From 8bea15d8dae8e7a2b2e7c6cae215164b87b02ee2 Mon Sep 17 00:00:00 2001 From: Shahar Soel Date: Wed, 9 Mar 2016 19:11:39 +0200 Subject: [PATCH] release 0.5.20 --- .travis.yml | 4 ++-- bower.json | 2 +- docs/tutorial/step2_parsing.md | 16 ++++++++-------- docs/tutorial/step3_adding_actions.md | 6 +++--- docs/tutorial/step4_fault_tolerance.md | 10 +++++----- package.json | 2 +- readme.md | 2 +- release/chevrotain.d.ts | 3 ++- release/chevrotain.js | 12 +++++++++--- release/chevrotain.min.js | 8 ++++---- src/api.ts | 2 +- 11 files changed, 37 insertions(+), 30 deletions(-) diff --git a/.travis.yml b/.travis.yml index e89775a58..beef3bb19 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,8 +57,8 @@ deploy: api_key: secure: DNq1wbqLPHVpJPDx9O89HZM+RJB6v2R7/wk8pok7Z8NT72kUWdvbqcThGhczPO4sZ8cUTJ3ergTCE8hs9mynlR/lX6932U4fj4+uICQL9+G+deBB/t2SNyTBllkE64WrJ9BKmQvIk/Chh7ZJOM0Fro3p2BIq3JsVnfYg1tZ3U5o= file: - - package/chevrotain-binaries-0.5.19.zip - - package/chevrotain-binaries-0.5.19.tar.gz + - package/chevrotain-binaries-0.5.20.zip + - package/chevrotain-binaries-0.5.20.tar.gz on: tags : true all_branches: true diff --git a/bower.json b/bower.json index d76231de0..4a18508a3 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "chevrotain", - "version": "0.5.19", + "version": "0.5.20", "description": "Chevrotain is a high performance fault Tolerant Javascript parsing DSL for building recursive decent parsers", "main": "release/chevrotain.js", "dependencies": {}, diff --git a/docs/tutorial/step2_parsing.md b/docs/tutorial/step2_parsing.md index 82446518a..c89554c92 100644 --- a/docs/tutorial/step2_parsing.md +++ b/docs/tutorial/step2_parsing.md @@ -44,16 +44,16 @@ relationalOperator A Chevrotain Parser analyses a [Token](https://github.com/SAP/chevrotain/blob/master/src/scan/tokens_public.ts#L61) vector that conforms to some grammar. -The grammar is defined using the [parsing DSL](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#at_least_one), +The grammar is defined using the [parsing DSL](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#at_least_one), Which includes the following methods. -* [CONSUME](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#consume1) - 'eat' a Token. -* [SUBRULE](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#subrule1) - reference to another rule. -* [OPTION](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#option1) - optional production. -* [MANY](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#many1) - repetition zero or more. -* [AT_LEAST_ONE](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#at_least_one1) - repetition one or more. -* [MANY_SEP](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#many_sep1) - repetition (zero or more) with a separator between any two items -* [AT_LEAST_ONE_SEP](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#at_least_one_sep1) - repetition (one or more) with a separator between any two items +* [CONSUME](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#consume1) - 'eat' a Token. +* [SUBRULE](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#subrule1) - reference to another rule. +* [OPTION](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#option1) - optional production. +* [MANY](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#many1) - repetition zero or more. +* [AT_LEAST_ONE](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#at_least_one1) - repetition one or more. +* [MANY_SEP](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#many_sep1) - repetition (zero or more) with a separator between any two items +* [AT_LEAST_ONE_SEP](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#at_least_one_sep1) - repetition (one or more) with a separator between any two items #### Lets implement our first grammar rule. diff --git a/docs/tutorial/step3_adding_actions.md b/docs/tutorial/step3_adding_actions.md index 236da231e..fc16a4501 100644 --- a/docs/tutorial/step3_adding_actions.md +++ b/docs/tutorial/step3_adding_actions.md @@ -18,9 +18,9 @@ validates the input conforms to the grammar. In most real world use cases the pa result/data structure/value. This can be accomplished using two features of the Parsing DSL: -* [CONSUME](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#consume1) will return - The [Token](http://sap.github.io/chevrotain/documentation/0_5_19/classes/token.html) instance consumed. -* [SUBRULE](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#subrule1) will return +* [CONSUME](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#consume1) will return + The [Token](http://sap.github.io/chevrotain/documentation/0_5_20/classes/token.html) instance consumed. +* [SUBRULE](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#subrule1) will return the result on invoking the rule. diff --git a/docs/tutorial/step4_fault_tolerance.md b/docs/tutorial/step4_fault_tolerance.md index dc87dda4b..7c801886c 100644 --- a/docs/tutorial/step4_fault_tolerance.md +++ b/docs/tutorial/step4_fault_tolerance.md @@ -47,9 +47,9 @@ Therefore the missing colon will be automatically "inserted". This heuristic's behavior can be customized by the following methods: -* [canTokenTypeBeInsertedInRecovery](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#cantokentypebeinsertedinrecovery) +* [canTokenTypeBeInsertedInRecovery](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#cantokentypebeinsertedinrecovery) -* [getTokenToInsert](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#gettokentoinsert) +* [getTokenToInsert](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#gettokentoinsert) ### In Rule Single Token deletion: @@ -204,14 +204,14 @@ from the sub-rule we have recovered from. By default **undefined** will be returned from a recovered rule, however this should most likely be customize in any but the most simple cases. -Customization is done during the definition of the grammar [RULE](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#rule). +Customization is done during the definition of the grammar [RULE](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#rule). The third parameter(**invalidRet**) is a function which will be invoked to produce the returned value in case of re-sync recovery. ####Disabling Re-Sync Recovery: Re-Sync recovery is enabled by default for all rules. In some cases it may be appropriate to disable re-sync recovery for a specific rule. -This is (once again) done during the definition of the grammar [RULE](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#rule). +This is (once again) done during the definition of the grammar [RULE](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#rule). The fourth argument is a boolean which can be controls whether or not re-sync is enabled for the defined rule. @@ -224,7 +224,7 @@ additional definitions (what should be returned value of a re-synced rule?). ### Disabling All Recovery mechanisms By default fault tolerance and error recovery heuristics are enabled. They can be disabled by passing a optional **isErrorRecoveryEnabled** parameter (default true) -To the parser's constructor [constructor](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#constructor). +To the parser's constructor [constructor](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#constructor). #### What is Next? diff --git a/package.json b/package.json index 6e2b28f4b..2801f7f3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "chevrotain", - "version": "0.5.19", + "version": "0.5.20", "description": "Chevrotain is a high performance fault tolerant javascript parsing DSL for building recursive decent parsers", "keywords": [ "parser", diff --git a/readme.md b/readme.md index b6f3dd6e0..53dae31a9 100644 --- a/readme.md +++ b/readme.md @@ -57,7 +57,7 @@ any code generation phase. ## Documentation * [Latest released version's HTML docs](http://sap.github.io/chevrotain/documentation) - * [Parsing DSL](http://sap.github.io/chevrotain/documentation/0_5_19/classes/parser.html#at_least_one) + * [Parsing DSL](http://sap.github.io/chevrotain/documentation/0_5_20/classes/parser.html#at_least_one) * Annotated source code (dev version): * [tokens_public.ts](https://github.com/SAP/chevrotain/blob/master/src/scan/tokens_public.ts) diff --git a/release/chevrotain.d.ts b/release/chevrotain.d.ts index 9f3afc3e2..70b36dcc3 100644 --- a/release/chevrotain.d.ts +++ b/release/chevrotain.d.ts @@ -1,4 +1,4 @@ -/*! chevrotain - v0.5.19 - 2016-03-07 */ +/*! chevrotain - v0.5.20 - 2016-03-09 */ declare namespace chevrotain { class HashTable{} export function tokenName(clazz: Function): string; @@ -795,6 +795,7 @@ declare namespace chevrotain { visitRepetitionWithSeparator(node: RepetitionWithSeparator): void; visitAlternation(node: Alternation): void; visitTerminal(node: Terminal): void; + visitRule(node: Rule): void; } } diff --git a/release/chevrotain.js b/release/chevrotain.js index 67dad8771..02074898f 100644 --- a/release/chevrotain.js +++ b/release/chevrotain.js @@ -1,4 +1,4 @@ -/*! chevrotain - v0.5.19 - 2016-03-07 */ +/*! chevrotain - v0.5.20 - 2016-03-09 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') @@ -69,7 +69,7 @@ return /******/ (function(modules) { // webpackBootstrap */ var API = {}; // semantic version - API.VERSION = "0.5.19"; + API.VERSION = "0.5.20"; // runtime API API.Parser = parser_public_1.Parser; API.Lexer = lexer_public_1.Lexer; @@ -2179,9 +2179,14 @@ return /******/ (function(modules) { // webpackBootstrap } else if (node instanceof Terminal) { this.visitTerminal(node); + }/* istanbul ignore else */ + else if (node instanceof Rule) { + this.visitRule(node); + } + else { + /* istanbul ignore next */ throw Error("non exhaustive match"); } }; - /* istanbul ignore next */ // this is an "Abstract" method that does nothing, testing it is pointless. GAstVisitor.prototype.visitNonTerminal = function (node) { }; GAstVisitor.prototype.visitFlat = function (node) { }; GAstVisitor.prototype.visitOption = function (node) { }; @@ -2191,6 +2196,7 @@ return /******/ (function(modules) { // webpackBootstrap GAstVisitor.prototype.visitRepetitionWithSeparator = function (node) { }; GAstVisitor.prototype.visitAlternation = function (node) { }; GAstVisitor.prototype.visitTerminal = function (node) { }; + GAstVisitor.prototype.visitRule = function (node) { }; return GAstVisitor; }()); gast.GAstVisitor = GAstVisitor; diff --git a/release/chevrotain.min.js b/release/chevrotain.min.js index d487c19a0..a756482aa 100644 --- a/release/chevrotain.min.js +++ b/release/chevrotain.min.js @@ -1,4 +1,4 @@ -/*! chevrotain - v0.5.19 - 2016-03-07 */ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("chevrotain",[],e):"object"==typeof exports?exports.chevrotain=e():t.chevrotain=e()}(this,function(){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var r=e[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,__webpack_require__),r.loaded=!0,r.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.p="",__webpack_require__(0)}([function(t,e,n){"use strict";var r=n(1),i=n(11),o=n(10),a=n(5),s=n(7),c=n(21),u={};u.VERSION="0.5.19",u.Parser=r.Parser,u.Lexer=i.Lexer,u.Token=o.Token,u.VirtualToken=o.VirtualToken,u.EOF=o.EOF,u.extendToken=o.extendToken,u.tokenName=o.tokenName,u.EMPTY_ALT=r.EMPTY_ALT,u.exceptions={},u.exceptions.isRecognitionException=a.exceptions.isRecognitionException,u.exceptions.EarlyExitException=a.exceptions.EarlyExitException,u.exceptions.MismatchedTokenException=a.exceptions.MismatchedTokenException,u.exceptions.NotAllInputParsedException=a.exceptions.NotAllInputParsedException,u.exceptions.NoViableAltException=a.exceptions.NoViableAltException,u.gast={},u.gast.GAstVisitor=s.gast.GAstVisitor,u.gast.Flat=s.gast.Flat,u.gast.Repetition=s.gast.Repetition,u.gast.RepetitionWithSeparator=s.gast.RepetitionWithSeparator,u.gast.RepetitionMandatory=s.gast.RepetitionMandatory,u.gast.RepetitionMandatoryWithSeparator=s.gast.RepetitionMandatoryWithSeparator,u.gast.Option=s.gast.Option,u.gast.Alternation=s.gast.Alternation,u.gast.NonTerminal=s.gast.NonTerminal,u.gast.Terminal=s.gast.Terminal,u.gast.Rule=s.gast.Rule,u.clearCache=c.clearCache,t.exports=u},function(t,e,n){"use strict";function EMPTY_ALT(t){return void 0===t&&(t=void 0),function(){return t}}function InRuleRecoveryException(t){this.name=o.functionName(InRuleRecoveryException),this.message=t}var r=n(2),i=n(5),o=n(3),a=n(6),s=n(8),c=n(4),u=n(14),l=n(10),p=n(17),f=n(19),h=n(18),d=n(16);!function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.DUPLICATE_PRODUCTIONS=2]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=3]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=4]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=5]="NONE_LAST_EMPTY_ALT"}(e.ParserDefinitionErrorType||(e.ParserDefinitionErrorType={}));e.ParserDefinitionErrorType;e.EMPTY_ALT=EMPTY_ALT;var E={},A=function(){function Parser(t,e,n){if(void 0===n&&(n=!0),this.errors=[],this._input=[],this.inputIdx=-1,this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.tokensMap=void 0,this.definedRulesNames=[],this._input=t,this.isErrorRecoveryEnabled=n,this.className=o.classNameFromInstance(this),this.firstAfterRepMap=r.getFirstAfterRepForClass(this.className),this.classLAFuncs=r.getLookaheadFuncsForClass(this.className),r.CLASS_TO_DEFINITION_ERRORS.containsKey(this.className)?this.definitionErrors=r.CLASS_TO_DEFINITION_ERRORS.get(this.className):(this.definitionErrors=[],r.CLASS_TO_DEFINITION_ERRORS.put(this.className,this.definitionErrors)),c.isArray(e))this.tokensMap=c.reduce(e,function(t,e){return t[l.tokenName(e)]=e,t},{});else{if(!c.isObject(e))throw new Error("'tokensMapOrArr' argument must be An Array of Token constructors or a Dictionary of Tokens.");this.tokensMap=c.cloneObj(e)}this.tokensMap[l.tokenName(l.EOF)]=l.EOF,void 0===r.CLASS_TO_OR_LA_CACHE[this.className]&&r.initLookAheadKeyCache(this.className),this.orLookaheadKeys=r.CLASS_TO_OR_LA_CACHE[this.className],this.manyLookaheadKeys=r.CLASS_TO_MANY_LA_CACHE[this.className],this.manySepLookaheadKeys=r.CLASS_TO_MANY_SEP_LA_CACHE[this.className],this.atLeastOneLookaheadKeys=r.CLASS_TO_AT_LEAST_ONE_LA_CACHE[this.className],this.atLeastOneSepLookaheadKeys=r.CLASS_TO_AT_LEAST_ONE_SEP_LA_CACHE[this.className],this.optionLookaheadKeys=r.CLASS_TO_OPTION_LA_CACHE[this.className]}return Parser.performSelfAnalysis=function(t){var e,n=[],i=o.classNameFromInstance(t);if(""===i)throw Error("A Parser's constructor may not be an anonymous Function, it must be a named function\nThe constructor's name is used at runtime for performance (caching) purposes.");if(!r.CLASS_TO_SELF_ANALYSIS_DONE.containsKey(i)){var l=r.getProductionsForClass(i);n=r.CLASS_TO_DEFINITION_ERRORS.get(i);var p=a.resolveGrammar(l);n.push.apply(n,p),r.CLASS_TO_SELF_ANALYSIS_DONE.put(i,!0);var f=s.validateGrammar(l.values());if(n.push.apply(n,f),!c.isEmpty(n)&&!Parser.DEFER_DEFINITION_ERRORS_HANDLING)throw e=c.map(n,function(t){return t.message}),new Error("Parser Definition Errors detected\n: "+e.join("\n-------------------------------\n"));if(c.isEmpty(n)){var h=u.computeAllProdsFollows(l.values());r.setResyncFollowsForClass(i,h)}}if(!c.isEmpty(r.CLASS_TO_DEFINITION_ERRORS.get(i))&&!Parser.DEFER_DEFINITION_ERRORS_HANDLING)throw e=c.map(r.CLASS_TO_DEFINITION_ERRORS.get(i),function(t){return t.message}),new Error("Parser Definition Errors detected\n: "+e.join("\n-------------------------------\n"))},Object.defineProperty(Parser.prototype,"input",{get:function(){return c.cloneArr(this._input)},set:function(t){this.reset(),this._input=t},enumerable:!0,configurable:!0}),Parser.prototype.reset=function(){this.isBackTrackingStack=[],this.errors=[],this._input=[],this.inputIdx=-1,this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[]},Parser.prototype.isAtEndOfInput=function(){return this.LA(1)instanceof l.EOF},Parser.prototype.getGAstProductions=function(){return r.getProductionsForClass(this.className)},Parser.prototype.isBackTracking=function(){return!c.isEmpty(this.isBackTrackingStack)},Parser.prototype.SAVE_ERROR=function(t){if(i.exceptions.isRecognitionException(t))return this.errors.push(t),t;throw Error("trying to save an Error which is not a RecognitionException")},Parser.prototype.NEXT_TOKEN=function(){return this.LA(1)},Parser.prototype.LA=function(t){return this._input.length<=this.inputIdx+t?new l.EOF:this._input[this.inputIdx+t]},Parser.prototype.isNextRule=function(t){var e=r.getLookaheadFuncsForClass(this.className),n=e.get(t);if(void 0===n){var i=this.getGAstProductions().get(t);n=p.buildLookaheadForTopLevel(i),e.put(t,n)}return n.call(this)},Parser.prototype.BACKTRACK=function(t,e){var n=this;return function(){n.isBackTrackingStack.push(1);var r=n.saveRecogState();try{var o=t.call(n);return e(o)}catch(a){if(i.exceptions.isRecognitionException(a))return!1;throw a}finally{n.reloadRecogState(r),n.isBackTrackingStack.pop()}}},Parser.prototype.SKIP_TOKEN=function(){return this.inputIdx<=this._input.length-2?(this.inputIdx++,this.NEXT_TOKEN()):new l.EOF},Parser.prototype.CONSUME=function(t){return this.CONSUME1(t)},Parser.prototype.CONSUME1=function(t){return this.consumeInternal(t,1)},Parser.prototype.CONSUME2=function(t){return this.consumeInternal(t,2)},Parser.prototype.CONSUME3=function(t){return this.consumeInternal(t,3)},Parser.prototype.CONSUME4=function(t){return this.consumeInternal(t,4)},Parser.prototype.CONSUME5=function(t){return this.consumeInternal(t,5)},Parser.prototype.SUBRULE=function(t,e){return void 0===e&&(e=[]),this.SUBRULE1(t,e)},Parser.prototype.SUBRULE1=function(t,e){return void 0===e&&(e=[]),t.call(this,1,e)},Parser.prototype.SUBRULE2=function(t,e){return void 0===e&&(e=[]),t.call(this,2,e)},Parser.prototype.SUBRULE3=function(t,e){return void 0===e&&(e=[]),t.call(this,3,e)},Parser.prototype.SUBRULE4=function(t,e){return void 0===e&&(e=[]),t.call(this,4,e)},Parser.prototype.SUBRULE5=function(t,e){return void 0===e&&(e=[]),t.call(this,5,e)},Parser.prototype.OPTION=function(t,e){return this.OPTION1.call(this,t,e)},Parser.prototype.OPTION1=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(1)),this.optionInternal(t,e)},Parser.prototype.OPTION2=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(2)),this.optionInternal(t,e)},Parser.prototype.OPTION3=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(3)),this.optionInternal(t,e)},Parser.prototype.OPTION4=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(4)),this.optionInternal(t,e)},Parser.prototype.OPTION5=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(5)),this.optionInternal(t,e)},Parser.prototype.OR=function(t,e,n){return void 0===n&&(n=!1),this.OR1(t,e,n)},Parser.prototype.OR1=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,1,n)},Parser.prototype.OR2=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,2,n)},Parser.prototype.OR3=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,3,n)},Parser.prototype.OR4=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,4,n)},Parser.prototype.OR5=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,5,n)},Parser.prototype.MANY=function(t,e){return this.MANY1.call(this,t,e)},Parser.prototype.MANY1=function(t,e){this.manyInternal(this.MANY1,"MANY1",1,t,e)},Parser.prototype.MANY2=function(t,e){this.manyInternal(this.MANY2,"MANY2",2,t,e)},Parser.prototype.MANY3=function(t,e){this.manyInternal(this.MANY3,"MANY3",3,t,e)},Parser.prototype.MANY4=function(t,e){this.manyInternal(this.MANY4,"MANY4",4,t,e)},Parser.prototype.MANY5=function(t,e){this.manyInternal(this.MANY5,"MANY5",5,t,e)},Parser.prototype.MANY_SEP=function(t,e,n){return this.MANY_SEP1.call(this,t,e,n)},Parser.prototype.MANY_SEP1=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP1,"MANY_SEP1",1,t,e,n)},Parser.prototype.MANY_SEP2=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP2,"MANY_SEP2",2,t,e,n)},Parser.prototype.MANY_SEP3=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP3,"MANY_SEP3",3,t,e,n)},Parser.prototype.MANY_SEP4=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP4,"MANY_SEP4",4,t,e,n)},Parser.prototype.MANY_SEP5=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP5,"MANY_SEP5",5,t,e,n)},Parser.prototype.AT_LEAST_ONE=function(t,e,n){return this.AT_LEAST_ONE1.call(this,t,e,n)},Parser.prototype.AT_LEAST_ONE1=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE1,"AT_LEAST_ONE1",1,t,e,n)},Parser.prototype.AT_LEAST_ONE2=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE2,"AT_LEAST_ONE2",2,t,e,n)},Parser.prototype.AT_LEAST_ONE3=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE3,"AT_LEAST_ONE3",3,t,e,n)},Parser.prototype.AT_LEAST_ONE4=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE4,"AT_LEAST_ONE4",4,t,e,n)},Parser.prototype.AT_LEAST_ONE5=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE5,"AT_LEAST_ONE5",5,t,e,n)},Parser.prototype.AT_LEAST_ONE_SEP=function(t,e,n,r){return this.AT_LEAST_ONE_SEP1.call(this,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP1=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP1",1,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP2=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP2",2,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP3=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP3",3,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP4=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP4",4,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP5=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP5",5,t,e,n,r)},Parser.prototype.RULE_NO_RESYNC=function(t,e,n){return this.RULE(t,e,n,!1)},Parser.prototype.RULE=function(t,e,n,o){void 0===n&&(n=this.defaultInvalidReturn),void 0===o&&(o=!0);var a=s.validateRuleName(t,this.definedRulesNames,this.className);this.definedRulesNames.push(t),this.definitionErrors.push.apply(this.definitionErrors,a);var c=r.getProductionsForClass(this.className);if(!c.containsKey(t)){var u=f.buildTopProduction(e.toString(),t,this.tokensMap);c.put(t,u)}var l=function(r,a){void 0===r&&(r=1),void 0===a&&(a=[]),this.ruleInvocationStateUpdate(t,r);try{return e.apply(this,a)}catch(s){var c=1===this.RULE_STACK.length,u=c||o&&!this.isBackTracking()&&this.isErrorRecoveryEnabled;if(u&&i.exceptions.isRecognitionException(s)){var l=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(l))return this.reSyncTo(l),n();throw s}throw s}finally{this.ruleFinallyStateUpdate()}},p="ruleName";return l[p]=t,l},Parser.prototype.ruleInvocationStateUpdate=function(t,e){this.RULE_OCCURRENCE_STACK.push(e),this.RULE_STACK.push(t)},Parser.prototype.ruleFinallyStateUpdate=function(){this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop();var t=this._input.length-1;if(0===this.RULE_STACK.length&&this.inputIdx"+t+"<-- but found -->'"+c.image+"'<--";o.SAVE_ERROR(new i.exceptions.MismatchedTokenException(e,c))};!p;){if(u instanceof r)return void f();if(n.call(this))return f(),void t.apply(this,e);u instanceof a&&(p=!0),u=this.SKIP_TOKEN()}this.inputIdx=s},Parser.prototype.shouldInRepetitionRecoveryBeTried=function(t,e){return void 0===t||void 0===e?!1:this.NEXT_TOKEN()instanceof t?!1:this.isBackTracking()?!1:!this.canPerformInRuleRecovery(t,this.getFollowsForInRuleRecovery(t,e))},Parser.prototype.getFollowsForInRuleRecovery=function(t,e){var n=c.cloneArr(this.RULE_STACK),r=c.cloneArr(this.RULE_OCCURRENCE_STACK),i={ruleStack:n,occurrenceStack:r,lastTok:t,lastTokOccurrence:e},o=c.first(n),a=this.getGAstProductions(),s=a.get(o),u=new h.NextAfterTokenWalker(s,i).startWalking();return u},Parser.prototype.tryInRuleRecovery=function(t,e){if(this.canRecoverWithSingleTokenInsertion(t,e)){var n=this.getTokenToInsert(t);return n.isInsertedInRecovery=!0,n}if(this.canRecoverWithSingleTokenDeletion(t)){var r=this.SKIP_TOKEN();return this.inputIdx++,r}throw new InRuleRecoveryException("sad sad panda")},Parser.prototype.canPerformInRuleRecovery=function(t,e){return this.canRecoverWithSingleTokenInsertion(t,e)||this.canRecoverWithSingleTokenDeletion(t)},Parser.prototype.canRecoverWithSingleTokenInsertion=function(t,e){if(!this.canTokenTypeBeInsertedInRecovery(t))return!1;if(c.isEmpty(e))return!1;var n=this.NEXT_TOKEN(),r=void 0!==c.find(e,function(t){return n instanceof t});return r},Parser.prototype.canRecoverWithSingleTokenDeletion=function(t){var e=this.LA(2)instanceof t;return e},Parser.prototype.isInCurrentRuleReSyncSet=function(t){var e=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(e);return c.contains(n,t)},Parser.prototype.findReSyncTokenType=function(){for(var t=this.flattenFollowSet(),e=this.NEXT_TOKEN(),n=2;;){var r=e.constructor;if(c.contains(t,r))return r;e=this.LA(n),n++}},Parser.prototype.getCurrFollowKey=function(){if(1===this.RULE_STACK.length)return E;var t=this.RULE_STACK.length-1,e=t,n=t-1;return{ruleName:this.RULE_STACK[t],idxInCallingRule:this.RULE_OCCURRENCE_STACK[e],inRule:this.RULE_STACK[n]}},Parser.prototype.buildFullFollowKeyStack=function(){var t=this;return c.map(this.RULE_STACK,function(e,n){return 0===n?E:{ruleName:e,idxInCallingRule:t.RULE_OCCURRENCE_STACK[n],inRule:t.RULE_STACK[n-1]}})},Parser.prototype.flattenFollowSet=function(){var t=this,e=c.map(this.buildFullFollowKeyStack(),function(e){return t.getFollowSetFromFollowKey(e)});return c.flatten(e)},Parser.prototype.getFollowSetFromFollowKey=function(t){if(t===E)return[l.EOF];var e=t.ruleName+t.idxInCallingRule+d.IN+t.inRule;return r.getResyncFollowsForClass(this.className).get(e)},Parser.prototype.reSyncTo=function(t){for(var e=this.NEXT_TOKEN();e instanceof t==!1;)e=this.SKIP_TOKEN()},Parser.prototype.attemptInRepetitionRecovery=function(t,e,n,r,i,o,a){var s=this.getKeyForAutomaticLookahead(r,a,i),u=this.firstAfterRepMap.get(s);if(void 0===u){var p=c.last(this.RULE_STACK),f=this.getGAstProductions().get(p),h=new o(f,i);u=h.startWalking(),this.firstAfterRepMap.put(s,u)}var d=u.token,E=u.occurrence,A=u.isEndOfRule;1===this.RULE_STACK.length&&A&&void 0===d&&(d=l.EOF,E=1),this.shouldInRepetitionRecoveryBeTried(d,E)&&this.tryInRepetitionRecovery(t,e,n,d)},Parser.prototype.optionInternal=function(t,e){return t.call(this)?(e.call(this),!0):!1},Parser.prototype.atLeastOneInternal=function(t,e,n,r,o,a){if(c.isString(o)&&(a=o,o=r,r=this.getLookaheadFuncForAtLeastOne(n)),!r.call(this))throw this.SAVE_ERROR(new i.exceptions.EarlyExitException("expecting at least one: "+a,this.NEXT_TOKEN()));for(o.call(this);r.call(this);)o.call(this);this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(t,[r,o,a],r,e,n,h.NextTerminalAfterAtLeastOneWalker,this.atLeastOneLookaheadKeys)},Parser.prototype.atLeastOneSepFirstInternal=function(t,e,n,r,o,a,s){var u=this,l=[];if(c.isString(a)&&(s=a,a=o,o=this.getLookaheadFuncForAtLeastOneSep(n)),!o.call(this))throw this.SAVE_ERROR(new i.exceptions.EarlyExitException("expecting at least one: "+s,this.NEXT_TOKEN()));a.call(this);for(var p=function(){return u.NEXT_TOKEN()instanceof r};p();)l.push(this.CONSUME(r)),a.call(this);return this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,p,a,l,this.atLeastOneSepLookaheadKeys,h.NextTerminalAfterAtLeastOneSepWalker],p,e,n,h.NextTerminalAfterAtLeastOneSepWalker,this.atLeastOneSepLookaheadKeys),l},Parser.prototype.manyInternal=function(t,e,n,r,i){for(void 0===i&&(i=r,r=this.getLookaheadFuncForMany(n));r.call(this);)i.call(this);this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(t,[r,i],r,e,n,h.NextTerminalAfterManyWalker,this.manyLookaheadKeys)},Parser.prototype.manySepFirstInternal=function(t,e,n,r,i,o){var a=this,s=[];if(void 0===o&&(o=i,i=this.getLookaheadFuncForManySep(n)),i.call(this)){o.call(this);for(var c=function(){return a.NEXT_TOKEN()instanceof r};c();)s.push(this.CONSUME(r)),o.call(this);this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,c,o,s,this.manySepLookaheadKeys,h.NextTerminalAfterManySepWalker],c,e,n,h.NextTerminalAfterManySepWalker,this.manySepLookaheadKeys)}return s},Parser.prototype.repetitionSepSecondInternal=function(t,e,n,r,i,o,a,s){for(;r();)o.push(this.CONSUME(n)),i.call(this);this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,e,n,r,i,o,a,s],r,t,e,s,a)},Parser.prototype.orInternal=function(t,e,n,r){if(void 0!==t[0].WHEN){for(var i=0;i"+n+"<-- but found -->'"+e.image+"'<--";throw this.SAVE_ERROR(new i.exceptions.MismatchedTokenException(r,e))},Parser.prototype.getKeyForAutomaticLookahead=function(t,e,n){var r=e[n-1],i=c.last(this.RULE_STACK),o=r[i];return void 0===o&&(o=t+n+d.IN+i,r[i]=o),o},Parser.prototype.getLookaheadFuncForOption=function(t){var e=this.getKeyForAutomaticLookahead("OPTION",this.optionLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForOption)},Parser.prototype.getLookaheadFuncForOr=function(t,e){var n=this.getKeyForAutomaticLookahead("OR",this.orLookaheadKeys,t);return this.getLookaheadFuncFor(n,t,p.buildLookaheadForOr,[e])},Parser.prototype.getLookaheadFuncForMany=function(t){var e=this.getKeyForAutomaticLookahead("MANY",this.manyLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForMany)},Parser.prototype.getLookaheadFuncForManySep=function(t){var e=this.getKeyForAutomaticLookahead("MANY_SEP",this.manySepLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForManySep)},Parser.prototype.getLookaheadFuncForAtLeastOne=function(t){var e=this.getKeyForAutomaticLookahead("AT_LEAST_ONE",this.atLeastOneLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForAtLeastOne)},Parser.prototype.getLookaheadFuncForAtLeastOneSep=function(t){var e=this.getKeyForAutomaticLookahead("AT_LEAST_ONE_SEP",this.atLeastOneSepLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForAtLeastOneSep)},Parser.prototype.getLookaheadFuncFor=function(t,e,n,r){void 0===r&&(r=[]);var i=c.last(this.RULE_STACK),o=this.classLAFuncs.get(t);if(void 0===o){var a=this.getGAstProductions().get(i);o=n.apply(null,[e,a].concat(r)),this.classLAFuncs.put(t,o)}return o},Parser.prototype.saveRecogState=function(){var t=c.cloneArr(this.errors),e=c.cloneArr(this.RULE_STACK);return{errors:t,inputIdx:this.inputIdx,RULE_STACK:e}},Parser.prototype.reloadRecogState=function(t){this.errors=t.errors,this.inputIdx=t.inputIdx,this.RULE_STACK=t.RULE_STACK},Parser.prototype.raiseNoAltException=function(t,e){var n=" but found: '"+this.NEXT_TOKEN().image+"'";if(void 0===e){var r=c.last(this.RULE_STACK),o=this.getGAstProductions().get(r),a=new h.NextInsideOrWalker(o,t).startWalking(),s=c.flatten(a),u=c.map(s,function(t){return l.tokenName(t)});e="one of: <"+u.join(" ,")+">"}throw this.SAVE_ERROR(new i.exceptions.NoViableAltException("expecting: "+e+" "+n,this.NEXT_TOKEN()))},Parser.IGNORE_AMBIGUITIES=!0,Parser.NO_RESYNC=!1,Parser.DEFER_DEFINITION_ERRORS_HANDLING=!1,Parser}();e.Parser=A,InRuleRecoveryException.prototype=Error.prototype},function(t,e,n){"use strict";function getProductionsForClass(t){return getFromNestedHashTable(t,e.CLASS_TO_GRAMMAR_PRODUCTIONS)}function getResyncFollowsForClass(t){return getFromNestedHashTable(t,e.CLASS_TO_RESYNC_FOLLOW_SETS)}function setResyncFollowsForClass(t,n){e.CLASS_TO_RESYNC_FOLLOW_SETS.put(t,n)}function getLookaheadFuncsForClass(t){return getFromNestedHashTable(t,e.CLASS_TO_LOOKAHEAD_FUNCS)}function getFirstAfterRepForClass(t){return getFromNestedHashTable(t,e.CLASS_TO_FIRST_AFTER_REPETITION)}function initLookAheadKeyCache(t){e.CLASS_TO_OR_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_MANY_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_MANY_SEP_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_AT_LEAST_ONE_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_AT_LEAST_ONE_SEP_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_OPTION_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),initSingleLookAheadKeyCache(e.CLASS_TO_OR_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_MANY_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_MANY_SEP_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_AT_LEAST_ONE_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_AT_LEAST_ONE_SEP_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_OPTION_LA_CACHE[t])}function initSingleLookAheadKeyCache(t){for(var n=0;n1}),c=i.map(i.values(a),function(e){var n=i.first(e),r=createDuplicatesErrorMessage(e,t.name),a=s.getProductionDslName(n),c={message:r,type:o.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:a,occurrence:n.occurrenceInParent},u=getExtraProductionArgument(n);return u&&(c.parameter=u),c});return c}function createDuplicatesErrorMessage(t,e){var n=i.first(t),r=n.occurrenceInParent,o=s.getProductionDslName(n),a=getExtraProductionArgument(n),c="->"+o+"<- with occurrence index: ->"+r+"<-\n "+(a?"and argument: "+a:"")+"\n appears more than once ("+t.length+" times) in the top level rule: "+e+".\n "+(1===r?"note that "+o+" and "+o+"1 both have the same occurrence index 1}":"")+"}\n to fix this make sure each usage of "+o+" "+(a?"with the argument: "+a:"")+"\n in the rule "+e+" has a different occurrence index (1-5), as that combination acts as a unique\n position key in the grammar, which is needed by the parsing engine.";return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,"\n")}function identifyProductionForDuplicates(t){return s.getProductionDslName(t)+"_#_"+t.occurrenceInParent+"_#_"+getExtraProductionArgument(t)}function getExtraProductionArgument(t){return t instanceof a.gast.Terminal?c.tokenName(t.terminalType):t instanceof a.gast.NonTerminal?t.nonTerminalName:""}function validateRuleName(t,e,n){var r,a=[];return t.match(p)||(r="Invalid Grammar rule name --> "+t+" it must match the pattern: "+p.toString(),a.push({message:r,type:o.ParserDefinitionErrorType.INVALID_RULE_NAME,ruleName:t})),i.contains(e,t)&&(r="Duplicate definition, rule: "+t+" is already defined in the grammar: "+n,a.push({message:r,type:o.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:t})),a}function validateNoLeftRecursion(t,e,n){void 0===n&&(n=[]);var r=[],a=getFirstNoneTerminal(e.definition);if(i.isEmpty(a))return[];var s=t.name,c=i.contains(a,t),u=i.map(n,function(t){return t.name}),l=s+" --> "+u.concat([s]).join(" --> ");if(c){var p="Left Recursion found in grammar.\n"+("rule: <"+s+"> can be invoked from itself (directly or indirectly)\n")+("without consuming any Tokens. The grammar path that causes this is: \n "+l+"\n")+" To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.";r.push({message:p,type:o.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:s})}var f=i.difference(a,n.concat([t])),h=i.map(f,function(e){var r=i.cloneArr(n);return r.push(e),validateNoLeftRecursion(t,e,r)});return r.concat(i.flatten(h))}function getFirstNoneTerminal(t){var e=[];if(i.isEmpty(t))return e;var n=i.first(t);if(n instanceof a.gast.NonTerminal){if(void 0===n.referencedRule)return e;e.push(n.referencedRule)}else if(n instanceof a.gast.Flat||n instanceof a.gast.Option||n instanceof a.gast.RepetitionMandatory||n instanceof a.gast.RepetitionMandatoryWithSeparator||n instanceof a.gast.RepetitionWithSeparator||n instanceof a.gast.Repetition)e=e.concat(getFirstNoneTerminal(n.definition));else if(n instanceof a.gast.Alternation)e=i.flatten(i.map(n.definition,function(t){return getFirstNoneTerminal(t.definition)}));else if(!(n instanceof a.gast.Terminal))throw Error("non exhaustive match");var r=s.isOptionalProd(n),o=t.length>1;if(r&&o){var c=i.drop(t);return e.concat(getFirstNoneTerminal(c))}return e}function validateEmptyOrAlternative(t){var e=new f;t.accept(e);var n=e.alternations,r=i.reduce(n,function(e,n){var r=i.dropRight(n.definition),a=i.map(r,function(e,r){return i.isEmpty(u.first(e))?{message:"Ambiguous empty alternative: <"+(r+1)+">"+(" in inside <"+t.name+"> Rule.\n")+"Only the last alternative may be an empty alternative.",type:o.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:n.occurrenceInParent,alternative:r+1}:null});return e.concat(i.compact(a))},[]);return r}var r=this&&this.__extends||function(t,e){function __(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)},i=n(4),o=n(1),a=n(7),s=n(9),c=n(10),u=n(13);e.validateGrammar=validateGrammar,e.identifyProductionForDuplicates=identifyProductionForDuplicates;var l=function(t){function OccurrenceValidationCollector(){t.apply(this,arguments),this.allProductions=[]}return r(OccurrenceValidationCollector,t),OccurrenceValidationCollector.prototype.visitNonTerminal=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitOption=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitRepetition=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitAlternation=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitTerminal=function(t){this.allProductions.push(t)},OccurrenceValidationCollector}(a.gast.GAstVisitor);e.OccurrenceValidationCollector=l;var p=/^[a-zA-Z_]\w*$/;e.validateRuleName=validateRuleName,e.validateNoLeftRecursion=validateNoLeftRecursion,e.getFirstNoneTerminal=getFirstNoneTerminal;var f=function(t){function OrCollector(){t.apply(this,arguments),this.alternations=[]}return r(OrCollector,t),OrCollector.prototype.visitAlternation=function(t){this.alternations.push(t)},OrCollector}(a.gast.GAstVisitor);e.validateEmptyOrAlternative=validateEmptyOrAlternative},function(t,e,n){"use strict";function isSequenceProd(t){return t instanceof r.gast.Flat||t instanceof r.gast.Option||t instanceof r.gast.Repetition||t instanceof r.gast.RepetitionMandatory||t instanceof r.gast.RepetitionMandatoryWithSeparator||t instanceof r.gast.RepetitionWithSeparator||t instanceof r.gast.Terminal||t instanceof r.gast.Rule}function isOptionalProd(t,e){void 0===e&&(e=[]);var n=t instanceof r.gast.Option||t instanceof r.gast.Repetition||t instanceof r.gast.RepetitionWithSeparator;return n?!0:t instanceof r.gast.Alternation?i.some(t.definition,function(t){return isOptionalProd(t,e)}):t instanceof r.gast.NonTerminal&&i.contains(e,t)?!1:t instanceof r.gast.AbstractProduction?(t instanceof r.gast.NonTerminal&&e.push(t),i.every(t.definition,function(t){return isOptionalProd(t,e)})):!1}function isBranchingProd(t){return t instanceof r.gast.Alternation}function getProductionDslName(t){var e=t.constructor,n=o.functionName(e);return a[n]}var r=n(7),i=n(4),o=n(3);e.isSequenceProd=isSequenceProd,e.isOptionalProd=isOptionalProd,e.isBranchingProd=isBranchingProd;var a={};a[o.functionName(r.gast.NonTerminal)]="SUBRULE",a[o.functionName(r.gast.Option)]="OPTION",a[o.functionName(r.gast.RepetitionMandatory)]="AT_LEAST_ONE",a[o.functionName(r.gast.RepetitionMandatoryWithSeparator)]="AT_LEAST_ONE_SEP",a[o.functionName(r.gast.RepetitionWithSeparator)]="MANY_SEP",a[o.functionName(r.gast.Repetition)]="MANY",a[o.functionName(r.gast.Alternation)]="OR",a[o.functionName(r.gast.Terminal)]="CONSUME",e.getProductionDslName=getProductionDslName},function(t,e,n){"use strict";function tokenName(t){return i.isString(t.tokenName)?t.tokenName:o.functionName(t)}function extendToken(t,e,n){void 0===e&&(e=void 0),void 0===n&&(n=s);var r;i.isRegExp(e)||e===a.Lexer.SKIPPED||e===a.Lexer.NA?r=e:i.isFunction(e)&&(n=e,r=void 0);var o=function(){n.apply(this,arguments)};return o=i.assign(o,n),o.tokenName=t,o.prototype=Object.create(n.prototype),o.prototype.constructor=o,i.isUndefined(r)||(o.PATTERN=r),o}var r=this&&this.__extends||function(t,e){function __(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)},i=n(4),o=n(3),a=n(11);e.tokenName=tokenName,e.extendToken=extendToken;var s=function(){function Token(t,e,n,r,i,o){void 0===i&&(i=n),void 0===o&&(o=r+t.length-1),this.image=t,this.offset=e,this.startLine=n,this.startColumn=r,this.endLine=i,this.endColumn=o,this.isInsertedInRecovery=!1}return Token}();e.Token=s;var c=function(t){function VirtualToken(){t.call(this,"",-1,-1,-1,-1,-1)}return r(VirtualToken,t),VirtualToken}(s);e.VirtualToken=c;var u=function(t){function EOF(){t.apply(this,arguments)}return r(EOF,t),EOF}(c);e.EOF=u},function(t,e,n){"use strict";var r=n(12),i=n(4);!function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND"}(e.LexerDefinitionErrorType||(e.LexerDefinitionErrorType={}));var o=(e.LexerDefinitionErrorType,function(){function Lexer(t,e){if(void 0===e&&(e=!1),this.tokenClasses=t,this.lexerDefinitionErrors=[],this.lexerDefinitionErrors=r.validatePatterns(t),!i.isEmpty(this.lexerDefinitionErrors)&&!e){var n=i.map(this.lexerDefinitionErrors,function(t){return t.message}),o=n.join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+o)}if(i.isEmpty(this.lexerDefinitionErrors)){var a=r.analyzeTokenClasses(t);this.allPatterns=a.allPatterns,this.patternIdxToClass=a.patternIdxToClass,this.patternIdxToGroup=a.patternIdxToGroup,this.patternIdxToLongerAltIdx=a.patternIdxToLongerAltIdx,this.patternIdxToCanLineTerminator=a.patternIdxToCanLineTerminator,this.emptyGroups=a.emptyGroups}}return Lexer.prototype.tokenize=function(t){var e,n,o,a,s,c,u,l,p,f,h,d,E,A,T,y,O,N,R=t,_=0,g=[],m=[],v=1,S=1,P=i.cloneObj(this.emptyGroups);if(!i.isEmpty(this.lexerDefinitionErrors)){var L=i.map(this.lexerDefinitionErrors,function(t){return t.message}),k=L.join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+k)}for(;t.length>0;){for(e=null,n=0;ne[0].length&&(e=a,n=s));break}if(null!==e){if(c=e[0],u=c.length,l=this.patternIdxToGroup[n],void 0!==l&&(p=this.patternIdxToClass[n],f=new p(c,_,v,S),"default"===l?g.push(f):P[l].push(f)),t=t.slice(u),_+=u,S+=u,d=this.patternIdxToCanLineTerminator[n]){var I=r.countLineTerminators(c);if(0!==I){for(v+=I,y=u-1;y>=0&&(A=c.charCodeAt(y),13!==A&&10!==A);)y--;S=u-y,void 0!==l&&(N=y===u-1,E=N?-1:0,1===I&&N||(f.endLine=v+E,f.endColumn=S-1+-E))}}}else{for(var x=_,F=v,C=S,w=!1;!w&&t.length>0;)for(T=t.charCodeAt(0),10===T||13===T&&(1===t.length||t.length>1&&10!==t.charCodeAt(1))?(v++,S=1):S++,t=t.substr(1),_++,o=0;o"+R.charAt(x)+"<- at offset: "+x+","+(" skipped "+(_-x)+" characters."),m.push({line:F,column:C,length:h,message:O})}}return{tokens:g,groups:P,errors:m}},Lexer.SKIPPED={description:"This marks a skipped Token pattern, this means each token identified by it willbe consumed and then throw into oblivion, this can be used to for example: skip whitespace."},Lexer.NA=/NOT_APPLICABLE/,Lexer}());e.Lexer=o},function(t,e,n){"use strict";function analyzeTokenClasses(t){var e=o.reject(t,function(t){return t[a]===i.Lexer.NA}),n=o.map(e,function(t){return addStartOfInput(t[a])}),r=o.zipObject(n,e),s=o.map(n,function(t){return r[t.toString()]}),c=o.map(e,function(t){var e=t.GROUP;if(e!==i.Lexer.SKIPPED){if(o.isString(e))return e;if(o.isUndefined(e))return"default";throw Error("non exhaustive match")}}),u=o.map(e,function(t){var n=t.LONGER_ALT;if(n){var r=o.indexOf(e,n);return r}}),l=o.map(n,function(t){return/\\n|\\r|\\s/g.test(t.source)}),p=o.reduce(e,function(t,e){var n=e.GROUP;return o.isString(n)&&(t[n]=[]),t},{});return{allPatterns:n,patternIdxToClass:s,patternIdxToGroup:c,patternIdxToLongerAltIdx:u,patternIdxToCanLineTerminator:l,emptyGroups:p}}function validatePatterns(t){var e=[],n=findMissingPatterns(t),r=n.validTokenClasses;e=e.concat(n.errors);var i=findInvalidPatterns(r);return r=i.validTokenClasses,e=e.concat(i.errors),e=e.concat(findEndOfInputAnchor(r)),e=e.concat(findUnsupportedFlags(r)),e=e.concat(findDuplicatePatterns(r)),e=e.concat(findInvalidGroupType(r))}function findMissingPatterns(t){var e=o.filter(t,function(t){return!o.has(t,a)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- missing static 'PATTERN' property",type:i.LexerDefinitionErrorType.MISSING_PATTERN,tokenClasses:[t]}}),s=o.difference(t,e);return{errors:n,validTokenClasses:s}}function findInvalidPatterns(t){var e=o.filter(t,function(t){var e=t[a];return!o.isRegExp(e)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- static 'PATTERN' can only be a RegExp",type:i.LexerDefinitionErrorType.INVALID_PATTERN,tokenClasses:[t]}}),s=o.difference(t,e);return{errors:n,validTokenClasses:s}}function findEndOfInputAnchor(t){var e=o.filter(t,function(t){var e=t[a];return s.test(e.source)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- static 'PATTERN' cannot contain end of input anchor '$'",type:i.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenClasses:[t]}});return n}function findUnsupportedFlags(t){var e=o.filter(t,function(t){var e=t[a];return e instanceof RegExp&&(e.multiline||e.global)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:i.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenClasses:[t]}});return n}function findDuplicatePatterns(t){var e=[],n=o.map(t,function(n){return o.reduce(t,function(t,r){return n.PATTERN.source!==r.PATTERN.source||o.contains(e,r)||r.PATTERN===i.Lexer.NA?t:(e.push(r),t.push(r),t)},[])});n=o.compact(n);var a=o.filter(n,function(t){return t.length>1}),s=o.map(a,function(t){var e=o.map(t,function(t){return r.tokenName(t)}),n=o.first(t).PATTERN;return{message:"The same RegExp pattern ->"+n+"<-"+("has been used in all the following classes: "+e.join(", ")+" <-"),type:i.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenClasses:t}});return s}function findInvalidGroupType(t){var e=o.filter(t,function(t){if(!o.has(t,"GROUP"))return!1;var e=t.GROUP;return e!==i.Lexer.SKIPPED&&e!==i.Lexer.NA&&!o.isString(e)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:i.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenClasses:[t]}});return n}function addStartOfInput(t){var e=t.ignoreCase?"i":"";return new RegExp("^(?:"+t.source+")",e)}function countLineTerminators(t){for(var e=0,n=0;na,c=!0;s&&c;)e=r[a],c=i.isOptionalProd(e),n=n.concat(first(e)),a+=1,s=r.length>a;return o.uniq(n)}function firstForBranching(t){var e=o.map(t.definition,function(t){return first(t)});return o.uniq(o.flatten(e))}function firstForTerminal(t){return[t.terminalType]}var r=n(7),i=n(9),o=n(4);e.first=first,e.firstForSequence=firstForSequence,e.firstForBranching=firstForBranching,e.firstForTerminal=firstForTerminal},function(t,e,n){"use strict";function computeAllProdsFollows(t){var e=new o.HashTable;return c.forEach(t,function(t){var n=new p(t).startWalking();e.putAll(n)}),e}function buildBetweenProdsFollowPrefix(t,e){return t.name+e+u.IN}function buildInProdFollowPrefix(t){var e=l.tokenName(t.terminalType);return e+t.occurrenceInParent+u.IN}var r=this&&this.__extends||function(t,e){function __(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)},i=n(15),o=n(3),a=n(7),s=n(13),c=n(4),u=n(16),l=n(10),p=function(t){function ResyncFollowsWalker(e){t.call(this),this.topProd=e,this.follows=new o.HashTable}return r(ResyncFollowsWalker,t),ResyncFollowsWalker.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},ResyncFollowsWalker.prototype.walkTerminal=function(t,e,n){},ResyncFollowsWalker.prototype.walkProdRef=function(t,e,n){var r=buildBetweenProdsFollowPrefix(t.referencedRule,t.occurrenceInParent)+this.topProd.name,i=e.concat(n),o=new a.gast.Flat(i),c=s.first(o);this.follows.put(r,c)},ResyncFollowsWalker}(i.RestWalker);e.ResyncFollowsWalker=p,e.computeAllProdsFollows=computeAllProdsFollows,e.buildBetweenProdsFollowPrefix=buildBetweenProdsFollowPrefix,e.buildInProdFollowPrefix=buildInProdFollowPrefix},function(t,e,n){"use strict";function restForRepetitionWithSeparator(t,e,n){var i=[new r.gast.Option([new r.gast.Terminal(t.separator)].concat(t.definition))],o=i.concat(e,n);return o}var r=n(7),i=n(4),o=function(){function RestWalker(){}return RestWalker.prototype.walk=function(t,e){var n=this;void 0===e&&(e=[]),i.forEach(t.definition,function(o,a){var s=i.drop(t.definition,a+1);if(o instanceof r.gast.NonTerminal)n.walkProdRef(o,s,e);else if(o instanceof r.gast.Terminal)n.walkTerminal(o,s,e);else if(o instanceof r.gast.Flat)n.walkFlat(o,s,e);else if(o instanceof r.gast.Option)n.walkOption(o,s,e);else if(o instanceof r.gast.RepetitionMandatory)n.walkAtLeastOne(o,s,e);else if(o instanceof r.gast.RepetitionMandatoryWithSeparator)n.walkAtLeastOneSep(o,s,e);else if(o instanceof r.gast.RepetitionWithSeparator)n.walkManySep(o,s,e);else if(o instanceof r.gast.Repetition)n.walkMany(o,s,e);else{if(!(o instanceof r.gast.Alternation))throw Error("non exhaustive match");n.walkOr(o,s,e)}})},RestWalker.prototype.walkTerminal=function(t,e,n){},RestWalker.prototype.walkProdRef=function(t,e,n){},RestWalker.prototype.walkFlat=function(t,e,n){var r=e.concat(n);this.walk(t,r)},RestWalker.prototype.walkOption=function(t,e,n){var r=e.concat(n);this.walk(t,r)},RestWalker.prototype.walkAtLeastOne=function(t,e,n){var i=[new r.gast.Option(t.definition)].concat(e,n);this.walk(t,i)},RestWalker.prototype.walkAtLeastOneSep=function(t,e,n){var r=restForRepetitionWithSeparator(t,e,n);this.walk(t,r)},RestWalker.prototype.walkMany=function(t,e,n){var i=[new r.gast.Option(t.definition)].concat(e,n);this.walk(t,i)},RestWalker.prototype.walkManySep=function(t,e,n){var r=restForRepetitionWithSeparator(t,e,n);this.walk(t,r)},RestWalker.prototype.walkOr=function(t,e,n){var o=this,a=e.concat(n);i.forEach(t.definition,function(t){var e=new r.gast.Flat([t]);o.walk(e,a)})},RestWalker}();e.RestWalker=o},function(t,e){"use strict";e.IN="_~IN~_"},function(t,e,n){"use strict";function buildLookaheadForTopLevel(t){var e=new r.gast.Flat(t.definition),n=i.first(e);return getSimpleLookahead(n)}function buildLookaheadForOption(t,e){return buildLookAheadForGrammarProd(o.NextInsideOptionWalker,t,e)}function buildLookaheadForMany(t,e){return buildLookAheadForGrammarProd(o.NextInsideManyWalker,t,e)}function buildLookaheadForManySep(t,e){return buildLookAheadForGrammarProd(o.NextInsideManySepWalker,t,e)}function buildLookaheadForAtLeastOne(t,e){return buildLookAheadForGrammarProd(o.NextInsideAtLeastOneWalker,t,e)}function buildLookaheadForAtLeastOneSep(t,e){return buildLookAheadForGrammarProd(o.NextInsideAtLeastOneSepWalker,t,e)}function buildLookaheadForOr(t,e,n){void 0===n&&(n=!1);var r=new o.NextInsideOrWalker(e,t).startWalking();n||checkForOrAmbiguities(r,t,e);var i=a.isEmpty(a.last(r));if(i){var s=r.length-1;return function(){for(var t=this.NEXT_TOKEN(),e=0;s>e;e++)for(var n=r[e],i=0;i in inside <"+n.name+"> "+("Rule, <"+s.tokenName(t.token)+"> may appears as the first Terminal in all these alternatives.\n")});throw new Error(i.join("\n ---------------- \n")+"To Resolve this, either: \n1. refactor your grammar to be LL(1)\n2. provide explicit lookahead functions in the form {WHEN:laFunc, THEN_DO:...}\n3. Add ignore arg to this OR Production:\nOR([], 'msg', recognizer.IGNORE_AMBIGUITIES)\nIn that case the parser will always pick the first alternative that matches and ignore all the others")}}function checkAlternativesAmbiguities(t){var e=a.flatten(t),n=a.uniq(e),r=a.map(n,function(e){var n=a.pick(t,function(t){return a.find(t,function(t){return t===e})}),r=a.map(a.keys(n),function(t){return parseInt(t,10)+1});return{token:e,alts:r}}),i=a.filter(r,function(t){return t.alts.length>1});return i}function buildLookAheadForGrammarProd(t,e,n){var r={ruleStack:[n.name],occurrenceStack:[1],occurrence:e},i=new t(n,r),o=i.startWalking();return getSimpleLookahead(o)}function getSimpleLookahead(t){return function(){for(var e=this.NEXT_TOKEN(),n=0;nt||t>e)}var n=function(){function Range(t,e){if(this.start=t,this.end=e,!isValidRange(t,e))throw new Error("INVALID RANGE")}return Range.prototype.contains=function(t){return this.start<=t&&this.end>=t},Range.prototype.containsRange=function(t){return this.start<=t.start&&this.end>=t.end},Range.prototype.isContainedInRange=function(t){return t.containsRange(this)},Range.prototype.strictlyContainsRange=function(t){return this.startt.end},Range.prototype.isStrictlyContainedInRange=function(t){return t.strictlyContainsRange(this)},Range}();e.Range=n,e.isValidRange=isValidRange},function(t,e,n){"use strict";function clearCache(){r.clearCache()}var r=n(2);e.clearCache=clearCache}])}); \ No newline at end of file +/*! chevrotain - v0.5.20 - 2016-03-09 */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define("chevrotain",[],e):"object"==typeof exports?exports.chevrotain=e():t.chevrotain=e()}(this,function(){return function(t){function __webpack_require__(n){if(e[n])return e[n].exports;var r=e[n]={exports:{},id:n,loaded:!1};return t[n].call(r.exports,r,r.exports,__webpack_require__),r.loaded=!0,r.exports}var e={};return __webpack_require__.m=t,__webpack_require__.c=e,__webpack_require__.p="",__webpack_require__(0)}([function(t,e,n){"use strict";var r=n(1),i=n(11),o=n(10),a=n(5),s=n(7),c=n(21),u={};u.VERSION="0.5.20",u.Parser=r.Parser,u.Lexer=i.Lexer,u.Token=o.Token,u.VirtualToken=o.VirtualToken,u.EOF=o.EOF,u.extendToken=o.extendToken,u.tokenName=o.tokenName,u.EMPTY_ALT=r.EMPTY_ALT,u.exceptions={},u.exceptions.isRecognitionException=a.exceptions.isRecognitionException,u.exceptions.EarlyExitException=a.exceptions.EarlyExitException,u.exceptions.MismatchedTokenException=a.exceptions.MismatchedTokenException,u.exceptions.NotAllInputParsedException=a.exceptions.NotAllInputParsedException,u.exceptions.NoViableAltException=a.exceptions.NoViableAltException,u.gast={},u.gast.GAstVisitor=s.gast.GAstVisitor,u.gast.Flat=s.gast.Flat,u.gast.Repetition=s.gast.Repetition,u.gast.RepetitionWithSeparator=s.gast.RepetitionWithSeparator,u.gast.RepetitionMandatory=s.gast.RepetitionMandatory,u.gast.RepetitionMandatoryWithSeparator=s.gast.RepetitionMandatoryWithSeparator,u.gast.Option=s.gast.Option,u.gast.Alternation=s.gast.Alternation,u.gast.NonTerminal=s.gast.NonTerminal,u.gast.Terminal=s.gast.Terminal,u.gast.Rule=s.gast.Rule,u.clearCache=c.clearCache,t.exports=u},function(t,e,n){"use strict";function EMPTY_ALT(t){return void 0===t&&(t=void 0),function(){return t}}function InRuleRecoveryException(t){this.name=o.functionName(InRuleRecoveryException),this.message=t}var r=n(2),i=n(5),o=n(3),a=n(6),s=n(8),c=n(4),u=n(14),l=n(10),p=n(17),f=n(19),h=n(18),d=n(16);!function(t){t[t.INVALID_RULE_NAME=0]="INVALID_RULE_NAME",t[t.DUPLICATE_RULE_NAME=1]="DUPLICATE_RULE_NAME",t[t.DUPLICATE_PRODUCTIONS=2]="DUPLICATE_PRODUCTIONS",t[t.UNRESOLVED_SUBRULE_REF=3]="UNRESOLVED_SUBRULE_REF",t[t.LEFT_RECURSION=4]="LEFT_RECURSION",t[t.NONE_LAST_EMPTY_ALT=5]="NONE_LAST_EMPTY_ALT"}(e.ParserDefinitionErrorType||(e.ParserDefinitionErrorType={}));e.ParserDefinitionErrorType;e.EMPTY_ALT=EMPTY_ALT;var E={},A=function(){function Parser(t,e,n){if(void 0===n&&(n=!0),this.errors=[],this._input=[],this.inputIdx=-1,this.isBackTrackingStack=[],this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[],this.tokensMap=void 0,this.definedRulesNames=[],this._input=t,this.isErrorRecoveryEnabled=n,this.className=o.classNameFromInstance(this),this.firstAfterRepMap=r.getFirstAfterRepForClass(this.className),this.classLAFuncs=r.getLookaheadFuncsForClass(this.className),r.CLASS_TO_DEFINITION_ERRORS.containsKey(this.className)?this.definitionErrors=r.CLASS_TO_DEFINITION_ERRORS.get(this.className):(this.definitionErrors=[],r.CLASS_TO_DEFINITION_ERRORS.put(this.className,this.definitionErrors)),c.isArray(e))this.tokensMap=c.reduce(e,function(t,e){return t[l.tokenName(e)]=e,t},{});else{if(!c.isObject(e))throw new Error("'tokensMapOrArr' argument must be An Array of Token constructors or a Dictionary of Tokens.");this.tokensMap=c.cloneObj(e)}this.tokensMap[l.tokenName(l.EOF)]=l.EOF,void 0===r.CLASS_TO_OR_LA_CACHE[this.className]&&r.initLookAheadKeyCache(this.className),this.orLookaheadKeys=r.CLASS_TO_OR_LA_CACHE[this.className],this.manyLookaheadKeys=r.CLASS_TO_MANY_LA_CACHE[this.className],this.manySepLookaheadKeys=r.CLASS_TO_MANY_SEP_LA_CACHE[this.className],this.atLeastOneLookaheadKeys=r.CLASS_TO_AT_LEAST_ONE_LA_CACHE[this.className],this.atLeastOneSepLookaheadKeys=r.CLASS_TO_AT_LEAST_ONE_SEP_LA_CACHE[this.className],this.optionLookaheadKeys=r.CLASS_TO_OPTION_LA_CACHE[this.className]}return Parser.performSelfAnalysis=function(t){var e,n=[],i=o.classNameFromInstance(t);if(""===i)throw Error("A Parser's constructor may not be an anonymous Function, it must be a named function\nThe constructor's name is used at runtime for performance (caching) purposes.");if(!r.CLASS_TO_SELF_ANALYSIS_DONE.containsKey(i)){var l=r.getProductionsForClass(i);n=r.CLASS_TO_DEFINITION_ERRORS.get(i);var p=a.resolveGrammar(l);n.push.apply(n,p),r.CLASS_TO_SELF_ANALYSIS_DONE.put(i,!0);var f=s.validateGrammar(l.values());if(n.push.apply(n,f),!c.isEmpty(n)&&!Parser.DEFER_DEFINITION_ERRORS_HANDLING)throw e=c.map(n,function(t){return t.message}),new Error("Parser Definition Errors detected\n: "+e.join("\n-------------------------------\n"));if(c.isEmpty(n)){var h=u.computeAllProdsFollows(l.values());r.setResyncFollowsForClass(i,h)}}if(!c.isEmpty(r.CLASS_TO_DEFINITION_ERRORS.get(i))&&!Parser.DEFER_DEFINITION_ERRORS_HANDLING)throw e=c.map(r.CLASS_TO_DEFINITION_ERRORS.get(i),function(t){return t.message}),new Error("Parser Definition Errors detected\n: "+e.join("\n-------------------------------\n"))},Object.defineProperty(Parser.prototype,"input",{get:function(){return c.cloneArr(this._input)},set:function(t){this.reset(),this._input=t},enumerable:!0,configurable:!0}),Parser.prototype.reset=function(){this.isBackTrackingStack=[],this.errors=[],this._input=[],this.inputIdx=-1,this.RULE_STACK=[],this.RULE_OCCURRENCE_STACK=[]},Parser.prototype.isAtEndOfInput=function(){return this.LA(1)instanceof l.EOF},Parser.prototype.getGAstProductions=function(){return r.getProductionsForClass(this.className)},Parser.prototype.isBackTracking=function(){return!c.isEmpty(this.isBackTrackingStack)},Parser.prototype.SAVE_ERROR=function(t){if(i.exceptions.isRecognitionException(t))return this.errors.push(t),t;throw Error("trying to save an Error which is not a RecognitionException")},Parser.prototype.NEXT_TOKEN=function(){return this.LA(1)},Parser.prototype.LA=function(t){return this._input.length<=this.inputIdx+t?new l.EOF:this._input[this.inputIdx+t]},Parser.prototype.isNextRule=function(t){var e=r.getLookaheadFuncsForClass(this.className),n=e.get(t);if(void 0===n){var i=this.getGAstProductions().get(t);n=p.buildLookaheadForTopLevel(i),e.put(t,n)}return n.call(this)},Parser.prototype.BACKTRACK=function(t,e){var n=this;return function(){n.isBackTrackingStack.push(1);var r=n.saveRecogState();try{var o=t.call(n);return e(o)}catch(a){if(i.exceptions.isRecognitionException(a))return!1;throw a}finally{n.reloadRecogState(r),n.isBackTrackingStack.pop()}}},Parser.prototype.SKIP_TOKEN=function(){return this.inputIdx<=this._input.length-2?(this.inputIdx++,this.NEXT_TOKEN()):new l.EOF},Parser.prototype.CONSUME=function(t){return this.CONSUME1(t)},Parser.prototype.CONSUME1=function(t){return this.consumeInternal(t,1)},Parser.prototype.CONSUME2=function(t){return this.consumeInternal(t,2)},Parser.prototype.CONSUME3=function(t){return this.consumeInternal(t,3)},Parser.prototype.CONSUME4=function(t){return this.consumeInternal(t,4)},Parser.prototype.CONSUME5=function(t){return this.consumeInternal(t,5)},Parser.prototype.SUBRULE=function(t,e){return void 0===e&&(e=[]),this.SUBRULE1(t,e)},Parser.prototype.SUBRULE1=function(t,e){return void 0===e&&(e=[]),t.call(this,1,e)},Parser.prototype.SUBRULE2=function(t,e){return void 0===e&&(e=[]),t.call(this,2,e)},Parser.prototype.SUBRULE3=function(t,e){return void 0===e&&(e=[]),t.call(this,3,e)},Parser.prototype.SUBRULE4=function(t,e){return void 0===e&&(e=[]),t.call(this,4,e)},Parser.prototype.SUBRULE5=function(t,e){return void 0===e&&(e=[]),t.call(this,5,e)},Parser.prototype.OPTION=function(t,e){return this.OPTION1.call(this,t,e)},Parser.prototype.OPTION1=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(1)),this.optionInternal(t,e)},Parser.prototype.OPTION2=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(2)),this.optionInternal(t,e)},Parser.prototype.OPTION3=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(3)),this.optionInternal(t,e)},Parser.prototype.OPTION4=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(4)),this.optionInternal(t,e)},Parser.prototype.OPTION5=function(t,e){return void 0===e&&(e=t,t=this.getLookaheadFuncForOption(5)),this.optionInternal(t,e)},Parser.prototype.OR=function(t,e,n){return void 0===n&&(n=!1),this.OR1(t,e,n)},Parser.prototype.OR1=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,1,n)},Parser.prototype.OR2=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,2,n)},Parser.prototype.OR3=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,3,n)},Parser.prototype.OR4=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,4,n)},Parser.prototype.OR5=function(t,e,n){return void 0===n&&(n=!1),this.orInternal(t,e,5,n)},Parser.prototype.MANY=function(t,e){return this.MANY1.call(this,t,e)},Parser.prototype.MANY1=function(t,e){this.manyInternal(this.MANY1,"MANY1",1,t,e)},Parser.prototype.MANY2=function(t,e){this.manyInternal(this.MANY2,"MANY2",2,t,e)},Parser.prototype.MANY3=function(t,e){this.manyInternal(this.MANY3,"MANY3",3,t,e)},Parser.prototype.MANY4=function(t,e){this.manyInternal(this.MANY4,"MANY4",4,t,e)},Parser.prototype.MANY5=function(t,e){this.manyInternal(this.MANY5,"MANY5",5,t,e)},Parser.prototype.MANY_SEP=function(t,e,n){return this.MANY_SEP1.call(this,t,e,n)},Parser.prototype.MANY_SEP1=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP1,"MANY_SEP1",1,t,e,n)},Parser.prototype.MANY_SEP2=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP2,"MANY_SEP2",2,t,e,n)},Parser.prototype.MANY_SEP3=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP3,"MANY_SEP3",3,t,e,n)},Parser.prototype.MANY_SEP4=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP4,"MANY_SEP4",4,t,e,n)},Parser.prototype.MANY_SEP5=function(t,e,n){return this.manySepFirstInternal(this.MANY_SEP5,"MANY_SEP5",5,t,e,n)},Parser.prototype.AT_LEAST_ONE=function(t,e,n){return this.AT_LEAST_ONE1.call(this,t,e,n)},Parser.prototype.AT_LEAST_ONE1=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE1,"AT_LEAST_ONE1",1,t,e,n)},Parser.prototype.AT_LEAST_ONE2=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE2,"AT_LEAST_ONE2",2,t,e,n)},Parser.prototype.AT_LEAST_ONE3=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE3,"AT_LEAST_ONE3",3,t,e,n)},Parser.prototype.AT_LEAST_ONE4=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE4,"AT_LEAST_ONE4",4,t,e,n)},Parser.prototype.AT_LEAST_ONE5=function(t,e,n){this.atLeastOneInternal(this.AT_LEAST_ONE5,"AT_LEAST_ONE5",5,t,e,n)},Parser.prototype.AT_LEAST_ONE_SEP=function(t,e,n,r){return this.AT_LEAST_ONE_SEP1.call(this,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP1=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP1",1,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP2=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP2",2,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP3=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP3",3,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP4=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP4",4,t,e,n,r)},Parser.prototype.AT_LEAST_ONE_SEP5=function(t,e,n,r){return this.atLeastOneSepFirstInternal(this.atLeastOneSepFirstInternal,"AT_LEAST_ONE_SEP5",5,t,e,n,r)},Parser.prototype.RULE_NO_RESYNC=function(t,e,n){return this.RULE(t,e,n,!1)},Parser.prototype.RULE=function(t,e,n,o){void 0===n&&(n=this.defaultInvalidReturn),void 0===o&&(o=!0);var a=s.validateRuleName(t,this.definedRulesNames,this.className);this.definedRulesNames.push(t),this.definitionErrors.push.apply(this.definitionErrors,a);var c=r.getProductionsForClass(this.className);if(!c.containsKey(t)){var u=f.buildTopProduction(e.toString(),t,this.tokensMap);c.put(t,u)}var l=function(r,a){void 0===r&&(r=1),void 0===a&&(a=[]),this.ruleInvocationStateUpdate(t,r);try{return e.apply(this,a)}catch(s){var c=1===this.RULE_STACK.length,u=c||o&&!this.isBackTracking()&&this.isErrorRecoveryEnabled;if(u&&i.exceptions.isRecognitionException(s)){var l=this.findReSyncTokenType();if(this.isInCurrentRuleReSyncSet(l))return this.reSyncTo(l),n();throw s}throw s}finally{this.ruleFinallyStateUpdate()}},p="ruleName";return l[p]=t,l},Parser.prototype.ruleInvocationStateUpdate=function(t,e){this.RULE_OCCURRENCE_STACK.push(e),this.RULE_STACK.push(t)},Parser.prototype.ruleFinallyStateUpdate=function(){this.RULE_STACK.pop(),this.RULE_OCCURRENCE_STACK.pop();var t=this._input.length-1;if(0===this.RULE_STACK.length&&this.inputIdx"+t+"<-- but found -->'"+c.image+"'<--";o.SAVE_ERROR(new i.exceptions.MismatchedTokenException(e,c))};!p;){if(u instanceof r)return void f();if(n.call(this))return f(),void t.apply(this,e);u instanceof a&&(p=!0),u=this.SKIP_TOKEN()}this.inputIdx=s},Parser.prototype.shouldInRepetitionRecoveryBeTried=function(t,e){return void 0===t||void 0===e?!1:this.NEXT_TOKEN()instanceof t?!1:this.isBackTracking()?!1:!this.canPerformInRuleRecovery(t,this.getFollowsForInRuleRecovery(t,e))},Parser.prototype.getFollowsForInRuleRecovery=function(t,e){var n=c.cloneArr(this.RULE_STACK),r=c.cloneArr(this.RULE_OCCURRENCE_STACK),i={ruleStack:n,occurrenceStack:r,lastTok:t,lastTokOccurrence:e},o=c.first(n),a=this.getGAstProductions(),s=a.get(o),u=new h.NextAfterTokenWalker(s,i).startWalking();return u},Parser.prototype.tryInRuleRecovery=function(t,e){if(this.canRecoverWithSingleTokenInsertion(t,e)){var n=this.getTokenToInsert(t);return n.isInsertedInRecovery=!0,n}if(this.canRecoverWithSingleTokenDeletion(t)){var r=this.SKIP_TOKEN();return this.inputIdx++,r}throw new InRuleRecoveryException("sad sad panda")},Parser.prototype.canPerformInRuleRecovery=function(t,e){return this.canRecoverWithSingleTokenInsertion(t,e)||this.canRecoverWithSingleTokenDeletion(t)},Parser.prototype.canRecoverWithSingleTokenInsertion=function(t,e){if(!this.canTokenTypeBeInsertedInRecovery(t))return!1;if(c.isEmpty(e))return!1;var n=this.NEXT_TOKEN(),r=void 0!==c.find(e,function(t){return n instanceof t});return r},Parser.prototype.canRecoverWithSingleTokenDeletion=function(t){var e=this.LA(2)instanceof t;return e},Parser.prototype.isInCurrentRuleReSyncSet=function(t){var e=this.getCurrFollowKey(),n=this.getFollowSetFromFollowKey(e);return c.contains(n,t)},Parser.prototype.findReSyncTokenType=function(){for(var t=this.flattenFollowSet(),e=this.NEXT_TOKEN(),n=2;;){var r=e.constructor;if(c.contains(t,r))return r;e=this.LA(n),n++}},Parser.prototype.getCurrFollowKey=function(){if(1===this.RULE_STACK.length)return E;var t=this.RULE_STACK.length-1,e=t,n=t-1;return{ruleName:this.RULE_STACK[t],idxInCallingRule:this.RULE_OCCURRENCE_STACK[e],inRule:this.RULE_STACK[n]}},Parser.prototype.buildFullFollowKeyStack=function(){var t=this;return c.map(this.RULE_STACK,function(e,n){return 0===n?E:{ruleName:e,idxInCallingRule:t.RULE_OCCURRENCE_STACK[n],inRule:t.RULE_STACK[n-1]}})},Parser.prototype.flattenFollowSet=function(){var t=this,e=c.map(this.buildFullFollowKeyStack(),function(e){return t.getFollowSetFromFollowKey(e)});return c.flatten(e)},Parser.prototype.getFollowSetFromFollowKey=function(t){if(t===E)return[l.EOF];var e=t.ruleName+t.idxInCallingRule+d.IN+t.inRule;return r.getResyncFollowsForClass(this.className).get(e)},Parser.prototype.reSyncTo=function(t){for(var e=this.NEXT_TOKEN();e instanceof t==!1;)e=this.SKIP_TOKEN()},Parser.prototype.attemptInRepetitionRecovery=function(t,e,n,r,i,o,a){var s=this.getKeyForAutomaticLookahead(r,a,i),u=this.firstAfterRepMap.get(s);if(void 0===u){var p=c.last(this.RULE_STACK),f=this.getGAstProductions().get(p),h=new o(f,i);u=h.startWalking(),this.firstAfterRepMap.put(s,u)}var d=u.token,E=u.occurrence,A=u.isEndOfRule;1===this.RULE_STACK.length&&A&&void 0===d&&(d=l.EOF,E=1),this.shouldInRepetitionRecoveryBeTried(d,E)&&this.tryInRepetitionRecovery(t,e,n,d)},Parser.prototype.optionInternal=function(t,e){return t.call(this)?(e.call(this),!0):!1},Parser.prototype.atLeastOneInternal=function(t,e,n,r,o,a){if(c.isString(o)&&(a=o,o=r,r=this.getLookaheadFuncForAtLeastOne(n)),!r.call(this))throw this.SAVE_ERROR(new i.exceptions.EarlyExitException("expecting at least one: "+a,this.NEXT_TOKEN()));for(o.call(this);r.call(this);)o.call(this);this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(t,[r,o,a],r,e,n,h.NextTerminalAfterAtLeastOneWalker,this.atLeastOneLookaheadKeys)},Parser.prototype.atLeastOneSepFirstInternal=function(t,e,n,r,o,a,s){var u=this,l=[];if(c.isString(a)&&(s=a,a=o,o=this.getLookaheadFuncForAtLeastOneSep(n)),!o.call(this))throw this.SAVE_ERROR(new i.exceptions.EarlyExitException("expecting at least one: "+s,this.NEXT_TOKEN()));a.call(this);for(var p=function(){return u.NEXT_TOKEN()instanceof r};p();)l.push(this.CONSUME(r)),a.call(this);return this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,p,a,l,this.atLeastOneSepLookaheadKeys,h.NextTerminalAfterAtLeastOneSepWalker],p,e,n,h.NextTerminalAfterAtLeastOneSepWalker,this.atLeastOneSepLookaheadKeys),l},Parser.prototype.manyInternal=function(t,e,n,r,i){for(void 0===i&&(i=r,r=this.getLookaheadFuncForMany(n));r.call(this);)i.call(this);this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(t,[r,i],r,e,n,h.NextTerminalAfterManyWalker,this.manyLookaheadKeys)},Parser.prototype.manySepFirstInternal=function(t,e,n,r,i,o){var a=this,s=[];if(void 0===o&&(o=i,i=this.getLookaheadFuncForManySep(n)),i.call(this)){o.call(this);for(var c=function(){return a.NEXT_TOKEN()instanceof r};c();)s.push(this.CONSUME(r)),o.call(this);this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[e,n,r,c,o,s,this.manySepLookaheadKeys,h.NextTerminalAfterManySepWalker],c,e,n,h.NextTerminalAfterManySepWalker,this.manySepLookaheadKeys)}return s},Parser.prototype.repetitionSepSecondInternal=function(t,e,n,r,i,o,a,s){for(;r();)o.push(this.CONSUME(n)),i.call(this);this.isErrorRecoveryEnabled&&this.attemptInRepetitionRecovery(this.repetitionSepSecondInternal,[t,e,n,r,i,o,a,s],r,t,e,s,a)},Parser.prototype.orInternal=function(t,e,n,r){if(void 0!==t[0].WHEN){for(var i=0;i"+n+"<-- but found -->'"+e.image+"'<--";throw this.SAVE_ERROR(new i.exceptions.MismatchedTokenException(r,e))},Parser.prototype.getKeyForAutomaticLookahead=function(t,e,n){var r=e[n-1],i=c.last(this.RULE_STACK),o=r[i];return void 0===o&&(o=t+n+d.IN+i,r[i]=o),o},Parser.prototype.getLookaheadFuncForOption=function(t){var e=this.getKeyForAutomaticLookahead("OPTION",this.optionLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForOption)},Parser.prototype.getLookaheadFuncForOr=function(t,e){var n=this.getKeyForAutomaticLookahead("OR",this.orLookaheadKeys,t);return this.getLookaheadFuncFor(n,t,p.buildLookaheadForOr,[e])},Parser.prototype.getLookaheadFuncForMany=function(t){var e=this.getKeyForAutomaticLookahead("MANY",this.manyLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForMany)},Parser.prototype.getLookaheadFuncForManySep=function(t){var e=this.getKeyForAutomaticLookahead("MANY_SEP",this.manySepLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForManySep)},Parser.prototype.getLookaheadFuncForAtLeastOne=function(t){var e=this.getKeyForAutomaticLookahead("AT_LEAST_ONE",this.atLeastOneLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForAtLeastOne)},Parser.prototype.getLookaheadFuncForAtLeastOneSep=function(t){var e=this.getKeyForAutomaticLookahead("AT_LEAST_ONE_SEP",this.atLeastOneSepLookaheadKeys,t);return this.getLookaheadFuncFor(e,t,p.buildLookaheadForAtLeastOneSep)},Parser.prototype.getLookaheadFuncFor=function(t,e,n,r){void 0===r&&(r=[]);var i=c.last(this.RULE_STACK),o=this.classLAFuncs.get(t);if(void 0===o){var a=this.getGAstProductions().get(i);o=n.apply(null,[e,a].concat(r)),this.classLAFuncs.put(t,o)}return o},Parser.prototype.saveRecogState=function(){var t=c.cloneArr(this.errors),e=c.cloneArr(this.RULE_STACK);return{errors:t,inputIdx:this.inputIdx,RULE_STACK:e}},Parser.prototype.reloadRecogState=function(t){this.errors=t.errors,this.inputIdx=t.inputIdx,this.RULE_STACK=t.RULE_STACK},Parser.prototype.raiseNoAltException=function(t,e){var n=" but found: '"+this.NEXT_TOKEN().image+"'";if(void 0===e){var r=c.last(this.RULE_STACK),o=this.getGAstProductions().get(r),a=new h.NextInsideOrWalker(o,t).startWalking(),s=c.flatten(a),u=c.map(s,function(t){return l.tokenName(t)});e="one of: <"+u.join(" ,")+">"}throw this.SAVE_ERROR(new i.exceptions.NoViableAltException("expecting: "+e+" "+n,this.NEXT_TOKEN()))},Parser.IGNORE_AMBIGUITIES=!0,Parser.NO_RESYNC=!1,Parser.DEFER_DEFINITION_ERRORS_HANDLING=!1,Parser}();e.Parser=A,InRuleRecoveryException.prototype=Error.prototype},function(t,e,n){"use strict";function getProductionsForClass(t){return getFromNestedHashTable(t,e.CLASS_TO_GRAMMAR_PRODUCTIONS)}function getResyncFollowsForClass(t){return getFromNestedHashTable(t,e.CLASS_TO_RESYNC_FOLLOW_SETS)}function setResyncFollowsForClass(t,n){e.CLASS_TO_RESYNC_FOLLOW_SETS.put(t,n)}function getLookaheadFuncsForClass(t){return getFromNestedHashTable(t,e.CLASS_TO_LOOKAHEAD_FUNCS)}function getFirstAfterRepForClass(t){return getFromNestedHashTable(t,e.CLASS_TO_FIRST_AFTER_REPETITION)}function initLookAheadKeyCache(t){e.CLASS_TO_OR_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_MANY_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_MANY_SEP_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_AT_LEAST_ONE_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_AT_LEAST_ONE_SEP_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),e.CLASS_TO_OPTION_LA_CACHE[t]=new Array(e.MAX_OCCURRENCE_INDEX),initSingleLookAheadKeyCache(e.CLASS_TO_OR_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_MANY_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_MANY_SEP_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_AT_LEAST_ONE_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_AT_LEAST_ONE_SEP_LA_CACHE[t]),initSingleLookAheadKeyCache(e.CLASS_TO_OPTION_LA_CACHE[t])}function initSingleLookAheadKeyCache(t){for(var n=0;n1}),c=i.map(i.values(a),function(e){var n=i.first(e),r=createDuplicatesErrorMessage(e,t.name),a=s.getProductionDslName(n),c={message:r,type:o.ParserDefinitionErrorType.DUPLICATE_PRODUCTIONS,ruleName:t.name,dslName:a,occurrence:n.occurrenceInParent},u=getExtraProductionArgument(n);return u&&(c.parameter=u),c});return c}function createDuplicatesErrorMessage(t,e){var n=i.first(t),r=n.occurrenceInParent,o=s.getProductionDslName(n),a=getExtraProductionArgument(n),c="->"+o+"<- with occurrence index: ->"+r+"<-\n "+(a?"and argument: "+a:"")+"\n appears more than once ("+t.length+" times) in the top level rule: "+e+".\n "+(1===r?"note that "+o+" and "+o+"1 both have the same occurrence index 1}":"")+"}\n to fix this make sure each usage of "+o+" "+(a?"with the argument: "+a:"")+"\n in the rule "+e+" has a different occurrence index (1-5), as that combination acts as a unique\n position key in the grammar, which is needed by the parsing engine.";return c=c.replace(/[ \t]+/g," "),c=c.replace(/\s\s+/g,"\n")}function identifyProductionForDuplicates(t){return s.getProductionDslName(t)+"_#_"+t.occurrenceInParent+"_#_"+getExtraProductionArgument(t)}function getExtraProductionArgument(t){return t instanceof a.gast.Terminal?c.tokenName(t.terminalType):t instanceof a.gast.NonTerminal?t.nonTerminalName:""}function validateRuleName(t,e,n){var r,a=[];return t.match(p)||(r="Invalid Grammar rule name --> "+t+" it must match the pattern: "+p.toString(),a.push({message:r,type:o.ParserDefinitionErrorType.INVALID_RULE_NAME,ruleName:t})),i.contains(e,t)&&(r="Duplicate definition, rule: "+t+" is already defined in the grammar: "+n,a.push({message:r,type:o.ParserDefinitionErrorType.DUPLICATE_RULE_NAME,ruleName:t})),a}function validateNoLeftRecursion(t,e,n){void 0===n&&(n=[]);var r=[],a=getFirstNoneTerminal(e.definition);if(i.isEmpty(a))return[];var s=t.name,c=i.contains(a,t),u=i.map(n,function(t){return t.name}),l=s+" --> "+u.concat([s]).join(" --> ");if(c){var p="Left Recursion found in grammar.\n"+("rule: <"+s+"> can be invoked from itself (directly or indirectly)\n")+("without consuming any Tokens. The grammar path that causes this is: \n "+l+"\n")+" To fix this refactor your grammar to remove the left recursion.\nsee: https://en.wikipedia.org/wiki/LL_parser#Left_Factoring.";r.push({message:p,type:o.ParserDefinitionErrorType.LEFT_RECURSION,ruleName:s})}var f=i.difference(a,n.concat([t])),h=i.map(f,function(e){var r=i.cloneArr(n);return r.push(e),validateNoLeftRecursion(t,e,r)});return r.concat(i.flatten(h))}function getFirstNoneTerminal(t){var e=[];if(i.isEmpty(t))return e;var n=i.first(t);if(n instanceof a.gast.NonTerminal){if(void 0===n.referencedRule)return e;e.push(n.referencedRule)}else if(n instanceof a.gast.Flat||n instanceof a.gast.Option||n instanceof a.gast.RepetitionMandatory||n instanceof a.gast.RepetitionMandatoryWithSeparator||n instanceof a.gast.RepetitionWithSeparator||n instanceof a.gast.Repetition)e=e.concat(getFirstNoneTerminal(n.definition));else if(n instanceof a.gast.Alternation)e=i.flatten(i.map(n.definition,function(t){return getFirstNoneTerminal(t.definition)}));else if(!(n instanceof a.gast.Terminal))throw Error("non exhaustive match");var r=s.isOptionalProd(n),o=t.length>1;if(r&&o){var c=i.drop(t);return e.concat(getFirstNoneTerminal(c))}return e}function validateEmptyOrAlternative(t){var e=new f;t.accept(e);var n=e.alternations,r=i.reduce(n,function(e,n){var r=i.dropRight(n.definition),a=i.map(r,function(e,r){return i.isEmpty(u.first(e))?{message:"Ambiguous empty alternative: <"+(r+1)+">"+(" in inside <"+t.name+"> Rule.\n")+"Only the last alternative may be an empty alternative.",type:o.ParserDefinitionErrorType.NONE_LAST_EMPTY_ALT,ruleName:t.name,occurrence:n.occurrenceInParent,alternative:r+1}:null});return e.concat(i.compact(a))},[]);return r}var r=this&&this.__extends||function(t,e){function __(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)},i=n(4),o=n(1),a=n(7),s=n(9),c=n(10),u=n(13);e.validateGrammar=validateGrammar,e.identifyProductionForDuplicates=identifyProductionForDuplicates;var l=function(t){function OccurrenceValidationCollector(){t.apply(this,arguments),this.allProductions=[]}return r(OccurrenceValidationCollector,t),OccurrenceValidationCollector.prototype.visitNonTerminal=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitOption=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitRepetitionWithSeparator=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitRepetitionMandatory=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitRepetitionMandatoryWithSeparator=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitRepetition=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitAlternation=function(t){this.allProductions.push(t)},OccurrenceValidationCollector.prototype.visitTerminal=function(t){this.allProductions.push(t)},OccurrenceValidationCollector}(a.gast.GAstVisitor);e.OccurrenceValidationCollector=l;var p=/^[a-zA-Z_]\w*$/;e.validateRuleName=validateRuleName,e.validateNoLeftRecursion=validateNoLeftRecursion,e.getFirstNoneTerminal=getFirstNoneTerminal;var f=function(t){function OrCollector(){t.apply(this,arguments),this.alternations=[]}return r(OrCollector,t),OrCollector.prototype.visitAlternation=function(t){this.alternations.push(t)},OrCollector}(a.gast.GAstVisitor);e.validateEmptyOrAlternative=validateEmptyOrAlternative},function(t,e,n){"use strict";function isSequenceProd(t){return t instanceof r.gast.Flat||t instanceof r.gast.Option||t instanceof r.gast.Repetition||t instanceof r.gast.RepetitionMandatory||t instanceof r.gast.RepetitionMandatoryWithSeparator||t instanceof r.gast.RepetitionWithSeparator||t instanceof r.gast.Terminal||t instanceof r.gast.Rule}function isOptionalProd(t,e){void 0===e&&(e=[]);var n=t instanceof r.gast.Option||t instanceof r.gast.Repetition||t instanceof r.gast.RepetitionWithSeparator;return n?!0:t instanceof r.gast.Alternation?i.some(t.definition,function(t){return isOptionalProd(t,e)}):t instanceof r.gast.NonTerminal&&i.contains(e,t)?!1:t instanceof r.gast.AbstractProduction?(t instanceof r.gast.NonTerminal&&e.push(t),i.every(t.definition,function(t){return isOptionalProd(t,e)})):!1}function isBranchingProd(t){return t instanceof r.gast.Alternation}function getProductionDslName(t){var e=t.constructor,n=o.functionName(e);return a[n]}var r=n(7),i=n(4),o=n(3);e.isSequenceProd=isSequenceProd,e.isOptionalProd=isOptionalProd,e.isBranchingProd=isBranchingProd;var a={};a[o.functionName(r.gast.NonTerminal)]="SUBRULE",a[o.functionName(r.gast.Option)]="OPTION",a[o.functionName(r.gast.RepetitionMandatory)]="AT_LEAST_ONE",a[o.functionName(r.gast.RepetitionMandatoryWithSeparator)]="AT_LEAST_ONE_SEP",a[o.functionName(r.gast.RepetitionWithSeparator)]="MANY_SEP",a[o.functionName(r.gast.Repetition)]="MANY",a[o.functionName(r.gast.Alternation)]="OR",a[o.functionName(r.gast.Terminal)]="CONSUME",e.getProductionDslName=getProductionDslName},function(t,e,n){"use strict";function tokenName(t){return i.isString(t.tokenName)?t.tokenName:o.functionName(t)}function extendToken(t,e,n){void 0===e&&(e=void 0),void 0===n&&(n=s);var r;i.isRegExp(e)||e===a.Lexer.SKIPPED||e===a.Lexer.NA?r=e:i.isFunction(e)&&(n=e,r=void 0);var o=function(){n.apply(this,arguments)};return o=i.assign(o,n),o.tokenName=t,o.prototype=Object.create(n.prototype),o.prototype.constructor=o,i.isUndefined(r)||(o.PATTERN=r),o}var r=this&&this.__extends||function(t,e){function __(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)},i=n(4),o=n(3),a=n(11);e.tokenName=tokenName,e.extendToken=extendToken;var s=function(){function Token(t,e,n,r,i,o){void 0===i&&(i=n),void 0===o&&(o=r+t.length-1),this.image=t,this.offset=e,this.startLine=n,this.startColumn=r,this.endLine=i,this.endColumn=o,this.isInsertedInRecovery=!1}return Token}();e.Token=s;var c=function(t){function VirtualToken(){t.call(this,"",-1,-1,-1,-1,-1)}return r(VirtualToken,t),VirtualToken}(s);e.VirtualToken=c;var u=function(t){function EOF(){t.apply(this,arguments)}return r(EOF,t),EOF}(c);e.EOF=u},function(t,e,n){"use strict";var r=n(12),i=n(4);!function(t){t[t.MISSING_PATTERN=0]="MISSING_PATTERN",t[t.INVALID_PATTERN=1]="INVALID_PATTERN",t[t.EOI_ANCHOR_FOUND=2]="EOI_ANCHOR_FOUND",t[t.UNSUPPORTED_FLAGS_FOUND=3]="UNSUPPORTED_FLAGS_FOUND",t[t.DUPLICATE_PATTERNS_FOUND=4]="DUPLICATE_PATTERNS_FOUND",t[t.INVALID_GROUP_TYPE_FOUND=5]="INVALID_GROUP_TYPE_FOUND"}(e.LexerDefinitionErrorType||(e.LexerDefinitionErrorType={}));var o=(e.LexerDefinitionErrorType,function(){function Lexer(t,e){if(void 0===e&&(e=!1),this.tokenClasses=t,this.lexerDefinitionErrors=[],this.lexerDefinitionErrors=r.validatePatterns(t),!i.isEmpty(this.lexerDefinitionErrors)&&!e){var n=i.map(this.lexerDefinitionErrors,function(t){return t.message}),o=n.join("-----------------------\n");throw new Error("Errors detected in definition of Lexer:\n"+o)}if(i.isEmpty(this.lexerDefinitionErrors)){var a=r.analyzeTokenClasses(t);this.allPatterns=a.allPatterns,this.patternIdxToClass=a.patternIdxToClass,this.patternIdxToGroup=a.patternIdxToGroup,this.patternIdxToLongerAltIdx=a.patternIdxToLongerAltIdx,this.patternIdxToCanLineTerminator=a.patternIdxToCanLineTerminator,this.emptyGroups=a.emptyGroups}}return Lexer.prototype.tokenize=function(t){var e,n,o,a,s,c,u,l,p,f,h,d,E,A,T,y,O,N,R=t,_=0,g=[],m=[],v=1,S=1,P=i.cloneObj(this.emptyGroups);if(!i.isEmpty(this.lexerDefinitionErrors)){var L=i.map(this.lexerDefinitionErrors,function(t){return t.message}),k=L.join("-----------------------\n");throw new Error("Unable to Tokenize because Errors detected in definition of Lexer:\n"+k)}for(;t.length>0;){for(e=null,n=0;ne[0].length&&(e=a,n=s));break}if(null!==e){if(c=e[0],u=c.length,l=this.patternIdxToGroup[n],void 0!==l&&(p=this.patternIdxToClass[n],f=new p(c,_,v,S),"default"===l?g.push(f):P[l].push(f)),t=t.slice(u),_+=u,S+=u,d=this.patternIdxToCanLineTerminator[n]){var I=r.countLineTerminators(c);if(0!==I){for(v+=I,y=u-1;y>=0&&(A=c.charCodeAt(y),13!==A&&10!==A);)y--;S=u-y,void 0!==l&&(N=y===u-1,E=N?-1:0,1===I&&N||(f.endLine=v+E,f.endColumn=S-1+-E))}}}else{for(var x=_,F=v,C=S,w=!1;!w&&t.length>0;)for(T=t.charCodeAt(0),10===T||13===T&&(1===t.length||t.length>1&&10!==t.charCodeAt(1))?(v++,S=1):S++,t=t.substr(1),_++,o=0;o"+R.charAt(x)+"<- at offset: "+x+","+(" skipped "+(_-x)+" characters."),m.push({line:F,column:C,length:h,message:O})}}return{tokens:g,groups:P,errors:m}},Lexer.SKIPPED={description:"This marks a skipped Token pattern, this means each token identified by it willbe consumed and then throw into oblivion, this can be used to for example: skip whitespace."},Lexer.NA=/NOT_APPLICABLE/,Lexer}());e.Lexer=o},function(t,e,n){"use strict";function analyzeTokenClasses(t){var e=o.reject(t,function(t){return t[a]===i.Lexer.NA}),n=o.map(e,function(t){return addStartOfInput(t[a])}),r=o.zipObject(n,e),s=o.map(n,function(t){return r[t.toString()]}),c=o.map(e,function(t){var e=t.GROUP;if(e!==i.Lexer.SKIPPED){if(o.isString(e))return e;if(o.isUndefined(e))return"default";throw Error("non exhaustive match")}}),u=o.map(e,function(t){var n=t.LONGER_ALT;if(n){var r=o.indexOf(e,n);return r}}),l=o.map(n,function(t){return/\\n|\\r|\\s/g.test(t.source)}),p=o.reduce(e,function(t,e){var n=e.GROUP;return o.isString(n)&&(t[n]=[]),t},{});return{allPatterns:n,patternIdxToClass:s,patternIdxToGroup:c,patternIdxToLongerAltIdx:u,patternIdxToCanLineTerminator:l,emptyGroups:p}}function validatePatterns(t){var e=[],n=findMissingPatterns(t),r=n.validTokenClasses;e=e.concat(n.errors);var i=findInvalidPatterns(r);return r=i.validTokenClasses,e=e.concat(i.errors),e=e.concat(findEndOfInputAnchor(r)),e=e.concat(findUnsupportedFlags(r)),e=e.concat(findDuplicatePatterns(r)),e=e.concat(findInvalidGroupType(r))}function findMissingPatterns(t){var e=o.filter(t,function(t){return!o.has(t,a)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- missing static 'PATTERN' property",type:i.LexerDefinitionErrorType.MISSING_PATTERN,tokenClasses:[t]}}),s=o.difference(t,e);return{errors:n,validTokenClasses:s}}function findInvalidPatterns(t){var e=o.filter(t,function(t){var e=t[a];return!o.isRegExp(e)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- static 'PATTERN' can only be a RegExp",type:i.LexerDefinitionErrorType.INVALID_PATTERN,tokenClasses:[t]}}),s=o.difference(t,e);return{errors:n,validTokenClasses:s}}function findEndOfInputAnchor(t){var e=o.filter(t,function(t){var e=t[a];return s.test(e.source)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- static 'PATTERN' cannot contain end of input anchor '$'",type:i.LexerDefinitionErrorType.EOI_ANCHOR_FOUND,tokenClasses:[t]}});return n}function findUnsupportedFlags(t){var e=o.filter(t,function(t){var e=t[a];return e instanceof RegExp&&(e.multiline||e.global)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- static 'PATTERN' may NOT contain global('g') or multiline('m')",type:i.LexerDefinitionErrorType.UNSUPPORTED_FLAGS_FOUND,tokenClasses:[t]}});return n}function findDuplicatePatterns(t){var e=[],n=o.map(t,function(n){return o.reduce(t,function(t,r){return n.PATTERN.source!==r.PATTERN.source||o.contains(e,r)||r.PATTERN===i.Lexer.NA?t:(e.push(r),t.push(r),t)},[])});n=o.compact(n);var a=o.filter(n,function(t){return t.length>1}),s=o.map(a,function(t){var e=o.map(t,function(t){return r.tokenName(t)}),n=o.first(t).PATTERN;return{message:"The same RegExp pattern ->"+n+"<-"+("has been used in all the following classes: "+e.join(", ")+" <-"),type:i.LexerDefinitionErrorType.DUPLICATE_PATTERNS_FOUND,tokenClasses:t}});return s}function findInvalidGroupType(t){var e=o.filter(t,function(t){if(!o.has(t,"GROUP"))return!1;var e=t.GROUP;return e!==i.Lexer.SKIPPED&&e!==i.Lexer.NA&&!o.isString(e)}),n=o.map(e,function(t){return{message:"Token class: ->"+r.tokenName(t)+"<- static 'GROUP' can only be Lexer.SKIPPED/Lexer.NA/A String",type:i.LexerDefinitionErrorType.INVALID_GROUP_TYPE_FOUND,tokenClasses:[t]}});return n}function addStartOfInput(t){var e=t.ignoreCase?"i":"";return new RegExp("^(?:"+t.source+")",e)}function countLineTerminators(t){for(var e=0,n=0;na,c=!0;s&&c;)e=r[a],c=i.isOptionalProd(e),n=n.concat(first(e)),a+=1,s=r.length>a;return o.uniq(n)}function firstForBranching(t){var e=o.map(t.definition,function(t){return first(t)});return o.uniq(o.flatten(e))}function firstForTerminal(t){return[t.terminalType]}var r=n(7),i=n(9),o=n(4);e.first=first,e.firstForSequence=firstForSequence,e.firstForBranching=firstForBranching,e.firstForTerminal=firstForTerminal},function(t,e,n){"use strict";function computeAllProdsFollows(t){var e=new o.HashTable;return c.forEach(t,function(t){var n=new p(t).startWalking();e.putAll(n)}),e}function buildBetweenProdsFollowPrefix(t,e){return t.name+e+u.IN}function buildInProdFollowPrefix(t){var e=l.tokenName(t.terminalType);return e+t.occurrenceInParent+u.IN}var r=this&&this.__extends||function(t,e){function __(){this.constructor=t}for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);t.prototype=null===e?Object.create(e):(__.prototype=e.prototype,new __)},i=n(15),o=n(3),a=n(7),s=n(13),c=n(4),u=n(16),l=n(10),p=function(t){function ResyncFollowsWalker(e){t.call(this),this.topProd=e,this.follows=new o.HashTable}return r(ResyncFollowsWalker,t),ResyncFollowsWalker.prototype.startWalking=function(){return this.walk(this.topProd),this.follows},ResyncFollowsWalker.prototype.walkTerminal=function(t,e,n){},ResyncFollowsWalker.prototype.walkProdRef=function(t,e,n){var r=buildBetweenProdsFollowPrefix(t.referencedRule,t.occurrenceInParent)+this.topProd.name,i=e.concat(n),o=new a.gast.Flat(i),c=s.first(o);this.follows.put(r,c)},ResyncFollowsWalker}(i.RestWalker);e.ResyncFollowsWalker=p,e.computeAllProdsFollows=computeAllProdsFollows,e.buildBetweenProdsFollowPrefix=buildBetweenProdsFollowPrefix,e.buildInProdFollowPrefix=buildInProdFollowPrefix},function(t,e,n){"use strict";function restForRepetitionWithSeparator(t,e,n){var i=[new r.gast.Option([new r.gast.Terminal(t.separator)].concat(t.definition))],o=i.concat(e,n);return o}var r=n(7),i=n(4),o=function(){function RestWalker(){}return RestWalker.prototype.walk=function(t,e){var n=this;void 0===e&&(e=[]),i.forEach(t.definition,function(o,a){var s=i.drop(t.definition,a+1);if(o instanceof r.gast.NonTerminal)n.walkProdRef(o,s,e);else if(o instanceof r.gast.Terminal)n.walkTerminal(o,s,e);else if(o instanceof r.gast.Flat)n.walkFlat(o,s,e);else if(o instanceof r.gast.Option)n.walkOption(o,s,e);else if(o instanceof r.gast.RepetitionMandatory)n.walkAtLeastOne(o,s,e);else if(o instanceof r.gast.RepetitionMandatoryWithSeparator)n.walkAtLeastOneSep(o,s,e);else if(o instanceof r.gast.RepetitionWithSeparator)n.walkManySep(o,s,e);else if(o instanceof r.gast.Repetition)n.walkMany(o,s,e);else{if(!(o instanceof r.gast.Alternation))throw Error("non exhaustive match");n.walkOr(o,s,e)}})},RestWalker.prototype.walkTerminal=function(t,e,n){},RestWalker.prototype.walkProdRef=function(t,e,n){},RestWalker.prototype.walkFlat=function(t,e,n){var r=e.concat(n);this.walk(t,r)},RestWalker.prototype.walkOption=function(t,e,n){var r=e.concat(n);this.walk(t,r)},RestWalker.prototype.walkAtLeastOne=function(t,e,n){var i=[new r.gast.Option(t.definition)].concat(e,n);this.walk(t,i)},RestWalker.prototype.walkAtLeastOneSep=function(t,e,n){var r=restForRepetitionWithSeparator(t,e,n);this.walk(t,r)},RestWalker.prototype.walkMany=function(t,e,n){var i=[new r.gast.Option(t.definition)].concat(e,n);this.walk(t,i)},RestWalker.prototype.walkManySep=function(t,e,n){var r=restForRepetitionWithSeparator(t,e,n);this.walk(t,r)},RestWalker.prototype.walkOr=function(t,e,n){var o=this,a=e.concat(n);i.forEach(t.definition,function(t){var e=new r.gast.Flat([t]);o.walk(e,a)})},RestWalker}();e.RestWalker=o},function(t,e){"use strict";e.IN="_~IN~_"},function(t,e,n){"use strict";function buildLookaheadForTopLevel(t){var e=new r.gast.Flat(t.definition),n=i.first(e);return getSimpleLookahead(n)}function buildLookaheadForOption(t,e){return buildLookAheadForGrammarProd(o.NextInsideOptionWalker,t,e)}function buildLookaheadForMany(t,e){return buildLookAheadForGrammarProd(o.NextInsideManyWalker,t,e)}function buildLookaheadForManySep(t,e){return buildLookAheadForGrammarProd(o.NextInsideManySepWalker,t,e)}function buildLookaheadForAtLeastOne(t,e){return buildLookAheadForGrammarProd(o.NextInsideAtLeastOneWalker,t,e)}function buildLookaheadForAtLeastOneSep(t,e){return buildLookAheadForGrammarProd(o.NextInsideAtLeastOneSepWalker,t,e)}function buildLookaheadForOr(t,e,n){void 0===n&&(n=!1);var r=new o.NextInsideOrWalker(e,t).startWalking();n||checkForOrAmbiguities(r,t,e);var i=a.isEmpty(a.last(r));if(i){var s=r.length-1;return function(){for(var t=this.NEXT_TOKEN(),e=0;s>e;e++)for(var n=r[e],i=0;i in inside <"+n.name+"> "+("Rule, <"+s.tokenName(t.token)+"> may appears as the first Terminal in all these alternatives.\n")});throw new Error(i.join("\n ---------------- \n")+"To Resolve this, either: \n1. refactor your grammar to be LL(1)\n2. provide explicit lookahead functions in the form {WHEN:laFunc, THEN_DO:...}\n3. Add ignore arg to this OR Production:\nOR([], 'msg', recognizer.IGNORE_AMBIGUITIES)\nIn that case the parser will always pick the first alternative that matches and ignore all the others")}}function checkAlternativesAmbiguities(t){var e=a.flatten(t),n=a.uniq(e),r=a.map(n,function(e){var n=a.pick(t,function(t){return a.find(t,function(t){return t===e})}),r=a.map(a.keys(n),function(t){return parseInt(t,10)+1});return{token:e,alts:r}}),i=a.filter(r,function(t){return t.alts.length>1});return i}function buildLookAheadForGrammarProd(t,e,n){var r={ruleStack:[n.name],occurrenceStack:[1],occurrence:e},i=new t(n,r),o=i.startWalking();return getSimpleLookahead(o)}function getSimpleLookahead(t){return function(){for(var e=this.NEXT_TOKEN(),n=0;nt||t>e)}var n=function(){function Range(t,e){if(this.start=t,this.end=e,!isValidRange(t,e))throw new Error("INVALID RANGE")}return Range.prototype.contains=function(t){return this.start<=t&&this.end>=t},Range.prototype.containsRange=function(t){return this.start<=t.start&&this.end>=t.end},Range.prototype.isContainedInRange=function(t){return t.containsRange(this)},Range.prototype.strictlyContainsRange=function(t){return this.startt.end},Range.prototype.isStrictlyContainedInRange=function(t){return t.strictlyContainsRange(this)},Range}();e.Range=n,e.isValidRange=isValidRange},function(t,e,n){"use strict";function clearCache(){r.clearCache()}var r=n(2);e.clearCache=clearCache}])}); \ No newline at end of file diff --git a/src/api.ts b/src/api.ts index 99b682293..0220c5e48 100644 --- a/src/api.ts +++ b/src/api.ts @@ -12,7 +12,7 @@ import {clearCache} from "./parse/cache_public" let API:any = {} // semantic version -API.VERSION = "0.5.19" +API.VERSION = "0.5.20" // runtime API API.Parser = Parser