salve-annos
Version:
A fork with support for documentation of Salve, a Javascript library which implements a validator able to validate an XML document on the basis of a subset of RelaxNG.
381 lines (333 loc) • 9.86 kB
Plain Text
/*!
* XRegExp Unicode Blocks 4.3.0
* <xregexp.com>
* Steven Levithan (c) 2010-present MIT License
* Unicode data by Mathias Bynens <mathiasbynens.be>
*/
/*!
* XRegExp Unicode Categories 4.3.0
* <xregexp.com>
* Steven Levithan (c) 2010-present MIT License
* Unicode data by Mathias Bynens <mathiasbynens.be>
*/
/**
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* A simplifier implemented in TypeScript (thus internal to Salve).
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Character class utilities for XML NS 1.0 edition 3.
*
* @author Louis-Dominique Dubeau
* @license MIT
* @copyright Louis-Dominique Dubeau
*/
/**
* Character classes and associated utilities for the 2nd edition of XML 1.1.
*
* @author Louis-Dominique Dubeau
* @license MIT
* @copyright Louis-Dominique Dubeau
*/
/**
* Character classes and associated utilities for the 5th edition of XML 1.0.
*
* @author Louis-Dominique Dubeau
* @license MIT
* @copyright Louis-Dominique Dubeau
*/
/**
* Class for XML Expanded Names.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Classes that model RNG patterns.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Classes that model datatypes used in RNG schemas.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*
*/
/**
* Collection of constants that model the way XML refers to various
* characters and groups of characters. This module is essentially private to
* salve.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Common tools for salve.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Errors that can be raised during parsing of types.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Facilities for loading resources.
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Implementation of the XMLSchema datatypes.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Implementation of the builtin Relax NG datatype library.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Implements a name resolver for handling namespace changes in XML.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern and walker for RNG's ``choice`` elements.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern and walker for RNG's ``data`` elements.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern and walker for RNG's ``element`` elements.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern and walker for RNG's ``empty`` elements.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern and walker for RNG's ``grammar`` elements.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern and walker for RNG's ``group`` elements.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern and walker for RNG's ``list`` elements.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern and walker for RNG's ``notAllowed`` elements.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern and walker for RNG's ``text`` elements.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Pattern for RNG's ``param`` element.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* RNG-based validator.
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* Set utilities.
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
* @private
*/
/**
* Simplification step 10.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Simplification step 14.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Simplification step 15.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Simplification step 16.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Simplification step 17.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Simplification step 18.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Simplification step 4.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Simplification step 6.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Simplification step 9.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Simplification support for trees produced by the parser module.
*
* This is an implementation in TypeScript of the XSLT pipeline we've been
* using. The step numbers are equivalent to those in the XSLT pipeline with the
* following exceptions:
*
* - Some steps are combined. The driving principles are:
*
* + Steps are not combined if a later step is entirely dependent on the work
* of an earlier step.
*
* + Steps are combined if they offer substantial performance benefits.
*
* Eventually the goal is to completely eliminate the XSLT pipeline. However,
* during the transition phase we aim for relative parity with what the XSLT
* pipeline does, in order to simplify testing. With a few small exceptions, we
* can provide an input to a step and expect the same output in the XSLT and
* TypeScript pipelines. So the TypeScript implementation may do things that
* appears senseless. For instance, at some point all ``define`` elements are
* renamed to make them unique, even those that do not have name clashes. We
* replicate the XSLT process, where only renaming clashing defines would be
* onerous. (It would also require the renaming operation to verify that new
* names do not clash with those names that are not changed. If we change all
* names, then this clash cannot occur.)
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* This is a module that converts XMLSchema regular expressions to
* plain JavaScript regular expressions.
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* This module contains classes for a conversion parser.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* This module contains classes for writing salve's internal schema format.
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* This module contains constants common to both reading and writing schemas in
* the JSON format internal to salve.
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* This module contains the logic for converting a simplified schema to a
* pattern.
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* This module contains utilities for reading salve's internal schema format.
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/
/**
* This module contains utilities used for converting Relax NG files to the
* format required by salve.
*
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*
*/
/**
* Utilities for simplification support for trees produced by the parser module.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright 2013, 2014 Mangalam Research Center for Buddhist Languages
*/
/**
* Validation errors.
* @author Louis-Dominique Dubeau
* @license MPL 2.0
* @copyright Mangalam Research Center for Buddhist Languages
*/