From 435595557e2bbb76d84789c1d2fd13bf5489063d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Feb 2013 19:17:43 +0100 Subject: [PATCH 001/417] SHA-1: 34233d9a278fba3bf65e427336a33ac50d188e5d * Added fix for when grammar file leaves some (invisible) whitespace on the empty lines between lexer rules: previously, the lexer would, depending on the exact input, barf an inexplicable hairball or (worse!) fail silently. Unit tests to verify the success of the fix have been included. --- lex.l | 1 + lex.y | 3 ++- tests/all-tests.js | 25 +++++++++++++++++++++++++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/lex.l b/lex.l index 02d77cb..1cfc1df 100644 --- a/lex.l +++ b/lex.l @@ -16,6 +16,7 @@ NAME [a-zA-Z_][a-zA-Z0-9_-]* "*" return '*'; \n+ /* */ +\s+\n+ /* */ \s+ this.begin('indented'); "%%" this.begin('code'); return '%%'; [a-zA-Z0-9_]+ return 'CHARACTER_LIT'; diff --git a/lex.y b/lex.y index 0502d5e..a798337 100644 --- a/lex.y +++ b/lex.y @@ -197,7 +197,7 @@ range_regex string : STRING_LIT - { $$ = prepareString(yytext.substr(1, yytext.length-2)); } + { $$ = prepareString(yytext.substr(1, yytext.length - 2)); } | CHARACTER_LIT ; @@ -213,3 +213,4 @@ function prepareString (s) { s = encodeRE(s); return s; }; + diff --git a/tests/all-tests.js b/tests/all-tests.js index 86db832..3716040 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -301,5 +301,30 @@ exports["test comments"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test no brace action with surplus whitespace between rules"] = function () { + var lexgrammar = '%%\n"a" return true;\n \n"b" return 1;\n \n'; + var expected = { + rules: [ + ["a\\b", "return true;"], + ["b\\b", "return 1;"] + ] + }; + + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + +exports["test braced action with surplus whitespace between rules"] = function () { + var lexgrammar = '%%\n"a" %{ \nreturn true;\n%} \n \n"b" %{ return 1;\n%} \n \n'; + var expected = { + rules: [ + ["a\\b", " \nreturn true;\n"], + ["b\\b", " return 1;\n"] + ] + }; + + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + + if (require.main === module) require("test").run(exports); From b51eb3f55a473c43f3327f17aaa63726bf3d4ac2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Jun 2013 02:07:31 +0200 Subject: [PATCH 002/417] updating the NPM package while finding out the proper way to completely rebuild jison from scratch --- package.json | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 68d86aa..0e42b50 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,6 @@ "scripts": { "test": "make test" }, - "repository": "", "keywords": [ "lexical", "grammar", @@ -14,9 +13,13 @@ "jison" ], "author": "Zach Carter", + "repository": { + "type": "git", + "url": "git://github.com/zaach/lex-parser.git" + }, "license": "MIT", "devDependencies": { - "jison": "0.4.x", + "jison": "git://github.com/GerHobbelt/jison.git", "test": "*" } } From c2ff97b352f223cc8f4cb254104568042e50be03 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Jun 2013 02:31:50 +0200 Subject: [PATCH 003/417] Make sure the 'compiled' output (lex-parser.js) is included in the repository, otherwise that file will be missing when this package is loaded by the dependent modules, such as jison-lex, via Node/NPM: their `npm install` expects the lex-parser.js file to simply be there already! --- .gitignore | 1 - lex-parser.js | 830 ++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 831 insertions(+), 2 deletions(-) create mode 100644 lex-parser.js diff --git a/.gitignore b/.gitignore index 8c32b70..b1a6b49 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,3 @@ -lex-parser.js node_modules/ # Editor bak files diff --git a/lex-parser.js b/lex-parser.js new file mode 100644 index 0000000..94026dd --- /dev/null +++ b/lex-parser.js @@ -0,0 +1,830 @@ +/* parser generated by jison 0.4.2 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} + } + + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), + stateStackSize: function(), + + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, + + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, + } + } + + + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + } + + + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + } +*/ +var lexParser = (function(){ +var parser = {trace: function trace() { }, +yy: {}, +symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"ACTION_BODY":25,"<":26,"name_list":27,">":28,"*":29,",":30,"regex_list":31,"|":32,"regex_concat":33,"regex_base":34,"(":35,")":36,"SPECIAL_GROUP":37,"+":38,"?":39,"/":40,"/!":41,"name_expansion":42,"range_regex":43,"any_group_regex":44,".":45,"^":46,"$":47,"string":48,"escape_char":49,"NAME_BRACE":50,"ANY_GROUP_REGEX":51,"ESCAPE_CHAR":52,"RANGE_REGEX":53,"STRING_LIT":54,"CHARACTER_LIT":55,"$accept":0,"$end":1}, +terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"START_COND",22:"{",24:"}",25:"ACTION_BODY",26:"<",28:">",29:"*",30:",",32:"|",35:"(",36:")",37:"SPECIAL_GROUP",38:"+",39:"?",40:"/",41:"/!",45:".",46:"^",47:"$",50:"NAME_BRACE",51:"ANY_GROUP_REGEX",52:"ESCAPE_CHAR",53:"RANGE_REGEX",54:"STRING_LIT",55:"CHARACTER_LIT"}, +productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[19,3],[21,3],[21,1],[23,0],[23,1],[23,5],[23,4],[20,3],[20,3],[20,0],[27,1],[27,3],[13,1],[31,3],[31,2],[31,1],[31,0],[33,2],[33,1],[34,3],[34,3],[34,2],[34,2],[34,2],[34,2],[34,2],[34,1],[34,2],[34,1],[34,1],[34,1],[34,1],[34,1],[34,1],[42,1],[44,1],[49,1],[43,1],[48,1],[48,1]], +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */ +/**/) { +/* this == yyval */ + +var $0 = $$.length - 1; +switch (yystate) { +case 1: + this.$ = { rules: $$[$0-1] }; + if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; + if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; + if ($$[$0]) this.$.moduleInclude = $$[$0]; + if (yy.options) this.$.options = yy.options; + if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; + delete yy.options; + delete yy.actionInclude; + return this.$; + +break; +case 2: this.$ = null; +break; +case 3: this.$ = null; +break; +case 4: this.$ = $$[$0-1]; +break; +case 5: + this.$ = $$[$0]; + if ('length' in $$[$0-1]) { + this.$[0] = this.$[0] || {}; + this.$[0][$$[$0-1][0]] = $$[$0-1][1]; + } else { + this.$[1] = this.$[1] || {}; + for (var name in $$[$0-1]) { + this.$[1][name] = $$[$0-1][name]; + } + } + +break; +case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +break; +case 7: yy.actionInclude = ''; this.$ = [null,null]; +break; +case 8: this.$ = [$$[$0-1], $$[$0]]; +break; +case 9: this.$ = $$[$0]; +break; +case 10: this.$ = $$[$0]; +break; +case 11: this.$ = {}; this.$[$$[$0]] = 0; +break; +case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +break; +case 13: this.$ = {}; this.$[$$[$0]] = 1; +break; +case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +break; +case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); +break; +case 16: this.$ = [$$[$0]]; +break; +case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; +break; +case 18:this.$ = $$[$0-1]; +break; +case 19:this.$ = $$[$0]; +break; +case 20:this.$ = ''; +break; +case 21:this.$ = yytext; +break; +case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 24: this.$ = $$[$0-1]; +break; +case 25: this.$ = ['*']; +break; +case 27: this.$ = [$$[$0]]; +break; +case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); +break; +case 29: + this.$ = $$[$0]; + if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) + this.$ += "\\b"; + +break; +case 30: this.$ = $$[$0-2] + '|' + $$[$0]; +break; +case 31: this.$ = $$[$0-1] + '|'; +break; +case 33: this.$ = '' +break; +case 34: this.$ = $$[$0-1] + $$[$0]; +break; +case 36: this.$ = '(' + $$[$0-1] + ')'; +break; +case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; +break; +case 38: this.$ = $$[$0-1] + '+'; +break; +case 39: this.$ = $$[$0-1] + '*'; +break; +case 40: this.$ = $$[$0-1] + '?'; +break; +case 41: this.$ = '(?=' + $$[$0] + ')'; +break; +case 42: this.$ = '(?!' + $$[$0] + ')'; +break; +case 44: this.$ = $$[$0-1] + $$[$0]; +break; +case 46: this.$ = '.'; +break; +case 47: this.$ = '^'; +break; +case 48: this.$ = '$'; +break; +case 52: this.$ = yytext; +break; +case 53: this.$ = yytext; +break; +case 54: this.$ = yytext; +break; +case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +break; +} +}, +table: [{3:1,4:2,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{1:[3]},{5:[1,8]},{4:9,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{4:10,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{5:[2,33],11:[2,33],12:[2,33],13:11,14:[2,33],16:[2,33],31:12,32:[2,33],33:13,34:14,35:[1,15],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:35,11:[2,26],19:36,20:37,22:[2,26],26:[1,38],32:[2,26],35:[2,26],37:[2,26],40:[2,26],41:[2,26],45:[2,26],46:[2,26],47:[2,26],50:[2,26],51:[2,26],52:[2,26],54:[2,26],55:[2,26]},{5:[2,5]},{5:[2,6]},{5:[2,8],11:[2,8],12:[2,8],14:[2,8],16:[2,8]},{5:[2,29],11:[2,29],12:[2,29],14:[2,29],16:[2,29],22:[2,29],32:[1,39]},{5:[2,32],11:[2,32],12:[2,32],14:[2,32],16:[2,32],22:[2,32],32:[2,32],34:40,35:[1,15],36:[2,32],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{5:[2,35],11:[2,35],12:[2,35],14:[2,35],16:[2,35],22:[2,35],29:[1,42],32:[2,35],35:[2,35],36:[2,35],37:[2,35],38:[1,41],39:[1,43],40:[2,35],41:[2,35],43:44,45:[2,35],46:[2,35],47:[2,35],50:[2,35],51:[2,35],52:[2,35],53:[1,45],54:[2,35],55:[2,35]},{31:46,32:[2,33],33:13,34:14,35:[1,15],36:[2,33],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{31:47,32:[2,33],33:13,34:14,35:[1,15],36:[2,33],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{34:48,35:[1,15],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{34:49,35:[1,15],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{5:[2,43],11:[2,43],12:[2,43],14:[2,43],16:[2,43],22:[2,43],29:[2,43],32:[2,43],35:[2,43],36:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],46:[2,43],47:[2,43],50:[2,43],51:[2,43],52:[2,43],53:[2,43],54:[2,43],55:[2,43]},{5:[2,45],11:[2,45],12:[2,45],14:[2,45],16:[2,45],22:[2,45],29:[2,45],32:[2,45],35:[2,45],36:[2,45],37:[2,45],38:[2,45],39:[2,45],40:[2,45],41:[2,45],45:[2,45],46:[2,45],47:[2,45],50:[2,45],51:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45]},{5:[2,46],11:[2,46],12:[2,46],14:[2,46],16:[2,46],22:[2,46],29:[2,46],32:[2,46],35:[2,46],36:[2,46],37:[2,46],38:[2,46],39:[2,46],40:[2,46],41:[2,46],45:[2,46],46:[2,46],47:[2,46],50:[2,46],51:[2,46],52:[2,46],53:[2,46],54:[2,46],55:[2,46]},{5:[2,47],11:[2,47],12:[2,47],14:[2,47],16:[2,47],22:[2,47],29:[2,47],32:[2,47],35:[2,47],36:[2,47],37:[2,47],38:[2,47],39:[2,47],40:[2,47],41:[2,47],45:[2,47],46:[2,47],47:[2,47],50:[2,47],51:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47]},{5:[2,48],11:[2,48],12:[2,48],14:[2,48],16:[2,48],22:[2,48],29:[2,48],32:[2,48],35:[2,48],36:[2,48],37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],45:[2,48],46:[2,48],47:[2,48],50:[2,48],51:[2,48],52:[2,48],53:[2,48],54:[2,48],55:[2,48]},{5:[2,49],11:[2,49],12:[2,49],14:[2,49],16:[2,49],22:[2,49],29:[2,49],32:[2,49],35:[2,49],36:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],45:[2,49],46:[2,49],47:[2,49],50:[2,49],51:[2,49],52:[2,49],53:[2,49],54:[2,49],55:[2,49]},{5:[2,50],11:[2,50],12:[2,50],14:[2,50],16:[2,50],22:[2,50],29:[2,50],32:[2,50],35:[2,50],36:[2,50],37:[2,50],38:[2,50],39:[2,50],40:[2,50],41:[2,50],45:[2,50],46:[2,50],47:[2,50],50:[2,50],51:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50]},{5:[2,51],11:[2,51],12:[2,51],14:[2,51],16:[2,51],22:[2,51],29:[2,51],32:[2,51],35:[2,51],36:[2,51],37:[2,51],38:[2,51],39:[2,51],40:[2,51],41:[2,51],45:[2,51],46:[2,51],47:[2,51],50:[2,51],51:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51]},{5:[2,52],11:[2,52],12:[2,52],14:[2,52],16:[2,52],22:[2,52],29:[2,52],32:[2,52],35:[2,52],36:[2,52],37:[2,52],38:[2,52],39:[2,52],40:[2,52],41:[2,52],45:[2,52],46:[2,52],47:[2,52],50:[2,52],51:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52]},{5:[2,55],11:[2,55],12:[2,55],14:[2,55],16:[2,55],22:[2,55],29:[2,55],32:[2,55],35:[2,55],36:[2,55],37:[2,55],38:[2,55],39:[2,55],40:[2,55],41:[2,55],45:[2,55],46:[2,55],47:[2,55],50:[2,55],51:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55]},{5:[2,56],11:[2,56],12:[2,56],14:[2,56],16:[2,56],22:[2,56],29:[2,56],32:[2,56],35:[2,56],36:[2,56],37:[2,56],38:[2,56],39:[2,56],40:[2,56],41:[2,56],45:[2,56],46:[2,56],47:[2,56],50:[2,56],51:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56]},{5:[2,53],11:[2,53],12:[2,53],14:[2,53],16:[2,53],22:[2,53],29:[2,53],32:[2,53],35:[2,53],36:[2,53],37:[2,53],38:[2,53],39:[2,53],40:[2,53],41:[2,53],45:[2,53],46:[2,53],47:[2,53],50:[2,53],51:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53]},{5:[2,9],11:[2,9],12:[2,9],14:[2,9],16:[2,9],18:[1,50]},{5:[2,11],11:[2,11],12:[2,11],14:[2,11],16:[2,11],18:[2,11]},{5:[2,10],11:[2,10],12:[2,10],14:[2,10],16:[2,10],18:[1,51]},{5:[2,13],11:[2,13],12:[2,13],14:[2,13],16:[2,13],18:[2,13]},{5:[1,55],7:52,8:[1,54],11:[2,26],19:53,20:37,22:[2,26],26:[1,38],32:[2,26],35:[2,26],37:[2,26],40:[2,26],41:[2,26],45:[2,26],46:[2,26],47:[2,26],50:[2,26],51:[2,26],52:[2,26],54:[2,26],55:[2,26]},{5:[2,16],8:[2,16],11:[2,16],22:[2,16],26:[2,16],32:[2,16],35:[2,16],37:[2,16],40:[2,16],41:[2,16],45:[2,16],46:[2,16],47:[2,16],50:[2,16],51:[2,16],52:[2,16],54:[2,16],55:[2,16]},{11:[2,33],13:56,22:[2,33],31:12,32:[2,33],33:13,34:14,35:[1,15],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{12:[1,59],27:57,29:[1,58]},{5:[2,31],11:[2,31],12:[2,31],14:[2,31],16:[2,31],22:[2,31],32:[2,31],33:60,34:14,35:[1,15],36:[2,31],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{5:[2,34],11:[2,34],12:[2,34],14:[2,34],16:[2,34],22:[2,34],29:[1,42],32:[2,34],35:[2,34],36:[2,34],37:[2,34],38:[1,41],39:[1,43],40:[2,34],41:[2,34],43:44,45:[2,34],46:[2,34],47:[2,34],50:[2,34],51:[2,34],52:[2,34],53:[1,45],54:[2,34],55:[2,34]},{5:[2,38],11:[2,38],12:[2,38],14:[2,38],16:[2,38],22:[2,38],29:[2,38],32:[2,38],35:[2,38],36:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],41:[2,38],45:[2,38],46:[2,38],47:[2,38],50:[2,38],51:[2,38],52:[2,38],53:[2,38],54:[2,38],55:[2,38]},{5:[2,39],11:[2,39],12:[2,39],14:[2,39],16:[2,39],22:[2,39],29:[2,39],32:[2,39],35:[2,39],36:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],41:[2,39],45:[2,39],46:[2,39],47:[2,39],50:[2,39],51:[2,39],52:[2,39],53:[2,39],54:[2,39],55:[2,39]},{5:[2,40],11:[2,40],12:[2,40],14:[2,40],16:[2,40],22:[2,40],29:[2,40],32:[2,40],35:[2,40],36:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],45:[2,40],46:[2,40],47:[2,40],50:[2,40],51:[2,40],52:[2,40],53:[2,40],54:[2,40],55:[2,40]},{5:[2,44],11:[2,44],12:[2,44],14:[2,44],16:[2,44],22:[2,44],29:[2,44],32:[2,44],35:[2,44],36:[2,44],37:[2,44],38:[2,44],39:[2,44],40:[2,44],41:[2,44],45:[2,44],46:[2,44],47:[2,44],50:[2,44],51:[2,44],52:[2,44],53:[2,44],54:[2,44],55:[2,44]},{5:[2,54],11:[2,54],12:[2,54],14:[2,54],16:[2,54],22:[2,54],29:[2,54],32:[2,54],35:[2,54],36:[2,54],37:[2,54],38:[2,54],39:[2,54],40:[2,54],41:[2,54],45:[2,54],46:[2,54],47:[2,54],50:[2,54],51:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54]},{32:[1,39],36:[1,61]},{32:[1,39],36:[1,62]},{5:[2,41],11:[2,41],12:[2,41],14:[2,41],16:[2,41],22:[2,41],29:[1,42],32:[2,41],35:[2,41],36:[2,41],37:[2,41],38:[1,41],39:[1,43],40:[2,41],41:[2,41],43:44,45:[2,41],46:[2,41],47:[2,41],50:[2,41],51:[2,41],52:[2,41],53:[1,45],54:[2,41],55:[2,41]},{5:[2,42],11:[2,42],12:[2,42],14:[2,42],16:[2,42],22:[2,42],29:[1,42],32:[2,42],35:[2,42],36:[2,42],37:[2,42],38:[1,41],39:[1,43],40:[2,42],41:[2,42],43:44,45:[2,42],46:[2,42],47:[2,42],50:[2,42],51:[2,42],52:[2,42],53:[1,45],54:[2,42],55:[2,42]},{5:[2,12],11:[2,12],12:[2,12],14:[2,12],16:[2,12],18:[2,12]},{5:[2,14],11:[2,14],12:[2,14],14:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{5:[2,15],8:[2,15],11:[2,15],22:[2,15],26:[2,15],32:[2,15],35:[2,15],37:[2,15],40:[2,15],41:[2,15],45:[2,15],46:[2,15],47:[2,15],50:[2,15],51:[2,15],52:[2,15],54:[2,15],55:[2,15]},{1:[2,2]},{8:[1,63],9:[1,64]},{11:[1,67],21:65,22:[1,66]},{28:[1,68],30:[1,69]},{28:[1,70]},{28:[2,27],30:[2,27]},{5:[2,30],11:[2,30],12:[2,30],14:[2,30],16:[2,30],22:[2,30],32:[2,30],34:40,35:[1,15],36:[2,30],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{5:[2,36],11:[2,36],12:[2,36],14:[2,36],16:[2,36],22:[2,36],29:[2,36],32:[2,36],35:[2,36],36:[2,36],37:[2,36],38:[2,36],39:[2,36],40:[2,36],41:[2,36],45:[2,36],46:[2,36],47:[2,36],50:[2,36],51:[2,36],52:[2,36],53:[2,36],54:[2,36],55:[2,36]},{5:[2,37],11:[2,37],12:[2,37],14:[2,37],16:[2,37],22:[2,37],29:[2,37],32:[2,37],35:[2,37],36:[2,37],37:[2,37],38:[2,37],39:[2,37],40:[2,37],41:[2,37],45:[2,37],46:[2,37],47:[2,37],50:[2,37],51:[2,37],52:[2,37],53:[2,37],54:[2,37],55:[2,37]},{1:[2,3]},{8:[1,71]},{5:[2,17],8:[2,17],11:[2,17],22:[2,17],26:[2,17],32:[2,17],35:[2,17],37:[2,17],40:[2,17],41:[2,17],45:[2,17],46:[2,17],47:[2,17],50:[2,17],51:[2,17],52:[2,17],54:[2,17],55:[2,17]},{22:[2,20],23:72,24:[2,20],25:[1,73]},{5:[2,19],8:[2,19],11:[2,19],22:[2,19],26:[2,19],32:[2,19],35:[2,19],37:[2,19],40:[2,19],41:[2,19],45:[2,19],46:[2,19],47:[2,19],50:[2,19],51:[2,19],52:[2,19],54:[2,19],55:[2,19]},{11:[2,24],22:[2,24],32:[2,24],35:[2,24],37:[2,24],40:[2,24],41:[2,24],45:[2,24],46:[2,24],47:[2,24],50:[2,24],51:[2,24],52:[2,24],54:[2,24],55:[2,24]},{12:[1,74]},{11:[2,25],22:[2,25],32:[2,25],35:[2,25],37:[2,25],40:[2,25],41:[2,25],45:[2,25],46:[2,25],47:[2,25],50:[2,25],51:[2,25],52:[2,25],54:[2,25],55:[2,25]},{1:[2,4]},{22:[1,76],24:[1,75]},{22:[2,21],24:[2,21]},{28:[2,28],30:[2,28]},{5:[2,18],8:[2,18],11:[2,18],22:[2,18],26:[2,18],32:[2,18],35:[2,18],37:[2,18],40:[2,18],41:[2,18],45:[2,18],46:[2,18],47:[2,18],50:[2,18],51:[2,18],52:[2,18],54:[2,18],55:[2,18]},{22:[2,20],23:77,24:[2,20],25:[1,73]},{22:[1,76],24:[1,78]},{22:[2,23],24:[2,23],25:[1,79]},{22:[2,22],24:[2,22]}], +defaultActions: {9:[2,5],10:[2,6],52:[2,1],54:[2,2],63:[2,3],71:[2,4]}, +parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + throw new Error(str); + } +}, +parse: function parse(input) { + var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc === "undefined") { + this.lexer.yylloc = {}; + } + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + var ranges = this.lexer.options && this.lexer.options.ranges; + if (typeof this.yy.parseError === "function") { + this.parseError = this.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + function lex() { + var token; + token = self.lexer.lex() || EOF; + if (typeof token !== "number") { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol === "undefined") { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === "undefined" || !action.length || !action[0]) { + var errStr = ""; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (this.lexer.showPosition) { + errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); + } + this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + if (typeof r !== "undefined") { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; +} +}; + + +function encodeRE (s) { + return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g,'\\u$1'); +} + +function prepareString (s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; +}; + +/* generated by jison-lex 0.1.0 */ +var lexer = (function(){ +var lexer = { + +EOF:1, + +parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + +// resets the lexer, sets new input +setInput:function (input) { + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0,0]; + } + this.offset = 0; + return this; + }, + +// consumes and returns one char from the input +input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + + this._input = this._input.slice(1); + return ch; + }, + +// unshifts one char (or a string) into the input +unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + +// When called from action, caches matched text and appends it on next action +more:function () { + this._more = true; + return this; + }, + +// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +reject:function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + + } + return this; + }, + +// retain first n characters of the match +less:function (n) { + this.unput(this.match.slice(n)); + }, + +// displays already matched input, i.e. for error messages +pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, + +// displays upcoming input, i.e. for error messages +upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + +// displays the character position where the lexing error occurred, i.e. for error messages +showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + +// test the lexed token: return FALSE when not a match, otherwise return token +test_match:function (match, indexed_rule) { + var token, + lines, + backup; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? + lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + if (this.options.backtrack_lexer) { + delete backup; + } + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. + } + if (this.options.backtrack_lexer) { + delete backup; + } + return false; + }, + +// return next match in input +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + + var token, + match, + tempMatch, + index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + +// return next match that has a token +lex:function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + +// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +begin:function begin(condition) { + this.conditionStack.push(condition); + }, + +// pop the previously active lexer condition state off the condition stack +popState:function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + +// produce the lexer rule set which is active for the currently active lexer condition state +_currentRules:function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + +// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +topState:function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + +// alias for begin(condition) +pushState:function pushState(condition) { + this.begin(condition); + }, + +// return the number of states currently on the stack +stateStackSize:function stateStackSize() { + return this.conditionStack.length; + }, +options: {}, +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START +/**/) { + +var YYSTATE=YY_START; +switch($avoiding_name_collisions) { +case 0:return 25; +break; +case 1:yy.depth++; return 22; +break; +case 2:yy.depth == 0 ? this.begin('trail') : yy.depth--; return 24; +break; +case 3:return 12; +break; +case 4:this.popState(); return 28; +break; +case 5:return 30; +break; +case 6:return 29; +break; +case 7:/* */ +break; +case 8:/* */ +break; +case 9:this.begin('indented'); +break; +case 10:this.begin('code'); return 5; +break; +case 11:return 55; +break; +case 12:yy.options[yy_.yytext] = true; +break; +case 13:this.begin('INITIAL'); +break; +case 14:this.begin('INITIAL'); +break; +case 15:/* empty */ +break; +case 16:return 18; +break; +case 17:this.begin('INITIAL'); +break; +case 18:this.begin('INITIAL'); +break; +case 19:/* empty */ +break; +case 20:this.begin('rules'); +break; +case 21:yy.depth = 0; this.begin('action'); return 22; +break; +case 22:this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4);return 11; +break; +case 23:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4); return 11; +break; +case 24:this.begin('rules'); return 11; +break; +case 25:/* ignore */ +break; +case 26:/* ignore */ +break; +case 27:/* */ +break; +case 28:/* */ +break; +case 29:return 12; +break; +case 30:yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 54; +break; +case 31:yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 54; +break; +case 32:return 32; +break; +case 33:return 51; +break; +case 34:return 37; +break; +case 35:return 37; +break; +case 36:return 37; +break; +case 37:return 35; +break; +case 38:return 36; +break; +case 39:return 38; +break; +case 40:return 29; +break; +case 41:return 39; +break; +case 42:return 46; +break; +case 43:return 30; +break; +case 44:return 47; +break; +case 45:this.begin('conditions'); return 26; +break; +case 46:return 41; +break; +case 47:return 40; +break; +case 48:return 52; +break; +case 49:yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 52; +break; +case 50:return 47; +break; +case 51:return 45; +break; +case 52:yy.options = {}; this.begin('options'); +break; +case 53:this.begin('start_condition'); return 14; +break; +case 54:this.begin('start_condition'); return 16; +break; +case 55:this.begin('rules'); return 5; +break; +case 56:return 53; +break; +case 57:return 50; +break; +case 58:return 22; +break; +case 59:return 24; +break; +case 60:/* ignore bad characters */ +break; +case 61:return 8; +break; +case 62:return 9; +break; +} +}, +rules: [/^(?:[^{}]+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:\n+)/,/^(?:\s+\n+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:\n+)/,/^(?:\s+\n+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:\n+)/,/^(?:\s+\n+)/,/^(?:\s+)/,/^(?:.*\n+)/,/^(?:\{)/,/^(?:%\{(.|\n)*?%\})/,/^(?:%\{(.|\n)*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\n+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|\n)+)/], +conditions: {"code":{"rules":[61,62],"inclusive":false},"start_condition":{"rules":[16,17,18,19,61],"inclusive":false},"options":{"rules":[12,13,14,15,61],"inclusive":false},"conditions":{"rules":[3,4,5,6,61],"inclusive":false},"action":{"rules":[0,1,2,61],"inclusive":false},"indented":{"rules":[21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],"inclusive":true},"trail":{"rules":[20,23,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],"inclusive":true},"rules":{"rules":[7,8,9,10,11,23,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],"inclusive":true},"INITIAL":{"rules":[23,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],"inclusive":true}} +}; +return lexer; +})(); +parser.lexer = lexer; +function Parser () { + this.yy = {}; +} +Parser.prototype = parser;parser.Parser = Parser; +return new Parser; +})(); + + +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { +exports.parser = lexParser; +exports.Parser = lexParser.Parser; +exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; +exports.main = function commonjsMain(args) { + if (!args[1]) { + console.log('Usage: '+args[0]+' FILE'); + process.exit(1); + } + var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); + return exports.parser.parse(source); +}; +if (typeof module !== 'undefined' && require.main === module) { + exports.main(process.argv.slice(1)); +} +} \ No newline at end of file diff --git a/package.json b/package.json index 0e42b50..47e620d 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,6 @@ "license": "MIT", "devDependencies": { "jison": "git://github.com/GerHobbelt/jison.git", - "test": "*" + "test": ">=0.4.0" } } From 5ded3824a78dc7f81fdfba3f9f88a100af8f1e36 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Jun 2013 02:34:56 +0200 Subject: [PATCH 004/417] regenerated the output; all tests pass --- lex-parser.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 94026dd..c3b27b4 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -72,7 +72,7 @@ recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ -var lexParser = (function(){ +var lex = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"ACTION_BODY":25,"<":26,"name_list":27,">":28,"*":29,",":30,"regex_list":31,"|":32,"regex_concat":33,"regex_base":34,"(":35,")":36,"SPECIAL_GROUP":37,"+":38,"?":39,"/":40,"/!":41,"name_expansion":42,"range_regex":43,"any_group_regex":44,".":45,"^":46,"$":47,"string":48,"escape_char":49,"NAME_BRACE":50,"ANY_GROUP_REGEX":51,"ESCAPE_CHAR":52,"RANGE_REGEX":53,"STRING_LIT":54,"CHARACTER_LIT":55,"$accept":0,"$end":1}, @@ -813,9 +813,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lexParser; -exports.Parser = lexParser.Parser; -exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; +exports.parser = lex; +exports.Parser = lex.Parser; +exports.parse = function () { return lex.parse.apply(lex, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); From 29f84eda1877d65280a5cd411a1f4ec0d3f1c444 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Jun 2013 03:49:17 +0200 Subject: [PATCH 005/417] use (") double-quotes for require(): quick hack to keep the SED script in jison Makefile consistent --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 785bf85..6913c62 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ This will generate `lex-parser.js`. ## usage - var lexParser = require('lex-parser'); + var lexParser = require("lex-parser"); // parse a lexical grammar and return JSON lexParser.parse("%% ... "); From 307bd8abc6968a13b2a0edebceb1e36f1bead1af Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Jun 2013 04:25:15 +0200 Subject: [PATCH 006/417] all jison module Makefiles now have `clean` and `superclean` targets --- Makefile | 9 +++++++++ lex-parser.js | 8 ++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index fba86cc..8e1add5 100644 --- a/Makefile +++ b/Makefile @@ -11,3 +11,12 @@ build: test: node tests/all-tests.js + + + +clean: + +superclean: clean + -find . -type d -name 'node_modules' -exec rm -rf "{}" \; + + diff --git a/lex-parser.js b/lex-parser.js index c3b27b4..94026dd 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -72,7 +72,7 @@ recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ -var lex = (function(){ +var lexParser = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"ACTION_BODY":25,"<":26,"name_list":27,">":28,"*":29,",":30,"regex_list":31,"|":32,"regex_concat":33,"regex_base":34,"(":35,")":36,"SPECIAL_GROUP":37,"+":38,"?":39,"/":40,"/!":41,"name_expansion":42,"range_regex":43,"any_group_regex":44,".":45,"^":46,"$":47,"string":48,"escape_char":49,"NAME_BRACE":50,"ANY_GROUP_REGEX":51,"ESCAPE_CHAR":52,"RANGE_REGEX":53,"STRING_LIT":54,"CHARACTER_LIT":55,"$accept":0,"$end":1}, @@ -813,9 +813,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lex; -exports.Parser = lex.Parser; -exports.parse = function () { return lex.parse.apply(lex, arguments); }; +exports.parser = lexParser; +exports.Parser = lexParser.Parser; +exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); From 9d6b7615b65fba43580832d2a259f568fcb91520 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Jun 2013 05:33:34 +0200 Subject: [PATCH 007/417] updated generated parser documentation --- lex-parser.js | 92 +++++++++++++++++++++++++-------------------------- 1 file changed, 46 insertions(+), 46 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 94026dd..02c4ab6 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -68,8 +68,8 @@ } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) + recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) } */ var lexParser = (function(){ @@ -84,7 +84,7 @@ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* actio var $0 = $$.length - 1; switch (yystate) { -case 1: +case 1: this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; @@ -93,14 +93,14 @@ case 1: if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; delete yy.options; delete yy.actionInclude; - return this.$; - + return this.$; + break; -case 2: this.$ = null; +case 2: this.$ = null; break; -case 3: this.$ = null; +case 3: this.$ = null; break; -case 4: this.$ = $$[$0-1]; +case 4: this.$ = $$[$0-1]; break; case 5: this.$ = $$[$0]; @@ -113,31 +113,31 @@ case 5: this.$[1][name] = $$[$0-1][name]; } } - + break; -case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; break; -case 7: yy.actionInclude = ''; this.$ = [null,null]; +case 7: yy.actionInclude = ''; this.$ = [null,null]; break; -case 8: this.$ = [$$[$0-1], $$[$0]]; +case 8: this.$ = [$$[$0-1], $$[$0]]; break; -case 9: this.$ = $$[$0]; +case 9: this.$ = $$[$0]; break; -case 10: this.$ = $$[$0]; +case 10: this.$ = $$[$0]; break; -case 11: this.$ = {}; this.$[$$[$0]] = 0; +case 11: this.$ = {}; this.$[$$[$0]] = 0; break; -case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; break; -case 13: this.$ = {}; this.$[$$[$0]] = 1; +case 13: this.$ = {}; this.$[$$[$0]] = 1; break; -case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; break; -case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); +case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 16: this.$ = [$$[$0]]; +case 16: this.$ = [$$[$0]]; break; -case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; +case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; break; case 18:this.$ = $$[$0-1]; break; @@ -151,57 +151,57 @@ case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24: this.$ = $$[$0-1]; +case 24: this.$ = $$[$0-1]; break; -case 25: this.$ = ['*']; +case 25: this.$ = ['*']; break; -case 27: this.$ = [$$[$0]]; +case 27: this.$ = [$$[$0]]; break; -case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); +case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 29: +case 29: this.$ = $$[$0]; if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) this.$ += "\\b"; - + break; -case 30: this.$ = $$[$0-2] + '|' + $$[$0]; +case 30: this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 31: this.$ = $$[$0-1] + '|'; +case 31: this.$ = $$[$0-1] + '|'; break; -case 33: this.$ = '' +case 33: this.$ = '' break; -case 34: this.$ = $$[$0-1] + $$[$0]; +case 34: this.$ = $$[$0-1] + $$[$0]; break; -case 36: this.$ = '(' + $$[$0-1] + ')'; +case 36: this.$ = '(' + $$[$0-1] + ')'; break; -case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; +case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 38: this.$ = $$[$0-1] + '+'; +case 38: this.$ = $$[$0-1] + '+'; break; -case 39: this.$ = $$[$0-1] + '*'; +case 39: this.$ = $$[$0-1] + '*'; break; -case 40: this.$ = $$[$0-1] + '?'; +case 40: this.$ = $$[$0-1] + '?'; break; -case 41: this.$ = '(?=' + $$[$0] + ')'; +case 41: this.$ = '(?=' + $$[$0] + ')'; break; -case 42: this.$ = '(?!' + $$[$0] + ')'; +case 42: this.$ = '(?!' + $$[$0] + ')'; break; -case 44: this.$ = $$[$0-1] + $$[$0]; +case 44: this.$ = $$[$0-1] + $$[$0]; break; -case 46: this.$ = '.'; +case 46: this.$ = '.'; break; -case 47: this.$ = '^'; +case 47: this.$ = '^'; break; -case 48: this.$ = '$'; +case 48: this.$ = '$'; break; -case 52: this.$ = yytext; +case 52: this.$ = yytext; break; -case 53: this.$ = yytext; +case 53: this.$ = yytext; break; -case 54: this.$ = yytext; +case 54: this.$ = yytext; break; -case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; } }, From caa023ca8b20652d89f3eeac1780da54e90a69eb Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Jun 2013 06:45:14 +0200 Subject: [PATCH 008/417] regenerated the parser --- lex-parser.js | 413 ++++++++++++++++++++++++++++++++++---------------- 1 file changed, 286 insertions(+), 127 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 02c4ab6..a4c5f07 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -84,7 +84,7 @@ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* actio var $0 = $$.length - 1; switch (yystate) { -case 1: +case 1: this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; @@ -93,14 +93,14 @@ case 1: if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; delete yy.options; delete yy.actionInclude; - return this.$; - + return this.$; + break; -case 2: this.$ = null; +case 2: this.$ = null; break; -case 3: this.$ = null; +case 3: this.$ = null; break; -case 4: this.$ = $$[$0-1]; +case 4: this.$ = $$[$0-1]; break; case 5: this.$ = $$[$0]; @@ -113,31 +113,31 @@ case 5: this.$[1][name] = $$[$0-1][name]; } } - + break; -case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; break; -case 7: yy.actionInclude = ''; this.$ = [null,null]; +case 7: yy.actionInclude = ''; this.$ = [null,null]; break; -case 8: this.$ = [$$[$0-1], $$[$0]]; +case 8: this.$ = [$$[$0-1], $$[$0]]; break; -case 9: this.$ = $$[$0]; +case 9: this.$ = $$[$0]; break; -case 10: this.$ = $$[$0]; +case 10: this.$ = $$[$0]; break; -case 11: this.$ = {}; this.$[$$[$0]] = 0; +case 11: this.$ = {}; this.$[$$[$0]] = 0; break; -case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; break; -case 13: this.$ = {}; this.$[$$[$0]] = 1; +case 13: this.$ = {}; this.$[$$[$0]] = 1; break; -case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; break; -case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); +case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 16: this.$ = [$$[$0]]; +case 16: this.$ = [$$[$0]]; break; -case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; +case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; break; case 18:this.$ = $$[$0-1]; break; @@ -151,57 +151,57 @@ case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24: this.$ = $$[$0-1]; +case 24: this.$ = $$[$0-1]; break; -case 25: this.$ = ['*']; +case 25: this.$ = ['*']; break; -case 27: this.$ = [$$[$0]]; +case 27: this.$ = [$$[$0]]; break; -case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); +case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 29: +case 29: this.$ = $$[$0]; if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) this.$ += "\\b"; - + break; -case 30: this.$ = $$[$0-2] + '|' + $$[$0]; +case 30: this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 31: this.$ = $$[$0-1] + '|'; +case 31: this.$ = $$[$0-1] + '|'; break; -case 33: this.$ = '' +case 33: this.$ = '' break; -case 34: this.$ = $$[$0-1] + $$[$0]; +case 34: this.$ = $$[$0-1] + $$[$0]; break; -case 36: this.$ = '(' + $$[$0-1] + ')'; +case 36: this.$ = '(' + $$[$0-1] + ')'; break; -case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; +case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 38: this.$ = $$[$0-1] + '+'; +case 38: this.$ = $$[$0-1] + '+'; break; -case 39: this.$ = $$[$0-1] + '*'; +case 39: this.$ = $$[$0-1] + '*'; break; -case 40: this.$ = $$[$0-1] + '?'; +case 40: this.$ = $$[$0-1] + '?'; break; -case 41: this.$ = '(?=' + $$[$0] + ')'; +case 41: this.$ = '(?=' + $$[$0] + ')'; break; -case 42: this.$ = '(?!' + $$[$0] + ')'; +case 42: this.$ = '(?!' + $$[$0] + ')'; break; -case 44: this.$ = $$[$0-1] + $$[$0]; +case 44: this.$ = $$[$0-1] + $$[$0]; break; -case 46: this.$ = '.'; +case 46: this.$ = '.'; break; -case 47: this.$ = '^'; +case 47: this.$ = '^'; break; -case 48: this.$ = '$'; +case 48: this.$ = '$'; break; -case 52: this.$ = yytext; +case 52: this.$ = yytext; break; -case 53: this.$ = yytext; +case 53: this.$ = yytext; break; -case 54: this.$ = yytext; +case 54: this.$ = yytext; break; -case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; } }, @@ -215,113 +215,260 @@ parseError: function parseError(str, hash) { } }, parse: function parse(input) { - var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = "", yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + var self = this, + stack = [0], + vstack = [null], // semantic value stack + lstack = [], // location stack + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + + //this.reductionCount = this.shiftCount = 0; + this.lexer.setInput(input); this.lexer.yy = this.yy; this.yy.lexer = this.lexer; this.yy.parser = this; - if (typeof this.lexer.yylloc === "undefined") { + if (typeof this.lexer.yylloc === 'undefined') { this.lexer.yylloc = {}; } var yyloc = this.lexer.yylloc; lstack.push(yyloc); + var ranges = this.lexer.options && this.lexer.options.ranges; - if (typeof this.yy.parseError === "function") { + + if (typeof this.yy.parseError === 'function') { this.parseError = this.yy.parseError; } else { - this.parseError = Object.getPrototypeOf(this).parseError; + this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ } - function popStack(n) { + + function popStack (n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } + function lex() { var token; - token = self.lexer.lex() || EOF; - if (typeof token !== "number") { + token = self.lexer.lex() || EOF; // $end = 1 + // if token isn't its numeric value, convert + if (typeof token !== 'number') { token = self.symbols_[token] || token; } return token; } - var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + + var symbol; + var preErrorSymbol = null; + var state, action, a, r; + var yyval = {}; + var p, len, newState; + var expected = []; + while (true) { + // retreive state number from top of stack state = stack[stack.length - 1]; + + // use default actions if available if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { - if (symbol === null || typeof symbol === "undefined") { + if (symbol === null || typeof symbol === 'undefined') { symbol = lex(); } + // read action for current state and first input action = table[state] && table[state][symbol]; } - if (typeof action === "undefined" || !action.length || !action[0]) { - var errStr = ""; - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push("'" + this.terminals_[p] + "'"); + + // handle parse error + if (typeof action === 'undefined' || !action.length || !action[0]) { + var error_rule_depth; + var errStr = ''; + + // Return the rule stack depth where the nearest error rule can be found. + // Return FALSE when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = stack.length - 1; + var depth = 0; + + // try to recover from error + for(;;) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + return depth; + } + if (state === 0 || stack_probe < 2) { + return false; // No suitable error recovery rule available. + } + stack_probe -= 2; // popStack(1): [symbol, action] + state = stack[stack_probe]; + ++depth; } } - if (this.lexer.showPosition) { - errStr = "Parse error on line " + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(", ") + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = "Parse error on line " + (yylineno + 1) + ": Unexpected " + (symbol == EOF?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); + + if (!recovering) { + // first see if there's any chance at hitting an error recovery rule: + error_rule_depth = locateNearestErrorRecoveryRule(state); + + // Report error + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (this.lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + + (symbol == EOF ? "end of input" : + ("'" + (this.terminals_[symbol] || symbol) + "'")); + } + a = this.parseError(errStr, p = { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: (error_rule_depth !== false) + }); + if (!p.recoverable) { + return a; + } + } else if (preErrorSymbol !== EOF) { + error_rule_depth = locateNearestErrorRecoveryRule(state); } - this.parseError(errStr, {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected}); - } - if (action[0] instanceof Array && action.length > 1) { - throw new Error("Parse Error: multiple actions possible at state: " + state + ", token: " + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { + + // just recovered from another error + if (recovering == 3) { + if (symbol === EOF || preErrorSymbol === EOF) { + return this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + } + + // discard current lookahead and grab another yyleng = this.lexer.yyleng; yytext = this.lexer.yytext; yylineno = this.lexer.yylineno; yyloc = this.lexer.yylloc; - if (recovering > 0) { - recovering--; - } - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = {first_line: lstack[lstack.length - (len || 1)].first_line, last_line: lstack[lstack.length - 1].last_line, first_column: lstack[lstack.length - (len || 1)].first_column, last_column: lstack[lstack.length - 1].last_column}; - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); - if (typeof r !== "undefined") { - return r; + symbol = lex(); } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); + + // try to recover from error + if (error_rule_depth === false) { + return this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - break; - case 3: - return true; + popStack(error_rule_depth); + + preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length-1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } + + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array && action.length > 1) { + return this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); } + + switch (action[0]) { + case 1: // shift + //this.shiftCount++; + + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); // push state + symbol = null; + if (!preErrorSymbol) { // normal execution / no error + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + // error just occurred, resume old lookahead f/ before error + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + + case 2: + // reduce + //this.reductionCount++; + + len = this.productions_[action[1]][1]; + + // perform semantic action + yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 + // default location, uses first token for firsts, last for lasts + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + + if (typeof r !== 'undefined') { + return r; + } + + // pop off stack + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + + stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + vstack.push(yyval.$); + lstack.push(yyval._$); + // goto new state = table[STATE][NONTERMINAL] + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + + case 3: + // accept + return true; + } + } - return true; -} -}; + + // return true; -- unreachable code +}}; function encodeRE (s) { @@ -341,6 +488,8 @@ var lexer = { EOF:1, +ERROR:2, + parseError:function parseError(str, hash) { if (this.yy.parser) { this.yy.parser.parseError(str, hash); @@ -363,7 +512,7 @@ setInput:function (input) { last_column: 0 }; if (this.options.ranges) { - this.yylloc.range = [0,0]; + this.yylloc.range = [0, 0]; } this.offset = 0; return this; @@ -416,8 +565,8 @@ unput:function (ch) { first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len }; if (this.options.ranges) { @@ -438,8 +587,8 @@ reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: "", + this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: this.match, token: null, line: this.yylineno }); @@ -453,26 +602,34 @@ less:function (n) { this.unput(this.match.slice(n)); }, -// displays already matched input, i.e. for error messages -pastInput:function () { +// return (part of the) already matched input, i.e. for error messages +pastInput:function (maxSize) { var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + return (past.length > maxSize ? '...' + past.substr(-maxSize) : past); }, -// displays upcoming input, i.e. for error messages -upcomingInput:function () { +// return (part of the) upcoming input, i.e. for error messages +upcomingInput:function (maxSize) { var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20-next.length); + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + if (next.length < maxSize) { + next += this._input.substr(0, maxSize - next.length); } - return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + return (next.length > maxSize ? next.substr(0, maxSize) + '...' : next); }, -// displays the character position where the lexing error occurred, i.e. for error messages +// return a string which displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { - var pre = this.pastInput(); + var pre = this.pastInput().replace(/\s/g, " "); var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; + return pre + this.upcomingInput().replace(/\s/g, " ") + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token @@ -603,11 +760,13 @@ next:function () { if (this._input === "") { return this.EOF; } else { + // we cannot recover from a lexer error: we consider the input completely lexed: + this.done = true; return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: "", + text: this.match + this._input, token: null, line: this.yylineno - }); + }) || this.ERROR; } }, From 9cd9b28dd4540c391959bd32917a889a4608f2e8 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Jun 2013 20:38:27 +0200 Subject: [PATCH 009/417] whitespace police raid --- lex-parser.js | 94 +++++++++++++++++++++++++-------------------------- lex.l | 32 +++++++++--------- lex.y | 6 ++-- 3 files changed, 66 insertions(+), 66 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index a4c5f07..e536d88 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -84,7 +84,7 @@ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* actio var $0 = $$.length - 1; switch (yystate) { -case 1: +case 1: this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; @@ -93,14 +93,14 @@ case 1: if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; delete yy.options; delete yy.actionInclude; - return this.$; - + return this.$; + break; -case 2: this.$ = null; +case 2: this.$ = null; break; -case 3: this.$ = null; +case 3: this.$ = null; break; -case 4: this.$ = $$[$0-1]; +case 4: this.$ = $$[$0-1]; break; case 5: this.$ = $$[$0]; @@ -113,31 +113,31 @@ case 5: this.$[1][name] = $$[$0-1][name]; } } - + break; -case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; break; -case 7: yy.actionInclude = ''; this.$ = [null,null]; +case 7: yy.actionInclude = ''; this.$ = [null,null]; break; -case 8: this.$ = [$$[$0-1], $$[$0]]; +case 8: this.$ = [$$[$0-1], $$[$0]]; break; -case 9: this.$ = $$[$0]; +case 9: this.$ = $$[$0]; break; -case 10: this.$ = $$[$0]; +case 10: this.$ = $$[$0]; break; -case 11: this.$ = {}; this.$[$$[$0]] = 0; +case 11: this.$ = {}; this.$[$$[$0]] = 0; break; -case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; break; -case 13: this.$ = {}; this.$[$$[$0]] = 1; +case 13: this.$ = {}; this.$[$$[$0]] = 1; break; -case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; break; -case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); +case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 16: this.$ = [$$[$0]]; +case 16: this.$ = [$$[$0]]; break; -case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; +case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; break; case 18:this.$ = $$[$0-1]; break; @@ -151,57 +151,57 @@ case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24: this.$ = $$[$0-1]; +case 24: this.$ = $$[$0-1]; break; -case 25: this.$ = ['*']; +case 25: this.$ = ['*']; break; -case 27: this.$ = [$$[$0]]; +case 27: this.$ = [$$[$0]]; break; -case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); +case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 29: +case 29: this.$ = $$[$0]; if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) this.$ += "\\b"; - + break; -case 30: this.$ = $$[$0-2] + '|' + $$[$0]; +case 30: this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 31: this.$ = $$[$0-1] + '|'; +case 31: this.$ = $$[$0-1] + '|'; break; -case 33: this.$ = '' +case 33: this.$ = '' break; -case 34: this.$ = $$[$0-1] + $$[$0]; +case 34: this.$ = $$[$0-1] + $$[$0]; break; -case 36: this.$ = '(' + $$[$0-1] + ')'; +case 36: this.$ = '(' + $$[$0-1] + ')'; break; -case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; +case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 38: this.$ = $$[$0-1] + '+'; +case 38: this.$ = $$[$0-1] + '+'; break; -case 39: this.$ = $$[$0-1] + '*'; +case 39: this.$ = $$[$0-1] + '*'; break; -case 40: this.$ = $$[$0-1] + '?'; +case 40: this.$ = $$[$0-1] + '?'; break; -case 41: this.$ = '(?=' + $$[$0] + ')'; +case 41: this.$ = '(?=' + $$[$0] + ')'; break; -case 42: this.$ = '(?!' + $$[$0] + ')'; +case 42: this.$ = '(?!' + $$[$0] + ')'; break; -case 44: this.$ = $$[$0-1] + $$[$0]; +case 44: this.$ = $$[$0-1] + $$[$0]; break; -case 46: this.$ = '.'; +case 46: this.$ = '.'; break; -case 47: this.$ = '^'; +case 47: this.$ = '^'; break; -case 48: this.$ = '$'; +case 48: this.$ = '$'; break; -case 52: this.$ = yytext; +case 52: this.$ = yytext; break; -case 53: this.$ = yytext; +case 53: this.$ = yytext; break; -case 54: this.$ = yytext; +case 54: this.$ = yytext; break; -case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; } }, @@ -337,9 +337,9 @@ parse: function parse(input) { expected: expected, recoverable: (error_rule_depth !== false) }); - if (!p.recoverable) { - return a; - } + if (!p.recoverable) { + return a; + } } else if (preErrorSymbol !== EOF) { error_rule_depth = locateNearestErrorRecoveryRule(state); } diff --git a/lex.l b/lex.l index 1cfc1df..7fedede 100644 --- a/lex.l +++ b/lex.l @@ -6,25 +6,25 @@ NAME [a-zA-Z_][a-zA-Z0-9_-]* %% -[^{}]+ return 'ACTION_BODY'; -"{" yy.depth++; return '{'; -"}" yy.depth == 0 ? this.begin('trail') : yy.depth--; return '}'; +[^{}]+ return 'ACTION_BODY'; +"{" yy.depth++; return '{'; +"}" yy.depth == 0 ? this.begin('trail') : yy.depth--; return '}'; -{NAME} return 'NAME'; -">" this.popState(); return '>'; -"," return ','; -"*" return '*'; +{NAME} return 'NAME'; +">" this.popState(); return '>'; +"," return ','; +"*" return '*'; -\n+ /* */ -\s+\n+ /* */ -\s+ this.begin('indented'); -"%%" this.begin('code'); return '%%'; -[a-zA-Z0-9_]+ return 'CHARACTER_LIT'; +\n+ /* */ +\s+\n+ /* */ +\s+ this.begin('indented'); +"%%" this.begin('code'); return '%%'; +[a-zA-Z0-9_]+ return 'CHARACTER_LIT'; -{NAME} yy.options[yytext] = true; -\n+ this.begin('INITIAL'); -\s+\n+ this.begin('INITIAL'); -\s+ /* empty */ +{NAME} yy.options[yytext] = true; +\n+ this.begin('INITIAL'); +\s+\n+ this.begin('INITIAL'); +\s+ /* empty */ {NAME} return 'START_COND'; \n+ this.begin('INITIAL'); diff --git a/lex.y b/lex.y index a798337..a25903a 100644 --- a/lex.y +++ b/lex.y @@ -10,7 +10,7 @@ lex : definitions '%%' rules epilogue - { + { $$ = { rules: $rules }; if ($definitions[0]) $$.macros = $definitions[0]; if ($definitions[1]) $$.startConditions = $definitions[1]; @@ -19,7 +19,7 @@ lex if (yy.actionInclude) $$.actionInclude = yy.actionInclude; delete yy.options; delete yy.actionInclude; - return $$; + return $$; } ; @@ -124,7 +124,7 @@ name_list regex : regex_list - { + { $$ = $1; if (!(yy.options && yy.options.flex) && $$.match(/[\w\d]$/) && !$$.match(/\\(b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) $$ += "\\b"; From 24288ba7a66b3c891b94d37f6fec8a781323c6e0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 10 Jun 2013 20:57:53 +0200 Subject: [PATCH 010/417] regenerated the parser --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index a4c5f07..f0bfb07 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.2 */ +/* parser generated by jison 0.4.4 */ /* Returns a Parser object of the following structure: From 261b6c37a450f5fa803e14abe9c1d506378a324f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 7 Jul 2013 14:43:32 +0200 Subject: [PATCH 011/417] regenerated code and documentation --- lex-parser.js | 105 +++++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 49 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d0e5672..07cb089 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -94,13 +94,13 @@ case 1: delete yy.options; delete yy.actionInclude; return this.$; - + break; -case 2: this.$ = null; +case 2: this.$ = null; break; -case 3: this.$ = null; +case 3: this.$ = null; break; -case 4: this.$ = $$[$0-1]; +case 4: this.$ = $$[$0-1]; break; case 5: this.$ = $$[$0]; @@ -113,31 +113,31 @@ case 5: this.$[1][name] = $$[$0-1][name]; } } - + break; -case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; break; -case 7: yy.actionInclude = ''; this.$ = [null,null]; +case 7: yy.actionInclude = ''; this.$ = [null,null]; break; -case 8: this.$ = [$$[$0-1], $$[$0]]; +case 8: this.$ = [$$[$0-1], $$[$0]]; break; -case 9: this.$ = $$[$0]; +case 9: this.$ = $$[$0]; break; -case 10: this.$ = $$[$0]; +case 10: this.$ = $$[$0]; break; -case 11: this.$ = {}; this.$[$$[$0]] = 0; +case 11: this.$ = {}; this.$[$$[$0]] = 0; break; -case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; break; -case 13: this.$ = {}; this.$[$$[$0]] = 1; +case 13: this.$ = {}; this.$[$$[$0]] = 1; break; -case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; break; -case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); +case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 16: this.$ = [$$[$0]]; +case 16: this.$ = [$$[$0]]; break; -case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; +case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; break; case 18:this.$ = $$[$0-1]; break; @@ -151,57 +151,57 @@ case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24: this.$ = $$[$0-1]; +case 24: this.$ = $$[$0-1]; break; -case 25: this.$ = ['*']; +case 25: this.$ = ['*']; break; -case 27: this.$ = [$$[$0]]; +case 27: this.$ = [$$[$0]]; break; -case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); +case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); break; case 29: this.$ = $$[$0]; if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) this.$ += "\\b"; - + break; -case 30: this.$ = $$[$0-2] + '|' + $$[$0]; +case 30: this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 31: this.$ = $$[$0-1] + '|'; +case 31: this.$ = $$[$0-1] + '|'; break; -case 33: this.$ = '' +case 33: this.$ = '' break; -case 34: this.$ = $$[$0-1] + $$[$0]; +case 34: this.$ = $$[$0-1] + $$[$0]; break; -case 36: this.$ = '(' + $$[$0-1] + ')'; +case 36: this.$ = '(' + $$[$0-1] + ')'; break; -case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; +case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 38: this.$ = $$[$0-1] + '+'; +case 38: this.$ = $$[$0-1] + '+'; break; -case 39: this.$ = $$[$0-1] + '*'; +case 39: this.$ = $$[$0-1] + '*'; break; -case 40: this.$ = $$[$0-1] + '?'; +case 40: this.$ = $$[$0-1] + '?'; break; -case 41: this.$ = '(?=' + $$[$0] + ')'; +case 41: this.$ = '(?=' + $$[$0] + ')'; break; -case 42: this.$ = '(?!' + $$[$0] + ')'; +case 42: this.$ = '(?!' + $$[$0] + ')'; break; -case 44: this.$ = $$[$0-1] + $$[$0]; +case 44: this.$ = $$[$0-1] + $$[$0]; break; -case 46: this.$ = '.'; +case 46: this.$ = '.'; break; -case 47: this.$ = '^'; +case 47: this.$ = '^'; break; -case 48: this.$ = '$'; +case 48: this.$ = '$'; break; -case 52: this.$ = yytext; +case 52: this.$ = yytext; break; -case 53: this.$ = yytext; +case 53: this.$ = yytext; break; -case 54: this.$ = yytext; +case 54: this.$ = yytext; break; -case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; } }, @@ -337,9 +337,9 @@ parse: function parse(input) { expected: expected, recoverable: (error_rule_depth !== false) }); - if (!p.recoverable) { - return a; - } + if (!p.recoverable) { + return a; + } } else if (preErrorSymbol !== EOF) { error_rule_depth = locateNearestErrorRecoveryRule(state); } @@ -772,12 +772,19 @@ next:function () { // return next match that has a token lex:function lex() { - var r = this.next(); - if (r) { - return r; - } else { - return this.lex(); + var r; + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.bind(this)(); + } + while (!r) { + r = this.next(); + }; + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.bind(this)(r) || r; } + return r; }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) From ef755f6ab58e74389a017650178fc29b08195444 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 13 Jul 2013 17:41:44 +0200 Subject: [PATCH 012/417] regenerated library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 07cb089..cd95cc1 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.4 */ +/* parser generated by jison 0.4.6 */ /* Returns a Parser object of the following structure: From a8093642c4851764c6dc171b1318734b68fb01b1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 19 Nov 2013 10:38:00 +0100 Subject: [PATCH 013/417] regenerated library files / ran build scripts --- lex-parser.js | 223 +++++++++++++++++++++++++++----------------------- 1 file changed, 121 insertions(+), 102 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index cd95cc1..beb5942 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.6 */ +/* parser generated by jison 0.4.13 */ /* Returns a Parser object of the following structure: @@ -72,12 +72,12 @@ recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) } */ -var lexParser = (function(){ +var lex = (function(){ var parser = {trace: function trace() { }, yy: {}, -symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"ACTION_BODY":25,"<":26,"name_list":27,">":28,"*":29,",":30,"regex_list":31,"|":32,"regex_concat":33,"regex_base":34,"(":35,")":36,"SPECIAL_GROUP":37,"+":38,"?":39,"/":40,"/!":41,"name_expansion":42,"range_regex":43,"any_group_regex":44,".":45,"^":46,"$":47,"string":48,"escape_char":49,"NAME_BRACE":50,"ANY_GROUP_REGEX":51,"ESCAPE_CHAR":52,"RANGE_REGEX":53,"STRING_LIT":54,"CHARACTER_LIT":55,"$accept":0,"$end":1}, -terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"START_COND",22:"{",24:"}",25:"ACTION_BODY",26:"<",28:">",29:"*",30:",",32:"|",35:"(",36:")",37:"SPECIAL_GROUP",38:"+",39:"?",40:"/",41:"/!",45:".",46:"^",47:"$",50:"NAME_BRACE",51:"ANY_GROUP_REGEX",52:"ESCAPE_CHAR",53:"RANGE_REGEX",54:"STRING_LIT",55:"CHARACTER_LIT"}, -productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[19,3],[21,3],[21,1],[23,0],[23,1],[23,5],[23,4],[20,3],[20,3],[20,0],[27,1],[27,3],[13,1],[31,3],[31,2],[31,1],[31,0],[33,2],[33,1],[34,3],[34,3],[34,2],[34,2],[34,2],[34,2],[34,2],[34,1],[34,2],[34,1],[34,1],[34,1],[34,1],[34,1],[34,1],[42,1],[44,1],[49,1],[43,1],[48,1],[48,1]], +symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, +terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"START_COND",22:"{",24:"}",26:"ACTION_BODY",27:"<",29:">",30:"*",31:",",33:"|",36:"(",37:")",38:"SPECIAL_GROUP",39:"+",40:"?",41:"/",42:"/!",46:".",47:"^",48:"$",51:"NAME_BRACE",52:"ANY_GROUP_REGEX",53:"ESCAPE_CHAR",54:"RANGE_REGEX",55:"STRING_LIT",56:"CHARACTER_LIT"}, +productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[19,3],[21,3],[21,1],[23,0],[23,1],[23,5],[23,4],[25,1],[25,2],[20,3],[20,3],[20,0],[28,1],[28,3],[13,1],[32,3],[32,2],[32,1],[32,0],[34,2],[34,1],[35,3],[35,3],[35,2],[35,2],[35,2],[35,2],[35,2],[35,1],[35,2],[35,1],[35,1],[35,1],[35,1],[35,1],[35,1],[43,1],[45,1],[50,1],[44,1],[49,1],[49,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */ /**/) { /* this == yyval */ @@ -145,67 +145,72 @@ case 19:this.$ = $$[$0]; break; case 20:this.$ = ''; break; -case 21:this.$ = yytext; +case 21:this.$ = $$[$0]; break; -case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +case 22:this.$ = $$[$0-4]+$$[$0-3]+$$[$0-2]+$$[$0-1]+$$[$0]; break; case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24: this.$ = $$[$0-1]; +case 24: this.$ = yytext; break; -case 25: this.$ = ['*']; +case 25: this.$ = $$[$0-1]+$$[$0]; break; -case 27: this.$ = [$$[$0]]; +case 26: this.$ = $$[$0-1]; break; -case 28: this.$ = $$[$0-2]; this.$.push($$[$0]); +case 27: this.$ = ['*']; break; -case 29: +case 29: this.$ = [$$[$0]]; +break; +case 30: this.$ = $$[$0-2]; this.$.push($$[$0]); +break; +case 31: this.$ = $$[$0]; - if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) + if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { this.$ += "\\b"; + } break; -case 30: this.$ = $$[$0-2] + '|' + $$[$0]; +case 32: this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 31: this.$ = $$[$0-1] + '|'; +case 33: this.$ = $$[$0-1] + '|'; break; -case 33: this.$ = '' +case 35: this.$ = '' break; -case 34: this.$ = $$[$0-1] + $$[$0]; +case 36: this.$ = $$[$0-1] + $$[$0]; break; -case 36: this.$ = '(' + $$[$0-1] + ')'; +case 38: this.$ = '(' + $$[$0-1] + ')'; break; -case 37: this.$ = $$[$0-2] + $$[$0-1] + ')'; +case 39: this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 38: this.$ = $$[$0-1] + '+'; +case 40: this.$ = $$[$0-1] + '+'; break; -case 39: this.$ = $$[$0-1] + '*'; +case 41: this.$ = $$[$0-1] + '*'; break; -case 40: this.$ = $$[$0-1] + '?'; +case 42: this.$ = $$[$0-1] + '?'; break; -case 41: this.$ = '(?=' + $$[$0] + ')'; +case 43: this.$ = '(?=' + $$[$0] + ')'; break; -case 42: this.$ = '(?!' + $$[$0] + ')'; +case 44: this.$ = '(?!' + $$[$0] + ')'; break; -case 44: this.$ = $$[$0-1] + $$[$0]; +case 46: this.$ = $$[$0-1] + $$[$0]; break; -case 46: this.$ = '.'; +case 48: this.$ = '.'; break; -case 47: this.$ = '^'; +case 49: this.$ = '^'; break; -case 48: this.$ = '$'; +case 50: this.$ = '$'; break; -case 52: this.$ = yytext; +case 54: this.$ = yytext; break; -case 53: this.$ = yytext; +case 55: this.$ = yytext; break; -case 54: this.$ = yytext; +case 56: this.$ = yytext; break; -case 55: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +case 57: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; } }, -table: [{3:1,4:2,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{1:[3]},{5:[1,8]},{4:9,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{4:10,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{5:[2,33],11:[2,33],12:[2,33],13:11,14:[2,33],16:[2,33],31:12,32:[2,33],33:13,34:14,35:[1,15],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:35,11:[2,26],19:36,20:37,22:[2,26],26:[1,38],32:[2,26],35:[2,26],37:[2,26],40:[2,26],41:[2,26],45:[2,26],46:[2,26],47:[2,26],50:[2,26],51:[2,26],52:[2,26],54:[2,26],55:[2,26]},{5:[2,5]},{5:[2,6]},{5:[2,8],11:[2,8],12:[2,8],14:[2,8],16:[2,8]},{5:[2,29],11:[2,29],12:[2,29],14:[2,29],16:[2,29],22:[2,29],32:[1,39]},{5:[2,32],11:[2,32],12:[2,32],14:[2,32],16:[2,32],22:[2,32],32:[2,32],34:40,35:[1,15],36:[2,32],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{5:[2,35],11:[2,35],12:[2,35],14:[2,35],16:[2,35],22:[2,35],29:[1,42],32:[2,35],35:[2,35],36:[2,35],37:[2,35],38:[1,41],39:[1,43],40:[2,35],41:[2,35],43:44,45:[2,35],46:[2,35],47:[2,35],50:[2,35],51:[2,35],52:[2,35],53:[1,45],54:[2,35],55:[2,35]},{31:46,32:[2,33],33:13,34:14,35:[1,15],36:[2,33],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{31:47,32:[2,33],33:13,34:14,35:[1,15],36:[2,33],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{34:48,35:[1,15],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{34:49,35:[1,15],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{5:[2,43],11:[2,43],12:[2,43],14:[2,43],16:[2,43],22:[2,43],29:[2,43],32:[2,43],35:[2,43],36:[2,43],37:[2,43],38:[2,43],39:[2,43],40:[2,43],41:[2,43],45:[2,43],46:[2,43],47:[2,43],50:[2,43],51:[2,43],52:[2,43],53:[2,43],54:[2,43],55:[2,43]},{5:[2,45],11:[2,45],12:[2,45],14:[2,45],16:[2,45],22:[2,45],29:[2,45],32:[2,45],35:[2,45],36:[2,45],37:[2,45],38:[2,45],39:[2,45],40:[2,45],41:[2,45],45:[2,45],46:[2,45],47:[2,45],50:[2,45],51:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45]},{5:[2,46],11:[2,46],12:[2,46],14:[2,46],16:[2,46],22:[2,46],29:[2,46],32:[2,46],35:[2,46],36:[2,46],37:[2,46],38:[2,46],39:[2,46],40:[2,46],41:[2,46],45:[2,46],46:[2,46],47:[2,46],50:[2,46],51:[2,46],52:[2,46],53:[2,46],54:[2,46],55:[2,46]},{5:[2,47],11:[2,47],12:[2,47],14:[2,47],16:[2,47],22:[2,47],29:[2,47],32:[2,47],35:[2,47],36:[2,47],37:[2,47],38:[2,47],39:[2,47],40:[2,47],41:[2,47],45:[2,47],46:[2,47],47:[2,47],50:[2,47],51:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47]},{5:[2,48],11:[2,48],12:[2,48],14:[2,48],16:[2,48],22:[2,48],29:[2,48],32:[2,48],35:[2,48],36:[2,48],37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],45:[2,48],46:[2,48],47:[2,48],50:[2,48],51:[2,48],52:[2,48],53:[2,48],54:[2,48],55:[2,48]},{5:[2,49],11:[2,49],12:[2,49],14:[2,49],16:[2,49],22:[2,49],29:[2,49],32:[2,49],35:[2,49],36:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],45:[2,49],46:[2,49],47:[2,49],50:[2,49],51:[2,49],52:[2,49],53:[2,49],54:[2,49],55:[2,49]},{5:[2,50],11:[2,50],12:[2,50],14:[2,50],16:[2,50],22:[2,50],29:[2,50],32:[2,50],35:[2,50],36:[2,50],37:[2,50],38:[2,50],39:[2,50],40:[2,50],41:[2,50],45:[2,50],46:[2,50],47:[2,50],50:[2,50],51:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50]},{5:[2,51],11:[2,51],12:[2,51],14:[2,51],16:[2,51],22:[2,51],29:[2,51],32:[2,51],35:[2,51],36:[2,51],37:[2,51],38:[2,51],39:[2,51],40:[2,51],41:[2,51],45:[2,51],46:[2,51],47:[2,51],50:[2,51],51:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51]},{5:[2,52],11:[2,52],12:[2,52],14:[2,52],16:[2,52],22:[2,52],29:[2,52],32:[2,52],35:[2,52],36:[2,52],37:[2,52],38:[2,52],39:[2,52],40:[2,52],41:[2,52],45:[2,52],46:[2,52],47:[2,52],50:[2,52],51:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52]},{5:[2,55],11:[2,55],12:[2,55],14:[2,55],16:[2,55],22:[2,55],29:[2,55],32:[2,55],35:[2,55],36:[2,55],37:[2,55],38:[2,55],39:[2,55],40:[2,55],41:[2,55],45:[2,55],46:[2,55],47:[2,55],50:[2,55],51:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55]},{5:[2,56],11:[2,56],12:[2,56],14:[2,56],16:[2,56],22:[2,56],29:[2,56],32:[2,56],35:[2,56],36:[2,56],37:[2,56],38:[2,56],39:[2,56],40:[2,56],41:[2,56],45:[2,56],46:[2,56],47:[2,56],50:[2,56],51:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56]},{5:[2,53],11:[2,53],12:[2,53],14:[2,53],16:[2,53],22:[2,53],29:[2,53],32:[2,53],35:[2,53],36:[2,53],37:[2,53],38:[2,53],39:[2,53],40:[2,53],41:[2,53],45:[2,53],46:[2,53],47:[2,53],50:[2,53],51:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53]},{5:[2,9],11:[2,9],12:[2,9],14:[2,9],16:[2,9],18:[1,50]},{5:[2,11],11:[2,11],12:[2,11],14:[2,11],16:[2,11],18:[2,11]},{5:[2,10],11:[2,10],12:[2,10],14:[2,10],16:[2,10],18:[1,51]},{5:[2,13],11:[2,13],12:[2,13],14:[2,13],16:[2,13],18:[2,13]},{5:[1,55],7:52,8:[1,54],11:[2,26],19:53,20:37,22:[2,26],26:[1,38],32:[2,26],35:[2,26],37:[2,26],40:[2,26],41:[2,26],45:[2,26],46:[2,26],47:[2,26],50:[2,26],51:[2,26],52:[2,26],54:[2,26],55:[2,26]},{5:[2,16],8:[2,16],11:[2,16],22:[2,16],26:[2,16],32:[2,16],35:[2,16],37:[2,16],40:[2,16],41:[2,16],45:[2,16],46:[2,16],47:[2,16],50:[2,16],51:[2,16],52:[2,16],54:[2,16],55:[2,16]},{11:[2,33],13:56,22:[2,33],31:12,32:[2,33],33:13,34:14,35:[1,15],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{12:[1,59],27:57,29:[1,58]},{5:[2,31],11:[2,31],12:[2,31],14:[2,31],16:[2,31],22:[2,31],32:[2,31],33:60,34:14,35:[1,15],36:[2,31],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{5:[2,34],11:[2,34],12:[2,34],14:[2,34],16:[2,34],22:[2,34],29:[1,42],32:[2,34],35:[2,34],36:[2,34],37:[2,34],38:[1,41],39:[1,43],40:[2,34],41:[2,34],43:44,45:[2,34],46:[2,34],47:[2,34],50:[2,34],51:[2,34],52:[2,34],53:[1,45],54:[2,34],55:[2,34]},{5:[2,38],11:[2,38],12:[2,38],14:[2,38],16:[2,38],22:[2,38],29:[2,38],32:[2,38],35:[2,38],36:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],41:[2,38],45:[2,38],46:[2,38],47:[2,38],50:[2,38],51:[2,38],52:[2,38],53:[2,38],54:[2,38],55:[2,38]},{5:[2,39],11:[2,39],12:[2,39],14:[2,39],16:[2,39],22:[2,39],29:[2,39],32:[2,39],35:[2,39],36:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],41:[2,39],45:[2,39],46:[2,39],47:[2,39],50:[2,39],51:[2,39],52:[2,39],53:[2,39],54:[2,39],55:[2,39]},{5:[2,40],11:[2,40],12:[2,40],14:[2,40],16:[2,40],22:[2,40],29:[2,40],32:[2,40],35:[2,40],36:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],45:[2,40],46:[2,40],47:[2,40],50:[2,40],51:[2,40],52:[2,40],53:[2,40],54:[2,40],55:[2,40]},{5:[2,44],11:[2,44],12:[2,44],14:[2,44],16:[2,44],22:[2,44],29:[2,44],32:[2,44],35:[2,44],36:[2,44],37:[2,44],38:[2,44],39:[2,44],40:[2,44],41:[2,44],45:[2,44],46:[2,44],47:[2,44],50:[2,44],51:[2,44],52:[2,44],53:[2,44],54:[2,44],55:[2,44]},{5:[2,54],11:[2,54],12:[2,54],14:[2,54],16:[2,54],22:[2,54],29:[2,54],32:[2,54],35:[2,54],36:[2,54],37:[2,54],38:[2,54],39:[2,54],40:[2,54],41:[2,54],45:[2,54],46:[2,54],47:[2,54],50:[2,54],51:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54]},{32:[1,39],36:[1,61]},{32:[1,39],36:[1,62]},{5:[2,41],11:[2,41],12:[2,41],14:[2,41],16:[2,41],22:[2,41],29:[1,42],32:[2,41],35:[2,41],36:[2,41],37:[2,41],38:[1,41],39:[1,43],40:[2,41],41:[2,41],43:44,45:[2,41],46:[2,41],47:[2,41],50:[2,41],51:[2,41],52:[2,41],53:[1,45],54:[2,41],55:[2,41]},{5:[2,42],11:[2,42],12:[2,42],14:[2,42],16:[2,42],22:[2,42],29:[1,42],32:[2,42],35:[2,42],36:[2,42],37:[2,42],38:[1,41],39:[1,43],40:[2,42],41:[2,42],43:44,45:[2,42],46:[2,42],47:[2,42],50:[2,42],51:[2,42],52:[2,42],53:[1,45],54:[2,42],55:[2,42]},{5:[2,12],11:[2,12],12:[2,12],14:[2,12],16:[2,12],18:[2,12]},{5:[2,14],11:[2,14],12:[2,14],14:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{5:[2,15],8:[2,15],11:[2,15],22:[2,15],26:[2,15],32:[2,15],35:[2,15],37:[2,15],40:[2,15],41:[2,15],45:[2,15],46:[2,15],47:[2,15],50:[2,15],51:[2,15],52:[2,15],54:[2,15],55:[2,15]},{1:[2,2]},{8:[1,63],9:[1,64]},{11:[1,67],21:65,22:[1,66]},{28:[1,68],30:[1,69]},{28:[1,70]},{28:[2,27],30:[2,27]},{5:[2,30],11:[2,30],12:[2,30],14:[2,30],16:[2,30],22:[2,30],32:[2,30],34:40,35:[1,15],36:[2,30],37:[1,16],40:[1,17],41:[1,18],42:19,44:20,45:[1,21],46:[1,22],47:[1,23],48:24,49:25,50:[1,26],51:[1,27],52:[1,30],54:[1,28],55:[1,29]},{5:[2,36],11:[2,36],12:[2,36],14:[2,36],16:[2,36],22:[2,36],29:[2,36],32:[2,36],35:[2,36],36:[2,36],37:[2,36],38:[2,36],39:[2,36],40:[2,36],41:[2,36],45:[2,36],46:[2,36],47:[2,36],50:[2,36],51:[2,36],52:[2,36],53:[2,36],54:[2,36],55:[2,36]},{5:[2,37],11:[2,37],12:[2,37],14:[2,37],16:[2,37],22:[2,37],29:[2,37],32:[2,37],35:[2,37],36:[2,37],37:[2,37],38:[2,37],39:[2,37],40:[2,37],41:[2,37],45:[2,37],46:[2,37],47:[2,37],50:[2,37],51:[2,37],52:[2,37],53:[2,37],54:[2,37],55:[2,37]},{1:[2,3]},{8:[1,71]},{5:[2,17],8:[2,17],11:[2,17],22:[2,17],26:[2,17],32:[2,17],35:[2,17],37:[2,17],40:[2,17],41:[2,17],45:[2,17],46:[2,17],47:[2,17],50:[2,17],51:[2,17],52:[2,17],54:[2,17],55:[2,17]},{22:[2,20],23:72,24:[2,20],25:[1,73]},{5:[2,19],8:[2,19],11:[2,19],22:[2,19],26:[2,19],32:[2,19],35:[2,19],37:[2,19],40:[2,19],41:[2,19],45:[2,19],46:[2,19],47:[2,19],50:[2,19],51:[2,19],52:[2,19],54:[2,19],55:[2,19]},{11:[2,24],22:[2,24],32:[2,24],35:[2,24],37:[2,24],40:[2,24],41:[2,24],45:[2,24],46:[2,24],47:[2,24],50:[2,24],51:[2,24],52:[2,24],54:[2,24],55:[2,24]},{12:[1,74]},{11:[2,25],22:[2,25],32:[2,25],35:[2,25],37:[2,25],40:[2,25],41:[2,25],45:[2,25],46:[2,25],47:[2,25],50:[2,25],51:[2,25],52:[2,25],54:[2,25],55:[2,25]},{1:[2,4]},{22:[1,76],24:[1,75]},{22:[2,21],24:[2,21]},{28:[2,28],30:[2,28]},{5:[2,18],8:[2,18],11:[2,18],22:[2,18],26:[2,18],32:[2,18],35:[2,18],37:[2,18],40:[2,18],41:[2,18],45:[2,18],46:[2,18],47:[2,18],50:[2,18],51:[2,18],52:[2,18],54:[2,18],55:[2,18]},{22:[2,20],23:77,24:[2,20],25:[1,73]},{22:[1,76],24:[1,78]},{22:[2,23],24:[2,23],25:[1,79]},{22:[2,22],24:[2,22]}], +table: [{3:1,4:2,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{1:[3]},{5:[1,8]},{4:9,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{4:10,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{5:[2,35],11:[2,35],12:[2,35],13:11,14:[2,35],16:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:35,11:[2,28],19:36,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,5]},{5:[2,6]},{5:[2,8],11:[2,8],12:[2,8],14:[2,8],16:[2,8]},{5:[2,31],11:[2,31],12:[2,31],14:[2,31],16:[2,31],22:[2,31],33:[1,39]},{5:[2,34],11:[2,34],12:[2,34],14:[2,34],16:[2,34],22:[2,34],33:[2,34],35:40,36:[1,15],37:[2,34],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,37],11:[2,37],12:[2,37],14:[2,37],16:[2,37],22:[2,37],30:[1,42],33:[2,37],36:[2,37],37:[2,37],38:[2,37],39:[1,41],40:[1,43],41:[2,37],42:[2,37],44:44,46:[2,37],47:[2,37],48:[2,37],51:[2,37],52:[2,37],53:[2,37],54:[1,45],55:[2,37],56:[2,37]},{32:46,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{32:47,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:48,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:49,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,45],11:[2,45],12:[2,45],14:[2,45],16:[2,45],22:[2,45],30:[2,45],33:[2,45],36:[2,45],37:[2,45],38:[2,45],39:[2,45],40:[2,45],41:[2,45],42:[2,45],46:[2,45],47:[2,45],48:[2,45],51:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45],56:[2,45]},{5:[2,47],11:[2,47],12:[2,47],14:[2,47],16:[2,47],22:[2,47],30:[2,47],33:[2,47],36:[2,47],37:[2,47],38:[2,47],39:[2,47],40:[2,47],41:[2,47],42:[2,47],46:[2,47],47:[2,47],48:[2,47],51:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47],56:[2,47]},{5:[2,48],11:[2,48],12:[2,48],14:[2,48],16:[2,48],22:[2,48],30:[2,48],33:[2,48],36:[2,48],37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],42:[2,48],46:[2,48],47:[2,48],48:[2,48],51:[2,48],52:[2,48],53:[2,48],54:[2,48],55:[2,48],56:[2,48]},{5:[2,49],11:[2,49],12:[2,49],14:[2,49],16:[2,49],22:[2,49],30:[2,49],33:[2,49],36:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],42:[2,49],46:[2,49],47:[2,49],48:[2,49],51:[2,49],52:[2,49],53:[2,49],54:[2,49],55:[2,49],56:[2,49]},{5:[2,50],11:[2,50],12:[2,50],14:[2,50],16:[2,50],22:[2,50],30:[2,50],33:[2,50],36:[2,50],37:[2,50],38:[2,50],39:[2,50],40:[2,50],41:[2,50],42:[2,50],46:[2,50],47:[2,50],48:[2,50],51:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50],56:[2,50]},{5:[2,51],11:[2,51],12:[2,51],14:[2,51],16:[2,51],22:[2,51],30:[2,51],33:[2,51],36:[2,51],37:[2,51],38:[2,51],39:[2,51],40:[2,51],41:[2,51],42:[2,51],46:[2,51],47:[2,51],48:[2,51],51:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51],56:[2,51]},{5:[2,52],11:[2,52],12:[2,52],14:[2,52],16:[2,52],22:[2,52],30:[2,52],33:[2,52],36:[2,52],37:[2,52],38:[2,52],39:[2,52],40:[2,52],41:[2,52],42:[2,52],46:[2,52],47:[2,52],48:[2,52],51:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52],56:[2,52]},{5:[2,53],11:[2,53],12:[2,53],14:[2,53],16:[2,53],22:[2,53],30:[2,53],33:[2,53],36:[2,53],37:[2,53],38:[2,53],39:[2,53],40:[2,53],41:[2,53],42:[2,53],46:[2,53],47:[2,53],48:[2,53],51:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53],56:[2,53]},{5:[2,54],11:[2,54],12:[2,54],14:[2,54],16:[2,54],22:[2,54],30:[2,54],33:[2,54],36:[2,54],37:[2,54],38:[2,54],39:[2,54],40:[2,54],41:[2,54],42:[2,54],46:[2,54],47:[2,54],48:[2,54],51:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54],56:[2,54]},{5:[2,57],11:[2,57],12:[2,57],14:[2,57],16:[2,57],22:[2,57],30:[2,57],33:[2,57],36:[2,57],37:[2,57],38:[2,57],39:[2,57],40:[2,57],41:[2,57],42:[2,57],46:[2,57],47:[2,57],48:[2,57],51:[2,57],52:[2,57],53:[2,57],54:[2,57],55:[2,57],56:[2,57]},{5:[2,58],11:[2,58],12:[2,58],14:[2,58],16:[2,58],22:[2,58],30:[2,58],33:[2,58],36:[2,58],37:[2,58],38:[2,58],39:[2,58],40:[2,58],41:[2,58],42:[2,58],46:[2,58],47:[2,58],48:[2,58],51:[2,58],52:[2,58],53:[2,58],54:[2,58],55:[2,58],56:[2,58]},{5:[2,55],11:[2,55],12:[2,55],14:[2,55],16:[2,55],22:[2,55],30:[2,55],33:[2,55],36:[2,55],37:[2,55],38:[2,55],39:[2,55],40:[2,55],41:[2,55],42:[2,55],46:[2,55],47:[2,55],48:[2,55],51:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55],56:[2,55]},{5:[2,9],11:[2,9],12:[2,9],14:[2,9],16:[2,9],18:[1,50]},{5:[2,11],11:[2,11],12:[2,11],14:[2,11],16:[2,11],18:[2,11]},{5:[2,10],11:[2,10],12:[2,10],14:[2,10],16:[2,10],18:[1,51]},{5:[2,13],11:[2,13],12:[2,13],14:[2,13],16:[2,13],18:[2,13]},{5:[1,55],7:52,8:[1,54],11:[2,28],19:53,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,16],8:[2,16],11:[2,16],22:[2,16],27:[2,16],33:[2,16],36:[2,16],38:[2,16],41:[2,16],42:[2,16],46:[2,16],47:[2,16],48:[2,16],51:[2,16],52:[2,16],53:[2,16],55:[2,16],56:[2,16]},{11:[2,35],13:56,22:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{12:[1,59],28:57,30:[1,58]},{5:[2,33],11:[2,33],12:[2,33],14:[2,33],16:[2,33],22:[2,33],33:[2,33],34:60,35:14,36:[1,15],37:[2,33],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,36],11:[2,36],12:[2,36],14:[2,36],16:[2,36],22:[2,36],30:[1,42],33:[2,36],36:[2,36],37:[2,36],38:[2,36],39:[1,41],40:[1,43],41:[2,36],42:[2,36],44:44,46:[2,36],47:[2,36],48:[2,36],51:[2,36],52:[2,36],53:[2,36],54:[1,45],55:[2,36],56:[2,36]},{5:[2,40],11:[2,40],12:[2,40],14:[2,40],16:[2,40],22:[2,40],30:[2,40],33:[2,40],36:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],42:[2,40],46:[2,40],47:[2,40],48:[2,40],51:[2,40],52:[2,40],53:[2,40],54:[2,40],55:[2,40],56:[2,40]},{5:[2,41],11:[2,41],12:[2,41],14:[2,41],16:[2,41],22:[2,41],30:[2,41],33:[2,41],36:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],42:[2,41],46:[2,41],47:[2,41],48:[2,41],51:[2,41],52:[2,41],53:[2,41],54:[2,41],55:[2,41],56:[2,41]},{5:[2,42],11:[2,42],12:[2,42],14:[2,42],16:[2,42],22:[2,42],30:[2,42],33:[2,42],36:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],42:[2,42],46:[2,42],47:[2,42],48:[2,42],51:[2,42],52:[2,42],53:[2,42],54:[2,42],55:[2,42],56:[2,42]},{5:[2,46],11:[2,46],12:[2,46],14:[2,46],16:[2,46],22:[2,46],30:[2,46],33:[2,46],36:[2,46],37:[2,46],38:[2,46],39:[2,46],40:[2,46],41:[2,46],42:[2,46],46:[2,46],47:[2,46],48:[2,46],51:[2,46],52:[2,46],53:[2,46],54:[2,46],55:[2,46],56:[2,46]},{5:[2,56],11:[2,56],12:[2,56],14:[2,56],16:[2,56],22:[2,56],30:[2,56],33:[2,56],36:[2,56],37:[2,56],38:[2,56],39:[2,56],40:[2,56],41:[2,56],42:[2,56],46:[2,56],47:[2,56],48:[2,56],51:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56],56:[2,56]},{33:[1,39],37:[1,61]},{33:[1,39],37:[1,62]},{5:[2,43],11:[2,43],12:[2,43],14:[2,43],16:[2,43],22:[2,43],30:[1,42],33:[2,43],36:[2,43],37:[2,43],38:[2,43],39:[1,41],40:[1,43],41:[2,43],42:[2,43],44:44,46:[2,43],47:[2,43],48:[2,43],51:[2,43],52:[2,43],53:[2,43],54:[1,45],55:[2,43],56:[2,43]},{5:[2,44],11:[2,44],12:[2,44],14:[2,44],16:[2,44],22:[2,44],30:[1,42],33:[2,44],36:[2,44],37:[2,44],38:[2,44],39:[1,41],40:[1,43],41:[2,44],42:[2,44],44:44,46:[2,44],47:[2,44],48:[2,44],51:[2,44],52:[2,44],53:[2,44],54:[1,45],55:[2,44],56:[2,44]},{5:[2,12],11:[2,12],12:[2,12],14:[2,12],16:[2,12],18:[2,12]},{5:[2,14],11:[2,14],12:[2,14],14:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{5:[2,15],8:[2,15],11:[2,15],22:[2,15],27:[2,15],33:[2,15],36:[2,15],38:[2,15],41:[2,15],42:[2,15],46:[2,15],47:[2,15],48:[2,15],51:[2,15],52:[2,15],53:[2,15],55:[2,15],56:[2,15]},{1:[2,2]},{8:[1,63],9:[1,64]},{11:[1,67],21:65,22:[1,66]},{29:[1,68],31:[1,69]},{29:[1,70]},{29:[2,29],31:[2,29]},{5:[2,32],11:[2,32],12:[2,32],14:[2,32],16:[2,32],22:[2,32],33:[2,32],35:40,36:[1,15],37:[2,32],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,38],11:[2,38],12:[2,38],14:[2,38],16:[2,38],22:[2,38],30:[2,38],33:[2,38],36:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],41:[2,38],42:[2,38],46:[2,38],47:[2,38],48:[2,38],51:[2,38],52:[2,38],53:[2,38],54:[2,38],55:[2,38],56:[2,38]},{5:[2,39],11:[2,39],12:[2,39],14:[2,39],16:[2,39],22:[2,39],30:[2,39],33:[2,39],36:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],41:[2,39],42:[2,39],46:[2,39],47:[2,39],48:[2,39],51:[2,39],52:[2,39],53:[2,39],54:[2,39],55:[2,39],56:[2,39]},{1:[2,3]},{8:[1,71]},{5:[2,17],8:[2,17],11:[2,17],22:[2,17],27:[2,17],33:[2,17],36:[2,17],38:[2,17],41:[2,17],42:[2,17],46:[2,17],47:[2,17],48:[2,17],51:[2,17],52:[2,17],53:[2,17],55:[2,17],56:[2,17]},{22:[2,20],23:72,24:[2,20],25:73,26:[1,74]},{5:[2,19],8:[2,19],11:[2,19],22:[2,19],27:[2,19],33:[2,19],36:[2,19],38:[2,19],41:[2,19],42:[2,19],46:[2,19],47:[2,19],48:[2,19],51:[2,19],52:[2,19],53:[2,19],55:[2,19],56:[2,19]},{11:[2,26],22:[2,26],33:[2,26],36:[2,26],38:[2,26],41:[2,26],42:[2,26],46:[2,26],47:[2,26],48:[2,26],51:[2,26],52:[2,26],53:[2,26],55:[2,26],56:[2,26]},{12:[1,75]},{11:[2,27],22:[2,27],33:[2,27],36:[2,27],38:[2,27],41:[2,27],42:[2,27],46:[2,27],47:[2,27],48:[2,27],51:[2,27],52:[2,27],53:[2,27],55:[2,27],56:[2,27]},{1:[2,4]},{22:[1,77],24:[1,76]},{22:[2,21],24:[2,21],26:[1,78]},{22:[2,24],24:[2,24],26:[2,24]},{29:[2,30],31:[2,30]},{5:[2,18],8:[2,18],11:[2,18],22:[2,18],27:[2,18],33:[2,18],36:[2,18],38:[2,18],41:[2,18],42:[2,18],46:[2,18],47:[2,18],48:[2,18],51:[2,18],52:[2,18],53:[2,18],55:[2,18],56:[2,18]},{22:[2,20],23:79,24:[2,20],25:73,26:[1,74]},{22:[2,25],24:[2,25],26:[2,25]},{22:[1,77],24:[1,80]},{22:[2,23],24:[2,23],25:81,26:[1,74]},{22:[2,22],24:[2,22],26:[1,78]}], defaultActions: {9:[2,5],10:[2,6],52:[2,1],54:[2,2],63:[2,3],71:[2,4]}, parseError: function parseError(str, hash) { if (hash.recoverable) { @@ -227,6 +232,8 @@ parse: function parse(input) { TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + //this.reductionCount = this.shiftCount = 0; this.lexer.setInput(input); @@ -244,7 +251,7 @@ parse: function parse(input) { if (typeof this.yy.parseError === 'function') { this.parseError = this.yy.parseError; } else { - this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ + this.parseError = Object.getPrototypeOf(this).parseError; } function popStack (n) { @@ -439,7 +446,7 @@ parse: function parse(input) { if (ranges) { yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; } - r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack); + r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack].concat(args)); if (typeof r !== 'undefined') { return r; @@ -836,136 +843,148 @@ performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START var YYSTATE=YY_START; switch($avoiding_name_collisions) { -case 0:return 25; +case 0:return 26; break; -case 1:yy.depth++; return 22; +case 1:return 26; break; -case 2:yy.depth == 0 ? this.begin('trail') : yy.depth--; return 24; +case 2:return 26; // regexp with braces or quotes (and no spaces) break; -case 3:return 12; +case 3:return 26; break; -case 4:this.popState(); return 28; +case 4:return 26; break; -case 5:return 30; +case 5:return 26; break; -case 6:return 29; +case 6:return 26; break; -case 7:/* */ +case 7:yy.depth++; return 22 break; -case 8:/* */ +case 8:yy.depth == 0 ? this.begin('trail') : yy.depth--; return 24 break; -case 9:this.begin('indented'); +case 9:return 12; break; -case 10:this.begin('code'); return 5; +case 10:this.popState(); return 29; break; -case 11:return 55; +case 11:return 31; break; -case 12:yy.options[yy_.yytext] = true; +case 12:return 30; break; -case 13:this.begin('INITIAL'); +case 13:/* */ break; -case 14:this.begin('INITIAL'); +case 14:/* */ break; -case 15:/* empty */ +case 15:this.begin('indented') break; -case 16:return 18; +case 16:this.begin('code'); return 5 break; -case 17:this.begin('INITIAL'); +case 17:return 56 break; -case 18:this.begin('INITIAL'); +case 18:yy.options[yy_.yytext] = true break; -case 19:/* empty */ +case 19:this.begin('INITIAL') break; -case 20:this.begin('rules'); +case 20:this.begin('INITIAL') break; -case 21:yy.depth = 0; this.begin('action'); return 22; +case 21:/* empty */ break; -case 22:this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4);return 11; +case 22:return 18 break; -case 23:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4); return 11; +case 23:this.begin('INITIAL') break; -case 24:this.begin('rules'); return 11; +case 24:this.begin('INITIAL') break; -case 25:/* ignore */ +case 25:/* empty */ break; -case 26:/* ignore */ +case 26:this.begin('rules') break; -case 27:/* */ +case 27:yy.depth = 0; this.begin('action'); return 22 break; -case 28:/* */ +case 28:this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4);return 11 break; -case 29:return 12; +case 29:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4); return 11 break; -case 30:yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 54; +case 30:this.begin('rules'); return 11 break; -case 31:yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 54; +case 31:/* ignore */ break; -case 32:return 32; +case 32:/* ignore */ break; -case 33:return 51; +case 33:/* */ break; -case 34:return 37; +case 34:/* */ break; -case 35:return 37; +case 35:return 12; break; -case 36:return 37; +case 36:yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 55; break; -case 37:return 35; +case 37:yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; break; -case 38:return 36; +case 38:return 33; break; -case 39:return 38; +case 39:return 52; break; -case 40:return 29; +case 40:return 38; break; -case 41:return 39; +case 41:return 38; break; -case 42:return 46; +case 42:return 38; break; -case 43:return 30; +case 43:return 36; break; -case 44:return 47; +case 44:return 37; break; -case 45:this.begin('conditions'); return 26; +case 45:return 39; break; -case 46:return 41; +case 46:return 30; break; case 47:return 40; break; -case 48:return 52; +case 48:return 47; +break; +case 49:return 31; +break; +case 50:return 48; +break; +case 51:this.begin('conditions'); return 27; +break; +case 52:return 42; +break; +case 53:return 41; +break; +case 54:return 53; break; -case 49:yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 52; +case 55:yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; break; -case 50:return 47; +case 56:return 48; break; -case 51:return 45; +case 57:return 46; break; -case 52:yy.options = {}; this.begin('options'); +case 58:yy.options = {}; this.begin('options'); break; -case 53:this.begin('start_condition'); return 14; +case 59:this.begin('start_condition'); return 14; break; -case 54:this.begin('start_condition'); return 16; +case 60:this.begin('start_condition'); return 16; break; -case 55:this.begin('rules'); return 5; +case 61:this.begin('rules'); return 5; break; -case 56:return 53; +case 62:return 54; break; -case 57:return 50; +case 63:return 51; break; -case 58:return 22; +case 64:return 22; break; -case 59:return 24; +case 65:return 24; break; -case 60:/* ignore bad characters */ +case 66:/* ignore bad characters */ break; -case 61:return 8; +case 67:return 8; break; -case 62:return 9; +case 68:return 9; break; } }, -rules: [/^(?:[^{}]+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:\n+)/,/^(?:\s+\n+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:\n+)/,/^(?:\s+\n+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:\n+)/,/^(?:\s+\n+)/,/^(?:\s+)/,/^(?:.*\n+)/,/^(?:\{)/,/^(?:%\{(.|\n)*?%\})/,/^(?:%\{(.|\n)*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\n+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|\n)+)/], -conditions: {"code":{"rules":[61,62],"inclusive":false},"start_condition":{"rules":[16,17,18,19,61],"inclusive":false},"options":{"rules":[12,13,14,15,61],"inclusive":false},"conditions":{"rules":[3,4,5,6,61],"inclusive":false},"action":{"rules":[0,1,2,61],"inclusive":false},"indented":{"rules":[21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],"inclusive":true},"trail":{"rules":[20,23,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],"inclusive":true},"rules":{"rules":[7,8,9,10,11,23,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],"inclusive":true},"INITIAL":{"rules":[23,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61],"inclusive":true}} +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r\b)+)/,/^(?:\s+(\r\n|\n|\r\b)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r\b)+)/,/^(?:\s+(\r\n|\n|\r\b)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r\b)+)/,/^(?:\s+(\r\n|\n|\r\b)+)/,/^(?:\s+)/,/^(?:.*(\r\n|\n|\r\b)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r\b))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r\b))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r\b)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r\b))+)/], +conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} }; return lexer; })(); @@ -979,9 +998,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lexParser; -exports.Parser = lexParser.Parser; -exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; +exports.parser = lex; +exports.Parser = lex.Parser; +exports.parse = function () { return lex.parse.apply(lex, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); From 1f91a456e0cb24e54994d661568d138b5f36fbc6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 19 Nov 2013 11:06:25 +0100 Subject: [PATCH 014/417] regenerated library files / ran build scripts --- lex-parser.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index beb5942..7177b11 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -72,7 +72,7 @@ recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) } */ -var lex = (function(){ +var lexParser = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, @@ -489,7 +489,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.1.0 */ +/* generated by jison-lex 0.2.1 */ var lexer = (function(){ var lexer = { @@ -700,9 +700,6 @@ test_match:function (match, indexed_rule) { this.done = false; } if (token) { - if (this.options.backtrack_lexer) { - delete backup; - } return token; } else if (this._backtrack) { // recover context @@ -711,9 +708,6 @@ test_match:function (match, indexed_rule) { } return false; // rule action called reject() implying the next rule should be tested instead. } - if (this.options.backtrack_lexer) { - delete backup; - } return false; }, @@ -983,7 +977,7 @@ case 68:return 9; break; } }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r\b)+)/,/^(?:\s+(\r\n|\n|\r\b)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r\b)+)/,/^(?:\s+(\r\n|\n|\r\b)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r\b)+)/,/^(?:\s+(\r\n|\n|\r\b)+)/,/^(?:\s+)/,/^(?:.*(\r\n|\n|\r\b)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r\b))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r\b))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r\b)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r\b))+)/], +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:.*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} }; return lexer; @@ -998,9 +992,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lex; -exports.Parser = lex.Parser; -exports.parse = function () { return lex.parse.apply(lex, arguments); }; +exports.parser = lexParser; +exports.Parser = lexParser.Parser; +exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); From 3e9b196931ae75ae87b77d79e4ae60d827fb03e3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 19 Nov 2013 11:10:19 +0100 Subject: [PATCH 015/417] regenerated library files / ran build scripts --- lex-parser.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 7177b11..cb0dfea 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -72,7 +72,7 @@ recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) } */ -var lexParser = (function(){ +var lex = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, @@ -992,9 +992,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lexParser; -exports.Parser = lexParser.Parser; -exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; +exports.parser = lex; +exports.Parser = lex.Parser; +exports.parse = function () { return lex.parse.apply(lex, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); From 7c57fbd2b26645bcb54900a36c88715f0589ad16 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 19 Nov 2013 11:16:09 +0100 Subject: [PATCH 016/417] regenerated library files / ran build scripts --- lex-parser.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index cb0dfea..7177b11 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -72,7 +72,7 @@ recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) } */ -var lex = (function(){ +var lexParser = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, @@ -992,9 +992,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lex; -exports.Parser = lex.Parser; -exports.parse = function () { return lex.parse.apply(lex, arguments); }; +exports.parser = lexParser; +exports.Parser = lexParser.Parser; +exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); From 5d74641127ba214f8c317ede918aeb4d295e1644 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 19 Nov 2013 11:22:43 +0100 Subject: [PATCH 017/417] regenerated library files / ran build scripts --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 8e1add5..e646e73 100644 --- a/Makefile +++ b/Makefile @@ -20,3 +20,7 @@ superclean: clean -find . -type d -name 'node_modules' -exec rm -rf "{}" \; + + + +.PHONY: all install build test clean superclean From 335feda069a117504343e3ef8e2c0de0057faee2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 19 Nov 2013 11:42:34 +0100 Subject: [PATCH 018/417] regenerated library files / ran build scripts --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 7177b11..dc6b081 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -251,7 +251,7 @@ parse: function parse(input) { if (typeof this.yy.parseError === 'function') { this.parseError = this.yy.parseError; } else { - this.parseError = Object.getPrototypeOf(this).parseError; + this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ } function popStack (n) { From fd16f1a0a1096114526907204aa84e7656b6c805 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 19 Nov 2013 11:42:34 +0100 Subject: [PATCH 019/417] fixed collision due to new pre_parser method: this method was used internally by jison generators. The internal method has been renamed to `__pre_parse()` --- lex-parser.js | 281 +++++++++++++++++++++++++++++++------------------- 1 file changed, 173 insertions(+), 108 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 7177b11..d1b03f7 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -12,7 +12,8 @@ symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), + (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) table: [...], defaultActions: {...}, parseError: function(str, hash), @@ -39,11 +40,7 @@ pushState: function(condition), stateStackSize: function(), - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, + options: { ... }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], @@ -71,6 +68,45 @@ expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) } + + You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + These options are available: + + ### options which are global for all parser instances + + Parser.pre_parse: function(yy) + optional: you can specify a pre_parse() function in the chunk following the grammar, + i.e. after the last `%%`. + Parser.post_parse: function(yy, retval) { return retval; } + optional: you can specify a post_parse() function in the chunk following the grammar, + i.e. after the last `%%`. When it does not return any value, the parser will return + the original `retval`. + + ### options which can be set up per parser instance + + yy: { + pre_parse: function(yy) + optional: is invoked before the parse cycle starts (and before the first invocation + of `lex()`) but immediately after the invocation of parser.pre_parse()). + post_parse: function(yy, retval) { return retval; } + optional: is invoked when the parse terminates due to success ('accept') or failure + (even when exceptions are thrown). `retval` contains the return value to be produced + by `Parser.parse()`; this function can override the return value by returning another. + When it does not return any value, the parser will return the original `retval`. + This function is invoked immediately before `Parser.post_parse()`. + parseError: function(str, hash) + optional: overrides the default `parseError` function. + } + + parser.lexer.options: { + ranges: boolean optional: true ==> token location info will include a .range[] member. + flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested + exhaustively to find the longest match. + backtrack_lexer: boolean + optional: true ==> lexer regexes are tested in order and for each matching + regex the action code is invoked; the lexer terminates + the scan when a token is returned by the action code. + } */ var lexParser = (function(){ var parser = {trace: function trace() { }, @@ -251,7 +287,7 @@ parse: function parse(input) { if (typeof this.yy.parseError === 'function') { this.parseError = this.yy.parseError; } else { - this.parseError = Object.getPrototypeOf(this).parseError; + this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ } function popStack (n) { @@ -276,85 +312,116 @@ parse: function parse(input) { var yyval = {}; var p, len, newState; var expected = []; + var retval = false; - while (true) { - // retreive state number from top of stack - state = stack[stack.length - 1]; + if (this.pre_parse) { + this.pre_parse(this.yy); + } + if (this.yy.pre_parse) { + this.yy.pre_parse(this.yy); + } - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol === 'undefined') { - symbol = lex(); + try { + for (;;) { + // retreive state number from top of stack + state = stack[stack.length - 1]; + + // use default actions if available + if (this.defaultActions && this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol === 'undefined') { + symbol = lex(); + } + // read action for current state and first input + action = table[state] && table[state][symbol]; } - // read action for current state and first input - action = table[state] && table[state][symbol]; - } - // handle parse error - if (typeof action === 'undefined' || !action.length || !action[0]) { - var error_rule_depth; - var errStr = ''; + // handle parse error + if (typeof action === 'undefined' || !action.length || !action[0]) { + var error_rule_depth; + var errStr = ''; + + // Return the rule stack depth where the nearest error rule can be found. + // Return FALSE when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = stack.length - 1; + var depth = 0; + + // try to recover from error + for(;;) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + return depth; + } + if (state === 0 || stack_probe < 2) { + return false; // No suitable error recovery rule available. + } + stack_probe -= 2; // popStack(1): [symbol, action] + state = stack[stack_probe]; + ++depth; + } + } - // Return the rule stack depth where the nearest error rule can be found. - // Return FALSE when no error recovery rule was found. - function locateNearestErrorRecoveryRule(state) { - var stack_probe = stack.length - 1; - var depth = 0; + if (!recovering) { + // first see if there's any chance at hitting an error recovery rule: + error_rule_depth = locateNearestErrorRecoveryRule(state); - // try to recover from error - for(;;) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - return depth; + // Report error + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } } - if (state === 0 || stack_probe < 2) { - return false; // No suitable error recovery rule available. + if (this.lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + + (symbol == EOF ? "end of input" : + ("'" + (this.terminals_[symbol] || symbol) + "'")); } - stack_probe -= 2; // popStack(1): [symbol, action] - state = stack[stack_probe]; - ++depth; + a = this.parseError(errStr, p = { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: (error_rule_depth !== false) + }); + if (!p.recoverable) { + retval = a; + break; + } + } else if (preErrorSymbol !== EOF) { + error_rule_depth = locateNearestErrorRecoveryRule(state); } - } - - if (!recovering) { - // first see if there's any chance at hitting an error recovery rule: - error_rule_depth = locateNearestErrorRecoveryRule(state); - // Report error - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push("'" + this.terminals_[p] + "'"); + // just recovered from another error + if (recovering == 3) { + if (symbol === EOF || preErrorSymbol === EOF) { + retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; } + + // discard current lookahead and grab another + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + symbol = lex(); } - if (this.lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + - (symbol == EOF ? "end of input" : - ("'" + (this.terminals_[symbol] || symbol) + "'")); - } - a = this.parseError(errStr, p = { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: (error_rule_depth !== false) - }); - if (!p.recoverable) { - return a; - } - } else if (preErrorSymbol !== EOF) { - error_rule_depth = locateNearestErrorRecoveryRule(state); - } - // just recovered from another error - if (recovering == 3) { - if (symbol === EOF || preErrorSymbol === EOF) { - return this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { + // try to recover from error + if (error_rule_depth === false) { + retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, @@ -362,19 +429,20 @@ parse: function parse(input) { expected: expected, recoverable: false }); + break; } + popStack(error_rule_depth); - // discard current lookahead and grab another - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - symbol = lex(); + preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length-1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error } - // try to recover from error - if (error_rule_depth === false) { - return this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array && action.length > 1) { + retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, @@ -382,29 +450,10 @@ parse: function parse(input) { expected: expected, recoverable: false }); + break; } - popStack(error_rule_depth); - - preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - return this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - } - switch (action[0]) { + switch (action[0]) { case 1: // shift //this.shiftCount++; @@ -426,7 +475,7 @@ parse: function parse(input) { symbol = preErrorSymbol; preErrorSymbol = null; } - break; + continue; case 2: // reduce @@ -449,7 +498,8 @@ parse: function parse(input) { r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack].concat(args)); if (typeof r !== 'undefined') { - return r; + retval = r; + break; } // pop off stack @@ -465,16 +515,31 @@ parse: function parse(input) { // goto new state = table[STATE][NONTERMINAL] newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); - break; + continue; case 3: // accept - return true; + retval = true; + break; + } + + // break out of loop: we accept or fail with error + break; } + } finally { + var rv; + if (this.yy.post_parse) { + rv = this.yy.post_parse(this.yy, retval); + if (typeof rv !== 'undefined') retval = rv; + } + if (this.post_parse) { + rv = this.post_parse(this.yy, retval); + if (typeof rv !== 'undefined') retval = rv; + } } - // return true; -- unreachable code + return retval; }}; From fc3c9c0070452c2b95cc946a897e893f9d54162d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 23 Nov 2013 06:57:32 +0100 Subject: [PATCH 020/417] regenerated library files --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d1b03f7..d282de4 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -327,7 +327,7 @@ parse: function parse(input) { state = stack[stack.length - 1]; // use default actions if available - if (this.defaultActions && this.defaultActions[state]) { + if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { if (symbol === null || typeof symbol === 'undefined') { @@ -523,7 +523,7 @@ parse: function parse(input) { break; } - // break out of loop: we accept or fail with error + // break out of loop: we accept or fail with error break; } } finally { From 3574e053fda301fdc15a24d2f860d92d9bbef8cf Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 23 Nov 2013 09:00:35 +0100 Subject: [PATCH 021/417] replaced pre_lex/post_lex .bind() with .call() as it is several orders of magnitude faster: see also http://jsperf.com/function-calls-direct-vs-apply-vs-call-vs-bind/18 --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d282de4..bae8c3e 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -841,14 +841,14 @@ lex:function lex() { var r; // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: if (typeof this.options.pre_lex === 'function') { - r = this.options.pre_lex.bind(this)(); + r = this.options.pre_lex.call(this); } while (!r) { r = this.next(); }; if (typeof this.options.post_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) - r = this.options.post_lex.bind(this)(r) || r; + r = this.options.post_lex.call(this, r) || r; } return r; }, From 00bd925542be7af3dc6f457d1c7b1b9a6f3054d9 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 16 Dec 2013 18:36:45 +0100 Subject: [PATCH 022/417] renamed make target \'install\' to \'npm-install\' as that is what it really is, while the \'install\' target is generally understood to _install_ the application itself, e.g. in /usr/local/bin/ --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index e646e73..dc04cf2 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ -all: install build test +all: npm-install build test -install: +npm-install: npm install build: @@ -23,4 +23,4 @@ superclean: clean -.PHONY: all install build test clean superclean +.PHONY: all npm-install build test clean superclean From 09e7202276563661af66564f9bada5120b9ac320 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 25 Dec 2013 04:24:11 +0100 Subject: [PATCH 023/417] preliminary fix for #204; this edit is a game-changer for non-`%option flex` lexers as those lexers MUST list their literal matching words (contained in quotes) from large to small length to ensure the first regex rule does not match by being a matching __prefix__ of the word being matched. --- lex.y | 3 --- 1 file changed, 3 deletions(-) diff --git a/lex.y b/lex.y index 51ac81f..2210aa9 100644 --- a/lex.y +++ b/lex.y @@ -132,9 +132,6 @@ regex : regex_list { $$ = $1; - if (!(yy.options && yy.options.flex) && $$.match(/[\w\d]$/) && !$$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { - $$ += "\\b"; - } } ; From 196db335553a54eba79e5718026f46a56c31299b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 25 Dec 2013 04:24:32 +0100 Subject: [PATCH 024/417] JSHinted semicolon envy. --- lex.l | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/lex.l b/lex.l index d7c0523..c6e5cd2 100644 --- a/lex.l +++ b/lex.l @@ -14,8 +14,8 @@ BR \r\n|\n|\r "'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; [/"'][^{}/"']+ return 'ACTION_BODY'; [^{}/"']+ return 'ACTION_BODY'; -"{" yy.depth++; return '{' -"}" yy.depth == 0 ? this.begin('trail') : yy.depth--; return '}' +"{" yy.depth++; return '{'; +"}" if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return '}'; {NAME} return 'NAME'; ">" this.popState(); return '>'; @@ -24,26 +24,26 @@ BR \r\n|\n|\r {BR}+ /* */ \s+{BR}+ /* */ -\s+ this.begin('indented') -"%%" this.begin('code'); return '%%' -[a-zA-Z0-9_]+ return 'CHARACTER_LIT' +\s+ this.begin('indented'); +"%%" this.begin('code'); return '%%'; +[a-zA-Z0-9_]+ return 'CHARACTER_LIT'; -{NAME} yy.options[yytext] = true -{BR}+ this.begin('INITIAL') -\s+{BR}+ this.begin('INITIAL') +{NAME} yy.options[yytext] = true; +{BR}+ this.begin('INITIAL'); +\s+{BR}+ this.begin('INITIAL'); \s+ /* empty */ -{NAME} return 'START_COND' -{BR}+ this.begin('INITIAL') -\s+{BR}+ this.begin('INITIAL') +{NAME} return 'START_COND'; +{BR}+ this.begin('INITIAL'); +\s+{BR}+ this.begin('INITIAL'); \s+ /* empty */ -.*{BR}+ this.begin('rules') +.*{BR}+ this.begin('rules'); -"{" yy.depth = 0; this.begin('action'); return '{' -"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length-4);return 'ACTION' -"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length-4); return 'ACTION' -.+ this.begin('rules'); return 'ACTION' +"{" yy.depth = 0; this.begin('action'); return '{'; +"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; +"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; +.+ this.begin('rules'); return 'ACTION'; "/*"(.|\n|\r)*?"*/" /* ignore */ "//".* /* ignore */ From 188b5b5f1a89a377939c073b055bab063379eecc Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 25 Dec 2013 05:13:31 +0100 Subject: [PATCH 025/417] fix tests to match the new output due to the preliminary fix for #204 --- lex-parser.js | 35 ++++++++++++++++------------------- tests/all-tests.js | 34 +++++++++++++++++----------------- tests/lex/bnf.lex.json | 10 +++++----- 3 files changed, 38 insertions(+), 41 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index bae8c3e..364c840 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -201,9 +201,6 @@ case 30: this.$ = $$[$0-2]; this.$.push($$[$0]); break; case 31: this.$ = $$[$0]; - if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { - this.$ += "\\b"; - } break; case 32: this.$ = $$[$0-2] + '|' + $$[$0]; @@ -916,9 +913,9 @@ case 5:return 26; break; case 6:return 26; break; -case 7:yy.depth++; return 22 +case 7:yy.depth++; return 22; break; -case 8:yy.depth == 0 ? this.begin('trail') : yy.depth--; return 24 +case 8:if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 24; break; case 9:return 12; break; @@ -932,37 +929,37 @@ case 13:/* */ break; case 14:/* */ break; -case 15:this.begin('indented') +case 15:this.begin('indented'); break; -case 16:this.begin('code'); return 5 +case 16:this.begin('code'); return 5; break; -case 17:return 56 +case 17:return 56; break; -case 18:yy.options[yy_.yytext] = true +case 18:yy.options[yy_.yytext] = true; break; -case 19:this.begin('INITIAL') +case 19:this.begin('INITIAL'); break; -case 20:this.begin('INITIAL') +case 20:this.begin('INITIAL'); break; case 21:/* empty */ break; -case 22:return 18 +case 22:return 18; break; -case 23:this.begin('INITIAL') +case 23:this.begin('INITIAL'); break; -case 24:this.begin('INITIAL') +case 24:this.begin('INITIAL'); break; case 25:/* empty */ break; -case 26:this.begin('rules') +case 26:this.begin('rules'); break; -case 27:yy.depth = 0; this.begin('action'); return 22 +case 27:yy.depth = 0; this.begin('action'); return 22; break; -case 28:this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4);return 11 +case 28:this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; break; -case 29:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4); return 11 +case 29:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; break; -case 30:this.begin('rules'); return 11 +case 30:this.begin('rules'); return 11; break; case 31:/* ignore */ break; diff --git a/tests/all-tests.js b/tests/all-tests.js index 8a09501..4068c66 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -12,7 +12,7 @@ exports["test lex grammar with macros"] = function () { var expected = { macros: {"D": "[0-9]", "ID": "[a-zA-Z][a-zA-Z0-9]+"}, rules: [ - ["{D}ohhai\\b", "print(9);"], + ["{D}ohhai", "print(9);"], ["\\{", "return '{';"] ] }; @@ -52,8 +52,8 @@ exports["test [^\\]]"] = function () { var expected = { rules: [ ["\\[[^\\]]\\]", "return true;"], - ["f\"oo'bar\\b", "return 'baz2';"], - ['fo"obar\\b', "return 'baz';"] + ["f\"oo'bar", "return 'baz2';"], + ['fo"obar', "return 'baz';"] ] }; @@ -183,10 +183,10 @@ exports["test start conditions"] = function () { "EAT": 1, }, rules: [ - ["enter-test\\b", "this.begin('TEST');" ], - [["TEST","EAT"], "x\\b", "return 'T';" ], - [["*"], "z\\b", "return 'Z';" ], - [["TEST"], "y\\b", "this.begin('INITIAL'); return 'TY';" ] + ["enter-test", "this.begin('TEST');" ], + [["TEST","EAT"], "x", "return 'T';" ], + [["*"], "z", "return 'Z';" ], + [["TEST"], "y", "this.begin('INITIAL'); return 'TY';" ] ] }; @@ -198,7 +198,7 @@ exports["test no brace action"] = function () { var expected = { rules: [ ["\\[[^\\]]\\]", "return true;"], - ["x\\b", "return 1;"] + ["x", "return 1;"] ] }; @@ -209,7 +209,7 @@ exports["test quote escape"] = function () { var lexgrammar = '%%\n\\"\\\'"x" return 1;'; var expected = { rules: [ - ["\"'x\\b", "return 1;"] + ["\"'x", "return 1;"] ] }; @@ -220,7 +220,7 @@ exports["test escape things"] = function () { var lexgrammar = '%%\n\\"\\\'\\\\\\*\\i return 1;\n"a"\\b return 2;\n\\cA {}\n\\012 {}\n\\xFF {}'; var expected = { rules: [ - ["\"'\\\\\\*i\\b", "return 1;"], + ["\"'\\\\\\*i", "return 1;"], ["a\\b", "return 2;"], ["\\cA", ""], ["\\012", ""], @@ -279,7 +279,7 @@ exports["test trailing code include"] = function () { var lexgrammar = '%%"foo" {return bar;}\n%% var bar = 1;'; var expected = { rules: [ - ['foo\\b', "return bar;"] + ['foo', "return bar;"] ], moduleInclude: " var bar = 1;" }; @@ -326,8 +326,8 @@ exports["test [^\\\\]"] = function () { var expected = { rules: [ ["\\[[^\\\\]\\]", "return true;"], - ["f\"oo'bar\\b", "return 'baz2';"], - ['fo"obar\\b', "return 'baz';"] + ["f\"oo'bar", "return 'baz2';"], + ['fo"obar', "return 'baz';"] ] }; @@ -360,8 +360,8 @@ exports["test no brace action with surplus whitespace between rules"] = function var lexgrammar = '%%\n"a" return true;\n \n"b" return 1;\n \n'; var expected = { rules: [ - ["a\\b", "return true;"], - ["b\\b", "return 1;"] + ["a", "return true;"], + ["b", "return 1;"] ] }; @@ -383,8 +383,8 @@ exports["test braced action with surplus whitespace between rules"] = function ( var lexgrammar = '%%\n"a" %{ \nreturn true;\n%} \n \n"b" %{ return 1;\n%} \n \n'; var expected = { rules: [ - ["a\\b", " \nreturn true;\n"], - ["b\\b", " return 1;\n"] + ["a", " \nreturn true;\n"], + ["b", " return 1;\n"] ] }; diff --git a/tests/lex/bnf.lex.json b/tests/lex/bnf.lex.json index 0dc1f6c..99aa3d0 100644 --- a/tests/lex/bnf.lex.json +++ b/tests/lex/bnf.lex.json @@ -9,11 +9,11 @@ [";", "return ';';"], ["\\|", "return '|';"], ["%%", "return '%%';"], - ["%prec\\b", "return 'PREC';"], - ["%start\\b", "return 'START';"], - ["%left\\b", "return 'LEFT';"], - ["%right\\b", "return 'RIGHT';"], - ["%nonassoc\\b", "return 'NONASSOC';"], + ["%prec", "return 'PREC';"], + ["%start", "return 'START';"], + ["%left", "return 'LEFT';"], + ["%right", "return 'RIGHT';"], + ["%nonassoc", "return 'NONASSOC';"], ["%[a-zA-Z]+[^\\n]*", "/* ignore unrecognized decl */"], ["\\{\\{[^}]*\\}", "return yy.lexAction(this);"], ["\\{[^}]*\\}", "yytext = yytext.substr(1, yyleng-2); return 'ACTION';"], From 883ec9337d9b8e4a323689119289c8f8ebed42c1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 25 Dec 2013 05:16:37 +0100 Subject: [PATCH 026/417] regenerated library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 364c840..578bb87 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1039,7 +1039,7 @@ case 68:return 9; break; } }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:.*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:.*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options)/,/^(?:%s)/,/^(?:%x)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} }; return lexer; From 8a16ce8cf71f0e0de619033a497ce2f2acfd5e0b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 26 Dec 2013 03:04:12 +0100 Subject: [PATCH 027/417] make sure the lexer chunk cannot be illegally terminated by a `/lex` inside a comment in the lexer: we use the simple heuristic that the `/lex` terminator must be at the start of a new line (with possible leading whitespace) --- lex-parser.js | 16 ++++++++-------- lex.l | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 578bb87..a519f08 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -925,9 +925,9 @@ case 11:return 31; break; case 12:return 30; break; -case 13:/* */ +case 13:/* empty */ break; -case 14:/* */ +case 14:/* empty */ break; case 15:this.begin('indented'); break; @@ -961,13 +961,13 @@ case 29:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; break; case 30:this.begin('rules'); return 11; break; -case 31:/* ignore */ +case 31:/* empty */ break; -case 32:/* ignore */ +case 32:/* empty */ break; -case 33:/* */ +case 33:/* ignore */ break; -case 34:/* */ +case 34:/* ignore */ break; case 35:return 12; break; @@ -1031,7 +1031,7 @@ case 64:return 22; break; case 65:return 24; break; -case 66:/* ignore bad characters */ +case 66:throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ break; case 67:return 8; break; @@ -1039,7 +1039,7 @@ case 68:return 9; break; } }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:.*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options)/,/^(?:%s)/,/^(?:%x)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options)/,/^(?:%s)/,/^(?:%x)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} }; return lexer; diff --git a/lex.l b/lex.l index c6e5cd2..f855af1 100644 --- a/lex.l +++ b/lex.l @@ -22,8 +22,8 @@ BR \r\n|\n|\r "," return ','; "*" return '*'; -{BR}+ /* */ -\s+{BR}+ /* */ +{BR}+ /* empty */ +\s+{BR}+ /* empty */ \s+ this.begin('indented'); "%%" this.begin('code'); return '%%'; [a-zA-Z0-9_]+ return 'CHARACTER_LIT'; @@ -38,18 +38,18 @@ BR \r\n|\n|\r \s+{BR}+ this.begin('INITIAL'); \s+ /* empty */ -.*{BR}+ this.begin('rules'); +\s*{BR}+ this.begin('rules'); "{" yy.depth = 0; this.begin('action'); return '{'; "%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; "%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; .+ this.begin('rules'); return 'ACTION'; -"/*"(.|\n|\r)*?"*/" /* ignore */ -"//".* /* ignore */ +"/*"(.|\n|\r)*?"*/" /* empty */ +"//".* /* empty */ -{BR}+ /* */ -\s+ /* */ +{BR}+ /* ignore */ +\s+ /* ignore */ {NAME} return 'NAME'; \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; @@ -81,7 +81,7 @@ BR \r\n|\n|\r "{"{NAME}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; -. /* ignore bad characters */ +. throw new Error("unsupported input character: " + yytext); /* b0rk on bad characters */ <*><> return 'EOF'; (.|{BR})+ return 'CODE'; From 3c9742e2b7297f4b89243f55822e48e7c5429d18 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 27 Dec 2013 00:28:50 +0100 Subject: [PATCH 028/417] whitespace police: align the action code in the lexer --- README.md | 153 ++++++++++++++++++++++++++------------------------ lex-parser.js | 22 ++++---- lex.l | 143 +++++++++++++++++++++++----------------------- lex.y | 12 ++-- 4 files changed, 170 insertions(+), 160 deletions(-) diff --git a/README.md b/README.md index 6913c62..477278a 100644 --- a/README.md +++ b/README.md @@ -25,84 +25,93 @@ This will generate `lex-parser.js`. The parser can parse its own lexical grammar, shown below: - NAME [a-zA-Z_][a-zA-Z0-9_-]* + NAME [a-zA-Z_][a-zA-Z0-9_-]* + BR \r\n|\n|\r %s indented trail rules %x code start_condition options conditions action %% - [^{}]+ return 'ACTION_BODY' - "{" yy.depth++; return '{' - "}" yy.depth == 0 ? this.begin('trail') : yy.depth--; return '}' - - {NAME} return 'NAME' - ">" this.popState(); return '>' - "," return ',' - "*" return '*' - - \n+ /* */ - \s+ this.begin('indented') - "%%" this.begin('code'); return '%%' - [a-zA-Z0-9_]+ return 'CHARACTER_LIT' - - {NAME} yy.options[yytext] = true - \n+ this.begin('INITIAL') - \s+\n+ this.begin('INITIAL') - \s+ /* empty */ - - {NAME} return 'START_COND' - \n+ this.begin('INITIAL') - \s+\n+ this.begin('INITIAL') - \s+ /* empty */ - - .*\n+ this.begin('rules') - - "{" yy.depth = 0; this.begin('action'); return '{' - "%{"(.|\n)*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length-4);return 'ACTION' - "%{"(.|\n)*?"%}" yytext = yytext.substr(2, yytext.length-4); return 'ACTION' - .+ this.begin('rules'); return 'ACTION' - - "/*"(.|\n|\r)*?"*/" /* ignore */ - "//".* /* ignore */ - - \n+ /* */ - \s+ /* */ - {NAME} return 'NAME' - \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"');return 'STRING_LIT' - "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'");return 'STRING_LIT' - "|" return '|' - "["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX' - "(?:" return 'SPECIAL_GROUP' - "(?=" return 'SPECIAL_GROUP' - "(?!" return 'SPECIAL_GROUP' - "(" return '(' - ")" return ')' - "+" return '+' - "*" return '*' - "?" return '?' - "^" return '^' - "," return ',' - "<>" return '$' - "<" this.begin('conditions'); return '<' - "/!" return '/!' - "/" return '/' - "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR' - "\\". yytext = yytext.replace(/^\\/g,''); return 'ESCAPE_CHAR' - "$" return '$' - "." return '.' - "%options" yy.options = {}; this.begin('options') - "%s" this.begin('start_condition');return 'START_INC' - "%x" this.begin('start_condition');return 'START_EXC' - "%%" this.begin('rules'); return '%%' - "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX' - "{"{NAME}"}" return 'NAME_BRACE' - "{" return '{' - "}" return '}' - . /* ignore bad characters */ - <*><> return 'EOF' - - (.|\n)+ return 'CODE' + "/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; + "//".* return 'ACTION_BODY'; + "/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; // regexp with braces or quotes (and no spaces) + \"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; + "'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; + [/"'][^{}/"']+ return 'ACTION_BODY'; + [^{}/"']+ return 'ACTION_BODY'; + "{" yy.depth++; return '{'; + "}" if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return '}'; + + {NAME} return 'NAME'; + ">" this.popState(); return '>'; + "," return ','; + "*" return '*'; + + {BR}+ /* empty */ + \s+{BR}+ /* empty */ + \s+ this.begin('indented'); + "%%" this.begin('code'); return '%%'; + [a-zA-Z0-9_]+ return 'CHARACTER_LIT'; + + {NAME} yy.options[yytext] = true; + {BR}+ this.begin('INITIAL'); + \s+{BR}+ this.begin('INITIAL'); + \s+ /* empty */ + + {NAME} return 'START_COND'; + {BR}+ this.begin('INITIAL'); + \s+{BR}+ this.begin('INITIAL'); + \s+ /* empty */ + + \s*{BR}+ this.begin('rules'); + + "{" yy.depth = 0; this.begin('action'); return '{'; + "%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; + "%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; + .+ this.begin('rules'); return 'ACTION'; + + "/*"(.|\n|\r)*?"*/" /* empty */ + "//".* /* empty */ + + {BR}+ /* ignore */ + \s+ /* ignore */ + {NAME} return 'NAME'; + \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; + "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; + "|" return '|'; + "["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; + "(?:" return 'SPECIAL_GROUP'; + "(?=" return 'SPECIAL_GROUP'; + "(?!" return 'SPECIAL_GROUP'; + "(" return '('; + ")" return ')'; + "+" return '+'; + "*" return '*'; + "?" return '?'; + "^" return '^'; + "," return ','; + "<>" return '$'; + "<" this.begin('conditions'); return '<'; + "/!" return '/!'; + "/" return '/'; + "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) + return 'ESCAPE_CHAR'; + "\\". yytext = yytext.replace(/^\\/g,''); return 'ESCAPE_CHAR'; + "$" return '$'; + "." return '.'; + "%options" yy.options = {}; this.begin('options'); + "%s" this.begin('start_condition'); return 'START_INC'; + "%x" this.begin('start_condition'); return 'START_EXC'; + "%%" this.begin('rules'); return '%%'; + "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; + "{"{NAME}"}" return 'NAME_BRACE'; + "{" return '{'; + "}" return '}'; + . throw new Error("unsupported input character: " + yytext); /* b0rk on bad characters */ + <*><> return 'EOF'; + + (.|{BR})+ return 'CODE'; %% diff --git a/lex-parser.js b/lex-parser.js index a519f08..cccbae7 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -108,7 +108,7 @@ the scan when a token is returned by the action code. } */ -var lexParser = (function(){ +var lex = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, @@ -183,13 +183,13 @@ case 20:this.$ = ''; break; case 21:this.$ = $$[$0]; break; -case 22:this.$ = $$[$0-4]+$$[$0-3]+$$[$0-2]+$$[$0-1]+$$[$0]; +case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; case 24: this.$ = yytext; break; -case 25: this.$ = $$[$0-1]+$$[$0]; +case 25: this.$ = $$[$0-1] + $$[$0]; break; case 26: this.$ = $$[$0-1]; break; @@ -207,7 +207,7 @@ case 32: this.$ = $$[$0-2] + '|' + $$[$0]; break; case 33: this.$ = $$[$0-1] + '|'; break; -case 35: this.$ = '' +case 35: this.$ = ''; break; case 36: this.$ = $$[$0-1] + $$[$0]; break; @@ -540,11 +540,11 @@ parse: function parse(input) { }}; -function encodeRE (s) { - return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g,'\\u$1'); +function encodeRE(s) { + return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); } -function prepareString (s) { +function prepareString(s) { // unescape slashes s = s.replace(/\\\\/g, "\\"); s = encodeRE(s); @@ -1039,7 +1039,7 @@ case 68:return 9; break; } }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options)/,/^(?:%s)/,/^(?:%x)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} }; return lexer; @@ -1054,9 +1054,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lexParser; -exports.Parser = lexParser.Parser; -exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; +exports.parser = lex; +exports.Parser = lex.Parser; +exports.parse = function () { return lex.parse.apply(lex, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); diff --git a/lex.l b/lex.l index f855af1..8b77cdc 100644 --- a/lex.l +++ b/lex.l @@ -1,90 +1,91 @@ -NAME [a-zA-Z_][a-zA-Z0-9_-]* -BR \r\n|\n|\r +NAME [a-zA-Z_][a-zA-Z0-9_-]* +BR \r\n|\n|\r %s indented trail rules %x code start_condition options conditions action %% -"/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; -"//".* return 'ACTION_BODY'; -"/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; // regexp with braces or quotes (and no spaces) -\"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; -"'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; -[/"'][^{}/"']+ return 'ACTION_BODY'; -[^{}/"']+ return 'ACTION_BODY'; -"{" yy.depth++; return '{'; -"}" if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return '}'; +"/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; +"//".* return 'ACTION_BODY'; +"/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; // regexp with braces or quotes (and no spaces) +\"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; +"'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; +[/"'][^{}/"']+ return 'ACTION_BODY'; +[^{}/"']+ return 'ACTION_BODY'; +"{" yy.depth++; return '{'; +"}" if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return '}'; -{NAME} return 'NAME'; -">" this.popState(); return '>'; -"," return ','; -"*" return '*'; +{NAME} return 'NAME'; +">" this.popState(); return '>'; +"," return ','; +"*" return '*'; -{BR}+ /* empty */ -\s+{BR}+ /* empty */ -\s+ this.begin('indented'); -"%%" this.begin('code'); return '%%'; -[a-zA-Z0-9_]+ return 'CHARACTER_LIT'; +{BR}+ /* empty */ +\s+{BR}+ /* empty */ +\s+ this.begin('indented'); +"%%" this.begin('code'); return '%%'; +[a-zA-Z0-9_]+ return 'CHARACTER_LIT'; -{NAME} yy.options[yytext] = true; -{BR}+ this.begin('INITIAL'); -\s+{BR}+ this.begin('INITIAL'); -\s+ /* empty */ +{NAME} yy.options[yytext] = true; +{BR}+ this.begin('INITIAL'); +\s+{BR}+ this.begin('INITIAL'); +\s+ /* empty */ -{NAME} return 'START_COND'; -{BR}+ this.begin('INITIAL'); -\s+{BR}+ this.begin('INITIAL'); -\s+ /* empty */ +{NAME} return 'START_COND'; +{BR}+ this.begin('INITIAL'); +\s+{BR}+ this.begin('INITIAL'); +\s+ /* empty */ -\s*{BR}+ this.begin('rules'); +\s*{BR}+ this.begin('rules'); -"{" yy.depth = 0; this.begin('action'); return '{'; -"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; -"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; -.+ this.begin('rules'); return 'ACTION'; +"{" yy.depth = 0; this.begin('action'); return '{'; +"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; +"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; +.+ this.begin('rules'); return 'ACTION'; -"/*"(.|\n|\r)*?"*/" /* empty */ -"//".* /* empty */ +"/*"(.|\n|\r)*?"*/" /* empty */ +"//".* /* empty */ -{BR}+ /* ignore */ -\s+ /* ignore */ -{NAME} return 'NAME'; -\"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; -"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; -"|" return '|'; -"["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; -"(?:" return 'SPECIAL_GROUP'; -"(?=" return 'SPECIAL_GROUP'; -"(?!" return 'SPECIAL_GROUP'; -"(" return '('; -")" return ')'; -"+" return '+'; -"*" return '*'; -"?" return '?'; -"^" return '^'; -"," return ','; -"<>" return '$'; -"<" this.begin('conditions'); return '<'; -"/!" return '/!'; -"/" return '/'; -"\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR'; -"\\". yytext = yytext.replace(/^\\/g,''); return 'ESCAPE_CHAR'; -"$" return '$'; -"." return '.'; -"%options" yy.options = {}; this.begin('options'); -"%s" this.begin('start_condition'); return 'START_INC'; -"%x" this.begin('start_condition'); return 'START_EXC'; -"%%" this.begin('rules'); return '%%'; -"{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; -"{"{NAME}"}" return 'NAME_BRACE'; -"{" return '{'; -"}" return '}'; -. throw new Error("unsupported input character: " + yytext); /* b0rk on bad characters */ -<*><> return 'EOF'; +{BR}+ /* ignore */ +\s+ /* ignore */ +{NAME} return 'NAME'; +\"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; +"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; +"|" return '|'; +"["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; +"(?:" return 'SPECIAL_GROUP'; +"(?=" return 'SPECIAL_GROUP'; +"(?!" return 'SPECIAL_GROUP'; +"(" return '('; +")" return ')'; +"+" return '+'; +"*" return '*'; +"?" return '?'; +"^" return '^'; +"," return ','; +"<>" return '$'; +"<" this.begin('conditions'); return '<'; +"/!" return '/!'; +"/" return '/'; +"\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) + return 'ESCAPE_CHAR'; +"\\". yytext = yytext.replace(/^\\/g,''); return 'ESCAPE_CHAR'; +"$" return '$'; +"." return '.'; +"%options" yy.options = {}; this.begin('options'); +"%s" this.begin('start_condition'); return 'START_INC'; +"%x" this.begin('start_condition'); return 'START_EXC'; +"%%" this.begin('rules'); return '%%'; +"{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; +"{"{NAME}"}" return 'NAME_BRACE'; +"{" return '{'; +"}" return '}'; +. throw new Error("unsupported input character: " + yytext); /* b0rk on bad characters */ +<*><> return 'EOF'; -(.|{BR})+ return 'CODE'; +(.|{BR})+ return 'CODE'; %% diff --git a/lex.y b/lex.y index 2210aa9..23ea3db 100644 --- a/lex.y +++ b/lex.y @@ -100,7 +100,7 @@ action_body | action_comments_body {$$ = $1;} | action_body '{' action_body '}' action_comments_body - {$$ = $1+$2+$3+$4+$5;} + {$$ = $1 + $2 + $3 + $4 + $5;} | action_body '{' action_body '}' {$$ = $1 + $2 + $3 + $4;} ; @@ -109,7 +109,7 @@ action_comments_body : ACTION_BODY { $$ = yytext; } | action_comments_body ACTION_BODY - { $$ = $1+$2; } + { $$ = $1 + $2; } ; @@ -142,7 +142,7 @@ regex_list { $$ = $1 + '|'; } | regex_concat | - { $$ = '' } + { $$ = ''; } ; regex_concat @@ -207,11 +207,11 @@ string %% -function encodeRE (s) { - return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g,'\\u$1'); +function encodeRE(s) { + return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); } -function prepareString (s) { +function prepareString(s) { // unescape slashes s = s.replace(/\\\\/g, "\\"); s = encodeRE(s); From 6fed7bd5d0cd105c55eae3813dc1809ef1308ec7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 27 Dec 2013 03:20:21 +0100 Subject: [PATCH 029/417] regenerated library files --- lex-parser.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index cccbae7..f4b0734 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -108,7 +108,7 @@ the scan when a token is returned by the action code. } */ -var lex = (function(){ +var lexParser = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, @@ -1039,7 +1039,7 @@ case 68:return 9; break; } }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options)/,/^(?:%s)/,/^(?:%x)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} }; return lexer; @@ -1054,9 +1054,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lex; -exports.Parser = lex.Parser; -exports.parse = function () { return lex.parse.apply(lex, arguments); }; +exports.parser = lexParser; +exports.Parser = lexParser.Parser; +exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); From 8fb61e468370aeadf7a947fd0d07ac9f9f78bc5b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 27 Dec 2013 21:32:06 +0100 Subject: [PATCH 030/417] regenerated library files --- lex-parser.js | 687 ++++++++++++++++++++++++++++++++++++-------------- lex.y | 6 +- 2 files changed, 499 insertions(+), 194 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index f4b0734..9ddfc25 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -120,7 +120,9 @@ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* actio var $0 = $$.length - 1; switch (yystate) { -case 1: +case 1 : +/*! Production:: lex : definitions %% rules epilogue */ + this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; @@ -130,15 +132,23 @@ case 1: delete yy.options; delete yy.actionInclude; return this.$; - + break; -case 2: this.$ = null; +case 2 : +/*! Production:: epilogue : EOF */ + this.$ = null; break; -case 3: this.$ = null; +case 3 : +/*! Production:: epilogue : %% EOF */ + this.$ = null; break; -case 4: this.$ = $$[$0-1]; +case 4 : +/*! Production:: epilogue : %% CODE EOF */ + this.$ = $$[$0-1]; break; -case 5: +case 5 : +/*! Production:: definitions : definition definitions */ + this.$ = $$[$0]; if ('length' in $$[$0-1]) { this.$[0] = this.$[0] || {}; @@ -149,97 +159,185 @@ case 5: this.$[1][name] = $$[$0-1][name]; } } - + break; -case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +case 6 : +/*! Production:: definitions : ACTION definitions */ + yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; break; -case 7: yy.actionInclude = ''; this.$ = [null,null]; +case 7 : +/*! Production:: definitions : */ + yy.actionInclude = ''; this.$ = [null,null]; break; -case 8: this.$ = [$$[$0-1], $$[$0]]; +case 8 : +/*! Production:: definition : NAME regex */ + this.$ = [$$[$0-1], $$[$0]]; break; -case 9: this.$ = $$[$0]; +case 9 : +/*! Production:: definition : START_INC names_inclusive */ + this.$ = $$[$0]; break; -case 10: this.$ = $$[$0]; +case 10 : +/*! Production:: definition : START_EXC names_exclusive */ + this.$ = $$[$0]; break; -case 11: this.$ = {}; this.$[$$[$0]] = 0; +case 11 : +/*! Production:: names_inclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 0; break; -case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +case 12 : +/*! Production:: names_inclusive : names_inclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 0; break; -case 13: this.$ = {}; this.$[$$[$0]] = 1; +case 13 : +/*! Production:: names_exclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 1; break; -case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +case 14 : +/*! Production:: names_exclusive : names_exclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 1; break; -case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); +case 15 : +/*! Production:: rules : rules rule */ + this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 16: this.$ = [$$[$0]]; +case 16 : +/*! Production:: rules : rule */ + this.$ = [$$[$0]]; break; -case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; +case 17 : +/*! Production:: rule : start_conditions regex action */ + this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; -case 18:this.$ = $$[$0-1]; +case 18 : +/*! Production:: action : { action_body } */ + this.$ = $$[$0-1]; break; -case 19:this.$ = $$[$0]; +case 19 : +/*! Production:: action : ACTION */ + this.$ = $$[$0]; break; -case 20:this.$ = ''; +case 20 : +/*! Production:: action_body : */ + this.$ = ''; break; -case 21:this.$ = $$[$0]; +case 21 : +/*! Production:: action_body : action_comments_body */ + this.$ = $$[$0]; break; -case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +case 22 : +/*! Production:: action_body : action_body { action_body } action_comments_body */ + this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +case 23 : +/*! Production:: action_body : action_body { action_body } */ + this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24: this.$ = yytext; +case 24 : +/*! Production:: action_comments_body : ACTION_BODY */ + this.$ = yytext; break; -case 25: this.$ = $$[$0-1] + $$[$0]; +case 25 : +/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ + this.$ = $$[$0-1] + $$[$0]; break; -case 26: this.$ = $$[$0-1]; +case 26 : +/*! Production:: start_conditions : < name_list > */ + this.$ = $$[$0-1]; break; -case 27: this.$ = ['*']; +case 27 : +/*! Production:: start_conditions : < * > */ + this.$ = ['*']; break; -case 29: this.$ = [$$[$0]]; +case 29 : +/*! Production:: name_list : NAME */ + this.$ = [$$[$0]]; break; -case 30: this.$ = $$[$0-2]; this.$.push($$[$0]); +case 30 : +/*! Production:: name_list : name_list , NAME */ + this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 31: +case 31 : +/*! Production:: regex : regex_list */ + this.$ = $$[$0]; - + break; -case 32: this.$ = $$[$0-2] + '|' + $$[$0]; +case 32 : +/*! Production:: regex_list : regex_list | regex_concat */ + this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 33: this.$ = $$[$0-1] + '|'; +case 33 : +/*! Production:: regex_list : regex_list | */ + this.$ = $$[$0-1] + '|'; break; -case 35: this.$ = ''; +case 35 : +/*! Production:: regex_list : */ + this.$ = ''; break; -case 36: this.$ = $$[$0-1] + $$[$0]; +case 36 : +/*! Production:: regex_concat : regex_concat regex_base */ + this.$ = $$[$0-1] + $$[$0]; break; -case 38: this.$ = '(' + $$[$0-1] + ')'; +case 38 : +/*! Production:: regex_base : ( regex_list ) */ + this.$ = '(' + $$[$0-1] + ')'; break; -case 39: this.$ = $$[$0-2] + $$[$0-1] + ')'; +case 39 : +/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ + this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 40: this.$ = $$[$0-1] + '+'; +case 40 : +/*! Production:: regex_base : regex_base + */ + this.$ = $$[$0-1] + '+'; break; -case 41: this.$ = $$[$0-1] + '*'; +case 41 : +/*! Production:: regex_base : regex_base * */ + this.$ = $$[$0-1] + '*'; break; -case 42: this.$ = $$[$0-1] + '?'; +case 42 : +/*! Production:: regex_base : regex_base ? */ + this.$ = $$[$0-1] + '?'; break; -case 43: this.$ = '(?=' + $$[$0] + ')'; +case 43 : +/*! Production:: regex_base : / regex_base */ + this.$ = '(?=' + $$[$0] + ')'; break; -case 44: this.$ = '(?!' + $$[$0] + ')'; +case 44 : +/*! Production:: regex_base : /! regex_base */ + this.$ = '(?!' + $$[$0] + ')'; break; -case 46: this.$ = $$[$0-1] + $$[$0]; +case 46 : +/*! Production:: regex_base : regex_base range_regex */ + this.$ = $$[$0-1] + $$[$0]; break; -case 48: this.$ = '.'; +case 48 : +/*! Production:: regex_base : . */ + this.$ = '.'; break; -case 49: this.$ = '^'; +case 49 : +/*! Production:: regex_base : ^ */ + this.$ = '^'; break; -case 50: this.$ = '$'; +case 50 : +/*! Production:: regex_base : $ */ + this.$ = '$'; break; -case 54: this.$ = yytext; +case 54 : +/*! Production:: any_group_regex : ANY_GROUP_REGEX */ + this.$ = yytext; break; -case 55: this.$ = yytext; +case 55 : +/*! Production:: escape_char : ESCAPE_CHAR */ + this.$ = yytext; break; -case 56: this.$ = yytext; +case 56 : +/*! Production:: range_regex : RANGE_REGEX */ + this.$ = yytext; break; -case 57: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +case 57 : +/*! Production:: string : STRING_LIT */ + this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; } }, @@ -540,11 +638,11 @@ parse: function parse(input) { }}; -function encodeRE(s) { +function encodeRE (s) { return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); } -function prepareString(s) { +function prepareString (s) { // unescape slashes s = s.replace(/\\\\/g, "\\"); s = encodeRE(s); @@ -899,143 +997,350 @@ performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START var YYSTATE=YY_START; switch($avoiding_name_collisions) { -case 0:return 26; -break; -case 1:return 26; -break; -case 2:return 26; // regexp with braces or quotes (and no spaces) -break; -case 3:return 26; -break; -case 4:return 26; -break; -case 5:return 26; -break; -case 6:return 26; -break; -case 7:yy.depth++; return 22; -break; -case 8:if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 24; -break; -case 9:return 12; -break; -case 10:this.popState(); return 29; -break; -case 11:return 31; -break; -case 12:return 30; -break; -case 13:/* empty */ -break; -case 14:/* empty */ -break; -case 15:this.begin('indented'); -break; -case 16:this.begin('code'); return 5; -break; -case 17:return 56; -break; -case 18:yy.options[yy_.yytext] = true; -break; -case 19:this.begin('INITIAL'); -break; -case 20:this.begin('INITIAL'); -break; -case 21:/* empty */ -break; -case 22:return 18; -break; -case 23:this.begin('INITIAL'); -break; -case 24:this.begin('INITIAL'); -break; -case 25:/* empty */ -break; -case 26:this.begin('rules'); -break; -case 27:yy.depth = 0; this.begin('action'); return 22; -break; -case 28:this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; -break; -case 29:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; -break; -case 30:this.begin('rules'); return 11; -break; -case 31:/* empty */ -break; -case 32:/* empty */ -break; -case 33:/* ignore */ -break; -case 34:/* ignore */ -break; -case 35:return 12; -break; -case 36:yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 55; -break; -case 37:yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; -break; -case 38:return 33; -break; -case 39:return 52; -break; -case 40:return 38; -break; -case 41:return 38; -break; -case 42:return 38; -break; -case 43:return 36; -break; -case 44:return 37; -break; -case 45:return 39; -break; -case 46:return 30; -break; -case 47:return 40; -break; -case 48:return 47; -break; -case 49:return 31; -break; -case 50:return 48; -break; -case 51:this.begin('conditions'); return 27; -break; -case 52:return 42; -break; -case 53:return 41; -break; -case 54:return 53; -break; -case 55:yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; -break; -case 56:return 48; -break; -case 57:return 46; -break; -case 58:yy.options = {}; this.begin('options'); -break; -case 59:this.begin('start_condition'); return 14; -break; -case 60:this.begin('start_condition'); return 16; -break; -case 61:this.begin('rules'); return 5; -break; -case 62:return 54; -break; -case 63:return 51; -break; -case 64:return 22; -break; -case 65:return 24; -break; -case 66:throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ -break; -case 67:return 8; -break; -case 68:return 9; +case 0 : +/*! Conditions:: action */ +/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + return 26; +break; +case 1 : +/*! Conditions:: action */ +/*! Rule:: \/\/.* */ + return 26; +break; +case 2 : +/*! Conditions:: action */ +/*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ + return 26; // regexp with braces or quotes (and no spaces) +break; +case 3 : +/*! Conditions:: action */ +/*! Rule:: "(\\\\|\\"|[^"])*" */ + return 26; +break; +case 4 : +/*! Conditions:: action */ +/*! Rule:: '(\\\\|\\'|[^'])*' */ + return 26; +break; +case 5 : +/*! Conditions:: action */ +/*! Rule:: [/"'][^{}/"']+ */ + return 26; +break; +case 6 : +/*! Conditions:: action */ +/*! Rule:: [^{}/"']+ */ + return 26; +break; +case 7 : +/*! Conditions:: action */ +/*! Rule:: \{ */ + yy.depth++; return 22; +break; +case 8 : +/*! Conditions:: action */ +/*! Rule:: \} */ + if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 24; +break; +case 9 : +/*! Conditions:: conditions */ +/*! Rule:: {NAME} */ + return 12; +break; +case 10 : +/*! Conditions:: conditions */ +/*! Rule:: > */ + this.popState(); return 29; +break; +case 11 : +/*! Conditions:: conditions */ +/*! Rule:: , */ + return 31; +break; +case 12 : +/*! Conditions:: conditions */ +/*! Rule:: \* */ + return 30; +break; +case 13 : +/*! Conditions:: rules */ +/*! Rule:: {BR}+ */ + /* empty */ +break; +case 14 : +/*! Conditions:: rules */ +/*! Rule:: \s+{BR}+ */ + /* empty */ +break; +case 15 : +/*! Conditions:: rules */ +/*! Rule:: \s+ */ + this.begin('indented'); +break; +case 16 : +/*! Conditions:: rules */ +/*! Rule:: %% */ + this.begin('code'); return 5; +break; +case 17 : +/*! Conditions:: rules */ +/*! Rule:: [a-zA-Z0-9_]+ */ + return 56; +break; +case 18 : +/*! Conditions:: options */ +/*! Rule:: {NAME} */ + yy.options[yy_.yytext] = true; +break; +case 19 : +/*! Conditions:: options */ +/*! Rule:: {BR}+ */ + this.begin('INITIAL'); +break; +case 20 : +/*! Conditions:: options */ +/*! Rule:: \s+{BR}+ */ + this.begin('INITIAL'); +break; +case 21 : +/*! Conditions:: options */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 22 : +/*! Conditions:: start_condition */ +/*! Rule:: {NAME} */ + return 18; +break; +case 23 : +/*! Conditions:: start_condition */ +/*! Rule:: {BR}+ */ + this.begin('INITIAL'); +break; +case 24 : +/*! Conditions:: start_condition */ +/*! Rule:: \s+{BR}+ */ + this.begin('INITIAL'); +break; +case 25 : +/*! Conditions:: start_condition */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 26 : +/*! Conditions:: trail */ +/*! Rule:: \s*{BR}+ */ + this.begin('rules'); +break; +case 27 : +/*! Conditions:: indented */ +/*! Rule:: \{ */ + yy.depth = 0; this.begin('action'); return 22; +break; +case 28 : +/*! Conditions:: indented */ +/*! Rule:: %\{(.|{BR})*?%\} */ + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; +break; +case 29 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %\{(.|{BR})*?%\} */ + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; +break; +case 30 : +/*! Conditions:: indented */ +/*! Rule:: .+ */ + this.begin('rules'); return 11; +break; +case 31 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /* empty */ +break; +case 32 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/\/.* */ + /* empty */ +break; +case 33 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: {BR}+ */ + /* ignore */ +break; +case 34 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \s+ */ + /* ignore */ +break; +case 35 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: {NAME} */ + return 12; +break; +case 36 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: "(\\\\|\\"|[^"])*" */ + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 55; +break; +case 37 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: '(\\\\|\\'|[^'])*' */ + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; +break; +case 38 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \| */ + return 33; +break; +case 39 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ + return 52; +break; +case 40 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \(\?: */ + return 38; +break; +case 41 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \(\?= */ + return 38; +break; +case 42 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \(\?! */ + return 38; +break; +case 43 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \( */ + return 36; +break; +case 44 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \) */ + return 37; +break; +case 45 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \+ */ + return 39; +break; +case 46 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \* */ + return 30; +break; +case 47 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \? */ + return 40; +break; +case 48 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \^ */ + return 47; +break; +case 49 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: , */ + return 31; +break; +case 50 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: <> */ + return 48; +break; +case 51 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: < */ + this.begin('conditions'); return 27; +break; +case 52 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/! */ + return 42; +break; +case 53 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/ */ + return 41; +break; +case 54 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + return 53; +break; +case 55 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; +break; +case 56 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \$ */ + return 48; +break; +case 57 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \. */ + return 46; +break; +case 58 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %options */ + yy.options = {}; this.begin('options'); +break; +case 59 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %s */ + this.begin('start_condition'); return 14; +break; +case 60 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %x */ + this.begin('start_condition'); return 16; +break; +case 61 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %% */ + this.begin('rules'); return 5; +break; +case 62 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \{\d+(,\s?\d+|,)?\} */ + return 54; +break; +case 63 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \{{NAME}\} */ + return 51; +break; +case 64 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \{ */ + return 22; +break; +case 65 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \} */ + return 24; +break; +case 66 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: . */ + throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ +break; +case 67 : +/*! Conditions:: * */ +/*! Rule:: $ */ + return 8; +break; +case 68 : +/*! Conditions:: code */ +/*! Rule:: (.|{BR})+ */ + return 9; break; } }, diff --git a/lex.y b/lex.y index 23ea3db..17e1a65 100644 --- a/lex.y +++ b/lex.y @@ -84,7 +84,7 @@ rules rule : start_conditions regex action - { $$ = $1 ? [$1, $2, $3] : [$2,$3]; } + { $$ = $1 ? [$1, $2, $3] : [$2, $3]; } ; action @@ -207,11 +207,11 @@ string %% -function encodeRE(s) { +function encodeRE (s) { return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); } -function prepareString(s) { +function prepareString (s) { // unescape slashes s = s.replace(/\\\\/g, "\\"); s = encodeRE(s); From 466c9981a3316baf702466b8e19f542f3c0b4053 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 01:05:57 +0100 Subject: [PATCH 031/417] regenerated library files --- lex-parser.js | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 9ddfc25..16f090c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -659,7 +659,7 @@ ERROR:2, parseError:function parseError(str, hash) { if (this.yy.parser) { - this.yy.parser.parseError(str, hash); + return this.yy.parser.parseError(str, hash) || this.ERROR; } else { throw new Error(str); } @@ -668,7 +668,7 @@ parseError:function parseError(str, hash) { // resets the lexer, sets new input setInput:function (input) { this._input = input; - this._more = this._backtrack = this.done = false; + this._more = this._backtrack = this._signaled_error_token = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; @@ -754,12 +754,14 @@ reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { - this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + // when the parseError() call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // .lex() run. + this._signaled_error_token = (this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { text: this.match, token: null, line: this.yylineno - }); - + }) || this.ERROR); } return this; }, @@ -867,6 +869,11 @@ test_match:function (match, indexed_rule) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + this._signaled_error_token = false; + return token; } return false; }, @@ -921,13 +928,15 @@ next:function () { if (this._input === "") { return this.EOF; } else { - // we cannot recover from a lexer error: we consider the input completely lexed: - this.done = true; - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: this.match + this._input, token: null, line: this.yylineno }) || this.ERROR; + if (token === this.ERROR || token === this.EOF) { + // we cannot recover from a lexer error that parseError() did not 'recover' for us: we consider the input completely lexed: + this.done = true; + } } }, From cdd36db48d33260985238a520f569b9f37507c13 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 12:53:48 +0100 Subject: [PATCH 032/417] fixed make dependencies and added bootstrapping actions so that the sequence `make superclean; make` will work while the 'superclean' target will kill all generated files --- Makefile | 1 + lex-parser.js | 1385 ------------------------------------------------- 2 files changed, 1 insertion(+), 1385 deletions(-) delete mode 100644 lex-parser.js diff --git a/Makefile b/Makefile index dc04cf2..655b042 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ test: clean: + -rm -f lex-parser.js superclean: clean -find . -type d -name 'node_modules' -exec rm -rf "{}" \; diff --git a/lex-parser.js b/lex-parser.js deleted file mode 100644 index 16f090c..0000000 --- a/lex-parser.js +++ /dev/null @@ -1,1385 +0,0 @@ -/* parser generated by jison 0.4.13 */ -/* - Returns a Parser object of the following structure: - - Parser: { - yy: {} - } - - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), - (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), - - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), - stateStackSize: function(), - - options: { ... }, - - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } - - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) - recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) - } - - You can specify parser options by setting / modifying the `.yy` object of your Parser instance. - These options are available: - - ### options which are global for all parser instances - - Parser.pre_parse: function(yy) - optional: you can specify a pre_parse() function in the chunk following the grammar, - i.e. after the last `%%`. - Parser.post_parse: function(yy, retval) { return retval; } - optional: you can specify a post_parse() function in the chunk following the grammar, - i.e. after the last `%%`. When it does not return any value, the parser will return - the original `retval`. - - ### options which can be set up per parser instance - - yy: { - pre_parse: function(yy) - optional: is invoked before the parse cycle starts (and before the first invocation - of `lex()`) but immediately after the invocation of parser.pre_parse()). - post_parse: function(yy, retval) { return retval; } - optional: is invoked when the parse terminates due to success ('accept') or failure - (even when exceptions are thrown). `retval` contains the return value to be produced - by `Parser.parse()`; this function can override the return value by returning another. - When it does not return any value, the parser will return the original `retval`. - This function is invoked immediately before `Parser.post_parse()`. - parseError: function(str, hash) - optional: overrides the default `parseError` function. - } - - parser.lexer.options: { - ranges: boolean optional: true ==> token location info will include a .range[] member. - flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested - exhaustively to find the longest match. - backtrack_lexer: boolean - optional: true ==> lexer regexes are tested in order and for each matching - regex the action code is invoked; the lexer terminates - the scan when a token is returned by the action code. - } -*/ -var lexParser = (function(){ -var parser = {trace: function trace() { }, -yy: {}, -symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, -terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"START_COND",22:"{",24:"}",26:"ACTION_BODY",27:"<",29:">",30:"*",31:",",33:"|",36:"(",37:")",38:"SPECIAL_GROUP",39:"+",40:"?",41:"/",42:"/!",46:".",47:"^",48:"$",51:"NAME_BRACE",52:"ANY_GROUP_REGEX",53:"ESCAPE_CHAR",54:"RANGE_REGEX",55:"STRING_LIT",56:"CHARACTER_LIT"}, -productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[19,3],[21,3],[21,1],[23,0],[23,1],[23,5],[23,4],[25,1],[25,2],[20,3],[20,3],[20,0],[28,1],[28,3],[13,1],[32,3],[32,2],[32,1],[32,0],[34,2],[34,1],[35,3],[35,3],[35,2],[35,2],[35,2],[35,2],[35,2],[35,1],[35,2],[35,1],[35,1],[35,1],[35,1],[35,1],[35,1],[43,1],[45,1],[50,1],[44,1],[49,1],[49,1]], -performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */ -/**/) { -/* this == yyval */ - -var $0 = $$.length - 1; -switch (yystate) { -case 1 : -/*! Production:: lex : definitions %% rules epilogue */ - - this.$ = { rules: $$[$0-1] }; - if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; - if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; - if ($$[$0]) this.$.moduleInclude = $$[$0]; - if (yy.options) this.$.options = yy.options; - if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; - delete yy.options; - delete yy.actionInclude; - return this.$; - -break; -case 2 : -/*! Production:: epilogue : EOF */ - this.$ = null; -break; -case 3 : -/*! Production:: epilogue : %% EOF */ - this.$ = null; -break; -case 4 : -/*! Production:: epilogue : %% CODE EOF */ - this.$ = $$[$0-1]; -break; -case 5 : -/*! Production:: definitions : definition definitions */ - - this.$ = $$[$0]; - if ('length' in $$[$0-1]) { - this.$[0] = this.$[0] || {}; - this.$[0][$$[$0-1][0]] = $$[$0-1][1]; - } else { - this.$[1] = this.$[1] || {}; - for (var name in $$[$0-1]) { - this.$[1][name] = $$[$0-1][name]; - } - } - -break; -case 6 : -/*! Production:: definitions : ACTION definitions */ - yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; -break; -case 7 : -/*! Production:: definitions : */ - yy.actionInclude = ''; this.$ = [null,null]; -break; -case 8 : -/*! Production:: definition : NAME regex */ - this.$ = [$$[$0-1], $$[$0]]; -break; -case 9 : -/*! Production:: definition : START_INC names_inclusive */ - this.$ = $$[$0]; -break; -case 10 : -/*! Production:: definition : START_EXC names_exclusive */ - this.$ = $$[$0]; -break; -case 11 : -/*! Production:: names_inclusive : START_COND */ - this.$ = {}; this.$[$$[$0]] = 0; -break; -case 12 : -/*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0-1]; this.$[$$[$0]] = 0; -break; -case 13 : -/*! Production:: names_exclusive : START_COND */ - this.$ = {}; this.$[$$[$0]] = 1; -break; -case 14 : -/*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0-1]; this.$[$$[$0]] = 1; -break; -case 15 : -/*! Production:: rules : rules rule */ - this.$ = $$[$0-1]; this.$.push($$[$0]); -break; -case 16 : -/*! Production:: rules : rule */ - this.$ = [$$[$0]]; -break; -case 17 : -/*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; -break; -case 18 : -/*! Production:: action : { action_body } */ - this.$ = $$[$0-1]; -break; -case 19 : -/*! Production:: action : ACTION */ - this.$ = $$[$0]; -break; -case 20 : -/*! Production:: action_body : */ - this.$ = ''; -break; -case 21 : -/*! Production:: action_body : action_comments_body */ - this.$ = $$[$0]; -break; -case 22 : -/*! Production:: action_body : action_body { action_body } action_comments_body */ - this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 23 : -/*! Production:: action_body : action_body { action_body } */ - this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 24 : -/*! Production:: action_comments_body : ACTION_BODY */ - this.$ = yytext; -break; -case 25 : -/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - this.$ = $$[$0-1] + $$[$0]; -break; -case 26 : -/*! Production:: start_conditions : < name_list > */ - this.$ = $$[$0-1]; -break; -case 27 : -/*! Production:: start_conditions : < * > */ - this.$ = ['*']; -break; -case 29 : -/*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; -break; -case 30 : -/*! Production:: name_list : name_list , NAME */ - this.$ = $$[$0-2]; this.$.push($$[$0]); -break; -case 31 : -/*! Production:: regex : regex_list */ - - this.$ = $$[$0]; - -break; -case 32 : -/*! Production:: regex_list : regex_list | regex_concat */ - this.$ = $$[$0-2] + '|' + $$[$0]; -break; -case 33 : -/*! Production:: regex_list : regex_list | */ - this.$ = $$[$0-1] + '|'; -break; -case 35 : -/*! Production:: regex_list : */ - this.$ = ''; -break; -case 36 : -/*! Production:: regex_concat : regex_concat regex_base */ - this.$ = $$[$0-1] + $$[$0]; -break; -case 38 : -/*! Production:: regex_base : ( regex_list ) */ - this.$ = '(' + $$[$0-1] + ')'; -break; -case 39 : -/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ - this.$ = $$[$0-2] + $$[$0-1] + ')'; -break; -case 40 : -/*! Production:: regex_base : regex_base + */ - this.$ = $$[$0-1] + '+'; -break; -case 41 : -/*! Production:: regex_base : regex_base * */ - this.$ = $$[$0-1] + '*'; -break; -case 42 : -/*! Production:: regex_base : regex_base ? */ - this.$ = $$[$0-1] + '?'; -break; -case 43 : -/*! Production:: regex_base : / regex_base */ - this.$ = '(?=' + $$[$0] + ')'; -break; -case 44 : -/*! Production:: regex_base : /! regex_base */ - this.$ = '(?!' + $$[$0] + ')'; -break; -case 46 : -/*! Production:: regex_base : regex_base range_regex */ - this.$ = $$[$0-1] + $$[$0]; -break; -case 48 : -/*! Production:: regex_base : . */ - this.$ = '.'; -break; -case 49 : -/*! Production:: regex_base : ^ */ - this.$ = '^'; -break; -case 50 : -/*! Production:: regex_base : $ */ - this.$ = '$'; -break; -case 54 : -/*! Production:: any_group_regex : ANY_GROUP_REGEX */ - this.$ = yytext; -break; -case 55 : -/*! Production:: escape_char : ESCAPE_CHAR */ - this.$ = yytext; -break; -case 56 : -/*! Production:: range_regex : RANGE_REGEX */ - this.$ = yytext; -break; -case 57 : -/*! Production:: string : STRING_LIT */ - this.$ = prepareString(yytext.substr(1, yytext.length - 2)); -break; -} -}, -table: [{3:1,4:2,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{1:[3]},{5:[1,8]},{4:9,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{4:10,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{5:[2,35],11:[2,35],12:[2,35],13:11,14:[2,35],16:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:35,11:[2,28],19:36,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,5]},{5:[2,6]},{5:[2,8],11:[2,8],12:[2,8],14:[2,8],16:[2,8]},{5:[2,31],11:[2,31],12:[2,31],14:[2,31],16:[2,31],22:[2,31],33:[1,39]},{5:[2,34],11:[2,34],12:[2,34],14:[2,34],16:[2,34],22:[2,34],33:[2,34],35:40,36:[1,15],37:[2,34],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,37],11:[2,37],12:[2,37],14:[2,37],16:[2,37],22:[2,37],30:[1,42],33:[2,37],36:[2,37],37:[2,37],38:[2,37],39:[1,41],40:[1,43],41:[2,37],42:[2,37],44:44,46:[2,37],47:[2,37],48:[2,37],51:[2,37],52:[2,37],53:[2,37],54:[1,45],55:[2,37],56:[2,37]},{32:46,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{32:47,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:48,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:49,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,45],11:[2,45],12:[2,45],14:[2,45],16:[2,45],22:[2,45],30:[2,45],33:[2,45],36:[2,45],37:[2,45],38:[2,45],39:[2,45],40:[2,45],41:[2,45],42:[2,45],46:[2,45],47:[2,45],48:[2,45],51:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45],56:[2,45]},{5:[2,47],11:[2,47],12:[2,47],14:[2,47],16:[2,47],22:[2,47],30:[2,47],33:[2,47],36:[2,47],37:[2,47],38:[2,47],39:[2,47],40:[2,47],41:[2,47],42:[2,47],46:[2,47],47:[2,47],48:[2,47],51:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47],56:[2,47]},{5:[2,48],11:[2,48],12:[2,48],14:[2,48],16:[2,48],22:[2,48],30:[2,48],33:[2,48],36:[2,48],37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],42:[2,48],46:[2,48],47:[2,48],48:[2,48],51:[2,48],52:[2,48],53:[2,48],54:[2,48],55:[2,48],56:[2,48]},{5:[2,49],11:[2,49],12:[2,49],14:[2,49],16:[2,49],22:[2,49],30:[2,49],33:[2,49],36:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],42:[2,49],46:[2,49],47:[2,49],48:[2,49],51:[2,49],52:[2,49],53:[2,49],54:[2,49],55:[2,49],56:[2,49]},{5:[2,50],11:[2,50],12:[2,50],14:[2,50],16:[2,50],22:[2,50],30:[2,50],33:[2,50],36:[2,50],37:[2,50],38:[2,50],39:[2,50],40:[2,50],41:[2,50],42:[2,50],46:[2,50],47:[2,50],48:[2,50],51:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50],56:[2,50]},{5:[2,51],11:[2,51],12:[2,51],14:[2,51],16:[2,51],22:[2,51],30:[2,51],33:[2,51],36:[2,51],37:[2,51],38:[2,51],39:[2,51],40:[2,51],41:[2,51],42:[2,51],46:[2,51],47:[2,51],48:[2,51],51:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51],56:[2,51]},{5:[2,52],11:[2,52],12:[2,52],14:[2,52],16:[2,52],22:[2,52],30:[2,52],33:[2,52],36:[2,52],37:[2,52],38:[2,52],39:[2,52],40:[2,52],41:[2,52],42:[2,52],46:[2,52],47:[2,52],48:[2,52],51:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52],56:[2,52]},{5:[2,53],11:[2,53],12:[2,53],14:[2,53],16:[2,53],22:[2,53],30:[2,53],33:[2,53],36:[2,53],37:[2,53],38:[2,53],39:[2,53],40:[2,53],41:[2,53],42:[2,53],46:[2,53],47:[2,53],48:[2,53],51:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53],56:[2,53]},{5:[2,54],11:[2,54],12:[2,54],14:[2,54],16:[2,54],22:[2,54],30:[2,54],33:[2,54],36:[2,54],37:[2,54],38:[2,54],39:[2,54],40:[2,54],41:[2,54],42:[2,54],46:[2,54],47:[2,54],48:[2,54],51:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54],56:[2,54]},{5:[2,57],11:[2,57],12:[2,57],14:[2,57],16:[2,57],22:[2,57],30:[2,57],33:[2,57],36:[2,57],37:[2,57],38:[2,57],39:[2,57],40:[2,57],41:[2,57],42:[2,57],46:[2,57],47:[2,57],48:[2,57],51:[2,57],52:[2,57],53:[2,57],54:[2,57],55:[2,57],56:[2,57]},{5:[2,58],11:[2,58],12:[2,58],14:[2,58],16:[2,58],22:[2,58],30:[2,58],33:[2,58],36:[2,58],37:[2,58],38:[2,58],39:[2,58],40:[2,58],41:[2,58],42:[2,58],46:[2,58],47:[2,58],48:[2,58],51:[2,58],52:[2,58],53:[2,58],54:[2,58],55:[2,58],56:[2,58]},{5:[2,55],11:[2,55],12:[2,55],14:[2,55],16:[2,55],22:[2,55],30:[2,55],33:[2,55],36:[2,55],37:[2,55],38:[2,55],39:[2,55],40:[2,55],41:[2,55],42:[2,55],46:[2,55],47:[2,55],48:[2,55],51:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55],56:[2,55]},{5:[2,9],11:[2,9],12:[2,9],14:[2,9],16:[2,9],18:[1,50]},{5:[2,11],11:[2,11],12:[2,11],14:[2,11],16:[2,11],18:[2,11]},{5:[2,10],11:[2,10],12:[2,10],14:[2,10],16:[2,10],18:[1,51]},{5:[2,13],11:[2,13],12:[2,13],14:[2,13],16:[2,13],18:[2,13]},{5:[1,55],7:52,8:[1,54],11:[2,28],19:53,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,16],8:[2,16],11:[2,16],22:[2,16],27:[2,16],33:[2,16],36:[2,16],38:[2,16],41:[2,16],42:[2,16],46:[2,16],47:[2,16],48:[2,16],51:[2,16],52:[2,16],53:[2,16],55:[2,16],56:[2,16]},{11:[2,35],13:56,22:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{12:[1,59],28:57,30:[1,58]},{5:[2,33],11:[2,33],12:[2,33],14:[2,33],16:[2,33],22:[2,33],33:[2,33],34:60,35:14,36:[1,15],37:[2,33],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,36],11:[2,36],12:[2,36],14:[2,36],16:[2,36],22:[2,36],30:[1,42],33:[2,36],36:[2,36],37:[2,36],38:[2,36],39:[1,41],40:[1,43],41:[2,36],42:[2,36],44:44,46:[2,36],47:[2,36],48:[2,36],51:[2,36],52:[2,36],53:[2,36],54:[1,45],55:[2,36],56:[2,36]},{5:[2,40],11:[2,40],12:[2,40],14:[2,40],16:[2,40],22:[2,40],30:[2,40],33:[2,40],36:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],42:[2,40],46:[2,40],47:[2,40],48:[2,40],51:[2,40],52:[2,40],53:[2,40],54:[2,40],55:[2,40],56:[2,40]},{5:[2,41],11:[2,41],12:[2,41],14:[2,41],16:[2,41],22:[2,41],30:[2,41],33:[2,41],36:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],42:[2,41],46:[2,41],47:[2,41],48:[2,41],51:[2,41],52:[2,41],53:[2,41],54:[2,41],55:[2,41],56:[2,41]},{5:[2,42],11:[2,42],12:[2,42],14:[2,42],16:[2,42],22:[2,42],30:[2,42],33:[2,42],36:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],42:[2,42],46:[2,42],47:[2,42],48:[2,42],51:[2,42],52:[2,42],53:[2,42],54:[2,42],55:[2,42],56:[2,42]},{5:[2,46],11:[2,46],12:[2,46],14:[2,46],16:[2,46],22:[2,46],30:[2,46],33:[2,46],36:[2,46],37:[2,46],38:[2,46],39:[2,46],40:[2,46],41:[2,46],42:[2,46],46:[2,46],47:[2,46],48:[2,46],51:[2,46],52:[2,46],53:[2,46],54:[2,46],55:[2,46],56:[2,46]},{5:[2,56],11:[2,56],12:[2,56],14:[2,56],16:[2,56],22:[2,56],30:[2,56],33:[2,56],36:[2,56],37:[2,56],38:[2,56],39:[2,56],40:[2,56],41:[2,56],42:[2,56],46:[2,56],47:[2,56],48:[2,56],51:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56],56:[2,56]},{33:[1,39],37:[1,61]},{33:[1,39],37:[1,62]},{5:[2,43],11:[2,43],12:[2,43],14:[2,43],16:[2,43],22:[2,43],30:[1,42],33:[2,43],36:[2,43],37:[2,43],38:[2,43],39:[1,41],40:[1,43],41:[2,43],42:[2,43],44:44,46:[2,43],47:[2,43],48:[2,43],51:[2,43],52:[2,43],53:[2,43],54:[1,45],55:[2,43],56:[2,43]},{5:[2,44],11:[2,44],12:[2,44],14:[2,44],16:[2,44],22:[2,44],30:[1,42],33:[2,44],36:[2,44],37:[2,44],38:[2,44],39:[1,41],40:[1,43],41:[2,44],42:[2,44],44:44,46:[2,44],47:[2,44],48:[2,44],51:[2,44],52:[2,44],53:[2,44],54:[1,45],55:[2,44],56:[2,44]},{5:[2,12],11:[2,12],12:[2,12],14:[2,12],16:[2,12],18:[2,12]},{5:[2,14],11:[2,14],12:[2,14],14:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{5:[2,15],8:[2,15],11:[2,15],22:[2,15],27:[2,15],33:[2,15],36:[2,15],38:[2,15],41:[2,15],42:[2,15],46:[2,15],47:[2,15],48:[2,15],51:[2,15],52:[2,15],53:[2,15],55:[2,15],56:[2,15]},{1:[2,2]},{8:[1,63],9:[1,64]},{11:[1,67],21:65,22:[1,66]},{29:[1,68],31:[1,69]},{29:[1,70]},{29:[2,29],31:[2,29]},{5:[2,32],11:[2,32],12:[2,32],14:[2,32],16:[2,32],22:[2,32],33:[2,32],35:40,36:[1,15],37:[2,32],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,38],11:[2,38],12:[2,38],14:[2,38],16:[2,38],22:[2,38],30:[2,38],33:[2,38],36:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],41:[2,38],42:[2,38],46:[2,38],47:[2,38],48:[2,38],51:[2,38],52:[2,38],53:[2,38],54:[2,38],55:[2,38],56:[2,38]},{5:[2,39],11:[2,39],12:[2,39],14:[2,39],16:[2,39],22:[2,39],30:[2,39],33:[2,39],36:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],41:[2,39],42:[2,39],46:[2,39],47:[2,39],48:[2,39],51:[2,39],52:[2,39],53:[2,39],54:[2,39],55:[2,39],56:[2,39]},{1:[2,3]},{8:[1,71]},{5:[2,17],8:[2,17],11:[2,17],22:[2,17],27:[2,17],33:[2,17],36:[2,17],38:[2,17],41:[2,17],42:[2,17],46:[2,17],47:[2,17],48:[2,17],51:[2,17],52:[2,17],53:[2,17],55:[2,17],56:[2,17]},{22:[2,20],23:72,24:[2,20],25:73,26:[1,74]},{5:[2,19],8:[2,19],11:[2,19],22:[2,19],27:[2,19],33:[2,19],36:[2,19],38:[2,19],41:[2,19],42:[2,19],46:[2,19],47:[2,19],48:[2,19],51:[2,19],52:[2,19],53:[2,19],55:[2,19],56:[2,19]},{11:[2,26],22:[2,26],33:[2,26],36:[2,26],38:[2,26],41:[2,26],42:[2,26],46:[2,26],47:[2,26],48:[2,26],51:[2,26],52:[2,26],53:[2,26],55:[2,26],56:[2,26]},{12:[1,75]},{11:[2,27],22:[2,27],33:[2,27],36:[2,27],38:[2,27],41:[2,27],42:[2,27],46:[2,27],47:[2,27],48:[2,27],51:[2,27],52:[2,27],53:[2,27],55:[2,27],56:[2,27]},{1:[2,4]},{22:[1,77],24:[1,76]},{22:[2,21],24:[2,21],26:[1,78]},{22:[2,24],24:[2,24],26:[2,24]},{29:[2,30],31:[2,30]},{5:[2,18],8:[2,18],11:[2,18],22:[2,18],27:[2,18],33:[2,18],36:[2,18],38:[2,18],41:[2,18],42:[2,18],46:[2,18],47:[2,18],48:[2,18],51:[2,18],52:[2,18],53:[2,18],55:[2,18],56:[2,18]},{22:[2,20],23:79,24:[2,20],25:73,26:[1,74]},{22:[2,25],24:[2,25],26:[2,25]},{22:[1,77],24:[1,80]},{22:[2,23],24:[2,23],25:81,26:[1,74]},{22:[2,22],24:[2,22],26:[1,78]}], -defaultActions: {9:[2,5],10:[2,6],52:[2,1],54:[2,2],63:[2,3],71:[2,4]}, -parseError: function parseError(str, hash) { - if (hash.recoverable) { - this.trace(str); - } else { - throw new Error(str); - } -}, -parse: function parse(input) { - var self = this, - stack = [0], - vstack = [null], // semantic value stack - lstack = [], // location stack - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - recovering = 0, - TERROR = 2, - EOF = 1; - - var args = lstack.slice.call(arguments, 1); - - //this.reductionCount = this.shiftCount = 0; - - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - this.yy.parser = this; - if (typeof this.lexer.yylloc === 'undefined') { - this.lexer.yylloc = {}; - } - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - - var ranges = this.lexer.options && this.lexer.options.ranges; - - if (typeof this.yy.parseError === 'function') { - this.parseError = this.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ - } - - function popStack (n) { - stack.length = stack.length - 2 * n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - - function lex() { - var token; - token = self.lexer.lex() || EOF; // $end = 1 - // if token isn't its numeric value, convert - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token; - } - - var symbol; - var preErrorSymbol = null; - var state, action, a, r; - var yyval = {}; - var p, len, newState; - var expected = []; - var retval = false; - - if (this.pre_parse) { - this.pre_parse(this.yy); - } - if (this.yy.pre_parse) { - this.yy.pre_parse(this.yy); - } - - try { - for (;;) { - // retreive state number from top of stack - state = stack[stack.length - 1]; - - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol === 'undefined') { - symbol = lex(); - } - // read action for current state and first input - action = table[state] && table[state][symbol]; - } - - // handle parse error - if (typeof action === 'undefined' || !action.length || !action[0]) { - var error_rule_depth; - var errStr = ''; - - // Return the rule stack depth where the nearest error rule can be found. - // Return FALSE when no error recovery rule was found. - function locateNearestErrorRecoveryRule(state) { - var stack_probe = stack.length - 1; - var depth = 0; - - // try to recover from error - for(;;) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - return depth; - } - if (state === 0 || stack_probe < 2) { - return false; // No suitable error recovery rule available. - } - stack_probe -= 2; // popStack(1): [symbol, action] - state = stack[stack_probe]; - ++depth; - } - } - - if (!recovering) { - // first see if there's any chance at hitting an error recovery rule: - error_rule_depth = locateNearestErrorRecoveryRule(state); - - // Report error - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push("'" + this.terminals_[p] + "'"); - } - } - if (this.lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + - (symbol == EOF ? "end of input" : - ("'" + (this.terminals_[symbol] || symbol) + "'")); - } - a = this.parseError(errStr, p = { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: (error_rule_depth !== false) - }); - if (!p.recoverable) { - retval = a; - break; - } - } else if (preErrorSymbol !== EOF) { - error_rule_depth = locateNearestErrorRecoveryRule(state); - } - - // just recovered from another error - if (recovering == 3) { - if (symbol === EOF || preErrorSymbol === EOF) { - retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; - } - - // discard current lookahead and grab another - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - symbol = lex(); - } - - // try to recover from error - if (error_rule_depth === false) { - retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; - } - popStack(error_rule_depth); - - preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; - } - - switch (action[0]) { - case 1: // shift - //this.shiftCount++; - - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); // push state - symbol = null; - if (!preErrorSymbol) { // normal execution / no error - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) { - recovering--; - } - } else { - // error just occurred, resume old lookahead f/ before error - symbol = preErrorSymbol; - preErrorSymbol = null; - } - continue; - - case 2: - // reduce - //this.reductionCount++; - - len = this.productions_[action[1]][1]; - - // perform semantic action - yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 - // default location, uses first token for firsts, last for lasts - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack].concat(args)); - - if (typeof r !== 'undefined') { - retval = r; - break; - } - - // pop off stack - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - - stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) - vstack.push(yyval.$); - lstack.push(yyval._$); - // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - continue; - - case 3: - // accept - retval = true; - break; - } - - // break out of loop: we accept or fail with error - break; - } - } finally { - var rv; - - if (this.yy.post_parse) { - rv = this.yy.post_parse(this.yy, retval); - if (typeof rv !== 'undefined') retval = rv; - } - if (this.post_parse) { - rv = this.post_parse(this.yy, retval); - if (typeof rv !== 'undefined') retval = rv; - } - } - - return retval; -}}; - - -function encodeRE (s) { - return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); -} - -function prepareString (s) { - // unescape slashes - s = s.replace(/\\\\/g, "\\"); - s = encodeRE(s); - return s; -}; - -/* generated by jison-lex 0.2.1 */ -var lexer = (function(){ -var lexer = { - -EOF:1, - -ERROR:2, - -parseError:function parseError(str, hash) { - if (this.yy.parser) { - return this.yy.parser.parseError(str, hash) || this.ERROR; - } else { - throw new Error(str); - } - }, - -// resets the lexer, sets new input -setInput:function (input) { - this._input = input; - this._more = this._backtrack = this._signaled_error_token = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - if (this.options.ranges) { - this.yylloc.range = [0, 0]; - } - this.offset = 0; - return this; - }, - -// consumes and returns one char from the input -input:function () { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) { - this.yylloc.range[1]++; - } - - this._input = this._input.slice(1); - return ch; - }, - -// unshifts one char (or a string) into the input -unput:function (ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - var r = this.yylloc.range; - - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - this.yyleng = this.yytext.length; - return this; - }, - -// When called from action, caches matched text and appends it on next action -more:function () { - this._more = true; - return this; - }, - -// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. -reject:function () { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - // when the parseError() call returns, we MUST ensure that the error is registered. - // We accomplish this by signaling an 'error' token to be produced for the current - // .lex() run. - this._signaled_error_token = (this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: this.match, - token: null, - line: this.yylineno - }) || this.ERROR); - } - return this; - }, - -// retain first n characters of the match -less:function (n) { - this.unput(this.match.slice(n)); - }, - -// return (part of the) already matched input, i.e. for error messages -pastInput:function (maxSize) { - var past = this.matched.substr(0, this.matched.length - this.match.length); - if (maxSize < 0) - maxSize = past.length; - else if (!maxSize) - maxSize = 20; - return (past.length > maxSize ? '...' + past.substr(-maxSize) : past); - }, - -// return (part of the) upcoming input, i.e. for error messages -upcomingInput:function (maxSize) { - var next = this.match; - if (maxSize < 0) - maxSize = next.length + this._input.length; - else if (!maxSize) - maxSize = 20; - if (next.length < maxSize) { - next += this._input.substr(0, maxSize - next.length); - } - return (next.length > maxSize ? next.substr(0, maxSize) + '...' : next); - }, - -// return a string which displays the character position where the lexing error occurred, i.e. for error messages -showPosition:function () { - var pre = this.pastInput().replace(/\s/g, " "); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput().replace(/\s/g, " ") + "\n" + c + "^"; - }, - -// test the lexed token: return FALSE when not a match, otherwise return token -test_match:function (match, indexed_rule) { - var token, - lines, - backup; - - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } - - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; - } - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : - this.yylloc.last_column + match[0].length - }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); - if (this.done && this._input) { - this.done = false; - } - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - return false; // rule action called reject() implying the next rule should be tested instead. - } else if (this._signaled_error_token) { - // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! - token = this._signaled_error_token; - this._signaled_error_token = false; - return token; - } - return false; - }, - -// return next match in input -next:function () { - if (this.done) { - return this.EOF; - } - if (!this._input) { - this.done = true; - } - - var token, - match, - tempMatch, - index; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); - if (token !== false) { - return token; - } else if (this._backtrack) { - match = false; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - if (match) { - token = this.test_match(match, rules[index]); - if (token !== false) { - return token; - } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - if (this._input === "") { - return this.EOF; - } else { - token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: this.match + this._input, - token: null, - line: this.yylineno - }) || this.ERROR; - if (token === this.ERROR || token === this.EOF) { - // we cannot recover from a lexer error that parseError() did not 'recover' for us: we consider the input completely lexed: - this.done = true; - } - } - }, - -// return next match that has a token -lex:function lex() { - var r; - // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: - if (typeof this.options.pre_lex === 'function') { - r = this.options.pre_lex.call(this); - } - while (!r) { - r = this.next(); - }; - if (typeof this.options.post_lex === 'function') { - // (also account for a userdef function which does not return any value: keep the token as is) - r = this.options.post_lex.call(this, r) || r; - } - return r; - }, - -// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) -begin:function begin(condition) { - this.conditionStack.push(condition); - }, - -// pop the previously active lexer condition state off the condition stack -popState:function popState() { - var n = this.conditionStack.length - 1; - if (n > 0) { - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } - }, - -// produce the lexer rule set which is active for the currently active lexer condition state -_currentRules:function _currentRules() { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions["INITIAL"].rules; - } - }, - -// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available -topState:function topState(n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { - return this.conditionStack[n]; - } else { - return "INITIAL"; - } - }, - -// alias for begin(condition) -pushState:function pushState(condition) { - this.begin(condition); - }, - -// return the number of states currently on the stack -stateStackSize:function stateStackSize() { - return this.conditionStack.length; - }, -options: {}, -performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START -/**/) { - -var YYSTATE=YY_START; -switch($avoiding_name_collisions) { -case 0 : -/*! Conditions:: action */ -/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - return 26; -break; -case 1 : -/*! Conditions:: action */ -/*! Rule:: \/\/.* */ - return 26; -break; -case 2 : -/*! Conditions:: action */ -/*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 26; // regexp with braces or quotes (and no spaces) -break; -case 3 : -/*! Conditions:: action */ -/*! Rule:: "(\\\\|\\"|[^"])*" */ - return 26; -break; -case 4 : -/*! Conditions:: action */ -/*! Rule:: '(\\\\|\\'|[^'])*' */ - return 26; -break; -case 5 : -/*! Conditions:: action */ -/*! Rule:: [/"'][^{}/"']+ */ - return 26; -break; -case 6 : -/*! Conditions:: action */ -/*! Rule:: [^{}/"']+ */ - return 26; -break; -case 7 : -/*! Conditions:: action */ -/*! Rule:: \{ */ - yy.depth++; return 22; -break; -case 8 : -/*! Conditions:: action */ -/*! Rule:: \} */ - if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 24; -break; -case 9 : -/*! Conditions:: conditions */ -/*! Rule:: {NAME} */ - return 12; -break; -case 10 : -/*! Conditions:: conditions */ -/*! Rule:: > */ - this.popState(); return 29; -break; -case 11 : -/*! Conditions:: conditions */ -/*! Rule:: , */ - return 31; -break; -case 12 : -/*! Conditions:: conditions */ -/*! Rule:: \* */ - return 30; -break; -case 13 : -/*! Conditions:: rules */ -/*! Rule:: {BR}+ */ - /* empty */ -break; -case 14 : -/*! Conditions:: rules */ -/*! Rule:: \s+{BR}+ */ - /* empty */ -break; -case 15 : -/*! Conditions:: rules */ -/*! Rule:: \s+ */ - this.begin('indented'); -break; -case 16 : -/*! Conditions:: rules */ -/*! Rule:: %% */ - this.begin('code'); return 5; -break; -case 17 : -/*! Conditions:: rules */ -/*! Rule:: [a-zA-Z0-9_]+ */ - return 56; -break; -case 18 : -/*! Conditions:: options */ -/*! Rule:: {NAME} */ - yy.options[yy_.yytext] = true; -break; -case 19 : -/*! Conditions:: options */ -/*! Rule:: {BR}+ */ - this.begin('INITIAL'); -break; -case 20 : -/*! Conditions:: options */ -/*! Rule:: \s+{BR}+ */ - this.begin('INITIAL'); -break; -case 21 : -/*! Conditions:: options */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 22 : -/*! Conditions:: start_condition */ -/*! Rule:: {NAME} */ - return 18; -break; -case 23 : -/*! Conditions:: start_condition */ -/*! Rule:: {BR}+ */ - this.begin('INITIAL'); -break; -case 24 : -/*! Conditions:: start_condition */ -/*! Rule:: \s+{BR}+ */ - this.begin('INITIAL'); -break; -case 25 : -/*! Conditions:: start_condition */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 26 : -/*! Conditions:: trail */ -/*! Rule:: \s*{BR}+ */ - this.begin('rules'); -break; -case 27 : -/*! Conditions:: indented */ -/*! Rule:: \{ */ - yy.depth = 0; this.begin('action'); return 22; -break; -case 28 : -/*! Conditions:: indented */ -/*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; -break; -case 29 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; -break; -case 30 : -/*! Conditions:: indented */ -/*! Rule:: .+ */ - this.begin('rules'); return 11; -break; -case 31 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - /* empty */ -break; -case 32 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/\/.* */ - /* empty */ -break; -case 33 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: {BR}+ */ - /* ignore */ -break; -case 34 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \s+ */ - /* ignore */ -break; -case 35 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: {NAME} */ - return 12; -break; -case 36 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 55; -break; -case 37 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; -break; -case 38 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \| */ - return 33; -break; -case 39 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ - return 52; -break; -case 40 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \(\?: */ - return 38; -break; -case 41 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \(\?= */ - return 38; -break; -case 42 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \(\?! */ - return 38; -break; -case 43 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \( */ - return 36; -break; -case 44 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \) */ - return 37; -break; -case 45 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \+ */ - return 39; -break; -case 46 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \* */ - return 30; -break; -case 47 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \? */ - return 40; -break; -case 48 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \^ */ - return 47; -break; -case 49 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: , */ - return 31; -break; -case 50 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: <> */ - return 48; -break; -case 51 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: < */ - this.begin('conditions'); return 27; -break; -case 52 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/! */ - return 42; -break; -case 53 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/ */ - return 41; -break; -case 54 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - return 53; -break; -case 55 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; -break; -case 56 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \$ */ - return 48; -break; -case 57 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \. */ - return 46; -break; -case 58 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %options */ - yy.options = {}; this.begin('options'); -break; -case 59 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %s */ - this.begin('start_condition'); return 14; -break; -case 60 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %x */ - this.begin('start_condition'); return 16; -break; -case 61 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %% */ - this.begin('rules'); return 5; -break; -case 62 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \{\d+(,\s?\d+|,)?\} */ - return 54; -break; -case 63 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \{{NAME}\} */ - return 51; -break; -case 64 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \{ */ - return 22; -break; -case 65 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \} */ - return 24; -break; -case 66 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: . */ - throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ -break; -case 67 : -/*! Conditions:: * */ -/*! Rule:: $ */ - return 8; -break; -case 68 : -/*! Conditions:: code */ -/*! Rule:: (.|{BR})+ */ - return 9; -break; -} -}, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options)/,/^(?:%s)/,/^(?:%x)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], -conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} -}; -return lexer; -})(); -parser.lexer = lexer; -function Parser () { - this.yy = {}; -} -Parser.prototype = parser;parser.Parser = Parser; -return new Parser; -})(); - - -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lexParser; -exports.Parser = lexParser.Parser; -exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; -exports.main = function commonjsMain(args) { - if (!args[1]) { - console.log('Usage: '+args[0]+' FILE'); - process.exit(1); - } - var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); - return exports.parser.parse(source); -}; -if (typeof module !== 'undefined' && require.main === module) { - exports.main(process.argv.slice(1)); -} -} \ No newline at end of file From 4fe4211348fb740767d651bf0f42a482533b6ed3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 13:47:29 +0100 Subject: [PATCH 033/417] added generated files again as anyone who wishes to run jison 'out of the box' needs those. --- lex-parser.js | 1376 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1376 insertions(+) create mode 100644 lex-parser.js diff --git a/lex-parser.js b/lex-parser.js new file mode 100644 index 0000000..40d1b6c --- /dev/null +++ b/lex-parser.js @@ -0,0 +1,1376 @@ +/* parser generated by jison 0.4.13 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} + } + + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), + (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), + stateStackSize: function(), + + options: { ... }, + + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, + } + } + + + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + } + + + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) + recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) + } + + You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + These options are available: + + ### options which are global for all parser instances + + Parser.pre_parse: function(yy) + optional: you can specify a pre_parse() function in the chunk following the grammar, + i.e. after the last `%%`. + Parser.post_parse: function(yy, retval) { return retval; } + optional: you can specify a post_parse() function in the chunk following the grammar, + i.e. after the last `%%`. When it does not return any value, the parser will return + the original `retval`. + + ### options which can be set up per parser instance + + yy: { + pre_parse: function(yy) + optional: is invoked before the parse cycle starts (and before the first invocation + of `lex()`) but immediately after the invocation of parser.pre_parse()). + post_parse: function(yy, retval) { return retval; } + optional: is invoked when the parse terminates due to success ('accept') or failure + (even when exceptions are thrown). `retval` contains the return value to be produced + by `Parser.parse()`; this function can override the return value by returning another. + When it does not return any value, the parser will return the original `retval`. + This function is invoked immediately before `Parser.post_parse()`. + parseError: function(str, hash) + optional: overrides the default `parseError` function. + } + + parser.lexer.options: { + ranges: boolean optional: true ==> token location info will include a .range[] member. + flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested + exhaustively to find the longest match. + backtrack_lexer: boolean + optional: true ==> lexer regexes are tested in order and for each matching + regex the action code is invoked; the lexer terminates + the scan when a token is returned by the action code. + } +*/ +var lex = (function(){ +var parser = {trace: function trace() { }, +yy: {}, +symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, +terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"START_COND",22:"{",24:"}",26:"ACTION_BODY",27:"<",29:">",30:"*",31:",",33:"|",36:"(",37:")",38:"SPECIAL_GROUP",39:"+",40:"?",41:"/",42:"/!",46:".",47:"^",48:"$",51:"NAME_BRACE",52:"ANY_GROUP_REGEX",53:"ESCAPE_CHAR",54:"RANGE_REGEX",55:"STRING_LIT",56:"CHARACTER_LIT"}, +productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[19,3],[21,3],[21,1],[23,0],[23,1],[23,5],[23,4],[25,1],[25,2],[20,3],[20,3],[20,0],[28,1],[28,3],[13,1],[32,3],[32,2],[32,1],[32,0],[34,2],[34,1],[35,3],[35,3],[35,2],[35,2],[35,2],[35,2],[35,2],[35,1],[35,2],[35,1],[35,1],[35,1],[35,1],[35,1],[35,1],[43,1],[45,1],[50,1],[44,1],[49,1],[49,1]], +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */ +/**/) { +/* this == yyval */ + +var $0 = $$.length - 1; +switch (yystate) { +case 1 : +/*! Production:: lex : definitions %% rules epilogue */ + + this.$ = { rules: $$[$0-1] }; + if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; + if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; + if ($$[$0]) this.$.moduleInclude = $$[$0]; + if (yy.options) this.$.options = yy.options; + if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; + delete yy.options; + delete yy.actionInclude; + return this.$; + +break; +case 2 : +/*! Production:: epilogue : EOF */ + this.$ = null; +break; +case 3 : +/*! Production:: epilogue : %% EOF */ + this.$ = null; +break; +case 4 : +/*! Production:: epilogue : %% CODE EOF */ + this.$ = $$[$0-1]; +break; +case 5 : +/*! Production:: definitions : definition definitions */ + + this.$ = $$[$0]; + if ('length' in $$[$0-1]) { + this.$[0] = this.$[0] || {}; + this.$[0][$$[$0-1][0]] = $$[$0-1][1]; + } else { + this.$[1] = this.$[1] || {}; + for (var name in $$[$0-1]) { + this.$[1][name] = $$[$0-1][name]; + } + } + +break; +case 6 : +/*! Production:: definitions : ACTION definitions */ + yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +break; +case 7 : +/*! Production:: definitions : */ + yy.actionInclude = ''; this.$ = [null,null]; +break; +case 8 : +/*! Production:: definition : NAME regex */ + this.$ = [$$[$0-1], $$[$0]]; +break; +case 9 : +/*! Production:: definition : START_INC names_inclusive */ + this.$ = $$[$0]; +break; +case 10 : +/*! Production:: definition : START_EXC names_exclusive */ + this.$ = $$[$0]; +break; +case 11 : +/*! Production:: names_inclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 0; +break; +case 12 : +/*! Production:: names_inclusive : names_inclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +break; +case 13 : +/*! Production:: names_exclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 1; +break; +case 14 : +/*! Production:: names_exclusive : names_exclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +break; +case 15 : +/*! Production:: rules : rules rule */ + this.$ = $$[$0-1]; this.$.push($$[$0]); +break; +case 16 : +/*! Production:: rules : rule */ + this.$ = [$$[$0]]; +break; +case 17 : +/*! Production:: rule : start_conditions regex action */ + this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; +break; +case 18 : +/*! Production:: action : { action_body } */ + this.$ = $$[$0-1]; +break; +case 19 : +/*! Production:: action : ACTION */ + this.$ = $$[$0]; +break; +case 20 : +/*! Production:: action_body : */ + this.$ = ''; +break; +case 21 : +/*! Production:: action_body : action_comments_body */ + this.$ = $$[$0]; +break; +case 22 : +/*! Production:: action_body : action_body { action_body } action_comments_body */ + this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 23 : +/*! Production:: action_body : action_body { action_body } */ + this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 24 : +/*! Production:: action_comments_body : ACTION_BODY */ + this.$ = yytext; +break; +case 25 : +/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ + this.$ = $$[$0-1] + $$[$0]; +break; +case 26 : +/*! Production:: start_conditions : < name_list > */ + this.$ = $$[$0-1]; +break; +case 27 : +/*! Production:: start_conditions : < * > */ + this.$ = ['*']; +break; +case 29 : +/*! Production:: name_list : NAME */ + this.$ = [$$[$0]]; +break; +case 30 : +/*! Production:: name_list : name_list , NAME */ + this.$ = $$[$0-2]; this.$.push($$[$0]); +break; +case 31 : +/*! Production:: regex : regex_list */ + + this.$ = $$[$0]; + +break; +case 32 : +/*! Production:: regex_list : regex_list | regex_concat */ + this.$ = $$[$0-2] + '|' + $$[$0]; +break; +case 33 : +/*! Production:: regex_list : regex_list | */ + this.$ = $$[$0-1] + '|'; +break; +case 35 : +/*! Production:: regex_list : */ + this.$ = ''; +break; +case 36 : +/*! Production:: regex_concat : regex_concat regex_base */ + this.$ = $$[$0-1] + $$[$0]; +break; +case 38 : +/*! Production:: regex_base : ( regex_list ) */ + this.$ = '(' + $$[$0-1] + ')'; +break; +case 39 : +/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ + this.$ = $$[$0-2] + $$[$0-1] + ')'; +break; +case 40 : +/*! Production:: regex_base : regex_base + */ + this.$ = $$[$0-1] + '+'; +break; +case 41 : +/*! Production:: regex_base : regex_base * */ + this.$ = $$[$0-1] + '*'; +break; +case 42 : +/*! Production:: regex_base : regex_base ? */ + this.$ = $$[$0-1] + '?'; +break; +case 43 : +/*! Production:: regex_base : / regex_base */ + this.$ = '(?=' + $$[$0] + ')'; +break; +case 44 : +/*! Production:: regex_base : /! regex_base */ + this.$ = '(?!' + $$[$0] + ')'; +break; +case 46 : +/*! Production:: regex_base : regex_base range_regex */ + this.$ = $$[$0-1] + $$[$0]; +break; +case 48 : +/*! Production:: regex_base : . */ + this.$ = '.'; +break; +case 49 : +/*! Production:: regex_base : ^ */ + this.$ = '^'; +break; +case 50 : +/*! Production:: regex_base : $ */ + this.$ = '$'; +break; +case 54 : +/*! Production:: any_group_regex : ANY_GROUP_REGEX */ + this.$ = yytext; +break; +case 55 : +/*! Production:: escape_char : ESCAPE_CHAR */ + this.$ = yytext; +break; +case 56 : +/*! Production:: range_regex : RANGE_REGEX */ + this.$ = yytext; +break; +case 57 : +/*! Production:: string : STRING_LIT */ + this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +break; +} +}, +table: [{3:1,4:2,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{1:[3]},{5:[1,8]},{4:9,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{4:10,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{5:[2,35],11:[2,35],12:[2,35],13:11,14:[2,35],16:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:35,11:[2,28],19:36,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,5]},{5:[2,6]},{5:[2,8],11:[2,8],12:[2,8],14:[2,8],16:[2,8]},{5:[2,31],11:[2,31],12:[2,31],14:[2,31],16:[2,31],22:[2,31],33:[1,39]},{5:[2,34],11:[2,34],12:[2,34],14:[2,34],16:[2,34],22:[2,34],33:[2,34],35:40,36:[1,15],37:[2,34],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,37],11:[2,37],12:[2,37],14:[2,37],16:[2,37],22:[2,37],30:[1,42],33:[2,37],36:[2,37],37:[2,37],38:[2,37],39:[1,41],40:[1,43],41:[2,37],42:[2,37],44:44,46:[2,37],47:[2,37],48:[2,37],51:[2,37],52:[2,37],53:[2,37],54:[1,45],55:[2,37],56:[2,37]},{32:46,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{32:47,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:48,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:49,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,45],11:[2,45],12:[2,45],14:[2,45],16:[2,45],22:[2,45],30:[2,45],33:[2,45],36:[2,45],37:[2,45],38:[2,45],39:[2,45],40:[2,45],41:[2,45],42:[2,45],46:[2,45],47:[2,45],48:[2,45],51:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45],56:[2,45]},{5:[2,47],11:[2,47],12:[2,47],14:[2,47],16:[2,47],22:[2,47],30:[2,47],33:[2,47],36:[2,47],37:[2,47],38:[2,47],39:[2,47],40:[2,47],41:[2,47],42:[2,47],46:[2,47],47:[2,47],48:[2,47],51:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47],56:[2,47]},{5:[2,48],11:[2,48],12:[2,48],14:[2,48],16:[2,48],22:[2,48],30:[2,48],33:[2,48],36:[2,48],37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],42:[2,48],46:[2,48],47:[2,48],48:[2,48],51:[2,48],52:[2,48],53:[2,48],54:[2,48],55:[2,48],56:[2,48]},{5:[2,49],11:[2,49],12:[2,49],14:[2,49],16:[2,49],22:[2,49],30:[2,49],33:[2,49],36:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],42:[2,49],46:[2,49],47:[2,49],48:[2,49],51:[2,49],52:[2,49],53:[2,49],54:[2,49],55:[2,49],56:[2,49]},{5:[2,50],11:[2,50],12:[2,50],14:[2,50],16:[2,50],22:[2,50],30:[2,50],33:[2,50],36:[2,50],37:[2,50],38:[2,50],39:[2,50],40:[2,50],41:[2,50],42:[2,50],46:[2,50],47:[2,50],48:[2,50],51:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50],56:[2,50]},{5:[2,51],11:[2,51],12:[2,51],14:[2,51],16:[2,51],22:[2,51],30:[2,51],33:[2,51],36:[2,51],37:[2,51],38:[2,51],39:[2,51],40:[2,51],41:[2,51],42:[2,51],46:[2,51],47:[2,51],48:[2,51],51:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51],56:[2,51]},{5:[2,52],11:[2,52],12:[2,52],14:[2,52],16:[2,52],22:[2,52],30:[2,52],33:[2,52],36:[2,52],37:[2,52],38:[2,52],39:[2,52],40:[2,52],41:[2,52],42:[2,52],46:[2,52],47:[2,52],48:[2,52],51:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52],56:[2,52]},{5:[2,53],11:[2,53],12:[2,53],14:[2,53],16:[2,53],22:[2,53],30:[2,53],33:[2,53],36:[2,53],37:[2,53],38:[2,53],39:[2,53],40:[2,53],41:[2,53],42:[2,53],46:[2,53],47:[2,53],48:[2,53],51:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53],56:[2,53]},{5:[2,54],11:[2,54],12:[2,54],14:[2,54],16:[2,54],22:[2,54],30:[2,54],33:[2,54],36:[2,54],37:[2,54],38:[2,54],39:[2,54],40:[2,54],41:[2,54],42:[2,54],46:[2,54],47:[2,54],48:[2,54],51:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54],56:[2,54]},{5:[2,57],11:[2,57],12:[2,57],14:[2,57],16:[2,57],22:[2,57],30:[2,57],33:[2,57],36:[2,57],37:[2,57],38:[2,57],39:[2,57],40:[2,57],41:[2,57],42:[2,57],46:[2,57],47:[2,57],48:[2,57],51:[2,57],52:[2,57],53:[2,57],54:[2,57],55:[2,57],56:[2,57]},{5:[2,58],11:[2,58],12:[2,58],14:[2,58],16:[2,58],22:[2,58],30:[2,58],33:[2,58],36:[2,58],37:[2,58],38:[2,58],39:[2,58],40:[2,58],41:[2,58],42:[2,58],46:[2,58],47:[2,58],48:[2,58],51:[2,58],52:[2,58],53:[2,58],54:[2,58],55:[2,58],56:[2,58]},{5:[2,55],11:[2,55],12:[2,55],14:[2,55],16:[2,55],22:[2,55],30:[2,55],33:[2,55],36:[2,55],37:[2,55],38:[2,55],39:[2,55],40:[2,55],41:[2,55],42:[2,55],46:[2,55],47:[2,55],48:[2,55],51:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55],56:[2,55]},{5:[2,9],11:[2,9],12:[2,9],14:[2,9],16:[2,9],18:[1,50]},{5:[2,11],11:[2,11],12:[2,11],14:[2,11],16:[2,11],18:[2,11]},{5:[2,10],11:[2,10],12:[2,10],14:[2,10],16:[2,10],18:[1,51]},{5:[2,13],11:[2,13],12:[2,13],14:[2,13],16:[2,13],18:[2,13]},{5:[1,55],7:52,8:[1,54],11:[2,28],19:53,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,16],8:[2,16],11:[2,16],22:[2,16],27:[2,16],33:[2,16],36:[2,16],38:[2,16],41:[2,16],42:[2,16],46:[2,16],47:[2,16],48:[2,16],51:[2,16],52:[2,16],53:[2,16],55:[2,16],56:[2,16]},{11:[2,35],13:56,22:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{12:[1,59],28:57,30:[1,58]},{5:[2,33],11:[2,33],12:[2,33],14:[2,33],16:[2,33],22:[2,33],33:[2,33],34:60,35:14,36:[1,15],37:[2,33],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,36],11:[2,36],12:[2,36],14:[2,36],16:[2,36],22:[2,36],30:[1,42],33:[2,36],36:[2,36],37:[2,36],38:[2,36],39:[1,41],40:[1,43],41:[2,36],42:[2,36],44:44,46:[2,36],47:[2,36],48:[2,36],51:[2,36],52:[2,36],53:[2,36],54:[1,45],55:[2,36],56:[2,36]},{5:[2,40],11:[2,40],12:[2,40],14:[2,40],16:[2,40],22:[2,40],30:[2,40],33:[2,40],36:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],42:[2,40],46:[2,40],47:[2,40],48:[2,40],51:[2,40],52:[2,40],53:[2,40],54:[2,40],55:[2,40],56:[2,40]},{5:[2,41],11:[2,41],12:[2,41],14:[2,41],16:[2,41],22:[2,41],30:[2,41],33:[2,41],36:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],42:[2,41],46:[2,41],47:[2,41],48:[2,41],51:[2,41],52:[2,41],53:[2,41],54:[2,41],55:[2,41],56:[2,41]},{5:[2,42],11:[2,42],12:[2,42],14:[2,42],16:[2,42],22:[2,42],30:[2,42],33:[2,42],36:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],42:[2,42],46:[2,42],47:[2,42],48:[2,42],51:[2,42],52:[2,42],53:[2,42],54:[2,42],55:[2,42],56:[2,42]},{5:[2,46],11:[2,46],12:[2,46],14:[2,46],16:[2,46],22:[2,46],30:[2,46],33:[2,46],36:[2,46],37:[2,46],38:[2,46],39:[2,46],40:[2,46],41:[2,46],42:[2,46],46:[2,46],47:[2,46],48:[2,46],51:[2,46],52:[2,46],53:[2,46],54:[2,46],55:[2,46],56:[2,46]},{5:[2,56],11:[2,56],12:[2,56],14:[2,56],16:[2,56],22:[2,56],30:[2,56],33:[2,56],36:[2,56],37:[2,56],38:[2,56],39:[2,56],40:[2,56],41:[2,56],42:[2,56],46:[2,56],47:[2,56],48:[2,56],51:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56],56:[2,56]},{33:[1,39],37:[1,61]},{33:[1,39],37:[1,62]},{5:[2,43],11:[2,43],12:[2,43],14:[2,43],16:[2,43],22:[2,43],30:[1,42],33:[2,43],36:[2,43],37:[2,43],38:[2,43],39:[1,41],40:[1,43],41:[2,43],42:[2,43],44:44,46:[2,43],47:[2,43],48:[2,43],51:[2,43],52:[2,43],53:[2,43],54:[1,45],55:[2,43],56:[2,43]},{5:[2,44],11:[2,44],12:[2,44],14:[2,44],16:[2,44],22:[2,44],30:[1,42],33:[2,44],36:[2,44],37:[2,44],38:[2,44],39:[1,41],40:[1,43],41:[2,44],42:[2,44],44:44,46:[2,44],47:[2,44],48:[2,44],51:[2,44],52:[2,44],53:[2,44],54:[1,45],55:[2,44],56:[2,44]},{5:[2,12],11:[2,12],12:[2,12],14:[2,12],16:[2,12],18:[2,12]},{5:[2,14],11:[2,14],12:[2,14],14:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{5:[2,15],8:[2,15],11:[2,15],22:[2,15],27:[2,15],33:[2,15],36:[2,15],38:[2,15],41:[2,15],42:[2,15],46:[2,15],47:[2,15],48:[2,15],51:[2,15],52:[2,15],53:[2,15],55:[2,15],56:[2,15]},{1:[2,2]},{8:[1,63],9:[1,64]},{11:[1,67],21:65,22:[1,66]},{29:[1,68],31:[1,69]},{29:[1,70]},{29:[2,29],31:[2,29]},{5:[2,32],11:[2,32],12:[2,32],14:[2,32],16:[2,32],22:[2,32],33:[2,32],35:40,36:[1,15],37:[2,32],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,38],11:[2,38],12:[2,38],14:[2,38],16:[2,38],22:[2,38],30:[2,38],33:[2,38],36:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],41:[2,38],42:[2,38],46:[2,38],47:[2,38],48:[2,38],51:[2,38],52:[2,38],53:[2,38],54:[2,38],55:[2,38],56:[2,38]},{5:[2,39],11:[2,39],12:[2,39],14:[2,39],16:[2,39],22:[2,39],30:[2,39],33:[2,39],36:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],41:[2,39],42:[2,39],46:[2,39],47:[2,39],48:[2,39],51:[2,39],52:[2,39],53:[2,39],54:[2,39],55:[2,39],56:[2,39]},{1:[2,3]},{8:[1,71]},{5:[2,17],8:[2,17],11:[2,17],22:[2,17],27:[2,17],33:[2,17],36:[2,17],38:[2,17],41:[2,17],42:[2,17],46:[2,17],47:[2,17],48:[2,17],51:[2,17],52:[2,17],53:[2,17],55:[2,17],56:[2,17]},{22:[2,20],23:72,24:[2,20],25:73,26:[1,74]},{5:[2,19],8:[2,19],11:[2,19],22:[2,19],27:[2,19],33:[2,19],36:[2,19],38:[2,19],41:[2,19],42:[2,19],46:[2,19],47:[2,19],48:[2,19],51:[2,19],52:[2,19],53:[2,19],55:[2,19],56:[2,19]},{11:[2,26],22:[2,26],33:[2,26],36:[2,26],38:[2,26],41:[2,26],42:[2,26],46:[2,26],47:[2,26],48:[2,26],51:[2,26],52:[2,26],53:[2,26],55:[2,26],56:[2,26]},{12:[1,75]},{11:[2,27],22:[2,27],33:[2,27],36:[2,27],38:[2,27],41:[2,27],42:[2,27],46:[2,27],47:[2,27],48:[2,27],51:[2,27],52:[2,27],53:[2,27],55:[2,27],56:[2,27]},{1:[2,4]},{22:[1,77],24:[1,76]},{22:[2,21],24:[2,21],26:[1,78]},{22:[2,24],24:[2,24],26:[2,24]},{29:[2,30],31:[2,30]},{5:[2,18],8:[2,18],11:[2,18],22:[2,18],27:[2,18],33:[2,18],36:[2,18],38:[2,18],41:[2,18],42:[2,18],46:[2,18],47:[2,18],48:[2,18],51:[2,18],52:[2,18],53:[2,18],55:[2,18],56:[2,18]},{22:[2,20],23:79,24:[2,20],25:73,26:[1,74]},{22:[2,25],24:[2,25],26:[2,25]},{22:[1,77],24:[1,80]},{22:[2,23],24:[2,23],25:81,26:[1,74]},{22:[2,22],24:[2,22],26:[1,78]}], +defaultActions: {9:[2,5],10:[2,6],52:[2,1],54:[2,2],63:[2,3],71:[2,4]}, +parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + throw new Error(str); + } +}, +parse: function parse(input) { + var self = this, + stack = [0], + vstack = [null], // semantic value stack + lstack = [], // location stack + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + + var args = lstack.slice.call(arguments, 1); + + //this.reductionCount = this.shiftCount = 0; + + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc === 'undefined') { + this.lexer.yylloc = {}; + } + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + + var ranges = this.lexer.options && this.lexer.options.ranges; + + if (typeof this.yy.parseError === 'function') { + this.parseError = this.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ + } + + function popStack (n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + + function lex() { + var token; + token = self.lexer.lex() || EOF; // $end = 1 + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + } + + var symbol; + var preErrorSymbol = null; + var state, action, a, r; + var yyval = {}; + var p, len, newState; + var expected = []; + var retval = false; + + if (this.pre_parse) { + this.pre_parse(this.yy); + } + if (this.yy.pre_parse) { + this.yy.pre_parse(this.yy); + } + + try { + for (;;) { + // retreive state number from top of stack + state = stack[stack.length - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol === 'undefined') { + symbol = lex(); + } + // read action for current state and first input + action = table[state] && table[state][symbol]; + } + + // handle parse error + if (typeof action === 'undefined' || !action.length || !action[0]) { + var error_rule_depth; + var errStr = ''; + + // Return the rule stack depth where the nearest error rule can be found. + // Return FALSE when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = stack.length - 1; + var depth = 0; + + // try to recover from error + for(;;) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + return depth; + } + if (state === 0 || stack_probe < 2) { + return false; // No suitable error recovery rule available. + } + stack_probe -= 2; // popStack(1): [symbol, action] + state = stack[stack_probe]; + ++depth; + } + } + + if (!recovering) { + // first see if there's any chance at hitting an error recovery rule: + error_rule_depth = locateNearestErrorRecoveryRule(state); + + // Report error + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (this.lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + + (symbol == EOF ? "end of input" : + ("'" + (this.terminals_[symbol] || symbol) + "'")); + } + a = this.parseError(errStr, p = { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: (error_rule_depth !== false) + }); + if (!p.recoverable) { + retval = a; + break; + } + } else if (preErrorSymbol !== EOF) { + error_rule_depth = locateNearestErrorRecoveryRule(state); + } + + // just recovered from another error + if (recovering == 3) { + if (symbol === EOF || preErrorSymbol === EOF) { + retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + + // discard current lookahead and grab another + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + symbol = lex(); + } + + // try to recover from error + if (error_rule_depth === false) { + retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + popStack(error_rule_depth); + + preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length-1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } + + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array && action.length > 1) { + retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + + switch (action[0]) { + case 1: // shift + //this.shiftCount++; + + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); // push state + symbol = null; + if (!preErrorSymbol) { // normal execution / no error + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + // error just occurred, resume old lookahead f/ before error + symbol = preErrorSymbol; + preErrorSymbol = null; + } + continue; + + case 2: + // reduce + //this.reductionCount++; + + len = this.productions_[action[1]][1]; + + // perform semantic action + yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 + // default location, uses first token for firsts, last for lasts + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack].concat(args)); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + + stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + vstack.push(yyval.$); + lstack.push(yyval._$); + // goto new state = table[STATE][NONTERMINAL] + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + continue; + + case 3: + // accept + retval = true; + break; + } + + // break out of loop: we accept or fail with error + break; + } + } finally { + var rv; + + if (this.yy.post_parse) { + rv = this.yy.post_parse(this.yy, retval); + if (typeof rv !== 'undefined') retval = rv; + } + if (this.post_parse) { + rv = this.post_parse(this.yy, retval); + if (typeof rv !== 'undefined') retval = rv; + } + } + + return retval; +}}; + + +function encodeRE (s) { + return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); +} + +function prepareString (s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; +}; + +/* generated by jison-lex 0.2.1 */ +var lexer = (function(){ +var lexer = { + +EOF:1, + +ERROR:2, + +parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + +// resets the lexer, sets new input +setInput:function (input) { + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + +// consumes and returns one char from the input +input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + + this._input = this._input.slice(1); + return ch; + }, + +// unshifts one char (or a string) into the input +unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + +// When called from action, caches matched text and appends it on next action +more:function () { + this._more = true; + return this; + }, + +// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +reject:function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: this.match, + token: null, + line: this.yylineno + }); + + } + return this; + }, + +// retain first n characters of the match +less:function (n) { + this.unput(this.match.slice(n)); + }, + +// return (part of the) already matched input, i.e. for error messages +pastInput:function (maxSize) { + var past = this.matched.substr(0, this.matched.length - this.match.length); + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + return (past.length > maxSize ? '...' + past.substr(-maxSize) : past); + }, + +// return (part of the) upcoming input, i.e. for error messages +upcomingInput:function (maxSize) { + var next = this.match; + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + if (next.length < maxSize) { + next += this._input.substr(0, maxSize - next.length); + } + return (next.length > maxSize ? next.substr(0, maxSize) + '...' : next); + }, + +// return a string which displays the character position where the lexing error occurred, i.e. for error messages +showPosition:function () { + var pre = this.pastInput().replace(/\s/g, " "); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput().replace(/\s/g, " ") + "\n" + c + "^"; + }, + +// test the lexed token: return FALSE when not a match, otherwise return token +test_match:function (match, indexed_rule) { + var token, + lines, + backup; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? + lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. + } + return false; + }, + +// return next match in input +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + + var token, + match, + tempMatch, + index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + // we cannot recover from a lexer error: we consider the input completely lexed: + this.done = true; + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: this.match + this._input, + token: null, + line: this.yylineno + }) || this.ERROR; + } + }, + +// return next match that has a token +lex:function lex() { + var r; + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + while (!r) { + r = this.next(); + }; + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + return r; + }, + +// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +begin:function begin(condition) { + this.conditionStack.push(condition); + }, + +// pop the previously active lexer condition state off the condition stack +popState:function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + +// produce the lexer rule set which is active for the currently active lexer condition state +_currentRules:function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + +// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +topState:function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + +// alias for begin(condition) +pushState:function pushState(condition) { + this.begin(condition); + }, + +// return the number of states currently on the stack +stateStackSize:function stateStackSize() { + return this.conditionStack.length; + }, +options: {}, +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START +/**/) { + +var YYSTATE=YY_START; +switch($avoiding_name_collisions) { +case 0 : +/*! Conditions:: action */ +/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + return 26; +break; +case 1 : +/*! Conditions:: action */ +/*! Rule:: \/\/.* */ + return 26; +break; +case 2 : +/*! Conditions:: action */ +/*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ + return 26; // regexp with braces or quotes (and no spaces) +break; +case 3 : +/*! Conditions:: action */ +/*! Rule:: "(\\\\|\\"|[^"])*" */ + return 26; +break; +case 4 : +/*! Conditions:: action */ +/*! Rule:: '(\\\\|\\'|[^'])*' */ + return 26; +break; +case 5 : +/*! Conditions:: action */ +/*! Rule:: [/"'][^{}/"']+ */ + return 26; +break; +case 6 : +/*! Conditions:: action */ +/*! Rule:: [^{}/"']+ */ + return 26; +break; +case 7 : +/*! Conditions:: action */ +/*! Rule:: \{ */ + yy.depth++; return 22; +break; +case 8 : +/*! Conditions:: action */ +/*! Rule:: \} */ + if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 24; +break; +case 9 : +/*! Conditions:: conditions */ +/*! Rule:: {NAME} */ + return 12; +break; +case 10 : +/*! Conditions:: conditions */ +/*! Rule:: > */ + this.popState(); return 29; +break; +case 11 : +/*! Conditions:: conditions */ +/*! Rule:: , */ + return 31; +break; +case 12 : +/*! Conditions:: conditions */ +/*! Rule:: \* */ + return 30; +break; +case 13 : +/*! Conditions:: rules */ +/*! Rule:: {BR}+ */ + /* empty */ +break; +case 14 : +/*! Conditions:: rules */ +/*! Rule:: \s+{BR}+ */ + /* empty */ +break; +case 15 : +/*! Conditions:: rules */ +/*! Rule:: \s+ */ + this.begin('indented'); +break; +case 16 : +/*! Conditions:: rules */ +/*! Rule:: %% */ + this.begin('code'); return 5; +break; +case 17 : +/*! Conditions:: rules */ +/*! Rule:: [a-zA-Z0-9_]+ */ + return 56; +break; +case 18 : +/*! Conditions:: options */ +/*! Rule:: {NAME} */ + yy.options[yy_.yytext] = true; +break; +case 19 : +/*! Conditions:: options */ +/*! Rule:: {BR}+ */ + this.begin('INITIAL'); +break; +case 20 : +/*! Conditions:: options */ +/*! Rule:: \s+{BR}+ */ + this.begin('INITIAL'); +break; +case 21 : +/*! Conditions:: options */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 22 : +/*! Conditions:: start_condition */ +/*! Rule:: {NAME} */ + return 18; +break; +case 23 : +/*! Conditions:: start_condition */ +/*! Rule:: {BR}+ */ + this.begin('INITIAL'); +break; +case 24 : +/*! Conditions:: start_condition */ +/*! Rule:: \s+{BR}+ */ + this.begin('INITIAL'); +break; +case 25 : +/*! Conditions:: start_condition */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 26 : +/*! Conditions:: trail */ +/*! Rule:: \s*{BR}+ */ + this.begin('rules'); +break; +case 27 : +/*! Conditions:: indented */ +/*! Rule:: \{ */ + yy.depth = 0; this.begin('action'); return 22; +break; +case 28 : +/*! Conditions:: indented */ +/*! Rule:: %\{(.|{BR})*?%\} */ + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; +break; +case 29 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %\{(.|{BR})*?%\} */ + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; +break; +case 30 : +/*! Conditions:: indented */ +/*! Rule:: .+ */ + this.begin('rules'); return 11; +break; +case 31 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /* empty */ +break; +case 32 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/\/.* */ + /* empty */ +break; +case 33 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: {BR}+ */ + /* ignore */ +break; +case 34 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \s+ */ + /* ignore */ +break; +case 35 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: {NAME} */ + return 12; +break; +case 36 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: "(\\\\|\\"|[^"])*" */ + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 55; +break; +case 37 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: '(\\\\|\\'|[^'])*' */ + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; +break; +case 38 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \| */ + return 33; +break; +case 39 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ + return 52; +break; +case 40 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \(\?: */ + return 38; +break; +case 41 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \(\?= */ + return 38; +break; +case 42 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \(\?! */ + return 38; +break; +case 43 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \( */ + return 36; +break; +case 44 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \) */ + return 37; +break; +case 45 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \+ */ + return 39; +break; +case 46 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \* */ + return 30; +break; +case 47 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \? */ + return 40; +break; +case 48 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \^ */ + return 47; +break; +case 49 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: , */ + return 31; +break; +case 50 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: <> */ + return 48; +break; +case 51 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: < */ + this.begin('conditions'); return 27; +break; +case 52 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/! */ + return 42; +break; +case 53 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/ */ + return 41; +break; +case 54 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + return 53; +break; +case 55 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; +break; +case 56 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \$ */ + return 48; +break; +case 57 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \. */ + return 46; +break; +case 58 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %options */ + yy.options = {}; this.begin('options'); +break; +case 59 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %s */ + this.begin('start_condition'); return 14; +break; +case 60 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %x */ + this.begin('start_condition'); return 16; +break; +case 61 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %% */ + this.begin('rules'); return 5; +break; +case 62 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \{\d+(,\s?\d+|,)?\} */ + return 54; +break; +case 63 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \{{NAME}\} */ + return 51; +break; +case 64 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \{ */ + return 22; +break; +case 65 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \} */ + return 24; +break; +case 66 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: . */ + throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ +break; +case 67 : +/*! Conditions:: * */ +/*! Rule:: $ */ + return 8; +break; +case 68 : +/*! Conditions:: code */ +/*! Rule:: (.|{BR})+ */ + return 9; +break; +} +}, +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options)/,/^(?:%s)/,/^(?:%x)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} +}; +return lexer; +})(); +parser.lexer = lexer; +function Parser () { + this.yy = {}; +} +Parser.prototype = parser;parser.Parser = Parser; +return new Parser; +})(); + + +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { +exports.parser = lex; +exports.Parser = lex.Parser; +exports.parse = function () { return lex.parse.apply(lex, arguments); }; +exports.main = function commonjsMain(args) { + if (!args[1]) { + console.log('Usage: '+args[0]+' FILE'); + process.exit(1); + } + var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); + return exports.parser.parse(source); +}; +if (typeof module !== 'undefined' && require.main === module) { + exports.main(process.argv.slice(1)); +} +} \ No newline at end of file From 98abb092554d76f6a847b41777e351a33edb1088 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 15:30:40 +0100 Subject: [PATCH 034/417] tweaked build target, using proper dependencies chaining --- Makefile | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 655b042..3435d65 100644 --- a/Makefile +++ b/Makefile @@ -4,9 +4,10 @@ all: npm-install build test npm-install: npm install -build: - node ./node_modules/.bin/jison lex.y lex.l - mv lex.js lex-parser.js +build: lex-parser.js + +lex-parser.js: npm-install lex.y lex.l + node ./node_modules/.bin/jison -o lex-parser.js lex.y lex.l test: node tests/all-tests.js From 619aa442e468d4a470da8de0d3eded71d60dfe39 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 15:34:30 +0100 Subject: [PATCH 035/417] make sure all tests have the lexer/parser RESET before running the test (options:flex would otherwise propagate across test boundaries) --- lex-parser.js | 8 ++++---- tests/all-tests.js | 47 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 40d1b6c..9ddfc25 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -108,7 +108,7 @@ the scan when a token is returned by the action code. } */ -var lex = (function(){ +var lexParser = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, @@ -1359,9 +1359,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lex; -exports.Parser = lex.Parser; -exports.parse = function () { return lex.parse.apply(lex, arguments); }; +exports.parser = lexParser; +exports.Parser = lexParser.Parser; +exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); diff --git a/tests/all-tests.js b/tests/all-tests.js index 4068c66..95d477c 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -7,6 +7,20 @@ function read (p, file) { return fs.readFileSync(path.join(__dirname, p, file), "utf8"); } +function lexer_reset() { + if (lex.parser.yy) { + var y = lex.parser.yy; + if (y.parser) { + delete y.parser; + } + if (y.lexer) { + delete y.lexer; + } + } + + lex.parser.yy = {}; +} + exports["test lex grammar with macros"] = function () { var lexgrammar = 'D [0-9]\nID [a-zA-Z][a-zA-Z0-9]+\n%%\n\n{D}"ohhai" {print(9);}\n"{" return \'{\';'; var expected = { @@ -17,6 +31,7 @@ exports["test lex grammar with macros"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -30,6 +45,7 @@ exports["test escaped chars"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -44,6 +60,7 @@ exports["test advanced"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -57,6 +74,7 @@ exports["test [^\\]]"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -68,6 +86,7 @@ exports["test multiline action"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -79,6 +98,7 @@ exports["test multiline action with single braces"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -90,6 +110,7 @@ exports["test multiline action with brace in a multi-line-comment"] = function ( ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -101,6 +122,7 @@ exports["test multiline action with brace in a single-line-comment"] = function ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -112,6 +134,7 @@ exports["test multiline action with braces in strings"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -123,6 +146,7 @@ exports["test multiline action with braces in regexp"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -136,6 +160,7 @@ exports["test include"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -143,6 +168,7 @@ exports["test bnf lex grammar"] = function () { var lexgrammar = lex.parse(read('lex', 'bnf.jisonlex')); var expected = JSON.parse(read('lex', 'bnf.lex.json')); + lexer_reset(); assert.deepEqual(lexgrammar, expected, "grammar should be parsed correctly"); }; @@ -150,12 +176,14 @@ exports["test lex grammar bootstrap"] = function () { var lexgrammar = lex.parse(read('lex', 'lex_grammar.jisonlex')); var expected = JSON.parse(read('lex', 'lex_grammar.lex.json')); + lexer_reset(); assert.deepEqual(lexgrammar, expected, "grammar should be parsed correctly"); }; exports["test ANSI C lexical grammar"] = function () { var lexgrammar = lex.parse(read('lex','ansic.jisonlex')); + lexer_reset(); assert.ok(lexgrammar, "grammar should be parsed correctly"); }; @@ -167,6 +195,7 @@ exports["test advanced"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -190,6 +219,7 @@ exports["test start conditions"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -202,6 +232,7 @@ exports["test no brace action"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -213,6 +244,7 @@ exports["test quote escape"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -228,6 +260,7 @@ exports["test escape things"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -239,6 +272,7 @@ exports["test unicode encoding"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -250,6 +284,7 @@ exports["test unicode"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -261,6 +296,7 @@ exports["test bugs"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -272,6 +308,7 @@ exports["test special groupings"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -284,6 +321,7 @@ exports["test trailing code include"] = function () { moduleInclude: " var bar = 1;" }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -295,6 +333,7 @@ exports["test empty or regex"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -307,6 +346,7 @@ exports["test options"] = function () { options: {flex: true} }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -318,6 +358,7 @@ exports["test unquoted string rules"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -331,6 +372,7 @@ exports["test [^\\\\]"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -342,6 +384,7 @@ exports["test comments"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -353,6 +396,7 @@ exports["test rules with trailing escapes"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -365,6 +409,7 @@ exports["test no brace action with surplus whitespace between rules"] = function ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -376,6 +421,7 @@ exports["test windows line endings"] = function () { ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; @@ -388,6 +434,7 @@ exports["test braced action with surplus whitespace between rules"] = function ( ] }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; From 2f807f7e8527397a82aeaeee74d1ce841206b203 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 18:27:47 +0100 Subject: [PATCH 036/417] minimal comment edit --- lex.l | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lex.l b/lex.l index 8b77cdc..6b27f22 100644 --- a/lex.l +++ b/lex.l @@ -45,11 +45,11 @@ BR \r\n|\n|\r "%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; .+ this.begin('rules'); return 'ACTION'; -"/*"(.|\n|\r)*?"*/" /* empty */ -"//".* /* empty */ +"/*"(.|\n|\r)*?"*/" /* ignore */ +"//".* /* ignore */ -{BR}+ /* ignore */ -\s+ /* ignore */ +{BR}+ /* empty */ +\s+ /* empty */ {NAME} return 'NAME'; \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; From 9e69d66f9f8e71049403b4a2473a712658ee4760 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 18:49:35 +0100 Subject: [PATCH 037/417] (re)introducing optional 'easy keyword lexing' a la #63: now only enabled when you specify the lexer `%option easy_keyword_rules` (this means that #63 is no longer tightly coupled with %option flex: the jison lexer behaved like flex by default, until you switch on the `%option easy_keyword_rules`) --- lex.y | 3 +++ tests/all-tests.js | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/lex.y b/lex.y index 17e1a65..cc68baf 100644 --- a/lex.y +++ b/lex.y @@ -132,6 +132,9 @@ regex : regex_list { $$ = $1; + if (yy.options && yy.options.easy_keyword_rules && $$.match(/[\w\d]$/) && !$$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { + $$ += "\\b"; + } } ; diff --git a/tests/all-tests.js b/tests/all-tests.js index 95d477c..a2c8004 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -17,7 +17,7 @@ function lexer_reset() { delete y.lexer; } } - + lex.parser.yy = {}; } @@ -438,6 +438,43 @@ exports["test braced action with surplus whitespace between rules"] = function ( assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test %option easy_keyword_rules"] = function () { + var lexgrammar = '%option easy_keyword_rules\n'+ + '%s TEST TEST2\n%x EAT\n%%\n'+ + '"enter-test" {this.begin(\'TEST\');}\n'+ + '"x" {return \'T\';}\n'+ + '<*>"z" {return \'Z\';}\n'+ + '"y" {this.begin(\'INITIAL\'); return \'TY\';}'+ + '\\"\\\'"a" return 1;'+ + '\\"\\\'\\\\\\*\\i return 1;\n"a"\\b return 2;\n\\cA {}\n\\012 {}\n\\xFF {}'+ + '"["[^\\\\]"]" {return true;}\n\'f"oo\\\'bar\' {return \'baz2\';}\n"fo\\"obar" {return \'baz\';}\n'; + var expected = { + startConditions: { + "TEST": 0, + "TEST2": 0, + "EAT": 1, + }, + rules: [ + ["enter-test", "this.begin('TEST');" ], + [["TEST","EAT"], "x", "return 'T';" ], + [["*"], "z", "return 'Z';" ], + [["TEST"], "y", "this.begin('INITIAL'); return 'TY';" ], + ["\"'a\\b", "return 1;"], + ["\"'\\\\\\*i", "return 1;"], + ["a\\b", "return 2;"], + ["\\cA", ""], + ["\\012", ""], + ["\\xFF", ""], + ["\\[[^\\\\]\\]", "return true;"], + ["f\"oo'bar", "return 'baz2';"], + ['fo"obar', "return 'baz';"] + ] + }; + + lexer_reset(); + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + if (require.main === module) require("test").run(exports); From 9e1622e0c555a91bf27928df05cc70870674cf0c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 19:24:38 +0100 Subject: [PATCH 038/417] fix test case for %options easy_keyword_rules --- lex-parser.js | 44 ++++++++++++++++++++++++++++++++------------ tests/all-tests.js | 29 ++++++++++++++++------------- 2 files changed, 48 insertions(+), 25 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 9ddfc25..2bad28d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -106,6 +106,14 @@ optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code. + pre_lex: function() + optional: is invoked before the lexer is invoked to produce another token. + `this` refers to the Lexer object. + post_lex: function(token) { return token; } + optional: is invoked when the lexer has produced a token `token`; + this function can override the returned token value by returning another. + When it does not return any (truthy) value, the lexer will return the original `token`. + `this` refers to the Lexer object. } */ var lexParser = (function(){ @@ -261,6 +269,9 @@ case 31 : /*! Production:: regex : regex_list */ this.$ = $$[$0]; + if (yy.options && yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { + this.$ += "\\b"; + } break; case 32 : @@ -659,7 +670,7 @@ ERROR:2, parseError:function parseError(str, hash) { if (this.yy.parser) { - this.yy.parser.parseError(str, hash); + return this.yy.parser.parseError(str, hash) || this.ERROR; } else { throw new Error(str); } @@ -668,7 +679,7 @@ parseError:function parseError(str, hash) { // resets the lexer, sets new input setInput:function (input) { this._input = input; - this._more = this._backtrack = this.done = false; + this._more = this._backtrack = this._signaled_error_token = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; @@ -754,12 +765,14 @@ reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { - this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + // when the parseError() call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // .lex() run. + this._signaled_error_token = (this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { text: this.match, token: null, line: this.yylineno - }); - + }) || this.ERROR); } return this; }, @@ -867,6 +880,11 @@ test_match:function (match, indexed_rule) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + this._signaled_error_token = false; + return token; } return false; }, @@ -921,13 +939,15 @@ next:function () { if (this._input === "") { return this.EOF; } else { - // we cannot recover from a lexer error: we consider the input completely lexed: - this.done = true; - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: this.match + this._input, token: null, line: this.yylineno }) || this.ERROR; + if (token === this.ERROR || token === this.EOF) { + // we cannot recover from a lexer error that parseError() did not 'recover' for us: we consider the input completely lexed: + this.done = true; + } } }, @@ -1155,22 +1175,22 @@ break; case 31 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - /* empty */ + /* ignore */ break; case 32 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/\/.* */ - /* empty */ + /* ignore */ break; case 33 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: {BR}+ */ - /* ignore */ + /* empty */ break; case 34 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \s+ */ - /* ignore */ + /* empty */ break; case 35 : /*! Conditions:: indented trail rules INITIAL */ diff --git a/tests/all-tests.js b/tests/all-tests.js index a2c8004..7d4b618 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -438,15 +438,15 @@ exports["test braced action with surplus whitespace between rules"] = function ( assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; -exports["test %option easy_keyword_rules"] = function () { - var lexgrammar = '%option easy_keyword_rules\n'+ +exports["test %options easy_keyword_rules"] = function () { + var lexgrammar = '%options easy_keyword_rules\n'+ '%s TEST TEST2\n%x EAT\n%%\n'+ '"enter-test" {this.begin(\'TEST\');}\n'+ '"x" {return \'T\';}\n'+ '<*>"z" {return \'Z\';}\n'+ - '"y" {this.begin(\'INITIAL\'); return \'TY\';}'+ - '\\"\\\'"a" return 1;'+ - '\\"\\\'\\\\\\*\\i return 1;\n"a"\\b return 2;\n\\cA {}\n\\012 {}\n\\xFF {}'+ + '"y" {this.begin(\'INITIAL\'); return \'TY\';}\n'+ + '\\"\\\'"a" return 1;\n'+ + '\\"\\\'\\\\\\*\\i return 1;\n"a"\\b return 2;\n\\cA {}\n\\012 {}\n\\xFF {}\n'+ '"["[^\\\\]"]" {return true;}\n\'f"oo\\\'bar\' {return \'baz2\';}\n"fo\\"obar" {return \'baz\';}\n'; var expected = { startConditions: { @@ -455,20 +455,23 @@ exports["test %option easy_keyword_rules"] = function () { "EAT": 1, }, rules: [ - ["enter-test", "this.begin('TEST');" ], - [["TEST","EAT"], "x", "return 'T';" ], - [["*"], "z", "return 'Z';" ], - [["TEST"], "y", "this.begin('INITIAL'); return 'TY';" ], + ["enter-test\\b", "this.begin('TEST');" ], + [["TEST","EAT"], "x\\b", "return 'T';" ], + [["*"], "z\\b", "return 'Z';" ], + [["TEST"], "y\\b", "this.begin('INITIAL'); return 'TY';" ], ["\"'a\\b", "return 1;"], - ["\"'\\\\\\*i", "return 1;"], + ["\"'\\\\\\*i\\b", "return 1;"], ["a\\b", "return 2;"], ["\\cA", ""], ["\\012", ""], ["\\xFF", ""], ["\\[[^\\\\]\\]", "return true;"], - ["f\"oo'bar", "return 'baz2';"], - ['fo"obar', "return 'baz';"] - ] + ["f\"oo'bar\\b", "return 'baz2';"], + ['fo"obar\\b', "return 'baz';"] + ], + options: { + "easy_keyword_rules": true + } }; lexer_reset(); From d171c300dc5a1e4caa3e2398ba841aeb76f0677d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 19:44:28 +0100 Subject: [PATCH 039/417] %options easy_keyword_rules round-trip: tweaked lexer definition file to support the feature (again) and regenerated the files. --- lex-parser.js | 10 +++++----- lex.l | 2 ++ 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 2bad28d..07b3f3b 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1011,7 +1011,7 @@ pushState:function pushState(condition) { stateStackSize:function stateStackSize() { return this.conditionStack.length; }, -options: {}, +options: {"easy_keyword_rules":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START /**/) { @@ -1309,17 +1309,17 @@ case 57 : break; case 58 : /*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %options */ +/*! Rule:: %options\b */ yy.options = {}; this.begin('options'); break; case 59 : /*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %s */ +/*! Rule:: %s\b */ this.begin('start_condition'); return 14; break; case 60 : /*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %x */ +/*! Rule:: %x\b */ this.begin('start_condition'); return 16; break; case 61 : @@ -1364,7 +1364,7 @@ case 68 : break; } }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options)/,/^(?:%s)/,/^(?:%x)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} }; return lexer; diff --git a/lex.l b/lex.l index 6b27f22..d9ed07b 100644 --- a/lex.l +++ b/lex.l @@ -5,6 +5,8 @@ BR \r\n|\n|\r %s indented trail rules %x code start_condition options conditions action +%options easy_keyword_rules + %% "/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; From ae2839e31bb9ee19fef1e8cf2be59eea7ea2be6c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 19:58:35 +0100 Subject: [PATCH 040/417] allow multiple %options lines in a lexer definition file, e.g. %options ranges %options easy_keyword_rules is now as valid as would have been: %options ranges easy_keyword_rules --- lex-parser.js | 1396 ------------------------------------------------- lex.l | 2 +- 2 files changed, 1 insertion(+), 1397 deletions(-) delete mode 100644 lex-parser.js diff --git a/lex-parser.js b/lex-parser.js deleted file mode 100644 index 07b3f3b..0000000 --- a/lex-parser.js +++ /dev/null @@ -1,1396 +0,0 @@ -/* parser generated by jison 0.4.13 */ -/* - Returns a Parser object of the following structure: - - Parser: { - yy: {} - } - - Parser.prototype: { - yy: {}, - trace: function(), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), - (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), - - lexer: { - EOF: 1, - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), - stateStackSize: function(), - - options: { ... }, - - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } - - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) - recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) - } - - You can specify parser options by setting / modifying the `.yy` object of your Parser instance. - These options are available: - - ### options which are global for all parser instances - - Parser.pre_parse: function(yy) - optional: you can specify a pre_parse() function in the chunk following the grammar, - i.e. after the last `%%`. - Parser.post_parse: function(yy, retval) { return retval; } - optional: you can specify a post_parse() function in the chunk following the grammar, - i.e. after the last `%%`. When it does not return any value, the parser will return - the original `retval`. - - ### options which can be set up per parser instance - - yy: { - pre_parse: function(yy) - optional: is invoked before the parse cycle starts (and before the first invocation - of `lex()`) but immediately after the invocation of parser.pre_parse()). - post_parse: function(yy, retval) { return retval; } - optional: is invoked when the parse terminates due to success ('accept') or failure - (even when exceptions are thrown). `retval` contains the return value to be produced - by `Parser.parse()`; this function can override the return value by returning another. - When it does not return any value, the parser will return the original `retval`. - This function is invoked immediately before `Parser.post_parse()`. - parseError: function(str, hash) - optional: overrides the default `parseError` function. - } - - parser.lexer.options: { - ranges: boolean optional: true ==> token location info will include a .range[] member. - flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested - exhaustively to find the longest match. - backtrack_lexer: boolean - optional: true ==> lexer regexes are tested in order and for each matching - regex the action code is invoked; the lexer terminates - the scan when a token is returned by the action code. - pre_lex: function() - optional: is invoked before the lexer is invoked to produce another token. - `this` refers to the Lexer object. - post_lex: function(token) { return token; } - optional: is invoked when the lexer has produced a token `token`; - this function can override the returned token value by returning another. - When it does not return any (truthy) value, the lexer will return the original `token`. - `this` refers to the Lexer object. - } -*/ -var lexParser = (function(){ -var parser = {trace: function trace() { }, -yy: {}, -symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, -terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"START_COND",22:"{",24:"}",26:"ACTION_BODY",27:"<",29:">",30:"*",31:",",33:"|",36:"(",37:")",38:"SPECIAL_GROUP",39:"+",40:"?",41:"/",42:"/!",46:".",47:"^",48:"$",51:"NAME_BRACE",52:"ANY_GROUP_REGEX",53:"ESCAPE_CHAR",54:"RANGE_REGEX",55:"STRING_LIT",56:"CHARACTER_LIT"}, -productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[19,3],[21,3],[21,1],[23,0],[23,1],[23,5],[23,4],[25,1],[25,2],[20,3],[20,3],[20,0],[28,1],[28,3],[13,1],[32,3],[32,2],[32,1],[32,0],[34,2],[34,1],[35,3],[35,3],[35,2],[35,2],[35,2],[35,2],[35,2],[35,1],[35,2],[35,1],[35,1],[35,1],[35,1],[35,1],[35,1],[43,1],[45,1],[50,1],[44,1],[49,1],[49,1]], -performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */ -/**/) { -/* this == yyval */ - -var $0 = $$.length - 1; -switch (yystate) { -case 1 : -/*! Production:: lex : definitions %% rules epilogue */ - - this.$ = { rules: $$[$0-1] }; - if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; - if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; - if ($$[$0]) this.$.moduleInclude = $$[$0]; - if (yy.options) this.$.options = yy.options; - if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; - delete yy.options; - delete yy.actionInclude; - return this.$; - -break; -case 2 : -/*! Production:: epilogue : EOF */ - this.$ = null; -break; -case 3 : -/*! Production:: epilogue : %% EOF */ - this.$ = null; -break; -case 4 : -/*! Production:: epilogue : %% CODE EOF */ - this.$ = $$[$0-1]; -break; -case 5 : -/*! Production:: definitions : definition definitions */ - - this.$ = $$[$0]; - if ('length' in $$[$0-1]) { - this.$[0] = this.$[0] || {}; - this.$[0][$$[$0-1][0]] = $$[$0-1][1]; - } else { - this.$[1] = this.$[1] || {}; - for (var name in $$[$0-1]) { - this.$[1][name] = $$[$0-1][name]; - } - } - -break; -case 6 : -/*! Production:: definitions : ACTION definitions */ - yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; -break; -case 7 : -/*! Production:: definitions : */ - yy.actionInclude = ''; this.$ = [null,null]; -break; -case 8 : -/*! Production:: definition : NAME regex */ - this.$ = [$$[$0-1], $$[$0]]; -break; -case 9 : -/*! Production:: definition : START_INC names_inclusive */ - this.$ = $$[$0]; -break; -case 10 : -/*! Production:: definition : START_EXC names_exclusive */ - this.$ = $$[$0]; -break; -case 11 : -/*! Production:: names_inclusive : START_COND */ - this.$ = {}; this.$[$$[$0]] = 0; -break; -case 12 : -/*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0-1]; this.$[$$[$0]] = 0; -break; -case 13 : -/*! Production:: names_exclusive : START_COND */ - this.$ = {}; this.$[$$[$0]] = 1; -break; -case 14 : -/*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0-1]; this.$[$$[$0]] = 1; -break; -case 15 : -/*! Production:: rules : rules rule */ - this.$ = $$[$0-1]; this.$.push($$[$0]); -break; -case 16 : -/*! Production:: rules : rule */ - this.$ = [$$[$0]]; -break; -case 17 : -/*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; -break; -case 18 : -/*! Production:: action : { action_body } */ - this.$ = $$[$0-1]; -break; -case 19 : -/*! Production:: action : ACTION */ - this.$ = $$[$0]; -break; -case 20 : -/*! Production:: action_body : */ - this.$ = ''; -break; -case 21 : -/*! Production:: action_body : action_comments_body */ - this.$ = $$[$0]; -break; -case 22 : -/*! Production:: action_body : action_body { action_body } action_comments_body */ - this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 23 : -/*! Production:: action_body : action_body { action_body } */ - this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 24 : -/*! Production:: action_comments_body : ACTION_BODY */ - this.$ = yytext; -break; -case 25 : -/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - this.$ = $$[$0-1] + $$[$0]; -break; -case 26 : -/*! Production:: start_conditions : < name_list > */ - this.$ = $$[$0-1]; -break; -case 27 : -/*! Production:: start_conditions : < * > */ - this.$ = ['*']; -break; -case 29 : -/*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; -break; -case 30 : -/*! Production:: name_list : name_list , NAME */ - this.$ = $$[$0-2]; this.$.push($$[$0]); -break; -case 31 : -/*! Production:: regex : regex_list */ - - this.$ = $$[$0]; - if (yy.options && yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { - this.$ += "\\b"; - } - -break; -case 32 : -/*! Production:: regex_list : regex_list | regex_concat */ - this.$ = $$[$0-2] + '|' + $$[$0]; -break; -case 33 : -/*! Production:: regex_list : regex_list | */ - this.$ = $$[$0-1] + '|'; -break; -case 35 : -/*! Production:: regex_list : */ - this.$ = ''; -break; -case 36 : -/*! Production:: regex_concat : regex_concat regex_base */ - this.$ = $$[$0-1] + $$[$0]; -break; -case 38 : -/*! Production:: regex_base : ( regex_list ) */ - this.$ = '(' + $$[$0-1] + ')'; -break; -case 39 : -/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ - this.$ = $$[$0-2] + $$[$0-1] + ')'; -break; -case 40 : -/*! Production:: regex_base : regex_base + */ - this.$ = $$[$0-1] + '+'; -break; -case 41 : -/*! Production:: regex_base : regex_base * */ - this.$ = $$[$0-1] + '*'; -break; -case 42 : -/*! Production:: regex_base : regex_base ? */ - this.$ = $$[$0-1] + '?'; -break; -case 43 : -/*! Production:: regex_base : / regex_base */ - this.$ = '(?=' + $$[$0] + ')'; -break; -case 44 : -/*! Production:: regex_base : /! regex_base */ - this.$ = '(?!' + $$[$0] + ')'; -break; -case 46 : -/*! Production:: regex_base : regex_base range_regex */ - this.$ = $$[$0-1] + $$[$0]; -break; -case 48 : -/*! Production:: regex_base : . */ - this.$ = '.'; -break; -case 49 : -/*! Production:: regex_base : ^ */ - this.$ = '^'; -break; -case 50 : -/*! Production:: regex_base : $ */ - this.$ = '$'; -break; -case 54 : -/*! Production:: any_group_regex : ANY_GROUP_REGEX */ - this.$ = yytext; -break; -case 55 : -/*! Production:: escape_char : ESCAPE_CHAR */ - this.$ = yytext; -break; -case 56 : -/*! Production:: range_regex : RANGE_REGEX */ - this.$ = yytext; -break; -case 57 : -/*! Production:: string : STRING_LIT */ - this.$ = prepareString(yytext.substr(1, yytext.length - 2)); -break; -} -}, -table: [{3:1,4:2,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{1:[3]},{5:[1,8]},{4:9,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{4:10,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{5:[2,35],11:[2,35],12:[2,35],13:11,14:[2,35],16:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:35,11:[2,28],19:36,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,5]},{5:[2,6]},{5:[2,8],11:[2,8],12:[2,8],14:[2,8],16:[2,8]},{5:[2,31],11:[2,31],12:[2,31],14:[2,31],16:[2,31],22:[2,31],33:[1,39]},{5:[2,34],11:[2,34],12:[2,34],14:[2,34],16:[2,34],22:[2,34],33:[2,34],35:40,36:[1,15],37:[2,34],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,37],11:[2,37],12:[2,37],14:[2,37],16:[2,37],22:[2,37],30:[1,42],33:[2,37],36:[2,37],37:[2,37],38:[2,37],39:[1,41],40:[1,43],41:[2,37],42:[2,37],44:44,46:[2,37],47:[2,37],48:[2,37],51:[2,37],52:[2,37],53:[2,37],54:[1,45],55:[2,37],56:[2,37]},{32:46,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{32:47,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:48,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:49,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,45],11:[2,45],12:[2,45],14:[2,45],16:[2,45],22:[2,45],30:[2,45],33:[2,45],36:[2,45],37:[2,45],38:[2,45],39:[2,45],40:[2,45],41:[2,45],42:[2,45],46:[2,45],47:[2,45],48:[2,45],51:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45],56:[2,45]},{5:[2,47],11:[2,47],12:[2,47],14:[2,47],16:[2,47],22:[2,47],30:[2,47],33:[2,47],36:[2,47],37:[2,47],38:[2,47],39:[2,47],40:[2,47],41:[2,47],42:[2,47],46:[2,47],47:[2,47],48:[2,47],51:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47],56:[2,47]},{5:[2,48],11:[2,48],12:[2,48],14:[2,48],16:[2,48],22:[2,48],30:[2,48],33:[2,48],36:[2,48],37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],42:[2,48],46:[2,48],47:[2,48],48:[2,48],51:[2,48],52:[2,48],53:[2,48],54:[2,48],55:[2,48],56:[2,48]},{5:[2,49],11:[2,49],12:[2,49],14:[2,49],16:[2,49],22:[2,49],30:[2,49],33:[2,49],36:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],42:[2,49],46:[2,49],47:[2,49],48:[2,49],51:[2,49],52:[2,49],53:[2,49],54:[2,49],55:[2,49],56:[2,49]},{5:[2,50],11:[2,50],12:[2,50],14:[2,50],16:[2,50],22:[2,50],30:[2,50],33:[2,50],36:[2,50],37:[2,50],38:[2,50],39:[2,50],40:[2,50],41:[2,50],42:[2,50],46:[2,50],47:[2,50],48:[2,50],51:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50],56:[2,50]},{5:[2,51],11:[2,51],12:[2,51],14:[2,51],16:[2,51],22:[2,51],30:[2,51],33:[2,51],36:[2,51],37:[2,51],38:[2,51],39:[2,51],40:[2,51],41:[2,51],42:[2,51],46:[2,51],47:[2,51],48:[2,51],51:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51],56:[2,51]},{5:[2,52],11:[2,52],12:[2,52],14:[2,52],16:[2,52],22:[2,52],30:[2,52],33:[2,52],36:[2,52],37:[2,52],38:[2,52],39:[2,52],40:[2,52],41:[2,52],42:[2,52],46:[2,52],47:[2,52],48:[2,52],51:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52],56:[2,52]},{5:[2,53],11:[2,53],12:[2,53],14:[2,53],16:[2,53],22:[2,53],30:[2,53],33:[2,53],36:[2,53],37:[2,53],38:[2,53],39:[2,53],40:[2,53],41:[2,53],42:[2,53],46:[2,53],47:[2,53],48:[2,53],51:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53],56:[2,53]},{5:[2,54],11:[2,54],12:[2,54],14:[2,54],16:[2,54],22:[2,54],30:[2,54],33:[2,54],36:[2,54],37:[2,54],38:[2,54],39:[2,54],40:[2,54],41:[2,54],42:[2,54],46:[2,54],47:[2,54],48:[2,54],51:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54],56:[2,54]},{5:[2,57],11:[2,57],12:[2,57],14:[2,57],16:[2,57],22:[2,57],30:[2,57],33:[2,57],36:[2,57],37:[2,57],38:[2,57],39:[2,57],40:[2,57],41:[2,57],42:[2,57],46:[2,57],47:[2,57],48:[2,57],51:[2,57],52:[2,57],53:[2,57],54:[2,57],55:[2,57],56:[2,57]},{5:[2,58],11:[2,58],12:[2,58],14:[2,58],16:[2,58],22:[2,58],30:[2,58],33:[2,58],36:[2,58],37:[2,58],38:[2,58],39:[2,58],40:[2,58],41:[2,58],42:[2,58],46:[2,58],47:[2,58],48:[2,58],51:[2,58],52:[2,58],53:[2,58],54:[2,58],55:[2,58],56:[2,58]},{5:[2,55],11:[2,55],12:[2,55],14:[2,55],16:[2,55],22:[2,55],30:[2,55],33:[2,55],36:[2,55],37:[2,55],38:[2,55],39:[2,55],40:[2,55],41:[2,55],42:[2,55],46:[2,55],47:[2,55],48:[2,55],51:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55],56:[2,55]},{5:[2,9],11:[2,9],12:[2,9],14:[2,9],16:[2,9],18:[1,50]},{5:[2,11],11:[2,11],12:[2,11],14:[2,11],16:[2,11],18:[2,11]},{5:[2,10],11:[2,10],12:[2,10],14:[2,10],16:[2,10],18:[1,51]},{5:[2,13],11:[2,13],12:[2,13],14:[2,13],16:[2,13],18:[2,13]},{5:[1,55],7:52,8:[1,54],11:[2,28],19:53,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,16],8:[2,16],11:[2,16],22:[2,16],27:[2,16],33:[2,16],36:[2,16],38:[2,16],41:[2,16],42:[2,16],46:[2,16],47:[2,16],48:[2,16],51:[2,16],52:[2,16],53:[2,16],55:[2,16],56:[2,16]},{11:[2,35],13:56,22:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{12:[1,59],28:57,30:[1,58]},{5:[2,33],11:[2,33],12:[2,33],14:[2,33],16:[2,33],22:[2,33],33:[2,33],34:60,35:14,36:[1,15],37:[2,33],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,36],11:[2,36],12:[2,36],14:[2,36],16:[2,36],22:[2,36],30:[1,42],33:[2,36],36:[2,36],37:[2,36],38:[2,36],39:[1,41],40:[1,43],41:[2,36],42:[2,36],44:44,46:[2,36],47:[2,36],48:[2,36],51:[2,36],52:[2,36],53:[2,36],54:[1,45],55:[2,36],56:[2,36]},{5:[2,40],11:[2,40],12:[2,40],14:[2,40],16:[2,40],22:[2,40],30:[2,40],33:[2,40],36:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],42:[2,40],46:[2,40],47:[2,40],48:[2,40],51:[2,40],52:[2,40],53:[2,40],54:[2,40],55:[2,40],56:[2,40]},{5:[2,41],11:[2,41],12:[2,41],14:[2,41],16:[2,41],22:[2,41],30:[2,41],33:[2,41],36:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],42:[2,41],46:[2,41],47:[2,41],48:[2,41],51:[2,41],52:[2,41],53:[2,41],54:[2,41],55:[2,41],56:[2,41]},{5:[2,42],11:[2,42],12:[2,42],14:[2,42],16:[2,42],22:[2,42],30:[2,42],33:[2,42],36:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],42:[2,42],46:[2,42],47:[2,42],48:[2,42],51:[2,42],52:[2,42],53:[2,42],54:[2,42],55:[2,42],56:[2,42]},{5:[2,46],11:[2,46],12:[2,46],14:[2,46],16:[2,46],22:[2,46],30:[2,46],33:[2,46],36:[2,46],37:[2,46],38:[2,46],39:[2,46],40:[2,46],41:[2,46],42:[2,46],46:[2,46],47:[2,46],48:[2,46],51:[2,46],52:[2,46],53:[2,46],54:[2,46],55:[2,46],56:[2,46]},{5:[2,56],11:[2,56],12:[2,56],14:[2,56],16:[2,56],22:[2,56],30:[2,56],33:[2,56],36:[2,56],37:[2,56],38:[2,56],39:[2,56],40:[2,56],41:[2,56],42:[2,56],46:[2,56],47:[2,56],48:[2,56],51:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56],56:[2,56]},{33:[1,39],37:[1,61]},{33:[1,39],37:[1,62]},{5:[2,43],11:[2,43],12:[2,43],14:[2,43],16:[2,43],22:[2,43],30:[1,42],33:[2,43],36:[2,43],37:[2,43],38:[2,43],39:[1,41],40:[1,43],41:[2,43],42:[2,43],44:44,46:[2,43],47:[2,43],48:[2,43],51:[2,43],52:[2,43],53:[2,43],54:[1,45],55:[2,43],56:[2,43]},{5:[2,44],11:[2,44],12:[2,44],14:[2,44],16:[2,44],22:[2,44],30:[1,42],33:[2,44],36:[2,44],37:[2,44],38:[2,44],39:[1,41],40:[1,43],41:[2,44],42:[2,44],44:44,46:[2,44],47:[2,44],48:[2,44],51:[2,44],52:[2,44],53:[2,44],54:[1,45],55:[2,44],56:[2,44]},{5:[2,12],11:[2,12],12:[2,12],14:[2,12],16:[2,12],18:[2,12]},{5:[2,14],11:[2,14],12:[2,14],14:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{5:[2,15],8:[2,15],11:[2,15],22:[2,15],27:[2,15],33:[2,15],36:[2,15],38:[2,15],41:[2,15],42:[2,15],46:[2,15],47:[2,15],48:[2,15],51:[2,15],52:[2,15],53:[2,15],55:[2,15],56:[2,15]},{1:[2,2]},{8:[1,63],9:[1,64]},{11:[1,67],21:65,22:[1,66]},{29:[1,68],31:[1,69]},{29:[1,70]},{29:[2,29],31:[2,29]},{5:[2,32],11:[2,32],12:[2,32],14:[2,32],16:[2,32],22:[2,32],33:[2,32],35:40,36:[1,15],37:[2,32],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,38],11:[2,38],12:[2,38],14:[2,38],16:[2,38],22:[2,38],30:[2,38],33:[2,38],36:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],41:[2,38],42:[2,38],46:[2,38],47:[2,38],48:[2,38],51:[2,38],52:[2,38],53:[2,38],54:[2,38],55:[2,38],56:[2,38]},{5:[2,39],11:[2,39],12:[2,39],14:[2,39],16:[2,39],22:[2,39],30:[2,39],33:[2,39],36:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],41:[2,39],42:[2,39],46:[2,39],47:[2,39],48:[2,39],51:[2,39],52:[2,39],53:[2,39],54:[2,39],55:[2,39],56:[2,39]},{1:[2,3]},{8:[1,71]},{5:[2,17],8:[2,17],11:[2,17],22:[2,17],27:[2,17],33:[2,17],36:[2,17],38:[2,17],41:[2,17],42:[2,17],46:[2,17],47:[2,17],48:[2,17],51:[2,17],52:[2,17],53:[2,17],55:[2,17],56:[2,17]},{22:[2,20],23:72,24:[2,20],25:73,26:[1,74]},{5:[2,19],8:[2,19],11:[2,19],22:[2,19],27:[2,19],33:[2,19],36:[2,19],38:[2,19],41:[2,19],42:[2,19],46:[2,19],47:[2,19],48:[2,19],51:[2,19],52:[2,19],53:[2,19],55:[2,19],56:[2,19]},{11:[2,26],22:[2,26],33:[2,26],36:[2,26],38:[2,26],41:[2,26],42:[2,26],46:[2,26],47:[2,26],48:[2,26],51:[2,26],52:[2,26],53:[2,26],55:[2,26],56:[2,26]},{12:[1,75]},{11:[2,27],22:[2,27],33:[2,27],36:[2,27],38:[2,27],41:[2,27],42:[2,27],46:[2,27],47:[2,27],48:[2,27],51:[2,27],52:[2,27],53:[2,27],55:[2,27],56:[2,27]},{1:[2,4]},{22:[1,77],24:[1,76]},{22:[2,21],24:[2,21],26:[1,78]},{22:[2,24],24:[2,24],26:[2,24]},{29:[2,30],31:[2,30]},{5:[2,18],8:[2,18],11:[2,18],22:[2,18],27:[2,18],33:[2,18],36:[2,18],38:[2,18],41:[2,18],42:[2,18],46:[2,18],47:[2,18],48:[2,18],51:[2,18],52:[2,18],53:[2,18],55:[2,18],56:[2,18]},{22:[2,20],23:79,24:[2,20],25:73,26:[1,74]},{22:[2,25],24:[2,25],26:[2,25]},{22:[1,77],24:[1,80]},{22:[2,23],24:[2,23],25:81,26:[1,74]},{22:[2,22],24:[2,22],26:[1,78]}], -defaultActions: {9:[2,5],10:[2,6],52:[2,1],54:[2,2],63:[2,3],71:[2,4]}, -parseError: function parseError(str, hash) { - if (hash.recoverable) { - this.trace(str); - } else { - throw new Error(str); - } -}, -parse: function parse(input) { - var self = this, - stack = [0], - vstack = [null], // semantic value stack - lstack = [], // location stack - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - recovering = 0, - TERROR = 2, - EOF = 1; - - var args = lstack.slice.call(arguments, 1); - - //this.reductionCount = this.shiftCount = 0; - - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - this.yy.parser = this; - if (typeof this.lexer.yylloc === 'undefined') { - this.lexer.yylloc = {}; - } - var yyloc = this.lexer.yylloc; - lstack.push(yyloc); - - var ranges = this.lexer.options && this.lexer.options.ranges; - - if (typeof this.yy.parseError === 'function') { - this.parseError = this.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ - } - - function popStack (n) { - stack.length = stack.length - 2 * n; - vstack.length = vstack.length - n; - lstack.length = lstack.length - n; - } - - function lex() { - var token; - token = self.lexer.lex() || EOF; // $end = 1 - // if token isn't its numeric value, convert - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token; - } - - var symbol; - var preErrorSymbol = null; - var state, action, a, r; - var yyval = {}; - var p, len, newState; - var expected = []; - var retval = false; - - if (this.pre_parse) { - this.pre_parse(this.yy); - } - if (this.yy.pre_parse) { - this.yy.pre_parse(this.yy); - } - - try { - for (;;) { - // retreive state number from top of stack - state = stack[stack.length - 1]; - - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol === 'undefined') { - symbol = lex(); - } - // read action for current state and first input - action = table[state] && table[state][symbol]; - } - - // handle parse error - if (typeof action === 'undefined' || !action.length || !action[0]) { - var error_rule_depth; - var errStr = ''; - - // Return the rule stack depth where the nearest error rule can be found. - // Return FALSE when no error recovery rule was found. - function locateNearestErrorRecoveryRule(state) { - var stack_probe = stack.length - 1; - var depth = 0; - - // try to recover from error - for(;;) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - return depth; - } - if (state === 0 || stack_probe < 2) { - return false; // No suitable error recovery rule available. - } - stack_probe -= 2; // popStack(1): [symbol, action] - state = stack[stack_probe]; - ++depth; - } - } - - if (!recovering) { - // first see if there's any chance at hitting an error recovery rule: - error_rule_depth = locateNearestErrorRecoveryRule(state); - - // Report error - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push("'" + this.terminals_[p] + "'"); - } - } - if (this.lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + - (symbol == EOF ? "end of input" : - ("'" + (this.terminals_[symbol] || symbol) + "'")); - } - a = this.parseError(errStr, p = { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: (error_rule_depth !== false) - }); - if (!p.recoverable) { - retval = a; - break; - } - } else if (preErrorSymbol !== EOF) { - error_rule_depth = locateNearestErrorRecoveryRule(state); - } - - // just recovered from another error - if (recovering == 3) { - if (symbol === EOF || preErrorSymbol === EOF) { - retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; - } - - // discard current lookahead and grab another - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - symbol = lex(); - } - - // try to recover from error - if (error_rule_depth === false) { - retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; - } - popStack(error_rule_depth); - - preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; - } - - switch (action[0]) { - case 1: // shift - //this.shiftCount++; - - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); // push state - symbol = null; - if (!preErrorSymbol) { // normal execution / no error - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) { - recovering--; - } - } else { - // error just occurred, resume old lookahead f/ before error - symbol = preErrorSymbol; - preErrorSymbol = null; - } - continue; - - case 2: - // reduce - //this.reductionCount++; - - len = this.productions_[action[1]][1]; - - // perform semantic action - yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 - // default location, uses first token for firsts, last for lasts - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack].concat(args)); - - if (typeof r !== 'undefined') { - retval = r; - break; - } - - // pop off stack - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); - } - - stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) - vstack.push(yyval.$); - lstack.push(yyval._$); - // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - continue; - - case 3: - // accept - retval = true; - break; - } - - // break out of loop: we accept or fail with error - break; - } - } finally { - var rv; - - if (this.yy.post_parse) { - rv = this.yy.post_parse(this.yy, retval); - if (typeof rv !== 'undefined') retval = rv; - } - if (this.post_parse) { - rv = this.post_parse(this.yy, retval); - if (typeof rv !== 'undefined') retval = rv; - } - } - - return retval; -}}; - - -function encodeRE (s) { - return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); -} - -function prepareString (s) { - // unescape slashes - s = s.replace(/\\\\/g, "\\"); - s = encodeRE(s); - return s; -}; - -/* generated by jison-lex 0.2.1 */ -var lexer = (function(){ -var lexer = { - -EOF:1, - -ERROR:2, - -parseError:function parseError(str, hash) { - if (this.yy.parser) { - return this.yy.parser.parseError(str, hash) || this.ERROR; - } else { - throw new Error(str); - } - }, - -// resets the lexer, sets new input -setInput:function (input) { - this._input = input; - this._more = this._backtrack = this._signaled_error_token = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; - this.conditionStack = ['INITIAL']; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - if (this.options.ranges) { - this.yylloc.range = [0, 0]; - } - this.offset = 0; - return this; - }, - -// consumes and returns one char from the input -input:function () { - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) { - this.yylloc.range[1]++; - } - - this._input = this._input.slice(1); - return ch; - }, - -// unshifts one char (or a string) into the input -unput:function (ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); - - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - var r = this.yylloc.range; - - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len - }; - - if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; - } - this.yyleng = this.yytext.length; - return this; - }, - -// When called from action, caches matched text and appends it on next action -more:function () { - this._more = true; - return this; - }, - -// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. -reject:function () { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - // when the parseError() call returns, we MUST ensure that the error is registered. - // We accomplish this by signaling an 'error' token to be produced for the current - // .lex() run. - this._signaled_error_token = (this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: this.match, - token: null, - line: this.yylineno - }) || this.ERROR); - } - return this; - }, - -// retain first n characters of the match -less:function (n) { - this.unput(this.match.slice(n)); - }, - -// return (part of the) already matched input, i.e. for error messages -pastInput:function (maxSize) { - var past = this.matched.substr(0, this.matched.length - this.match.length); - if (maxSize < 0) - maxSize = past.length; - else if (!maxSize) - maxSize = 20; - return (past.length > maxSize ? '...' + past.substr(-maxSize) : past); - }, - -// return (part of the) upcoming input, i.e. for error messages -upcomingInput:function (maxSize) { - var next = this.match; - if (maxSize < 0) - maxSize = next.length + this._input.length; - else if (!maxSize) - maxSize = 20; - if (next.length < maxSize) { - next += this._input.substr(0, maxSize - next.length); - } - return (next.length > maxSize ? next.substr(0, maxSize) + '...' : next); - }, - -// return a string which displays the character position where the lexing error occurred, i.e. for error messages -showPosition:function () { - var pre = this.pastInput().replace(/\s/g, " "); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput().replace(/\s/g, " ") + "\n" + c + "^"; - }, - -// test the lexed token: return FALSE when not a match, otherwise return token -test_match:function (match, indexed_rule) { - var token, - lines, - backup; - - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } - - lines = match[0].match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; - } - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : - this.yylloc.last_column + match[0].length - }; - this.yytext += match[0]; - this.match += match[0]; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; - } - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); - if (this.done && this._input) { - this.done = false; - } - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - return false; // rule action called reject() implying the next rule should be tested instead. - } else if (this._signaled_error_token) { - // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! - token = this._signaled_error_token; - this._signaled_error_token = false; - return token; - } - return false; - }, - -// return next match in input -next:function () { - if (this.done) { - return this.EOF; - } - if (!this._input) { - this.done = true; - } - - var token, - match, - tempMatch, - index; - if (!this._more) { - this.yytext = ''; - this.match = ''; - } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); - if (token !== false) { - return token; - } else if (this._backtrack) { - match = false; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - if (match) { - token = this.test_match(match, rules[index]); - if (token !== false) { - return token; - } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - if (this._input === "") { - return this.EOF; - } else { - token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: this.match + this._input, - token: null, - line: this.yylineno - }) || this.ERROR; - if (token === this.ERROR || token === this.EOF) { - // we cannot recover from a lexer error that parseError() did not 'recover' for us: we consider the input completely lexed: - this.done = true; - } - } - }, - -// return next match that has a token -lex:function lex() { - var r; - // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: - if (typeof this.options.pre_lex === 'function') { - r = this.options.pre_lex.call(this); - } - while (!r) { - r = this.next(); - }; - if (typeof this.options.post_lex === 'function') { - // (also account for a userdef function which does not return any value: keep the token as is) - r = this.options.post_lex.call(this, r) || r; - } - return r; - }, - -// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) -begin:function begin(condition) { - this.conditionStack.push(condition); - }, - -// pop the previously active lexer condition state off the condition stack -popState:function popState() { - var n = this.conditionStack.length - 1; - if (n > 0) { - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } - }, - -// produce the lexer rule set which is active for the currently active lexer condition state -_currentRules:function _currentRules() { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions["INITIAL"].rules; - } - }, - -// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available -topState:function topState(n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { - return this.conditionStack[n]; - } else { - return "INITIAL"; - } - }, - -// alias for begin(condition) -pushState:function pushState(condition) { - this.begin(condition); - }, - -// return the number of states currently on the stack -stateStackSize:function stateStackSize() { - return this.conditionStack.length; - }, -options: {"easy_keyword_rules":true}, -performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START -/**/) { - -var YYSTATE=YY_START; -switch($avoiding_name_collisions) { -case 0 : -/*! Conditions:: action */ -/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - return 26; -break; -case 1 : -/*! Conditions:: action */ -/*! Rule:: \/\/.* */ - return 26; -break; -case 2 : -/*! Conditions:: action */ -/*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 26; // regexp with braces or quotes (and no spaces) -break; -case 3 : -/*! Conditions:: action */ -/*! Rule:: "(\\\\|\\"|[^"])*" */ - return 26; -break; -case 4 : -/*! Conditions:: action */ -/*! Rule:: '(\\\\|\\'|[^'])*' */ - return 26; -break; -case 5 : -/*! Conditions:: action */ -/*! Rule:: [/"'][^{}/"']+ */ - return 26; -break; -case 6 : -/*! Conditions:: action */ -/*! Rule:: [^{}/"']+ */ - return 26; -break; -case 7 : -/*! Conditions:: action */ -/*! Rule:: \{ */ - yy.depth++; return 22; -break; -case 8 : -/*! Conditions:: action */ -/*! Rule:: \} */ - if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 24; -break; -case 9 : -/*! Conditions:: conditions */ -/*! Rule:: {NAME} */ - return 12; -break; -case 10 : -/*! Conditions:: conditions */ -/*! Rule:: > */ - this.popState(); return 29; -break; -case 11 : -/*! Conditions:: conditions */ -/*! Rule:: , */ - return 31; -break; -case 12 : -/*! Conditions:: conditions */ -/*! Rule:: \* */ - return 30; -break; -case 13 : -/*! Conditions:: rules */ -/*! Rule:: {BR}+ */ - /* empty */ -break; -case 14 : -/*! Conditions:: rules */ -/*! Rule:: \s+{BR}+ */ - /* empty */ -break; -case 15 : -/*! Conditions:: rules */ -/*! Rule:: \s+ */ - this.begin('indented'); -break; -case 16 : -/*! Conditions:: rules */ -/*! Rule:: %% */ - this.begin('code'); return 5; -break; -case 17 : -/*! Conditions:: rules */ -/*! Rule:: [a-zA-Z0-9_]+ */ - return 56; -break; -case 18 : -/*! Conditions:: options */ -/*! Rule:: {NAME} */ - yy.options[yy_.yytext] = true; -break; -case 19 : -/*! Conditions:: options */ -/*! Rule:: {BR}+ */ - this.begin('INITIAL'); -break; -case 20 : -/*! Conditions:: options */ -/*! Rule:: \s+{BR}+ */ - this.begin('INITIAL'); -break; -case 21 : -/*! Conditions:: options */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 22 : -/*! Conditions:: start_condition */ -/*! Rule:: {NAME} */ - return 18; -break; -case 23 : -/*! Conditions:: start_condition */ -/*! Rule:: {BR}+ */ - this.begin('INITIAL'); -break; -case 24 : -/*! Conditions:: start_condition */ -/*! Rule:: \s+{BR}+ */ - this.begin('INITIAL'); -break; -case 25 : -/*! Conditions:: start_condition */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 26 : -/*! Conditions:: trail */ -/*! Rule:: \s*{BR}+ */ - this.begin('rules'); -break; -case 27 : -/*! Conditions:: indented */ -/*! Rule:: \{ */ - yy.depth = 0; this.begin('action'); return 22; -break; -case 28 : -/*! Conditions:: indented */ -/*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; -break; -case 29 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; -break; -case 30 : -/*! Conditions:: indented */ -/*! Rule:: .+ */ - this.begin('rules'); return 11; -break; -case 31 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - /* ignore */ -break; -case 32 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/\/.* */ - /* ignore */ -break; -case 33 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: {BR}+ */ - /* empty */ -break; -case 34 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 35 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: {NAME} */ - return 12; -break; -case 36 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 55; -break; -case 37 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; -break; -case 38 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \| */ - return 33; -break; -case 39 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ - return 52; -break; -case 40 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \(\?: */ - return 38; -break; -case 41 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \(\?= */ - return 38; -break; -case 42 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \(\?! */ - return 38; -break; -case 43 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \( */ - return 36; -break; -case 44 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \) */ - return 37; -break; -case 45 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \+ */ - return 39; -break; -case 46 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \* */ - return 30; -break; -case 47 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \? */ - return 40; -break; -case 48 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \^ */ - return 47; -break; -case 49 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: , */ - return 31; -break; -case 50 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: <> */ - return 48; -break; -case 51 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: < */ - this.begin('conditions'); return 27; -break; -case 52 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/! */ - return 42; -break; -case 53 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/ */ - return 41; -break; -case 54 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - return 53; -break; -case 55 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; -break; -case 56 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \$ */ - return 48; -break; -case 57 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \. */ - return 46; -break; -case 58 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %options\b */ - yy.options = {}; this.begin('options'); -break; -case 59 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %s\b */ - this.begin('start_condition'); return 14; -break; -case 60 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %x\b */ - this.begin('start_condition'); return 16; -break; -case 61 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %% */ - this.begin('rules'); return 5; -break; -case 62 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \{\d+(,\s?\d+|,)?\} */ - return 54; -break; -case 63 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \{{NAME}\} */ - return 51; -break; -case 64 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \{ */ - return 22; -break; -case 65 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \} */ - return 24; -break; -case 66 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: . */ - throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ -break; -case 67 : -/*! Conditions:: * */ -/*! Rule:: $ */ - return 8; -break; -case 68 : -/*! Conditions:: code */ -/*! Rule:: (.|{BR})+ */ - return 9; -break; -} -}, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], -conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} -}; -return lexer; -})(); -parser.lexer = lexer; -function Parser () { - this.yy = {}; -} -Parser.prototype = parser;parser.Parser = Parser; -return new Parser; -})(); - - -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lexParser; -exports.Parser = lexParser.Parser; -exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; -exports.main = function commonjsMain(args) { - if (!args[1]) { - console.log('Usage: '+args[0]+' FILE'); - process.exit(1); - } - var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); - return exports.parser.parse(source); -}; -if (typeof module !== 'undefined' && require.main === module) { - exports.main(process.argv.slice(1)); -} -} \ No newline at end of file diff --git a/lex.l b/lex.l index d9ed07b..cebb059 100644 --- a/lex.l +++ b/lex.l @@ -76,7 +76,7 @@ BR \r\n|\n|\r "\\". yytext = yytext.replace(/^\\/g,''); return 'ESCAPE_CHAR'; "$" return '$'; "." return '.'; -"%options" yy.options = {}; this.begin('options'); +"%options" if (!yy.options) { yy.options = {}; } this.begin('options'); "%s" this.begin('start_condition'); return 'START_INC'; "%x" this.begin('start_condition'); return 'START_EXC'; "%%" this.begin('rules'); return '%%'; From 3f80900b68f1793238fd3cc74e7031c59c99748e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 20:25:16 +0100 Subject: [PATCH 041/417] regenerated files --- lex-parser.js | 1396 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1396 insertions(+) create mode 100644 lex-parser.js diff --git a/lex-parser.js b/lex-parser.js new file mode 100644 index 0000000..2ff741c --- /dev/null +++ b/lex-parser.js @@ -0,0 +1,1396 @@ +/* parser generated by jison 0.4.13 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} + } + + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), + (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), + stateStackSize: function(), + + options: { ... }, + + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, + } + } + + + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + } + + + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) + recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) + } + + You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + These options are available: + + ### options which are global for all parser instances + + Parser.pre_parse: function(yy) + optional: you can specify a pre_parse() function in the chunk following the grammar, + i.e. after the last `%%`. + Parser.post_parse: function(yy, retval) { return retval; } + optional: you can specify a post_parse() function in the chunk following the grammar, + i.e. after the last `%%`. When it does not return any value, the parser will return + the original `retval`. + + ### options which can be set up per parser instance + + yy: { + pre_parse: function(yy) + optional: is invoked before the parse cycle starts (and before the first invocation + of `lex()`) but immediately after the invocation of parser.pre_parse()). + post_parse: function(yy, retval) { return retval; } + optional: is invoked when the parse terminates due to success ('accept') or failure + (even when exceptions are thrown). `retval` contains the return value to be produced + by `Parser.parse()`; this function can override the return value by returning another. + When it does not return any value, the parser will return the original `retval`. + This function is invoked immediately before `Parser.post_parse()`. + parseError: function(str, hash) + optional: overrides the default `parseError` function. + } + + parser.lexer.options: { + ranges: boolean optional: true ==> token location info will include a .range[] member. + flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested + exhaustively to find the longest match. + backtrack_lexer: boolean + optional: true ==> lexer regexes are tested in order and for each matching + regex the action code is invoked; the lexer terminates + the scan when a token is returned by the action code. + pre_lex: function() + optional: is invoked before the lexer is invoked to produce another token. + `this` refers to the Lexer object. + post_lex: function(token) { return token; } + optional: is invoked when the lexer has produced a token `token`; + this function can override the returned token value by returning another. + When it does not return any (truthy) value, the lexer will return the original `token`. + `this` refers to the Lexer object. + } +*/ +var lexParser = (function(){ +var parser = {trace: function trace() { }, +yy: {}, +symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, +terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"START_COND",22:"{",24:"}",26:"ACTION_BODY",27:"<",29:">",30:"*",31:",",33:"|",36:"(",37:")",38:"SPECIAL_GROUP",39:"+",40:"?",41:"/",42:"/!",46:".",47:"^",48:"$",51:"NAME_BRACE",52:"ANY_GROUP_REGEX",53:"ESCAPE_CHAR",54:"RANGE_REGEX",55:"STRING_LIT",56:"CHARACTER_LIT"}, +productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[19,3],[21,3],[21,1],[23,0],[23,1],[23,5],[23,4],[25,1],[25,2],[20,3],[20,3],[20,0],[28,1],[28,3],[13,1],[32,3],[32,2],[32,1],[32,0],[34,2],[34,1],[35,3],[35,3],[35,2],[35,2],[35,2],[35,2],[35,2],[35,1],[35,2],[35,1],[35,1],[35,1],[35,1],[35,1],[35,1],[43,1],[45,1],[50,1],[44,1],[49,1],[49,1]], +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */ +/**/) { +/* this == yyval */ + +var $0 = $$.length - 1; +switch (yystate) { +case 1 : +/*! Production:: lex : definitions %% rules epilogue */ + + this.$ = { rules: $$[$0-1] }; + if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; + if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; + if ($$[$0]) this.$.moduleInclude = $$[$0]; + if (yy.options) this.$.options = yy.options; + if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; + delete yy.options; + delete yy.actionInclude; + return this.$; + +break; +case 2 : +/*! Production:: epilogue : EOF */ + this.$ = null; +break; +case 3 : +/*! Production:: epilogue : %% EOF */ + this.$ = null; +break; +case 4 : +/*! Production:: epilogue : %% CODE EOF */ + this.$ = $$[$0-1]; +break; +case 5 : +/*! Production:: definitions : definition definitions */ + + this.$ = $$[$0]; + if ('length' in $$[$0-1]) { + this.$[0] = this.$[0] || {}; + this.$[0][$$[$0-1][0]] = $$[$0-1][1]; + } else { + this.$[1] = this.$[1] || {}; + for (var name in $$[$0-1]) { + this.$[1][name] = $$[$0-1][name]; + } + } + +break; +case 6 : +/*! Production:: definitions : ACTION definitions */ + yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +break; +case 7 : +/*! Production:: definitions : */ + yy.actionInclude = ''; this.$ = [null,null]; +break; +case 8 : +/*! Production:: definition : NAME regex */ + this.$ = [$$[$0-1], $$[$0]]; +break; +case 9 : +/*! Production:: definition : START_INC names_inclusive */ + this.$ = $$[$0]; +break; +case 10 : +/*! Production:: definition : START_EXC names_exclusive */ + this.$ = $$[$0]; +break; +case 11 : +/*! Production:: names_inclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 0; +break; +case 12 : +/*! Production:: names_inclusive : names_inclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +break; +case 13 : +/*! Production:: names_exclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 1; +break; +case 14 : +/*! Production:: names_exclusive : names_exclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +break; +case 15 : +/*! Production:: rules : rules rule */ + this.$ = $$[$0-1]; this.$.push($$[$0]); +break; +case 16 : +/*! Production:: rules : rule */ + this.$ = [$$[$0]]; +break; +case 17 : +/*! Production:: rule : start_conditions regex action */ + this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; +break; +case 18 : +/*! Production:: action : { action_body } */ + this.$ = $$[$0-1]; +break; +case 19 : +/*! Production:: action : ACTION */ + this.$ = $$[$0]; +break; +case 20 : +/*! Production:: action_body : */ + this.$ = ''; +break; +case 21 : +/*! Production:: action_body : action_comments_body */ + this.$ = $$[$0]; +break; +case 22 : +/*! Production:: action_body : action_body { action_body } action_comments_body */ + this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 23 : +/*! Production:: action_body : action_body { action_body } */ + this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 24 : +/*! Production:: action_comments_body : ACTION_BODY */ + this.$ = yytext; +break; +case 25 : +/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ + this.$ = $$[$0-1] + $$[$0]; +break; +case 26 : +/*! Production:: start_conditions : < name_list > */ + this.$ = $$[$0-1]; +break; +case 27 : +/*! Production:: start_conditions : < * > */ + this.$ = ['*']; +break; +case 29 : +/*! Production:: name_list : NAME */ + this.$ = [$$[$0]]; +break; +case 30 : +/*! Production:: name_list : name_list , NAME */ + this.$ = $$[$0-2]; this.$.push($$[$0]); +break; +case 31 : +/*! Production:: regex : regex_list */ + + this.$ = $$[$0]; + if (yy.options && yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { + this.$ += "\\b"; + } + +break; +case 32 : +/*! Production:: regex_list : regex_list | regex_concat */ + this.$ = $$[$0-2] + '|' + $$[$0]; +break; +case 33 : +/*! Production:: regex_list : regex_list | */ + this.$ = $$[$0-1] + '|'; +break; +case 35 : +/*! Production:: regex_list : */ + this.$ = ''; +break; +case 36 : +/*! Production:: regex_concat : regex_concat regex_base */ + this.$ = $$[$0-1] + $$[$0]; +break; +case 38 : +/*! Production:: regex_base : ( regex_list ) */ + this.$ = '(' + $$[$0-1] + ')'; +break; +case 39 : +/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ + this.$ = $$[$0-2] + $$[$0-1] + ')'; +break; +case 40 : +/*! Production:: regex_base : regex_base + */ + this.$ = $$[$0-1] + '+'; +break; +case 41 : +/*! Production:: regex_base : regex_base * */ + this.$ = $$[$0-1] + '*'; +break; +case 42 : +/*! Production:: regex_base : regex_base ? */ + this.$ = $$[$0-1] + '?'; +break; +case 43 : +/*! Production:: regex_base : / regex_base */ + this.$ = '(?=' + $$[$0] + ')'; +break; +case 44 : +/*! Production:: regex_base : /! regex_base */ + this.$ = '(?!' + $$[$0] + ')'; +break; +case 46 : +/*! Production:: regex_base : regex_base range_regex */ + this.$ = $$[$0-1] + $$[$0]; +break; +case 48 : +/*! Production:: regex_base : . */ + this.$ = '.'; +break; +case 49 : +/*! Production:: regex_base : ^ */ + this.$ = '^'; +break; +case 50 : +/*! Production:: regex_base : $ */ + this.$ = '$'; +break; +case 54 : +/*! Production:: any_group_regex : ANY_GROUP_REGEX */ + this.$ = yytext; +break; +case 55 : +/*! Production:: escape_char : ESCAPE_CHAR */ + this.$ = yytext; +break; +case 56 : +/*! Production:: range_regex : RANGE_REGEX */ + this.$ = yytext; +break; +case 57 : +/*! Production:: string : STRING_LIT */ + this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +break; +} +}, +table: [{3:1,4:2,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{1:[3]},{5:[1,8]},{4:9,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{4:10,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{5:[2,35],11:[2,35],12:[2,35],13:11,14:[2,35],16:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:35,11:[2,28],19:36,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,5]},{5:[2,6]},{5:[2,8],11:[2,8],12:[2,8],14:[2,8],16:[2,8]},{5:[2,31],11:[2,31],12:[2,31],14:[2,31],16:[2,31],22:[2,31],33:[1,39]},{5:[2,34],11:[2,34],12:[2,34],14:[2,34],16:[2,34],22:[2,34],33:[2,34],35:40,36:[1,15],37:[2,34],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,37],11:[2,37],12:[2,37],14:[2,37],16:[2,37],22:[2,37],30:[1,42],33:[2,37],36:[2,37],37:[2,37],38:[2,37],39:[1,41],40:[1,43],41:[2,37],42:[2,37],44:44,46:[2,37],47:[2,37],48:[2,37],51:[2,37],52:[2,37],53:[2,37],54:[1,45],55:[2,37],56:[2,37]},{32:46,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{32:47,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:48,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:49,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,45],11:[2,45],12:[2,45],14:[2,45],16:[2,45],22:[2,45],30:[2,45],33:[2,45],36:[2,45],37:[2,45],38:[2,45],39:[2,45],40:[2,45],41:[2,45],42:[2,45],46:[2,45],47:[2,45],48:[2,45],51:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45],56:[2,45]},{5:[2,47],11:[2,47],12:[2,47],14:[2,47],16:[2,47],22:[2,47],30:[2,47],33:[2,47],36:[2,47],37:[2,47],38:[2,47],39:[2,47],40:[2,47],41:[2,47],42:[2,47],46:[2,47],47:[2,47],48:[2,47],51:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47],56:[2,47]},{5:[2,48],11:[2,48],12:[2,48],14:[2,48],16:[2,48],22:[2,48],30:[2,48],33:[2,48],36:[2,48],37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],42:[2,48],46:[2,48],47:[2,48],48:[2,48],51:[2,48],52:[2,48],53:[2,48],54:[2,48],55:[2,48],56:[2,48]},{5:[2,49],11:[2,49],12:[2,49],14:[2,49],16:[2,49],22:[2,49],30:[2,49],33:[2,49],36:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],42:[2,49],46:[2,49],47:[2,49],48:[2,49],51:[2,49],52:[2,49],53:[2,49],54:[2,49],55:[2,49],56:[2,49]},{5:[2,50],11:[2,50],12:[2,50],14:[2,50],16:[2,50],22:[2,50],30:[2,50],33:[2,50],36:[2,50],37:[2,50],38:[2,50],39:[2,50],40:[2,50],41:[2,50],42:[2,50],46:[2,50],47:[2,50],48:[2,50],51:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50],56:[2,50]},{5:[2,51],11:[2,51],12:[2,51],14:[2,51],16:[2,51],22:[2,51],30:[2,51],33:[2,51],36:[2,51],37:[2,51],38:[2,51],39:[2,51],40:[2,51],41:[2,51],42:[2,51],46:[2,51],47:[2,51],48:[2,51],51:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51],56:[2,51]},{5:[2,52],11:[2,52],12:[2,52],14:[2,52],16:[2,52],22:[2,52],30:[2,52],33:[2,52],36:[2,52],37:[2,52],38:[2,52],39:[2,52],40:[2,52],41:[2,52],42:[2,52],46:[2,52],47:[2,52],48:[2,52],51:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52],56:[2,52]},{5:[2,53],11:[2,53],12:[2,53],14:[2,53],16:[2,53],22:[2,53],30:[2,53],33:[2,53],36:[2,53],37:[2,53],38:[2,53],39:[2,53],40:[2,53],41:[2,53],42:[2,53],46:[2,53],47:[2,53],48:[2,53],51:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53],56:[2,53]},{5:[2,54],11:[2,54],12:[2,54],14:[2,54],16:[2,54],22:[2,54],30:[2,54],33:[2,54],36:[2,54],37:[2,54],38:[2,54],39:[2,54],40:[2,54],41:[2,54],42:[2,54],46:[2,54],47:[2,54],48:[2,54],51:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54],56:[2,54]},{5:[2,57],11:[2,57],12:[2,57],14:[2,57],16:[2,57],22:[2,57],30:[2,57],33:[2,57],36:[2,57],37:[2,57],38:[2,57],39:[2,57],40:[2,57],41:[2,57],42:[2,57],46:[2,57],47:[2,57],48:[2,57],51:[2,57],52:[2,57],53:[2,57],54:[2,57],55:[2,57],56:[2,57]},{5:[2,58],11:[2,58],12:[2,58],14:[2,58],16:[2,58],22:[2,58],30:[2,58],33:[2,58],36:[2,58],37:[2,58],38:[2,58],39:[2,58],40:[2,58],41:[2,58],42:[2,58],46:[2,58],47:[2,58],48:[2,58],51:[2,58],52:[2,58],53:[2,58],54:[2,58],55:[2,58],56:[2,58]},{5:[2,55],11:[2,55],12:[2,55],14:[2,55],16:[2,55],22:[2,55],30:[2,55],33:[2,55],36:[2,55],37:[2,55],38:[2,55],39:[2,55],40:[2,55],41:[2,55],42:[2,55],46:[2,55],47:[2,55],48:[2,55],51:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55],56:[2,55]},{5:[2,9],11:[2,9],12:[2,9],14:[2,9],16:[2,9],18:[1,50]},{5:[2,11],11:[2,11],12:[2,11],14:[2,11],16:[2,11],18:[2,11]},{5:[2,10],11:[2,10],12:[2,10],14:[2,10],16:[2,10],18:[1,51]},{5:[2,13],11:[2,13],12:[2,13],14:[2,13],16:[2,13],18:[2,13]},{5:[1,55],7:52,8:[1,54],11:[2,28],19:53,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,16],8:[2,16],11:[2,16],22:[2,16],27:[2,16],33:[2,16],36:[2,16],38:[2,16],41:[2,16],42:[2,16],46:[2,16],47:[2,16],48:[2,16],51:[2,16],52:[2,16],53:[2,16],55:[2,16],56:[2,16]},{11:[2,35],13:56,22:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{12:[1,59],28:57,30:[1,58]},{5:[2,33],11:[2,33],12:[2,33],14:[2,33],16:[2,33],22:[2,33],33:[2,33],34:60,35:14,36:[1,15],37:[2,33],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,36],11:[2,36],12:[2,36],14:[2,36],16:[2,36],22:[2,36],30:[1,42],33:[2,36],36:[2,36],37:[2,36],38:[2,36],39:[1,41],40:[1,43],41:[2,36],42:[2,36],44:44,46:[2,36],47:[2,36],48:[2,36],51:[2,36],52:[2,36],53:[2,36],54:[1,45],55:[2,36],56:[2,36]},{5:[2,40],11:[2,40],12:[2,40],14:[2,40],16:[2,40],22:[2,40],30:[2,40],33:[2,40],36:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],42:[2,40],46:[2,40],47:[2,40],48:[2,40],51:[2,40],52:[2,40],53:[2,40],54:[2,40],55:[2,40],56:[2,40]},{5:[2,41],11:[2,41],12:[2,41],14:[2,41],16:[2,41],22:[2,41],30:[2,41],33:[2,41],36:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],42:[2,41],46:[2,41],47:[2,41],48:[2,41],51:[2,41],52:[2,41],53:[2,41],54:[2,41],55:[2,41],56:[2,41]},{5:[2,42],11:[2,42],12:[2,42],14:[2,42],16:[2,42],22:[2,42],30:[2,42],33:[2,42],36:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],42:[2,42],46:[2,42],47:[2,42],48:[2,42],51:[2,42],52:[2,42],53:[2,42],54:[2,42],55:[2,42],56:[2,42]},{5:[2,46],11:[2,46],12:[2,46],14:[2,46],16:[2,46],22:[2,46],30:[2,46],33:[2,46],36:[2,46],37:[2,46],38:[2,46],39:[2,46],40:[2,46],41:[2,46],42:[2,46],46:[2,46],47:[2,46],48:[2,46],51:[2,46],52:[2,46],53:[2,46],54:[2,46],55:[2,46],56:[2,46]},{5:[2,56],11:[2,56],12:[2,56],14:[2,56],16:[2,56],22:[2,56],30:[2,56],33:[2,56],36:[2,56],37:[2,56],38:[2,56],39:[2,56],40:[2,56],41:[2,56],42:[2,56],46:[2,56],47:[2,56],48:[2,56],51:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56],56:[2,56]},{33:[1,39],37:[1,61]},{33:[1,39],37:[1,62]},{5:[2,43],11:[2,43],12:[2,43],14:[2,43],16:[2,43],22:[2,43],30:[1,42],33:[2,43],36:[2,43],37:[2,43],38:[2,43],39:[1,41],40:[1,43],41:[2,43],42:[2,43],44:44,46:[2,43],47:[2,43],48:[2,43],51:[2,43],52:[2,43],53:[2,43],54:[1,45],55:[2,43],56:[2,43]},{5:[2,44],11:[2,44],12:[2,44],14:[2,44],16:[2,44],22:[2,44],30:[1,42],33:[2,44],36:[2,44],37:[2,44],38:[2,44],39:[1,41],40:[1,43],41:[2,44],42:[2,44],44:44,46:[2,44],47:[2,44],48:[2,44],51:[2,44],52:[2,44],53:[2,44],54:[1,45],55:[2,44],56:[2,44]},{5:[2,12],11:[2,12],12:[2,12],14:[2,12],16:[2,12],18:[2,12]},{5:[2,14],11:[2,14],12:[2,14],14:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{5:[2,15],8:[2,15],11:[2,15],22:[2,15],27:[2,15],33:[2,15],36:[2,15],38:[2,15],41:[2,15],42:[2,15],46:[2,15],47:[2,15],48:[2,15],51:[2,15],52:[2,15],53:[2,15],55:[2,15],56:[2,15]},{1:[2,2]},{8:[1,63],9:[1,64]},{11:[1,67],21:65,22:[1,66]},{29:[1,68],31:[1,69]},{29:[1,70]},{29:[2,29],31:[2,29]},{5:[2,32],11:[2,32],12:[2,32],14:[2,32],16:[2,32],22:[2,32],33:[2,32],35:40,36:[1,15],37:[2,32],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,38],11:[2,38],12:[2,38],14:[2,38],16:[2,38],22:[2,38],30:[2,38],33:[2,38],36:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],41:[2,38],42:[2,38],46:[2,38],47:[2,38],48:[2,38],51:[2,38],52:[2,38],53:[2,38],54:[2,38],55:[2,38],56:[2,38]},{5:[2,39],11:[2,39],12:[2,39],14:[2,39],16:[2,39],22:[2,39],30:[2,39],33:[2,39],36:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],41:[2,39],42:[2,39],46:[2,39],47:[2,39],48:[2,39],51:[2,39],52:[2,39],53:[2,39],54:[2,39],55:[2,39],56:[2,39]},{1:[2,3]},{8:[1,71]},{5:[2,17],8:[2,17],11:[2,17],22:[2,17],27:[2,17],33:[2,17],36:[2,17],38:[2,17],41:[2,17],42:[2,17],46:[2,17],47:[2,17],48:[2,17],51:[2,17],52:[2,17],53:[2,17],55:[2,17],56:[2,17]},{22:[2,20],23:72,24:[2,20],25:73,26:[1,74]},{5:[2,19],8:[2,19],11:[2,19],22:[2,19],27:[2,19],33:[2,19],36:[2,19],38:[2,19],41:[2,19],42:[2,19],46:[2,19],47:[2,19],48:[2,19],51:[2,19],52:[2,19],53:[2,19],55:[2,19],56:[2,19]},{11:[2,26],22:[2,26],33:[2,26],36:[2,26],38:[2,26],41:[2,26],42:[2,26],46:[2,26],47:[2,26],48:[2,26],51:[2,26],52:[2,26],53:[2,26],55:[2,26],56:[2,26]},{12:[1,75]},{11:[2,27],22:[2,27],33:[2,27],36:[2,27],38:[2,27],41:[2,27],42:[2,27],46:[2,27],47:[2,27],48:[2,27],51:[2,27],52:[2,27],53:[2,27],55:[2,27],56:[2,27]},{1:[2,4]},{22:[1,77],24:[1,76]},{22:[2,21],24:[2,21],26:[1,78]},{22:[2,24],24:[2,24],26:[2,24]},{29:[2,30],31:[2,30]},{5:[2,18],8:[2,18],11:[2,18],22:[2,18],27:[2,18],33:[2,18],36:[2,18],38:[2,18],41:[2,18],42:[2,18],46:[2,18],47:[2,18],48:[2,18],51:[2,18],52:[2,18],53:[2,18],55:[2,18],56:[2,18]},{22:[2,20],23:79,24:[2,20],25:73,26:[1,74]},{22:[2,25],24:[2,25],26:[2,25]},{22:[1,77],24:[1,80]},{22:[2,23],24:[2,23],25:81,26:[1,74]},{22:[2,22],24:[2,22],26:[1,78]}], +defaultActions: {9:[2,5],10:[2,6],52:[2,1],54:[2,2],63:[2,3],71:[2,4]}, +parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + throw new Error(str); + } +}, +parse: function parse(input) { + var self = this, + stack = [0], + vstack = [null], // semantic value stack + lstack = [], // location stack + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + + var args = lstack.slice.call(arguments, 1); + + //this.reductionCount = this.shiftCount = 0; + + this.lexer.setInput(input); + this.lexer.yy = this.yy; + this.yy.lexer = this.lexer; + this.yy.parser = this; + if (typeof this.lexer.yylloc === 'undefined') { + this.lexer.yylloc = {}; + } + var yyloc = this.lexer.yylloc; + lstack.push(yyloc); + + var ranges = this.lexer.options && this.lexer.options.ranges; + + if (typeof this.yy.parseError === 'function') { + this.parseError = this.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ + } + + function popStack (n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + + function lex() { + var token; + token = self.lexer.lex() || EOF; // $end = 1 + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + } + + var symbol; + var preErrorSymbol = null; + var state, action, a, r; + var yyval = {}; + var p, len, newState; + var expected = []; + var retval = false; + + if (this.pre_parse) { + this.pre_parse(this.yy); + } + if (this.yy.pre_parse) { + this.yy.pre_parse(this.yy); + } + + try { + for (;;) { + // retreive state number from top of stack + state = stack[stack.length - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol === 'undefined') { + symbol = lex(); + } + // read action for current state and first input + action = table[state] && table[state][symbol]; + } + + // handle parse error + if (typeof action === 'undefined' || !action.length || !action[0]) { + var error_rule_depth; + var errStr = ''; + + // Return the rule stack depth where the nearest error rule can be found. + // Return FALSE when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = stack.length - 1; + var depth = 0; + + // try to recover from error + for(;;) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + return depth; + } + if (state === 0 || stack_probe < 2) { + return false; // No suitable error recovery rule available. + } + stack_probe -= 2; // popStack(1): [symbol, action] + state = stack[stack_probe]; + ++depth; + } + } + + if (!recovering) { + // first see if there's any chance at hitting an error recovery rule: + error_rule_depth = locateNearestErrorRecoveryRule(state); + + // Report error + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (this.lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + + (symbol == EOF ? "end of input" : + ("'" + (this.terminals_[symbol] || symbol) + "'")); + } + a = this.parseError(errStr, p = { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: (error_rule_depth !== false) + }); + if (!p.recoverable) { + retval = a; + break; + } + } else if (preErrorSymbol !== EOF) { + error_rule_depth = locateNearestErrorRecoveryRule(state); + } + + // just recovered from another error + if (recovering == 3) { + if (symbol === EOF || preErrorSymbol === EOF) { + retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + + // discard current lookahead and grab another + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + symbol = lex(); + } + + // try to recover from error + if (error_rule_depth === false) { + retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + popStack(error_rule_depth); + + preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length-1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } + + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array && action.length > 1) { + retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { + text: this.lexer.match, + token: this.terminals_[symbol] || symbol, + line: this.lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + + switch (action[0]) { + case 1: // shift + //this.shiftCount++; + + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); // push state + symbol = null; + if (!preErrorSymbol) { // normal execution / no error + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + // error just occurred, resume old lookahead f/ before error + symbol = preErrorSymbol; + preErrorSymbol = null; + } + continue; + + case 2: + // reduce + //this.reductionCount++; + + len = this.productions_[action[1]][1]; + + // perform semantic action + yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 + // default location, uses first token for firsts, last for lasts + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack].concat(args)); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + + stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + vstack.push(yyval.$); + lstack.push(yyval._$); + // goto new state = table[STATE][NONTERMINAL] + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + continue; + + case 3: + // accept + retval = true; + break; + } + + // break out of loop: we accept or fail with error + break; + } + } finally { + var rv; + + if (this.yy.post_parse) { + rv = this.yy.post_parse(this.yy, retval); + if (typeof rv !== 'undefined') retval = rv; + } + if (this.post_parse) { + rv = this.post_parse(this.yy, retval); + if (typeof rv !== 'undefined') retval = rv; + } + } + + return retval; +}}; + + +function encodeRE (s) { + return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); +} + +function prepareString (s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; +}; + +/* generated by jison-lex 0.2.1 */ +var lexer = (function(){ +var lexer = { + +EOF:1, + +ERROR:2, + +parseError:function parseError(str, hash) { + if (this.yy.parser) { + return this.yy.parser.parseError(str, hash) || this.ERROR; + } else { + throw new Error(str); + } + }, + +// resets the lexer, sets new input +setInput:function (input) { + this._input = input; + this._more = this._backtrack = this._signaled_error_token = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + +// consumes and returns one char from the input +input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + + this._input = this._input.slice(1); + return ch; + }, + +// unshifts one char (or a string) into the input +unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + +// When called from action, caches matched text and appends it on next action +more:function () { + this._more = true; + return this; + }, + +// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +reject:function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + // when the parseError() call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // .lex() run. + this._signaled_error_token = (this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: this.match, + token: null, + line: this.yylineno + }) || this.ERROR); + } + return this; + }, + +// retain first n characters of the match +less:function (n) { + this.unput(this.match.slice(n)); + }, + +// return (part of the) already matched input, i.e. for error messages +pastInput:function (maxSize) { + var past = this.matched.substr(0, this.matched.length - this.match.length); + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + return (past.length > maxSize ? '...' + past.substr(-maxSize) : past); + }, + +// return (part of the) upcoming input, i.e. for error messages +upcomingInput:function (maxSize) { + var next = this.match; + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + if (next.length < maxSize) { + next += this._input.substr(0, maxSize - next.length); + } + return (next.length > maxSize ? next.substr(0, maxSize) + '...' : next); + }, + +// return a string which displays the character position where the lexing error occurred, i.e. for error messages +showPosition:function () { + var pre = this.pastInput().replace(/\s/g, " "); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput().replace(/\s/g, " ") + "\n" + c + "^"; + }, + +// test the lexed token: return FALSE when not a match, otherwise return token +test_match:function (match, indexed_rule) { + var token, + lines, + backup; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? + lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + this._signaled_error_token = false; + return token; + } + return false; + }, + +// return next match in input +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + + var token, + match, + tempMatch, + index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: this.match + this._input, + token: null, + line: this.yylineno + }) || this.ERROR; + if (token === this.ERROR || token === this.EOF) { + // we cannot recover from a lexer error that parseError() did not 'recover' for us: we consider the input completely lexed: + this.done = true; + } + } + }, + +// return next match that has a token +lex:function lex() { + var r; + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + while (!r) { + r = this.next(); + }; + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + return r; + }, + +// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +begin:function begin(condition) { + this.conditionStack.push(condition); + }, + +// pop the previously active lexer condition state off the condition stack +popState:function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + +// produce the lexer rule set which is active for the currently active lexer condition state +_currentRules:function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + +// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +topState:function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + +// alias for begin(condition) +pushState:function pushState(condition) { + this.begin(condition); + }, + +// return the number of states currently on the stack +stateStackSize:function stateStackSize() { + return this.conditionStack.length; + }, +options: {"easy_keyword_rules":true}, +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START +/**/) { + +var YYSTATE=YY_START; +switch($avoiding_name_collisions) { +case 0 : +/*! Conditions:: action */ +/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + return 26; +break; +case 1 : +/*! Conditions:: action */ +/*! Rule:: \/\/.* */ + return 26; +break; +case 2 : +/*! Conditions:: action */ +/*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ + return 26; // regexp with braces or quotes (and no spaces) +break; +case 3 : +/*! Conditions:: action */ +/*! Rule:: "(\\\\|\\"|[^"])*" */ + return 26; +break; +case 4 : +/*! Conditions:: action */ +/*! Rule:: '(\\\\|\\'|[^'])*' */ + return 26; +break; +case 5 : +/*! Conditions:: action */ +/*! Rule:: [/"'][^{}/"']+ */ + return 26; +break; +case 6 : +/*! Conditions:: action */ +/*! Rule:: [^{}/"']+ */ + return 26; +break; +case 7 : +/*! Conditions:: action */ +/*! Rule:: \{ */ + yy.depth++; return 22; +break; +case 8 : +/*! Conditions:: action */ +/*! Rule:: \} */ + if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 24; +break; +case 9 : +/*! Conditions:: conditions */ +/*! Rule:: {NAME} */ + return 12; +break; +case 10 : +/*! Conditions:: conditions */ +/*! Rule:: > */ + this.popState(); return 29; +break; +case 11 : +/*! Conditions:: conditions */ +/*! Rule:: , */ + return 31; +break; +case 12 : +/*! Conditions:: conditions */ +/*! Rule:: \* */ + return 30; +break; +case 13 : +/*! Conditions:: rules */ +/*! Rule:: {BR}+ */ + /* empty */ +break; +case 14 : +/*! Conditions:: rules */ +/*! Rule:: \s+{BR}+ */ + /* empty */ +break; +case 15 : +/*! Conditions:: rules */ +/*! Rule:: \s+ */ + this.begin('indented'); +break; +case 16 : +/*! Conditions:: rules */ +/*! Rule:: %% */ + this.begin('code'); return 5; +break; +case 17 : +/*! Conditions:: rules */ +/*! Rule:: [a-zA-Z0-9_]+ */ + return 56; +break; +case 18 : +/*! Conditions:: options */ +/*! Rule:: {NAME} */ + yy.options[yy_.yytext] = true; +break; +case 19 : +/*! Conditions:: options */ +/*! Rule:: {BR}+ */ + this.begin('INITIAL'); +break; +case 20 : +/*! Conditions:: options */ +/*! Rule:: \s+{BR}+ */ + this.begin('INITIAL'); +break; +case 21 : +/*! Conditions:: options */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 22 : +/*! Conditions:: start_condition */ +/*! Rule:: {NAME} */ + return 18; +break; +case 23 : +/*! Conditions:: start_condition */ +/*! Rule:: {BR}+ */ + this.begin('INITIAL'); +break; +case 24 : +/*! Conditions:: start_condition */ +/*! Rule:: \s+{BR}+ */ + this.begin('INITIAL'); +break; +case 25 : +/*! Conditions:: start_condition */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 26 : +/*! Conditions:: trail */ +/*! Rule:: \s*{BR}+ */ + this.begin('rules'); +break; +case 27 : +/*! Conditions:: indented */ +/*! Rule:: \{ */ + yy.depth = 0; this.begin('action'); return 22; +break; +case 28 : +/*! Conditions:: indented */ +/*! Rule:: %\{(.|{BR})*?%\} */ + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; +break; +case 29 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %\{(.|{BR})*?%\} */ + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; +break; +case 30 : +/*! Conditions:: indented */ +/*! Rule:: .+ */ + this.begin('rules'); return 11; +break; +case 31 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /* ignore */ +break; +case 32 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/\/.* */ + /* ignore */ +break; +case 33 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: {BR}+ */ + /* empty */ +break; +case 34 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 35 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: {NAME} */ + return 12; +break; +case 36 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: "(\\\\|\\"|[^"])*" */ + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 55; +break; +case 37 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: '(\\\\|\\'|[^'])*' */ + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; +break; +case 38 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \| */ + return 33; +break; +case 39 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ + return 52; +break; +case 40 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \(\?: */ + return 38; +break; +case 41 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \(\?= */ + return 38; +break; +case 42 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \(\?! */ + return 38; +break; +case 43 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \( */ + return 36; +break; +case 44 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \) */ + return 37; +break; +case 45 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \+ */ + return 39; +break; +case 46 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \* */ + return 30; +break; +case 47 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \? */ + return 40; +break; +case 48 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \^ */ + return 47; +break; +case 49 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: , */ + return 31; +break; +case 50 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: <> */ + return 48; +break; +case 51 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: < */ + this.begin('conditions'); return 27; +break; +case 52 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/! */ + return 42; +break; +case 53 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/ */ + return 41; +break; +case 54 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + return 53; +break; +case 55 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; +break; +case 56 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \$ */ + return 48; +break; +case 57 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \. */ + return 46; +break; +case 58 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %options\b */ + if (!yy.options) { yy.options = {}; } this.begin('options'); +break; +case 59 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %s\b */ + this.begin('start_condition'); return 14; +break; +case 60 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %x\b */ + this.begin('start_condition'); return 16; +break; +case 61 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %% */ + this.begin('rules'); return 5; +break; +case 62 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \{\d+(,\s?\d+|,)?\} */ + return 54; +break; +case 63 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \{{NAME}\} */ + return 51; +break; +case 64 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \{ */ + return 22; +break; +case 65 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \} */ + return 24; +break; +case 66 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: . */ + throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ +break; +case 67 : +/*! Conditions:: * */ +/*! Rule:: $ */ + return 8; +break; +case 68 : +/*! Conditions:: code */ +/*! Rule:: (.|{BR})+ */ + return 9; +break; +} +}, +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} +}; +return lexer; +})(); +parser.lexer = lexer; +function Parser () { + this.yy = {}; +} +Parser.prototype = parser;parser.Parser = Parser; +return new Parser; +})(); + + +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { +exports.parser = lexParser; +exports.Parser = lexParser.Parser; +exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; +exports.main = function commonjsMain(args) { + if (!args[1]) { + console.log('Usage: '+args[0]+' FILE'); + process.exit(1); + } + var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); + return exports.parser.parse(source); +}; +if (typeof module !== 'undefined' && require.main === module) { + exports.main(process.argv.slice(1)); +} +} \ No newline at end of file From 15c7645201cc4574eb77ed2ccd8b1aef08ee1e0f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Dec 2013 21:23:16 +0100 Subject: [PATCH 042/417] regenerated library files --- lex-parser.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lex-parser.js b/lex-parser.js index 2ff741c..85e05ee 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -948,6 +948,7 @@ next:function () { // we cannot recover from a lexer error that parseError() did not 'recover' for us: we consider the input completely lexed: this.done = true; } + return token; } }, From 8bff8235a7a3b1ceb44ceb8056806c5e78baa865 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Dec 2013 00:31:02 +0100 Subject: [PATCH 043/417] regenerated library files --- lex-parser.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 85e05ee..c0dcb03 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -704,7 +704,10 @@ input:function () { this.offset++; this.match += ch; this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); + // Count the linenumber up when we hit the LF (or a stand-alone CR). + // On CRLF, the linenumber is incremented when you fetch the LF: + // the CR is hence 'assigned' to the previous line. + var lines = this._input.match(/^(?:\r[^\n]|\r$|\n)/); if (lines) { this.yylineno++; this.yylloc.last_line++; @@ -891,7 +894,15 @@ test_match:function (match, indexed_rule) { // return next match in input next:function () { + function clear() { + this.yytext = ''; + this.match = ''; + this._more = false; + this._backtrack = false; + } + if (this.done) { + clear.call(this); return this.EOF; } if (!this._input) { @@ -903,8 +914,7 @@ next:function () { tempMatch, index; if (!this._more) { - this.yytext = ''; - this.match = ''; + clear.call(this); } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { @@ -937,6 +947,8 @@ next:function () { return false; } if (this._input === "") { + clear.call(this); + this.done = true; return this.EOF; } else { token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { @@ -944,9 +956,11 @@ next:function () { token: null, line: this.yylineno }) || this.ERROR; - if (token === this.ERROR || token === this.EOF) { - // we cannot recover from a lexer error that parseError() did not 'recover' for us: we consider the input completely lexed: - this.done = true; + if (token === this.ERROR) { + // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward one character at a time: + if (!this.match.length) { + this.input(); + } } return token; } From 27b6a125321212b162e60a2d03f1faaab8fe5947 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Dec 2013 00:46:43 +0100 Subject: [PATCH 044/417] pass the yyloc (.loc) location info to lexer parseError handlers, just like we do already for parser-based pars$ --- lex-parser.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index c0dcb03..d9504f2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -774,7 +774,8 @@ reject:function () { this._signaled_error_token = (this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { text: this.match, token: null, - line: this.yylineno + line: this.yylineno, + loc: this.yyloc }) || this.ERROR); } return this; @@ -954,7 +955,8 @@ next:function () { token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { text: this.match + this._input, token: null, - line: this.yylineno + line: this.yylineno, + loc: this.yyloc }) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward one character at a time: From e7c487ae5280fcbfa22f1297f22d41966e729d18 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Dec 2013 03:52:25 +0100 Subject: [PATCH 045/417] clean of EOF forgot to clean the .matches[] and .yyleng attributes. --- lex-parser.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lex-parser.js b/lex-parser.js index d9504f2..24b3b69 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -897,7 +897,9 @@ test_match:function (match, indexed_rule) { next:function () { function clear() { this.yytext = ''; + this.yyleng = 0; this.match = ''; + this.matches = false; this._more = false; this._backtrack = false; } From 64d53cf082d009cc96d7caf6a0f59f0ab44f000e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 28 Apr 2014 23:17:55 +0200 Subject: [PATCH 046/417] regenerated parser using vanilla jison while we upgrade... --- lex-parser.js | 601 +++++++++++++------------------------------------- package.json | 2 +- 2 files changed, 151 insertions(+), 452 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 24b3b69..a1885aa 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.13 */ +/* parser generated by jison 0.4.11 */ /* Returns a Parser object of the following structure: @@ -12,8 +12,7 @@ symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), - (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), @@ -38,9 +37,12 @@ _currentRules: function(), topState: function(), pushState: function(condition), - stateStackSize: function(), - options: { ... }, + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], @@ -65,55 +67,8 @@ } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) - expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) - recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) - } - - You can specify parser options by setting / modifying the `.yy` object of your Parser instance. - These options are available: - - ### options which are global for all parser instances - - Parser.pre_parse: function(yy) - optional: you can specify a pre_parse() function in the chunk following the grammar, - i.e. after the last `%%`. - Parser.post_parse: function(yy, retval) { return retval; } - optional: you can specify a post_parse() function in the chunk following the grammar, - i.e. after the last `%%`. When it does not return any value, the parser will return - the original `retval`. - - ### options which can be set up per parser instance - - yy: { - pre_parse: function(yy) - optional: is invoked before the parse cycle starts (and before the first invocation - of `lex()`) but immediately after the invocation of parser.pre_parse()). - post_parse: function(yy, retval) { return retval; } - optional: is invoked when the parse terminates due to success ('accept') or failure - (even when exceptions are thrown). `retval` contains the return value to be produced - by `Parser.parse()`; this function can override the return value by returning another. - When it does not return any value, the parser will return the original `retval`. - This function is invoked immediately before `Parser.post_parse()`. - parseError: function(str, hash) - optional: overrides the default `parseError` function. - } - - parser.lexer.options: { - ranges: boolean optional: true ==> token location info will include a .range[] member. - flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested - exhaustively to find the longest match. - backtrack_lexer: boolean - optional: true ==> lexer regexes are tested in order and for each matching - regex the action code is invoked; the lexer terminates - the scan when a token is returned by the action code. - pre_lex: function() - optional: is invoked before the lexer is invoked to produce another token. - `this` refers to the Lexer object. - post_lex: function(token) { return token; } - optional: is invoked when the lexer has produced a token `token`; - this function can override the returned token value by returning another. - When it does not return any (truthy) value, the lexer will return the original `token`. - `this` refers to the Lexer object. + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ var lexParser = (function(){ @@ -122,15 +77,12 @@ yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"START_COND",22:"{",24:"}",26:"ACTION_BODY",27:"<",29:">",30:"*",31:",",33:"|",36:"(",37:")",38:"SPECIAL_GROUP",39:"+",40:"?",41:"/",42:"/!",46:".",47:"^",48:"$",51:"NAME_BRACE",52:"ANY_GROUP_REGEX",53:"ESCAPE_CHAR",54:"RANGE_REGEX",55:"STRING_LIT",56:"CHARACTER_LIT"}, productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[19,3],[21,3],[21,1],[23,0],[23,1],[23,5],[23,4],[25,1],[25,2],[20,3],[20,3],[20,0],[28,1],[28,3],[13,1],[32,3],[32,2],[32,1],[32,0],[34,2],[34,1],[35,3],[35,3],[35,2],[35,2],[35,2],[35,2],[35,2],[35,1],[35,2],[35,1],[35,1],[35,1],[35,1],[35,1],[35,1],[43,1],[45,1],[50,1],[44,1],[49,1],[49,1]], -performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */ -/**/) { +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { -case 1 : -/*! Production:: lex : definitions %% rules epilogue */ - +case 1: this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; @@ -140,23 +92,15 @@ case 1 : delete yy.options; delete yy.actionInclude; return this.$; - + break; -case 2 : -/*! Production:: epilogue : EOF */ - this.$ = null; +case 2: this.$ = null; break; -case 3 : -/*! Production:: epilogue : %% EOF */ - this.$ = null; +case 3: this.$ = null; break; -case 4 : -/*! Production:: epilogue : %% CODE EOF */ - this.$ = $$[$0-1]; +case 4: this.$ = $$[$0-1]; break; -case 5 : -/*! Production:: definitions : definition definitions */ - +case 5: this.$ = $$[$0]; if ('length' in $$[$0-1]) { this.$[0] = this.$[0] || {}; @@ -167,188 +111,100 @@ case 5 : this.$[1][name] = $$[$0-1][name]; } } - + break; -case 6 : -/*! Production:: definitions : ACTION definitions */ - yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; break; -case 7 : -/*! Production:: definitions : */ - yy.actionInclude = ''; this.$ = [null,null]; +case 7: yy.actionInclude = ''; this.$ = [null,null]; break; -case 8 : -/*! Production:: definition : NAME regex */ - this.$ = [$$[$0-1], $$[$0]]; +case 8: this.$ = [$$[$0-1], $$[$0]]; break; -case 9 : -/*! Production:: definition : START_INC names_inclusive */ - this.$ = $$[$0]; +case 9: this.$ = $$[$0]; break; -case 10 : -/*! Production:: definition : START_EXC names_exclusive */ - this.$ = $$[$0]; +case 10: this.$ = $$[$0]; break; -case 11 : -/*! Production:: names_inclusive : START_COND */ - this.$ = {}; this.$[$$[$0]] = 0; +case 11: this.$ = {}; this.$[$$[$0]] = 0; break; -case 12 : -/*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; break; -case 13 : -/*! Production:: names_exclusive : START_COND */ - this.$ = {}; this.$[$$[$0]] = 1; +case 13: this.$ = {}; this.$[$$[$0]] = 1; break; -case 14 : -/*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; break; -case 15 : -/*! Production:: rules : rules rule */ - this.$ = $$[$0-1]; this.$.push($$[$0]); +case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 16 : -/*! Production:: rules : rule */ - this.$ = [$$[$0]]; +case 16: this.$ = [$$[$0]]; break; -case 17 : -/*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; +case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; -case 18 : -/*! Production:: action : { action_body } */ - this.$ = $$[$0-1]; +case 18:this.$ = $$[$0-1]; break; -case 19 : -/*! Production:: action : ACTION */ - this.$ = $$[$0]; +case 19:this.$ = $$[$0]; break; -case 20 : -/*! Production:: action_body : */ - this.$ = ''; +case 20:this.$ = ''; break; -case 21 : -/*! Production:: action_body : action_comments_body */ - this.$ = $$[$0]; +case 21:this.$ = $$[$0]; break; -case 22 : -/*! Production:: action_body : action_body { action_body } action_comments_body */ - this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 23 : -/*! Production:: action_body : action_body { action_body } */ - this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24 : -/*! Production:: action_comments_body : ACTION_BODY */ - this.$ = yytext; +case 24: this.$ = yytext; break; -case 25 : -/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - this.$ = $$[$0-1] + $$[$0]; +case 25: this.$ = $$[$0-1] + $$[$0]; break; -case 26 : -/*! Production:: start_conditions : < name_list > */ - this.$ = $$[$0-1]; +case 26: this.$ = $$[$0-1]; break; -case 27 : -/*! Production:: start_conditions : < * > */ - this.$ = ['*']; +case 27: this.$ = ['*']; break; -case 29 : -/*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; +case 29: this.$ = [$$[$0]]; break; -case 30 : -/*! Production:: name_list : name_list , NAME */ - this.$ = $$[$0-2]; this.$.push($$[$0]); +case 30: this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 31 : -/*! Production:: regex : regex_list */ - +case 31: this.$ = $$[$0]; if (yy.options && yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { this.$ += "\\b"; } - + break; -case 32 : -/*! Production:: regex_list : regex_list | regex_concat */ - this.$ = $$[$0-2] + '|' + $$[$0]; +case 32: this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 33 : -/*! Production:: regex_list : regex_list | */ - this.$ = $$[$0-1] + '|'; +case 33: this.$ = $$[$0-1] + '|'; break; -case 35 : -/*! Production:: regex_list : */ - this.$ = ''; +case 35: this.$ = ''; break; -case 36 : -/*! Production:: regex_concat : regex_concat regex_base */ - this.$ = $$[$0-1] + $$[$0]; +case 36: this.$ = $$[$0-1] + $$[$0]; break; -case 38 : -/*! Production:: regex_base : ( regex_list ) */ - this.$ = '(' + $$[$0-1] + ')'; +case 38: this.$ = '(' + $$[$0-1] + ')'; break; -case 39 : -/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ - this.$ = $$[$0-2] + $$[$0-1] + ')'; +case 39: this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 40 : -/*! Production:: regex_base : regex_base + */ - this.$ = $$[$0-1] + '+'; +case 40: this.$ = $$[$0-1] + '+'; break; -case 41 : -/*! Production:: regex_base : regex_base * */ - this.$ = $$[$0-1] + '*'; +case 41: this.$ = $$[$0-1] + '*'; break; -case 42 : -/*! Production:: regex_base : regex_base ? */ - this.$ = $$[$0-1] + '?'; +case 42: this.$ = $$[$0-1] + '?'; break; -case 43 : -/*! Production:: regex_base : / regex_base */ - this.$ = '(?=' + $$[$0] + ')'; +case 43: this.$ = '(?=' + $$[$0] + ')'; break; -case 44 : -/*! Production:: regex_base : /! regex_base */ - this.$ = '(?!' + $$[$0] + ')'; +case 44: this.$ = '(?!' + $$[$0] + ')'; break; -case 46 : -/*! Production:: regex_base : regex_base range_regex */ - this.$ = $$[$0-1] + $$[$0]; +case 46: this.$ = $$[$0-1] + $$[$0]; break; -case 48 : -/*! Production:: regex_base : . */ - this.$ = '.'; +case 48: this.$ = '.'; break; -case 49 : -/*! Production:: regex_base : ^ */ - this.$ = '^'; +case 49: this.$ = '^'; break; -case 50 : -/*! Production:: regex_base : $ */ - this.$ = '$'; +case 50: this.$ = '$'; break; -case 54 : -/*! Production:: any_group_regex : ANY_GROUP_REGEX */ - this.$ = yytext; +case 54: this.$ = yytext; break; -case 55 : -/*! Production:: escape_char : ESCAPE_CHAR */ - this.$ = yytext; +case 55: this.$ = yytext; break; -case 56 : -/*! Production:: range_regex : RANGE_REGEX */ - this.$ = yytext; +case 56: this.$ = yytext; break; -case 57 : -/*! Production:: string : STRING_LIT */ - this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +case 57: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; } }, @@ -362,290 +218,134 @@ parseError: function parseError(str, hash) { } }, parse: function parse(input) { - var self = this, - stack = [0], - vstack = [null], // semantic value stack - lstack = [], // location stack - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - recovering = 0, - TERROR = 2, - EOF = 1; - + var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; var args = lstack.slice.call(arguments, 1); - - //this.reductionCount = this.shiftCount = 0; - this.lexer.setInput(input); this.lexer.yy = this.yy; this.yy.lexer = this.lexer; this.yy.parser = this; - if (typeof this.lexer.yylloc === 'undefined') { + if (typeof this.lexer.yylloc == 'undefined') { this.lexer.yylloc = {}; } var yyloc = this.lexer.yylloc; lstack.push(yyloc); - var ranges = this.lexer.options && this.lexer.options.ranges; - if (typeof this.yy.parseError === 'function') { this.parseError = this.yy.parseError; } else { - this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ + this.parseError = Object.getPrototypeOf(this).parseError; } - - function popStack (n) { + function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } - function lex() { var token; - token = self.lexer.lex() || EOF; // $end = 1 - // if token isn't its numeric value, convert + token = self.lexer.lex() || EOF; if (typeof token !== 'number') { token = self.symbols_[token] || token; } return token; } - - var symbol; - var preErrorSymbol = null; - var state, action, a, r; - var yyval = {}; - var p, len, newState; - var expected = []; - var retval = false; - - if (this.pre_parse) { - this.pre_parse(this.yy); - } - if (this.yy.pre_parse) { - this.yy.pre_parse(this.yy); - } - - try { - for (;;) { - // retreive state number from top of stack - state = stack[stack.length - 1]; - - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol === 'undefined') { - symbol = lex(); - } - // read action for current state and first input - action = table[state] && table[state][symbol]; + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); } - - // handle parse error - if (typeof action === 'undefined' || !action.length || !action[0]) { - var error_rule_depth; + action = table[state] && table[state][symbol]; + } + if (typeof action === 'undefined' || !action.length || !action[0]) { var errStr = ''; - - // Return the rule stack depth where the nearest error rule can be found. - // Return FALSE when no error recovery rule was found. - function locateNearestErrorRecoveryRule(state) { - var stack_probe = stack.length - 1; - var depth = 0; - - // try to recover from error - for(;;) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - return depth; - } - if (state === 0 || stack_probe < 2) { - return false; // No suitable error recovery rule available. - } - stack_probe -= 2; // popStack(1): [symbol, action] - state = stack[stack_probe]; - ++depth; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); } } - - if (!recovering) { - // first see if there's any chance at hitting an error recovery rule: - error_rule_depth = locateNearestErrorRecoveryRule(state); - - // Report error - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push("'" + this.terminals_[p] + "'"); - } - } - if (this.lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + - (symbol == EOF ? "end of input" : - ("'" + (this.terminals_[symbol] || symbol) + "'")); - } - a = this.parseError(errStr, p = { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: (error_rule_depth !== false) - }); - if (!p.recoverable) { - retval = a; - break; - } - } else if (preErrorSymbol !== EOF) { - error_rule_depth = locateNearestErrorRecoveryRule(state); - } - - // just recovered from another error - if (recovering == 3) { - if (symbol === EOF || preErrorSymbol === EOF) { - retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; - } - - // discard current lookahead and grab another - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - symbol = lex(); - } - - // try to recover from error - if (error_rule_depth === false) { - retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { - text: this.lexer.match, - token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; + if (this.lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + this.lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); } - popStack(error_rule_depth); - - preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { + this.parseError(errStr, { text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, - expected: expected, - recoverable: false + expected: expected }); - break; } - - switch (action[0]) { - case 1: // shift - //this.shiftCount++; - - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); // push state - symbol = null; - if (!preErrorSymbol) { // normal execution / no error - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) { - recovering--; - } - } else { - // error just occurred, resume old lookahead f/ before error - symbol = preErrorSymbol; - preErrorSymbol = null; - } - continue; - - case 2: - // reduce - //this.reductionCount++; - - len = this.productions_[action[1]][1]; - - // perform semantic action - yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 - // default location, uses first token for firsts, last for lasts - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; - } - r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack].concat(args)); - - if (typeof r !== 'undefined') { - retval = r; - break; - } - - // pop off stack - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(this.lexer.yytext); + lstack.push(this.lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = this.lexer.yyleng; + yytext = this.lexer.yytext; + yylineno = this.lexer.yylineno; + yyloc = this.lexer.yylloc; + if (recovering > 0) { + recovering--; } - - stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) - vstack.push(yyval.$); - lstack.push(yyval._$); - // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); - continue; - - case 3: - // accept - retval = true; - break; + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; } - - // break out of loop: we accept or fail with error break; - } - } finally { - var rv; - - if (this.yy.post_parse) { - rv = this.yy.post_parse(this.yy, retval); - if (typeof rv !== 'undefined') retval = rv; - } - if (this.post_parse) { - rv = this.post_parse(this.yy, retval); - if (typeof rv !== 'undefined') retval = rv; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + this.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; } } - - return retval; + return true; }}; @@ -1031,8 +731,7 @@ stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: {"easy_keyword_rules":true}, -performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START -/**/) { +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { var YYSTATE=YY_START; switch($avoiding_name_collisions) { diff --git a/package.json b/package.json index 4646211..30f9cfa 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "author": "Zach Carter", "license": "MIT", "devDependencies": { - "jison": "git://github.com/GerHobbelt/jison.git", + "jison": "git://github.com/zaach/jison.git#ef2647", "test": ">=0.4.0" } } From 4f87ed330c025ca0cdcfd70ec97236759749e1c0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 28 Apr 2014 23:26:07 +0200 Subject: [PATCH 047/417] restore settings after upgrade... --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 30f9cfa..4646211 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "author": "Zach Carter", "license": "MIT", "devDependencies": { - "jison": "git://github.com/zaach/jison.git#ef2647", + "jison": "git://github.com/GerHobbelt/jison.git", "test": ">=0.4.0" } } From 667318f9cbea4955b8163e85e2496bcdd30f165c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 28 Apr 2014 23:38:06 +0200 Subject: [PATCH 048/417] fix Makefile: the jison command is a BASH shell script and therefor breaks badly when invoked via Node itself. Compare with ebnf-parser/Makefile et al --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 3435d65..4e29ebb 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ npm-install: build: lex-parser.js -lex-parser.js: npm-install lex.y lex.l - node ./node_modules/.bin/jison -o lex-parser.js lex.y lex.l +lex-parser.js: lex.y lex.l + ./node_modules/.bin/jison -o lex-parser.js lex.y lex.l test: node tests/all-tests.js From d7c638a951045a81cb42e7f80f4291914179c7e7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 28 Apr 2014 23:41:38 +0200 Subject: [PATCH 049/417] regenerated parser --- lex-parser.js | 647 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 478 insertions(+), 169 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index a1885aa..a4af78c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.11 */ +/* parser generated by jison 0.4.13 */ /* Returns a Parser object of the following structure: @@ -12,7 +12,8 @@ symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), + (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) table: [...], defaultActions: {...}, parseError: function(str, hash), @@ -37,12 +38,9 @@ _currentRules: function(), topState: function(), pushState: function(condition), + stateStackSize: function(), - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, + options: { ... }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], @@ -67,11 +65,58 @@ } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) + recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) + } + + You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + These options are available: + + ### options which are global for all parser instances + + Parser.pre_parse: function(yy) + optional: you can specify a pre_parse() function in the chunk following the grammar, + i.e. after the last `%%`. + Parser.post_parse: function(yy, retval) { return retval; } + optional: you can specify a post_parse() function in the chunk following the grammar, + i.e. after the last `%%`. When it does not return any value, the parser will return + the original `retval`. + + ### options which can be set up per parser instance + + yy: { + pre_parse: function(yy) + optional: is invoked before the parse cycle starts (and before the first invocation + of `lex()`) but immediately after the invocation of parser.pre_parse()). + post_parse: function(yy, retval) { return retval; } + optional: is invoked when the parse terminates due to success ('accept') or failure + (even when exceptions are thrown). `retval` contains the return value to be produced + by `Parser.parse()`; this function can override the return value by returning another. + When it does not return any value, the parser will return the original `retval`. + This function is invoked immediately before `Parser.post_parse()`. + parseError: function(str, hash) + optional: overrides the default `parseError` function. + } + + parser.lexer.options: { + ranges: boolean optional: true ==> token location info will include a .range[] member. + flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested + exhaustively to find the longest match. + backtrack_lexer: boolean + optional: true ==> lexer regexes are tested in order and for each matching + regex the action code is invoked; the lexer terminates + the scan when a token is returned by the action code. + pre_lex: function() + optional: is invoked before the lexer is invoked to produce another token. + `this` refers to the Lexer object. + post_lex: function(token) { return token; } + optional: is invoked when the lexer has produced a token `token`; + this function can override the returned token value by returning another. + When it does not return any (truthy) value, the lexer will return the original `token`. + `this` refers to the Lexer object. } */ -var lexParser = (function(){ +var parser = (function(){ var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, @@ -82,7 +127,9 @@ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* actio var $0 = $$.length - 1; switch (yystate) { -case 1: +case 1 : +/*! Production:: lex : definitions %% rules epilogue */ + this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; @@ -92,15 +139,23 @@ case 1: delete yy.options; delete yy.actionInclude; return this.$; - + break; -case 2: this.$ = null; +case 2 : +/*! Production:: epilogue : EOF */ + this.$ = null; break; -case 3: this.$ = null; +case 3 : +/*! Production:: epilogue : %% EOF */ + this.$ = null; break; -case 4: this.$ = $$[$0-1]; +case 4 : +/*! Production:: epilogue : %% CODE EOF */ + this.$ = $$[$0-1]; break; -case 5: +case 5 : +/*! Production:: definitions : definition definitions */ + this.$ = $$[$0]; if ('length' in $$[$0-1]) { this.$[0] = this.$[0] || {}; @@ -111,100 +166,188 @@ case 5: this.$[1][name] = $$[$0-1][name]; } } - + break; -case 6: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +case 6 : +/*! Production:: definitions : ACTION definitions */ + yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; break; -case 7: yy.actionInclude = ''; this.$ = [null,null]; +case 7 : +/*! Production:: definitions : */ + yy.actionInclude = ''; this.$ = [null,null]; break; -case 8: this.$ = [$$[$0-1], $$[$0]]; +case 8 : +/*! Production:: definition : NAME regex */ + this.$ = [$$[$0-1], $$[$0]]; break; -case 9: this.$ = $$[$0]; +case 9 : +/*! Production:: definition : START_INC names_inclusive */ + this.$ = $$[$0]; break; -case 10: this.$ = $$[$0]; +case 10 : +/*! Production:: definition : START_EXC names_exclusive */ + this.$ = $$[$0]; break; -case 11: this.$ = {}; this.$[$$[$0]] = 0; +case 11 : +/*! Production:: names_inclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 0; break; -case 12: this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +case 12 : +/*! Production:: names_inclusive : names_inclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 0; break; -case 13: this.$ = {}; this.$[$$[$0]] = 1; +case 13 : +/*! Production:: names_exclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 1; break; -case 14: this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +case 14 : +/*! Production:: names_exclusive : names_exclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 1; break; -case 15: this.$ = $$[$0-1]; this.$.push($$[$0]); +case 15 : +/*! Production:: rules : rules rule */ + this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 16: this.$ = [$$[$0]]; +case 16 : +/*! Production:: rules : rule */ + this.$ = [$$[$0]]; break; -case 17: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; +case 17 : +/*! Production:: rule : start_conditions regex action */ + this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; -case 18:this.$ = $$[$0-1]; +case 18 : +/*! Production:: action : { action_body } */ + this.$ = $$[$0-1]; break; -case 19:this.$ = $$[$0]; +case 19 : +/*! Production:: action : ACTION */ + this.$ = $$[$0]; break; -case 20:this.$ = ''; +case 20 : +/*! Production:: action_body : */ + this.$ = ''; break; -case 21:this.$ = $$[$0]; +case 21 : +/*! Production:: action_body : action_comments_body */ + this.$ = $$[$0]; break; -case 22:this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +case 22 : +/*! Production:: action_body : action_body { action_body } action_comments_body */ + this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 23:this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +case 23 : +/*! Production:: action_body : action_body { action_body } */ + this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24: this.$ = yytext; +case 24 : +/*! Production:: action_comments_body : ACTION_BODY */ + this.$ = yytext; break; -case 25: this.$ = $$[$0-1] + $$[$0]; +case 25 : +/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ + this.$ = $$[$0-1] + $$[$0]; break; -case 26: this.$ = $$[$0-1]; +case 26 : +/*! Production:: start_conditions : < name_list > */ + this.$ = $$[$0-1]; break; -case 27: this.$ = ['*']; +case 27 : +/*! Production:: start_conditions : < * > */ + this.$ = ['*']; break; -case 29: this.$ = [$$[$0]]; +case 29 : +/*! Production:: name_list : NAME */ + this.$ = [$$[$0]]; break; -case 30: this.$ = $$[$0-2]; this.$.push($$[$0]); +case 30 : +/*! Production:: name_list : name_list , NAME */ + this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 31: +case 31 : +/*! Production:: regex : regex_list */ + this.$ = $$[$0]; if (yy.options && yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { this.$ += "\\b"; } - + break; -case 32: this.$ = $$[$0-2] + '|' + $$[$0]; +case 32 : +/*! Production:: regex_list : regex_list | regex_concat */ + this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 33: this.$ = $$[$0-1] + '|'; +case 33 : +/*! Production:: regex_list : regex_list | */ + this.$ = $$[$0-1] + '|'; break; -case 35: this.$ = ''; +case 35 : +/*! Production:: regex_list : */ + this.$ = ''; break; -case 36: this.$ = $$[$0-1] + $$[$0]; +case 36 : +/*! Production:: regex_concat : regex_concat regex_base */ + this.$ = $$[$0-1] + $$[$0]; break; -case 38: this.$ = '(' + $$[$0-1] + ')'; +case 38 : +/*! Production:: regex_base : ( regex_list ) */ + this.$ = '(' + $$[$0-1] + ')'; break; -case 39: this.$ = $$[$0-2] + $$[$0-1] + ')'; +case 39 : +/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ + this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 40: this.$ = $$[$0-1] + '+'; +case 40 : +/*! Production:: regex_base : regex_base + */ + this.$ = $$[$0-1] + '+'; break; -case 41: this.$ = $$[$0-1] + '*'; +case 41 : +/*! Production:: regex_base : regex_base * */ + this.$ = $$[$0-1] + '*'; break; -case 42: this.$ = $$[$0-1] + '?'; +case 42 : +/*! Production:: regex_base : regex_base ? */ + this.$ = $$[$0-1] + '?'; break; -case 43: this.$ = '(?=' + $$[$0] + ')'; +case 43 : +/*! Production:: regex_base : / regex_base */ + this.$ = '(?=' + $$[$0] + ')'; break; -case 44: this.$ = '(?!' + $$[$0] + ')'; +case 44 : +/*! Production:: regex_base : /! regex_base */ + this.$ = '(?!' + $$[$0] + ')'; break; -case 46: this.$ = $$[$0-1] + $$[$0]; +case 46 : +/*! Production:: regex_base : regex_base range_regex */ + this.$ = $$[$0-1] + $$[$0]; break; -case 48: this.$ = '.'; +case 48 : +/*! Production:: regex_base : . */ + this.$ = '.'; break; -case 49: this.$ = '^'; +case 49 : +/*! Production:: regex_base : ^ */ + this.$ = '^'; break; -case 50: this.$ = '$'; +case 50 : +/*! Production:: regex_base : $ */ + this.$ = '$'; break; -case 54: this.$ = yytext; +case 54 : +/*! Production:: any_group_regex : ANY_GROUP_REGEX */ + this.$ = yytext; break; -case 55: this.$ = yytext; +case 55 : +/*! Production:: escape_char : ESCAPE_CHAR */ + this.$ = yytext; break; -case 56: this.$ = yytext; +case 56 : +/*! Production:: range_regex : RANGE_REGEX */ + this.$ = yytext; break; -case 57: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +case 57 : +/*! Production:: string : STRING_LIT */ + this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; } }, @@ -218,134 +361,300 @@ parseError: function parseError(str, hash) { } }, parse: function parse(input) { - var self = this, stack = [0], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + var self = this, + stack = [0], + tstack = [], // token stack + vstack = [null], // semantic value stack + lstack = [], // location stack + table = this.table, + yytext = '', + yylineno = 0, + yyleng = 0, + recovering = 0, + TERROR = 2, + EOF = 1; + var args = lstack.slice.call(arguments, 1); - this.lexer.setInput(input); - this.lexer.yy = this.yy; - this.yy.lexer = this.lexer; - this.yy.parser = this; - if (typeof this.lexer.yylloc == 'undefined') { - this.lexer.yylloc = {}; + + //this.reductionCount = this.shiftCount = 0; + + var lexer = Object.create(this.lexer); + var sharedState = { yy: {} }; + // copy state + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc === 'undefined') { + lexer.yylloc = {}; } - var yyloc = this.lexer.yylloc; + var yyloc = lexer.yylloc; lstack.push(yyloc); - var ranges = this.lexer.options && this.lexer.options.ranges; - if (typeof this.yy.parseError === 'function') { - this.parseError = this.yy.parseError; + + var ranges = lexer.options && lexer.options.ranges; + + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; } else { - this.parseError = Object.getPrototypeOf(this).parseError; + this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ } - function popStack(n) { + + function popStack (n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } + +_token_stack: function lex() { var token; - token = self.lexer.lex() || EOF; + token = lexer.lex() || EOF; + // if token isn't its numeric value, convert if (typeof token !== 'number') { token = self.symbols_[token] || token; } return token; } - var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; - while (true) { - state = stack[stack.length - 1]; - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); + + var symbol; + var preErrorSymbol = null; + var state, action, a, r; + var yyval = {}; + var p, len, newState; + var expected = []; + var retval = false; + + if (this.pre_parse) { + this.pre_parse(sharedState.yy); + } + if (sharedState.yy.pre_parse) { + sharedState.yy.pre_parse(sharedState.yy); + } + + try { + for (;;) { + // retreive state number from top of stack + state = stack[stack.length - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol === 'undefined') { + symbol = lex(); + } + // read action for current state and first input + action = table[state] && table[state][symbol]; } - action = table[state] && table[state][symbol]; - } - if (typeof action === 'undefined' || !action.length || !action[0]) { + + // handle parse error + if (typeof action === 'undefined' || !action.length || !action[0]) { + var error_rule_depth; var errStr = ''; - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push('\'' + this.terminals_[p] + '\''); + + // Return the rule stack depth where the nearest error rule can be found. + // Return FALSE when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = stack.length - 1; + var depth = 0; + + // try to recover from error + for(;;) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + return depth; + } + if (state === 0 || stack_probe < 2) { + return false; // No suitable error recovery rule available. + } + stack_probe -= 2; // popStack(1): [symbol, action] + state = stack[stack_probe]; + ++depth; } } - if (this.lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + this.lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); + + if (!recovering) { + // first see if there's any chance at hitting an error recovery rule: + error_rule_depth = locateNearestErrorRecoveryRule(state); + + // Report error + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); + } + } + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + + (symbol == EOF ? "end of input" : + ("'" + (this.terminals_[symbol] || symbol) + "'")); + } + a = this.parseError(errStr, p = { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: (error_rule_depth !== false) + }); + if (!p.recoverable) { + retval = a; + break; + } + } else if (preErrorSymbol !== EOF) { + error_rule_depth = locateNearestErrorRecoveryRule(state); } - this.parseError(errStr, { - text: this.lexer.match, + + // just recovered from another error + if (recovering == 3) { + if (symbol === EOF || preErrorSymbol === EOF) { + retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + + // discard current lookahead and grab another + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + symbol = lex(); + } + + // try to recover from error + if (error_rule_depth === false) { + retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + popStack(error_rule_depth); + + preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length-1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } + + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array && action.length > 1) { + retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { + text: lexer.match, token: this.terminals_[symbol] || symbol, - line: this.lexer.yylineno, + line: lexer.yylineno, loc: yyloc, - expected: expected + expected: expected, + recoverable: false }); + break; } - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); - } - switch (action[0]) { - case 1: - stack.push(symbol); - vstack.push(this.lexer.yytext); - lstack.push(this.lexer.yylloc); - stack.push(action[1]); - symbol = null; - if (!preErrorSymbol) { - yyleng = this.lexer.yyleng; - yytext = this.lexer.yytext; - yylineno = this.lexer.yylineno; - yyloc = this.lexer.yylloc; - if (recovering > 0) { - recovering--; + + switch (action[0]) { + case 1: // shift + //this.shiftCount++; + + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); // push state + symbol = null; + if (!preErrorSymbol) { // normal execution / no error + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + // error just occurred, resume old lookahead f/ before error + symbol = preErrorSymbol; + preErrorSymbol = null; } - } else { - symbol = preErrorSymbol; - preErrorSymbol = null; - } - break; - case 2: - len = this.productions_[action[1]][1]; - yyval.$ = vstack[vstack.length - len]; - yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column - }; - if (ranges) { - yyval._$.range = [ - lstack[lstack.length - (len || 1)].range[0], - lstack[lstack.length - 1].range[1] - ]; - } - r = this.performAction.apply(yyval, [ - yytext, - yyleng, - yylineno, - this.yy, - action[1], - vstack, - lstack - ].concat(args)); - if (typeof r !== 'undefined') { - return r; - } - if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); + continue; + + case 2: + // reduce + //this.reductionCount++; + + len = this.productions_[action[1]][1]; + + // perform semantic action + yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 + // default location, uses first token for firsts, last for lasts + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + } + r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + + stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + vstack.push(yyval.$); + lstack.push(yyval._$); + // goto new state = table[STATE][NONTERMINAL] + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + continue; + + case 3: + // accept + retval = true; + break; } - stack.push(this.productions_[action[1]][0]); - vstack.push(yyval.$); - lstack.push(yyval._$); - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); + + // break out of loop: we accept or fail with error break; - case 3: - return true; + } + } finally { + var rv; + + if (sharedState.yy.post_parse) { + rv = sharedState.yy.post_parse(sharedState.yy, retval); + if (typeof rv !== 'undefined') retval = rv; + } + if (this.post_parse) { + rv = this.post_parse(sharedState.yy, retval); + if (typeof rv !== 'undefined') retval = rv; } } - return true; + + return retval; }}; @@ -360,9 +669,9 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.2.1 */ +/* generated by jison-lex 0.3.4 */ var lexer = (function(){ -var lexer = { +var lexer = ({ EOF:1, @@ -377,7 +686,8 @@ parseError:function parseError(str, hash) { }, // resets the lexer, sets new input -setInput:function (input) { +setInput:function (input, yy) { + this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this._signaled_error_token = this.done = false; this.yylineno = this.yyleng = 0; @@ -428,7 +738,7 @@ unput:function (ch) { var lines = ch.split(/(?:\r\n?|\n)/g); this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len - 1); + this.yytext = this.yytext.substr(0, this.yytext.length - len); //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); @@ -732,7 +1042,6 @@ stateStackSize:function stateStackSize() { }, options: {"easy_keyword_rules":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { - var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0 : @@ -1084,7 +1393,7 @@ break; }, rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} -}; +}); return lexer; })(); parser.lexer = lexer; @@ -1097,9 +1406,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lexParser; -exports.Parser = lexParser.Parser; -exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; +exports.parser = parser; +exports.Parser = parser.Parser; +exports.parse = function () { return parser.parse.apply(parser, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); From 3708da82b05285f43859cbd4ddcc713be060d307 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 2 Sep 2014 13:09:46 +0200 Subject: [PATCH 050/417] consistent code format --- lex.y | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lex.y b/lex.y index cc68baf..629d42c 100644 --- a/lex.y +++ b/lex.y @@ -89,20 +89,20 @@ rule action : '{' action_body '}' - {$$ = $2;} + { $$ = $2; } | ACTION - {$$ = $1;} + { $$ = $1; } ; action_body : - {$$ = '';} + { $$ = ''; } | action_comments_body - {$$ = $1;} + { $$ = $1; } | action_body '{' action_body '}' action_comments_body - {$$ = $1 + $2 + $3 + $4 + $5;} + { $$ = $1 + $2 + $3 + $4 + $5; } | action_body '{' action_body '}' - {$$ = $1 + $2 + $3 + $4;} + { $$ = $1 + $2 + $3 + $4; } ; action_comments_body From 558f32ec97638f8c16bd96ee7e66692903e9a609 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 2 Sep 2014 16:10:38 +0200 Subject: [PATCH 051/417] regenerated library --- lex-parser.js | 121 ++++++++++++++++++++++---------------------------- 1 file changed, 54 insertions(+), 67 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index a4af78c..b01df9a 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.13 */ +/* parser generated by jison 0.4.15 */ /* Returns a Parser object of the following structure: @@ -117,6 +117,13 @@ } */ var parser = (function(){ +var __expand__ = function (k, v, o) { + o = o || {}; + for (var l = k.length; l--; ) { + o[k[l]] = v; + } + return o; +}; var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, @@ -143,14 +150,16 @@ case 1 : break; case 2 : /*! Production:: epilogue : EOF */ - this.$ = null; -break; -case 3 : + case 3 : /*! Production:: epilogue : %% EOF */ this.$ = null; break; case 4 : /*! Production:: epilogue : %% CODE EOF */ + case 18 : +/*! Production:: action : { action_body } */ + case 26 : +/*! Production:: start_conditions : < name_list > */ this.$ = $$[$0-1]; break; case 5 : @@ -182,10 +191,12 @@ case 8 : break; case 9 : /*! Production:: definition : START_INC names_inclusive */ - this.$ = $$[$0]; -break; -case 10 : + case 10 : /*! Production:: definition : START_EXC names_exclusive */ + case 19 : +/*! Production:: action : ACTION */ + case 21 : +/*! Production:: action_body : action_comments_body */ this.$ = $$[$0]; break; case 11 : @@ -210,56 +221,50 @@ case 15 : break; case 16 : /*! Production:: rules : rule */ + case 29 : +/*! Production:: name_list : NAME */ this.$ = [$$[$0]]; break; case 17 : /*! Production:: rule : start_conditions regex action */ this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; -case 18 : -/*! Production:: action : { action_body } */ - this.$ = $$[$0-1]; -break; -case 19 : -/*! Production:: action : ACTION */ - this.$ = $$[$0]; -break; case 20 : /*! Production:: action_body : */ - this.$ = ''; -break; -case 21 : -/*! Production:: action_body : action_comments_body */ - this.$ = $$[$0]; + case 35 : +/*! Production:: regex_list : */ + this.$ = ''; break; case 22 : /*! Production:: action_body : action_body { action_body } action_comments_body */ - this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; + this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; case 23 : /*! Production:: action_body : action_body { action_body } */ - this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; + this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; case 24 : /*! Production:: action_comments_body : ACTION_BODY */ + case 54 : +/*! Production:: any_group_regex : ANY_GROUP_REGEX */ + case 55 : +/*! Production:: escape_char : ESCAPE_CHAR */ + case 56 : +/*! Production:: range_regex : RANGE_REGEX */ this.$ = yytext; break; case 25 : /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ + case 36 : +/*! Production:: regex_concat : regex_concat regex_base */ + case 46 : +/*! Production:: regex_base : regex_base range_regex */ this.$ = $$[$0-1] + $$[$0]; break; -case 26 : -/*! Production:: start_conditions : < name_list > */ - this.$ = $$[$0-1]; -break; case 27 : /*! Production:: start_conditions : < * > */ this.$ = ['*']; break; -case 29 : -/*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; -break; case 30 : /*! Production:: name_list : name_list , NAME */ this.$ = $$[$0-2]; this.$.push($$[$0]); @@ -281,14 +286,6 @@ case 33 : /*! Production:: regex_list : regex_list | */ this.$ = $$[$0-1] + '|'; break; -case 35 : -/*! Production:: regex_list : */ - this.$ = ''; -break; -case 36 : -/*! Production:: regex_concat : regex_concat regex_base */ - this.$ = $$[$0-1] + $$[$0]; -break; case 38 : /*! Production:: regex_base : ( regex_list ) */ this.$ = '(' + $$[$0-1] + ')'; @@ -317,10 +314,6 @@ case 44 : /*! Production:: regex_base : /! regex_base */ this.$ = '(?!' + $$[$0] + ')'; break; -case 46 : -/*! Production:: regex_base : regex_base range_regex */ - this.$ = $$[$0-1] + $$[$0]; -break; case 48 : /*! Production:: regex_base : . */ this.$ = '.'; @@ -333,18 +326,6 @@ case 50 : /*! Production:: regex_base : $ */ this.$ = '$'; break; -case 54 : -/*! Production:: any_group_regex : ANY_GROUP_REGEX */ - this.$ = yytext; -break; -case 55 : -/*! Production:: escape_char : ESCAPE_CHAR */ - this.$ = yytext; -break; -case 56 : -/*! Production:: range_regex : RANGE_REGEX */ - this.$ = yytext; -break; case 57 : /*! Production:: string : STRING_LIT */ this.$ = prepareString(yytext.substr(1, yytext.length - 2)); @@ -379,7 +360,9 @@ parse: function parse(input) { //this.reductionCount = this.shiftCount = 0; var lexer = Object.create(this.lexer); - var sharedState = { yy: {} }; + var sharedState = { + yy: {} + }; // copy state for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { @@ -404,7 +387,7 @@ parse: function parse(input) { this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ } - function popStack (n) { + function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; @@ -430,10 +413,10 @@ _token_stack: var retval = false; if (this.pre_parse) { - this.pre_parse(sharedState.yy); + this.pre_parse.call(this, sharedState.yy); } if (sharedState.yy.pre_parse) { - sharedState.yy.pre_parse(sharedState.yy); + sharedState.yy.pre_parse.call(this, sharedState.yy); } try { @@ -464,7 +447,7 @@ _token_stack: var depth = 0; // try to recover from error - for(;;) { + for (;;) { // check for error recovery rule in this state if ((TERROR.toString()) in table[state]) { return depth; @@ -550,7 +533,7 @@ _token_stack: preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; + state = stack[stack.length - 1]; action = table[state] && table[state][TERROR]; recovering = 3; // allow 3 real symbols to be shifted before reporting a new error } @@ -645,11 +628,11 @@ _token_stack: var rv; if (sharedState.yy.post_parse) { - rv = sharedState.yy.post_parse(sharedState.yy, retval); + rv = sharedState.yy.post_parse.call(this, sharedState.yy, retval); if (typeof rv !== 'undefined') retval = rv; } if (this.post_parse) { - rv = this.post_parse(sharedState.yy, retval); + rv = this.post_parse.call(this, sharedState.yy, retval); if (typeof rv !== 'undefined') retval = rv; } } @@ -1042,6 +1025,7 @@ stateStackSize:function stateStackSize() { }, options: {"easy_keyword_rules":true}, performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { + var YYSTATE=YY_START; switch($avoiding_name_collisions) { case 0 : @@ -1379,21 +1363,24 @@ case 66 : /*! Rule:: . */ throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ break; -case 67 : -/*! Conditions:: * */ -/*! Rule:: $ */ - return 8; -break; case 68 : /*! Conditions:: code */ /*! Rule:: (.|{BR})+ */ return 9; break; +default: + return $case_helper[$avoiding_name_collisions]; } }, rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} }); +var $case_helper = { +67 : +/*! Conditions:: * */ +/*! Rule:: $ */ + 8 +};; return lexer; })(); parser.lexer = lexer; From 15d57d64b2dd2e49ff2dec01af0ec21d9be59286 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 2 Sep 2014 16:29:16 +0200 Subject: [PATCH 052/417] updated jison --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4646211..f502ba9 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "author": "Zach Carter", "license": "MIT", "devDependencies": { - "jison": "git://github.com/GerHobbelt/jison.git", + "jison": "git://github.com/GerHobbelt/jison.git#master", "test": ">=0.4.0" } } From f1b870d2c3abd72958dc265d752a90bff4827a1b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 2 Sep 2014 16:55:21 +0200 Subject: [PATCH 053/417] regen lib + npm update --- lex-parser.js | 137 +++++++++++++++++++++++++++++++++++++++++++++++--- package.json | 2 +- 2 files changed, 130 insertions(+), 9 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index b01df9a..868228a 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -123,7 +123,47 @@ var __expand__ = function (k, v, o) { o[k[l]] = v; } return o; -}; +}, + $V0=[2,7], + $V1=[1,4], + $V2=[1,5], + $V3=[1,6], + $V4=[1,7], + $V5=[2,35], + $V6=[1,15], + $V7=[1,16], + $V8=[1,17], + $V9=[1,18], + $Va=[1,21], + $Vb=[1,22], + $Vc=[1,23], + $Vd=[1,26], + $Ve=[1,27], + $Vf=[1,30], + $Vg=[1,28], + $Vh=[1,29], + $Vi=[11,22,33,36,38,41,42,46,47,48,51,52,53,55,56], + $Vj=[2,28], + $Vk=[1,38], + $Vl=[5,11,12,14,16], + $Vm=[1,39], + $Vn=[5,11,12,14,16,22,33,37], + $Vo=[5,11,12,14,16,22,33,36,37,38,41,42,46,47,48,51,52,53,55,56], + $Vp=[1,42], + $Vq=[1,41], + $Vr=[1,43], + $Vs=[1,45], + $Vt=[33,37], + $Vu=[5,11,12,14,16,22,30,33,36,37,38,39,40,41,42,46,47,48,51,52,53,54,55,56], + $Vv=[5,11,12,14,16,18], + $Vw=[5,8,11,22,27,33,36,38,41,42,46,47,48,51,52,53,55,56], + $Vx=[29,31], + $Vy=[22,24], + $Vz=[2,20], + $VA=[1,74], + $VB=[1,77], + $VC=[1,78], + $VD=[22,24,26]; var parser = {trace: function trace() { }, yy: {}, symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, @@ -332,7 +372,88 @@ case 57 : break; } }, -table: [{3:1,4:2,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{1:[3]},{5:[1,8]},{4:9,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{4:10,5:[2,7],10:3,11:[1,4],12:[1,5],14:[1,6],16:[1,7]},{5:[2,35],11:[2,35],12:[2,35],13:11,14:[2,35],16:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{15:31,18:[1,32]},{17:33,18:[1,34]},{6:35,11:[2,28],19:36,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,5]},{5:[2,6]},{5:[2,8],11:[2,8],12:[2,8],14:[2,8],16:[2,8]},{5:[2,31],11:[2,31],12:[2,31],14:[2,31],16:[2,31],22:[2,31],33:[1,39]},{5:[2,34],11:[2,34],12:[2,34],14:[2,34],16:[2,34],22:[2,34],33:[2,34],35:40,36:[1,15],37:[2,34],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,37],11:[2,37],12:[2,37],14:[2,37],16:[2,37],22:[2,37],30:[1,42],33:[2,37],36:[2,37],37:[2,37],38:[2,37],39:[1,41],40:[1,43],41:[2,37],42:[2,37],44:44,46:[2,37],47:[2,37],48:[2,37],51:[2,37],52:[2,37],53:[2,37],54:[1,45],55:[2,37],56:[2,37]},{32:46,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{32:47,33:[2,35],34:13,35:14,36:[1,15],37:[2,35],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:48,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{35:49,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,45],11:[2,45],12:[2,45],14:[2,45],16:[2,45],22:[2,45],30:[2,45],33:[2,45],36:[2,45],37:[2,45],38:[2,45],39:[2,45],40:[2,45],41:[2,45],42:[2,45],46:[2,45],47:[2,45],48:[2,45],51:[2,45],52:[2,45],53:[2,45],54:[2,45],55:[2,45],56:[2,45]},{5:[2,47],11:[2,47],12:[2,47],14:[2,47],16:[2,47],22:[2,47],30:[2,47],33:[2,47],36:[2,47],37:[2,47],38:[2,47],39:[2,47],40:[2,47],41:[2,47],42:[2,47],46:[2,47],47:[2,47],48:[2,47],51:[2,47],52:[2,47],53:[2,47],54:[2,47],55:[2,47],56:[2,47]},{5:[2,48],11:[2,48],12:[2,48],14:[2,48],16:[2,48],22:[2,48],30:[2,48],33:[2,48],36:[2,48],37:[2,48],38:[2,48],39:[2,48],40:[2,48],41:[2,48],42:[2,48],46:[2,48],47:[2,48],48:[2,48],51:[2,48],52:[2,48],53:[2,48],54:[2,48],55:[2,48],56:[2,48]},{5:[2,49],11:[2,49],12:[2,49],14:[2,49],16:[2,49],22:[2,49],30:[2,49],33:[2,49],36:[2,49],37:[2,49],38:[2,49],39:[2,49],40:[2,49],41:[2,49],42:[2,49],46:[2,49],47:[2,49],48:[2,49],51:[2,49],52:[2,49],53:[2,49],54:[2,49],55:[2,49],56:[2,49]},{5:[2,50],11:[2,50],12:[2,50],14:[2,50],16:[2,50],22:[2,50],30:[2,50],33:[2,50],36:[2,50],37:[2,50],38:[2,50],39:[2,50],40:[2,50],41:[2,50],42:[2,50],46:[2,50],47:[2,50],48:[2,50],51:[2,50],52:[2,50],53:[2,50],54:[2,50],55:[2,50],56:[2,50]},{5:[2,51],11:[2,51],12:[2,51],14:[2,51],16:[2,51],22:[2,51],30:[2,51],33:[2,51],36:[2,51],37:[2,51],38:[2,51],39:[2,51],40:[2,51],41:[2,51],42:[2,51],46:[2,51],47:[2,51],48:[2,51],51:[2,51],52:[2,51],53:[2,51],54:[2,51],55:[2,51],56:[2,51]},{5:[2,52],11:[2,52],12:[2,52],14:[2,52],16:[2,52],22:[2,52],30:[2,52],33:[2,52],36:[2,52],37:[2,52],38:[2,52],39:[2,52],40:[2,52],41:[2,52],42:[2,52],46:[2,52],47:[2,52],48:[2,52],51:[2,52],52:[2,52],53:[2,52],54:[2,52],55:[2,52],56:[2,52]},{5:[2,53],11:[2,53],12:[2,53],14:[2,53],16:[2,53],22:[2,53],30:[2,53],33:[2,53],36:[2,53],37:[2,53],38:[2,53],39:[2,53],40:[2,53],41:[2,53],42:[2,53],46:[2,53],47:[2,53],48:[2,53],51:[2,53],52:[2,53],53:[2,53],54:[2,53],55:[2,53],56:[2,53]},{5:[2,54],11:[2,54],12:[2,54],14:[2,54],16:[2,54],22:[2,54],30:[2,54],33:[2,54],36:[2,54],37:[2,54],38:[2,54],39:[2,54],40:[2,54],41:[2,54],42:[2,54],46:[2,54],47:[2,54],48:[2,54],51:[2,54],52:[2,54],53:[2,54],54:[2,54],55:[2,54],56:[2,54]},{5:[2,57],11:[2,57],12:[2,57],14:[2,57],16:[2,57],22:[2,57],30:[2,57],33:[2,57],36:[2,57],37:[2,57],38:[2,57],39:[2,57],40:[2,57],41:[2,57],42:[2,57],46:[2,57],47:[2,57],48:[2,57],51:[2,57],52:[2,57],53:[2,57],54:[2,57],55:[2,57],56:[2,57]},{5:[2,58],11:[2,58],12:[2,58],14:[2,58],16:[2,58],22:[2,58],30:[2,58],33:[2,58],36:[2,58],37:[2,58],38:[2,58],39:[2,58],40:[2,58],41:[2,58],42:[2,58],46:[2,58],47:[2,58],48:[2,58],51:[2,58],52:[2,58],53:[2,58],54:[2,58],55:[2,58],56:[2,58]},{5:[2,55],11:[2,55],12:[2,55],14:[2,55],16:[2,55],22:[2,55],30:[2,55],33:[2,55],36:[2,55],37:[2,55],38:[2,55],39:[2,55],40:[2,55],41:[2,55],42:[2,55],46:[2,55],47:[2,55],48:[2,55],51:[2,55],52:[2,55],53:[2,55],54:[2,55],55:[2,55],56:[2,55]},{5:[2,9],11:[2,9],12:[2,9],14:[2,9],16:[2,9],18:[1,50]},{5:[2,11],11:[2,11],12:[2,11],14:[2,11],16:[2,11],18:[2,11]},{5:[2,10],11:[2,10],12:[2,10],14:[2,10],16:[2,10],18:[1,51]},{5:[2,13],11:[2,13],12:[2,13],14:[2,13],16:[2,13],18:[2,13]},{5:[1,55],7:52,8:[1,54],11:[2,28],19:53,20:37,22:[2,28],27:[1,38],33:[2,28],36:[2,28],38:[2,28],41:[2,28],42:[2,28],46:[2,28],47:[2,28],48:[2,28],51:[2,28],52:[2,28],53:[2,28],55:[2,28],56:[2,28]},{5:[2,16],8:[2,16],11:[2,16],22:[2,16],27:[2,16],33:[2,16],36:[2,16],38:[2,16],41:[2,16],42:[2,16],46:[2,16],47:[2,16],48:[2,16],51:[2,16],52:[2,16],53:[2,16],55:[2,16],56:[2,16]},{11:[2,35],13:56,22:[2,35],32:12,33:[2,35],34:13,35:14,36:[1,15],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{12:[1,59],28:57,30:[1,58]},{5:[2,33],11:[2,33],12:[2,33],14:[2,33],16:[2,33],22:[2,33],33:[2,33],34:60,35:14,36:[1,15],37:[2,33],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,36],11:[2,36],12:[2,36],14:[2,36],16:[2,36],22:[2,36],30:[1,42],33:[2,36],36:[2,36],37:[2,36],38:[2,36],39:[1,41],40:[1,43],41:[2,36],42:[2,36],44:44,46:[2,36],47:[2,36],48:[2,36],51:[2,36],52:[2,36],53:[2,36],54:[1,45],55:[2,36],56:[2,36]},{5:[2,40],11:[2,40],12:[2,40],14:[2,40],16:[2,40],22:[2,40],30:[2,40],33:[2,40],36:[2,40],37:[2,40],38:[2,40],39:[2,40],40:[2,40],41:[2,40],42:[2,40],46:[2,40],47:[2,40],48:[2,40],51:[2,40],52:[2,40],53:[2,40],54:[2,40],55:[2,40],56:[2,40]},{5:[2,41],11:[2,41],12:[2,41],14:[2,41],16:[2,41],22:[2,41],30:[2,41],33:[2,41],36:[2,41],37:[2,41],38:[2,41],39:[2,41],40:[2,41],41:[2,41],42:[2,41],46:[2,41],47:[2,41],48:[2,41],51:[2,41],52:[2,41],53:[2,41],54:[2,41],55:[2,41],56:[2,41]},{5:[2,42],11:[2,42],12:[2,42],14:[2,42],16:[2,42],22:[2,42],30:[2,42],33:[2,42],36:[2,42],37:[2,42],38:[2,42],39:[2,42],40:[2,42],41:[2,42],42:[2,42],46:[2,42],47:[2,42],48:[2,42],51:[2,42],52:[2,42],53:[2,42],54:[2,42],55:[2,42],56:[2,42]},{5:[2,46],11:[2,46],12:[2,46],14:[2,46],16:[2,46],22:[2,46],30:[2,46],33:[2,46],36:[2,46],37:[2,46],38:[2,46],39:[2,46],40:[2,46],41:[2,46],42:[2,46],46:[2,46],47:[2,46],48:[2,46],51:[2,46],52:[2,46],53:[2,46],54:[2,46],55:[2,46],56:[2,46]},{5:[2,56],11:[2,56],12:[2,56],14:[2,56],16:[2,56],22:[2,56],30:[2,56],33:[2,56],36:[2,56],37:[2,56],38:[2,56],39:[2,56],40:[2,56],41:[2,56],42:[2,56],46:[2,56],47:[2,56],48:[2,56],51:[2,56],52:[2,56],53:[2,56],54:[2,56],55:[2,56],56:[2,56]},{33:[1,39],37:[1,61]},{33:[1,39],37:[1,62]},{5:[2,43],11:[2,43],12:[2,43],14:[2,43],16:[2,43],22:[2,43],30:[1,42],33:[2,43],36:[2,43],37:[2,43],38:[2,43],39:[1,41],40:[1,43],41:[2,43],42:[2,43],44:44,46:[2,43],47:[2,43],48:[2,43],51:[2,43],52:[2,43],53:[2,43],54:[1,45],55:[2,43],56:[2,43]},{5:[2,44],11:[2,44],12:[2,44],14:[2,44],16:[2,44],22:[2,44],30:[1,42],33:[2,44],36:[2,44],37:[2,44],38:[2,44],39:[1,41],40:[1,43],41:[2,44],42:[2,44],44:44,46:[2,44],47:[2,44],48:[2,44],51:[2,44],52:[2,44],53:[2,44],54:[1,45],55:[2,44],56:[2,44]},{5:[2,12],11:[2,12],12:[2,12],14:[2,12],16:[2,12],18:[2,12]},{5:[2,14],11:[2,14],12:[2,14],14:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{5:[2,15],8:[2,15],11:[2,15],22:[2,15],27:[2,15],33:[2,15],36:[2,15],38:[2,15],41:[2,15],42:[2,15],46:[2,15],47:[2,15],48:[2,15],51:[2,15],52:[2,15],53:[2,15],55:[2,15],56:[2,15]},{1:[2,2]},{8:[1,63],9:[1,64]},{11:[1,67],21:65,22:[1,66]},{29:[1,68],31:[1,69]},{29:[1,70]},{29:[2,29],31:[2,29]},{5:[2,32],11:[2,32],12:[2,32],14:[2,32],16:[2,32],22:[2,32],33:[2,32],35:40,36:[1,15],37:[2,32],38:[1,16],41:[1,17],42:[1,18],43:19,45:20,46:[1,21],47:[1,22],48:[1,23],49:24,50:25,51:[1,26],52:[1,27],53:[1,30],55:[1,28],56:[1,29]},{5:[2,38],11:[2,38],12:[2,38],14:[2,38],16:[2,38],22:[2,38],30:[2,38],33:[2,38],36:[2,38],37:[2,38],38:[2,38],39:[2,38],40:[2,38],41:[2,38],42:[2,38],46:[2,38],47:[2,38],48:[2,38],51:[2,38],52:[2,38],53:[2,38],54:[2,38],55:[2,38],56:[2,38]},{5:[2,39],11:[2,39],12:[2,39],14:[2,39],16:[2,39],22:[2,39],30:[2,39],33:[2,39],36:[2,39],37:[2,39],38:[2,39],39:[2,39],40:[2,39],41:[2,39],42:[2,39],46:[2,39],47:[2,39],48:[2,39],51:[2,39],52:[2,39],53:[2,39],54:[2,39],55:[2,39],56:[2,39]},{1:[2,3]},{8:[1,71]},{5:[2,17],8:[2,17],11:[2,17],22:[2,17],27:[2,17],33:[2,17],36:[2,17],38:[2,17],41:[2,17],42:[2,17],46:[2,17],47:[2,17],48:[2,17],51:[2,17],52:[2,17],53:[2,17],55:[2,17],56:[2,17]},{22:[2,20],23:72,24:[2,20],25:73,26:[1,74]},{5:[2,19],8:[2,19],11:[2,19],22:[2,19],27:[2,19],33:[2,19],36:[2,19],38:[2,19],41:[2,19],42:[2,19],46:[2,19],47:[2,19],48:[2,19],51:[2,19],52:[2,19],53:[2,19],55:[2,19],56:[2,19]},{11:[2,26],22:[2,26],33:[2,26],36:[2,26],38:[2,26],41:[2,26],42:[2,26],46:[2,26],47:[2,26],48:[2,26],51:[2,26],52:[2,26],53:[2,26],55:[2,26],56:[2,26]},{12:[1,75]},{11:[2,27],22:[2,27],33:[2,27],36:[2,27],38:[2,27],41:[2,27],42:[2,27],46:[2,27],47:[2,27],48:[2,27],51:[2,27],52:[2,27],53:[2,27],55:[2,27],56:[2,27]},{1:[2,4]},{22:[1,77],24:[1,76]},{22:[2,21],24:[2,21],26:[1,78]},{22:[2,24],24:[2,24],26:[2,24]},{29:[2,30],31:[2,30]},{5:[2,18],8:[2,18],11:[2,18],22:[2,18],27:[2,18],33:[2,18],36:[2,18],38:[2,18],41:[2,18],42:[2,18],46:[2,18],47:[2,18],48:[2,18],51:[2,18],52:[2,18],53:[2,18],55:[2,18],56:[2,18]},{22:[2,20],23:79,24:[2,20],25:73,26:[1,74]},{22:[2,25],24:[2,25],26:[2,25]},{22:[1,77],24:[1,80]},{22:[2,23],24:[2,23],25:81,26:[1,74]},{22:[2,22],24:[2,22],26:[1,78]}], +table: [{3:1,4:2,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4}, + {1:[3]}, + {5:[1,8]}, + {4:9,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4}, + {4:10,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4}, + __expand__([5,11,12,14,16,33], $V5, {13:11,32:12,34:13,35:14,43:19,45:20,49:24,50:25,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), + {15:31,18:[1,32]}, + {17:33,18:[1,34]}, + __expand__($Vi, $Vj, {6:35,19:36,20:37,27:$Vk}), + {5:[2,5]}, + {5:[2,6]}, + __expand__($Vl, [2,8]), + __expand__([5,11,12,14,16,22], [2,31], {33:$Vm}), + __expand__($Vn, [2,34], {43:19,45:20,49:24,50:25,35:40,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), + __expand__($Vo, [2,37], {44:44,30:$Vp,39:$Vq,40:$Vr,54:$Vs}), + __expand__($Vt, $V5, {34:13,35:14,43:19,45:20,49:24,50:25,32:46,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), + __expand__($Vt, $V5, {34:13,35:14,43:19,45:20,49:24,50:25,32:47,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), + {35:48,36:$V6,38:$V7,41:$V8,42:$V9,43:19,45:20,46:$Va,47:$Vb,48:$Vc,49:24,50:25,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}, + {35:49,36:$V6,38:$V7,41:$V8,42:$V9,43:19,45:20,46:$Va,47:$Vb,48:$Vc,49:24,50:25,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}, + __expand__($Vu, [2,45]), + __expand__($Vu, [2,47]), + __expand__($Vu, [2,48]), + __expand__($Vu, [2,49]), + __expand__($Vu, [2,50]), + __expand__($Vu, [2,51]), + __expand__($Vu, [2,52]), + __expand__($Vu, [2,53]), + __expand__($Vu, [2,54]), + __expand__($Vu, [2,57]), + __expand__($Vu, [2,58]), + __expand__($Vu, [2,55]), + __expand__($Vl, [2,9], {18:[1,50]}), + __expand__($Vv, [2,11]), + __expand__($Vl, [2,10], {18:[1,51]}), + __expand__($Vv, [2,13]), + __expand__($Vi, $Vj, {20:37,7:52,19:53,5:[1,55],8:[1,54],27:$Vk}), + __expand__($Vw, [2,16]), + __expand__([11,22,33], $V5, {32:12,34:13,35:14,43:19,45:20,49:24,50:25,13:56,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), + {12:[1,59],28:57,30:[1,58]}, + __expand__($Vn, [2,33], {35:14,43:19,45:20,49:24,50:25,34:60,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), + __expand__($Vo, [2,36], {44:44,30:$Vp,39:$Vq,40:$Vr,54:$Vs}), + __expand__($Vu, [2,40]), + __expand__($Vu, [2,41]), + __expand__($Vu, [2,42]), + __expand__($Vu, [2,46]), + __expand__($Vu, [2,56]), + {33:$Vm,37:[1,61]}, + {33:$Vm,37:[1,62]}, + __expand__($Vo, [2,43], {44:44,30:$Vp,39:$Vq,40:$Vr,54:$Vs}), + __expand__($Vo, [2,44], {44:44,30:$Vp,39:$Vq,40:$Vr,54:$Vs}), + __expand__($Vv, [2,12]), + __expand__($Vv, [2,14]), + {1:[2,1]}, + __expand__($Vw, [2,15]), + {1:[2,2]}, + {8:[1,63],9:[1,64]}, + {11:[1,67],21:65,22:[1,66]}, + {29:[1,68],31:[1,69]}, + {29:[1,70]}, + __expand__($Vx, [2,29]), + __expand__($Vn, [2,32], {43:19,45:20,49:24,50:25,35:40,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), + __expand__($Vu, [2,38]), + __expand__($Vu, [2,39]), + {1:[2,3]}, + {8:[1,71]}, + __expand__($Vw, [2,17]), + __expand__($Vy, $Vz, {23:72,25:73,26:$VA}), + __expand__($Vw, [2,19]), + __expand__($Vi, [2,26]), + {12:[1,75]}, + __expand__($Vi, [2,27]), + {1:[2,4]}, + {22:$VB,24:[1,76]}, + __expand__($Vy, [2,21], {26:$VC}), + __expand__($VD, [2,24]), + __expand__($Vx, [2,30]), + __expand__($Vw, [2,18]), + __expand__($Vy, $Vz, {25:73,23:79,26:$VA}), + __expand__($VD, [2,25]), + {22:$VB,24:[1,80]}, + __expand__($Vy, [2,23], {25:81,26:$VA}), + __expand__($Vy, [2,22], {26:$VC})], defaultActions: {9:[2,5],10:[2,6],52:[2,1],54:[2,2],63:[2,3],71:[2,4]}, parseError: function parseError(str, hash) { if (hash.recoverable) { @@ -1369,18 +1490,18 @@ case 68 : return 9; break; default: - return $case_helper[$avoiding_name_collisions]; + return this.simpleCaseActionClusters[$avoiding_name_collisions]; } }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], -conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} -}); -var $case_helper = { +simpleCaseActionClusters: { 67 : /*! Conditions:: * */ /*! Rule:: $ */ 8 -};; +}, +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} +}); return lexer; })(); parser.lexer = lexer; diff --git a/package.json b/package.json index f502ba9..64e71b4 100644 --- a/package.json +++ b/package.json @@ -20,6 +20,6 @@ "license": "MIT", "devDependencies": { "jison": "git://github.com/GerHobbelt/jison.git#master", - "test": ">=0.4.0" + "test": ">=0.6.0" } } From 0c05d1dcab1d322f30f388018db56aef73a9ea38 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 19 Oct 2014 15:12:09 +0200 Subject: [PATCH 054/417] regenerated after fix: lexer .offset value would be completely b0rked if this.options.ranges option is *not* set and your lexer action code calls the .unput() API method anywhere. --- Makefile | 1 + lex-parser.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4e29ebb..0a3249f 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ test: clean: -rm -f lex-parser.js + -rm -rf node_modules/ superclean: clean -find . -type d -name 'node_modules' -exec rm -rf "{}" \; diff --git a/lex-parser.js b/lex-parser.js index 868228a..2e41139 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -116,7 +116,7 @@ `this` refers to the Lexer object. } */ -var parser = (function(){ +var lexParser = (function(){ var __expand__ = function (k, v, o) { o = o || {}; for (var l = k.length; l--; ) { @@ -1514,9 +1514,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = parser; -exports.Parser = parser.Parser; -exports.parse = function () { return parser.parse.apply(parser, arguments); }; +exports.parser = lexParser; +exports.Parser = lexParser.Parser; +exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); From ad39c11a781bad40d84efdf2f5d3a189e1d66cfc Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 19 Oct 2014 15:26:02 +0200 Subject: [PATCH 055/417] regenerate after bugfix --- lex-parser.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 2e41139..d54be24 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -980,8 +980,9 @@ test_match:function (match, indexed_rule) { this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; + this.yylloc.range = [this.offset, this.offset + this.yyleng]; } + this.offset += this.yyleng; this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); From c9d60bfbfd7cb33736b83d81c95a924788c71896 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 19 Oct 2014 15:29:48 +0200 Subject: [PATCH 056/417] regenerate after bugfix --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d54be24..0adf290 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -846,8 +846,8 @@ unput:function (ch) { //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); + this.match = this.match.substr(0, this.match.length - len); + this.matched = this.matched.substr(0, this.matched.length - len); if (lines.length - 1) { this.yylineno -= lines.length - 1; From c04f7e5f294cab3144722c8832566ddfd92cd6bc Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 25 Jan 2015 16:15:31 +0100 Subject: [PATCH 057/417] run-time speed optimization for the parser: previously every `.parse()` call instantiated a fresh instance of the lexer; now the first call will instantiate a lexer and every subsequent call to `.parse()` will reuse the existing lexer instance. This improves the performance of the parser a lot when it is invoked many times in a single application. --- lex-parser.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 0adf290..8f4d189 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -480,7 +480,13 @@ parse: function parse(input) { //this.reductionCount = this.shiftCount = 0; - var lexer = Object.create(this.lexer); + var lexer; + if (this.__lexer__) { + lexer = this.__lexer__; + } else { + lexer = this.__lexer__ = Object.create(this.lexer); + } + var sharedState = { yy: {} }; @@ -1529,4 +1535,4 @@ exports.main = function commonjsMain(args) { if (typeof module !== 'undefined' && require.main === module) { exports.main(process.argv.slice(1)); } -} \ No newline at end of file +} From 7d880ad871db76e168a0e1e7a4ad609d216d614b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 11 Feb 2015 21:40:54 +0100 Subject: [PATCH 058/417] end the CR/LF/CRLF cross=platform git conundrum by using gitattributes --- .gitattributes | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 .gitattributes diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..d57c14e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,19 @@ +*.sh text eol=lf +*.bat text eol=crlf +*.php text eol=lf +*.inc text eol=lf +*.html text eol=lf +*.js text eol=lf +*.css text eol=lf +*.less text eol=lf +*.sass text eol=lf +*.ini text eol=lf +*.txt text eol=lf +*.xml text eol=lf +*.md text eol=lf +*.markdown text eol=lf + +*.pdf binary +*.psd binary +*.pptx binary +*.xlsx binary From 1a1eb783436a2acc79eb98bb2c0d477b08e13066 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 11 Feb 2015 22:56:53 +0100 Subject: [PATCH 059/417] updated NPM packages --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index b1a6b49..5415a32 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ node_modules/ +npm-debug.log # Editor bak files *~ *.bak *.orig + From 3d6b356db7e272fe2c7790be82344fb331d49fb3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 28 May 2015 11:27:58 +0200 Subject: [PATCH 060/417] - removed npm install check from the regular build process so that it doesn't b0rk when you're off-net. - added the `prep` make target as a shorthand for `make npm-install` --- Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 0a3249f..aa1af92 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ -all: npm-install build test +all: build test + +prep: npm-install npm-install: npm install @@ -26,4 +28,4 @@ superclean: clean -.PHONY: all npm-install build test clean superclean +.PHONY: all prep npm-install build test clean superclean From ad02fe89713f896471b2db361835d90f18a1a07b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 2 Jun 2015 12:10:41 +0200 Subject: [PATCH 061/417] stricter `NAME` regex: names cannot end with a dash (`-`), e.g. `id-` shouldn't be acceptable as a NAME. --- lex-parser.js | 2086 +++++++++++++++++++++++++++++++++++++++++++------ lex.l | 3 +- 2 files changed, 1829 insertions(+), 260 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8f4d189..1b9543b 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -116,7 +116,7 @@ `this` refers to the Lexer object. } */ -var lexParser = (function(){ +var lexParser = (function () { var __expand__ = function (k, v, o) { o = o || {}; for (var l = k.length; l--; ) { @@ -124,51 +124,345 @@ var __expand__ = function (k, v, o) { } return o; }, - $V0=[2,7], - $V1=[1,4], - $V2=[1,5], - $V3=[1,6], - $V4=[1,7], - $V5=[2,35], - $V6=[1,15], - $V7=[1,16], - $V8=[1,17], - $V9=[1,18], - $Va=[1,21], - $Vb=[1,22], - $Vc=[1,23], - $Vd=[1,26], - $Ve=[1,27], - $Vf=[1,30], - $Vg=[1,28], - $Vh=[1,29], - $Vi=[11,22,33,36,38,41,42,46,47,48,51,52,53,55,56], - $Vj=[2,28], - $Vk=[1,38], - $Vl=[5,11,12,14,16], - $Vm=[1,39], - $Vn=[5,11,12,14,16,22,33,37], - $Vo=[5,11,12,14,16,22,33,36,37,38,41,42,46,47,48,51,52,53,55,56], - $Vp=[1,42], - $Vq=[1,41], - $Vr=[1,43], - $Vs=[1,45], - $Vt=[33,37], - $Vu=[5,11,12,14,16,22,30,33,36,37,38,39,40,41,42,46,47,48,51,52,53,54,55,56], - $Vv=[5,11,12,14,16,18], - $Vw=[5,8,11,22,27,33,36,38,41,42,46,47,48,51,52,53,55,56], - $Vx=[29,31], - $Vy=[22,24], - $Vz=[2,20], - $VA=[1,74], - $VB=[1,77], - $VC=[1,78], - $VD=[22,24,26]; + $V0=[11,22,33,36,38,41,42,46,47,48,51,52,53,55], + $V1=[5,11,12,14,16,22,33,37], + $V2=[5,11,12,14,16,22,33,36,37,38,41,42,46,47,48,51,52,53,55], + $V3=[33,37], + $V4=[5,11,12,14,16,22,30,33,36,37,38,39,40,41,42,46,47,48,51,52,53,54,55], + $V5=[5,11,12,14,16], + $V6=[5,8,11,22,27,33,36,38,41,42,46,47,48,51,52,53,55], + $V7=[22,24]; var parser = {trace: function trace() { }, yy: {}, -symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"START_COND":18,"rule":19,"start_conditions":20,"action":21,"{":22,"action_body":23,"}":24,"action_comments_body":25,"ACTION_BODY":26,"<":27,"name_list":28,">":29,"*":30,",":31,"regex_list":32,"|":33,"regex_concat":34,"regex_base":35,"(":36,")":37,"SPECIAL_GROUP":38,"+":39,"?":40,"/":41,"/!":42,"name_expansion":43,"range_regex":44,"any_group_regex":45,".":46,"^":47,"$":48,"string":49,"escape_char":50,"NAME_BRACE":51,"ANY_GROUP_REGEX":52,"ESCAPE_CHAR":53,"RANGE_REGEX":54,"STRING_LIT":55,"CHARACTER_LIT":56,"$accept":0,"$end":1}, -terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"START_COND",22:"{",24:"}",26:"ACTION_BODY",27:"<",29:">",30:"*",31:",",33:"|",36:"(",37:")",38:"SPECIAL_GROUP",39:"+",40:"?",41:"/",42:"/!",46:".",47:"^",48:"$",51:"NAME_BRACE",52:"ANY_GROUP_REGEX",53:"ESCAPE_CHAR",54:"RANGE_REGEX",55:"STRING_LIT",56:"CHARACTER_LIT"}, -productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[19,3],[21,3],[21,1],[23,0],[23,1],[23,5],[23,4],[25,1],[25,2],[20,3],[20,3],[20,0],[28,1],[28,3],[13,1],[32,3],[32,2],[32,1],[32,0],[34,2],[34,1],[35,3],[35,3],[35,2],[35,2],[35,2],[35,2],[35,2],[35,1],[35,2],[35,1],[35,1],[35,1],[35,1],[35,1],[35,1],[43,1],[45,1],[50,1],[44,1],[49,1],[49,1]], +symbols_: { + "error": 2, + "lex": 3, + "definitions": 4, + "%%": 5, + "rules": 6, + "epilogue": 7, + "EOF": 8, + "CODE": 9, + "definition": 10, + "ACTION": 11, + "NAME": 12, + "regex": 13, + "START_INC": 14, + "names_inclusive": 15, + "START_EXC": 16, + "names_exclusive": 17, + "START_COND": 18, + "rule": 19, + "start_conditions": 20, + "action": 21, + "{": 22, + "action_body": 23, + "}": 24, + "action_comments_body": 25, + "ACTION_BODY": 26, + "<": 27, + "name_list": 28, + ">": 29, + "*": 30, + ",": 31, + "regex_list": 32, + "|": 33, + "regex_concat": 34, + "regex_base": 35, + "(": 36, + ")": 37, + "SPECIAL_GROUP": 38, + "+": 39, + "?": 40, + "/": 41, + "/!": 42, + "name_expansion": 43, + "range_regex": 44, + "any_group_regex": 45, + ".": 46, + "^": 47, + "$": 48, + "string": 49, + "escape_char": 50, + "NAME_BRACE": 51, + "ANY_GROUP_REGEX": 52, + "ESCAPE_CHAR": 53, + "RANGE_REGEX": 54, + "STRING_LIT": 55, + "CHARACTER_LIT": 56, + "$accept": 0, + "$end": 1 +}, +terminals_: { + 2: "error", + 5: "%%", + 8: "EOF", + 9: "CODE", + 11: "ACTION", + 12: "NAME", + 14: "START_INC", + 16: "START_EXC", + 18: "START_COND", + 22: "{", + 24: "}", + 26: "ACTION_BODY", + 27: "<", + 29: ">", + 30: "*", + 31: ",", + 33: "|", + 36: "(", + 37: ")", + 38: "SPECIAL_GROUP", + 39: "+", + 40: "?", + 41: "/", + 42: "/!", + 46: ".", + 47: "^", + 48: "$", + 51: "NAME_BRACE", + 52: "ANY_GROUP_REGEX", + 53: "ESCAPE_CHAR", + 54: "RANGE_REGEX", + 55: "STRING_LIT", + 56: "CHARACTER_LIT" +}, +productions_: [ + 0, + [ + 3, + 4 + ], + [ + 7, + 1 + ], + [ + 7, + 2 + ], + [ + 7, + 3 + ], + [ + 4, + 2 + ], + [ + 4, + 2 + ], + [ + 4, + 0 + ], + [ + 10, + 2 + ], + [ + 10, + 2 + ], + [ + 10, + 2 + ], + [ + 15, + 1 + ], + [ + 15, + 2 + ], + [ + 17, + 1 + ], + [ + 17, + 2 + ], + [ + 6, + 2 + ], + [ + 6, + 1 + ], + [ + 19, + 3 + ], + [ + 21, + 3 + ], + [ + 21, + 1 + ], + [ + 23, + 0 + ], + [ + 23, + 1 + ], + [ + 23, + 5 + ], + [ + 23, + 4 + ], + [ + 25, + 1 + ], + [ + 25, + 2 + ], + [ + 20, + 3 + ], + [ + 20, + 3 + ], + [ + 20, + 0 + ], + [ + 28, + 1 + ], + [ + 28, + 3 + ], + [ + 13, + 1 + ], + [ + 32, + 3 + ], + [ + 32, + 2 + ], + [ + 32, + 1 + ], + [ + 32, + 0 + ], + [ + 34, + 2 + ], + [ + 34, + 1 + ], + [ + 35, + 3 + ], + [ + 35, + 3 + ], + [ + 35, + 2 + ], + [ + 35, + 2 + ], + [ + 35, + 2 + ], + [ + 35, + 2 + ], + [ + 35, + 2 + ], + [ + 35, + 1 + ], + [ + 35, + 2 + ], + [ + 35, + 1 + ], + [ + 35, + 1 + ], + [ + 35, + 1 + ], + [ + 35, + 1 + ], + [ + 35, + 1 + ], + [ + 35, + 1 + ], + [ + 43, + 1 + ], + [ + 45, + 1 + ], + [ + 50, + 1 + ], + [ + 44, + 1 + ], + [ + 49, + 1 + ], + [ + 49, + 1 + ] +], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ @@ -372,89 +666,1121 @@ case 57 : break; } }, -table: [{3:1,4:2,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4}, - {1:[3]}, - {5:[1,8]}, - {4:9,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4}, - {4:10,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4}, - __expand__([5,11,12,14,16,33], $V5, {13:11,32:12,34:13,35:14,43:19,45:20,49:24,50:25,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), - {15:31,18:[1,32]}, - {17:33,18:[1,34]}, - __expand__($Vi, $Vj, {6:35,19:36,20:37,27:$Vk}), - {5:[2,5]}, - {5:[2,6]}, - __expand__($Vl, [2,8]), - __expand__([5,11,12,14,16,22], [2,31], {33:$Vm}), - __expand__($Vn, [2,34], {43:19,45:20,49:24,50:25,35:40,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), - __expand__($Vo, [2,37], {44:44,30:$Vp,39:$Vq,40:$Vr,54:$Vs}), - __expand__($Vt, $V5, {34:13,35:14,43:19,45:20,49:24,50:25,32:46,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), - __expand__($Vt, $V5, {34:13,35:14,43:19,45:20,49:24,50:25,32:47,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), - {35:48,36:$V6,38:$V7,41:$V8,42:$V9,43:19,45:20,46:$Va,47:$Vb,48:$Vc,49:24,50:25,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}, - {35:49,36:$V6,38:$V7,41:$V8,42:$V9,43:19,45:20,46:$Va,47:$Vb,48:$Vc,49:24,50:25,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}, - __expand__($Vu, [2,45]), - __expand__($Vu, [2,47]), - __expand__($Vu, [2,48]), - __expand__($Vu, [2,49]), - __expand__($Vu, [2,50]), - __expand__($Vu, [2,51]), - __expand__($Vu, [2,52]), - __expand__($Vu, [2,53]), - __expand__($Vu, [2,54]), - __expand__($Vu, [2,57]), - __expand__($Vu, [2,58]), - __expand__($Vu, [2,55]), - __expand__($Vl, [2,9], {18:[1,50]}), - __expand__($Vv, [2,11]), - __expand__($Vl, [2,10], {18:[1,51]}), - __expand__($Vv, [2,13]), - __expand__($Vi, $Vj, {20:37,7:52,19:53,5:[1,55],8:[1,54],27:$Vk}), - __expand__($Vw, [2,16]), - __expand__([11,22,33], $V5, {32:12,34:13,35:14,43:19,45:20,49:24,50:25,13:56,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), - {12:[1,59],28:57,30:[1,58]}, - __expand__($Vn, [2,33], {35:14,43:19,45:20,49:24,50:25,34:60,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), - __expand__($Vo, [2,36], {44:44,30:$Vp,39:$Vq,40:$Vr,54:$Vs}), - __expand__($Vu, [2,40]), - __expand__($Vu, [2,41]), - __expand__($Vu, [2,42]), - __expand__($Vu, [2,46]), - __expand__($Vu, [2,56]), - {33:$Vm,37:[1,61]}, - {33:$Vm,37:[1,62]}, - __expand__($Vo, [2,43], {44:44,30:$Vp,39:$Vq,40:$Vr,54:$Vs}), - __expand__($Vo, [2,44], {44:44,30:$Vp,39:$Vq,40:$Vr,54:$Vs}), - __expand__($Vv, [2,12]), - __expand__($Vv, [2,14]), - {1:[2,1]}, - __expand__($Vw, [2,15]), - {1:[2,2]}, - {8:[1,63],9:[1,64]}, - {11:[1,67],21:65,22:[1,66]}, - {29:[1,68],31:[1,69]}, - {29:[1,70]}, - __expand__($Vx, [2,29]), - __expand__($Vn, [2,32], {43:19,45:20,49:24,50:25,35:40,36:$V6,38:$V7,41:$V8,42:$V9,46:$Va,47:$Vb,48:$Vc,51:$Vd,52:$Ve,53:$Vf,55:$Vg,56:$Vh}), - __expand__($Vu, [2,38]), - __expand__($Vu, [2,39]), - {1:[2,3]}, - {8:[1,71]}, - __expand__($Vw, [2,17]), - __expand__($Vy, $Vz, {23:72,25:73,26:$VA}), - __expand__($Vw, [2,19]), - __expand__($Vi, [2,26]), - {12:[1,75]}, - __expand__($Vi, [2,27]), - {1:[2,4]}, - {22:$VB,24:[1,76]}, - __expand__($Vy, [2,21], {26:$VC}), - __expand__($VD, [2,24]), - __expand__($Vx, [2,30]), - __expand__($Vw, [2,18]), - __expand__($Vy, $Vz, {25:73,23:79,26:$VA}), - __expand__($VD, [2,25]), - {22:$VB,24:[1,80]}, - __expand__($Vy, [2,23], {25:81,26:$VA}), - __expand__($Vy, [2,22], {26:$VC})], -defaultActions: {9:[2,5],10:[2,6],52:[2,1],54:[2,2],63:[2,3],71:[2,4]}, +table: [ + { + 3: 1, + 4: 2, + 5: [ + 2, + 7 + ], + 10: 3, + 11: [ + 1, + 4 + ], + 12: [ + 1, + 5 + ], + 14: [ + 1, + 6 + ], + 16: [ + 1, + 7 + ] + }, + { + 1: [ + 3 + ] + }, + { + 5: [ + 1, + 8 + ] + }, + { + 4: 9, + 5: [ + 2, + 7 + ], + 10: 3, + 11: [ + 1, + 4 + ], + 12: [ + 1, + 5 + ], + 14: [ + 1, + 6 + ], + 16: [ + 1, + 7 + ] + }, + { + 4: 10, + 5: [ + 2, + 7 + ], + 10: 3, + 11: [ + 1, + 4 + ], + 12: [ + 1, + 5 + ], + 14: [ + 1, + 6 + ], + 16: [ + 1, + 7 + ] + }, + __expand__([5,11,12,14,16,33], [ + 2, + 35 + ], {13:11,32:12,34:13,35:14,43:19,45:20,49:24,50:25,36:[ + 1, + 15 + ],38:[ + 1, + 16 + ],41:[ + 1, + 17 + ],42:[ + 1, + 18 + ],46:[ + 1, + 21 + ],47:[ + 1, + 22 + ],48:[ + 1, + 23 + ],51:[ + 1, + 26 + ],52:[ + 1, + 27 + ],53:[ + 1, + 30 + ],55:[ + 1, + 28 + ],56:[ + 1, + 29 + ] + }), + { + 15: 31, + 18: [ + 1, + 32 + ] + }, + { + 17: 33, + 18: [ + 1, + 34 + ] + }, + __expand__($V0, [ + 2, + 28 + ], {6:35,19:36,20:37,27:[ + 1, + 38 + ],56:[ + 2, + 28 + ] + }), + { + 5: [ + 2, + 5 + ] + }, + { + 5: [ + 2, + 6 + ] + }, + __expand__([5,11,12,14], [ + 2, + 8 + ], {16:[ + 2, + 8 + ] + }), + __expand__([5,11,12,14,16,22], [ + 2, + 31 + ], {33:[ + 1, + 39 + ] + }), + __expand__($V1, [ + 2, + 34 + ], {43:19,45:20,49:24,50:25,35:40,36:[ + 1, + 15 + ],38:[ + 1, + 16 + ],41:[ + 1, + 17 + ],42:[ + 1, + 18 + ],46:[ + 1, + 21 + ],47:[ + 1, + 22 + ],48:[ + 1, + 23 + ],51:[ + 1, + 26 + ],52:[ + 1, + 27 + ],53:[ + 1, + 30 + ],55:[ + 1, + 28 + ],56:[ + 1, + 29 + ] + }), + __expand__($V2, [ + 2, + 37 + ], {44:44,30:[ + 1, + 42 + ],39:[ + 1, + 41 + ],40:[ + 1, + 43 + ],54:[ + 1, + 45 + ],56:[ + 2, + 37 + ] + }), + __expand__($V3, [ + 2, + 35 + ], {34:13,35:14,43:19,45:20,49:24,50:25,32:46,36:[ + 1, + 15 + ],38:[ + 1, + 16 + ],41:[ + 1, + 17 + ],42:[ + 1, + 18 + ],46:[ + 1, + 21 + ],47:[ + 1, + 22 + ],48:[ + 1, + 23 + ],51:[ + 1, + 26 + ],52:[ + 1, + 27 + ],53:[ + 1, + 30 + ],55:[ + 1, + 28 + ],56:[ + 1, + 29 + ] + }), + __expand__($V3, [ + 2, + 35 + ], {34:13,35:14,43:19,45:20,49:24,50:25,32:47,36:[ + 1, + 15 + ],38:[ + 1, + 16 + ],41:[ + 1, + 17 + ],42:[ + 1, + 18 + ],46:[ + 1, + 21 + ],47:[ + 1, + 22 + ],48:[ + 1, + 23 + ],51:[ + 1, + 26 + ],52:[ + 1, + 27 + ],53:[ + 1, + 30 + ],55:[ + 1, + 28 + ],56:[ + 1, + 29 + ] + }), + { + 35: 48, + 36: [ + 1, + 15 + ], + 38: [ + 1, + 16 + ], + 41: [ + 1, + 17 + ], + 42: [ + 1, + 18 + ], + 43: 19, + 45: 20, + 46: [ + 1, + 21 + ], + 47: [ + 1, + 22 + ], + 48: [ + 1, + 23 + ], + 49: 24, + 50: 25, + 51: [ + 1, + 26 + ], + 52: [ + 1, + 27 + ], + 53: [ + 1, + 30 + ], + 55: [ + 1, + 28 + ], + 56: [ + 1, + 29 + ] + }, + { + 35: 49, + 36: [ + 1, + 15 + ], + 38: [ + 1, + 16 + ], + 41: [ + 1, + 17 + ], + 42: [ + 1, + 18 + ], + 43: 19, + 45: 20, + 46: [ + 1, + 21 + ], + 47: [ + 1, + 22 + ], + 48: [ + 1, + 23 + ], + 49: 24, + 50: 25, + 51: [ + 1, + 26 + ], + 52: [ + 1, + 27 + ], + 53: [ + 1, + 30 + ], + 55: [ + 1, + 28 + ], + 56: [ + 1, + 29 + ] + }, + __expand__($V4, [ + 2, + 45 + ], {56:[ + 2, + 45 + ] + }), + __expand__($V4, [ + 2, + 47 + ], {56:[ + 2, + 47 + ] + }), + __expand__($V4, [ + 2, + 48 + ], {56:[ + 2, + 48 + ] + }), + __expand__($V4, [ + 2, + 49 + ], {56:[ + 2, + 49 + ] + }), + __expand__($V4, [ + 2, + 50 + ], {56:[ + 2, + 50 + ] + }), + __expand__($V4, [ + 2, + 51 + ], {56:[ + 2, + 51 + ] + }), + __expand__($V4, [ + 2, + 52 + ], {56:[ + 2, + 52 + ] + }), + __expand__($V4, [ + 2, + 53 + ], {56:[ + 2, + 53 + ] + }), + __expand__($V4, [ + 2, + 54 + ], {56:[ + 2, + 54 + ] + }), + __expand__($V4, [ + 2, + 57 + ], {56:[ + 2, + 57 + ] + }), + __expand__($V4, [ + 2, + 58 + ], {56:[ + 2, + 58 + ] + }), + __expand__($V4, [ + 2, + 55 + ], {56:[ + 2, + 55 + ] + }), + __expand__($V5, [ + 2, + 9 + ], {18:[ + 1, + 50 + ] + }), + __expand__($V5, [ + 2, + 11 + ], {18:[ + 2, + 11 + ] + }), + __expand__($V5, [ + 2, + 10 + ], {18:[ + 1, + 51 + ] + }), + __expand__($V5, [ + 2, + 13 + ], {18:[ + 2, + 13 + ] + }), + __expand__($V0, [ + 2, + 28 + ], {20:37,7:52,19:53,5:[ + 1, + 55 + ],8:[ + 1, + 54 + ],27:[ + 1, + 38 + ],56:[ + 2, + 28 + ] + }), + __expand__($V6, [ + 2, + 16 + ], {56:[ + 2, + 16 + ] + }), + __expand__([11,22,33], [ + 2, + 35 + ], {32:12,34:13,35:14,43:19,45:20,49:24,50:25,13:56,36:[ + 1, + 15 + ],38:[ + 1, + 16 + ],41:[ + 1, + 17 + ],42:[ + 1, + 18 + ],46:[ + 1, + 21 + ],47:[ + 1, + 22 + ],48:[ + 1, + 23 + ],51:[ + 1, + 26 + ],52:[ + 1, + 27 + ],53:[ + 1, + 30 + ],55:[ + 1, + 28 + ],56:[ + 1, + 29 + ] + }), + { + 12: [ + 1, + 59 + ], + 28: 57, + 30: [ + 1, + 58 + ] + }, + __expand__($V1, [ + 2, + 33 + ], {35:14,43:19,45:20,49:24,50:25,34:60,36:[ + 1, + 15 + ],38:[ + 1, + 16 + ],41:[ + 1, + 17 + ],42:[ + 1, + 18 + ],46:[ + 1, + 21 + ],47:[ + 1, + 22 + ],48:[ + 1, + 23 + ],51:[ + 1, + 26 + ],52:[ + 1, + 27 + ],53:[ + 1, + 30 + ],55:[ + 1, + 28 + ],56:[ + 1, + 29 + ] + }), + __expand__($V2, [ + 2, + 36 + ], {44:44,30:[ + 1, + 42 + ],39:[ + 1, + 41 + ],40:[ + 1, + 43 + ],54:[ + 1, + 45 + ],56:[ + 2, + 36 + ] + }), + __expand__($V4, [ + 2, + 40 + ], {56:[ + 2, + 40 + ] + }), + __expand__($V4, [ + 2, + 41 + ], {56:[ + 2, + 41 + ] + }), + __expand__($V4, [ + 2, + 42 + ], {56:[ + 2, + 42 + ] + }), + __expand__($V4, [ + 2, + 46 + ], {56:[ + 2, + 46 + ] + }), + __expand__($V4, [ + 2, + 56 + ], {56:[ + 2, + 56 + ] + }), + { + 33: [ + 1, + 39 + ], + 37: [ + 1, + 61 + ] + }, + { + 33: [ + 1, + 39 + ], + 37: [ + 1, + 62 + ] + }, + __expand__($V2, [ + 2, + 43 + ], {44:44,30:[ + 1, + 42 + ],39:[ + 1, + 41 + ],40:[ + 1, + 43 + ],54:[ + 1, + 45 + ],56:[ + 2, + 43 + ] + }), + __expand__($V2, [ + 2, + 44 + ], {44:44,30:[ + 1, + 42 + ],39:[ + 1, + 41 + ],40:[ + 1, + 43 + ],54:[ + 1, + 45 + ],56:[ + 2, + 44 + ] + }), + __expand__($V5, [ + 2, + 12 + ], {18:[ + 2, + 12 + ] + }), + __expand__($V5, [ + 2, + 14 + ], {18:[ + 2, + 14 + ] + }), + { + 1: [ + 2, + 1 + ] + }, + __expand__($V6, [ + 2, + 15 + ], {56:[ + 2, + 15 + ] + }), + { + 1: [ + 2, + 2 + ] + }, + { + 8: [ + 1, + 63 + ], + 9: [ + 1, + 64 + ] + }, + { + 11: [ + 1, + 67 + ], + 21: 65, + 22: [ + 1, + 66 + ] + }, + { + 29: [ + 1, + 68 + ], + 31: [ + 1, + 69 + ] + }, + { + 29: [ + 1, + 70 + ] + }, + { + 29: [ + 2, + 29 + ], + 31: [ + 2, + 29 + ] + }, + __expand__($V1, [ + 2, + 32 + ], {43:19,45:20,49:24,50:25,35:40,36:[ + 1, + 15 + ],38:[ + 1, + 16 + ],41:[ + 1, + 17 + ],42:[ + 1, + 18 + ],46:[ + 1, + 21 + ],47:[ + 1, + 22 + ],48:[ + 1, + 23 + ],51:[ + 1, + 26 + ],52:[ + 1, + 27 + ],53:[ + 1, + 30 + ],55:[ + 1, + 28 + ],56:[ + 1, + 29 + ] + }), + __expand__($V4, [ + 2, + 38 + ], {56:[ + 2, + 38 + ] + }), + __expand__($V4, [ + 2, + 39 + ], {56:[ + 2, + 39 + ] + }), + { + 1: [ + 2, + 3 + ] + }, + { + 8: [ + 1, + 71 + ] + }, + __expand__($V6, [ + 2, + 17 + ], {56:[ + 2, + 17 + ] + }), + __expand__($V7, [ + 2, + 20 + ], {23:72,25:73,26:[ + 1, + 74 + ] + }), + __expand__($V6, [ + 2, + 19 + ], {56:[ + 2, + 19 + ] + }), + __expand__($V0, [ + 2, + 26 + ], {56:[ + 2, + 26 + ] + }), + { + 12: [ + 1, + 75 + ] + }, + __expand__($V0, [ + 2, + 27 + ], {56:[ + 2, + 27 + ] + }), + { + 1: [ + 2, + 4 + ] + }, + { + 22: [ + 1, + 77 + ], + 24: [ + 1, + 76 + ] + }, + __expand__($V7, [ + 2, + 21 + ], {26:[ + 1, + 78 + ] + }), + __expand__($V7, [ + 2, + 24 + ], {26:[ + 2, + 24 + ] + }), + { + 29: [ + 2, + 30 + ], + 31: [ + 2, + 30 + ] + }, + __expand__($V6, [ + 2, + 18 + ], {56:[ + 2, + 18 + ] + }), + __expand__($V7, [ + 2, + 20 + ], {25:73,23:79,26:[ + 1, + 74 + ] + }), + __expand__($V7, [ + 2, + 25 + ], {26:[ + 2, + 25 + ] + }), + { + 22: [ + 1, + 77 + ], + 24: [ + 1, + 80 + ] + }, + __expand__($V7, [ + 2, + 23 + ], {25:81,26:[ + 1, + 74 + ] + }), + __expand__($V7, [ + 2, + 22 + ], {26:[ + 1, + 78 + ] + }) +], +defaultActions: { + 9: [ + 2, + 5 + ], + 10: [ + 2, + 6 + ], + 52: [ + 2, + 1 + ], + 54: [ + 2, + 2 + ], + 63: [ + 2, + 3 + ], + 71: [ + 2, + 4 + ] +}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); @@ -465,14 +1791,14 @@ parseError: function parseError(str, hash) { parse: function parse(input) { var self = this, stack = [0], - tstack = [], // token stack - vstack = [null], // semantic value stack - lstack = [], // location stack + + vstack = [null], // semantic value stack + lstack = [], // location stack table = this.table, yytext = '', yylineno = 0, yyleng = 0, - recovering = 0, + TERROR = 2, EOF = 1; @@ -520,7 +1846,6 @@ parse: function parse(input) { lstack.length = lstack.length - n; } -_token_stack: function lex() { var token; token = lexer.lex() || EOF; @@ -548,7 +1873,7 @@ _token_stack: try { for (;;) { - // retreive state number from top of stack + // retrieve state number from top of stack state = stack[stack.length - 1]; // use default actions if available @@ -564,107 +1889,35 @@ _token_stack: // handle parse error if (typeof action === 'undefined' || !action.length || !action[0]) { - var error_rule_depth; var errStr = ''; - // Return the rule stack depth where the nearest error rule can be found. - // Return FALSE when no error recovery rule was found. - function locateNearestErrorRecoveryRule(state) { - var stack_probe = stack.length - 1; - var depth = 0; - - // try to recover from error - for (;;) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - return depth; - } - if (state === 0 || stack_probe < 2) { - return false; // No suitable error recovery rule available. - } - stack_probe -= 2; // popStack(1): [symbol, action] - state = stack[stack_probe]; - ++depth; - } - } - - if (!recovering) { - // first see if there's any chance at hitting an error recovery rule: - error_rule_depth = locateNearestErrorRecoveryRule(state); - - // Report error - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push("'" + this.terminals_[p] + "'"); - } - } - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + - (symbol == EOF ? "end of input" : - ("'" + (this.terminals_[symbol] || symbol) + "'")); - } - a = this.parseError(errStr, p = { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: (error_rule_depth !== false) - }); - if (!p.recoverable) { - retval = a; - break; - } - } else if (preErrorSymbol !== EOF) { - error_rule_depth = locateNearestErrorRecoveryRule(state); - } - - // just recovered from another error - if (recovering == 3) { - if (symbol === EOF || preErrorSymbol === EOF) { - retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; + // Report error + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'" + this.terminals_[p] + "'"); } - - // discard current lookahead and grab another - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - symbol = lex(); } - - // try to recover from error - if (error_rule_depth === false) { - retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + + (symbol == EOF ? "end of input" : + ("'" + (this.terminals_[symbol] || symbol) + "'")); } - popStack(error_rule_depth); - - preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length - 1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + // we cannot recover from the error! + retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; } + // this shouldn't happen, unless resolve defaults are off if (action[0] instanceof Array && action.length > 1) { retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { @@ -692,9 +1945,7 @@ _token_stack: yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; - if (recovering > 0) { - recovering--; - } + } else { // error just occurred, resume old lookahead f/ before error symbol = preErrorSymbol; @@ -780,7 +2031,7 @@ function prepareString (s) { }; /* generated by jison-lex 0.3.4 */ -var lexer = (function(){ +var lexer = (function () { var lexer = ({ EOF:1, @@ -825,9 +2076,29 @@ input:function () { this.match += ch; this.matched += ch; // Count the linenumber up when we hit the LF (or a stand-alone CR). - // On CRLF, the linenumber is incremented when you fetch the LF: - // the CR is hence 'assigned' to the previous line. - var lines = this._input.match(/^(?:\r[^\n]|\r$|\n)/); + // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo + // and we advance immediately past the LF as well, returning both together as if + // it was all a single 'character' only. + var slice_len = 1; + var lines = false; + if (ch === '\n') { + lines = true; + } else if (ch === '\r') { + lines = true; + var ch2 = this._input[1]; + if (ch2 === '\n') { + slice_len++; + ch += ch2; + this.yytext += ch2; + this.yyleng++; + this.offset++; + this.match += ch2; + this.matched += ch2; + if (this.options.ranges) { + this.yylloc.range[1]++; + } + } + } if (lines) { this.yylineno++; this.yylloc.last_line++; @@ -838,7 +2109,7 @@ input:function () { this.yylloc.range[1]++; } - this._input = this._input.slice(1); + this._input = this._input.slice(slice_len); return ch; }, @@ -931,9 +2202,9 @@ upcomingInput:function (maxSize) { // return a string which displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { - var pre = this.pastInput().replace(/\s/g, " "); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput().replace(/\s/g, " ") + "\n" + c + "^"; + var pre = this.pastInput().replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput().replace(/\s/g, ' ') + '\n' + c + '^'; }, // test the lexed token: return FALSE when not a match, otherwise return token @@ -1070,7 +2341,7 @@ next:function () { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } - if (this._input === "") { + if (this._input === '') { clear.call(this); this.done = true; return this.EOF; @@ -1100,7 +2371,7 @@ lex:function lex() { } while (!r) { r = this.next(); - }; + } if (typeof this.options.post_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.options.post_lex.call(this, r) || r; @@ -1128,7 +2399,7 @@ _currentRules:function _currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { - return this.conditions["INITIAL"].rules; + return this.conditions['INITIAL'].rules; } }, @@ -1138,7 +2409,7 @@ topState:function topState(n) { if (n >= 0) { return this.conditionStack[n]; } else { - return "INITIAL"; + return 'INITIAL'; } }, @@ -1151,10 +2422,13 @@ pushState:function pushState(condition) { stateStackSize:function stateStackSize() { return this.conditionStack.length; }, -options: {"easy_keyword_rules":true}, -performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { +options: { + "easy_keyword_rules": true, + "ranges": true +}, +performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { -var YYSTATE=YY_START; +var YYSTATE = YY_START; switch($avoiding_name_collisions) { case 0 : /*! Conditions:: action */ @@ -1506,8 +2780,312 @@ simpleCaseActionClusters: { /*! Rule:: $ */ 8 }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], -conditions: {"code":{"rules":[67,68],"inclusive":false},"start_condition":{"rules":[22,23,24,25,67],"inclusive":false},"options":{"rules":[18,19,20,21,67],"inclusive":false},"conditions":{"rules":[9,10,11,12,67],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,67],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67],"inclusive":true}} +rules: [ +/^(?:\/\*(.|\n|\r)*?\*\/)/, +/^(?:\/\/.*)/, +/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/, +/^(?:"(\\\\|\\"|[^"])*")/, +/^(?:'(\\\\|\\'|[^'])*')/, +/^(?:[/"'][^{}/"']+)/, +/^(?:[^{}/"']+)/, +/^(?:\{)/, +/^(?:\})/, +/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, +/^(?:>)/, +/^(?:,)/, +/^(?:\*)/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:\s+(\r\n|\n|\r)+)/, +/^(?:\s+)/, +/^(?:%%)/, +/^(?:[a-zA-Z0-9_]+)/, +/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:\s+(\r\n|\n|\r)+)/, +/^(?:\s+)/, +/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:\s+(\r\n|\n|\r)+)/, +/^(?:\s+)/, +/^(?:\s*(\r\n|\n|\r)+)/, +/^(?:\{)/, +/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, +/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, +/^(?:.+)/, +/^(?:\/\*(.|\n|\r)*?\*\/)/, +/^(?:\/\/.*)/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:\s+)/, +/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, +/^(?:"(\\\\|\\"|[^"])*")/, +/^(?:'(\\\\|\\'|[^'])*')/, +/^(?:\|)/, +/^(?:\[(\\\\|\\\]|[^\]])*\])/, +/^(?:\(\?:)/, +/^(?:\(\?=)/, +/^(?:\(\?!)/, +/^(?:\()/, +/^(?:\))/, +/^(?:\+)/, +/^(?:\*)/, +/^(?:\?)/, +/^(?:\^)/, +/^(?:,)/, +/^(?:<>)/, +/^(?:<)/, +/^(?:\/!)/, +/^(?:\/)/, +/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/, +/^(?:\\.)/, +/^(?:\$)/, +/^(?:\.)/, +/^(?:%options\b)/, +/^(?:%s\b)/, +/^(?:%x\b)/, +/^(?:%%)/, +/^(?:\{\d+(,\s?\d+|,)?\})/, +/^(?:\{([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)\})/, +/^(?:\{)/, +/^(?:\})/, +/^(?:.)/, +/^(?:$)/, +/^(?:(.|(\r\n|\n|\r))+)/ +], +conditions: { + "code": { + "rules": [ + 67, + 68 + ], + "inclusive": false + }, + "start_condition": { + "rules": [ + 22, + 23, + 24, + 25, + 67 + ], + "inclusive": false + }, + "options": { + "rules": [ + 18, + 19, + 20, + 21, + 67 + ], + "inclusive": false + }, + "conditions": { + "rules": [ + 9, + 10, + 11, + 12, + 67 + ], + "inclusive": false + }, + "action": { + "rules": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 67 + ], + "inclusive": false + }, + "indented": { + "rules": [ + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67 + ], + "inclusive": true + }, + "trail": { + "rules": [ + 26, + 29, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67 + ], + "inclusive": true + }, + "rules": { + "rules": [ + 13, + 14, + 15, + 16, + 17, + 29, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67 + ], + "inclusive": true + }, + "INITIAL": { + "rules": [ + 29, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67 + ], + "inclusive": true + } +} }); return lexer; })(); @@ -1520,19 +3098,9 @@ return new Parser; })(); + if (typeof require !== 'undefined' && typeof exports !== 'undefined') { exports.parser = lexParser; exports.Parser = lexParser.Parser; exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; -exports.main = function commonjsMain(args) { - if (!args[1]) { - console.log('Usage: '+args[0]+' FILE'); - process.exit(1); - } - var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); - return exports.parser.parse(source); -}; -if (typeof module !== 'undefined' && require.main === module) { - exports.main(process.argv.slice(1)); -} -} +} \ No newline at end of file diff --git a/lex.l b/lex.l index cebb059..ee69867 100644 --- a/lex.l +++ b/lex.l @@ -1,11 +1,12 @@ -NAME [a-zA-Z_][a-zA-Z0-9_-]* +NAME [a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])? BR \r\n|\n|\r %s indented trail rules %x code start_condition options conditions action %options easy_keyword_rules +%options ranges %% From 94ad617e31a0c2cb9d2dd8635d6779464afac212 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 2 Jun 2015 12:36:13 +0200 Subject: [PATCH 062/417] synced package.json --- package.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 64e71b4..c26e00a 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,9 @@ { + "author": { + "name": "Zach Carter", + "email": "zach@carter.name", + "url": "http://zaa.ch" + }, "name": "lex-parser", "version": "0.1.4", "description": "A parser for lexical grammars used by jison", @@ -16,7 +21,6 @@ "parser", "jison" ], - "author": "Zach Carter", "license": "MIT", "devDependencies": { "jison": "git://github.com/GerHobbelt/jison.git#master", From 50ba6c6d6f65252d548b7c6f1490ff09da002ffa Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 2 Jun 2015 16:13:13 +0200 Subject: [PATCH 063/417] regenerated grammar/parser --- lex-parser.js | 352 ++++++++++++++++++++++---------------------------- 1 file changed, 152 insertions(+), 200 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 1b9543b..2371d34 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1791,7 +1791,7 @@ parseError: function parseError(str, hash) { parse: function parse(input) { var self = this, stack = [0], - + vstack = [null], // semantic value stack lstack = [], // location stack table = this.table, @@ -1799,6 +1799,7 @@ parse: function parse(input) { yylineno = 0, yyleng = 0, + error_signaled = false, TERROR = 2, EOF = 1; @@ -1860,7 +1861,7 @@ parse: function parse(input) { var preErrorSymbol = null; var state, action, a, r; var yyval = {}; - var p, len, newState; + var p, len, len1, this_production, lstack_begin, lstack_end, newState; var expected = []; var retval = false; @@ -1871,6 +1872,23 @@ parse: function parse(input) { sharedState.yy.pre_parse.call(this, sharedState.yy); } + + + function collect_expected_token_set(state) { + var tokenset = []; + for (var p in table[state]) { + if (p > TERROR) { + if (self.terminal_descriptions_ && self.terminal_descriptions_[p]) { + tokenset.push(self.terminal_descriptions_[p]); + } + else if (self.terminals_[p]) { + tokenset.push("'" + self.terminals_[p] + "'"); + } + } + } + return tokenset; + } + try { for (;;) { // retrieve state number from top of stack @@ -1889,24 +1907,20 @@ parse: function parse(input) { // handle parse error if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr = ''; + var errStr; // Report error - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push("'" + this.terminals_[p] + "'"); - } - } + expected = collect_expected_token_set(state); if (lexer.showPosition) { errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; } else { errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + - (symbol == EOF ? "end of input" : + (symbol === EOF ? "end of input" : ("'" + (this.terminals_[symbol] || symbol) + "'")); } // we cannot recover from the error! - retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { + error_signaled = true; + retval = this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, @@ -1920,6 +1934,7 @@ parse: function parse(input) { // this shouldn't happen, unless resolve defaults are off if (action[0] instanceof Array && action.length > 1) { + error_signaled = true; retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { text: lexer.match, token: this.terminals_[symbol] || symbol, @@ -1957,35 +1972,38 @@ parse: function parse(input) { // reduce //this.reductionCount++; - len = this.productions_[action[1]][1]; + this_production = this.productions_[action[1]]; + len = this_production[1]; + lstack_end = lstack.length; + lstack_begin = lstack_end - (len1 || 1); + lstack_end--; // perform semantic action yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 // default location, uses first token for firsts, last for lasts yyval._$ = { - first_line: lstack[lstack.length - (len || 1)].first_line, - last_line: lstack[lstack.length - 1].last_line, - first_column: lstack[lstack.length - (len || 1)].first_column, - last_column: lstack[lstack.length - 1].last_column + first_line: lstack[lstack_begin].first_line, + last_line: lstack[lstack_end].last_line, + first_column: lstack[lstack_begin].first_column, + last_column: lstack[lstack_end].last_column }; if (ranges) { - yyval._$.range = [lstack[lstack.length - (len || 1)].range[0], lstack[lstack.length - 1].range[1]]; + yyval._$.range = [lstack[lstack_begin].range[0], lstack[lstack_end].range[1]]; } r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); if (typeof r !== 'undefined') { retval = r; + error_signaled = true; break; } // pop off stack if (len) { - stack = stack.slice(0, -1 * len * 2); - vstack = vstack.slice(0, -1 * len); - lstack = lstack.slice(0, -1 * len); + popStack(len); } - stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + stack.push(this_production[0]); // push nonterminal (reduce) vstack.push(yyval.$); lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL] @@ -1996,10 +2014,14 @@ parse: function parse(input) { case 3: // accept retval = true; + error_signaled = true; break; } // break out of loop: we accept or fail with error + if (!error_signaled) { + // b0rk b0rk b0rk! + } break; } } finally { @@ -2430,41 +2452,11 @@ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) var YYSTATE = YY_START; switch($avoiding_name_collisions) { -case 0 : -/*! Conditions:: action */ -/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - return 26; -break; -case 1 : -/*! Conditions:: action */ -/*! Rule:: \/\/.* */ - return 26; -break; case 2 : /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ return 26; // regexp with braces or quotes (and no spaces) break; -case 3 : -/*! Conditions:: action */ -/*! Rule:: "(\\\\|\\"|[^"])*" */ - return 26; -break; -case 4 : -/*! Conditions:: action */ -/*! Rule:: '(\\\\|\\'|[^'])*' */ - return 26; -break; -case 5 : -/*! Conditions:: action */ -/*! Rule:: [/"'][^{}/"']+ */ - return 26; -break; -case 6 : -/*! Conditions:: action */ -/*! Rule:: [^{}/"']+ */ - return 26; -break; case 7 : /*! Conditions:: action */ /*! Rule:: \{ */ @@ -2475,26 +2467,11 @@ case 8 : /*! Rule:: \} */ if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 24; break; -case 9 : -/*! Conditions:: conditions */ -/*! Rule:: {NAME} */ - return 12; -break; case 10 : /*! Conditions:: conditions */ /*! Rule:: > */ this.popState(); return 29; break; -case 11 : -/*! Conditions:: conditions */ -/*! Rule:: , */ - return 31; -break; -case 12 : -/*! Conditions:: conditions */ -/*! Rule:: \* */ - return 30; -break; case 13 : /*! Conditions:: rules */ /*! Rule:: {BR}+ */ @@ -2515,11 +2492,6 @@ case 16 : /*! Rule:: %% */ this.begin('code'); return 5; break; -case 17 : -/*! Conditions:: rules */ -/*! Rule:: [a-zA-Z0-9_]+ */ - return 56; -break; case 18 : /*! Conditions:: options */ /*! Rule:: {NAME} */ @@ -2540,11 +2512,6 @@ case 21 : /*! Rule:: \s+ */ /* empty */ break; -case 22 : -/*! Conditions:: start_condition */ -/*! Rule:: {NAME} */ - return 18; -break; case 23 : /*! Conditions:: start_condition */ /*! Rule:: {BR}+ */ @@ -2605,11 +2572,6 @@ case 34 : /*! Rule:: \s+ */ /* empty */ break; -case 35 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: {NAME} */ - return 12; -break; case 36 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ @@ -2620,106 +2582,16 @@ case 37 : /*! Rule:: '(\\\\|\\'|[^'])*' */ yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; break; -case 38 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \| */ - return 33; -break; -case 39 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ - return 52; -break; -case 40 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \(\?: */ - return 38; -break; -case 41 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \(\?= */ - return 38; -break; -case 42 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \(\?! */ - return 38; -break; -case 43 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \( */ - return 36; -break; -case 44 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \) */ - return 37; -break; -case 45 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \+ */ - return 39; -break; -case 46 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \* */ - return 30; -break; -case 47 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \? */ - return 40; -break; -case 48 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \^ */ - return 47; -break; -case 49 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: , */ - return 31; -break; -case 50 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: <> */ - return 48; -break; case 51 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: < */ this.begin('conditions'); return 27; break; -case 52 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/! */ - return 42; -break; -case 53 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/ */ - return 41; -break; -case 54 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - return 53; -break; case 55 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\. */ yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; break; -case 56 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \$ */ - return 48; -break; -case 57 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \. */ - return 46; -break; case 58 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %options\b */ @@ -2740,45 +2612,125 @@ case 61 : /*! Rule:: %% */ this.begin('rules'); return 5; break; -case 62 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \{\d+(,\s?\d+|,)?\} */ - return 54; -break; -case 63 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \{{NAME}\} */ - return 51; -break; -case 64 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \{ */ - return 22; -break; -case 65 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \} */ - return 24; -break; case 66 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: . */ throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ break; -case 68 : -/*! Conditions:: code */ -/*! Rule:: (.|{BR})+ */ - return 9; -break; default: return this.simpleCaseActionClusters[$avoiding_name_collisions]; } }, simpleCaseActionClusters: { -67 : -/*! Conditions:: * */ -/*! Rule:: $ */ - 8 + + /*! Conditions:: action */ + /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + 0 : 26, + /*! Conditions:: action */ + /*! Rule:: \/\/.* */ + 1 : 26, + /*! Conditions:: action */ + /*! Rule:: "(\\\\|\\"|[^"])*" */ + 3 : 26, + /*! Conditions:: action */ + /*! Rule:: '(\\\\|\\'|[^'])*' */ + 4 : 26, + /*! Conditions:: action */ + /*! Rule:: [/"'][^{}/"']+ */ + 5 : 26, + /*! Conditions:: action */ + /*! Rule:: [^{}/"']+ */ + 6 : 26, + /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ + 9 : 12, + /*! Conditions:: conditions */ + /*! Rule:: , */ + 11 : 31, + /*! Conditions:: conditions */ + /*! Rule:: \* */ + 12 : 30, + /*! Conditions:: rules */ + /*! Rule:: [a-zA-Z0-9_]+ */ + 17 : 56, + /*! Conditions:: start_condition */ + /*! Rule:: {NAME} */ + 22 : 18, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: {NAME} */ + 35 : 12, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \| */ + 38 : 33, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ + 39 : 52, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \(\?: */ + 40 : 38, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \(\?= */ + 41 : 38, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \(\?! */ + 42 : 38, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \( */ + 43 : 36, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \) */ + 44 : 37, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \+ */ + 45 : 39, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \* */ + 46 : 30, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \? */ + 47 : 40, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \^ */ + 48 : 47, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: , */ + 49 : 31, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: <> */ + 50 : 48, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \/! */ + 52 : 42, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \/ */ + 53 : 41, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + 54 : 53, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \$ */ + 56 : 48, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \. */ + 57 : 46, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \{\d+(,\s?\d+|,)?\} */ + 62 : 54, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \{{NAME}\} */ + 63 : 51, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \{ */ + 64 : 22, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \} */ + 65 : 24, + /*! Conditions:: * */ + /*! Rule:: $ */ + 67 : 8, + /*! Conditions:: code */ + /*! Rule:: (.|{BR})+ */ + 68 : 9 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, From f1cfe70a2239d822653f86dee4200f8c65df3cae Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 8 Jun 2015 13:24:47 +0200 Subject: [PATCH 064/417] using named references in the actions for improved legibility --- lex-parser.js | 2 +- lex.y | 54 +++++++++++++++++++++++++-------------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 2371d34..30f9cc7 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -517,7 +517,7 @@ case 6 : break; case 7 : /*! Production:: definitions : */ - yy.actionInclude = ''; this.$ = [null,null]; + yy.actionInclude = ''; this.$ = [null, null]; break; case 8 : /*! Production:: definition : NAME regex */ diff --git a/lex.y b/lex.y index 629d42c..6eada3a 100644 --- a/lex.y +++ b/lex.y @@ -29,7 +29,7 @@ epilogue | '%%' EOF { $$ = null; } | '%%' CODE EOF - { $$ = $2; } + { $$ = $CODE; } ; definitions @@ -47,58 +47,58 @@ definitions } } | ACTION definitions - { yy.actionInclude += $1; $$ = $definitions; } + { yy.actionInclude += $ACTION; $$ = $definitions; } | - { yy.actionInclude = ''; $$ = [null,null]; } + { yy.actionInclude = ''; $$ = [null, null]; } ; definition : NAME regex - { $$ = [$1, $2]; } + { $$ = [$NAME, $regex]; } | START_INC names_inclusive - { $$ = $2; } + { $$ = $names_inclusive; } | START_EXC names_exclusive - { $$ = $2; } + { $$ = $names_exclusive; } ; names_inclusive : START_COND - { $$ = {}; $$[$1] = 0; } + { $$ = {}; $$[$START_COND] = 0; } | names_inclusive START_COND - { $$ = $1; $$[$2] = 0; } + { $$ = $names_inclusive; $$[$START_COND] = 0; } ; names_exclusive : START_COND - { $$ = {}; $$[$1] = 1; } + { $$ = {}; $$[$START_COND] = 1; } | names_exclusive START_COND - { $$ = $1; $$[$2] = 1; } + { $$ = $names_exclusive; $$[$START_COND] = 1; } ; rules : rules rule - { $$ = $1; $$.push($2); } + { $$ = $rules; $$.push($rule); } | rule - { $$ = [$1]; } + { $$ = [$rule]; } ; rule : start_conditions regex action - { $$ = $1 ? [$1, $2, $3] : [$2, $3]; } + { $$ = $start_conditions ? [$start_conditions, $regex, $action] : [$regex, $action]; } ; action : '{' action_body '}' - { $$ = $2; } + { $$ = $action_body; } | ACTION - { $$ = $1; } + { $$ = $ACTION; } ; action_body : { $$ = ''; } | action_comments_body - { $$ = $1; } + { $$ = $action_comments_body; } | action_body '{' action_body '}' action_comments_body { $$ = $1 + $2 + $3 + $4 + $5; } | action_body '{' action_body '}' @@ -115,7 +115,7 @@ action_comments_body start_conditions : '<' name_list '>' - { $$ = $2; } + { $$ = $name_list; } | '<' '*' '>' { $$ = ['*']; } | @@ -123,15 +123,15 @@ start_conditions name_list : NAME - { $$ = [$1]; } + { $$ = [$NAME]; } | name_list ',' NAME - { $$ = $1; $$.push($3); } + { $$ = $name_list; $$.push($NAME); } ; regex : regex_list { - $$ = $1; + $$ = $regex_list; if (yy.options && yy.options.easy_keyword_rules && $$.match(/[\w\d]$/) && !$$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { $$ += "\\b"; } @@ -156,19 +156,19 @@ regex_concat regex_base : '(' regex_list ')' - { $$ = '(' + $2 + ')'; } + { $$ = '(' + $regex_list + ')'; } | SPECIAL_GROUP regex_list ')' - { $$ = $1 + $2 + ')'; } + { $$ = $SPECIAL_GROUP + $regex_list + ')'; } | regex_base '+' - { $$ = $1 + '+'; } + { $$ = $regex_base + '+'; } | regex_base '*' - { $$ = $1 + '*'; } + { $$ = $regex_base + '*'; } | regex_base '?' - { $$ = $1 + '?'; } + { $$ = $regex_base + '?'; } | '/' regex_base - { $$ = '(?=' + $2 + ')'; } + { $$ = '(?=' + $regex_base + ')'; } | '/!' regex_base - { $$ = '(?!' + $2 + ')'; } + { $$ = '(?!' + $regex_base + ')'; } | name_expansion | regex_base range_regex { $$ = $1 + $2; } From 0f36209bb9aaa1e54401b5b0ebdb60d1176a7a9b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 8 Jun 2015 13:44:57 +0200 Subject: [PATCH 065/417] add support for bison way of bundling multiple rules in a single 'start condition' block: ` { rule1; rule2; ... }` -- **WARNING**: this creates a grammar ambiguity as we allow `{` to start any action block *and* permit empty regexes vis the potentially empty `regex_list` rule. Hence this feature cannot be implemented without some more changes to JISON! --- lex-parser.js | 1131 ++++++++++++++++++++++++++++--------------------- lex.y | 32 +- 2 files changed, 677 insertions(+), 486 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 30f9cc7..0a3a8c4 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -124,14 +124,17 @@ var __expand__ = function (k, v, o) { } return o; }, - $V0=[11,22,33,36,38,41,42,46,47,48,51,52,53,55], - $V1=[5,11,12,14,16,22,33,37], - $V2=[5,11,12,14,16,22,33,36,37,38,41,42,46,47,48,51,52,53,55], - $V3=[33,37], - $V4=[5,11,12,14,16,22,30,33,36,37,38,39,40,41,42,46,47,48,51,52,53,54,55], + $V0=[11,22,35,38,40,43,44,48,49,50,53,54,55,57], + $V1=[5,11,12,14,16,22,35,39], + $V2=[5,11,12,14,16,22,35,38,39,40,43,44,48,49,50,53,54,55,57], + $V3=[35,39], + $V4=[5,11,12,14,16,22,32,35,38,39,40,41,42,43,44,48,49,50,53,54,55,56,57], $V5=[5,11,12,14,16], - $V6=[5,8,11,22,27,33,36,38,41,42,46,47,48,51,52,53,55], - $V7=[22,24]; + $V6=[5,8,11,22,29,35,38,40,43,44,48,49,50,53,54,55,57], + $V7=[11,22,35], + $V8=[11,22,24,35,38,40,43,44,48,49,50,53,54,55,57], + $V9=[5,8,11,22,24,29,35,38,40,43,44,48,49,50,53,54,55,57], + $Va=[22,24]; var parser = {trace: function trace() { }, yy: {}, symbols_: { @@ -152,44 +155,46 @@ symbols_: { "START_EXC": 16, "names_exclusive": 17, "START_COND": 18, - "rule": 19, + "rules_collective": 19, "start_conditions": 20, - "action": 21, + "rule": 21, "{": 22, - "action_body": 23, + "rule_block": 23, "}": 24, - "action_comments_body": 25, - "ACTION_BODY": 26, - "<": 27, - "name_list": 28, - ">": 29, - "*": 30, - ",": 31, - "regex_list": 32, - "|": 33, - "regex_concat": 34, - "regex_base": 35, - "(": 36, - ")": 37, - "SPECIAL_GROUP": 38, - "+": 39, - "?": 40, - "/": 41, - "/!": 42, - "name_expansion": 43, - "range_regex": 44, - "any_group_regex": 45, - ".": 46, - "^": 47, - "$": 48, - "string": 49, - "escape_char": 50, - "NAME_BRACE": 51, - "ANY_GROUP_REGEX": 52, - "ESCAPE_CHAR": 53, - "RANGE_REGEX": 54, - "STRING_LIT": 55, - "CHARACTER_LIT": 56, + "action": 25, + "action_body": 26, + "action_comments_body": 27, + "ACTION_BODY": 28, + "<": 29, + "name_list": 30, + ">": 31, + "*": 32, + ",": 33, + "regex_list": 34, + "|": 35, + "regex_concat": 36, + "regex_base": 37, + "(": 38, + ")": 39, + "SPECIAL_GROUP": 40, + "+": 41, + "?": 42, + "/": 43, + "/!": 44, + "name_expansion": 45, + "range_regex": 46, + "any_group_regex": 47, + ".": 48, + "^": 49, + "$": 50, + "string": 51, + "escape_char": 52, + "NAME_BRACE": 53, + "ANY_GROUP_REGEX": 54, + "ESCAPE_CHAR": 55, + "RANGE_REGEX": 56, + "STRING_LIT": 57, + "CHARACTER_LIT": 58, "$accept": 0, "$end": 1 }, @@ -205,28 +210,28 @@ terminals_: { 18: "START_COND", 22: "{", 24: "}", - 26: "ACTION_BODY", - 27: "<", - 29: ">", - 30: "*", - 31: ",", - 33: "|", - 36: "(", - 37: ")", - 38: "SPECIAL_GROUP", - 39: "+", - 40: "?", - 41: "/", - 42: "/!", - 46: ".", - 47: "^", - 48: "$", - 51: "NAME_BRACE", - 52: "ANY_GROUP_REGEX", - 53: "ESCAPE_CHAR", - 54: "RANGE_REGEX", - 55: "STRING_LIT", - 56: "CHARACTER_LIT" + 28: "ACTION_BODY", + 29: "<", + 31: ">", + 32: "*", + 33: ",", + 35: "|", + 38: "(", + 39: ")", + 40: "SPECIAL_GROUP", + 41: "+", + 42: "?", + 43: "/", + 44: "/!", + 48: ".", + 49: "^", + 50: "$", + 53: "NAME_BRACE", + 54: "ANY_GROUP_REGEX", + 55: "ESCAPE_CHAR", + 56: "RANGE_REGEX", + 57: "STRING_LIT", + 58: "CHARACTER_LIT" }, productions_: [ 0, @@ -296,38 +301,54 @@ productions_: [ ], [ 19, - 3 + 2 + ], + [ + 19, + 4 + ], + [ + 23, + 2 + ], + [ + 23, + 1 ], [ 21, + 2 + ], + [ + 25, 3 ], [ - 21, + 25, 1 ], [ - 23, + 26, 0 ], [ - 23, + 26, 1 ], [ - 23, + 26, 5 ], [ - 23, + 26, 4 ], [ - 25, + 27, 1 ], [ - 25, + 27, 2 ], [ @@ -343,11 +364,11 @@ productions_: [ 0 ], [ - 28, + 30, 1 ], [ - 28, + 30, 3 ], [ @@ -355,111 +376,111 @@ productions_: [ 1 ], [ - 32, + 34, 3 ], [ - 32, + 34, 2 ], [ - 32, + 34, 1 ], [ - 32, + 34, 0 ], [ - 34, + 36, 2 ], [ - 34, + 36, 1 ], [ - 35, + 37, 3 ], [ - 35, + 37, 3 ], [ - 35, + 37, 2 ], [ - 35, + 37, 2 ], [ - 35, + 37, 2 ], [ - 35, + 37, 2 ], [ - 35, + 37, 2 ], [ - 35, + 37, 1 ], [ - 35, + 37, 2 ], [ - 35, + 37, 1 ], [ - 35, + 37, 1 ], [ - 35, + 37, 1 ], [ - 35, + 37, 1 ], [ - 35, + 37, 1 ], [ - 35, + 37, 1 ], [ - 43, + 45, 1 ], [ - 45, + 47, 1 ], [ - 50, + 52, 1 ], [ - 44, + 46, 1 ], [ - 49, + 51, 1 ], [ - 49, + 51, 1 ] ], @@ -490,9 +511,9 @@ case 2 : break; case 4 : /*! Production:: epilogue : %% CODE EOF */ - case 18 : + case 22 : /*! Production:: action : { action_body } */ - case 26 : + case 30 : /*! Production:: start_conditions : < name_list > */ this.$ = $$[$0-1]; break; @@ -521,15 +542,19 @@ case 7 : break; case 8 : /*! Production:: definition : NAME regex */ + case 21 : +/*! Production:: rule : regex action */ this.$ = [$$[$0-1], $$[$0]]; break; case 9 : /*! Production:: definition : START_INC names_inclusive */ case 10 : /*! Production:: definition : START_EXC names_exclusive */ - case 19 : + case 16 : +/*! Production:: rules : rules_collective */ + case 23 : /*! Production:: action : ACTION */ - case 21 : + case 25 : /*! Production:: action_body : action_comments_body */ this.$ = $$[$0]; break; @@ -550,60 +575,80 @@ case 14 : this.$ = $$[$0-1]; this.$[$$[$0]] = 1; break; case 15 : -/*! Production:: rules : rules rule */ - this.$ = $$[$0-1]; this.$.push($$[$0]); -break; -case 16 : -/*! Production:: rules : rule */ - case 29 : -/*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; +/*! Production:: rules : rules rules_collective */ + this.$ = $$[$0-1].concat($$[$0]); break; case 17 : -/*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; +/*! Production:: rules_collective : start_conditions rule */ + + if ($$[$0-1]) { + $$[$0].unshift($$[$0-1]); + } + this.$ = [$$[$0]]; + +break; +case 18 : +/*! Production:: rules_collective : start_conditions { rule_block } */ + + if ($$[$0-3]) { + $$[$0-1].forEach(function (d) { + d.unshift($$[$0-3]); + }); + } + this.$ = $$[$0-1]; + +break; +case 19 : +/*! Production:: rule_block : rule_block rule */ + this.$ = $rules; this.$.push($$[$0]); break; case 20 : +/*! Production:: rule_block : rule */ + case 33 : +/*! Production:: name_list : NAME */ + this.$ = [$$[$0]]; +break; +case 24 : /*! Production:: action_body : */ - case 35 : + case 39 : /*! Production:: regex_list : */ this.$ = ''; break; -case 22 : +case 26 : /*! Production:: action_body : action_body { action_body } action_comments_body */ this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 23 : +case 27 : /*! Production:: action_body : action_body { action_body } */ this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24 : +case 28 : /*! Production:: action_comments_body : ACTION_BODY */ - case 54 : + case 58 : /*! Production:: any_group_regex : ANY_GROUP_REGEX */ - case 55 : + case 59 : /*! Production:: escape_char : ESCAPE_CHAR */ - case 56 : + case 60 : /*! Production:: range_regex : RANGE_REGEX */ this.$ = yytext; break; -case 25 : +case 29 : /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - case 36 : + case 40 : /*! Production:: regex_concat : regex_concat regex_base */ - case 46 : + case 50 : /*! Production:: regex_base : regex_base range_regex */ this.$ = $$[$0-1] + $$[$0]; break; -case 27 : +case 31 : /*! Production:: start_conditions : < * > */ this.$ = ['*']; break; -case 30 : +case 34 : /*! Production:: name_list : name_list , NAME */ this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 31 : +case 35 : /*! Production:: regex : regex_list */ this.$ = $$[$0]; @@ -612,55 +657,55 @@ case 31 : } break; -case 32 : +case 36 : /*! Production:: regex_list : regex_list | regex_concat */ this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 33 : +case 37 : /*! Production:: regex_list : regex_list | */ this.$ = $$[$0-1] + '|'; break; -case 38 : +case 42 : /*! Production:: regex_base : ( regex_list ) */ this.$ = '(' + $$[$0-1] + ')'; break; -case 39 : +case 43 : /*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 40 : +case 44 : /*! Production:: regex_base : regex_base + */ this.$ = $$[$0-1] + '+'; break; -case 41 : +case 45 : /*! Production:: regex_base : regex_base * */ this.$ = $$[$0-1] + '*'; break; -case 42 : +case 46 : /*! Production:: regex_base : regex_base ? */ this.$ = $$[$0-1] + '?'; break; -case 43 : +case 47 : /*! Production:: regex_base : / regex_base */ this.$ = '(?=' + $$[$0] + ')'; break; -case 44 : +case 48 : /*! Production:: regex_base : /! regex_base */ this.$ = '(?!' + $$[$0] + ')'; break; -case 48 : +case 52 : /*! Production:: regex_base : . */ this.$ = '.'; break; -case 49 : +case 53 : /*! Production:: regex_base : ^ */ this.$ = '^'; break; -case 50 : +case 54 : /*! Production:: regex_base : $ */ this.$ = '$'; break; -case 57 : +case 61 : /*! Production:: string : STRING_LIT */ this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; @@ -751,43 +796,43 @@ table: [ 7 ] }, - __expand__([5,11,12,14,16,33], [ + __expand__([5,11,12,14,16,35], [ 2, - 35 - ], {13:11,32:12,34:13,35:14,43:19,45:20,49:24,50:25,36:[ + 39 + ], {13:11,34:12,36:13,37:14,45:19,47:20,51:24,52:25,38:[ 1, 15 - ],38:[ + ],40:[ 1, 16 - ],41:[ + ],43:[ 1, 17 - ],42:[ + ],44:[ 1, 18 - ],46:[ + ],48:[ 1, 21 - ],47:[ + ],49:[ 1, 22 - ],48:[ + ],50:[ 1, 23 - ],51:[ + ],53:[ 1, 26 - ],52:[ + ],54:[ 1, 27 - ],53:[ + ],55:[ 1, 30 - ],55:[ + ],57:[ 1, 28 - ],56:[ + ],58:[ 1, 29 ] @@ -808,13 +853,13 @@ table: [ }, __expand__($V0, [ 2, - 28 - ], {6:35,19:36,20:37,27:[ + 32 + ], {6:35,19:36,20:37,29:[ 1, 38 - ],56:[ + ],58:[ 2, - 28 + 32 ] }), { @@ -839,359 +884,359 @@ table: [ }), __expand__([5,11,12,14,16,22], [ 2, - 31 - ], {33:[ + 35 + ], {35:[ 1, 39 ] }), __expand__($V1, [ 2, - 34 - ], {43:19,45:20,49:24,50:25,35:40,36:[ + 38 + ], {45:19,47:20,51:24,52:25,37:40,38:[ 1, 15 - ],38:[ + ],40:[ 1, 16 - ],41:[ + ],43:[ 1, 17 - ],42:[ + ],44:[ 1, 18 - ],46:[ + ],48:[ 1, 21 - ],47:[ + ],49:[ 1, 22 - ],48:[ + ],50:[ 1, 23 - ],51:[ + ],53:[ 1, 26 - ],52:[ + ],54:[ 1, 27 - ],53:[ + ],55:[ 1, 30 - ],55:[ + ],57:[ 1, 28 - ],56:[ + ],58:[ 1, 29 ] }), __expand__($V2, [ 2, - 37 - ], {44:44,30:[ + 41 + ], {46:44,32:[ 1, 42 - ],39:[ + ],41:[ 1, 41 - ],40:[ + ],42:[ 1, 43 - ],54:[ + ],56:[ 1, 45 - ],56:[ + ],58:[ 2, - 37 + 41 ] }), __expand__($V3, [ 2, - 35 - ], {34:13,35:14,43:19,45:20,49:24,50:25,32:46,36:[ + 39 + ], {36:13,37:14,45:19,47:20,51:24,52:25,34:46,38:[ 1, 15 - ],38:[ + ],40:[ 1, 16 - ],41:[ + ],43:[ 1, 17 - ],42:[ + ],44:[ 1, 18 - ],46:[ + ],48:[ 1, 21 - ],47:[ + ],49:[ 1, 22 - ],48:[ + ],50:[ 1, 23 - ],51:[ + ],53:[ 1, 26 - ],52:[ + ],54:[ 1, 27 - ],53:[ + ],55:[ 1, 30 - ],55:[ + ],57:[ 1, 28 - ],56:[ + ],58:[ 1, 29 ] }), __expand__($V3, [ 2, - 35 - ], {34:13,35:14,43:19,45:20,49:24,50:25,32:47,36:[ + 39 + ], {36:13,37:14,45:19,47:20,51:24,52:25,34:47,38:[ 1, 15 - ],38:[ + ],40:[ 1, 16 - ],41:[ + ],43:[ 1, 17 - ],42:[ + ],44:[ 1, 18 - ],46:[ + ],48:[ 1, 21 - ],47:[ + ],49:[ 1, 22 - ],48:[ + ],50:[ 1, 23 - ],51:[ + ],53:[ 1, 26 - ],52:[ + ],54:[ 1, 27 - ],53:[ + ],55:[ 1, 30 - ],55:[ + ],57:[ 1, 28 - ],56:[ + ],58:[ 1, 29 ] }), { - 35: 48, - 36: [ + 37: 48, + 38: [ 1, 15 ], - 38: [ + 40: [ 1, 16 ], - 41: [ + 43: [ 1, 17 ], - 42: [ + 44: [ 1, 18 ], - 43: 19, - 45: 20, - 46: [ + 45: 19, + 47: 20, + 48: [ 1, 21 ], - 47: [ + 49: [ 1, 22 ], - 48: [ + 50: [ 1, 23 ], - 49: 24, - 50: 25, - 51: [ + 51: 24, + 52: 25, + 53: [ 1, 26 ], - 52: [ + 54: [ 1, 27 ], - 53: [ + 55: [ 1, 30 ], - 55: [ + 57: [ 1, 28 ], - 56: [ + 58: [ 1, 29 ] }, { - 35: 49, - 36: [ + 37: 49, + 38: [ 1, 15 ], - 38: [ + 40: [ 1, 16 ], - 41: [ + 43: [ 1, 17 ], - 42: [ + 44: [ 1, 18 ], - 43: 19, - 45: 20, - 46: [ + 45: 19, + 47: 20, + 48: [ 1, 21 ], - 47: [ + 49: [ 1, 22 ], - 48: [ + 50: [ 1, 23 ], - 49: 24, - 50: 25, - 51: [ + 51: 24, + 52: 25, + 53: [ 1, 26 ], - 52: [ + 54: [ 1, 27 ], - 53: [ + 55: [ 1, 30 ], - 55: [ + 57: [ 1, 28 ], - 56: [ + 58: [ 1, 29 ] }, __expand__($V4, [ 2, - 45 - ], {56:[ + 49 + ], {58:[ 2, - 45 + 49 ] }), __expand__($V4, [ 2, - 47 - ], {56:[ + 51 + ], {58:[ 2, - 47 + 51 ] }), __expand__($V4, [ 2, - 48 - ], {56:[ + 52 + ], {58:[ 2, - 48 + 52 ] }), __expand__($V4, [ 2, - 49 - ], {56:[ + 53 + ], {58:[ 2, - 49 + 53 ] }), __expand__($V4, [ 2, - 50 - ], {56:[ + 54 + ], {58:[ 2, - 50 + 54 ] }), __expand__($V4, [ 2, - 51 - ], {56:[ + 55 + ], {58:[ 2, - 51 + 55 ] }), __expand__($V4, [ 2, - 52 - ], {56:[ + 56 + ], {58:[ 2, - 52 + 56 ] }), __expand__($V4, [ 2, - 53 - ], {56:[ + 57 + ], {58:[ 2, - 53 + 57 ] }), __expand__($V4, [ 2, - 54 - ], {56:[ + 58 + ], {58:[ 2, - 54 + 58 ] }), __expand__($V4, [ 2, - 57 - ], {56:[ + 61 + ], {58:[ 2, - 57 + 61 ] }), __expand__($V4, [ 2, - 58 - ], {56:[ + 62 + ], {58:[ 2, - 58 + 62 ] }), __expand__($V4, [ 2, - 55 - ], {56:[ + 59 + ], {58:[ 2, - 55 + 59 ] }), __expand__($V5, [ @@ -1228,66 +1273,69 @@ table: [ }), __expand__($V0, [ 2, - 28 + 32 ], {20:37,7:52,19:53,5:[ 1, 55 ],8:[ 1, 54 - ],27:[ + ],29:[ 1, 38 - ],56:[ + ],58:[ 2, - 28 + 32 ] }), __expand__($V6, [ 2, 16 - ], {56:[ + ], {58:[ 2, 16 ] }), - __expand__([11,22,33], [ + __expand__([11,35], [ 2, - 35 - ], {32:12,34:13,35:14,43:19,45:20,49:24,50:25,13:56,36:[ + 39 + ], {34:12,36:13,37:14,45:19,47:20,51:24,52:25,21:56,13:58,22:[ 1, - 15 + 57 ],38:[ + 1, + 15 + ],40:[ 1, 16 - ],41:[ + ],43:[ 1, 17 - ],42:[ + ],44:[ 1, 18 - ],46:[ + ],48:[ 1, 21 - ],47:[ + ],49:[ 1, 22 - ],48:[ + ],50:[ 1, 23 - ],51:[ + ],53:[ 1, 26 - ],52:[ + ],54:[ 1, 27 - ],53:[ + ],55:[ 1, 30 - ],55:[ + ],57:[ 1, 28 - ],56:[ + ],58:[ 1, 29 ] @@ -1295,173 +1343,173 @@ table: [ { 12: [ 1, - 59 + 61 ], - 28: 57, - 30: [ + 30: 59, + 32: [ 1, - 58 + 60 ] }, __expand__($V1, [ 2, - 33 - ], {35:14,43:19,45:20,49:24,50:25,34:60,36:[ + 37 + ], {37:14,45:19,47:20,51:24,52:25,36:62,38:[ 1, 15 - ],38:[ + ],40:[ 1, 16 - ],41:[ + ],43:[ 1, 17 - ],42:[ + ],44:[ 1, 18 - ],46:[ + ],48:[ 1, 21 - ],47:[ + ],49:[ 1, 22 - ],48:[ + ],50:[ 1, 23 - ],51:[ + ],53:[ 1, 26 - ],52:[ + ],54:[ 1, 27 - ],53:[ + ],55:[ 1, 30 - ],55:[ + ],57:[ 1, 28 - ],56:[ + ],58:[ 1, 29 ] }), __expand__($V2, [ 2, - 36 - ], {44:44,30:[ + 40 + ], {46:44,32:[ 1, 42 - ],39:[ + ],41:[ 1, 41 - ],40:[ + ],42:[ 1, 43 - ],54:[ + ],56:[ 1, 45 - ],56:[ + ],58:[ 2, - 36 + 40 ] }), __expand__($V4, [ 2, - 40 - ], {56:[ + 44 + ], {58:[ 2, - 40 + 44 ] }), __expand__($V4, [ 2, - 41 - ], {56:[ + 45 + ], {58:[ 2, - 41 + 45 ] }), __expand__($V4, [ 2, - 42 - ], {56:[ + 46 + ], {58:[ 2, - 42 + 46 ] }), __expand__($V4, [ 2, - 46 - ], {56:[ + 50 + ], {58:[ 2, - 46 + 50 ] }), __expand__($V4, [ 2, - 56 - ], {56:[ + 60 + ], {58:[ 2, - 56 + 60 ] }), { - 33: [ + 35: [ 1, 39 ], - 37: [ + 39: [ 1, - 61 + 63 ] }, { - 33: [ + 35: [ 1, 39 ], - 37: [ + 39: [ 1, - 62 + 64 ] }, __expand__($V2, [ 2, - 43 - ], {44:44,30:[ + 47 + ], {46:44,32:[ 1, 42 - ],39:[ + ],41:[ 1, 41 - ],40:[ + ],42:[ 1, 43 - ],54:[ + ],56:[ 1, 45 - ],56:[ + ],58:[ 2, - 43 + 47 ] }), __expand__($V2, [ 2, - 44 - ], {44:44,30:[ + 48 + ], {46:44,32:[ 1, 42 - ],39:[ + ],41:[ 1, 41 - ],40:[ + ],42:[ 1, 43 - ],54:[ + ],56:[ 1, 45 - ],56:[ + ],58:[ 2, - 44 + 48 ] }), __expand__($V5, [ @@ -1489,7 +1537,7 @@ table: [ __expand__($V6, [ 2, 15 - ], {56:[ + ], {58:[ 2, 15 ] @@ -1503,105 +1551,154 @@ table: [ { 8: [ 1, - 63 + 65 ], 9: [ 1, - 64 + 66 ] }, + __expand__($V6, [ + 2, + 17 + ], {58:[ + 2, + 17 + ] + }), + __expand__($V7, [ + 2, + 39 + ], {34:12,36:13,37:14,45:19,47:20,51:24,52:25,13:58,23:67,21:68,38:[ + 1, + 15 + ],40:[ + 1, + 16 + ],43:[ + 1, + 17 + ],44:[ + 1, + 18 + ],48:[ + 1, + 21 + ],49:[ + 1, + 22 + ],50:[ + 1, + 23 + ],53:[ + 1, + 26 + ],54:[ + 1, + 27 + ],55:[ + 1, + 30 + ],57:[ + 1, + 28 + ],58:[ + 1, + 29 + ] + }), { 11: [ 1, - 67 + 71 ], - 21: 65, 22: [ 1, - 66 - ] + 70 + ], + 25: 69 }, { - 29: [ + 31: [ 1, - 68 + 72 ], - 31: [ + 33: [ 1, - 69 + 73 ] }, { - 29: [ + 31: [ 1, - 70 + 74 ] }, { - 29: [ + 31: [ 2, - 29 + 33 ], - 31: [ + 33: [ 2, - 29 + 33 ] }, __expand__($V1, [ 2, - 32 - ], {43:19,45:20,49:24,50:25,35:40,36:[ + 36 + ], {45:19,47:20,51:24,52:25,37:40,38:[ 1, 15 - ],38:[ + ],40:[ 1, 16 - ],41:[ + ],43:[ 1, 17 - ],42:[ + ],44:[ 1, 18 - ],46:[ + ],48:[ 1, 21 - ],47:[ + ],49:[ 1, 22 - ],48:[ + ],50:[ 1, 23 - ],51:[ + ],53:[ 1, 26 - ],52:[ + ],54:[ 1, 27 - ],53:[ + ],55:[ 1, 30 - ],55:[ + ],57:[ 1, 28 - ],56:[ + ],58:[ 1, 29 ] }), __expand__($V4, [ 2, - 38 - ], {56:[ + 42 + ], {58:[ 2, - 38 + 42 ] }), __expand__($V4, [ 2, - 39 - ], {56:[ + 43 + ], {58:[ 2, - 39 + 43 ] }), { @@ -1613,53 +1710,105 @@ table: [ { 8: [ 1, - 71 + 75 ] }, - __expand__($V6, [ - 2, - 17 - ], {56:[ + __expand__($V7, [ 2, + 39 + ], {34:12,36:13,37:14,45:19,47:20,51:24,52:25,13:58,21:77,24:[ + 1, + 76 + ],38:[ + 1, + 15 + ],40:[ + 1, + 16 + ],43:[ + 1, 17 + ],44:[ + 1, + 18 + ],48:[ + 1, + 21 + ],49:[ + 1, + 22 + ],50:[ + 1, + 23 + ],53:[ + 1, + 26 + ],54:[ + 1, + 27 + ],55:[ + 1, + 30 + ],57:[ + 1, + 28 + ],58:[ + 1, + 29 ] }), - __expand__($V7, [ + __expand__($V8, [ 2, 20 - ], {23:72,25:73,26:[ + ], {58:[ + 2, + 20 + ] + }), + __expand__($V9, [ + 2, + 21 + ], {58:[ + 2, + 21 + ] + }), + __expand__($Va, [ + 2, + 24 + ], {26:78,27:79,28:[ 1, - 74 + 80 ] }), - __expand__($V6, [ + __expand__($V9, [ 2, - 19 - ], {56:[ + 23 + ], {58:[ 2, - 19 + 23 ] }), __expand__($V0, [ 2, - 26 - ], {56:[ + 30 + ], {58:[ 2, - 26 + 30 ] }), { 12: [ 1, - 75 + 81 ] }, __expand__($V0, [ 2, - 27 - ], {56:[ + 31 + ], {58:[ 2, - 27 + 31 ] }), { @@ -1668,90 +1817,106 @@ table: [ 4 ] }, + __expand__($V6, [ + 2, + 18 + ], {58:[ + 2, + 18 + ] + }), + __expand__($V8, [ + 2, + 19 + ], {58:[ + 2, + 19 + ] + }), { 22: [ 1, - 77 + 83 ], 24: [ 1, - 76 + 82 ] }, - __expand__($V7, [ + __expand__($Va, [ 2, - 21 - ], {26:[ + 25 + ], {28:[ 1, - 78 + 84 ] }), - __expand__($V7, [ + __expand__($Va, [ 2, - 24 - ], {26:[ + 28 + ], {28:[ 2, - 24 + 28 ] }), { - 29: [ + 31: [ 2, - 30 + 34 ], - 31: [ + 33: [ 2, - 30 + 34 ] }, - __expand__($V6, [ + __expand__($V9, [ 2, - 18 - ], {56:[ + 22 + ], {58:[ 2, - 18 + 22 ] }), - __expand__($V7, [ + __expand__($Va, [ 2, - 20 - ], {25:73,23:79,26:[ + 24 + ], {27:79,26:85,28:[ 1, - 74 + 80 ] }), - __expand__($V7, [ + __expand__($Va, [ 2, - 25 - ], {26:[ + 29 + ], {28:[ 2, - 25 + 29 ] }), { 22: [ 1, - 77 + 83 ], 24: [ 1, - 80 + 86 ] }, - __expand__($V7, [ + __expand__($Va, [ 2, - 23 - ], {25:81,26:[ + 27 + ], {27:87,28:[ 1, - 74 + 80 ] }), - __expand__($V7, [ + __expand__($Va, [ 2, - 22 - ], {26:[ + 26 + ], {28:[ 1, - 78 + 84 ] }) ], @@ -1772,11 +1937,11 @@ defaultActions: { 2, 2 ], - 63: [ + 65: [ 2, 3 ], - 71: [ + 75: [ 2, 4 ] @@ -2455,7 +2620,7 @@ switch($avoiding_name_collisions) { case 2 : /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 26; // regexp with braces or quotes (and no spaces) + return 28; // regexp with braces or quotes (and no spaces) break; case 7 : /*! Conditions:: action */ @@ -2470,7 +2635,7 @@ break; case 10 : /*! Conditions:: conditions */ /*! Rule:: > */ - this.popState(); return 29; + this.popState(); return 31; break; case 13 : /*! Conditions:: rules */ @@ -2575,22 +2740,22 @@ break; case 36 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 55; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 57; break; case 37 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 57; break; case 51 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: < */ - this.begin('conditions'); return 27; + this.begin('conditions'); return 29; break; case 55 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; + yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 55; break; case 58 : /*! Conditions:: indented trail rules INITIAL */ @@ -2625,34 +2790,34 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 26, + 0 : 28, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 26, + 1 : 28, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 26, + 3 : 28, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 26, + 4 : 28, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 26, + 5 : 28, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 26, + 6 : 28, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ 9 : 12, /*! Conditions:: conditions */ /*! Rule:: , */ - 11 : 31, + 11 : 33, /*! Conditions:: conditions */ /*! Rule:: \* */ - 12 : 30, + 12 : 32, /*! Conditions:: rules */ /*! Rule:: [a-zA-Z0-9_]+ */ - 17 : 56, + 17 : 58, /*! Conditions:: start_condition */ /*! Rule:: {NAME} */ 22 : 18, @@ -2661,64 +2826,64 @@ simpleCaseActionClusters: { 35 : 12, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \| */ - 38 : 33, + 38 : 35, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ - 39 : 52, + 39 : 54, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?: */ - 40 : 38, + 40 : 40, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?= */ - 41 : 38, + 41 : 40, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?! */ - 42 : 38, + 42 : 40, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \( */ - 43 : 36, + 43 : 38, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \) */ - 44 : 37, + 44 : 39, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \+ */ - 45 : 39, + 45 : 41, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \* */ - 46 : 30, + 46 : 32, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \? */ - 47 : 40, + 47 : 42, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \^ */ - 48 : 47, + 48 : 49, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: , */ - 49 : 31, + 49 : 33, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: <> */ - 50 : 48, + 50 : 50, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/! */ - 52 : 42, + 52 : 44, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/ */ - 53 : 41, + 53 : 43, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 54 : 53, + 54 : 55, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \$ */ - 56 : 48, + 56 : 50, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \. */ - 57 : 46, + 57 : 48, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 62 : 54, + 62 : 56, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{{NAME}\} */ - 63 : 51, + 63 : 53, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{ */ 64 : 22, diff --git a/lex.y b/lex.y index 6eada3a..0a8ffc9 100644 --- a/lex.y +++ b/lex.y @@ -76,15 +76,41 @@ names_exclusive ; rules - : rules rule + : rules rules_collective + { $$ = $rules.concat($rules_collective); } + | rules_collective + { $$ = $rules_collective; } + ; + +rules_collective + : start_conditions rule + { + if ($start_conditions) { + $rule.unshift($start_conditions); + } + $$ = [$rule]; + } + | start_conditions '{' rule_block '}' + { + if ($start_conditions) { + $rule_block.forEach(function (d) { + d.unshift($start_conditions); + }); + } + $$ = $rule_block; + } + ; + +rule_block + : rule_block rule { $$ = $rules; $$.push($rule); } | rule { $$ = [$rule]; } ; rule - : start_conditions regex action - { $$ = $start_conditions ? [$start_conditions, $regex, $action] : [$regex, $action]; } + : regex action + { $$ = [$regex, $action]; } ; action From 6156e8974f3acb9160805e7ec6e7dd671c34cd61 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 26 Aug 2015 23:31:52 +0200 Subject: [PATCH 066/417] regenerated everything after syncing npm installs with latest jison codebase through the bash command sequence: `make clean; make prep; make site` --- lex-parser.js | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 30f9cc7..a3188d3 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -132,7 +132,8 @@ var __expand__ = function (k, v, o) { $V5=[5,11,12,14,16], $V6=[5,8,11,22,27,33,36,38,41,42,46,47,48,51,52,53,55], $V7=[22,24]; -var parser = {trace: function trace() { }, +var parser = { +trace: function trace() { }, yy: {}, symbols_: { "error": 2, @@ -1785,7 +1786,13 @@ parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { - throw new Error(str); + function _parseError (msg, hash) { + this.message = msg; + this.hash = hash; + } + _parseError.prototype = new Error(); + + throw new _parseError(str, hash); } }, parse: function parse(input) { @@ -1912,10 +1919,10 @@ parse: function parse(input) { // Report error expected = collect_expected_token_set(state); if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + "\nExpecting " + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ": Unexpected " + - (symbol === EOF ? "end of input" : + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + + (symbol === EOF ? 'end of input' : ("'" + (this.terminals_[symbol] || symbol) + "'")); } // we cannot recover from the error! @@ -2038,7 +2045,8 @@ parse: function parse(input) { } return retval; -}}; +} +}; function encodeRE (s) { @@ -2052,6 +2060,7 @@ function prepareString (s) { return s; }; + /* generated by jison-lex 0.3.4 */ var lexer = (function () { var lexer = ({ @@ -3042,17 +3051,24 @@ conditions: { return lexer; })(); parser.lexer = lexer; + function Parser () { this.yy = {}; } -Parser.prototype = parser;parser.Parser = Parser; -return new Parser; +Parser.prototype = parser; +parser.Parser = Parser; + +return new Parser(); })(); + if (typeof require !== 'undefined' && typeof exports !== 'undefined') { exports.parser = lexParser; exports.Parser = lexParser.Parser; -exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; -} \ No newline at end of file +exports.parse = function () { + return lexParser.parse.apply(lexParser, arguments); +}; + +} From 17dcad7866518b5e938465afed1dd26c7e681585 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Thu, 15 Oct 2015 21:05:10 -0400 Subject: [PATCH 067/417] Hang on to unknown declarations rather than dropping them --- lex.l | 2 +- lex.y | 25 +++++++++++++++---------- tests/all-tests.js | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/lex.l b/lex.l index 515984d..87a4585 100644 --- a/lex.l +++ b/lex.l @@ -77,6 +77,7 @@ BR \r\n|\n|\r "%s" this.begin('start_condition'); return 'START_INC'; "%x" this.begin('start_condition'); return 'START_EXC'; "%%" this.begin('rules'); return '%%'; +"%"[a-zA-Z]+[^\r\n]* return 'UNKNOWN_DECL'; "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; "{"{NAME}"}" return 'NAME_BRACE'; "{" return '{'; @@ -87,4 +88,3 @@ BR \r\n|\n|\r (.|{BR})+ return 'CODE'; %% - diff --git a/lex.y b/lex.y index 599c382..006b1ac 100644 --- a/lex.y +++ b/lex.y @@ -10,16 +10,17 @@ lex : definitions '%%' rules epilogue - { + { $$ = { rules: $rules }; if ($definitions[0]) $$.macros = $definitions[0]; if ($definitions[1]) $$.startConditions = $definitions[1]; + if ($definitions[2]) $$.unknownDecls = $definitions[2]; if ($epilogue) $$.moduleInclude = $epilogue; if (yy.options) $$.options = yy.options; if (yy.actionInclude) $$.actionInclude = yy.actionInclude; delete yy.options; delete yy.actionInclude; - return $$; + return $$; } ; @@ -39,11 +40,14 @@ definitions if ('length' in $definition) { $$[0] = $$[0] || {}; $$[0][$definition[0]] = $definition[1]; - } else { + } else if ($definition.type === 'names') { $$[1] = $$[1] || {}; - for (var name in $definition) { - $$[1][name] = $definition[name]; + for (var name in $definition.names) { + $$[1][name] = $definition.names[name]; } + } else if ($definition.type === 'unknown') { + $$[2] = $$[2] || []; + $$[2].push($definition.body); } } | ACTION definitions @@ -59,20 +63,22 @@ definition { $$ = $2; } | START_EXC names_exclusive { $$ = $2; } + | UNKNOWN_DECL + { $$ = {type: 'unknown', body: $1}; } ; names_inclusive : START_COND - { $$ = {}; $$[$1] = 0; } + { $$ = {type: 'names', names: {}}; $$.names[$1] = 0; } | names_inclusive START_COND - { $$ = $1; $$[$2] = 0; } + { $$ = $1; $$.names[$2] = 0; } ; names_exclusive : START_COND - { $$ = {}; $$[$1] = 1; } + { $$ = {type: 'names', names: {}}; $$.names[$1] = 1; } | names_exclusive START_COND - { $$ = $1; $$[$2] = 1; } + { $$ = $1; $$.names[$2] = 1; } ; rules @@ -220,4 +226,3 @@ function prepareString (s) { s = encodeRE(s); return s; }; - diff --git a/tests/all-tests.js b/tests/all-tests.js index 8a09501..bc8a6bb 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -193,6 +193,22 @@ exports["test start conditions"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test unknown declarations"] = function () { + var lexgrammar = '%a b c\n%foo[bar] baz qux\n%a b c\n%%\n. //'; + var expected = { + unknownDecls: [ + '%a b c', + '%foo[bar] baz qux', + '%a b c' + ], + rules: [ + ['.', '//'] + ] + }; + + assert.deepEqual(lex.parse(lexgrammar), expected, "unknown declarations should be parsed correctly"); +}; + exports["test no brace action"] = function () { var lexgrammar = '%%\n"["[^\\]]"]" return true;\n"x" return 1;'; var expected = { From 877a30543f74611b6d5bf206ca1681e5aed703f6 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Thu, 15 Oct 2015 21:05:10 -0400 Subject: [PATCH 068/417] Hang on to unknown declarations rather than dropping them --- lex.l | 2 +- lex.y | 25 +++++++++++++++---------- tests/all-tests.js | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/lex.l b/lex.l index 515984d..87a4585 100644 --- a/lex.l +++ b/lex.l @@ -77,6 +77,7 @@ BR \r\n|\n|\r "%s" this.begin('start_condition'); return 'START_INC'; "%x" this.begin('start_condition'); return 'START_EXC'; "%%" this.begin('rules'); return '%%'; +"%"[a-zA-Z]+[^\r\n]* return 'UNKNOWN_DECL'; "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; "{"{NAME}"}" return 'NAME_BRACE'; "{" return '{'; @@ -87,4 +88,3 @@ BR \r\n|\n|\r (.|{BR})+ return 'CODE'; %% - diff --git a/lex.y b/lex.y index 599c382..006b1ac 100644 --- a/lex.y +++ b/lex.y @@ -10,16 +10,17 @@ lex : definitions '%%' rules epilogue - { + { $$ = { rules: $rules }; if ($definitions[0]) $$.macros = $definitions[0]; if ($definitions[1]) $$.startConditions = $definitions[1]; + if ($definitions[2]) $$.unknownDecls = $definitions[2]; if ($epilogue) $$.moduleInclude = $epilogue; if (yy.options) $$.options = yy.options; if (yy.actionInclude) $$.actionInclude = yy.actionInclude; delete yy.options; delete yy.actionInclude; - return $$; + return $$; } ; @@ -39,11 +40,14 @@ definitions if ('length' in $definition) { $$[0] = $$[0] || {}; $$[0][$definition[0]] = $definition[1]; - } else { + } else if ($definition.type === 'names') { $$[1] = $$[1] || {}; - for (var name in $definition) { - $$[1][name] = $definition[name]; + for (var name in $definition.names) { + $$[1][name] = $definition.names[name]; } + } else if ($definition.type === 'unknown') { + $$[2] = $$[2] || []; + $$[2].push($definition.body); } } | ACTION definitions @@ -59,20 +63,22 @@ definition { $$ = $2; } | START_EXC names_exclusive { $$ = $2; } + | UNKNOWN_DECL + { $$ = {type: 'unknown', body: $1}; } ; names_inclusive : START_COND - { $$ = {}; $$[$1] = 0; } + { $$ = {type: 'names', names: {}}; $$.names[$1] = 0; } | names_inclusive START_COND - { $$ = $1; $$[$2] = 0; } + { $$ = $1; $$.names[$2] = 0; } ; names_exclusive : START_COND - { $$ = {}; $$[$1] = 1; } + { $$ = {type: 'names', names: {}}; $$.names[$1] = 1; } | names_exclusive START_COND - { $$ = $1; $$[$2] = 1; } + { $$ = $1; $$.names[$2] = 1; } ; rules @@ -220,4 +226,3 @@ function prepareString (s) { s = encodeRE(s); return s; }; - diff --git a/tests/all-tests.js b/tests/all-tests.js index 8a09501..bc8a6bb 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -193,6 +193,22 @@ exports["test start conditions"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test unknown declarations"] = function () { + var lexgrammar = '%a b c\n%foo[bar] baz qux\n%a b c\n%%\n. //'; + var expected = { + unknownDecls: [ + '%a b c', + '%foo[bar] baz qux', + '%a b c' + ], + rules: [ + ['.', '//'] + ] + }; + + assert.deepEqual(lex.parse(lexgrammar), expected, "unknown declarations should be parsed correctly"); +}; + exports["test no brace action"] = function () { var lexgrammar = '%%\n"["[^\\]]"]" return true;\n"x" return 1;'; var expected = { From 58fd482d47c1c4c340881ac190492159163911a1 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Thu, 15 Oct 2015 21:06:19 -0400 Subject: [PATCH 069/417] Build with unknown decl parsing --- .gitignore | 2 +- lex-parser.js | 898 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 899 insertions(+), 1 deletion(-) create mode 100644 lex-parser.js diff --git a/.gitignore b/.gitignore index 8c32b70..ab51632 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -lex-parser.js +# lex-parser.js node_modules/ # Editor bak files diff --git a/lex-parser.js b/lex-parser.js new file mode 100644 index 0000000..f32143e --- /dev/null +++ b/lex-parser.js @@ -0,0 +1,898 @@ +/* parser generated by jison 0.4.15 */ +/* + Returns a Parser object of the following structure: + + Parser: { + yy: {} + } + + Parser.prototype: { + yy: {}, + trace: function(), + symbols_: {associative list: name ==> number}, + terminals_: {associative list: number ==> name}, + productions_: [...], + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + table: [...], + defaultActions: {...}, + parseError: function(str, hash), + parse: function(input), + + lexer: { + EOF: 1, + parseError: function(str, hash), + setInput: function(input), + input: function(), + unput: function(str), + more: function(), + less: function(n), + pastInput: function(), + upcomingInput: function(), + showPosition: function(), + test_match: function(regex_match_array, rule_index), + next: function(), + lex: function(), + begin: function(condition), + popState: function(), + _currentRules: function(), + topState: function(), + pushState: function(condition), + + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, + + performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + rules: [...], + conditions: {associative list: name ==> set}, + } + } + + + token location info (@$, _$, etc.): { + first_line: n, + last_line: n, + first_column: n, + last_column: n, + range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + } + + + the parseError function receives a 'hash' object with these members for lexer and parser errors: { + text: (matched text) + token: (the produced terminal token, if any) + line: (yylineno) + } + while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + loc: (yylloc) + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + } +*/ +var parser = (function(){ +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[2,7],$V1=[1,4],$V2=[1,5],$V3=[1,6],$V4=[1,7],$V5=[1,8],$V6=[2,36],$V7=[1,16],$V8=[1,17],$V9=[1,18],$Va=[1,19],$Vb=[1,22],$Vc=[1,23],$Vd=[1,24],$Ve=[1,27],$Vf=[1,28],$Vg=[1,31],$Vh=[1,29],$Vi=[1,30],$Vj=[5,11,12,14,16,18],$Vk=[11,23,34,37,39,42,43,47,48,49,52,53,54,56,57],$Vl=[2,29],$Vm=[1,39],$Vn=[1,40],$Vo=[5,11,12,14,16,18,23,34,38],$Vp=[5,11,12,14,16,18,23,34,37,38,39,42,43,47,48,49,52,53,54,56,57],$Vq=[1,43],$Vr=[1,42],$Vs=[1,44],$Vt=[1,46],$Vu=[34,38],$Vv=[5,11,12,14,16,18,23,31,34,37,38,39,40,41,42,43,47,48,49,52,53,54,55,56,57],$Vw=[5,11,12,14,16,18,19],$Vx=[5,8,11,23,28,34,37,39,42,43,47,48,49,52,53,54,56,57],$Vy=[30,32],$Vz=[23,25],$VA=[2,21],$VB=[1,75],$VC=[1,78],$VD=[1,79],$VE=[23,25,27]; +var parser = {trace: function trace() { }, +yy: {}, +symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"UNKNOWN_DECL":18,"START_COND":19,"rule":20,"start_conditions":21,"action":22,"{":23,"action_body":24,"}":25,"action_comments_body":26,"ACTION_BODY":27,"<":28,"name_list":29,">":30,"*":31,",":32,"regex_list":33,"|":34,"regex_concat":35,"regex_base":36,"(":37,")":38,"SPECIAL_GROUP":39,"+":40,"?":41,"/":42,"/!":43,"name_expansion":44,"range_regex":45,"any_group_regex":46,".":47,"^":48,"$":49,"string":50,"escape_char":51,"NAME_BRACE":52,"ANY_GROUP_REGEX":53,"ESCAPE_CHAR":54,"RANGE_REGEX":55,"STRING_LIT":56,"CHARACTER_LIT":57,"$accept":0,"$end":1}, +terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"UNKNOWN_DECL",19:"START_COND",23:"{",25:"}",27:"ACTION_BODY",28:"<",30:">",31:"*",32:",",34:"|",37:"(",38:")",39:"SPECIAL_GROUP",40:"+",41:"?",42:"/",43:"/!",47:".",48:"^",49:"$",52:"NAME_BRACE",53:"ANY_GROUP_REGEX",54:"ESCAPE_CHAR",55:"RANGE_REGEX",56:"STRING_LIT",57:"CHARACTER_LIT"}, +productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[10,1],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[20,3],[22,3],[22,1],[24,0],[24,1],[24,5],[24,4],[26,1],[26,2],[21,3],[21,3],[21,0],[29,1],[29,3],[13,1],[33,3],[33,2],[33,1],[33,0],[35,2],[35,1],[36,3],[36,3],[36,2],[36,2],[36,2],[36,2],[36,2],[36,1],[36,2],[36,1],[36,1],[36,1],[36,1],[36,1],[36,1],[44,1],[46,1],[51,1],[45,1],[50,1],[50,1]], +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { +/* this == yyval */ + +var $0 = $$.length - 1; +switch (yystate) { +case 1: + + this.$ = { rules: $$[$0-1] }; + if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; + if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; + if ($$[$0-3][2]) this.$.unknownDecls = $$[$0-3][2]; + if ($$[$0]) this.$.moduleInclude = $$[$0]; + if (yy.options) this.$.options = yy.options; + if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; + delete yy.options; + delete yy.actionInclude; + return this.$; + +break; +case 2: case 3: + this.$ = null; +break; +case 4: case 27: + this.$ = $$[$0-1]; +break; +case 5: + + this.$ = $$[$0]; + if ('length' in $$[$0-1]) { + this.$[0] = this.$[0] || {}; + this.$[0][$$[$0-1][0]] = $$[$0-1][1]; + } else if ($$[$0-1].type === 'names') { + this.$[1] = this.$[1] || {}; + for (var name in $$[$0-1].names) { + this.$[1][name] = $$[$0-1].names[name]; + } + } else if ($$[$0-1].type === 'unknown') { + this.$[2] = this.$[2] || []; + this.$[2].push($$[$0-1].body); + } + +break; +case 6: + yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; +break; +case 7: + yy.actionInclude = ''; this.$ = [null,null]; +break; +case 8: + this.$ = [$$[$0-1], $$[$0]]; +break; +case 9: case 10: + this.$ = $$[$0]; +break; +case 11: + this.$ = {type: 'unknown', body: $$[$0]}; +break; +case 12: + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; +break; +case 13: + this.$ = $$[$0-1]; this.$.names[$$[$0]] = 0; +break; +case 14: + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; +break; +case 15: + this.$ = $$[$0-1]; this.$.names[$$[$0]] = 1; +break; +case 16: + this.$ = $$[$0-1]; this.$.push($$[$0]); +break; +case 17: case 30: + this.$ = [$$[$0]]; +break; +case 18: + this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; +break; +case 19: +this.$ = $$[$0-1]; +break; +case 20: case 22: +this.$ = $$[$0]; +break; +case 21: +this.$ = ''; +break; +case 23: +this.$ = $$[$0-4]+$$[$0-3]+$$[$0-2]+$$[$0-1]+$$[$0]; +break; +case 24: +this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 25: case 55: case 56: case 57: + this.$ = yytext; +break; +case 26: + this.$ = $$[$0-1]+$$[$0]; +break; +case 28: + this.$ = ['*']; +break; +case 31: + this.$ = $$[$0-2]; this.$.push($$[$0]); +break; +case 32: + + this.$ = $$[$0]; + if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { + this.$ += "\\b"; + } + +break; +case 33: + this.$ = $$[$0-2] + '|' + $$[$0]; +break; +case 34: + this.$ = $$[$0-1] + '|'; +break; +case 36: + this.$ = '' +break; +case 37: case 47: + this.$ = $$[$0-1] + $$[$0]; +break; +case 39: + this.$ = '(' + $$[$0-1] + ')'; +break; +case 40: + this.$ = $$[$0-2] + $$[$0-1] + ')'; +break; +case 41: + this.$ = $$[$0-1] + '+'; +break; +case 42: + this.$ = $$[$0-1] + '*'; +break; +case 43: + this.$ = $$[$0-1] + '?'; +break; +case 44: + this.$ = '(?=' + $$[$0] + ')'; +break; +case 45: + this.$ = '(?!' + $$[$0] + ')'; +break; +case 49: + this.$ = '.'; +break; +case 50: + this.$ = '^'; +break; +case 51: + this.$ = '$'; +break; +case 58: + this.$ = prepareString(yytext.substr(1, yytext.length - 2)); +break; +} +}, +table: [{3:1,4:2,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4,18:$V5},{1:[3]},{5:[1,9]},{4:10,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4,18:$V5},{4:11,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4,18:$V5},o([5,11,12,14,16,18,34],$V6,{13:12,33:13,35:14,36:15,44:20,46:21,50:25,51:26,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),{15:32,19:[1,33]},{17:34,19:[1,35]},o($Vj,[2,11]),o($Vk,$Vl,{6:36,20:37,21:38,28:$Vm}),{5:[2,5]},{5:[2,6]},o($Vj,[2,8]),o([5,11,12,14,16,18,23],[2,32],{34:$Vn}),o($Vo,[2,35],{44:20,46:21,50:25,51:26,36:41,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),o($Vp,[2,38],{45:45,31:$Vq,40:$Vr,41:$Vs,55:$Vt}),o($Vu,$V6,{35:14,36:15,44:20,46:21,50:25,51:26,33:47,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),o($Vu,$V6,{35:14,36:15,44:20,46:21,50:25,51:26,33:48,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),{36:49,37:$V7,39:$V8,42:$V9,43:$Va,44:20,46:21,47:$Vb,48:$Vc,49:$Vd,50:25,51:26,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi},{36:50,37:$V7,39:$V8,42:$V9,43:$Va,44:20,46:21,47:$Vb,48:$Vc,49:$Vd,50:25,51:26,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi},o($Vv,[2,46]),o($Vv,[2,48]),o($Vv,[2,49]),o($Vv,[2,50]),o($Vv,[2,51]),o($Vv,[2,52]),o($Vv,[2,53]),o($Vv,[2,54]),o($Vv,[2,55]),o($Vv,[2,58]),o($Vv,[2,59]),o($Vv,[2,56]),o($Vj,[2,9],{19:[1,51]}),o($Vw,[2,12]),o($Vj,[2,10],{19:[1,52]}),o($Vw,[2,14]),o($Vk,$Vl,{21:38,7:53,20:54,5:[1,56],8:[1,55],28:$Vm}),o($Vx,[2,17]),o([11,23,34],$V6,{33:13,35:14,36:15,44:20,46:21,50:25,51:26,13:57,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),{12:[1,60],29:58,31:[1,59]},o($Vo,[2,34],{36:15,44:20,46:21,50:25,51:26,35:61,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),o($Vp,[2,37],{45:45,31:$Vq,40:$Vr,41:$Vs,55:$Vt}),o($Vv,[2,41]),o($Vv,[2,42]),o($Vv,[2,43]),o($Vv,[2,47]),o($Vv,[2,57]),{34:$Vn,38:[1,62]},{34:$Vn,38:[1,63]},o($Vp,[2,44],{45:45,31:$Vq,40:$Vr,41:$Vs,55:$Vt}),o($Vp,[2,45],{45:45,31:$Vq,40:$Vr,41:$Vs,55:$Vt}),o($Vw,[2,13]),o($Vw,[2,15]),{1:[2,1]},o($Vx,[2,16]),{1:[2,2]},{8:[1,64],9:[1,65]},{11:[1,68],22:66,23:[1,67]},{30:[1,69],32:[1,70]},{30:[1,71]},o($Vy,[2,30]),o($Vo,[2,33],{44:20,46:21,50:25,51:26,36:41,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),o($Vv,[2,39]),o($Vv,[2,40]),{1:[2,3]},{8:[1,72]},o($Vx,[2,18]),o($Vz,$VA,{24:73,26:74,27:$VB}),o($Vx,[2,20]),o($Vk,[2,27]),{12:[1,76]},o($Vk,[2,28]),{1:[2,4]},{23:$VC,25:[1,77]},o($Vz,[2,22],{27:$VD}),o($VE,[2,25]),o($Vy,[2,31]),o($Vx,[2,19]),o($Vz,$VA,{26:74,24:80,27:$VB}),o($VE,[2,26]),{23:$VC,25:[1,81]},o($Vz,[2,24],{26:82,27:$VB}),o($Vz,[2,23],{27:$VD})], +defaultActions: {10:[2,5],11:[2,6],53:[2,1],55:[2,2],64:[2,3],72:[2,4]}, +parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + } else { + throw new Error(str); + } +}, +parse: function parse(input) { + var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; + var args = lstack.slice.call(arguments, 1); + var lexer = Object.create(this.lexer); + var sharedState = { yy: {} }; + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState.yy[k] = this.yy[k]; + } + } + lexer.setInput(input, sharedState.yy); + sharedState.yy.lexer = lexer; + sharedState.yy.parser = this; + if (typeof lexer.yylloc == 'undefined') { + lexer.yylloc = {}; + } + var yyloc = lexer.yylloc; + lstack.push(yyloc); + var ranges = lexer.options && lexer.options.ranges; + if (typeof sharedState.yy.parseError === 'function') { + this.parseError = sharedState.yy.parseError; + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } + function popStack(n) { + stack.length = stack.length - 2 * n; + vstack.length = vstack.length - n; + lstack.length = lstack.length - n; + } + _token_stack: + function lex() { + var token; + token = lexer.lex() || EOF; + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token; + } + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + state = stack[stack.length - 1]; + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); + } + action = table[state] && table[state][symbol]; + } + if (typeof action === 'undefined' || !action.length || !action[0]) { + var errStr = ''; + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push('\'' + this.terminals_[p] + '\''); + } + } + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); + } + this.parseError(errStr, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected + }); + } + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); + } + switch (action[0]) { + case 1: + stack.push(symbol); + vstack.push(lexer.yytext); + lstack.push(lexer.yylloc); + stack.push(action[1]); + symbol = null; + if (!preErrorSymbol) { + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + if (recovering > 0) { + recovering--; + } + } else { + symbol = preErrorSymbol; + preErrorSymbol = null; + } + break; + case 2: + len = this.productions_[action[1]][1]; + yyval.$ = vstack[vstack.length - len]; + yyval._$ = { + first_line: lstack[lstack.length - (len || 1)].first_line, + last_line: lstack[lstack.length - 1].last_line, + first_column: lstack[lstack.length - (len || 1)].first_column, + last_column: lstack[lstack.length - 1].last_column + }; + if (ranges) { + yyval._$.range = [ + lstack[lstack.length - (len || 1)].range[0], + lstack[lstack.length - 1].range[1] + ]; + } + r = this.performAction.apply(yyval, [ + yytext, + yyleng, + yylineno, + sharedState.yy, + action[1], + vstack, + lstack + ].concat(args)); + if (typeof r !== 'undefined') { + return r; + } + if (len) { + stack = stack.slice(0, -1 * len * 2); + vstack = vstack.slice(0, -1 * len); + lstack = lstack.slice(0, -1 * len); + } + stack.push(this.productions_[action[1]][0]); + vstack.push(yyval.$); + lstack.push(yyval._$); + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + stack.push(newState); + break; + case 3: + return true; + } + } + return true; +}}; + + +function encodeRE (s) { + return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g,'\\u$1'); +} + +function prepareString (s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; +}; +/* generated by jison-lex 0.3.4 */ +var lexer = (function(){ +var lexer = ({ + +EOF:1, + +parseError:function parseError(str, hash) { + if (this.yy.parser) { + this.yy.parser.parseError(str, hash); + } else { + throw new Error(str); + } + }, + +// resets the lexer, sets new input +setInput:function (input, yy) { + this.yy = yy || this.yy || {}; + this._input = input; + this._more = this._backtrack = this.done = false; + this.yylineno = this.yyleng = 0; + this.yytext = this.matched = this.match = ''; + this.conditionStack = ['INITIAL']; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0,0]; + } + this.offset = 0; + return this; + }, + +// consumes and returns one char from the input +input:function () { + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + var lines = ch.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + + this._input = this._input.slice(1); + return ch; + }, + +// unshifts one char (or a string) into the input +unput:function (ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); + + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + var r = this.yylloc.range; + + this.yylloc = { + first_line: this.yylloc.first_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.first_column, + last_column: lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len + }; + + if (this.options.ranges) { + this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + } + this.yyleng = this.yytext.length; + return this; + }, + +// When called from action, caches matched text and appends it on next action +more:function () { + this._more = true; + return this; + }, + +// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. +reject:function () { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + + } + return this; + }, + +// retain first n characters of the match +less:function (n) { + this.unput(this.match.slice(n)); + }, + +// displays already matched input, i.e. for error messages +pastInput:function () { + var past = this.matched.substr(0, this.matched.length - this.match.length); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + }, + +// displays upcoming input, i.e. for error messages +upcomingInput:function () { + var next = this.match; + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); + } + return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + }, + +// displays the character position where the lexing error occurred, i.e. for error messages +showPosition:function () { + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; + }, + +// test the lexed token: return FALSE when not a match, otherwise return token +test_match:function (match, indexed_rule) { + var token, + lines, + backup; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + + lines = match[0].match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? + lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + this.yylloc.last_column + match[0].length + }; + this.yytext += match[0]; + this.match += match[0]; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset += this.yyleng]; + } + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match[0].length); + this.matched += match[0]; + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + return false; // rule action called reject() implying the next rule should be tested instead. + } + return false; + }, + +// return next match in input +next:function () { + if (this.done) { + return this.EOF; + } + if (!this._input) { + this.done = true; + } + + var token, + match, + tempMatch, + index; + if (!this._more) { + this.yytext = ''; + this.match = ''; + } + var rules = this._currentRules(); + for (var i = 0; i < rules.length; i++) { + tempMatch = this._input.match(this.rules[rules[i]]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rules[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = false; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rules[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === "") { + return this.EOF; + } else { + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", + token: null, + line: this.yylineno + }); + } + }, + +// return next match that has a token +lex:function lex() { + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); + } + }, + +// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) +begin:function begin(condition) { + this.conditionStack.push(condition); + }, + +// pop the previously active lexer condition state off the condition stack +popState:function popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + +// produce the lexer rule set which is active for the currently active lexer condition state +_currentRules:function _currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions["INITIAL"].rules; + } + }, + +// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available +topState:function topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return "INITIAL"; + } + }, + +// alias for begin(condition) +pushState:function pushState(condition) { + this.begin(condition); + }, + +// return the number of states currently on the stack +stateStackSize:function stateStackSize() { + return this.conditionStack.length; + }, +options: {}, +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { +var YYSTATE=YY_START; +switch($avoiding_name_collisions) { +case 0:return 27; +break; +case 1:return 27; +break; +case 2:return 27; // regexp with braces or quotes (and no spaces) +break; +case 3:return 27; +break; +case 4:return 27; +break; +case 5:return 27; +break; +case 6:return 27; +break; +case 7:yy.depth++; return 23 +break; +case 8:yy.depth == 0 ? this.begin('trail') : yy.depth--; return 25 +break; +case 9:return 12; +break; +case 10:this.popState(); return 30; +break; +case 11:return 32; +break; +case 12:return 31; +break; +case 13:/* */ +break; +case 14:/* */ +break; +case 15:this.begin('indented') +break; +case 16:this.begin('code'); return 5 +break; +case 17:return 57 +break; +case 18:yy.options[yy_.yytext] = true +break; +case 19:this.begin('INITIAL') +break; +case 20:this.begin('INITIAL') +break; +case 21:/* empty */ +break; +case 22:return 19 +break; +case 23:this.begin('INITIAL') +break; +case 24:this.begin('INITIAL') +break; +case 25:/* empty */ +break; +case 26:this.begin('rules') +break; +case 27:yy.depth = 0; this.begin('action'); return 23 +break; +case 28:this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4);return 11 +break; +case 29:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length-4); return 11 +break; +case 30:this.begin('rules'); return 11 +break; +case 31:/* ignore */ +break; +case 32:/* ignore */ +break; +case 33:/* */ +break; +case 34:/* */ +break; +case 35:return 12; +break; +case 36:yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 56; +break; +case 37:yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 56; +break; +case 38:return 34; +break; +case 39:return 53; +break; +case 40:return 39; +break; +case 41:return 39; +break; +case 42:return 39; +break; +case 43:return 37; +break; +case 44:return 38; +break; +case 45:return 40; +break; +case 46:return 31; +break; +case 47:return 41; +break; +case 48:return 48; +break; +case 49:return 32; +break; +case 50:return 49; +break; +case 51:this.begin('conditions'); return 28; +break; +case 52:return 43; +break; +case 53:return 42; +break; +case 54:return 54; +break; +case 55:yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 54; +break; +case 56:return 49; +break; +case 57:return 47; +break; +case 58:yy.options = {}; this.begin('options'); +break; +case 59:this.begin('start_condition'); return 14; +break; +case 60:this.begin('start_condition'); return 16; +break; +case 61:this.begin('rules'); return 5; +break; +case 62:return 18; +break; +case 63:return 55; +break; +case 64:return 52; +break; +case 65:return 23; +break; +case 66:return 25; +break; +case 67:/* ignore bad characters */ +break; +case 68:return 8; +break; +case 69:return 9; +break; +} +}, +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:.*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:%[a-zA-Z]+[^\r\n]*)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +conditions: {"code":{"rules":[68,69],"inclusive":false},"start_condition":{"rules":[22,23,24,25,68],"inclusive":false},"options":{"rules":[18,19,20,21,68],"inclusive":false},"conditions":{"rules":[9,10,11,12,68],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,68],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],"inclusive":true}} +}); +return lexer; +})(); +parser.lexer = lexer; +function Parser () { + this.yy = {}; +} +Parser.prototype = parser;parser.Parser = Parser; +return new Parser; +})(); + + +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { +exports.parser = parser; +exports.Parser = parser.Parser; +exports.parse = function () { return parser.parse.apply(parser, arguments); }; +exports.main = function commonjsMain(args) { + if (!args[1]) { + console.log('Usage: '+args[0]+' FILE'); + process.exit(1); + } + var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); + return exports.parser.parse(source); +}; +if (typeof module !== 'undefined' && require.main === module) { + exports.main(process.argv.slice(1)); +} +} \ No newline at end of file From 688cddbb6e90fc49cc6182a354effcda7f40fe30 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 19 Oct 2015 23:01:46 +0200 Subject: [PATCH 070/417] - add check in makefile to produce a comprehensible error report before things go the way of the dodo when you forgot to run npm install everywhere -- something which make prep will take care of for you - make the makefile work well with one of the very few GNU Make builds on Windows which correctly support the `-j` make option for multithreading -- which is why I use it --: ``` GNU Make 4.1 This program is built by Equation Solution for Windows. Copyright (C) 1988-2014 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. ``` --- Makefile | 3 ++- lex-parser.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index aa1af92..72d9e14 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ npm-install: build: lex-parser.js lex-parser.js: lex.y lex.l - ./node_modules/.bin/jison -o lex-parser.js lex.y lex.l + @[ -a ./node_modules/.bin/jison ] || echo "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###" + sh node_modules/.bin/jison -o lex-parser.js lex.y lex.l test: node tests/all-tests.js diff --git a/lex-parser.js b/lex-parser.js index a3188d3..3c39f68 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2744,11 +2744,11 @@ simpleCaseActionClusters: { rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/.*)/, -/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/, +/^(?:\/[^ \/]*?['"{}'][^ ]*?\/)/, /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, -/^(?:[/"'][^{}/"']+)/, -/^(?:[^{}/"']+)/, +/^(?:[\/"'][^{}\/"']+)/, +/^(?:[^{}\/"']+)/, /^(?:\{)/, /^(?:\})/, /^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, From 988b2059b1224fa3c8e3ebdad77320d5b4942451 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 20 Oct 2015 00:08:17 +0200 Subject: [PATCH 071/417] - report all lexer 'unsupported character in input' errors with the location info for easier diagnostics and fixing by the user. --- README.md | 2 +- lex-parser.js | 2 +- lex.l | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 477278a..18f2e84 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ The parser can parse its own lexical grammar, shown below: "{"{NAME}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; - . throw new Error("unsupported input character: " + yytext); /* b0rk on bad characters */ + . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yyloc)); /* b0rk on bad characters */ <*><> return 'EOF'; (.|{BR})+ return 'CODE'; diff --git a/lex-parser.js b/lex-parser.js index 3c39f68..987e912 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2624,7 +2624,7 @@ break; case 66 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: . */ - throw new Error("unsupported input character: " + yy_.yytext); /* b0rk on bad characters */ + throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yyloc)); /* b0rk on bad characters */ break; default: return this.simpleCaseActionClusters[$avoiding_name_collisions]; diff --git a/lex.l b/lex.l index ee69867..1d081ee 100644 --- a/lex.l +++ b/lex.l @@ -85,7 +85,7 @@ BR \r\n|\n|\r "{"{NAME}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; -. throw new Error("unsupported input character: " + yytext); /* b0rk on bad characters */ +. throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yyloc)); /* b0rk on bad characters */ <*><> return 'EOF'; (.|{BR})+ return 'CODE'; From 65e11d4b42e4d3a76a153114b82f9b3470b37aa5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 20 Oct 2015 00:38:33 +0200 Subject: [PATCH 072/417] fix typo in `yylloc` (yyloc) in the code compiler, which screwed our location info tracking. --- README.md | 2 +- lex-parser.js | 6 +++--- lex.l | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 18f2e84..9b48c9b 100644 --- a/README.md +++ b/README.md @@ -108,7 +108,7 @@ The parser can parse its own lexical grammar, shown below: "{"{NAME}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; - . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yyloc)); /* b0rk on bad characters */ + . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ <*><> return 'EOF'; (.|{BR})+ return 'CODE'; diff --git a/lex-parser.js b/lex-parser.js index 987e912..6d8413b 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2197,7 +2197,7 @@ reject:function () { text: this.match, token: null, line: this.yylineno, - loc: this.yyloc + loc: this.yylloc }) || this.ERROR); } return this; @@ -2381,7 +2381,7 @@ next:function () { text: this.match + this._input, token: null, line: this.yylineno, - loc: this.yyloc + loc: this.yylloc }) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward one character at a time: @@ -2624,7 +2624,7 @@ break; case 66 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: . */ - throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yyloc)); /* b0rk on bad characters */ + throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ break; default: return this.simpleCaseActionClusters[$avoiding_name_collisions]; diff --git a/lex.l b/lex.l index 1d081ee..6817f59 100644 --- a/lex.l +++ b/lex.l @@ -85,7 +85,7 @@ BR \r\n|\n|\r "{"{NAME}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; -. throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yyloc)); /* b0rk on bad characters */ +. throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ <*><> return 'EOF'; (.|{BR})+ return 'CODE'; From 34386d2e20c6e39f27c36d90ad6796c2fc3b803f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 20 Oct 2015 23:54:11 +0200 Subject: [PATCH 073/417] - feature: added `%include \` support where you include any JavaScript code instead of dumping it into the lexer/grammar file itself; see the `examples/precedence.jison` file for a *minimal demo* of its potential uses -- particularly handy when certain actions, surplus/trailing code chunks and/or `%{...%}` code preludes have become pretty huge as you use JISON for a (complex) production grammar. - minor cleanup: several `yytext` uses in the *grammars* have been replaced by their preferred way of coding such references, i.e. using the `$`-prefixed rule atom name as a reference instead. **TBD**: the code is still littered with debug statements as we had a hard time finding one lexer issue -- see also the `lex.l` 'anecdotal' comments at around line 49 for rule `"%include"` --- lex-parser.js | 1883 ++++++++++++++++++++++++++++++------------------- lex.l | 57 +- lex.y | 64 +- 3 files changed, 1257 insertions(+), 747 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 6d8413b..e1e7b63 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -124,14 +124,17 @@ var __expand__ = function (k, v, o) { } return o; }, - $V0=[11,22,33,36,38,41,42,46,47,48,51,52,53,55], - $V1=[5,11,12,14,16,22,33,37], - $V2=[5,11,12,14,16,22,33,36,37,38,41,42,46,47,48,51,52,53,55], - $V3=[33,37], - $V4=[5,11,12,14,16,22,30,33,36,37,38,39,40,41,42,46,47,48,51,52,53,54,55], - $V5=[5,11,12,14,16], - $V6=[5,8,11,22,27,33,36,38,41,42,46,47,48,51,52,53,55], - $V7=[22,24]; + $V0=[11,23,34,37,39,42,43,47,48,49,52,53,54,56,57], + $V1=[5,11,13,15,17], + $V2=[5,11,13,15,17,23,34,38], + $V3=[5,11,13,15,17,23,34,37,38,39,42,43,47,48,49,52,53,54,56,57], + $V4=[34,38], + $V5=[5,11,13,15,17,23,31,34,37,38,39,40,41,42,43,47,48,49,52,53,54,55,56,57], + $V6=[5,11,13,15,17,19], + $V7=[5,8,11,13,15,17,23,28,34,37,39,42,43,47,48,49,52,53,54,56,57,59], + $V8=[5,8,11,23,28,34,37,39,42,43,47,48,49,52,53,54,56,57], + $V9=[8,59], + $Va=[23,25]; var parser = { trace: function trace() { }, yy: {}, @@ -143,54 +146,60 @@ symbols_: { "rules": 6, "epilogue": 7, "EOF": 8, - "CODE": 9, + "extra_lexer_module_code": 9, "definition": 10, "ACTION": 11, - "NAME": 12, - "regex": 13, - "START_INC": 14, - "names_inclusive": 15, - "START_EXC": 16, - "names_exclusive": 17, - "START_COND": 18, - "rule": 19, - "start_conditions": 20, - "action": 21, - "{": 22, - "action_body": 23, - "}": 24, - "action_comments_body": 25, - "ACTION_BODY": 26, - "<": 27, - "name_list": 28, - ">": 29, - "*": 30, - ",": 31, - "regex_list": 32, - "|": 33, - "regex_concat": 34, - "regex_base": 35, - "(": 36, - ")": 37, - "SPECIAL_GROUP": 38, - "+": 39, - "?": 40, - "/": 41, - "/!": 42, - "name_expansion": 43, - "range_regex": 44, - "any_group_regex": 45, - ".": 46, - "^": 47, - "$": 48, - "string": 49, - "escape_char": 50, - "NAME_BRACE": 51, - "ANY_GROUP_REGEX": 52, - "ESCAPE_CHAR": 53, - "RANGE_REGEX": 54, - "STRING_LIT": 55, - "CHARACTER_LIT": 56, + "include_macro_code": 12, + "NAME": 13, + "regex": 14, + "START_INC": 15, + "names_inclusive": 16, + "START_EXC": 17, + "names_exclusive": 18, + "START_COND": 19, + "rule": 20, + "start_conditions": 21, + "action": 22, + "{": 23, + "action_body": 24, + "}": 25, + "action_comments_body": 26, + "ACTION_BODY": 27, + "<": 28, + "name_list": 29, + ">": 30, + "*": 31, + ",": 32, + "regex_list": 33, + "|": 34, + "regex_concat": 35, + "regex_base": 36, + "(": 37, + ")": 38, + "SPECIAL_GROUP": 39, + "+": 40, + "?": 41, + "/": 42, + "/!": 43, + "name_expansion": 44, + "range_regex": 45, + "any_group_regex": 46, + ".": 47, + "^": 48, + "$": 49, + "string": 50, + "escape_char": 51, + "NAME_BRACE": 52, + "ANY_GROUP_REGEX": 53, + "ESCAPE_CHAR": 54, + "RANGE_REGEX": 55, + "STRING_LIT": 56, + "CHARACTER_LIT": 57, + "optional_module_code_chunk": 58, + "INCLUDE": 59, + "PATH": 60, + "module_code_chunk": 61, + "CODE": 62, "$accept": 0, "$end": 1 }, @@ -198,36 +207,38 @@ terminals_: { 2: "error", 5: "%%", 8: "EOF", - 9: "CODE", 11: "ACTION", - 12: "NAME", - 14: "START_INC", - 16: "START_EXC", - 18: "START_COND", - 22: "{", - 24: "}", - 26: "ACTION_BODY", - 27: "<", - 29: ">", - 30: "*", - 31: ",", - 33: "|", - 36: "(", - 37: ")", - 38: "SPECIAL_GROUP", - 39: "+", - 40: "?", - 41: "/", - 42: "/!", - 46: ".", - 47: "^", - 48: "$", - 51: "NAME_BRACE", - 52: "ANY_GROUP_REGEX", - 53: "ESCAPE_CHAR", - 54: "RANGE_REGEX", - 55: "STRING_LIT", - 56: "CHARACTER_LIT" + 13: "NAME", + 15: "START_INC", + 17: "START_EXC", + 19: "START_COND", + 23: "{", + 25: "}", + 27: "ACTION_BODY", + 28: "<", + 30: ">", + 31: "*", + 32: ",", + 34: "|", + 37: "(", + 38: ")", + 39: "SPECIAL_GROUP", + 40: "+", + 41: "?", + 42: "/", + 43: "/!", + 47: ".", + 48: "^", + 49: "$", + 52: "NAME_BRACE", + 53: "ANY_GROUP_REGEX", + 54: "ESCAPE_CHAR", + 55: "RANGE_REGEX", + 56: "STRING_LIT", + 57: "CHARACTER_LIT", + 59: "INCLUDE", + 60: "PATH", + 62: "CODE" }, productions_: [ 0, @@ -241,11 +252,11 @@ productions_: [ ], [ 7, - 2 + 3 ], [ - 7, - 3 + 4, + 2 ], [ 4, @@ -272,19 +283,19 @@ productions_: [ 2 ], [ - 15, + 16, 1 ], [ - 15, + 16, 2 ], [ - 17, + 18, 1 ], [ - 17, + 18, 2 ], [ @@ -296,151 +307,163 @@ productions_: [ 1 ], [ - 19, + 20, 3 ], [ - 21, + 22, 3 ], [ - 21, + 22, + 1 + ], + [ + 22, 1 ], [ - 23, + 24, 0 ], [ - 23, + 24, 1 ], [ - 23, + 24, 5 ], [ - 23, + 24, 4 ], [ - 25, + 26, 1 ], [ - 25, + 26, 2 ], [ - 20, + 21, 3 ], [ - 20, + 21, 3 ], [ - 20, + 21, 0 ], [ - 28, + 29, 1 ], [ - 28, + 29, 3 ], [ - 13, + 14, 1 ], [ - 32, + 33, 3 ], [ - 32, + 33, 2 ], [ - 32, + 33, 1 ], [ - 32, + 33, 0 ], [ - 34, + 35, 2 ], [ - 34, + 35, 1 ], [ - 35, + 36, 3 ], [ - 35, + 36, 3 ], [ - 35, + 36, 2 ], [ - 35, + 36, 2 ], [ - 35, + 36, 2 ], [ - 35, + 36, 2 ], [ - 35, + 36, 2 ], [ - 35, + 36, 1 ], [ - 35, + 36, 2 ], [ - 35, + 36, 1 ], [ - 35, + 36, 1 ], [ - 35, + 36, 1 ], [ - 35, + 36, 1 ], [ - 35, + 36, 1 ], [ - 35, + 36, + 1 + ], + [ + 44, + 1 + ], + [ + 46, 1 ], [ - 43, + 51, 1 ], [ @@ -452,16 +475,40 @@ productions_: [ 1 ], [ - 44, + 50, 1 ], [ - 49, + 9, + 1 + ], + [ + 9, + 3 + ], + [ + 12, + 2 + ], + [ + 12, + 2 + ], + [ + 61, 1 ], [ - 49, + 61, + 2 + ], + [ + 58, 1 + ], + [ + 58, + 0 ] ], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { @@ -475,7 +522,7 @@ case 1 : this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; - if ($$[$0]) this.$.moduleInclude = $$[$0]; + if ($$[$0] && $$[$0].trim() !== '') this.$.moduleInclude = $$[$0]; if (yy.options) this.$.options = yy.options; if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; delete yy.options; @@ -485,19 +532,15 @@ case 1 : break; case 2 : /*! Production:: epilogue : EOF */ - case 3 : -/*! Production:: epilogue : %% EOF */ this.$ = null; break; -case 4 : -/*! Production:: epilogue : %% CODE EOF */ - case 18 : -/*! Production:: action : { action_body } */ - case 26 : +case 3 : +/*! Production:: epilogue : %% extra_lexer_module_code EOF */ + case 27 : /*! Production:: start_conditions : < name_list > */ this.$ = $$[$0-1]; break; -case 5 : +case 4 : /*! Production:: definitions : definition definitions */ this.$ = $$[$0]; @@ -512,8 +555,10 @@ case 5 : } break; -case 6 : +case 5 : /*! Production:: definitions : ACTION definitions */ + case 6 : +/*! Production:: definitions : include_macro_code definitions */ yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; break; case 7 : @@ -528,10 +573,22 @@ case 9 : /*! Production:: definition : START_INC names_inclusive */ case 10 : /*! Production:: definition : START_EXC names_exclusive */ - case 19 : -/*! Production:: action : ACTION */ - case 21 : + case 22 : /*! Production:: action_body : action_comments_body */ + case 25 : +/*! Production:: action_comments_body : ACTION_BODY */ + case 55 : +/*! Production:: any_group_regex : ANY_GROUP_REGEX */ + case 56 : +/*! Production:: escape_char : ESCAPE_CHAR */ + case 57 : +/*! Production:: range_regex : RANGE_REGEX */ + case 60 : +/*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + case 64 : +/*! Production:: module_code_chunk : CODE */ + case 66 : +/*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = $$[$0]; break; case 11 : @@ -556,7 +613,7 @@ case 15 : break; case 16 : /*! Production:: rules : rule */ - case 29 : + case 30 : /*! Production:: name_list : NAME */ this.$ = [$$[$0]]; break; @@ -564,47 +621,53 @@ case 17 : /*! Production:: rule : start_conditions regex action */ this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; +case 18 : +/*! Production:: action : { action_body } */ + console.log("one ACTION BODY: ", $$[$0-1]); this.$ = $$[$0-1]; +break; +case 19 : +/*! Production:: action : ACTION */ + console.log("one ACTION: ", $$[$0]); this.$ = $$[$0]; +break; case 20 : +/*! Production:: action : include_macro_code */ + console.log("one INCLUDE: ", $$[$0]); this.$ = $$[$0]; +break; +case 21 : /*! Production:: action_body : */ - case 35 : + case 36 : /*! Production:: regex_list : */ + case 67 : +/*! Production:: optional_module_code_chunk : */ this.$ = ''; break; -case 22 : +case 23 : /*! Production:: action_body : action_body { action_body } action_comments_body */ this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 23 : +case 24 : /*! Production:: action_body : action_body { action_body } */ this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24 : -/*! Production:: action_comments_body : ACTION_BODY */ - case 54 : -/*! Production:: any_group_regex : ANY_GROUP_REGEX */ - case 55 : -/*! Production:: escape_char : ESCAPE_CHAR */ - case 56 : -/*! Production:: range_regex : RANGE_REGEX */ - this.$ = yytext; -break; -case 25 : +case 26 : /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - case 36 : + case 37 : /*! Production:: regex_concat : regex_concat regex_base */ - case 46 : + case 47 : /*! Production:: regex_base : regex_base range_regex */ + case 65 : +/*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = $$[$0-1] + $$[$0]; break; -case 27 : +case 28 : /*! Production:: start_conditions : < * > */ this.$ = ['*']; break; -case 30 : +case 31 : /*! Production:: name_list : name_list , NAME */ this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 31 : +case 32 : /*! Production:: regex : regex_list */ this.$ = $$[$0]; @@ -613,57 +676,77 @@ case 31 : } break; -case 32 : +case 33 : /*! Production:: regex_list : regex_list | regex_concat */ this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 33 : +case 34 : /*! Production:: regex_list : regex_list | */ this.$ = $$[$0-1] + '|'; break; -case 38 : +case 39 : /*! Production:: regex_base : ( regex_list ) */ this.$ = '(' + $$[$0-1] + ')'; break; -case 39 : +case 40 : /*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 40 : +case 41 : /*! Production:: regex_base : regex_base + */ this.$ = $$[$0-1] + '+'; break; -case 41 : +case 42 : /*! Production:: regex_base : regex_base * */ this.$ = $$[$0-1] + '*'; break; -case 42 : +case 43 : /*! Production:: regex_base : regex_base ? */ this.$ = $$[$0-1] + '?'; break; -case 43 : +case 44 : /*! Production:: regex_base : / regex_base */ this.$ = '(?=' + $$[$0] + ')'; break; -case 44 : +case 45 : /*! Production:: regex_base : /! regex_base */ this.$ = '(?!' + $$[$0] + ')'; break; -case 48 : +case 49 : /*! Production:: regex_base : . */ this.$ = '.'; break; -case 49 : +case 50 : /*! Production:: regex_base : ^ */ this.$ = '^'; break; -case 50 : +case 51 : /*! Production:: regex_base : $ */ this.$ = '$'; break; -case 57 : +case 58 : /*! Production:: string : STRING_LIT */ - this.$ = prepareString(yytext.substr(1, yytext.length - 2)); + this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); +break; +case 61 : +/*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ + this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 62 : +/*! Production:: include_macro_code : INCLUDE PATH */ + + console.log("load file: ", $$[$0]); + var fs = require('fs'); + var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); + // And no, we don't support nested '%include': + this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; + +break; +case 63 : +/*! Production:: include_macro_code : INCLUDE error */ + + console.error("%include MUST be followed by a valid file path"); + break; } }, @@ -680,17 +763,22 @@ table: [ 1, 4 ], - 12: [ - 1, - 5 - ], - 14: [ + 12: 5, + 13: [ 1, 6 ], - 16: [ + 15: [ 1, 7 + ], + 17: [ + 1, + 8 + ], + 59: [ + 1, + 9 ] }, { @@ -701,11 +789,11 @@ table: [ { 5: [ 1, - 8 + 10 ] }, { - 4: 9, + 4: 11, 5: [ 2, 7 @@ -715,21 +803,26 @@ table: [ 1, 4 ], - 12: [ - 1, - 5 - ], - 14: [ + 12: 5, + 13: [ 1, 6 ], - 16: [ + 15: [ 1, 7 + ], + 17: [ + 1, + 8 + ], + 59: [ + 1, + 9 ] }, { - 4: 10, + 4: 12, 5: [ 2, 7 @@ -739,85 +832,138 @@ table: [ 1, 4 ], - 12: [ + 12: 5, + 13: [ 1, - 5 + 6 + ], + 15: [ + 1, + 7 + ], + 17: [ + 1, + 8 + ], + 59: [ + 1, + 9 + ] + }, + { + 4: 13, + 5: [ + 2, + 7 + ], + 10: 3, + 11: [ + 1, + 4 ], - 14: [ + 12: 5, + 13: [ 1, 6 ], - 16: [ + 15: [ 1, 7 + ], + 17: [ + 1, + 8 + ], + 59: [ + 1, + 9 ] }, - __expand__([5,11,12,14,16,33], [ + __expand__([5,11,13,15,17,34], [ 2, - 35 - ], {13:11,32:12,34:13,35:14,43:19,45:20,49:24,50:25,36:[ - 1, - 15 - ],38:[ + 36 + ], {14:14,33:15,35:16,36:17,44:22,46:23,50:27,51:28,37:[ 1, - 16 - ],41:[ + 18 + ],39:[ 1, - 17 + 19 ],42:[ 1, - 18 - ],46:[ + 20 + ],43:[ 1, 21 ],47:[ 1, - 22 + 24 ],48:[ 1, - 23 - ],51:[ + 25 + ],49:[ 1, 26 ],52:[ 1, - 27 + 29 ],53:[ 1, 30 - ],55:[ + ],54:[ 1, - 28 + 33 ],56:[ 1, - 29 + 31 + ],57:[ + 1, + 32 + ],59:[ + 2, + 36 ] }), { - 15: 31, - 18: [ + 16: 34, + 19: [ 1, - 32 + 35 ] }, { - 17: 33, - 18: [ + 18: 36, + 19: [ 1, - 34 + 37 + ] + }, + { + 2: [ + 1, + 39 + ], + 60: [ + 1, + 38 ] }, __expand__($V0, [ 2, - 28 - ], {6:35,19:36,20:37,27:[ + 29 + ], {6:40,20:41,21:42,28:[ 1, - 38 - ],56:[ + 43 + ],59:[ 2, - 28 + 29 ] }), + { + 5: [ + 2, + 4 + ] + }, { 5: [ 2, @@ -830,653 +976,687 @@ table: [ 6 ] }, - __expand__([5,11,12,14], [ + __expand__($V1, [ 2, 8 - ], {16:[ + ], {59:[ 2, 8 ] }), - __expand__([5,11,12,14,16,22], [ + __expand__([5,11,13,15,17,23], [ 2, - 31 - ], {33:[ + 32 + ], {34:[ 1, - 39 + 44 + ],59:[ + 2, + 32 ] }), - __expand__($V1, [ + __expand__($V2, [ 2, - 34 - ], {43:19,45:20,49:24,50:25,35:40,36:[ - 1, - 15 - ],38:[ + 35 + ], {44:22,46:23,50:27,51:28,36:45,37:[ 1, - 16 - ],41:[ + 18 + ],39:[ 1, - 17 + 19 ],42:[ 1, - 18 - ],46:[ + 20 + ],43:[ 1, 21 ],47:[ 1, - 22 + 24 ],48:[ 1, - 23 - ],51:[ + 25 + ],49:[ 1, 26 ],52:[ 1, - 27 + 29 ],53:[ 1, 30 - ],55:[ + ],54:[ 1, - 28 + 33 ],56:[ 1, - 29 + 31 + ],57:[ + 1, + 32 + ],59:[ + 2, + 35 ] }), - __expand__($V2, [ + __expand__($V3, [ 2, - 37 - ], {44:44,30:[ - 1, - 42 - ],39:[ + 38 + ], {45:49,31:[ 1, - 41 + 47 ],40:[ 1, - 43 - ],54:[ + 46 + ],41:[ 1, - 45 - ],56:[ + 48 + ],55:[ + 1, + 50 + ],59:[ 2, - 37 + 38 ] }), - __expand__($V3, [ + __expand__($V4, [ 2, - 35 - ], {34:13,35:14,43:19,45:20,49:24,50:25,32:46,36:[ - 1, - 15 - ],38:[ + 36 + ], {35:16,36:17,44:22,46:23,50:27,51:28,33:51,37:[ 1, - 16 - ],41:[ + 18 + ],39:[ 1, - 17 + 19 ],42:[ 1, - 18 - ],46:[ + 20 + ],43:[ 1, 21 ],47:[ 1, - 22 + 24 ],48:[ 1, - 23 - ],51:[ + 25 + ],49:[ 1, 26 ],52:[ 1, - 27 + 29 ],53:[ 1, 30 - ],55:[ + ],54:[ 1, - 28 + 33 ],56:[ 1, - 29 + 31 + ],57:[ + 1, + 32 ] }), - __expand__($V3, [ + __expand__($V4, [ 2, - 35 - ], {34:13,35:14,43:19,45:20,49:24,50:25,32:47,36:[ - 1, - 15 - ],38:[ + 36 + ], {35:16,36:17,44:22,46:23,50:27,51:28,33:52,37:[ 1, - 16 - ],41:[ + 18 + ],39:[ 1, - 17 + 19 ],42:[ 1, - 18 - ],46:[ + 20 + ],43:[ 1, 21 ],47:[ 1, - 22 + 24 ],48:[ 1, - 23 - ],51:[ + 25 + ],49:[ 1, 26 ],52:[ 1, - 27 + 29 ],53:[ 1, 30 - ],55:[ + ],54:[ 1, - 28 + 33 ],56:[ 1, - 29 + 31 + ],57:[ + 1, + 32 ] }), { - 35: 48, - 36: [ - 1, - 15 - ], - 38: [ + 36: 53, + 37: [ 1, - 16 + 18 ], - 41: [ + 39: [ 1, - 17 + 19 ], 42: [ 1, - 18 + 20 ], - 43: 19, - 45: 20, - 46: [ + 43: [ 1, 21 ], + 44: 22, + 46: 23, 47: [ 1, - 22 + 24 ], 48: [ 1, - 23 + 25 ], - 49: 24, - 50: 25, - 51: [ + 49: [ 1, 26 ], + 50: 27, + 51: 28, 52: [ 1, - 27 + 29 ], 53: [ 1, 30 ], - 55: [ + 54: [ 1, - 28 + 33 ], 56: [ 1, - 29 + 31 + ], + 57: [ + 1, + 32 ] }, { - 35: 49, - 36: [ - 1, - 15 - ], - 38: [ + 36: 54, + 37: [ 1, - 16 + 18 ], - 41: [ + 39: [ 1, - 17 + 19 ], 42: [ 1, - 18 + 20 ], - 43: 19, - 45: 20, - 46: [ + 43: [ 1, 21 ], + 44: 22, + 46: 23, 47: [ 1, - 22 + 24 ], 48: [ 1, - 23 + 25 ], - 49: 24, - 50: 25, - 51: [ + 49: [ 1, 26 ], + 50: 27, + 51: 28, 52: [ 1, - 27 + 29 ], 53: [ 1, 30 ], - 55: [ + 54: [ 1, - 28 + 33 ], 56: [ 1, - 29 + 31 + ], + 57: [ + 1, + 32 ] }, - __expand__($V4, [ - 2, - 45 - ], {56:[ - 2, - 45 - ] - }), - __expand__($V4, [ + __expand__($V5, [ 2, - 47 - ], {56:[ + 46 + ], {59:[ 2, - 47 + 46 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 48 - ], {56:[ + ], {59:[ 2, 48 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 49 - ], {56:[ + ], {59:[ 2, 49 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 50 - ], {56:[ + ], {59:[ 2, 50 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 51 - ], {56:[ + ], {59:[ 2, 51 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 52 - ], {56:[ + ], {59:[ 2, 52 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 53 - ], {56:[ + ], {59:[ 2, 53 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 54 - ], {56:[ + ], {59:[ 2, 54 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, - 57 - ], {56:[ + 55 + ], {59:[ 2, - 57 + 55 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 58 - ], {56:[ + ], {59:[ 2, 58 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, - 55 - ], {56:[ + 59 + ], {59:[ 2, - 55 + 59 ] }), __expand__($V5, [ + 2, + 56 + ], {59:[ + 2, + 56 + ] + }), + __expand__($V1, [ 2, 9 - ], {18:[ + ], {19:[ 1, - 50 + 55 + ],59:[ + 2, + 9 ] }), - __expand__($V5, [ + __expand__($V6, [ 2, 11 - ], {18:[ + ], {59:[ 2, 11 ] }), - __expand__($V5, [ + __expand__($V1, [ 2, 10 - ], {18:[ + ], {19:[ 1, - 51 + 56 + ],59:[ + 2, + 10 ] }), - __expand__($V5, [ + __expand__($V6, [ 2, 13 - ], {18:[ + ], {59:[ 2, 13 ] }), + __expand__($V7, [ + 2, + 62 + ], {62:[ + 2, + 62 + ] + }), + __expand__($V7, [ + 2, + 63 + ], {62:[ + 2, + 63 + ] + }), __expand__($V0, [ 2, - 28 - ], {20:37,7:52,19:53,5:[ + 29 + ], {21:42,7:57,20:58,5:[ 1, - 55 + 60 ],8:[ 1, - 54 - ],27:[ + 59 + ],28:[ 1, - 38 - ],56:[ + 43 + ],59:[ 2, - 28 + 29 ] }), - __expand__($V6, [ + __expand__($V8, [ 2, 16 - ], {56:[ + ], {59:[ 2, 16 ] }), - __expand__([11,22,33], [ + __expand__([11,23,34], [ 2, - 35 - ], {32:12,34:13,35:14,43:19,45:20,49:24,50:25,13:56,36:[ - 1, - 15 - ],38:[ + 36 + ], {33:15,35:16,36:17,44:22,46:23,50:27,51:28,14:61,37:[ 1, - 16 - ],41:[ + 18 + ],39:[ 1, - 17 + 19 ],42:[ 1, - 18 - ],46:[ + 20 + ],43:[ 1, 21 ],47:[ 1, - 22 + 24 ],48:[ 1, - 23 - ],51:[ + 25 + ],49:[ 1, 26 ],52:[ 1, - 27 + 29 ],53:[ 1, 30 - ],55:[ + ],54:[ 1, - 28 + 33 ],56:[ 1, - 29 + 31 + ],57:[ + 1, + 32 + ],59:[ + 2, + 36 ] }), { - 12: [ + 13: [ 1, - 59 + 64 ], - 28: 57, - 30: [ + 29: 62, + 31: [ 1, - 58 + 63 ] }, - __expand__($V1, [ + __expand__($V2, [ 2, - 33 - ], {35:14,43:19,45:20,49:24,50:25,34:60,36:[ - 1, - 15 - ],38:[ + 34 + ], {36:17,44:22,46:23,50:27,51:28,35:65,37:[ 1, - 16 - ],41:[ + 18 + ],39:[ 1, - 17 + 19 ],42:[ 1, - 18 - ],46:[ + 20 + ],43:[ 1, 21 ],47:[ 1, - 22 + 24 ],48:[ 1, - 23 - ],51:[ + 25 + ],49:[ 1, 26 ],52:[ 1, - 27 + 29 ],53:[ 1, 30 - ],55:[ + ],54:[ 1, - 28 + 33 ],56:[ 1, - 29 + 31 + ],57:[ + 1, + 32 + ],59:[ + 2, + 34 ] }), - __expand__($V2, [ + __expand__($V3, [ 2, - 36 - ], {44:44,30:[ - 1, - 42 - ],39:[ + 37 + ], {45:49,31:[ 1, - 41 + 47 ],40:[ 1, - 43 - ],54:[ + 46 + ],41:[ 1, - 45 - ],56:[ - 2, - 36 - ] - }), - __expand__($V4, [ - 2, - 40 - ], {56:[ + 48 + ],55:[ + 1, + 50 + ],59:[ 2, - 40 + 37 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 41 - ], {56:[ + ], {59:[ 2, 41 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, 42 - ], {56:[ + ], {59:[ 2, 42 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, - 46 - ], {56:[ + 43 + ], {59:[ 2, - 46 + 43 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, - 56 - ], {56:[ + 47 + ], {59:[ 2, - 56 + 47 + ] + }), + __expand__($V5, [ + 2, + 57 + ], {59:[ + 2, + 57 ] }), { - 33: [ + 34: [ 1, - 39 + 44 ], - 37: [ + 38: [ 1, - 61 + 66 ] }, { - 33: [ + 34: [ 1, - 39 + 44 ], - 37: [ + 38: [ 1, - 62 + 67 ] }, - __expand__($V2, [ + __expand__($V3, [ 2, - 43 - ], {44:44,30:[ - 1, - 42 - ],39:[ + 44 + ], {45:49,31:[ 1, - 41 + 47 ],40:[ 1, - 43 - ],54:[ + 46 + ],41:[ 1, - 45 - ],56:[ + 48 + ],55:[ + 1, + 50 + ],59:[ 2, - 43 + 44 ] }), - __expand__($V2, [ + __expand__($V3, [ 2, - 44 - ], {44:44,30:[ - 1, - 42 - ],39:[ + 45 + ], {45:49,31:[ 1, - 41 + 47 ],40:[ 1, - 43 - ],54:[ + 46 + ],41:[ 1, - 45 - ],56:[ + 48 + ],55:[ + 1, + 50 + ],59:[ 2, - 44 + 45 ] }), - __expand__($V5, [ + __expand__($V6, [ 2, 12 - ], {18:[ + ], {59:[ 2, 12 ] }), - __expand__($V5, [ + __expand__($V6, [ 2, 14 - ], {18:[ + ], {59:[ 2, 14 ] @@ -1487,10 +1667,10 @@ table: [ 1 ] }, - __expand__($V6, [ + __expand__($V8, [ 2, 15 - ], {56:[ + ], {59:[ 2, 15 ] @@ -1501,285 +1681,346 @@ table: [ 2 ] }, - { - 8: [ - 1, - 63 - ], - 9: [ + __expand__($V9, [ + 2, + 67 + ], {9:68,58:69,61:70,62:[ 1, - 64 + 71 ] - }, + }), { 11: [ 1, - 67 + 74 ], - 21: 65, - 22: [ + 12: 75, + 22: 72, + 23: [ 1, - 66 + 73 + ], + 59: [ + 1, + 9 ] }, { - 29: [ + 30: [ 1, - 68 + 76 ], - 31: [ + 32: [ 1, - 69 + 77 ] }, { - 29: [ + 30: [ 1, - 70 + 78 ] }, { - 29: [ + 30: [ 2, - 29 + 30 ], - 31: [ + 32: [ 2, - 29 + 30 ] }, - __expand__($V1, [ + __expand__($V2, [ 2, - 32 - ], {43:19,45:20,49:24,50:25,35:40,36:[ - 1, - 15 - ],38:[ + 33 + ], {44:22,46:23,50:27,51:28,36:45,37:[ 1, - 16 - ],41:[ + 18 + ],39:[ 1, - 17 + 19 ],42:[ 1, - 18 - ],46:[ + 20 + ],43:[ 1, 21 ],47:[ 1, - 22 + 24 ],48:[ 1, - 23 - ],51:[ + 25 + ],49:[ 1, 26 ],52:[ 1, - 27 + 29 ],53:[ 1, 30 - ],55:[ + ],54:[ 1, - 28 + 33 ],56:[ 1, - 29 + 31 + ],57:[ + 1, + 32 + ],59:[ + 2, + 33 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, - 38 - ], {56:[ + 39 + ], {59:[ 2, - 38 + 39 ] }), - __expand__($V4, [ + __expand__($V5, [ 2, - 39 - ], {56:[ + 40 + ], {59:[ 2, - 39 + 40 ] }), { - 1: [ - 2, - 3 + 8: [ + 1, + 79 ] }, { 8: [ + 2, + 60 + ], + 12: 80, + 59: [ 1, - 71 + 9 ] }, - __expand__($V6, [ + __expand__($V9, [ + 2, + 66 + ], {62:[ + 1, + 81 + ] + }), + __expand__($V9, [ + 2, + 64 + ], {62:[ + 2, + 64 + ] + }), + __expand__($V8, [ 2, 17 - ], {56:[ + ], {59:[ 2, 17 ] }), - __expand__($V7, [ + __expand__($Va, [ 2, - 20 - ], {23:72,25:73,26:[ + 21 + ], {24:82,26:83,27:[ 1, - 74 + 84 ] }), - __expand__($V6, [ + __expand__($V8, [ 2, 19 - ], {56:[ + ], {59:[ 2, 19 ] }), + __expand__($V8, [ + 2, + 20 + ], {59:[ + 2, + 20 + ] + }), __expand__($V0, [ 2, - 26 - ], {56:[ + 27 + ], {59:[ 2, - 26 + 27 ] }), { - 12: [ + 13: [ 1, - 75 + 85 ] }, __expand__($V0, [ 2, - 27 - ], {56:[ + 28 + ], {59:[ 2, - 27 + 28 ] }), { 1: [ 2, - 4 + 3 ] }, + __expand__($V9, [ + 2, + 67 + ], {58:69,61:70,9:86,62:[ + 1, + 71 + ] + }), + __expand__($V9, [ + 2, + 65 + ], {62:[ + 2, + 65 + ] + }), { - 22: [ + 23: [ 1, - 77 + 88 ], - 24: [ + 25: [ 1, - 76 + 87 ] }, - __expand__($V7, [ + __expand__($Va, [ 2, - 21 - ], {26:[ + 22 + ], {27:[ 1, - 78 + 89 ] }), - __expand__($V7, [ + __expand__($Va, [ 2, - 24 - ], {26:[ + 25 + ], {27:[ 2, - 24 + 25 ] }), { - 29: [ + 30: [ 2, - 30 + 31 ], - 31: [ + 32: [ 2, - 30 + 31 ] }, - __expand__($V6, [ + { + 8: [ + 2, + 61 + ] + }, + __expand__($V8, [ 2, 18 - ], {56:[ + ], {59:[ 2, 18 ] }), - __expand__($V7, [ + __expand__($Va, [ 2, - 20 - ], {25:73,23:79,26:[ + 21 + ], {26:83,24:90,27:[ 1, - 74 + 84 ] }), - __expand__($V7, [ + __expand__($Va, [ 2, - 25 - ], {26:[ + 26 + ], {27:[ 2, - 25 + 26 ] }), { - 22: [ + 23: [ 1, - 77 + 88 ], - 24: [ + 25: [ 1, - 80 + 91 ] }, - __expand__($V7, [ + __expand__($Va, [ 2, - 23 - ], {25:81,26:[ + 24 + ], {26:92,27:[ 1, - 74 + 84 ] }), - __expand__($V7, [ + __expand__($Va, [ 2, - 22 - ], {26:[ + 23 + ], {27:[ 1, - 78 + 89 ] }) ], defaultActions: { - 9: [ + 11: [ + 2, + 4 + ], + 12: [ 2, 5 ], - 10: [ + 13: [ 2, 6 ], - 52: [ + 57: [ 2, 1 ], - 54: [ + 59: [ 2, 2 ], - 63: [ + 79: [ 2, 3 ], - 71: [ + 86: [ 2, - 4 + 61 ] }, parseError: function parseError(str, hash) { @@ -1805,7 +2046,7 @@ parse: function parse(input) { yytext = '', yylineno = 0, yyleng = 0, - + recovering = 0, // (only used when the grammar contains error recovery rules) error_signaled = false, TERROR = 2, EOF = 1; @@ -1879,6 +2120,26 @@ parse: function parse(input) { sharedState.yy.pre_parse.call(this, sharedState.yy); } + // Return the rule stack depth where the nearest error rule can be found. + // Return FALSE when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = stack.length - 1; + var depth = 0; + + // try to recover from error + for (;;) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + return depth; + } + if (state === 0 || stack_probe < 2) { + return false; // No suitable error recovery rule available. + } + stack_probe -= 2; // popStack(1): [symbol, action] + state = stack[stack_probe]; + ++depth; + } + } function collect_expected_token_set(state) { @@ -1914,28 +2175,82 @@ parse: function parse(input) { // handle parse error if (typeof action === 'undefined' || !action.length || !action[0]) { - var errStr; + var error_rule_depth; + var errStr = ''; - // Report error - expected = collect_expected_token_set(state); - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ":\n" + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + - (symbol === EOF ? 'end of input' : - ("'" + (this.terminals_[symbol] || symbol) + "'")); + if (!recovering) { + // first see if there's any chance at hitting an error recovery rule: + error_rule_depth = locateNearestErrorRecoveryRule(state); + + // Report error + expected = collect_expected_token_set(state); + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + + (symbol === EOF ? 'end of input' : + ("'" + (this.terminals_[symbol] || symbol) + "'")); + } + error_signaled = true; + a = this.parseError(errStr, p = { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: (error_rule_depth !== false) + }); + if (!p.recoverable) { + retval = a; + break; + } + } else if (preErrorSymbol !== EOF) { + error_rule_depth = locateNearestErrorRecoveryRule(state); } - // we cannot recover from the error! - error_signaled = true; - retval = this.parseError(errStr, { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; + + // just recovered from another error + if (recovering === 3) { + if (symbol === EOF || preErrorSymbol === EOF) { + error_signaled = true; + retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + + // discard current lookahead and grab another + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + symbol = lex(); + } + + // try to recover from error + if (error_rule_depth === false) { + error_signaled = true; + retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + popStack(error_rule_depth); + + preErrorSymbol = (symbol === TERROR ? null : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length - 1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error } @@ -1967,7 +2282,9 @@ parse: function parse(input) { yytext = lexer.yytext; yylineno = lexer.yylineno; yyloc = lexer.yylloc; - + if (recovering > 0) { + recovering--; + } } else { // error just occurred, resume old lookahead f/ before error symbol = preErrorSymbol; @@ -2464,22 +2781,22 @@ switch($avoiding_name_collisions) { case 2 : /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 26; // regexp with braces or quotes (and no spaces) + return 27; // regexp with braces or quotes (and no spaces) break; case 7 : /*! Conditions:: action */ /*! Rule:: \{ */ - yy.depth++; return 22; + yy.depth++; return 23; break; case 8 : /*! Conditions:: action */ /*! Rule:: \} */ - if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 24; + if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 25; break; case 10 : /*! Conditions:: conditions */ /*! Rule:: > */ - this.popState(); return 29; + this.popState(); return 30; break; case 13 : /*! Conditions:: rules */ @@ -2509,12 +2826,12 @@ break; case 19 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.begin('INITIAL'); + this.popState(); break; case 20 : /*! Conditions:: options */ /*! Rule:: \s+{BR}+ */ - this.begin('INITIAL'); + this.popState(); break; case 21 : /*! Conditions:: options */ @@ -2524,12 +2841,12 @@ break; case 23 : /*! Conditions:: start_condition */ /*! Rule:: {BR}+ */ - this.begin('INITIAL'); + this.popState(); break; case 24 : /*! Conditions:: start_condition */ /*! Rule:: \s+{BR}+ */ - this.begin('INITIAL'); + this.popState(); break; case 25 : /*! Conditions:: start_condition */ @@ -2544,7 +2861,7 @@ break; case 27 : /*! Conditions:: indented */ /*! Rule:: \{ */ - yy.depth = 0; this.begin('action'); return 22; + yy.depth = 0; this.begin('action'); return 23; break; case 28 : /*! Conditions:: indented */ @@ -2558,74 +2875,148 @@ case 29 : break; case 30 : /*! Conditions:: indented */ +/*! Rule:: %include\b */ + + // This is an include instruction in place of an action: + // thanks to the `.+` rule immediately below we need to semi-duplicate + // the `%include` token recognition here vs. the almost-identical rule for the same + // further below. + // There's no real harm as we need to do something special in this case anyway: + // push 2 (two!) conditions. + // + // (Annecdotal: to find that we needed to place this almost-copy here to make the test grammar + // parse correctly took several hours as the debug facilities were - and are - too meager to + // quickly diagnose the problem while we hadn't. So the code got littered with debug prints + // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) + + // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... + this.pushState('trail'); + // then push the immediate need: the 'path' condition. + this.pushState('path'); + return 59; + +break; +case 31 : +/*! Conditions:: indented */ /*! Rule:: .+ */ this.begin('rules'); return 11; break; -case 31 : +case 32 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ /* ignore */ break; -case 32 : +case 33 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/\/.* */ /* ignore */ break; -case 33 : +case 34 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: {BR}+ */ /* empty */ break; -case 34 : +case 35 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \s+ */ /* empty */ break; -case 36 : +case 37 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 55; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 56; break; -case 37 : +case 38 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 55; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 56; break; -case 51 : +case 52 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: < */ - this.begin('conditions'); return 27; + this.begin('conditions'); return 28; break; -case 55 : +case 56 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g,''); return 53; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 54; break; -case 58 : +case 59 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %options\b */ - if (!yy.options) { yy.options = {}; } this.begin('options'); + if (!yy.options) { yy.options = {}; } this.begin('options'); return false; break; -case 59 : +case 60 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %s\b */ - this.begin('start_condition'); return 14; + this.begin('start_condition'); return 15; break; -case 60 : +case 61 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %x\b */ - this.begin('start_condition'); return 16; + this.begin('start_condition'); return 17; break; -case 61 : +case 62 : +/*! Conditions:: INITIAL trail code */ +/*! Rule:: %include\b */ + this.pushState('path'); return 59; +break; +case 63 : +/*! Conditions:: INITIAL rules trail code */ +/*! Rule:: %{NAME}[^\r\n]+ */ + + /* ignore unrecognized decl */ + console.warn('ignoring unsupported lexer option: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + +break; +case 64 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %% */ this.begin('rules'); return 5; break; -case 66 : +case 69 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: . */ throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ break; +case 72 : +/*! Conditions:: code */ +/*! Rule:: [^\r\n]+ */ + return 62; // the bit of CODE just before EOF... +break; +case 73 : +/*! Conditions:: path */ +/*! Rule:: [\r\n] */ + this.popState(); this.unput(yy_.yytext); +break; +case 74 : +/*! Conditions:: path */ +/*! Rule:: '[^\r\n]+' */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 60; +break; +case 75 : +/*! Conditions:: path */ +/*! Rule:: "[^\r\n]+" */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 60; +break; +case 76 : +/*! Conditions:: path */ +/*! Rule:: \s+ */ + // skip whitespace in the line +break; +case 77 : +/*! Conditions:: path */ +/*! Rule:: [^\s\r\n]+ */ + this.popState(); return 60; +break; +case 78 : +/*! Conditions:: * */ +/*! Rule:: . */ + + /* ignore unrecognized decl */ + console.warn('ignoring unsupported lexer input: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + +break; default: return this.simpleCaseActionClusters[$avoiding_name_collisions]; } @@ -2634,112 +3025,112 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 26, + 0 : 27, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 26, + 1 : 27, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 26, + 3 : 27, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 26, + 4 : 27, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 26, + 5 : 27, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 26, + 6 : 27, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 9 : 12, + 9 : 13, /*! Conditions:: conditions */ /*! Rule:: , */ - 11 : 31, + 11 : 32, /*! Conditions:: conditions */ /*! Rule:: \* */ - 12 : 30, + 12 : 31, /*! Conditions:: rules */ /*! Rule:: [a-zA-Z0-9_]+ */ - 17 : 56, + 17 : 57, /*! Conditions:: start_condition */ /*! Rule:: {NAME} */ - 22 : 18, + 22 : 19, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: {NAME} */ - 35 : 12, + 36 : 13, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \| */ - 38 : 33, + 39 : 34, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ - 39 : 52, + 40 : 53, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?: */ - 40 : 38, + 41 : 39, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?= */ - 41 : 38, + 42 : 39, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?! */ - 42 : 38, + 43 : 39, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \( */ - 43 : 36, + 44 : 37, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \) */ - 44 : 37, + 45 : 38, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \+ */ - 45 : 39, + 46 : 40, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \* */ - 46 : 30, + 47 : 31, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \? */ - 47 : 40, + 48 : 41, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \^ */ - 48 : 47, + 49 : 48, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: , */ - 49 : 31, + 50 : 32, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: <> */ - 50 : 48, + 51 : 49, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/! */ - 52 : 42, + 53 : 43, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/ */ - 53 : 41, + 54 : 42, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 54 : 53, + 55 : 54, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \$ */ - 56 : 48, + 57 : 49, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \. */ - 57 : 46, + 58 : 47, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 62 : 54, + 65 : 55, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{{NAME}\} */ - 63 : 51, + 66 : 52, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{ */ - 64 : 22, + 67 : 23, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \} */ - 65 : 24, + 68 : 25, /*! Conditions:: * */ /*! Rule:: $ */ - 67 : 8, + 70 : 8, /*! Conditions:: code */ - /*! Rule:: (.|{BR})+ */ - 68 : 9 + /*! Rule:: [^\r\n]*(\r|\n)+ */ + 71 : 62 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, @@ -2772,6 +3163,7 @@ rules: [ /^(?:\{)/, /^(?:%\{(.|(\r\n|\n|\r))*?%\})/, /^(?:%\{(.|(\r\n|\n|\r))*?%\})/, +/^(?:%include\b)/, /^(?:.+)/, /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/.*)/, @@ -2803,6 +3195,8 @@ rules: [ /^(?:%options\b)/, /^(?:%s\b)/, /^(?:%x\b)/, +/^(?:%include\b)/, +/^(?:%([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)[^\r\n]+)/, /^(?:%%)/, /^(?:\{\d+(,\s?\d+|,)?\})/, /^(?:\{([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)\})/, @@ -2810,13 +3204,24 @@ rules: [ /^(?:\})/, /^(?:.)/, /^(?:$)/, -/^(?:(.|(\r\n|\n|\r))+)/ +/^(?:[^\r\n]*(\r|\n)+)/, +/^(?:[^\r\n]+)/, +/^(?:[\r\n])/, +/^(?:'[^\r\n]+')/, +/^(?:"[^\r\n]+")/, +/^(?:\s+)/, +/^(?:[^\s\r\n]+)/, +/^(?:.)/ ], conditions: { "code": { "rules": [ - 67, - 68 + 62, + 63, + 70, + 71, + 72, + 78 ], "inclusive": false }, @@ -2826,7 +3231,8 @@ conditions: { 23, 24, 25, - 67 + 70, + 78 ], "inclusive": false }, @@ -2836,7 +3242,8 @@ conditions: { 19, 20, 21, - 67 + 70, + 78 ], "inclusive": false }, @@ -2846,7 +3253,8 @@ conditions: { 10, 11, 12, - 67 + 70, + 78 ], "inclusive": false }, @@ -2861,7 +3269,20 @@ conditions: { 6, 7, 8, - 67 + 70, + 78 + ], + "inclusive": false + }, + "path": { + "rules": [ + 70, + 73, + 74, + 75, + 76, + 77, + 78 ], "inclusive": false }, @@ -2902,12 +3323,14 @@ conditions: { 59, 60, 61, - 62, - 63, 64, 65, 66, - 67 + 67, + 68, + 69, + 70, + 78 ], "inclusive": true }, @@ -2915,7 +3338,6 @@ conditions: { "rules": [ 26, 29, - 31, 32, 33, 34, @@ -2951,7 +3373,11 @@ conditions: { 64, 65, 66, - 67 + 67, + 68, + 69, + 70, + 78 ], "inclusive": true }, @@ -2963,7 +3389,6 @@ conditions: { 16, 17, 29, - 31, 32, 33, 34, @@ -2994,19 +3419,21 @@ conditions: { 59, 60, 61, - 62, 63, 64, 65, 66, - 67 + 67, + 68, + 69, + 70, + 78 ], "inclusive": true }, "INITIAL": { "rules": [ 29, - 31, 32, 33, 34, @@ -3042,7 +3469,11 @@ conditions: { 64, 65, 66, - 67 + 67, + 68, + 69, + 70, + 78 ], "inclusive": true } diff --git a/lex.l b/lex.l index 6817f59..43ccb14 100644 --- a/lex.l +++ b/lex.l @@ -3,7 +3,7 @@ NAME [a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])? BR \r\n|\n|\r %s indented trail rules -%x code start_condition options conditions action +%x code start_condition options conditions action path %options easy_keyword_rules %options ranges @@ -32,13 +32,13 @@ BR \r\n|\n|\r [a-zA-Z0-9_]+ return 'CHARACTER_LIT'; {NAME} yy.options[yytext] = true; -{BR}+ this.begin('INITIAL'); -\s+{BR}+ this.begin('INITIAL'); +{BR}+ this.popState(); +\s+{BR}+ this.popState(); \s+ /* empty */ {NAME} return 'START_COND'; -{BR}+ this.begin('INITIAL'); -\s+{BR}+ this.begin('INITIAL'); +{BR}+ this.popState(); +\s+{BR}+ this.popState(); \s+ /* empty */ \s*{BR}+ this.begin('rules'); @@ -46,6 +46,25 @@ BR \r\n|\n|\r "{" yy.depth = 0; this.begin('action'); return '{'; "%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; "%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; +"%include" %{ + // This is an include instruction in place of an action: + // thanks to the `.+` rule immediately below we need to semi-duplicate + // the `%include` token recognition here vs. the almost-identical rule for the same + // further below. + // There's no real harm as we need to do something special in this case anyway: + // push 2 (two!) conditions. + // + // (Annecdotal: to find that we needed to place this almost-copy here to make the test grammar + // parse correctly took several hours as the debug facilities were - and are - too meager to + // quickly diagnose the problem while we hadn't. So the code got littered with debug prints + // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) + + // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... + this.pushState('trail'); + // then push the immediate need: the 'path' condition. + this.pushState('path'); + return 'INCLUDE'; + %} .+ this.begin('rules'); return 'ACTION'; "/*"(.|\n|\r)*?"*/" /* ignore */ @@ -74,12 +93,18 @@ BR \r\n|\n|\r "/" return '/'; "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR'; -"\\". yytext = yytext.replace(/^\\/g,''); return 'ESCAPE_CHAR'; +"\\". yytext = yytext.replace(/^\\/g, ''); return 'ESCAPE_CHAR'; "$" return '$'; "." return '.'; -"%options" if (!yy.options) { yy.options = {}; } this.begin('options'); +"%options" if (!yy.options) { yy.options = {}; } this.begin('options'); return false; "%s" this.begin('start_condition'); return 'START_INC'; "%x" this.begin('start_condition'); return 'START_EXC'; +"%include" this.pushState('path'); return 'INCLUDE'; +"%"{NAME}[^\r\n]+ + %{ + /* ignore unrecognized decl */ + console.warn('ignoring unsupported lexer option: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + %} "%%" this.begin('rules'); return '%%'; "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; "{"{NAME}"}" return 'NAME_BRACE'; @@ -88,7 +113,23 @@ BR \r\n|\n|\r . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ <*><> return 'EOF'; -(.|{BR})+ return 'CODE'; + +// in the trailing CODE block, only accept these `%include` macros when they appear at the start of a line +// and make sure the rest of lexer regexes account for this one so it'll match that way only: +[^\r\n]*(\r|\n)+ return 'CODE'; +[^\r\n]+ return 'CODE'; // the bit of CODE just before EOF... + + +[\r\n] this.popState(); this.unput(yytext); +"'"[^\r\n]+"'" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +\"[^\r\n]+\" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +\s+ // skip whitespace in the line +[^\s\r\n]+ this.popState(); return 'PATH'; + +<*>. %{ + /* ignore unrecognized decl */ + console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + %} %% diff --git a/lex.y b/lex.y index 6eada3a..037065b 100644 --- a/lex.y +++ b/lex.y @@ -14,7 +14,7 @@ lex $$ = { rules: $rules }; if ($definitions[0]) $$.macros = $definitions[0]; if ($definitions[1]) $$.startConditions = $definitions[1]; - if ($epilogue) $$.moduleInclude = $epilogue; + if ($epilogue && $epilogue.trim() !== '') $$.moduleInclude = $epilogue; if (yy.options) $$.options = yy.options; if (yy.actionInclude) $$.actionInclude = yy.actionInclude; delete yy.options; @@ -26,10 +26,8 @@ lex epilogue : EOF { $$ = null; } - | '%%' EOF - { $$ = null; } - | '%%' CODE EOF - { $$ = $CODE; } + | '%%' extra_lexer_module_code EOF + { $$ = $extra_lexer_module_code; } ; definitions @@ -48,6 +46,8 @@ definitions } | ACTION definitions { yy.actionInclude += $ACTION; $$ = $definitions; } + | include_macro_code definitions + { yy.actionInclude += $include_macro_code; $$ = $definitions; } | { yy.actionInclude = ''; $$ = [null, null]; } ; @@ -89,9 +89,11 @@ rule action : '{' action_body '}' - { $$ = $action_body; } + { console.log("one ACTION BODY: ", $action_body); $$ = $action_body; } | ACTION - { $$ = $ACTION; } + { console.log("one ACTION: ", $ACTION); $$ = $ACTION; } + | include_macro_code + { console.log("one INCLUDE: ", $include_macro_code); $$ = $include_macro_code; } ; action_body @@ -107,9 +109,9 @@ action_body action_comments_body : ACTION_BODY - { $$ = yytext; } + { $$ = $ACTION_BODY; } | action_comments_body ACTION_BODY - { $$ = $1 + $2; } + { $$ = $action_comments_body + $ACTION_BODY; } ; @@ -189,25 +191,61 @@ name_expansion any_group_regex : ANY_GROUP_REGEX - { $$ = yytext; } + { $$ = $ANY_GROUP_REGEX; } ; escape_char : ESCAPE_CHAR - { $$ = yytext; } + { $$ = $ESCAPE_CHAR; } ; range_regex : RANGE_REGEX - { $$ = yytext; } + { $$ = $RANGE_REGEX; } ; string : STRING_LIT - { $$ = prepareString(yytext.substr(1, yytext.length - 2)); } + { $$ = prepareString($STRING_LIT.substr(1, $STRING_LIT.length - 2)); } | CHARACTER_LIT ; +extra_lexer_module_code + : optional_module_code_chunk + { $$ = $optional_module_code_chunk; } + | optional_module_code_chunk include_macro_code extra_lexer_module_code + { $$ = $optional_module_code_chunk + $include_macro_code + $extra_lexer_module_code; } + ; + +include_macro_code + : INCLUDE PATH + { + console.log("load file: ", $PATH); + var fs = require('fs'); + var fileContent = fs.readFileSync($PATH, { encoding: 'utf-8' }); + // And no, we don't support nested '%include': + $$ = '\n// Included by Jison: ' + $PATH + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $PATH + '\n\n'; + } + | INCLUDE error + { + console.error("%include MUST be followed by a valid file path"); + } + ; + +module_code_chunk + : CODE + { $$ = $CODE; } + | module_code_chunk CODE + { $$ = $module_code_chunk + $CODE; } + ; + +optional_module_code_chunk + : module_code_chunk + { $$ = $module_code_chunk; } + | /* nil */ + { $$ = ''; } + ; + %% function encodeRE (s) { From 4a286bbc0761dbe51eca09eefbbe0565efb00205 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 20 Oct 2015 23:59:43 +0200 Subject: [PATCH 074/417] lingo fix in the comments. --- lex-parser.js | 2 +- lex.l | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index e1e7b63..05ed246 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2884,7 +2884,7 @@ case 30 : // There's no real harm as we need to do something special in this case anyway: // push 2 (two!) conditions. // - // (Annecdotal: to find that we needed to place this almost-copy here to make the test grammar + // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar // parse correctly took several hours as the debug facilities were - and are - too meager to // quickly diagnose the problem while we hadn't. So the code got littered with debug prints // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) diff --git a/lex.l b/lex.l index 43ccb14..4afa633 100644 --- a/lex.l +++ b/lex.l @@ -54,7 +54,7 @@ BR \r\n|\n|\r // There's no real harm as we need to do something special in this case anyway: // push 2 (two!) conditions. // - // (Annecdotal: to find that we needed to place this almost-copy here to make the test grammar + // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar // parse correctly took several hours as the debug facilities were - and are - too meager to // quickly diagnose the problem while we hadn't. So the code got littered with debug prints // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) From eb7bcb85775fe9a8a4a68960d6e32472021d801c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 21 Oct 2015 00:09:30 +0200 Subject: [PATCH 075/417] removed the debug code left over from the previous `%include` feature commit. --- lex-parser.js | 19 ++++++------------- lex.y | 7 +++---- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 05ed246..e418fae 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -536,6 +536,8 @@ case 2 : break; case 3 : /*! Production:: epilogue : %% extra_lexer_module_code EOF */ + case 18 : +/*! Production:: action : { action_body } */ case 27 : /*! Production:: start_conditions : < name_list > */ this.$ = $$[$0-1]; @@ -573,6 +575,10 @@ case 9 : /*! Production:: definition : START_INC names_inclusive */ case 10 : /*! Production:: definition : START_EXC names_exclusive */ + case 19 : +/*! Production:: action : ACTION */ + case 20 : +/*! Production:: action : include_macro_code */ case 22 : /*! Production:: action_body : action_comments_body */ case 25 : @@ -621,18 +627,6 @@ case 17 : /*! Production:: rule : start_conditions regex action */ this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; -case 18 : -/*! Production:: action : { action_body } */ - console.log("one ACTION BODY: ", $$[$0-1]); this.$ = $$[$0-1]; -break; -case 19 : -/*! Production:: action : ACTION */ - console.log("one ACTION: ", $$[$0]); this.$ = $$[$0]; -break; -case 20 : -/*! Production:: action : include_macro_code */ - console.log("one INCLUDE: ", $$[$0]); this.$ = $$[$0]; -break; case 21 : /*! Production:: action_body : */ case 36 : @@ -735,7 +729,6 @@ break; case 62 : /*! Production:: include_macro_code : INCLUDE PATH */ - console.log("load file: ", $$[$0]); var fs = require('fs'); var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); // And no, we don't support nested '%include': diff --git a/lex.y b/lex.y index 037065b..7bb1c66 100644 --- a/lex.y +++ b/lex.y @@ -89,11 +89,11 @@ rule action : '{' action_body '}' - { console.log("one ACTION BODY: ", $action_body); $$ = $action_body; } + { $$ = $action_body; } | ACTION - { console.log("one ACTION: ", $ACTION); $$ = $ACTION; } + { $$ = $ACTION; } | include_macro_code - { console.log("one INCLUDE: ", $include_macro_code); $$ = $include_macro_code; } + { $$ = $include_macro_code; } ; action_body @@ -220,7 +220,6 @@ extra_lexer_module_code include_macro_code : INCLUDE PATH { - console.log("load file: ", $PATH); var fs = require('fs'); var fileContent = fs.readFileSync($PATH, { encoding: 'utf-8' }); // And no, we don't support nested '%include': From 2cd429b1d7dfb87e8815970cda0c6dd444de89d2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 21 Oct 2015 00:39:19 +0200 Subject: [PATCH 076/417] updated README.md: synced with lex.l --- README.md | 224 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 135 insertions(+), 89 deletions(-) diff --git a/README.md b/README.md index 9b48c9b..0484b22 100644 --- a/README.md +++ b/README.md @@ -25,95 +25,141 @@ This will generate `lex-parser.js`. The parser can parse its own lexical grammar, shown below: - NAME [a-zA-Z_][a-zA-Z0-9_-]* - BR \r\n|\n|\r - - %s indented trail rules - %x code start_condition options conditions action - - %% - - "/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; - "//".* return 'ACTION_BODY'; - "/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; // regexp with braces or quotes (and no spaces) - \"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; - "'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; - [/"'][^{}/"']+ return 'ACTION_BODY'; - [^{}/"']+ return 'ACTION_BODY'; - "{" yy.depth++; return '{'; - "}" if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return '}'; - - {NAME} return 'NAME'; - ">" this.popState(); return '>'; - "," return ','; - "*" return '*'; - - {BR}+ /* empty */ - \s+{BR}+ /* empty */ - \s+ this.begin('indented'); - "%%" this.begin('code'); return '%%'; - [a-zA-Z0-9_]+ return 'CHARACTER_LIT'; - - {NAME} yy.options[yytext] = true; - {BR}+ this.begin('INITIAL'); - \s+{BR}+ this.begin('INITIAL'); - \s+ /* empty */ - - {NAME} return 'START_COND'; - {BR}+ this.begin('INITIAL'); - \s+{BR}+ this.begin('INITIAL'); - \s+ /* empty */ - - \s*{BR}+ this.begin('rules'); - - "{" yy.depth = 0; this.begin('action'); return '{'; - "%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; - "%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; - .+ this.begin('rules'); return 'ACTION'; - - "/*"(.|\n|\r)*?"*/" /* empty */ - "//".* /* empty */ - - {BR}+ /* ignore */ - \s+ /* ignore */ - {NAME} return 'NAME'; - \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; - "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; - "|" return '|'; - "["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; - "(?:" return 'SPECIAL_GROUP'; - "(?=" return 'SPECIAL_GROUP'; - "(?!" return 'SPECIAL_GROUP'; - "(" return '('; - ")" return ')'; - "+" return '+'; - "*" return '*'; - "?" return '?'; - "^" return '^'; - "," return ','; - "<>" return '$'; - "<" this.begin('conditions'); return '<'; - "/!" return '/!'; - "/" return '/'; - "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) - return 'ESCAPE_CHAR'; - "\\". yytext = yytext.replace(/^\\/g,''); return 'ESCAPE_CHAR'; - "$" return '$'; - "." return '.'; - "%options" yy.options = {}; this.begin('options'); - "%s" this.begin('start_condition'); return 'START_INC'; - "%x" this.begin('start_condition'); return 'START_EXC'; - "%%" this.begin('rules'); return '%%'; - "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; - "{"{NAME}"}" return 'NAME_BRACE'; - "{" return '{'; - "}" return '}'; - . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ - <*><> return 'EOF'; - - (.|{BR})+ return 'CODE'; - - %% +``` +NAME [a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])? +BR \r\n|\n|\r + +%s indented trail rules +%x code start_condition options conditions action path + +%options easy_keyword_rules +%options ranges + +%% + +"/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; +"//".* return 'ACTION_BODY'; +"/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; // regexp with braces or quotes (and no spaces) +\"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; +"'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; +[/"'][^{}/"']+ return 'ACTION_BODY'; +[^{}/"']+ return 'ACTION_BODY'; +"{" yy.depth++; return '{'; +"}" if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return '}'; + +{NAME} return 'NAME'; +">" this.popState(); return '>'; +"," return ','; +"*" return '*'; + +{BR}+ /* empty */ +\s+{BR}+ /* empty */ +\s+ this.begin('indented'); +"%%" this.begin('code'); return '%%'; +[a-zA-Z0-9_]+ return 'CHARACTER_LIT'; + +{NAME} yy.options[yytext] = true; +{BR}+ this.popState(); +\s+{BR}+ this.popState(); +\s+ /* empty */ + +{NAME} return 'START_COND'; +{BR}+ this.popState(); +\s+{BR}+ this.popState(); +\s+ /* empty */ + +\s*{BR}+ this.begin('rules'); + +"{" yy.depth = 0; this.begin('action'); return '{'; +"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; +"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; +"%include" %{ + // This is an include instruction in place of an action: + // thanks to the `.+` rule immediately below we need to semi-duplicate + // the `%include` token recognition here vs. the almost-identical rule for the same + // further below. + // There's no real harm as we need to do something special in this case anyway: + // push 2 (two!) conditions. + // + // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar + // parse correctly took several hours as the debug facilities were - and are - too meager to + // quickly diagnose the problem while we hadn't. So the code got littered with debug prints + // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) + + // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... + this.pushState('trail'); + // then push the immediate need: the 'path' condition. + this.pushState('path'); + return 'INCLUDE'; + %} +.+ this.begin('rules'); return 'ACTION'; + +"/*"(.|\n|\r)*?"*/" /* ignore */ +"//".* /* ignore */ + +{BR}+ /* empty */ +\s+ /* empty */ +{NAME} return 'NAME'; +\"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; +"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; +"|" return '|'; +"["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; +"(?:" return 'SPECIAL_GROUP'; +"(?=" return 'SPECIAL_GROUP'; +"(?!" return 'SPECIAL_GROUP'; +"(" return '('; +")" return ')'; +"+" return '+'; +"*" return '*'; +"?" return '?'; +"^" return '^'; +"," return ','; +"<>" return '$'; +"<" this.begin('conditions'); return '<'; +"/!" return '/!'; +"/" return '/'; +"\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) + return 'ESCAPE_CHAR'; +"\\". yytext = yytext.replace(/^\\/g, ''); return 'ESCAPE_CHAR'; +"$" return '$'; +"." return '.'; +"%options" if (!yy.options) { yy.options = {}; } this.begin('options'); return false; +"%s" this.begin('start_condition'); return 'START_INC'; +"%x" this.begin('start_condition'); return 'START_EXC'; +"%include" this.pushState('path'); return 'INCLUDE'; +"%"{NAME}[^\r\n]+ + %{ + /* ignore unrecognized decl */ + console.warn('ignoring unsupported lexer option: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + %} +"%%" this.begin('rules'); return '%%'; +"{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; +"{"{NAME}"}" return 'NAME_BRACE'; +"{" return '{'; +"}" return '}'; +. throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ +<*><> return 'EOF'; + + +// in the trailing CODE block, only accept these `%include` macros when they appear at the start of a line +// and make sure the rest of lexer regexes account for this one so it'll match that way only: +[^\r\n]*(\r|\n)+ return 'CODE'; +[^\r\n]+ return 'CODE'; // the bit of CODE just before EOF... + + +[\r\n] this.popState(); this.unput(yytext); +"'"[^\r\n]+"'" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +\"[^\r\n]+\" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +\s+ // skip whitespace in the line +[^\s\r\n]+ this.popState(); return 'PATH'; + +<*>. %{ + /* ignore unrecognized decl */ + console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + %} + +%% +``` ## license From 502c1e4eb1b465cf122eb403f18e647ad8e6a769 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 25 Oct 2015 13:32:41 +0100 Subject: [PATCH 077/417] protective commit until jison is made smart enough to produce this output --- lex-parser.js | 2181 +++++++++++++++++++++++++++---------------------- 1 file changed, 1192 insertions(+), 989 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index e418fae..d6118d4 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -117,6 +117,22 @@ } */ var lexParser = (function () { + 'use strict'; +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +function JisonParserError(msg, hash) { + console.log("parser error: ", msg); + this.message = msg; + this.hash = hash; + var stacktrace = (new Error()).stack; + if (stacktrace) { + this.stack = stacktrace; + } +} +JisonParserError.prototype = Object.create(Error.prototype); +JisonParserError.prototype.constructor = JisonParserError; +JisonParserError.prototype.name = 'JisonParserError'; + var __expand__ = function (k, v, o) { o = o || {}; for (var l = k.length; l--; ) { @@ -124,390 +140,438 @@ var __expand__ = function (k, v, o) { } return o; }, - $V0=[11,23,34,37,39,42,43,47,48,49,52,53,54,56,57], - $V1=[5,11,13,15,17], - $V2=[5,11,13,15,17,23,34,38], - $V3=[5,11,13,15,17,23,34,37,38,39,42,43,47,48,49,52,53,54,56,57], - $V4=[34,38], - $V5=[5,11,13,15,17,23,31,34,37,38,39,40,41,42,43,47,48,49,52,53,54,55,56,57], - $V6=[5,11,13,15,17,19], - $V7=[5,8,11,13,15,17,23,28,34,37,39,42,43,47,48,49,52,53,54,56,57,59], - $V8=[5,8,11,23,28,34,37,39,42,43,47,48,49,52,53,54,56,57], - $V9=[8,59], - $Va=[23,25]; + $V0=[6,12,14,16,18,62], + $V1=[18,25,36,39,41,44,45,49,50,51,54,55,58,60,61], + $V2=[6,12,14,16,18,25,36,40,62], + $V3=[6,12,14,16,18,25,36,39,40,41,44,45,49,50,51,54,55,58,60,61,62], + $V4=[36,40], + $V5=[6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,58,59,60,61,62], + $V6=[6,12,14,16,18,21,62], + $V7=[6,9,12,14,16,18,25,30,36,39,41,44,45,49,50,51,54,55,58,60,61,62,69], + $V8=[6,9,18,25,30,36,39,41,44,45,49,50,51,54,55,58,60,61], + $V9=[9,69], + $Va=[25,27]; var parser = { trace: function trace() { }, yy: {}, symbols_: { "error": 2, "lex": 3, - "definitions": 4, - "%%": 5, - "rules": 6, - "epilogue": 7, - "EOF": 8, - "extra_lexer_module_code": 9, - "definition": 10, - "ACTION": 11, - "include_macro_code": 12, - "NAME": 13, - "regex": 14, - "START_INC": 15, - "names_inclusive": 16, - "START_EXC": 17, - "names_exclusive": 18, - "START_COND": 19, - "rule": 20, - "start_conditions": 21, - "action": 22, - "{": 23, - "action_body": 24, - "}": 25, - "action_comments_body": 26, - "ACTION_BODY": 27, - "<": 28, - "name_list": 29, - ">": 30, - "*": 31, - ",": 32, - "regex_list": 33, - "|": 34, - "regex_concat": 35, - "regex_base": 36, - "(": 37, - ")": 38, - "SPECIAL_GROUP": 39, - "+": 40, - "?": 41, - "/": 42, - "/!": 43, - "name_expansion": 44, - "range_regex": 45, - "any_group_regex": 46, - ".": 47, - "^": 48, - "$": 49, - "string": 50, - "escape_char": 51, - "NAME_BRACE": 52, - "ANY_GROUP_REGEX": 53, - "ESCAPE_CHAR": 54, - "RANGE_REGEX": 55, - "STRING_LIT": 56, - "CHARACTER_LIT": 57, - "optional_module_code_chunk": 58, - "INCLUDE": 59, - "PATH": 60, - "module_code_chunk": 61, - "CODE": 62, + "init": 4, + "definitions": 5, + "%%": 6, + "rules": 7, + "epilogue": 8, + "EOF": 9, + "extra_lexer_module_code": 10, + "definition": 11, + "NAME": 12, + "regex": 13, + "START_INC": 14, + "names_inclusive": 15, + "START_EXC": 16, + "names_exclusive": 17, + "ACTION": 18, + "include_macro_code": 19, + "options": 20, + "START_COND": 21, + "rule": 22, + "start_conditions": 23, + "action": 24, + "{": 25, + "action_body": 26, + "}": 27, + "action_comments_body": 28, + "ACTION_BODY": 29, + "<": 30, + "name_list": 31, + ">": 32, + "*": 33, + ",": 34, + "regex_list": 35, + "|": 36, + "regex_concat": 37, + "regex_base": 38, + "(": 39, + ")": 40, + "SPECIAL_GROUP": 41, + "+": 42, + "?": 43, + "/": 44, + "/!": 45, + "name_expansion": 46, + "range_regex": 47, + "any_group_regex": 48, + ".": 49, + "^": 50, + "$": 51, + "string": 52, + "escape_char": 53, + "NAME_BRACE": 54, + "REGEX_SET_START": 55, + "REGEX_SET": 56, + "REGEX_SET_END": 57, + "ESCAPE_CHAR": 58, + "RANGE_REGEX": 59, + "STRING_LIT": 60, + "CHARACTER_LIT": 61, + "OPTIONS": 62, + "option_list": 63, + "OPTIONS_END": 64, + "option": 65, + "=": 66, + "OPTION_VALUE": 67, + "optional_module_code_chunk": 68, + "INCLUDE": 69, + "PATH": 70, + "module_code_chunk": 71, + "CODE": 72, "$accept": 0, "$end": 1 }, terminals_: { 2: "error", - 5: "%%", - 8: "EOF", - 11: "ACTION", - 13: "NAME", - 15: "START_INC", - 17: "START_EXC", - 19: "START_COND", - 23: "{", - 25: "}", - 27: "ACTION_BODY", - 28: "<", - 30: ">", - 31: "*", - 32: ",", - 34: "|", - 37: "(", - 38: ")", - 39: "SPECIAL_GROUP", - 40: "+", - 41: "?", - 42: "/", - 43: "/!", - 47: ".", - 48: "^", - 49: "$", - 52: "NAME_BRACE", - 53: "ANY_GROUP_REGEX", - 54: "ESCAPE_CHAR", - 55: "RANGE_REGEX", - 56: "STRING_LIT", - 57: "CHARACTER_LIT", - 59: "INCLUDE", - 60: "PATH", - 62: "CODE" + 6: "%%", + 9: "EOF", + 12: "NAME", + 14: "START_INC", + 16: "START_EXC", + 18: "ACTION", + 21: "START_COND", + 25: "{", + 27: "}", + 29: "ACTION_BODY", + 30: "<", + 32: ">", + 33: "*", + 34: ",", + 36: "|", + 39: "(", + 40: ")", + 41: "SPECIAL_GROUP", + 42: "+", + 43: "?", + 44: "/", + 45: "/!", + 49: ".", + 50: "^", + 51: "$", + 54: "NAME_BRACE", + 55: "REGEX_SET_START", + 56: "REGEX_SET", + 57: "REGEX_SET_END", + 58: "ESCAPE_CHAR", + 59: "RANGE_REGEX", + 60: "STRING_LIT", + 61: "CHARACTER_LIT", + 62: "OPTIONS", + 64: "OPTIONS_END", + 66: "=", + 67: "OPTION_VALUE", + 69: "INCLUDE", + 70: "PATH", + 72: "CODE" }, productions_: [ 0, [ 3, - 4 + 5 ], [ - 7, + 8, 1 ], [ - 7, + 8, 3 ], [ 4, - 2 - ], - [ - 4, - 2 + 0 ], [ - 4, + 5, 2 ], [ - 4, + 5, 0 ], [ - 10, + 11, 2 ], [ - 10, + 11, 2 ], [ - 10, + 11, 2 ], [ - 16, + 11, + 1 + ], + [ + 11, + 1 + ], + [ + 11, 1 ], [ - 16, + 15, + 1 + ], + [ + 15, 2 ], [ - 18, + 17, 1 ], [ - 18, + 17, 2 ], [ - 6, + 7, 2 ], [ - 6, + 7, 1 ], [ - 20, + 22, 3 ], [ - 22, + 24, 3 ], [ - 22, + 24, 1 ], [ - 22, + 24, 1 ], [ - 24, + 26, 0 ], [ - 24, + 26, 1 ], [ - 24, + 26, 5 ], [ - 24, + 26, 4 ], [ - 26, + 28, 1 ], [ - 26, + 28, 2 ], [ - 21, + 23, 3 ], [ - 21, + 23, 3 ], [ - 21, + 23, 0 ], [ - 29, + 31, 1 ], [ - 29, + 31, 3 ], [ - 14, + 13, 1 ], [ - 33, + 35, 3 ], [ - 33, + 35, 2 ], [ - 33, + 35, 1 ], [ - 33, + 35, 0 ], [ - 35, + 37, 2 ], [ - 35, + 37, 1 ], [ - 36, + 38, 3 ], [ - 36, + 38, 3 ], [ - 36, + 38, 2 ], [ - 36, + 38, 2 ], [ - 36, + 38, 2 ], [ - 36, + 38, 2 ], [ - 36, + 38, 2 ], [ - 36, + 38, 1 ], [ - 36, + 38, 2 ], [ - 36, + 38, 1 ], [ - 36, + 38, 1 ], [ - 36, + 38, 1 ], [ - 36, + 38, 1 ], [ - 36, + 38, 1 ], [ - 36, + 38, 1 ], [ - 44, + 46, 1 ], [ - 46, + 48, + 3 + ], + [ + 53, + 1 + ], + [ + 47, 1 ], [ - 51, + 52, 1 ], [ - 45, + 52, 1 ], [ - 50, + 20, + 3 + ], + [ + 63, + 2 + ], + [ + 63, 1 ], [ - 50, + 65, 1 ], [ - 9, + 65, + 3 + ], + [ + 65, + 3 + ], + [ + 10, 1 ], [ - 9, + 10, 3 ], [ - 12, + 19, 2 ], [ - 12, + 19, 2 ], [ - 61, + 71, 1 ], [ - 61, + 71, 2 ], [ - 58, + 68, 1 ], [ - 58, + 68, 0 ] ], @@ -517,7 +581,7 @@ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* actio var $0 = $$.length - 1; switch (yystate) { case 1 : -/*! Production:: lex : definitions %% rules epilogue */ +/*! Production:: lex : init definitions %% rules epilogue */ this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; @@ -532,136 +596,142 @@ case 1 : break; case 2 : /*! Production:: epilogue : EOF */ + case 12 : +/*! Production:: definition : options */ this.$ = null; break; case 3 : /*! Production:: epilogue : %% extra_lexer_module_code EOF */ - case 18 : + case 20 : /*! Production:: action : { action_body } */ - case 27 : + case 29 : /*! Production:: start_conditions : < name_list > */ this.$ = $$[$0-1]; break; case 4 : +/*! Production:: init : */ + yy.actionInclude = ''; +break; +case 5 : /*! Production:: definitions : definition definitions */ this.$ = $$[$0]; - if ('length' in $$[$0-1]) { - this.$[0] = this.$[0] || {}; - this.$[0][$$[$0-1][0]] = $$[$0-1][1]; - } else { - this.$[1] = this.$[1] || {}; - for (var name in $$[$0-1]) { - this.$[1][name] = $$[$0-1][name]; + if ($$[$0-1] != null) { + if ('length' in $$[$0-1]) { + this.$[0] = this.$[0] || {}; + this.$[0][$$[$0-1][0]] = $$[$0-1][1]; + } else { + this.$[1] = this.$[1] || {}; + for (var name in $$[$0-1]) { + this.$[1][name] = $$[$0-1][name]; + } } } break; -case 5 : -/*! Production:: definitions : ACTION definitions */ - case 6 : -/*! Production:: definitions : include_macro_code definitions */ - yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; -break; -case 7 : +case 6 : /*! Production:: definitions : */ - yy.actionInclude = ''; this.$ = [null, null]; + this.$ = [null, null]; break; -case 8 : +case 7 : /*! Production:: definition : NAME regex */ this.$ = [$$[$0-1], $$[$0]]; break; -case 9 : +case 8 : /*! Production:: definition : START_INC names_inclusive */ - case 10 : + case 9 : /*! Production:: definition : START_EXC names_exclusive */ - case 19 : + case 21 : /*! Production:: action : ACTION */ - case 20 : -/*! Production:: action : include_macro_code */ case 22 : +/*! Production:: action : include_macro_code */ + case 24 : /*! Production:: action_body : action_comments_body */ - case 25 : + case 27 : /*! Production:: action_comments_body : ACTION_BODY */ - case 55 : -/*! Production:: any_group_regex : ANY_GROUP_REGEX */ - case 56 : + case 58 : /*! Production:: escape_char : ESCAPE_CHAR */ - case 57 : + case 59 : /*! Production:: range_regex : RANGE_REGEX */ - case 60 : + case 68 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ - case 64 : + case 72 : /*! Production:: module_code_chunk : CODE */ - case 66 : + case 74 : /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = $$[$0]; break; -case 11 : +case 10 : +/*! Production:: definition : ACTION */ + case 11 : +/*! Production:: definition : include_macro_code */ + yy.actionInclude += $$[$0]; this.$ = null; +break; +case 13 : /*! Production:: names_inclusive : START_COND */ this.$ = {}; this.$[$$[$0]] = 0; break; -case 12 : +case 14 : /*! Production:: names_inclusive : names_inclusive START_COND */ this.$ = $$[$0-1]; this.$[$$[$0]] = 0; break; -case 13 : +case 15 : /*! Production:: names_exclusive : START_COND */ this.$ = {}; this.$[$$[$0]] = 1; break; -case 14 : +case 16 : /*! Production:: names_exclusive : names_exclusive START_COND */ this.$ = $$[$0-1]; this.$[$$[$0]] = 1; break; -case 15 : +case 17 : /*! Production:: rules : rules rule */ this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 16 : +case 18 : /*! Production:: rules : rule */ - case 30 : + case 32 : /*! Production:: name_list : NAME */ this.$ = [$$[$0]]; break; -case 17 : +case 19 : /*! Production:: rule : start_conditions regex action */ this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; -case 21 : +case 23 : /*! Production:: action_body : */ - case 36 : + case 38 : /*! Production:: regex_list : */ - case 67 : + case 75 : /*! Production:: optional_module_code_chunk : */ this.$ = ''; break; -case 23 : +case 25 : /*! Production:: action_body : action_body { action_body } action_comments_body */ this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 24 : +case 26 : /*! Production:: action_body : action_body { action_body } */ this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 26 : +case 28 : /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - case 37 : + case 39 : /*! Production:: regex_concat : regex_concat regex_base */ - case 47 : + case 49 : /*! Production:: regex_base : regex_base range_regex */ - case 65 : + case 73 : /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = $$[$0-1] + $$[$0]; break; -case 28 : +case 30 : /*! Production:: start_conditions : < * > */ this.$ = ['*']; break; -case 31 : +case 33 : /*! Production:: name_list : name_list , NAME */ this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 32 : +case 34 : /*! Production:: regex : regex_list */ this.$ = $$[$0]; @@ -670,63 +740,75 @@ case 32 : } break; -case 33 : +case 35 : /*! Production:: regex_list : regex_list | regex_concat */ this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 34 : +case 36 : /*! Production:: regex_list : regex_list | */ this.$ = $$[$0-1] + '|'; break; -case 39 : +case 41 : /*! Production:: regex_base : ( regex_list ) */ this.$ = '(' + $$[$0-1] + ')'; break; -case 40 : +case 42 : /*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 41 : +case 43 : /*! Production:: regex_base : regex_base + */ this.$ = $$[$0-1] + '+'; break; -case 42 : +case 44 : /*! Production:: regex_base : regex_base * */ this.$ = $$[$0-1] + '*'; break; -case 43 : +case 45 : /*! Production:: regex_base : regex_base ? */ this.$ = $$[$0-1] + '?'; break; -case 44 : +case 46 : /*! Production:: regex_base : / regex_base */ this.$ = '(?=' + $$[$0] + ')'; break; -case 45 : +case 47 : /*! Production:: regex_base : /! regex_base */ this.$ = '(?!' + $$[$0] + ')'; break; -case 49 : +case 51 : /*! Production:: regex_base : . */ this.$ = '.'; break; -case 50 : +case 52 : /*! Production:: regex_base : ^ */ this.$ = '^'; break; -case 51 : +case 53 : /*! Production:: regex_base : $ */ this.$ = '$'; break; -case 58 : +case 57 : +/*! Production:: any_group_regex : REGEX_SET_START REGEX_SET REGEX_SET_END */ + case 69 : +/*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ + this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 60 : /*! Production:: string : STRING_LIT */ this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; -case 61 : -/*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; +case 65 : +/*! Production:: option : NAME */ + yy.options[$$[$0]] = true; break; -case 62 : +case 66 : +/*! Production:: option : NAME = OPTION_VALUE */ + case 67 : +/*! Production:: option : NAME = NAME */ + yy.options[$$[$0-2]] = $$[$0]; +break; +case 70 : /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); @@ -735,7 +817,7 @@ case 62 : this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; break; -case 63 : +case 71 : /*! Production:: include_macro_code : INCLUDE error */ console.error("%include MUST be followed by a valid file path"); @@ -744,534 +826,497 @@ break; } }, table: [ - { - 3: 1, - 4: 2, - 5: [ + __expand__($V0, [ + 2, + 4 + ], {3:1,4:2,69:[ 2, - 7 - ], - 10: 3, - 11: [ - 1, 4 - ], - 12: 5, - 13: [ - 1, - 6 - ], - 15: [ - 1, - 7 - ], - 17: [ - 1, - 8 - ], - 59: [ - 1, - 9 ] - }, + }), { 1: [ 3 ] }, { - 5: [ - 1, - 10 - ] - }, - { - 4: 11, - 5: [ + 5: 3, + 6: [ 2, - 7 + 6 ], - 10: 3, - 11: [ + 11: 4, + 12: [ 1, - 4 + 5 ], - 12: 5, - 13: [ + 14: [ 1, 6 ], - 15: [ + 16: [ 1, 7 ], - 17: [ + 18: [ 1, 8 ], - 59: [ + 19: 9, + 20: 10, + 62: [ 1, - 9 + 12 + ], + 69: [ + 1, + 11 ] }, { - 4: 12, - 5: [ - 2, - 7 - ], - 10: 3, - 11: [ - 1, - 4 - ], - 12: 5, - 13: [ - 1, - 6 - ], - 15: [ - 1, - 7 - ], - 17: [ - 1, - 8 - ], - 59: [ + 6: [ 1, - 9 + 13 ] }, { - 4: 13, - 5: [ + 5: 14, + 6: [ 2, - 7 + 6 ], - 10: 3, - 11: [ + 11: 4, + 12: [ 1, - 4 + 5 ], - 12: 5, - 13: [ + 14: [ 1, 6 ], - 15: [ + 16: [ 1, 7 ], - 17: [ + 18: [ 1, 8 ], - 59: [ + 19: 9, + 20: 10, + 62: [ 1, - 9 + 12 + ], + 69: [ + 1, + 11 ] }, - __expand__([5,11,13,15,17,34], [ + __expand__([6,12,14,16,18,36,62], [ 2, - 36 - ], {14:14,33:15,35:16,36:17,44:22,46:23,50:27,51:28,37:[ - 1, - 18 - ],39:[ + 38 + ], {13:15,35:16,37:17,38:18,46:23,48:24,52:28,53:29,39:[ 1, 19 - ],42:[ + ],41:[ 1, 20 - ],43:[ + ],44:[ 1, 21 - ],47:[ + ],45:[ 1, - 24 - ],48:[ + 22 + ],49:[ 1, 25 - ],49:[ + ],50:[ 1, 26 - ],52:[ - 1, - 29 - ],53:[ + ],51:[ 1, - 30 + 27 ],54:[ 1, - 33 - ],56:[ + 30 + ],55:[ 1, 31 - ],57:[ + ],58:[ + 1, + 34 + ],60:[ 1, 32 - ],59:[ + ],61:[ + 1, + 33 + ],69:[ 2, - 36 + 38 ] }), { - 16: 34, - 19: [ - 1, - 35 - ] - }, - { - 18: 36, - 19: [ + 15: 35, + 21: [ 1, - 37 + 36 ] }, { - 2: [ - 1, - 39 - ], - 60: [ + 17: 37, + 21: [ 1, 38 ] }, __expand__($V0, [ 2, - 29 - ], {6:40,20:41,21:42,28:[ - 1, - 43 - ],59:[ + 10 + ], {69:[ 2, - 29 + 10 ] }), - { - 5: [ + __expand__($V0, [ 2, - 4 - ] + 11 + ], {69:[ + 2, + 11 + ] + }), + __expand__($V0, [ + 2, + 12 + ], {69:[ + 2, + 12 + ] + }), + { + 2: [ + 1, + 40 + ], + 70: [ + 1, + 39 + ] }, { - 5: [ + 12: [ + 1, + 43 + ], + 63: 41, + 65: 42 + }, + __expand__($V1, [ 2, - 5 + 31 + ], {7:44,22:45,23:46,30:[ + 1, + 47 + ],69:[ + 2, + 31 ] - }, + }), { - 5: [ + 6: [ 2, - 6 + 5 ] }, - __expand__($V1, [ + __expand__($V0, [ 2, - 8 - ], {59:[ + 7 + ], {69:[ 2, - 8 + 7 ] }), - __expand__([5,11,13,15,17,23], [ + __expand__([6,12,14,16,18,25,62], [ 2, - 32 - ], {34:[ + 34 + ], {36:[ 1, - 44 - ],59:[ + 48 + ],69:[ 2, - 32 + 34 ] }), __expand__($V2, [ 2, - 35 - ], {44:22,46:23,50:27,51:28,36:45,37:[ - 1, - 18 - ],39:[ + 37 + ], {46:23,48:24,52:28,53:29,38:49,39:[ 1, 19 - ],42:[ + ],41:[ 1, 20 - ],43:[ + ],44:[ 1, 21 - ],47:[ + ],45:[ 1, - 24 - ],48:[ + 22 + ],49:[ 1, 25 - ],49:[ + ],50:[ 1, 26 - ],52:[ - 1, - 29 - ],53:[ + ],51:[ 1, - 30 + 27 ],54:[ 1, - 33 - ],56:[ + 30 + ],55:[ 1, 31 - ],57:[ + ],58:[ + 1, + 34 + ],60:[ 1, 32 - ],59:[ + ],61:[ + 1, + 33 + ],69:[ 2, - 35 + 37 ] }), __expand__($V3, [ 2, - 38 - ], {45:49,31:[ - 1, - 47 - ],40:[ - 1, - 46 - ],41:[ + 40 + ], {47:53,33:[ 1, - 48 - ],55:[ + 51 + ],42:[ 1, 50 + ],43:[ + 1, + 52 ],59:[ + 1, + 54 + ],69:[ 2, - 38 + 40 ] }), __expand__($V4, [ 2, - 36 - ], {35:16,36:17,44:22,46:23,50:27,51:28,33:51,37:[ - 1, - 18 - ],39:[ + 38 + ], {37:17,38:18,46:23,48:24,52:28,53:29,35:55,39:[ 1, 19 - ],42:[ + ],41:[ 1, 20 - ],43:[ + ],44:[ 1, 21 - ],47:[ + ],45:[ 1, - 24 - ],48:[ + 22 + ],49:[ 1, 25 - ],49:[ + ],50:[ 1, 26 - ],52:[ - 1, - 29 - ],53:[ + ],51:[ 1, - 30 + 27 ],54:[ 1, - 33 - ],56:[ + 30 + ],55:[ 1, 31 - ],57:[ + ],58:[ + 1, + 34 + ],60:[ 1, 32 + ],61:[ + 1, + 33 ] }), __expand__($V4, [ 2, - 36 - ], {35:16,36:17,44:22,46:23,50:27,51:28,33:52,37:[ - 1, - 18 - ],39:[ + 38 + ], {37:17,38:18,46:23,48:24,52:28,53:29,35:56,39:[ 1, 19 - ],42:[ + ],41:[ 1, 20 - ],43:[ + ],44:[ 1, 21 - ],47:[ + ],45:[ 1, - 24 - ],48:[ + 22 + ],49:[ 1, 25 - ],49:[ + ],50:[ 1, 26 - ],52:[ + ],51:[ 1, - 29 - ],53:[ - 1, - 30 + 27 ],54:[ 1, - 33 - ],56:[ + 30 + ],55:[ 1, 31 - ],57:[ + ],58:[ + 1, + 34 + ],60:[ 1, 32 + ],61:[ + 1, + 33 ] }), { - 36: 53, - 37: [ - 1, - 18 - ], + 38: 57, 39: [ 1, 19 ], - 42: [ + 41: [ 1, 20 ], - 43: [ + 44: [ 1, 21 ], - 44: 22, - 46: 23, - 47: [ + 45: [ 1, - 24 + 22 ], - 48: [ + 46: 23, + 48: 24, + 49: [ 1, 25 ], - 49: [ + 50: [ 1, 26 ], - 50: 27, - 51: 28, - 52: [ + 51: [ 1, - 29 + 27 ], - 53: [ + 52: 28, + 53: 29, + 54: [ 1, 30 ], - 54: [ + 55: [ 1, - 33 + 31 ], - 56: [ + 58: [ 1, - 31 + 34 ], - 57: [ + 60: [ 1, 32 + ], + 61: [ + 1, + 33 ] }, { - 36: 54, - 37: [ - 1, - 18 - ], + 38: 58, 39: [ 1, 19 ], - 42: [ + 41: [ 1, 20 ], - 43: [ + 44: [ 1, 21 ], - 44: 22, - 46: 23, - 47: [ + 45: [ 1, - 24 + 22 ], - 48: [ + 46: 23, + 48: 24, + 49: [ 1, 25 ], - 49: [ + 50: [ 1, 26 ], - 50: 27, - 51: 28, - 52: [ + 51: [ 1, - 29 + 27 ], - 53: [ + 52: 28, + 53: 29, + 54: [ 1, 30 ], - 54: [ + 55: [ 1, - 33 + 31 ], - 56: [ + 58: [ 1, - 31 + 34 ], - 57: [ + 60: [ 1, 32 + ], + 61: [ + 1, + 33 ] }, - __expand__($V5, [ - 2, - 46 - ], {59:[ - 2, - 46 - ] - }), __expand__($V5, [ 2, 48 - ], {59:[ + ], {69:[ 2, 48 ] }), - __expand__($V5, [ - 2, - 49 - ], {59:[ - 2, - 49 - ] - }), __expand__($V5, [ 2, 50 - ], {59:[ + ], {69:[ 2, 50 ] @@ -1279,7 +1324,7 @@ table: [ __expand__($V5, [ 2, 51 - ], {59:[ + ], {69:[ 2, 51 ] @@ -1287,7 +1332,7 @@ table: [ __expand__($V5, [ 2, 52 - ], {59:[ + ], {69:[ 2, 52 ] @@ -1295,7 +1340,7 @@ table: [ __expand__($V5, [ 2, 53 - ], {59:[ + ], {69:[ 2, 53 ] @@ -1303,7 +1348,7 @@ table: [ __expand__($V5, [ 2, 54 - ], {59:[ + ], {69:[ 2, 54 ] @@ -1311,349 +1356,419 @@ table: [ __expand__($V5, [ 2, 55 - ], {59:[ + ], {69:[ 2, 55 ] }), __expand__($V5, [ 2, - 58 - ], {59:[ + 56 + ], {69:[ 2, - 58 + 56 ] }), + { + 56: [ + 1, + 59 + ] + }, __expand__($V5, [ 2, - 59 - ], {59:[ + 60 + ], {69:[ 2, - 59 + 60 ] }), __expand__($V5, [ 2, - 56 - ], {59:[ + 61 + ], {69:[ 2, - 56 + 61 ] }), - __expand__($V1, [ + __expand__($V5, [ 2, - 9 - ], {19:[ + 58 + ], {69:[ + 2, + 58 + ] + }), + __expand__($V0, [ + 2, + 8 + ], {21:[ 1, - 55 - ],59:[ + 60 + ],69:[ 2, - 9 + 8 ] }), __expand__($V6, [ 2, - 11 - ], {59:[ + 13 + ], {69:[ 2, - 11 + 13 ] }), - __expand__($V1, [ + __expand__($V0, [ 2, - 10 - ], {19:[ + 9 + ], {21:[ 1, - 56 - ],59:[ + 61 + ],69:[ 2, - 10 + 9 ] }), __expand__($V6, [ 2, - 13 - ], {59:[ + 15 + ], {69:[ 2, - 13 + 15 ] }), __expand__($V7, [ 2, - 62 - ], {62:[ + 70 + ], {72:[ 2, - 62 + 70 ] }), __expand__($V7, [ 2, - 63 - ], {62:[ + 71 + ], {72:[ 2, - 63 + 71 ] }), - __expand__($V0, [ - 2, - 29 - ], {21:42,7:57,20:58,5:[ + { + 64: [ 1, - 60 - ],8:[ - 1, - 59 - ],28:[ + 62 + ] + }, + { + 12: [ 1, 43 - ],59:[ + ], + 63: 63, + 64: [ 2, - 29 + 64 + ], + 65: 42 + }, + __expand__([12,64], [ + 2, + 65 + ], {66:[ + 1, + 64 ] }), - __expand__($V8, [ + __expand__($V1, [ 2, - 16 - ], {59:[ + 31 + ], {23:46,8:65,22:66,6:[ + 1, + 68 + ],9:[ + 1, + 67 + ],30:[ + 1, + 47 + ],69:[ 2, - 16 + 31 ] }), - __expand__([11,23,34], [ + __expand__($V8, [ + 2, + 18 + ], {69:[ 2, - 36 - ], {33:15,35:16,36:17,44:22,46:23,50:27,51:28,14:61,37:[ - 1, 18 - ],39:[ + ] + }), + __expand__([18,25,36], [ + 2, + 38 + ], {35:16,37:17,38:18,46:23,48:24,52:28,53:29,13:69,39:[ 1, 19 - ],42:[ + ],41:[ 1, 20 - ],43:[ + ],44:[ 1, 21 - ],47:[ + ],45:[ 1, - 24 - ],48:[ + 22 + ],49:[ 1, 25 - ],49:[ + ],50:[ 1, 26 - ],52:[ + ],51:[ 1, - 29 - ],53:[ - 1, - 30 + 27 ],54:[ 1, - 33 - ],56:[ + 30 + ],55:[ 1, 31 - ],57:[ + ],58:[ + 1, + 34 + ],60:[ 1, 32 - ],59:[ + ],61:[ + 1, + 33 + ],69:[ 2, - 36 + 38 ] }), { - 13: [ + 12: [ 1, - 64 + 72 ], - 29: 62, - 31: [ + 31: 70, + 33: [ 1, - 63 + 71 ] }, __expand__($V2, [ 2, - 34 - ], {36:17,44:22,46:23,50:27,51:28,35:65,37:[ - 1, - 18 - ],39:[ + 36 + ], {38:18,46:23,48:24,52:28,53:29,37:73,39:[ 1, 19 - ],42:[ + ],41:[ 1, 20 - ],43:[ + ],44:[ 1, 21 - ],47:[ + ],45:[ 1, - 24 - ],48:[ + 22 + ],49:[ 1, 25 - ],49:[ + ],50:[ 1, 26 - ],52:[ - 1, - 29 - ],53:[ + ],51:[ 1, - 30 + 27 ],54:[ 1, - 33 - ],56:[ + 30 + ],55:[ 1, 31 - ],57:[ + ],58:[ + 1, + 34 + ],60:[ 1, 32 - ],59:[ + ],61:[ + 1, + 33 + ],69:[ 2, - 34 + 36 ] }), __expand__($V3, [ 2, - 37 - ], {45:49,31:[ - 1, - 47 - ],40:[ - 1, - 46 - ],41:[ + 39 + ], {47:53,33:[ 1, - 48 - ],55:[ + 51 + ],42:[ 1, 50 + ],43:[ + 1, + 52 ],59:[ + 1, + 54 + ],69:[ 2, - 37 + 39 ] }), __expand__($V5, [ 2, - 41 - ], {59:[ + 43 + ], {69:[ 2, - 41 + 43 ] }), __expand__($V5, [ 2, - 42 - ], {59:[ + 44 + ], {69:[ 2, - 42 + 44 ] }), __expand__($V5, [ 2, - 43 - ], {59:[ + 45 + ], {69:[ 2, - 43 + 45 ] }), __expand__($V5, [ 2, - 47 - ], {59:[ + 49 + ], {69:[ 2, - 47 + 49 ] }), __expand__($V5, [ 2, - 57 - ], {59:[ + 59 + ], {69:[ 2, - 57 + 59 ] }), { - 34: [ + 36: [ 1, - 44 + 48 ], - 38: [ + 40: [ 1, - 66 + 74 ] }, { - 34: [ + 36: [ 1, - 44 + 48 ], - 38: [ + 40: [ 1, - 67 + 75 ] }, __expand__($V3, [ 2, - 44 - ], {45:49,31:[ - 1, - 47 - ],40:[ - 1, 46 - ],41:[ + ], {47:53,33:[ 1, - 48 - ],55:[ + 51 + ],42:[ 1, 50 + ],43:[ + 1, + 52 ],59:[ + 1, + 54 + ],69:[ 2, - 44 + 46 ] }), __expand__($V3, [ 2, - 45 - ], {45:49,31:[ - 1, 47 - ],40:[ + ], {47:53,33:[ 1, - 46 - ],41:[ - 1, - 48 - ],55:[ + 51 + ],42:[ 1, 50 + ],43:[ + 1, + 52 ],59:[ + 1, + 54 + ],69:[ 2, - 45 + 47 ] }), + { + 57: [ + 1, + 76 + ] + }, __expand__($V6, [ 2, - 12 - ], {59:[ + 14 + ], {69:[ 2, - 12 + 14 ] }), __expand__($V6, [ 2, - 14 - ], {59:[ + 16 + ], {69:[ 2, - 14 + 16 ] }), + __expand__($V0, [ + 2, + 62 + ], {69:[ + 2, + 62 + ] + }), + { + 64: [ + 2, + 63 + ] + }, + { + 12: [ + 1, + 78 + ], + 67: [ + 1, + 77 + ] + }, { 1: [ 2, @@ -1662,10 +1777,10 @@ table: [ }, __expand__($V8, [ 2, - 15 - ], {59:[ + 17 + ], {69:[ 2, - 15 + 17 ] }), { @@ -1676,199 +1791,227 @@ table: [ }, __expand__($V9, [ 2, - 67 - ], {9:68,58:69,61:70,62:[ + 75 + ], {10:79,68:80,71:81,72:[ 1, - 71 + 82 ] }), { - 11: [ + 18: [ 1, - 74 + 85 ], - 12: 75, - 22: 72, - 23: [ + 19: 86, + 24: 83, + 25: [ 1, - 73 + 84 ], - 59: [ + 69: [ 1, - 9 + 11 ] }, { - 30: [ + 32: [ 1, - 76 + 87 ], - 32: [ + 34: [ 1, - 77 + 88 ] }, { - 30: [ + 32: [ 1, - 78 + 89 ] }, { - 30: [ + 32: [ 2, - 30 + 32 ], - 32: [ + 34: [ 2, - 30 + 32 ] }, __expand__($V2, [ 2, - 33 - ], {44:22,46:23,50:27,51:28,36:45,37:[ - 1, - 18 - ],39:[ + 35 + ], {46:23,48:24,52:28,53:29,38:49,39:[ 1, 19 - ],42:[ + ],41:[ 1, 20 - ],43:[ + ],44:[ 1, 21 - ],47:[ + ],45:[ 1, - 24 - ],48:[ + 22 + ],49:[ 1, 25 - ],49:[ + ],50:[ 1, 26 - ],52:[ + ],51:[ 1, - 29 - ],53:[ - 1, - 30 + 27 ],54:[ 1, - 33 - ],56:[ + 30 + ],55:[ 1, 31 - ],57:[ + ],58:[ + 1, + 34 + ],60:[ 1, 32 - ],59:[ - 2, + ],61:[ + 1, 33 + ],69:[ + 2, + 35 ] }), __expand__($V5, [ 2, - 39 - ], {59:[ + 41 + ], {69:[ 2, - 39 + 41 ] }), __expand__($V5, [ 2, - 40 - ], {59:[ + 42 + ], {69:[ 2, - 40 + 42 + ] + }), + __expand__($V5, [ + 2, + 57 + ], {69:[ + 2, + 57 ] }), { - 8: [ + 12: [ + 2, + 66 + ], + 64: [ + 2, + 66 + ] + }, + { + 12: [ + 2, + 67 + ], + 64: [ + 2, + 67 + ] + }, + { + 9: [ 1, - 79 + 90 ] }, { - 8: [ + 9: [ 2, - 60 + 68 ], - 12: 80, - 59: [ + 19: 91, + 69: [ 1, - 9 + 11 ] }, __expand__($V9, [ 2, - 66 - ], {62:[ + 74 + ], {72:[ 1, - 81 + 92 ] }), __expand__($V9, [ 2, - 64 - ], {62:[ + 72 + ], {72:[ 2, - 64 + 72 ] }), __expand__($V8, [ 2, - 17 - ], {59:[ + 19 + ], {69:[ 2, - 17 + 19 ] }), __expand__($Va, [ 2, - 21 - ], {24:82,26:83,27:[ + 23 + ], {26:93,28:94,29:[ 1, - 84 + 95 ] }), __expand__($V8, [ 2, - 19 - ], {59:[ + 21 + ], {69:[ 2, - 19 + 21 ] }), __expand__($V8, [ 2, - 20 - ], {59:[ + 22 + ], {69:[ 2, - 20 + 22 ] }), - __expand__($V0, [ + __expand__($V1, [ 2, - 27 - ], {59:[ + 29 + ], {69:[ 2, - 27 + 29 ] }), { - 13: [ + 12: [ 1, - 85 + 96 ] }, - __expand__($V0, [ + __expand__($V1, [ 2, - 28 - ], {59:[ + 30 + ], {69:[ 2, - 28 + 30 ] }), { @@ -1879,154 +2022,144 @@ table: [ }, __expand__($V9, [ 2, - 67 - ], {58:69,61:70,9:86,62:[ + 75 + ], {68:80,71:81,10:97,72:[ 1, - 71 + 82 ] }), __expand__($V9, [ 2, - 65 - ], {62:[ + 73 + ], {72:[ 2, - 65 + 73 ] }), { - 23: [ + 25: [ 1, - 88 + 99 ], - 25: [ + 27: [ 1, - 87 + 98 ] }, __expand__($Va, [ 2, - 22 - ], {27:[ + 24 + ], {29:[ 1, - 89 + 100 ] }), __expand__($Va, [ 2, - 25 - ], {27:[ + 27 + ], {29:[ 2, - 25 + 27 ] }), { - 30: [ + 32: [ 2, - 31 + 33 ], - 32: [ + 34: [ 2, - 31 + 33 ] }, { - 8: [ + 9: [ 2, - 61 + 69 ] }, __expand__($V8, [ 2, - 18 - ], {59:[ + 20 + ], {69:[ 2, - 18 + 20 ] }), __expand__($Va, [ 2, - 21 - ], {26:83,24:90,27:[ + 23 + ], {28:94,26:101,29:[ 1, - 84 + 95 ] }), __expand__($Va, [ 2, - 26 - ], {27:[ + 28 + ], {29:[ 2, - 26 + 28 ] }), { - 23: [ + 25: [ 1, - 88 + 99 ], - 25: [ + 27: [ 1, - 91 + 102 ] }, __expand__($Va, [ 2, - 24 - ], {26:92,27:[ + 26 + ], {28:103,29:[ 1, - 84 + 95 ] }), __expand__($Va, [ 2, - 23 - ], {27:[ + 25 + ], {29:[ 1, - 89 + 100 ] }) ], defaultActions: { - 11: [ - 2, - 4 - ], - 12: [ + 14: [ 2, 5 ], - 13: [ + 63: [ 2, - 6 + 63 ], - 57: [ + 65: [ 2, 1 ], - 59: [ + 67: [ 2, 2 ], - 79: [ + 90: [ 2, 3 ], - 86: [ + 97: [ 2, - 61 + 69 ] }, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { - function _parseError (msg, hash) { - this.message = msg; - this.hash = hash; - } - _parseError.prototype = new Error(); - - throw new _parseError(str, hash); + throw new JisonParserError(str, hash); } }, parse: function parse(input) { @@ -2373,6 +2506,21 @@ function prepareString (s) { /* generated by jison-lex 0.3.4 */ var lexer = (function () { +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +function JisonLexerError(msg, hash) { + console.log("lexer error: ", msg); + this.message = msg; + this.hash = hash; + var stacktrace = (new Error()).stack; + if (stacktrace) { + this.stack = stacktrace; + } +} +JisonLexerError.prototype = Object.create(Error.prototype); +JisonLexerError.prototype.constructor = JisonLexerError; +JisonLexerError.prototype.name = 'JisonLexerError'; + var lexer = ({ EOF:1, @@ -2383,7 +2531,7 @@ parseError:function parseError(str, hash) { if (this.yy.parser) { return this.yy.parser.parseError(str, hash) || this.ERROR; } else { - throw new Error(str); + throw new JisonLexerError(str); } }, @@ -2774,22 +2922,22 @@ switch($avoiding_name_collisions) { case 2 : /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 27; // regexp with braces or quotes (and no spaces) + return 29; // regexp with braces or quotes (and no spaces) break; case 7 : /*! Conditions:: action */ /*! Rule:: \{ */ - yy.depth++; return 23; + yy.depth++; return 25; break; case 8 : /*! Conditions:: action */ /*! Rule:: \} */ - if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 25; + if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 27; break; case 10 : /*! Conditions:: conditions */ /*! Rule:: > */ - this.popState(); return 30; + this.popState(); return 32; break; case 13 : /*! Conditions:: rules */ @@ -2809,64 +2957,69 @@ break; case 16 : /*! Conditions:: rules */ /*! Rule:: %% */ - this.begin('code'); return 5; + this.begin('code'); return 6; break; -case 18 : +case 20 : /*! Conditions:: options */ -/*! Rule:: {NAME} */ - yy.options[yy_.yytext] = true; +/*! Rule:: "(\\\\|\\"|[^"])*" */ + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 67; break; -case 19 : +case 21 : +/*! Conditions:: options */ +/*! Rule:: '(\\\\|\\'|[^'])*' */ + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 67; +break; +case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); + this.popState(); return 64; break; -case 20 : +case 24 : /*! Conditions:: options */ /*! Rule:: \s+{BR}+ */ - this.popState(); + this.popState(); return 64; break; -case 21 : +case 25 : /*! Conditions:: options */ /*! Rule:: \s+ */ /* empty */ break; -case 23 : +case 27 : /*! Conditions:: start_condition */ /*! Rule:: {BR}+ */ this.popState(); break; -case 24 : +case 28 : /*! Conditions:: start_condition */ /*! Rule:: \s+{BR}+ */ this.popState(); break; -case 25 : +case 29 : /*! Conditions:: start_condition */ /*! Rule:: \s+ */ /* empty */ break; -case 26 : +case 30 : /*! Conditions:: trail */ /*! Rule:: \s*{BR}+ */ this.begin('rules'); break; -case 27 : +case 31 : /*! Conditions:: indented */ /*! Rule:: \{ */ - yy.depth = 0; this.begin('action'); return 23; + yy.depth = 0; this.begin('action'); return 25; break; -case 28 : +case 32 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; break; -case 29 : +case 33 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 11; + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; break; -case 30 : +case 34 : /*! Conditions:: indented */ /*! Rule:: %include\b */ @@ -2886,75 +3039,95 @@ case 30 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 59; + return 69; break; -case 31 : +case 35 : /*! Conditions:: indented */ /*! Rule:: .+ */ - this.begin('rules'); return 11; + this.begin('rules'); return 18; break; -case 32 : +case 36 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ /* ignore */ break; -case 33 : +case 37 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/\/.* */ /* ignore */ break; -case 34 : +case 38 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: {BR}+ */ /* empty */ break; -case 35 : +case 39 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \s+ */ /* empty */ break; -case 37 : +case 41 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 56; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 60; break; -case 38 : +case 42 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 56; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 60; break; -case 52 : +case 43 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \[ */ + this.pushState('set'); return 55; +break; +case 45 : +/*! Conditions:: set */ +/*! Rule:: \] */ + this.popState('set'); return 57; +break; +case 58 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: < */ - this.begin('conditions'); return 28; + this.begin('conditions'); return 30; +break; +case 59 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/! */ + return 45; // treated as `(?!atom)` +break; +case 60 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/ */ + return 44; // treated as `(?=atom)` break; -case 56 : +case 62 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 54; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 58; break; -case 59 : +case 65 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %options\b */ - if (!yy.options) { yy.options = {}; } this.begin('options'); return false; + if (!yy.options) { yy.options = {}; } this.begin('options'); return 62; break; -case 60 : +case 66 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %s\b */ - this.begin('start_condition'); return 15; + this.begin('start_condition'); return 14; break; -case 61 : +case 67 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %x\b */ - this.begin('start_condition'); return 17; + this.begin('start_condition'); return 16; break; -case 62 : +case 68 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 59; + this.pushState('path'); return 69; break; -case 63 : +case 69 : /*! Conditions:: INITIAL rules trail code */ /*! Rule:: %{NAME}[^\r\n]+ */ @@ -2962,47 +3135,47 @@ case 63 : console.warn('ignoring unsupported lexer option: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); break; -case 64 : +case 70 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %% */ - this.begin('rules'); return 5; + this.begin('rules'); return 6; break; -case 69 : +case 76 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: . */ throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ break; -case 72 : +case 79 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 62; // the bit of CODE just before EOF... + return 72; // the bit of CODE just before EOF... break; -case 73 : +case 80 : /*! Conditions:: path */ /*! Rule:: [\r\n] */ this.popState(); this.unput(yy_.yytext); break; -case 74 : +case 81 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 60; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 70; break; -case 75 : +case 82 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 60; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 70; break; -case 76 : +case 83 : /*! Conditions:: path */ /*! Rule:: \s+ */ // skip whitespace in the line break; -case 77 : +case 84 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 60; + this.popState(); return 70; break; -case 78 : +case 85 : /*! Conditions:: * */ /*! Rule:: . */ @@ -3018,112 +3191,118 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 27, + 0 : 29, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 27, + 1 : 29, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 27, + 3 : 29, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 27, + 4 : 29, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 27, + 5 : 29, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 27, + 6 : 29, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 9 : 13, + 9 : 12, /*! Conditions:: conditions */ /*! Rule:: , */ - 11 : 32, + 11 : 34, /*! Conditions:: conditions */ /*! Rule:: \* */ - 12 : 31, + 12 : 33, /*! Conditions:: rules */ /*! Rule:: [a-zA-Z0-9_]+ */ - 17 : 57, + 17 : 61, + /*! Conditions:: options */ + /*! Rule:: {NAME} */ + 18 : 12, + /*! Conditions:: options */ + /*! Rule:: = */ + 19 : 66, + /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ + 22 : 67, /*! Conditions:: start_condition */ /*! Rule:: {NAME} */ - 22 : 19, + 26 : 21, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: {NAME} */ - 36 : 13, + 40 : 12, + /*! Conditions:: set */ + /*! Rule:: (\\\\|\\\]|[^\]])+ */ + 44 : 56, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \| */ - 39 : 34, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \[(\\\\|\\\]|[^\]])*\] */ - 40 : 53, + 46 : 36, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?: */ - 41 : 39, + 47 : 41, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?= */ - 42 : 39, + 48 : 41, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?! */ - 43 : 39, + 49 : 41, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \( */ - 44 : 37, + 50 : 39, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \) */ - 45 : 38, + 51 : 40, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \+ */ - 46 : 40, + 52 : 42, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \* */ - 47 : 31, + 53 : 33, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \? */ - 48 : 41, + 54 : 43, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \^ */ - 49 : 48, + 55 : 50, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: , */ - 50 : 32, + 56 : 34, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: <> */ - 51 : 49, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \/! */ - 53 : 43, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \/ */ - 54 : 42, + 57 : 51, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 55 : 54, + 61 : 58, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \$ */ - 57 : 49, + 63 : 51, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \. */ - 58 : 47, + 64 : 49, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 65 : 55, + 71 : 59, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{{NAME}\} */ - 66 : 52, + 72 : 54, + /*! Conditions:: set options */ + /*! Rule:: \{{NAME}\} */ + 73 : 54, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{ */ - 67 : 23, + 74 : 25, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \} */ - 68 : 25, + 75 : 27, /*! Conditions:: * */ /*! Rule:: $ */ - 70 : 8, + 77 : 9, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 71 : 62 + 78 : 72 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, @@ -3145,6 +3324,10 @@ rules: [ /^(?:%%)/, /^(?:[a-zA-Z0-9_]+)/, /^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, +/^(?:=)/, +/^(?:"(\\\\|\\"|[^"])*")/, +/^(?:'(\\\\|\\'|[^'])*')/, +/^(?:[^\s\r\n]+)/, /^(?:(\r\n|\n|\r)+)/, /^(?:\s+(\r\n|\n|\r)+)/, /^(?:\s+)/, @@ -3165,8 +3348,10 @@ rules: [ /^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, +/^(?:\[)/, +/^(?:(\\\\|\\\]|[^\]])+)/, +/^(?:\])/, /^(?:\|)/, -/^(?:\[(\\\\|\\\]|[^\]])*\])/, /^(?:\(\?:)/, /^(?:\(\?=)/, /^(?:\(\?!)/, @@ -3193,6 +3378,7 @@ rules: [ /^(?:%%)/, /^(?:\{\d+(,\s?\d+|,)?\})/, /^(?:\{([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)\})/, +/^(?:\{([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)\})/, /^(?:\{)/, /^(?:\})/, /^(?:.)/, @@ -3209,23 +3395,23 @@ rules: [ conditions: { "code": { "rules": [ - 62, - 63, - 70, - 71, - 72, - 78 + 68, + 69, + 77, + 78, + 79, + 85 ], "inclusive": false }, "start_condition": { "rules": [ - 22, - 23, - 24, - 25, - 70, - 78 + 26, + 27, + 28, + 29, + 77, + 85 ], "inclusive": false }, @@ -3235,8 +3421,13 @@ conditions: { 19, 20, 21, - 70, - 78 + 22, + 23, + 24, + 25, + 73, + 77, + 85 ], "inclusive": false }, @@ -3246,8 +3437,8 @@ conditions: { 10, 11, 12, - 70, - 78 + 77, + 85 ], "inclusive": false }, @@ -3262,29 +3453,35 @@ conditions: { 6, 7, 8, - 70, - 78 + 77, + 85 ], "inclusive": false }, "path": { "rules": [ - 70, + 77, + 80, + 81, + 82, + 83, + 84, + 85 + ], + "inclusive": false + }, + "set": { + "rules": [ + 44, + 45, 73, - 74, - 75, - 76, 77, - 78 + 85 ], "inclusive": false }, "indented": { "rules": [ - 27, - 28, - 29, - 30, 31, 32, 33, @@ -3298,8 +3495,6 @@ conditions: { 41, 42, 43, - 44, - 45, 46, 47, 48, @@ -3316,25 +3511,27 @@ conditions: { 59, 60, 61, + 62, + 63, 64, 65, 66, 67, - 68, - 69, 70, - 78 + 71, + 72, + 74, + 75, + 76, + 77, + 85 ], "inclusive": true }, "trail": { "rules": [ - 26, - 29, - 32, + 30, 33, - 34, - 35, 36, 37, 38, @@ -3343,8 +3540,6 @@ conditions: { 41, 42, 43, - 44, - 45, 46, 47, 48, @@ -3370,7 +3565,13 @@ conditions: { 68, 69, 70, - 78 + 71, + 72, + 74, + 75, + 76, + 77, + 85 ], "inclusive": true }, @@ -3381,11 +3582,7 @@ conditions: { 15, 16, 17, - 29, - 32, 33, - 34, - 35, 36, 37, 38, @@ -3394,8 +3591,6 @@ conditions: { 41, 42, 43, - 44, - 45, 46, 47, 48, @@ -3412,25 +3607,27 @@ conditions: { 59, 60, 61, + 62, 63, 64, 65, 66, 67, - 68, 69, 70, - 78 + 71, + 72, + 74, + 75, + 76, + 77, + 85 ], "inclusive": true }, "INITIAL": { "rules": [ - 29, - 32, 33, - 34, - 35, 36, 37, 38, @@ -3439,8 +3636,6 @@ conditions: { 41, 42, 43, - 44, - 45, 46, 47, 48, @@ -3466,15 +3661,23 @@ conditions: { 68, 69, 70, - 78 + 71, + 72, + 74, + 75, + 76, + 77, + 85 ], "inclusive": true } } }); +lexer.JisonLexerError = JisonLexerError; return lexer; })(); parser.lexer = lexer; +parser.JisonParserError = JisonParserError; function Parser () { this.yy = {}; From 67cd0486859b3d7abe36acd45e10683dc245dc12 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 25 Oct 2015 14:09:20 +0100 Subject: [PATCH 078/417] - prepped lexer to accept `{NAME}` *inside* a regex set -- the grammar has NOT been adjusted for this yet! - adjusted lexer and grammar: added ability to accept option *value*, e.g. `%option unicode=7`: now options go through the parser engine, just like the rest of the jison language; before this, parsing `%options` lines was a purely lexer-internal thing. - added tests to verify the proper parsing of `%options` lines. --- lex.l | 24 ++++++++++++------- lex.y | 59 +++++++++++++++++++++++++++++++++------------- tests/all-tests.js | 35 +++++++++++++++++++++++++++ 3 files changed, 94 insertions(+), 24 deletions(-) diff --git a/lex.l b/lex.l index 4afa633..7471f32 100644 --- a/lex.l +++ b/lex.l @@ -3,7 +3,7 @@ NAME [a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])? BR \r\n|\n|\r %s indented trail rules -%x code start_condition options conditions action path +%x code start_condition options conditions action path set %options easy_keyword_rules %options ranges @@ -31,9 +31,13 @@ BR \r\n|\n|\r "%%" this.begin('code'); return '%%'; [a-zA-Z0-9_]+ return 'CHARACTER_LIT'; -{NAME} yy.options[yytext] = true; -{BR}+ this.popState(); -\s+{BR}+ this.popState(); +{NAME} return 'NAME'; +"=" return '='; +\"("\\\\"|'\"'|[^"])*\" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; +"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; +[^\s\r\n]+ return 'OPTION_VALUE'; +{BR}+ this.popState(); return 'OPTIONS_END'; +\s+{BR}+ this.popState(); return 'OPTIONS_END'; \s+ /* empty */ {NAME} return 'START_COND'; @@ -75,8 +79,11 @@ BR \r\n|\n|\r {NAME} return 'NAME'; \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; +"[" this.pushState('set'); return 'REGEX_SET_START'; +("\\\\"|"\]"|[^\]])+ return 'REGEX_SET'; +"]" this.popState('set'); return 'REGEX_SET_END'; "|" return '|'; -"["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; +// "["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; "(?:" return 'SPECIAL_GROUP'; "(?=" return 'SPECIAL_GROUP'; "(?!" return 'SPECIAL_GROUP'; @@ -89,14 +96,14 @@ BR \r\n|\n|\r "," return ','; "<>" return '$'; "<" this.begin('conditions'); return '<'; -"/!" return '/!'; -"/" return '/'; +"/!" return '/!'; // treated as `(?!atom)` +"/" return '/'; // treated as `(?=atom)` "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR'; "\\". yytext = yytext.replace(/^\\/g, ''); return 'ESCAPE_CHAR'; "$" return '$'; "." return '.'; -"%options" if (!yy.options) { yy.options = {}; } this.begin('options'); return false; +"%options" if (!yy.options) { yy.options = {}; } this.begin('options'); return 'OPTIONS'; "%s" this.begin('start_condition'); return 'START_INC'; "%x" this.begin('start_condition'); return 'START_EXC'; "%include" this.pushState('path'); return 'INCLUDE'; @@ -108,6 +115,7 @@ BR \r\n|\n|\r "%%" this.begin('rules'); return '%%'; "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; "{"{NAME}"}" return 'NAME_BRACE'; +"{"{NAME}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ diff --git a/lex.y b/lex.y index 7bb1c66..e1d42d4 100644 --- a/lex.y +++ b/lex.y @@ -9,7 +9,7 @@ %% lex - : definitions '%%' rules epilogue + : init definitions '%%' rules epilogue { $$ = { rules: $rules }; if ($definitions[0]) $$.macros = $definitions[0]; @@ -30,26 +30,30 @@ epilogue { $$ = $extra_lexer_module_code; } ; +// because JISON doesn't support mid-rule actions, we set up `yy` using this empty rule at the start: +init + : + { yy.actionInclude = ''; } + ; + definitions : definition definitions { $$ = $definitions; - if ('length' in $definition) { - $$[0] = $$[0] || {}; - $$[0][$definition[0]] = $definition[1]; - } else { - $$[1] = $$[1] || {}; - for (var name in $definition) { - $$[1][name] = $definition[name]; + if ($definition != null) { + if ('length' in $definition) { + $$[0] = $$[0] || {}; + $$[0][$definition[0]] = $definition[1]; + } else { + $$[1] = $$[1] || {}; + for (var name in $definition) { + $$[1][name] = $definition[name]; + } } } } - | ACTION definitions - { yy.actionInclude += $ACTION; $$ = $definitions; } - | include_macro_code definitions - { yy.actionInclude += $include_macro_code; $$ = $definitions; } | - { yy.actionInclude = ''; $$ = [null, null]; } + { $$ = [null, null]; } ; definition @@ -59,6 +63,12 @@ definition { $$ = $names_inclusive; } | START_EXC names_exclusive { $$ = $names_exclusive; } + | ACTION + { yy.actionInclude += $ACTION; $$ = null; } + | include_macro_code + { yy.actionInclude += $include_macro_code; $$ = null; } + | options + { $$ = null; } ; names_inclusive @@ -114,7 +124,6 @@ action_comments_body { $$ = $action_comments_body + $ACTION_BODY; } ; - start_conditions : '<' name_list '>' { $$ = $name_list; } @@ -190,8 +199,8 @@ name_expansion ; any_group_regex - : ANY_GROUP_REGEX - { $$ = $ANY_GROUP_REGEX; } + : REGEX_SET_START REGEX_SET REGEX_SET_END + { $$ = $REGEX_SET_START + $REGEX_SET + $REGEX_SET_END; } ; escape_char @@ -210,6 +219,24 @@ string | CHARACTER_LIT ; +options + : OPTIONS option_list OPTIONS_END + ; + +option_list + : option option_list + | option + ; + +option + : NAME[option] + { yy.options[$option] = true; } + | NAME[option] '=' OPTION_VALUE[value] + { yy.options[$option] = $value; } + | NAME[option] '=' NAME[value] + { yy.options[$option] = $value; } + ; + extra_lexer_module_code : optional_module_code_chunk { $$ = $optional_module_code_chunk; } diff --git a/tests/all-tests.js b/tests/all-tests.js index 7d4b618..09176ee 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -350,6 +350,41 @@ exports["test options"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test options with values"] = function () { + var lexgrammar = '%options ping=666 bla=blub bool1 s1="s1value" s2=\'s2value\'\n%%\n"foo" return 1;'; + var expected = { + rules: [ + ["foo", "return 1;"] + ], + options: { + ping: "666", + bla: "blub", + bool1: true, + s1: "s1value", + s2: "s2value" + } + }; + + lexer_reset(); + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + +exports["test options with string values which have embedded quotes"] = function () { + var lexgrammar = '%options s1="s1\\"val\'ue" s2=\'s2\\\\x\\\'val\"ue\'\n%%\n"foo" return 1;'; + var expected = { + rules: [ + ["foo", "return 1;"] + ], + options: { + s1: "s1\\\"val'ue", + s2: "s2\\\\x\\'val\"ue" + } + }; + + lexer_reset(); + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + exports["test unquoted string rules"] = function () { var lexgrammar = "%%\nfoo* return 1"; var expected = { From da1e41286fd2ddbd8b9207a2a8178ee8a4001911 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 25 Oct 2015 17:55:29 +0100 Subject: [PATCH 079/417] - fix: corrected the order of the lexer rules for regex *sets* (e.g. `[0-9]`) to nsure that name expansions are properly tokenized - augmented the lexer grammar to parse regex sets once again; this time with name expansion capability included (see also below). - introduced the `JisonParserError` and `JisonLexerError` functions: these serve as custom exception classes and are thrown by the default `parseError` handlers of the parser and lexer respectively. These classes are exported as `\.JisonParserError` and `\.lexer.JisonLexerError` respectively so userland can reference these or use them in other ways. - added proper support for name expansions *inside* regex sets, e.g. `[{digits}]`; see the examples/precedence.jison example for its use. - all tests pass again. --- lex-parser.js | 824 ++++++++++++++++++++++++++------------------------ lex.l | 6 +- lex.y | 16 +- 3 files changed, 454 insertions(+), 392 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d6118d4..109fd5b 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -117,22 +117,6 @@ } */ var lexParser = (function () { - 'use strict'; -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript -function JisonParserError(msg, hash) { - console.log("parser error: ", msg); - this.message = msg; - this.hash = hash; - var stacktrace = (new Error()).stack; - if (stacktrace) { - this.stack = stacktrace; - } -} -JisonParserError.prototype = Object.create(Error.prototype); -JisonParserError.prototype.constructor = JisonParserError; -JisonParserError.prototype.name = 'JisonParserError'; - var __expand__ = function (k, v, o) { o = o || {}; for (var l = k.length; l--; ) { @@ -140,17 +124,18 @@ var __expand__ = function (k, v, o) { } return o; }, - $V0=[6,12,14,16,18,62], - $V1=[18,25,36,39,41,44,45,49,50,51,54,55,58,60,61], - $V2=[6,12,14,16,18,25,36,40,62], - $V3=[6,12,14,16,18,25,36,39,40,41,44,45,49,50,51,54,55,58,60,61,62], + $V0=[6,12,14,16,18,64], + $V1=[18,25,36,39,41,44,45,49,50,51,54,55,60,62,63], + $V2=[6,12,14,16,18,25,36,40,64], + $V3=[6,12,14,16,18,25,36,39,40,41,44,45,49,50,51,54,55,60,62,63,64], $V4=[36,40], - $V5=[6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,58,59,60,61,62], - $V6=[6,12,14,16,18,21,62], - $V7=[6,9,12,14,16,18,25,30,36,39,41,44,45,49,50,51,54,55,58,60,61,62,69], - $V8=[6,9,18,25,30,36,39,41,44,45,49,50,51,54,55,58,60,61], - $V9=[9,69], - $Va=[25,27]; + $V5=[6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,60,61,62,63,64], + $V6=[6,12,14,16,18,21,64], + $V7=[6,9,12,14,16,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63,64,71], + $V8=[6,9,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63], + $V9=[54,57], + $Va=[9,71], + $Vb=[25,27]; var parser = { trace: function trace() { }, yy: {}, @@ -209,23 +194,25 @@ symbols_: { "escape_char": 53, "NAME_BRACE": 54, "REGEX_SET_START": 55, - "REGEX_SET": 56, + "regex_set": 56, "REGEX_SET_END": 57, - "ESCAPE_CHAR": 58, - "RANGE_REGEX": 59, - "STRING_LIT": 60, - "CHARACTER_LIT": 61, - "OPTIONS": 62, - "option_list": 63, - "OPTIONS_END": 64, - "option": 65, - "=": 66, - "OPTION_VALUE": 67, - "optional_module_code_chunk": 68, - "INCLUDE": 69, - "PATH": 70, - "module_code_chunk": 71, - "CODE": 72, + "regex_set_atom": 58, + "REGEX_SET": 59, + "ESCAPE_CHAR": 60, + "RANGE_REGEX": 61, + "STRING_LIT": 62, + "CHARACTER_LIT": 63, + "OPTIONS": 64, + "option_list": 65, + "OPTIONS_END": 66, + "option": 67, + "=": 68, + "OPTION_VALUE": 69, + "optional_module_code_chunk": 70, + "INCLUDE": 71, + "PATH": 72, + "module_code_chunk": 73, + "CODE": 74, "$accept": 0, "$end": 1 }, @@ -258,19 +245,19 @@ terminals_: { 51: "$", 54: "NAME_BRACE", 55: "REGEX_SET_START", - 56: "REGEX_SET", 57: "REGEX_SET_END", - 58: "ESCAPE_CHAR", - 59: "RANGE_REGEX", - 60: "STRING_LIT", - 61: "CHARACTER_LIT", - 62: "OPTIONS", - 64: "OPTIONS_END", - 66: "=", - 67: "OPTION_VALUE", - 69: "INCLUDE", - 70: "PATH", - 72: "CODE" + 59: "REGEX_SET", + 60: "ESCAPE_CHAR", + 61: "RANGE_REGEX", + 62: "STRING_LIT", + 63: "CHARACTER_LIT", + 64: "OPTIONS", + 66: "OPTIONS_END", + 68: "=", + 69: "OPTION_VALUE", + 71: "INCLUDE", + 72: "PATH", + 74: "CODE" }, productions_: [ 0, @@ -502,6 +489,22 @@ productions_: [ 48, 3 ], + [ + 56, + 2 + ], + [ + 56, + 1 + ], + [ + 58, + 1 + ], + [ + 58, + 1 + ], [ 53, 1 @@ -523,23 +526,23 @@ productions_: [ 3 ], [ - 63, + 65, 2 ], [ - 63, + 65, 1 ], [ - 65, + 67, 1 ], [ - 65, + 67, 3 ], [ - 65, + 67, 3 ], [ @@ -559,19 +562,19 @@ productions_: [ 2 ], [ - 71, + 73, 1 ], [ - 71, + 73, 2 ], [ - 68, + 70, 1 ], [ - 68, + 70, 0 ] ], @@ -649,15 +652,15 @@ case 8 : /*! Production:: action_body : action_comments_body */ case 27 : /*! Production:: action_comments_body : ACTION_BODY */ - case 58 : + case 62 : /*! Production:: escape_char : ESCAPE_CHAR */ - case 59 : + case 63 : /*! Production:: range_regex : RANGE_REGEX */ - case 68 : -/*! Production:: extra_lexer_module_code : optional_module_code_chunk */ case 72 : +/*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + case 76 : /*! Production:: module_code_chunk : CODE */ - case 74 : + case 78 : /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = $$[$0]; break; @@ -701,7 +704,7 @@ case 23 : /*! Production:: action_body : */ case 38 : /*! Production:: regex_list : */ - case 75 : + case 79 : /*! Production:: optional_module_code_chunk : */ this.$ = ''; break; @@ -719,7 +722,9 @@ case 28 : /*! Production:: regex_concat : regex_concat regex_base */ case 49 : /*! Production:: regex_base : regex_base range_regex */ - case 73 : + case 58 : +/*! Production:: regex_set : regex_set_atom regex_set */ + case 77 : /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = $$[$0-1] + $$[$0]; break; @@ -789,26 +794,30 @@ case 53 : this.$ = '$'; break; case 57 : -/*! Production:: any_group_regex : REGEX_SET_START REGEX_SET REGEX_SET_END */ - case 69 : +/*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ + case 73 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 60 : +case 61 : +/*! Production:: regex_set_atom : name_expansion */ + this.$ = '{[' + $$[$0] + ']}'; +break; +case 64 : /*! Production:: string : STRING_LIT */ this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; -case 65 : +case 69 : /*! Production:: option : NAME */ yy.options[$$[$0]] = true; break; -case 66 : +case 70 : /*! Production:: option : NAME = OPTION_VALUE */ - case 67 : + case 71 : /*! Production:: option : NAME = NAME */ yy.options[$$[$0-2]] = $$[$0]; break; -case 70 : +case 74 : /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); @@ -817,7 +826,7 @@ case 70 : this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; break; -case 71 : +case 75 : /*! Production:: include_macro_code : INCLUDE error */ console.error("%include MUST be followed by a valid file path"); @@ -829,7 +838,7 @@ table: [ __expand__($V0, [ 2, 4 - ], {3:1,4:2,69:[ + ], {3:1,4:2,71:[ 2, 4 ] @@ -864,11 +873,11 @@ table: [ ], 19: 9, 20: 10, - 62: [ + 64: [ 1, 12 ], - 69: [ + 71: [ 1, 11 ] @@ -904,16 +913,16 @@ table: [ ], 19: 9, 20: 10, - 62: [ + 64: [ 1, 12 ], - 69: [ + 71: [ 1, 11 ] }, - __expand__([6,12,14,16,18,36,62], [ + __expand__([6,12,14,16,18,36,64], [ 2, 38 ], {13:15,35:16,37:17,38:18,46:23,48:24,52:28,53:29,39:[ @@ -943,16 +952,16 @@ table: [ ],55:[ 1, 31 - ],58:[ + ],60:[ 1, 34 - ],60:[ + ],62:[ 1, 32 - ],61:[ + ],63:[ 1, 33 - ],69:[ + ],71:[ 2, 38 ] @@ -974,7 +983,7 @@ table: [ __expand__($V0, [ 2, 10 - ], {69:[ + ], {71:[ 2, 10 ] @@ -982,7 +991,7 @@ table: [ __expand__($V0, [ 2, 11 - ], {69:[ + ], {71:[ 2, 11 ] @@ -990,7 +999,7 @@ table: [ __expand__($V0, [ 2, 12 - ], {69:[ + ], {71:[ 2, 12 ] @@ -1000,7 +1009,7 @@ table: [ 1, 40 ], - 70: [ + 72: [ 1, 39 ] @@ -1010,8 +1019,8 @@ table: [ 1, 43 ], - 63: 41, - 65: 42 + 65: 41, + 67: 42 }, __expand__($V1, [ 2, @@ -1019,7 +1028,7 @@ table: [ ], {7:44,22:45,23:46,30:[ 1, 47 - ],69:[ + ],71:[ 2, 31 ] @@ -1033,18 +1042,18 @@ table: [ __expand__($V0, [ 2, 7 - ], {69:[ + ], {71:[ 2, 7 ] }), - __expand__([6,12,14,16,18,25,62], [ + __expand__([6,12,14,16,18,25,64], [ 2, 34 ], {36:[ 1, 48 - ],69:[ + ],71:[ 2, 34 ] @@ -1079,16 +1088,16 @@ table: [ ],55:[ 1, 31 - ],58:[ + ],60:[ 1, 34 - ],60:[ + ],62:[ 1, 32 - ],61:[ + ],63:[ 1, 33 - ],69:[ + ],71:[ 2, 37 ] @@ -1105,10 +1114,10 @@ table: [ ],43:[ 1, 52 - ],59:[ + ],61:[ 1, 54 - ],69:[ + ],71:[ 2, 40 ] @@ -1143,13 +1152,13 @@ table: [ ],55:[ 1, 31 - ],58:[ + ],60:[ 1, 34 - ],60:[ + ],62:[ 1, 32 - ],61:[ + ],63:[ 1, 33 ] @@ -1184,13 +1193,13 @@ table: [ ],55:[ 1, 31 - ],58:[ + ],60:[ 1, 34 - ],60:[ + ],62:[ 1, 32 - ],61:[ + ],63:[ 1, 33 ] @@ -1237,15 +1246,15 @@ table: [ 1, 31 ], - 58: [ + 60: [ 1, 34 ], - 60: [ + 62: [ 1, 32 ], - 61: [ + 63: [ 1, 33 ] @@ -1292,15 +1301,15 @@ table: [ 1, 31 ], - 58: [ + 60: [ 1, 34 ], - 60: [ + 62: [ 1, 32 ], - 61: [ + 63: [ 1, 33 ] @@ -1308,7 +1317,7 @@ table: [ __expand__($V5, [ 2, 48 - ], {69:[ + ], {71:[ 2, 48 ] @@ -1316,7 +1325,7 @@ table: [ __expand__($V5, [ 2, 50 - ], {69:[ + ], {71:[ 2, 50 ] @@ -1324,7 +1333,7 @@ table: [ __expand__($V5, [ 2, 51 - ], {69:[ + ], {71:[ 2, 51 ] @@ -1332,7 +1341,7 @@ table: [ __expand__($V5, [ 2, 52 - ], {69:[ + ], {71:[ 2, 52 ] @@ -1340,7 +1349,7 @@ table: [ __expand__($V5, [ 2, 53 - ], {69:[ + ], {71:[ 2, 53 ] @@ -1348,7 +1357,7 @@ table: [ __expand__($V5, [ 2, 54 - ], {69:[ + ], {71:[ 2, 54 ] @@ -1356,47 +1365,54 @@ table: [ __expand__($V5, [ 2, 55 - ], {69:[ + ], {71:[ 2, 55 ] }), - __expand__($V5, [ + __expand__([6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,57,59,60,61,62,63,64], [ 2, 56 - ], {69:[ + ], {71:[ 2, 56 ] }), { - 56: [ + 46: 62, + 54: [ 1, - 59 + 30 + ], + 56: 59, + 58: 60, + 59: [ + 1, + 61 ] }, __expand__($V5, [ 2, - 60 - ], {69:[ + 64 + ], {71:[ 2, - 60 + 64 ] }), __expand__($V5, [ 2, - 61 - ], {69:[ + 65 + ], {71:[ 2, - 61 + 65 ] }), __expand__($V5, [ 2, - 58 - ], {69:[ + 62 + ], {71:[ 2, - 58 + 62 ] }), __expand__($V0, [ @@ -1404,8 +1420,8 @@ table: [ 8 ], {21:[ 1, - 60 - ],69:[ + 63 + ],71:[ 2, 8 ] @@ -1413,7 +1429,7 @@ table: [ __expand__($V6, [ 2, 13 - ], {69:[ + ], {71:[ 2, 13 ] @@ -1423,8 +1439,8 @@ table: [ 9 ], {21:[ 1, - 61 - ],69:[ + 64 + ],71:[ 2, 9 ] @@ -1432,31 +1448,31 @@ table: [ __expand__($V6, [ 2, 15 - ], {69:[ + ], {71:[ 2, 15 ] }), __expand__($V7, [ 2, - 70 - ], {72:[ + 74 + ], {74:[ 2, - 70 + 74 ] }), __expand__($V7, [ 2, - 71 - ], {72:[ + 75 + ], {74:[ 2, - 71 + 75 ] }), { - 64: [ + 66: [ 1, - 62 + 65 ] }, { @@ -1464,34 +1480,34 @@ table: [ 1, 43 ], - 63: 63, - 64: [ + 65: 66, + 66: [ 2, - 64 + 68 ], - 65: 42 + 67: 42 }, - __expand__([12,64], [ + __expand__([12,66], [ 2, - 65 - ], {66:[ + 69 + ], {68:[ 1, - 64 + 67 ] }), __expand__($V1, [ 2, 31 - ], {23:46,8:65,22:66,6:[ + ], {23:46,8:68,22:69,6:[ 1, - 68 + 71 ],9:[ 1, - 67 + 70 ],30:[ 1, 47 - ],69:[ + ],71:[ 2, 31 ] @@ -1499,7 +1515,7 @@ table: [ __expand__($V8, [ 2, 18 - ], {69:[ + ], {71:[ 2, 18 ] @@ -1507,7 +1523,7 @@ table: [ __expand__([18,25,36], [ 2, 38 - ], {35:16,37:17,38:18,46:23,48:24,52:28,53:29,13:69,39:[ + ], {35:16,37:17,38:18,46:23,48:24,52:28,53:29,13:72,39:[ 1, 19 ],41:[ @@ -1534,16 +1550,16 @@ table: [ ],55:[ 1, 31 - ],58:[ + ],60:[ 1, 34 - ],60:[ + ],62:[ 1, 32 - ],61:[ + ],63:[ 1, 33 - ],69:[ + ],71:[ 2, 38 ] @@ -1551,18 +1567,18 @@ table: [ { 12: [ 1, - 72 + 75 ], - 31: 70, + 31: 73, 33: [ 1, - 71 + 74 ] }, __expand__($V2, [ 2, 36 - ], {38:18,46:23,48:24,52:28,53:29,37:73,39:[ + ], {38:18,46:23,48:24,52:28,53:29,37:76,39:[ 1, 19 ],41:[ @@ -1589,16 +1605,16 @@ table: [ ],55:[ 1, 31 - ],58:[ + ],60:[ 1, 34 - ],60:[ + ],62:[ 1, 32 - ],61:[ + ],63:[ 1, 33 - ],69:[ + ],71:[ 2, 36 ] @@ -1615,10 +1631,10 @@ table: [ ],43:[ 1, 52 - ],59:[ + ],61:[ 1, 54 - ],69:[ + ],71:[ 2, 39 ] @@ -1626,7 +1642,7 @@ table: [ __expand__($V5, [ 2, 43 - ], {69:[ + ], {71:[ 2, 43 ] @@ -1634,7 +1650,7 @@ table: [ __expand__($V5, [ 2, 44 - ], {69:[ + ], {71:[ 2, 44 ] @@ -1642,7 +1658,7 @@ table: [ __expand__($V5, [ 2, 45 - ], {69:[ + ], {71:[ 2, 45 ] @@ -1650,17 +1666,17 @@ table: [ __expand__($V5, [ 2, 49 - ], {69:[ + ], {71:[ 2, 49 ] }), __expand__($V5, [ 2, - 59 - ], {69:[ + 63 + ], {71:[ 2, - 59 + 63 ] }), { @@ -1670,7 +1686,7 @@ table: [ ], 40: [ 1, - 74 + 77 ] }, { @@ -1680,7 +1696,7 @@ table: [ ], 40: [ 1, - 75 + 78 ] }, __expand__($V3, [ @@ -1695,10 +1711,10 @@ table: [ ],43:[ 1, 52 - ],59:[ + ],61:[ 1, 54 - ],69:[ + ],71:[ 2, 46 ] @@ -1715,10 +1731,10 @@ table: [ ],43:[ 1, 52 - ],59:[ + ],61:[ 1, 54 - ],69:[ + ],71:[ 2, 47 ] @@ -1726,13 +1742,46 @@ table: [ { 57: [ 1, - 76 + 79 ] }, + { + 46: 62, + 54: [ + 1, + 30 + ], + 56: 80, + 57: [ + 2, + 59 + ], + 58: 60, + 59: [ + 1, + 61 + ] + }, + __expand__($V9, [ + 2, + 60 + ], {59:[ + 2, + 60 + ] + }), + __expand__($V9, [ + 2, + 61 + ], {59:[ + 2, + 61 + ] + }), __expand__($V6, [ 2, 14 - ], {69:[ + ], {71:[ 2, 14 ] @@ -1740,33 +1789,33 @@ table: [ __expand__($V6, [ 2, 16 - ], {69:[ + ], {71:[ 2, 16 ] }), __expand__($V0, [ 2, - 62 - ], {69:[ + 66 + ], {71:[ 2, - 62 + 66 ] }), { - 64: [ + 66: [ 2, - 63 + 67 ] }, { 12: [ 1, - 78 + 82 ], - 67: [ + 69: [ 1, - 77 + 81 ] }, { @@ -1778,7 +1827,7 @@ table: [ __expand__($V8, [ 2, 17 - ], {69:[ + ], {71:[ 2, 17 ] @@ -1789,26 +1838,26 @@ table: [ 2 ] }, - __expand__($V9, [ + __expand__($Va, [ 2, - 75 - ], {10:79,68:80,71:81,72:[ + 79 + ], {10:83,70:84,73:85,74:[ 1, - 82 + 86 ] }), { 18: [ 1, - 85 + 89 ], - 19: 86, - 24: 83, + 19: 90, + 24: 87, 25: [ 1, - 84 + 88 ], - 69: [ + 71: [ 1, 11 ] @@ -1816,17 +1865,17 @@ table: [ { 32: [ 1, - 87 + 91 ], 34: [ 1, - 88 + 92 ] }, { 32: [ 1, - 89 + 93 ] }, { @@ -1869,16 +1918,16 @@ table: [ ],55:[ 1, 31 - ],58:[ + ],60:[ 1, 34 - ],60:[ + ],62:[ 1, 32 - ],61:[ + ],63:[ 1, 33 - ],69:[ + ],71:[ 2, 35 ] @@ -1886,7 +1935,7 @@ table: [ __expand__($V5, [ 2, 41 - ], {69:[ + ], {71:[ 2, 41 ] @@ -1894,7 +1943,7 @@ table: [ __expand__($V5, [ 2, 42 - ], {69:[ + ], {71:[ 2, 42 ] @@ -1902,84 +1951,90 @@ table: [ __expand__($V5, [ 2, 57 - ], {69:[ + ], {71:[ 2, 57 ] }), + { + 57: [ + 2, + 58 + ] + }, { 12: [ 2, - 66 + 70 ], - 64: [ + 66: [ 2, - 66 + 70 ] }, { 12: [ 2, - 67 + 71 ], - 64: [ + 66: [ 2, - 67 + 71 ] }, { 9: [ 1, - 90 + 94 ] }, { 9: [ 2, - 68 + 72 ], - 19: 91, - 69: [ + 19: 95, + 71: [ 1, 11 ] }, - __expand__($V9, [ + __expand__($Va, [ 2, - 74 - ], {72:[ + 78 + ], {74:[ 1, - 92 + 96 ] }), - __expand__($V9, [ + __expand__($Va, [ 2, - 72 - ], {72:[ + 76 + ], {74:[ 2, - 72 + 76 ] }), __expand__($V8, [ 2, 19 - ], {69:[ + ], {71:[ 2, 19 ] }), - __expand__($Va, [ + __expand__($Vb, [ 2, 23 - ], {26:93,28:94,29:[ + ], {26:97,28:98,29:[ 1, - 95 + 99 ] }), __expand__($V8, [ 2, 21 - ], {69:[ + ], {71:[ 2, 21 ] @@ -1987,7 +2042,7 @@ table: [ __expand__($V8, [ 2, 22 - ], {69:[ + ], {71:[ 2, 22 ] @@ -1995,7 +2050,7 @@ table: [ __expand__($V1, [ 2, 29 - ], {69:[ + ], {71:[ 2, 29 ] @@ -2003,13 +2058,13 @@ table: [ { 12: [ 1, - 96 + 100 ] }, __expand__($V1, [ 2, 30 - ], {69:[ + ], {71:[ 2, 30 ] @@ -2020,41 +2075,41 @@ table: [ 3 ] }, - __expand__($V9, [ + __expand__($Va, [ 2, - 75 - ], {68:80,71:81,10:97,72:[ + 79 + ], {70:84,73:85,10:101,74:[ 1, - 82 + 86 ] }), - __expand__($V9, [ + __expand__($Va, [ 2, - 73 - ], {72:[ + 77 + ], {74:[ 2, - 73 + 77 ] }), { 25: [ 1, - 99 + 103 ], 27: [ 1, - 98 + 102 ] }, - __expand__($Va, [ + __expand__($Vb, [ 2, 24 ], {29:[ 1, - 100 + 104 ] }), - __expand__($Va, [ + __expand__($Vb, [ 2, 27 ], {29:[ @@ -2075,26 +2130,26 @@ table: [ { 9: [ 2, - 69 + 73 ] }, __expand__($V8, [ 2, 20 - ], {69:[ + ], {71:[ 2, 20 ] }), - __expand__($Va, [ + __expand__($Vb, [ 2, 23 - ], {28:94,26:101,29:[ + ], {28:98,26:105,29:[ 1, - 95 + 99 ] }), - __expand__($Va, [ + __expand__($Vb, [ 2, 28 ], {29:[ @@ -2105,27 +2160,27 @@ table: [ { 25: [ 1, - 99 + 103 ], 27: [ 1, - 102 + 106 ] }, - __expand__($Va, [ + __expand__($Vb, [ 2, 26 - ], {28:103,29:[ + ], {28:107,29:[ 1, - 95 + 99 ] }), - __expand__($Va, [ + __expand__($Vb, [ 2, 25 ], {29:[ 1, - 100 + 104 ] }) ], @@ -2134,32 +2189,42 @@ defaultActions: { 2, 5 ], - 63: [ + 66: [ 2, - 63 + 67 ], - 65: [ + 68: [ 2, 1 ], - 67: [ + 70: [ 2, 2 ], - 90: [ + 80: [ + 2, + 58 + ], + 94: [ 2, 3 ], - 97: [ + 101: [ 2, - 69 + 73 ] }, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { - throw new JisonParserError(str, hash); + function _parseError (msg, hash) { + this.message = msg; + this.hash = hash; + } + _parseError.prototype = new Error(); + + throw new _parseError(str, hash); } }, parse: function parse(input) { @@ -2506,21 +2571,6 @@ function prepareString (s) { /* generated by jison-lex 0.3.4 */ var lexer = (function () { -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript -function JisonLexerError(msg, hash) { - console.log("lexer error: ", msg); - this.message = msg; - this.hash = hash; - var stacktrace = (new Error()).stack; - if (stacktrace) { - this.stack = stacktrace; - } -} -JisonLexerError.prototype = Object.create(Error.prototype); -JisonLexerError.prototype.constructor = JisonLexerError; -JisonLexerError.prototype.name = 'JisonLexerError'; - var lexer = ({ EOF:1, @@ -2531,7 +2581,7 @@ parseError:function parseError(str, hash) { if (this.yy.parser) { return this.yy.parser.parseError(str, hash) || this.ERROR; } else { - throw new JisonLexerError(str); + throw new Error(str); } }, @@ -2962,22 +3012,22 @@ break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 67; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 69; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 67; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 69; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 64; + this.popState(); return 66; break; case 24 : /*! Conditions:: options */ /*! Rule:: \s+{BR}+ */ - this.popState(); return 64; + this.popState(); return 66; break; case 25 : /*! Conditions:: options */ @@ -3039,7 +3089,7 @@ case 34 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 69; + return 71; break; case 35 : @@ -3070,64 +3120,59 @@ break; case 41 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 60; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 62; break; case 42 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 60; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 62; break; case 43 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \[ */ this.pushState('set'); return 55; break; -case 45 : -/*! Conditions:: set */ -/*! Rule:: \] */ - this.popState('set'); return 57; -break; -case 58 : +case 56 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: < */ this.begin('conditions'); return 30; break; -case 59 : +case 57 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/! */ return 45; // treated as `(?!atom)` break; -case 60 : +case 58 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/ */ return 44; // treated as `(?=atom)` break; -case 62 : +case 60 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 58; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 60; break; -case 65 : +case 63 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %options\b */ - if (!yy.options) { yy.options = {}; } this.begin('options'); return 62; + if (!yy.options) { yy.options = {}; } this.begin('options'); return 64; break; -case 66 : +case 64 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %s\b */ this.begin('start_condition'); return 14; break; -case 67 : +case 65 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %x\b */ this.begin('start_condition'); return 16; break; -case 68 : +case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 69; + this.pushState('path'); return 71; break; -case 69 : +case 67 : /*! Conditions:: INITIAL rules trail code */ /*! Rule:: %{NAME}[^\r\n]+ */ @@ -3135,20 +3180,25 @@ case 69 : console.warn('ignoring unsupported lexer option: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); break; -case 70 : +case 68 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %% */ this.begin('rules'); return 6; break; -case 76 : +case 74 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: . */ throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ break; +case 77 : +/*! Conditions:: set */ +/*! Rule:: \] */ + this.popState('set'); return 57; +break; case 79 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 72; // the bit of CODE just before EOF... + return 74; // the bit of CODE just before EOF... break; case 80 : /*! Conditions:: path */ @@ -3158,12 +3208,12 @@ break; case 81 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 70; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 72; break; case 82 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 70; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 72; break; case 83 : /*! Conditions:: path */ @@ -3173,7 +3223,7 @@ break; case 84 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 70; + this.popState(); return 72; break; case 85 : /*! Conditions:: * */ @@ -3218,91 +3268,91 @@ simpleCaseActionClusters: { 12 : 33, /*! Conditions:: rules */ /*! Rule:: [a-zA-Z0-9_]+ */ - 17 : 61, + 17 : 63, /*! Conditions:: options */ /*! Rule:: {NAME} */ 18 : 12, /*! Conditions:: options */ /*! Rule:: = */ - 19 : 66, + 19 : 68, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 67, + 22 : 69, /*! Conditions:: start_condition */ /*! Rule:: {NAME} */ 26 : 21, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: {NAME} */ 40 : 12, - /*! Conditions:: set */ - /*! Rule:: (\\\\|\\\]|[^\]])+ */ - 44 : 56, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \| */ - 46 : 36, + 44 : 36, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?: */ - 47 : 41, + 45 : 41, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?= */ - 48 : 41, + 46 : 41, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?! */ - 49 : 41, + 47 : 41, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \( */ - 50 : 39, + 48 : 39, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \) */ - 51 : 40, + 49 : 40, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \+ */ - 52 : 42, + 50 : 42, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \* */ - 53 : 33, + 51 : 33, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \? */ - 54 : 43, + 52 : 43, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \^ */ - 55 : 50, + 53 : 50, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: , */ - 56 : 34, + 54 : 34, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: <> */ - 57 : 51, + 55 : 51, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 61 : 58, + 59 : 60, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \$ */ - 63 : 51, + 61 : 51, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \. */ - 64 : 49, + 62 : 49, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 71 : 59, + 69 : 61, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{{NAME}\} */ - 72 : 54, + 70 : 54, /*! Conditions:: set options */ /*! Rule:: \{{NAME}\} */ - 73 : 54, + 71 : 54, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{ */ - 74 : 25, + 72 : 25, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \} */ - 75 : 27, + 73 : 27, /*! Conditions:: * */ /*! Rule:: $ */ - 77 : 9, + 75 : 9, + /*! Conditions:: set */ + /*! Rule:: (\\\\|\\\]|[^\]])+ */ + 76 : 59, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 78 : 72 + 78 : 74 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, @@ -3349,8 +3399,6 @@ rules: [ /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, /^(?:\[)/, -/^(?:(\\\\|\\\]|[^\]])+)/, -/^(?:\])/, /^(?:\|)/, /^(?:\(\?:)/, /^(?:\(\?=)/, @@ -3383,6 +3431,8 @@ rules: [ /^(?:\})/, /^(?:.)/, /^(?:$)/, +/^(?:(\\\\|\\\]|[^\]])+)/, +/^(?:\])/, /^(?:[^\r\n]*(\r|\n)+)/, /^(?:[^\r\n]+)/, /^(?:[\r\n])/, @@ -3395,9 +3445,9 @@ rules: [ conditions: { "code": { "rules": [ - 68, - 69, - 77, + 66, + 67, + 75, 78, 79, 85 @@ -3410,7 +3460,7 @@ conditions: { 27, 28, 29, - 77, + 75, 85 ], "inclusive": false @@ -3425,8 +3475,8 @@ conditions: { 23, 24, 25, - 73, - 77, + 71, + 75, 85 ], "inclusive": false @@ -3437,7 +3487,7 @@ conditions: { 10, 11, 12, - 77, + 75, 85 ], "inclusive": false @@ -3453,14 +3503,14 @@ conditions: { 6, 7, 8, - 77, + 75, 85 ], "inclusive": false }, "path": { "rules": [ - 77, + 75, 80, 81, 82, @@ -3472,9 +3522,9 @@ conditions: { }, "set": { "rules": [ - 44, - 45, - 73, + 71, + 75, + 76, 77, 85 ], @@ -3495,6 +3545,8 @@ conditions: { 41, 42, 43, + 44, + 45, 46, 47, 48, @@ -3515,15 +3567,13 @@ conditions: { 63, 64, 65, - 66, - 67, + 68, + 69, 70, - 71, 72, + 73, 74, 75, - 76, - 77, 85 ], "inclusive": true @@ -3540,6 +3590,8 @@ conditions: { 41, 42, 43, + 44, + 45, 46, 47, 48, @@ -3565,12 +3617,10 @@ conditions: { 68, 69, 70, - 71, 72, + 73, 74, 75, - 76, - 77, 85 ], "inclusive": true @@ -3591,6 +3641,8 @@ conditions: { 41, 42, 43, + 44, + 45, 46, 47, 48, @@ -3611,16 +3663,14 @@ conditions: { 63, 64, 65, - 66, 67, + 68, 69, 70, - 71, 72, + 73, 74, 75, - 76, - 77, 85 ], "inclusive": true @@ -3636,6 +3686,8 @@ conditions: { 41, 42, 43, + 44, + 45, 46, 47, 48, @@ -3661,23 +3713,19 @@ conditions: { 68, 69, 70, - 71, 72, + 73, 74, 75, - 76, - 77, 85 ], "inclusive": true } } }); -lexer.JisonLexerError = JisonLexerError; return lexer; })(); parser.lexer = lexer; -parser.JisonParserError = JisonParserError; function Parser () { this.yy = {}; diff --git a/lex.l b/lex.l index 7471f32..e66849a 100644 --- a/lex.l +++ b/lex.l @@ -80,8 +80,6 @@ BR \r\n|\n|\r \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; "[" this.pushState('set'); return 'REGEX_SET_START'; -("\\\\"|"\]"|[^\]])+ return 'REGEX_SET'; -"]" this.popState('set'); return 'REGEX_SET_END'; "|" return '|'; // "["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; "(?:" return 'SPECIAL_GROUP'; @@ -122,6 +120,10 @@ BR \r\n|\n|\r <*><> return 'EOF'; +("\\\\"|"\]"|[^\]])+ return 'REGEX_SET'; +"]" this.popState('set'); return 'REGEX_SET_END'; + + // in the trailing CODE block, only accept these `%include` macros when they appear at the start of a line // and make sure the rest of lexer regexes account for this one so it'll match that way only: [^\r\n]*(\r|\n)+ return 'CODE'; diff --git a/lex.y b/lex.y index e1d42d4..8e8c53a 100644 --- a/lex.y +++ b/lex.y @@ -199,8 +199,20 @@ name_expansion ; any_group_regex - : REGEX_SET_START REGEX_SET REGEX_SET_END - { $$ = $REGEX_SET_START + $REGEX_SET + $REGEX_SET_END; } + : REGEX_SET_START regex_set REGEX_SET_END + { $$ = $REGEX_SET_START + $regex_set + $REGEX_SET_END; } + ; + +regex_set + : regex_set_atom regex_set + { $$ = $regex_set_atom + $regex_set; } + | regex_set_atom + ; + +regex_set_atom + : REGEX_SET + | name_expansion + { $$ = '{[' + $name_expansion + ']}'; } ; escape_char From 90ed8ebe4d1434c2f44faff91f894d4477fc458e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 25 Oct 2015 18:12:22 +0100 Subject: [PATCH 080/417] - ` make clean ; make prep ; make ` --> rebuild the whole shebang; all tests pass - added build number `100` to the version numbers so I can stay in sync with the Zaach mainline re major.minor.build; no use to fiddle the minor version as we'll have collisions then downstream. Besides, we don't fetch the buggers on a version but rather on a *commit* anyway, so at least *our* NPM should do fine either way. --- lex-parser.js | 66 ++++++++++++++++++++++++++++++++++----------------- package.json | 2 +- 2 files changed, 45 insertions(+), 23 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 109fd5b..a67a971 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -8,7 +8,8 @@ Parser.prototype: { yy: {}, - trace: function(), + trace: function(errorMessage, errorHash), + JisonParserError: function(msg, hash), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], @@ -21,11 +22,14 @@ lexer: { EOF: 1, + ERROR: 2, + JisonLexerError: function(msg, hash), parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), + reject: function(), less: function(n), pastInput: function(), upcomingInput: function(), @@ -117,14 +121,29 @@ } */ var lexParser = (function () { -var __expand__ = function (k, v, o) { +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +function JisonParserError(msg, hash) { + this.message = msg; + this.hash = hash; + var stacktrace = (new Error()).stack; + if (stacktrace) { + this.stack = stacktrace; + } +} +JisonParserError.prototype = Object.create(Error.prototype); +JisonParserError.prototype.constructor = JisonParserError; +JisonParserError.prototype.name = 'JisonParserError'; + +function __expand__(k, v, o) { o = o || {}; for (var l = k.length; l--; ) { o[k[l]] = v; } return o; -}, - $V0=[6,12,14,16,18,64], +} + +var $V0=[6,12,14,16,18,64], $V1=[18,25,36,39,41,44,45,49,50,51,54,55,60,62,63], $V2=[6,12,14,16,18,25,36,40,64], $V3=[6,12,14,16,18,25,36,39,40,41,44,45,49,50,51,54,55,60,62,63,64], @@ -136,8 +155,10 @@ var __expand__ = function (k, v, o) { $V9=[54,57], $Va=[9,71], $Vb=[25,27]; + var parser = { trace: function trace() { }, +JisonParserError: JisonParserError, yy: {}, symbols_: { "error": 2, @@ -2218,13 +2239,7 @@ parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { - function _parseError (msg, hash) { - this.message = msg; - this.hash = hash; - } - _parseError.prototype = new Error(); - - throw new _parseError(str, hash); + throw new this.JisonParserError(str, hash); } }, parse: function parse(input) { @@ -2238,7 +2253,6 @@ parse: function parse(input) { yylineno = 0, yyleng = 0, recovering = 0, // (only used when the grammar contains error recovery rules) - error_signaled = false, TERROR = 2, EOF = 1; @@ -2382,7 +2396,6 @@ parse: function parse(input) { (symbol === EOF ? 'end of input' : ("'" + (this.terminals_[symbol] || symbol) + "'")); } - error_signaled = true; a = this.parseError(errStr, p = { text: lexer.match, token: this.terminals_[symbol] || symbol, @@ -2402,7 +2415,6 @@ parse: function parse(input) { // just recovered from another error if (recovering === 3) { if (symbol === EOF || preErrorSymbol === EOF) { - error_signaled = true; retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { text: lexer.match, token: this.terminals_[symbol] || symbol, @@ -2424,7 +2436,6 @@ parse: function parse(input) { // try to recover from error if (error_rule_depth === false) { - error_signaled = true; retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { text: lexer.match, token: this.terminals_[symbol] || symbol, @@ -2447,7 +2458,6 @@ parse: function parse(input) { // this shouldn't happen, unless resolve defaults are off if (action[0] instanceof Array && action.length > 1) { - error_signaled = true; retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { text: lexer.match, token: this.terminals_[symbol] || symbol, @@ -2509,7 +2519,6 @@ parse: function parse(input) { if (typeof r !== 'undefined') { retval = r; - error_signaled = true; break; } @@ -2529,14 +2538,10 @@ parse: function parse(input) { case 3: // accept retval = true; - error_signaled = true; break; } // break out of loop: we accept or fail with error - if (!error_signaled) { - // b0rk b0rk b0rk! - } break; } } finally { @@ -2571,6 +2576,20 @@ function prepareString (s) { /* generated by jison-lex 0.3.4 */ var lexer = (function () { +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +function JisonLexerError(msg, hash) { + this.message = msg; + this.hash = hash; + var stacktrace = (new Error()).stack; + if (stacktrace) { + this.stack = stacktrace; + } +} +JisonLexerError.prototype = Object.create(Error.prototype); +JisonLexerError.prototype.constructor = JisonLexerError; +JisonLexerError.prototype.name = 'JisonLexerError'; + var lexer = ({ EOF:1, @@ -2581,7 +2600,7 @@ parseError:function parseError(str, hash) { if (this.yy.parser) { return this.yy.parser.parseError(str, hash) || this.ERROR; } else { - throw new Error(str); + throw new this.JisonLexerError(str); } }, @@ -2965,6 +2984,7 @@ options: { "easy_keyword_rules": true, "ranges": true }, +JisonLexerError: JisonLexerError, performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { var YYSTATE = YY_START; @@ -3723,6 +3743,7 @@ conditions: { } } }); +// lexer.JisonLexerError = JisonLexerError; return lexer; })(); parser.lexer = lexer; @@ -3732,6 +3753,7 @@ function Parser () { } Parser.prototype = parser; parser.Parser = Parser; +// parser.JisonParserError = JisonParserError; return new Parser(); })(); diff --git a/package.json b/package.json index c26e00a..7f0bb11 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4", + "version": "0.1.4.100", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 0c5eec04ddd964291aa057ba878e736c438964ec Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 25 Oct 2015 19:07:41 +0100 Subject: [PATCH 081/417] nice try with the versions there, mister, but http://stackoverflow.com/questions/16887993/npm-why-is-a-version-0-1-invalid#16888025 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f0bb11..b0d97ee 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4.100", + "version": "0.1.4-100", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 3ae448f629a2aee717520b0846424b9a02f4eafd Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 25 Oct 2015 19:13:31 +0100 Subject: [PATCH 082/417] `make clean ; make prep ; make`: rebuilt everything; tests pass. --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index a67a971..07f2f2f 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.15 */ +/* parser generated by jison 0.4.15-100 */ /* Returns a Parser object of the following structure: @@ -2574,7 +2574,7 @@ function prepareString (s) { }; -/* generated by jison-lex 0.3.4 */ +/* generated by jison-lex 0.3.4.100 */ var lexer = (function () { // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript From 6be28bd27baf5fde5ca22388a16633cc26574039 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 00:47:34 +0100 Subject: [PATCH 083/417] `make clean ; make prep ; make` - all test pass. (Except the issue-293 example of course) --- lex-parser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 07f2f2f..de810a5 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -126,7 +126,7 @@ var lexParser = (function () { function JisonParserError(msg, hash) { this.message = msg; this.hash = hash; - var stacktrace = (new Error()).stack; + var stacktrace = (new Error(msg)).stack; if (stacktrace) { this.stack = stacktrace; } @@ -2291,7 +2291,7 @@ parse: function parse(input) { if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } else { - this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ + //this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ } function popStack(n) { @@ -2574,7 +2574,7 @@ function prepareString (s) { }; -/* generated by jison-lex 0.3.4.100 */ +/* generated by jison-lex 0.3.4-100 */ var lexer = (function () { // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript From 93454e16b5dd55e2dd75b752531fa7f6be649ff7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 03:34:54 +0100 Subject: [PATCH 084/417] `make clean; make prep; make` ==> all tests pass, once again. --- lex-parser.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index de810a5..31a317b 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2288,11 +2288,10 @@ parse: function parse(input) { var ranges = lexer.options && lexer.options.ranges; + // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; - } else { - //this.parseError = Object.getPrototypeOf(this).parseError; // because in the generated code 'this.__proto__.parseError' doesn't work for everyone: http://javascriptweblog.wordpress.com/2010/06/07/understanding-javascript-prototypes/ - } + } function popStack(n) { stack.length = stack.length - 2 * n; @@ -2581,7 +2580,7 @@ var lexer = (function () { function JisonLexerError(msg, hash) { this.message = msg; this.hash = hash; - var stacktrace = (new Error()).stack; + var stacktrace = (new Error(msg)).stack; if (stacktrace) { this.stack = stacktrace; } From 10e8e00320bd3cb2f85bf787a5f70719fd7681f4 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 03:40:26 +0100 Subject: [PATCH 085/417] bumped build number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b0d97ee..ddfade1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-100", + "version": "0.1.4-101", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From b415539ac4192a40b21f5de274de0fde8b25064b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 12:50:49 +0100 Subject: [PATCH 086/417] unify IDs vs. NAMEs across the board: IDs are `[a-zA-Z_][a-zA-Z0-9_]*` while NAMES are that too, but also accept '-' in the middle, e.g. `a_b` is an ID (and a NAME), while `a-b` is a NAME, but *not* an ID. `$name`s are ID-based as they appear inside code so allowing a '-' in there would be confusing as it would permit $ labels like this one: `$a-1` which is a legal NAME `a-1` -- okay, good coding styles generally are more generous in handing out whitespace (-> `$a - 1` for an expression rather than `$a-1` but some programmers think they can be lazy & smart at the same time; maybe they feel they save their tendons this way, I don't know. --- lex-parser.js | 3712 +++++--------------------------- lex.l | 11 +- tests/all-tests.js | 6 +- tests/lex/bnf.jisonlex | 2 +- tests/lex/bnf.lex.json | 2 +- tests/lex/lex_grammar.jisonlex | 2 +- tests/lex/lex_grammar.lex.json | 2 +- 7 files changed, 517 insertions(+), 3220 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 31a317b..fa9c9a3 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.15-100 */ +/* parser generated by jison 0.4.15 */ /* Returns a Parser object of the following structure: @@ -8,13 +8,11 @@ Parser.prototype: { yy: {}, - trace: function(errorMessage, errorHash), - JisonParserError: function(msg, hash), + trace: function(), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), - (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), table: [...], defaultActions: {...}, parseError: function(str, hash), @@ -22,14 +20,11 @@ lexer: { EOF: 1, - ERROR: 2, - JisonLexerError: function(msg, hash), parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), - reject: function(), less: function(n), pastInput: function(), upcomingInput: function(), @@ -42,9 +37,12 @@ _currentRules: function(), topState: function(), pushState: function(condition), - stateStackSize: function(), - options: { ... }, + options: { + ranges: boolean (optional: true ==> token location info will include a .range[] member) + flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) + backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) + }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], @@ -69,544 +67,24 @@ } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) - expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) - recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) - } - - You can specify parser options by setting / modifying the `.yy` object of your Parser instance. - These options are available: - - ### options which are global for all parser instances - - Parser.pre_parse: function(yy) - optional: you can specify a pre_parse() function in the chunk following the grammar, - i.e. after the last `%%`. - Parser.post_parse: function(yy, retval) { return retval; } - optional: you can specify a post_parse() function in the chunk following the grammar, - i.e. after the last `%%`. When it does not return any value, the parser will return - the original `retval`. - - ### options which can be set up per parser instance - - yy: { - pre_parse: function(yy) - optional: is invoked before the parse cycle starts (and before the first invocation - of `lex()`) but immediately after the invocation of parser.pre_parse()). - post_parse: function(yy, retval) { return retval; } - optional: is invoked when the parse terminates due to success ('accept') or failure - (even when exceptions are thrown). `retval` contains the return value to be produced - by `Parser.parse()`; this function can override the return value by returning another. - When it does not return any value, the parser will return the original `retval`. - This function is invoked immediately before `Parser.post_parse()`. - parseError: function(str, hash) - optional: overrides the default `parseError` function. - } - - parser.lexer.options: { - ranges: boolean optional: true ==> token location info will include a .range[] member. - flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested - exhaustively to find the longest match. - backtrack_lexer: boolean - optional: true ==> lexer regexes are tested in order and for each matching - regex the action code is invoked; the lexer terminates - the scan when a token is returned by the action code. - pre_lex: function() - optional: is invoked before the lexer is invoked to produce another token. - `this` refers to the Lexer object. - post_lex: function(token) { return token; } - optional: is invoked when the lexer has produced a token `token`; - this function can override the returned token value by returning another. - When it does not return any (truthy) value, the lexer will return the original `token`. - `this` refers to the Lexer object. + expected: (string describing the set of expected tokens) + recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ -var lexParser = (function () { -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript -function JisonParserError(msg, hash) { - this.message = msg; - this.hash = hash; - var stacktrace = (new Error(msg)).stack; - if (stacktrace) { - this.stack = stacktrace; - } -} -JisonParserError.prototype = Object.create(Error.prototype); -JisonParserError.prototype.constructor = JisonParserError; -JisonParserError.prototype.name = 'JisonParserError'; - -function __expand__(k, v, o) { - o = o || {}; - for (var l = k.length; l--; ) { - o[k[l]] = v; - } - return o; -} - -var $V0=[6,12,14,16,18,64], - $V1=[18,25,36,39,41,44,45,49,50,51,54,55,60,62,63], - $V2=[6,12,14,16,18,25,36,40,64], - $V3=[6,12,14,16,18,25,36,39,40,41,44,45,49,50,51,54,55,60,62,63,64], - $V4=[36,40], - $V5=[6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,60,61,62,63,64], - $V6=[6,12,14,16,18,21,64], - $V7=[6,9,12,14,16,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63,64,71], - $V8=[6,9,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63], - $V9=[54,57], - $Va=[9,71], - $Vb=[25,27]; - -var parser = { -trace: function trace() { }, -JisonParserError: JisonParserError, +var parser = (function(){ +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,12,14,16,18,64,73],$V1=[2,6],$V2=[1,5],$V3=[1,6],$V4=[1,7],$V5=[1,8],$V6=[1,12],$V7=[1,11],$V8=[2,38],$V9=[1,19],$Va=[1,20],$Vb=[1,21],$Vc=[1,22],$Vd=[1,25],$Ve=[1,26],$Vf=[1,27],$Vg=[1,30],$Vh=[1,31],$Vi=[1,34],$Vj=[1,32],$Vk=[1,33],$Vl=[1,43],$Vm=[18,25,36,39,41,44,45,49,50,51,54,55,60,62,63,73],$Vn=[2,31],$Vo=[1,47],$Vp=[1,48],$Vq=[6,12,14,16,18,25,36,40,64,73],$Vr=[6,12,14,16,18,25,36,39,40,41,44,45,49,50,51,54,55,60,62,63,64,73],$Vs=[1,51],$Vt=[1,50],$Vu=[1,52],$Vv=[1,54],$Vw=[36,40],$Vx=[6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,60,61,62,63,64,73],$Vy=[1,61],$Vz=[6,12,14,16,18,21,64,73],$VA=[6,9,12,14,16,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63,64,73,76],$VB=[12,66],$VC=[6,9,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63,73],$VD=[54,57,59],$VE=[9,73],$VF=[2,79],$VG=[1,86],$VH=[32,34],$VI=[9,73,76],$VJ=[25,27],$VK=[2,23],$VL=[1,99],$VM=[1,103],$VN=[1,104],$VO=[25,27,29]; +var parser = {trace: function trace() { }, yy: {}, -symbols_: { - "error": 2, - "lex": 3, - "init": 4, - "definitions": 5, - "%%": 6, - "rules": 7, - "epilogue": 8, - "EOF": 9, - "extra_lexer_module_code": 10, - "definition": 11, - "NAME": 12, - "regex": 13, - "START_INC": 14, - "names_inclusive": 15, - "START_EXC": 16, - "names_exclusive": 17, - "ACTION": 18, - "include_macro_code": 19, - "options": 20, - "START_COND": 21, - "rule": 22, - "start_conditions": 23, - "action": 24, - "{": 25, - "action_body": 26, - "}": 27, - "action_comments_body": 28, - "ACTION_BODY": 29, - "<": 30, - "name_list": 31, - ">": 32, - "*": 33, - ",": 34, - "regex_list": 35, - "|": 36, - "regex_concat": 37, - "regex_base": 38, - "(": 39, - ")": 40, - "SPECIAL_GROUP": 41, - "+": 42, - "?": 43, - "/": 44, - "/!": 45, - "name_expansion": 46, - "range_regex": 47, - "any_group_regex": 48, - ".": 49, - "^": 50, - "$": 51, - "string": 52, - "escape_char": 53, - "NAME_BRACE": 54, - "REGEX_SET_START": 55, - "regex_set": 56, - "REGEX_SET_END": 57, - "regex_set_atom": 58, - "REGEX_SET": 59, - "ESCAPE_CHAR": 60, - "RANGE_REGEX": 61, - "STRING_LIT": 62, - "CHARACTER_LIT": 63, - "OPTIONS": 64, - "option_list": 65, - "OPTIONS_END": 66, - "option": 67, - "=": 68, - "OPTION_VALUE": 69, - "optional_module_code_chunk": 70, - "INCLUDE": 71, - "PATH": 72, - "module_code_chunk": 73, - "CODE": 74, - "$accept": 0, - "$end": 1 -}, -terminals_: { - 2: "error", - 6: "%%", - 9: "EOF", - 12: "NAME", - 14: "START_INC", - 16: "START_EXC", - 18: "ACTION", - 21: "START_COND", - 25: "{", - 27: "}", - 29: "ACTION_BODY", - 30: "<", - 32: ">", - 33: "*", - 34: ",", - 36: "|", - 39: "(", - 40: ")", - 41: "SPECIAL_GROUP", - 42: "+", - 43: "?", - 44: "/", - 45: "/!", - 49: ".", - 50: "^", - 51: "$", - 54: "NAME_BRACE", - 55: "REGEX_SET_START", - 57: "REGEX_SET_END", - 59: "REGEX_SET", - 60: "ESCAPE_CHAR", - 61: "RANGE_REGEX", - 62: "STRING_LIT", - 63: "CHARACTER_LIT", - 64: "OPTIONS", - 66: "OPTIONS_END", - 68: "=", - 69: "OPTION_VALUE", - 71: "INCLUDE", - 72: "PATH", - 74: "CODE" -}, -productions_: [ - 0, - [ - 3, - 5 - ], - [ - 8, - 1 - ], - [ - 8, - 3 - ], - [ - 4, - 0 - ], - [ - 5, - 2 - ], - [ - 5, - 0 - ], - [ - 11, - 2 - ], - [ - 11, - 2 - ], - [ - 11, - 2 - ], - [ - 11, - 1 - ], - [ - 11, - 1 - ], - [ - 11, - 1 - ], - [ - 15, - 1 - ], - [ - 15, - 2 - ], - [ - 17, - 1 - ], - [ - 17, - 2 - ], - [ - 7, - 2 - ], - [ - 7, - 1 - ], - [ - 22, - 3 - ], - [ - 24, - 3 - ], - [ - 24, - 1 - ], - [ - 24, - 1 - ], - [ - 26, - 0 - ], - [ - 26, - 1 - ], - [ - 26, - 5 - ], - [ - 26, - 4 - ], - [ - 28, - 1 - ], - [ - 28, - 2 - ], - [ - 23, - 3 - ], - [ - 23, - 3 - ], - [ - 23, - 0 - ], - [ - 31, - 1 - ], - [ - 31, - 3 - ], - [ - 13, - 1 - ], - [ - 35, - 3 - ], - [ - 35, - 2 - ], - [ - 35, - 1 - ], - [ - 35, - 0 - ], - [ - 37, - 2 - ], - [ - 37, - 1 - ], - [ - 38, - 3 - ], - [ - 38, - 3 - ], - [ - 38, - 2 - ], - [ - 38, - 2 - ], - [ - 38, - 2 - ], - [ - 38, - 2 - ], - [ - 38, - 2 - ], - [ - 38, - 1 - ], - [ - 38, - 2 - ], - [ - 38, - 1 - ], - [ - 38, - 1 - ], - [ - 38, - 1 - ], - [ - 38, - 1 - ], - [ - 38, - 1 - ], - [ - 38, - 1 - ], - [ - 46, - 1 - ], - [ - 48, - 3 - ], - [ - 56, - 2 - ], - [ - 56, - 1 - ], - [ - 58, - 1 - ], - [ - 58, - 1 - ], - [ - 53, - 1 - ], - [ - 47, - 1 - ], - [ - 52, - 1 - ], - [ - 52, - 1 - ], - [ - 20, - 3 - ], - [ - 65, - 2 - ], - [ - 65, - 1 - ], - [ - 67, - 1 - ], - [ - 67, - 3 - ], - [ - 67, - 3 - ], - [ - 10, - 1 - ], - [ - 10, - 3 - ], - [ - 19, - 2 - ], - [ - 19, - 2 - ], - [ - 73, - 1 - ], - [ - 73, - 2 - ], - [ - 70, - 1 - ], - [ - 70, - 0 - ] -], +symbols_: {"error":2,"lex":3,"init":4,"definitions":5,"%%":6,"rules":7,"epilogue":8,"EOF":9,"extra_lexer_module_code":10,"definition":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"ACTION":18,"include_macro_code":19,"options":20,"START_COND":21,"rule":22,"start_conditions":23,"action":24,"{":25,"action_body":26,"}":27,"action_comments_body":28,"ACTION_BODY":29,"<":30,"name_list":31,">":32,"*":33,",":34,"regex_list":35,"|":36,"regex_concat":37,"regex_base":38,"(":39,")":40,"SPECIAL_GROUP":41,"+":42,"?":43,"/":44,"/!":45,"name_expansion":46,"range_regex":47,"any_group_regex":48,".":49,"^":50,"$":51,"string":52,"escape_char":53,"NAME_BRACE":54,"REGEX_SET_START":55,"regex_set":56,"REGEX_SET_END":57,"regex_set_atom":58,"REGEX_SET":59,"ESCAPE_CHAR":60,"RANGE_REGEX":61,"STRING_LIT":62,"CHARACTER_LIT":63,"OPTIONS":64,"option_list":65,"OPTIONS_END":66,"option":67,"NAME[option]":68,"=":69,"OPTION_VALUE[value]":70,"NAME[value]":71,"optional_module_code_chunk":72,"INCLUDE":73,"PATH":74,"module_code_chunk":75,"CODE":76,"$accept":0,"$end":1}, +terminals_: {2:"error",6:"%%",9:"EOF",12:"NAME",14:"START_INC",16:"START_EXC",18:"ACTION",21:"START_COND",25:"{",27:"}",29:"ACTION_BODY",30:"<",32:">",33:"*",34:",",36:"|",39:"(",40:")",41:"SPECIAL_GROUP",42:"+",43:"?",44:"/",45:"/!",49:".",50:"^",51:"$",54:"NAME_BRACE",55:"REGEX_SET_START",57:"REGEX_SET_END",59:"REGEX_SET",60:"ESCAPE_CHAR",61:"RANGE_REGEX",62:"STRING_LIT",63:"CHARACTER_LIT",64:"OPTIONS",66:"OPTIONS_END",68:"NAME[option]",69:"=",70:"OPTION_VALUE[value]",71:"NAME[value]",73:"INCLUDE",74:"PATH",76:"CODE"}, +productions_: [0,[3,5],[8,1],[8,3],[4,0],[5,2],[5,0],[11,2],[11,2],[11,2],[11,1],[11,1],[11,1],[15,1],[15,2],[17,1],[17,2],[7,2],[7,1],[22,3],[24,3],[24,1],[24,1],[26,0],[26,1],[26,5],[26,4],[28,1],[28,2],[23,3],[23,3],[23,0],[31,1],[31,3],[13,1],[35,3],[35,2],[35,1],[35,0],[37,2],[37,1],[38,3],[38,3],[38,2],[38,2],[38,2],[38,2],[38,2],[38,1],[38,2],[38,1],[38,1],[38,1],[38,1],[38,1],[38,1],[46,1],[48,3],[56,2],[56,1],[58,1],[58,1],[53,1],[47,1],[52,1],[52,1],[20,3],[65,2],[65,1],[67,1],[67,3],[67,3],[10,1],[10,3],[19,2],[19,2],[75,1],[75,2],[72,1],[72,0]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { -case 1 : -/*! Production:: lex : init definitions %% rules epilogue */ - +case 1: + this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; @@ -616,29 +94,19 @@ case 1 : delete yy.options; delete yy.actionInclude; return this.$; - -break; -case 2 : -/*! Production:: epilogue : EOF */ - case 12 : -/*! Production:: definition : options */ - this.$ = null; -break; -case 3 : -/*! Production:: epilogue : %% extra_lexer_module_code EOF */ - case 20 : -/*! Production:: action : { action_body } */ - case 29 : -/*! Production:: start_conditions : < name_list > */ - this.$ = $$[$0-1]; -break; -case 4 : -/*! Production:: init : */ - yy.actionInclude = ''; -break; -case 5 : -/*! Production:: definitions : definition definitions */ - + +break; +case 2: case 12: + this.$ = null; +break; +case 3: case 20: case 29: + this.$ = $$[$0-1]; +break; +case 4: + yy.actionInclude = ''; +break; +case 5: + this.$ = $$[$0]; if ($$[$0-1] != null) { if ('length' in $$[$0-1]) { @@ -651,1608 +119,153 @@ case 5 : } } } - -break; -case 6 : -/*! Production:: definitions : */ - this.$ = [null, null]; -break; -case 7 : -/*! Production:: definition : NAME regex */ - this.$ = [$$[$0-1], $$[$0]]; -break; -case 8 : -/*! Production:: definition : START_INC names_inclusive */ - case 9 : -/*! Production:: definition : START_EXC names_exclusive */ - case 21 : -/*! Production:: action : ACTION */ - case 22 : -/*! Production:: action : include_macro_code */ - case 24 : -/*! Production:: action_body : action_comments_body */ - case 27 : -/*! Production:: action_comments_body : ACTION_BODY */ - case 62 : -/*! Production:: escape_char : ESCAPE_CHAR */ - case 63 : -/*! Production:: range_regex : RANGE_REGEX */ - case 72 : -/*! Production:: extra_lexer_module_code : optional_module_code_chunk */ - case 76 : -/*! Production:: module_code_chunk : CODE */ - case 78 : -/*! Production:: optional_module_code_chunk : module_code_chunk */ - this.$ = $$[$0]; -break; -case 10 : -/*! Production:: definition : ACTION */ - case 11 : -/*! Production:: definition : include_macro_code */ - yy.actionInclude += $$[$0]; this.$ = null; -break; -case 13 : -/*! Production:: names_inclusive : START_COND */ - this.$ = {}; this.$[$$[$0]] = 0; -break; -case 14 : -/*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0-1]; this.$[$$[$0]] = 0; -break; -case 15 : -/*! Production:: names_exclusive : START_COND */ - this.$ = {}; this.$[$$[$0]] = 1; -break; -case 16 : -/*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0-1]; this.$[$$[$0]] = 1; -break; -case 17 : -/*! Production:: rules : rules rule */ - this.$ = $$[$0-1]; this.$.push($$[$0]); -break; -case 18 : -/*! Production:: rules : rule */ - case 32 : -/*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; -break; -case 19 : -/*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; -break; -case 23 : -/*! Production:: action_body : */ - case 38 : -/*! Production:: regex_list : */ - case 79 : -/*! Production:: optional_module_code_chunk : */ - this.$ = ''; -break; -case 25 : -/*! Production:: action_body : action_body { action_body } action_comments_body */ - this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 26 : -/*! Production:: action_body : action_body { action_body } */ - this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 28 : -/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - case 39 : -/*! Production:: regex_concat : regex_concat regex_base */ - case 49 : -/*! Production:: regex_base : regex_base range_regex */ - case 58 : -/*! Production:: regex_set : regex_set_atom regex_set */ - case 77 : -/*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = $$[$0-1] + $$[$0]; -break; -case 30 : -/*! Production:: start_conditions : < * > */ - this.$ = ['*']; -break; -case 33 : -/*! Production:: name_list : name_list , NAME */ - this.$ = $$[$0-2]; this.$.push($$[$0]); -break; -case 34 : -/*! Production:: regex : regex_list */ - + +break; +case 6: + this.$ = [null, null]; +break; +case 7: + this.$ = [$$[$0-1], $$[$0]]; +break; +case 8: case 9: case 21: case 22: case 24: case 27: case 62: case 63: case 72: case 76: case 78: + this.$ = $$[$0]; +break; +case 10: case 11: + yy.actionInclude += $$[$0]; this.$ = null; +break; +case 13: + this.$ = {}; this.$[$$[$0]] = 0; +break; +case 14: + this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +break; +case 15: + this.$ = {}; this.$[$$[$0]] = 1; +break; +case 16: + this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +break; +case 17: + this.$ = $$[$0-1]; this.$.push($$[$0]); +break; +case 18: case 32: + this.$ = [$$[$0]]; +break; +case 19: + this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; +break; +case 23: case 38: case 79: + this.$ = ''; +break; +case 25: + this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 26: + this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 28: case 39: case 49: case 58: case 77: + this.$ = $$[$0-1] + $$[$0]; +break; +case 30: + this.$ = ['*']; +break; +case 33: + this.$ = $$[$0-2]; this.$.push($$[$0]); +break; +case 34: + this.$ = $$[$0]; if (yy.options && yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { this.$ += "\\b"; } - -break; -case 35 : -/*! Production:: regex_list : regex_list | regex_concat */ - this.$ = $$[$0-2] + '|' + $$[$0]; -break; -case 36 : -/*! Production:: regex_list : regex_list | */ - this.$ = $$[$0-1] + '|'; -break; -case 41 : -/*! Production:: regex_base : ( regex_list ) */ - this.$ = '(' + $$[$0-1] + ')'; -break; -case 42 : -/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ - this.$ = $$[$0-2] + $$[$0-1] + ')'; -break; -case 43 : -/*! Production:: regex_base : regex_base + */ - this.$ = $$[$0-1] + '+'; -break; -case 44 : -/*! Production:: regex_base : regex_base * */ - this.$ = $$[$0-1] + '*'; -break; -case 45 : -/*! Production:: regex_base : regex_base ? */ - this.$ = $$[$0-1] + '?'; -break; -case 46 : -/*! Production:: regex_base : / regex_base */ - this.$ = '(?=' + $$[$0] + ')'; -break; -case 47 : -/*! Production:: regex_base : /! regex_base */ - this.$ = '(?!' + $$[$0] + ')'; -break; -case 51 : -/*! Production:: regex_base : . */ - this.$ = '.'; -break; -case 52 : -/*! Production:: regex_base : ^ */ - this.$ = '^'; -break; -case 53 : -/*! Production:: regex_base : $ */ - this.$ = '$'; -break; -case 57 : -/*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ - case 73 : -/*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 61 : -/*! Production:: regex_set_atom : name_expansion */ - this.$ = '{[' + $$[$0] + ']}'; -break; -case 64 : -/*! Production:: string : STRING_LIT */ - this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); -break; -case 69 : -/*! Production:: option : NAME */ - yy.options[$$[$0]] = true; -break; -case 70 : -/*! Production:: option : NAME = OPTION_VALUE */ - case 71 : -/*! Production:: option : NAME = NAME */ - yy.options[$$[$0-2]] = $$[$0]; -break; -case 74 : -/*! Production:: include_macro_code : INCLUDE PATH */ - + +break; +case 35: + this.$ = $$[$0-2] + '|' + $$[$0]; +break; +case 36: + this.$ = $$[$0-1] + '|'; +break; +case 41: + this.$ = '(' + $$[$0-1] + ')'; +break; +case 42: + this.$ = $$[$0-2] + $$[$0-1] + ')'; +break; +case 43: + this.$ = $$[$0-1] + '+'; +break; +case 44: + this.$ = $$[$0-1] + '*'; +break; +case 45: + this.$ = $$[$0-1] + '?'; +break; +case 46: + this.$ = '(?=' + $$[$0] + ')'; +break; +case 47: + this.$ = '(?!' + $$[$0] + ')'; +break; +case 51: + this.$ = '.'; +break; +case 52: + this.$ = '^'; +break; +case 53: + this.$ = '$'; +break; +case 57: case 73: + this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 61: + this.$ = '{[' + $$[$0] + ']}'; +break; +case 64: + this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); +break; +case 69: + yy.options[$$[$0]] = true; +break; +case 70: case 71: + yy.options[$$[$0-2]] = $$[$0]; +break; +case 74: + var fs = require('fs'); var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); // And no, we don't support nested '%include': this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; - + break; -case 75 : -/*! Production:: include_macro_code : INCLUDE error */ - +case 75: + console.error("%include MUST be followed by a valid file path"); - + break; } }, -table: [ - __expand__($V0, [ - 2, - 4 - ], {3:1,4:2,71:[ - 2, - 4 - ] - }), - { - 1: [ - 3 - ] - }, - { - 5: 3, - 6: [ - 2, - 6 - ], - 11: 4, - 12: [ - 1, - 5 - ], - 14: [ - 1, - 6 - ], - 16: [ - 1, - 7 - ], - 18: [ - 1, - 8 - ], - 19: 9, - 20: 10, - 64: [ - 1, - 12 - ], - 71: [ - 1, - 11 - ] - }, - { - 6: [ - 1, - 13 - ] - }, - { - 5: 14, - 6: [ - 2, - 6 - ], - 11: 4, - 12: [ - 1, - 5 - ], - 14: [ - 1, - 6 - ], - 16: [ - 1, - 7 - ], - 18: [ - 1, - 8 - ], - 19: 9, - 20: 10, - 64: [ - 1, - 12 - ], - 71: [ - 1, - 11 - ] - }, - __expand__([6,12,14,16,18,36,64], [ - 2, - 38 - ], {13:15,35:16,37:17,38:18,46:23,48:24,52:28,53:29,39:[ - 1, - 19 - ],41:[ - 1, - 20 - ],44:[ - 1, - 21 - ],45:[ - 1, - 22 - ],49:[ - 1, - 25 - ],50:[ - 1, - 26 - ],51:[ - 1, - 27 - ],54:[ - 1, - 30 - ],55:[ - 1, - 31 - ],60:[ - 1, - 34 - ],62:[ - 1, - 32 - ],63:[ - 1, - 33 - ],71:[ - 2, - 38 - ] - }), - { - 15: 35, - 21: [ - 1, - 36 - ] - }, - { - 17: 37, - 21: [ - 1, - 38 - ] - }, - __expand__($V0, [ - 2, - 10 - ], {71:[ - 2, - 10 - ] - }), - __expand__($V0, [ - 2, - 11 - ], {71:[ - 2, - 11 - ] - }), - __expand__($V0, [ - 2, - 12 - ], {71:[ - 2, - 12 - ] - }), - { - 2: [ - 1, - 40 - ], - 72: [ - 1, - 39 - ] - }, - { - 12: [ - 1, - 43 - ], - 65: 41, - 67: 42 - }, - __expand__($V1, [ - 2, - 31 - ], {7:44,22:45,23:46,30:[ - 1, - 47 - ],71:[ - 2, - 31 - ] - }), - { - 6: [ - 2, - 5 - ] - }, - __expand__($V0, [ - 2, - 7 - ], {71:[ - 2, - 7 - ] - }), - __expand__([6,12,14,16,18,25,64], [ - 2, - 34 - ], {36:[ - 1, - 48 - ],71:[ - 2, - 34 - ] - }), - __expand__($V2, [ - 2, - 37 - ], {46:23,48:24,52:28,53:29,38:49,39:[ - 1, - 19 - ],41:[ - 1, - 20 - ],44:[ - 1, - 21 - ],45:[ - 1, - 22 - ],49:[ - 1, - 25 - ],50:[ - 1, - 26 - ],51:[ - 1, - 27 - ],54:[ - 1, - 30 - ],55:[ - 1, - 31 - ],60:[ - 1, - 34 - ],62:[ - 1, - 32 - ],63:[ - 1, - 33 - ],71:[ - 2, - 37 - ] - }), - __expand__($V3, [ - 2, - 40 - ], {47:53,33:[ - 1, - 51 - ],42:[ - 1, - 50 - ],43:[ - 1, - 52 - ],61:[ - 1, - 54 - ],71:[ - 2, - 40 - ] - }), - __expand__($V4, [ - 2, - 38 - ], {37:17,38:18,46:23,48:24,52:28,53:29,35:55,39:[ - 1, - 19 - ],41:[ - 1, - 20 - ],44:[ - 1, - 21 - ],45:[ - 1, - 22 - ],49:[ - 1, - 25 - ],50:[ - 1, - 26 - ],51:[ - 1, - 27 - ],54:[ - 1, - 30 - ],55:[ - 1, - 31 - ],60:[ - 1, - 34 - ],62:[ - 1, - 32 - ],63:[ - 1, - 33 - ] - }), - __expand__($V4, [ - 2, - 38 - ], {37:17,38:18,46:23,48:24,52:28,53:29,35:56,39:[ - 1, - 19 - ],41:[ - 1, - 20 - ],44:[ - 1, - 21 - ],45:[ - 1, - 22 - ],49:[ - 1, - 25 - ],50:[ - 1, - 26 - ],51:[ - 1, - 27 - ],54:[ - 1, - 30 - ],55:[ - 1, - 31 - ],60:[ - 1, - 34 - ],62:[ - 1, - 32 - ],63:[ - 1, - 33 - ] - }), - { - 38: 57, - 39: [ - 1, - 19 - ], - 41: [ - 1, - 20 - ], - 44: [ - 1, - 21 - ], - 45: [ - 1, - 22 - ], - 46: 23, - 48: 24, - 49: [ - 1, - 25 - ], - 50: [ - 1, - 26 - ], - 51: [ - 1, - 27 - ], - 52: 28, - 53: 29, - 54: [ - 1, - 30 - ], - 55: [ - 1, - 31 - ], - 60: [ - 1, - 34 - ], - 62: [ - 1, - 32 - ], - 63: [ - 1, - 33 - ] - }, - { - 38: 58, - 39: [ - 1, - 19 - ], - 41: [ - 1, - 20 - ], - 44: [ - 1, - 21 - ], - 45: [ - 1, - 22 - ], - 46: 23, - 48: 24, - 49: [ - 1, - 25 - ], - 50: [ - 1, - 26 - ], - 51: [ - 1, - 27 - ], - 52: 28, - 53: 29, - 54: [ - 1, - 30 - ], - 55: [ - 1, - 31 - ], - 60: [ - 1, - 34 - ], - 62: [ - 1, - 32 - ], - 63: [ - 1, - 33 - ] - }, - __expand__($V5, [ - 2, - 48 - ], {71:[ - 2, - 48 - ] - }), - __expand__($V5, [ - 2, - 50 - ], {71:[ - 2, - 50 - ] - }), - __expand__($V5, [ - 2, - 51 - ], {71:[ - 2, - 51 - ] - }), - __expand__($V5, [ - 2, - 52 - ], {71:[ - 2, - 52 - ] - }), - __expand__($V5, [ - 2, - 53 - ], {71:[ - 2, - 53 - ] - }), - __expand__($V5, [ - 2, - 54 - ], {71:[ - 2, - 54 - ] - }), - __expand__($V5, [ - 2, - 55 - ], {71:[ - 2, - 55 - ] - }), - __expand__([6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,57,59,60,61,62,63,64], [ - 2, - 56 - ], {71:[ - 2, - 56 - ] - }), - { - 46: 62, - 54: [ - 1, - 30 - ], - 56: 59, - 58: 60, - 59: [ - 1, - 61 - ] - }, - __expand__($V5, [ - 2, - 64 - ], {71:[ - 2, - 64 - ] - }), - __expand__($V5, [ - 2, - 65 - ], {71:[ - 2, - 65 - ] - }), - __expand__($V5, [ - 2, - 62 - ], {71:[ - 2, - 62 - ] - }), - __expand__($V0, [ - 2, - 8 - ], {21:[ - 1, - 63 - ],71:[ - 2, - 8 - ] - }), - __expand__($V6, [ - 2, - 13 - ], {71:[ - 2, - 13 - ] - }), - __expand__($V0, [ - 2, - 9 - ], {21:[ - 1, - 64 - ],71:[ - 2, - 9 - ] - }), - __expand__($V6, [ - 2, - 15 - ], {71:[ - 2, - 15 - ] - }), - __expand__($V7, [ - 2, - 74 - ], {74:[ - 2, - 74 - ] - }), - __expand__($V7, [ - 2, - 75 - ], {74:[ - 2, - 75 - ] - }), - { - 66: [ - 1, - 65 - ] - }, - { - 12: [ - 1, - 43 - ], - 65: 66, - 66: [ - 2, - 68 - ], - 67: 42 - }, - __expand__([12,66], [ - 2, - 69 - ], {68:[ - 1, - 67 - ] - }), - __expand__($V1, [ - 2, - 31 - ], {23:46,8:68,22:69,6:[ - 1, - 71 - ],9:[ - 1, - 70 - ],30:[ - 1, - 47 - ],71:[ - 2, - 31 - ] - }), - __expand__($V8, [ - 2, - 18 - ], {71:[ - 2, - 18 - ] - }), - __expand__([18,25,36], [ - 2, - 38 - ], {35:16,37:17,38:18,46:23,48:24,52:28,53:29,13:72,39:[ - 1, - 19 - ],41:[ - 1, - 20 - ],44:[ - 1, - 21 - ],45:[ - 1, - 22 - ],49:[ - 1, - 25 - ],50:[ - 1, - 26 - ],51:[ - 1, - 27 - ],54:[ - 1, - 30 - ],55:[ - 1, - 31 - ],60:[ - 1, - 34 - ],62:[ - 1, - 32 - ],63:[ - 1, - 33 - ],71:[ - 2, - 38 - ] - }), - { - 12: [ - 1, - 75 - ], - 31: 73, - 33: [ - 1, - 74 - ] - }, - __expand__($V2, [ - 2, - 36 - ], {38:18,46:23,48:24,52:28,53:29,37:76,39:[ - 1, - 19 - ],41:[ - 1, - 20 - ],44:[ - 1, - 21 - ],45:[ - 1, - 22 - ],49:[ - 1, - 25 - ],50:[ - 1, - 26 - ],51:[ - 1, - 27 - ],54:[ - 1, - 30 - ],55:[ - 1, - 31 - ],60:[ - 1, - 34 - ],62:[ - 1, - 32 - ],63:[ - 1, - 33 - ],71:[ - 2, - 36 - ] - }), - __expand__($V3, [ - 2, - 39 - ], {47:53,33:[ - 1, - 51 - ],42:[ - 1, - 50 - ],43:[ - 1, - 52 - ],61:[ - 1, - 54 - ],71:[ - 2, - 39 - ] - }), - __expand__($V5, [ - 2, - 43 - ], {71:[ - 2, - 43 - ] - }), - __expand__($V5, [ - 2, - 44 - ], {71:[ - 2, - 44 - ] - }), - __expand__($V5, [ - 2, - 45 - ], {71:[ - 2, - 45 - ] - }), - __expand__($V5, [ - 2, - 49 - ], {71:[ - 2, - 49 - ] - }), - __expand__($V5, [ - 2, - 63 - ], {71:[ - 2, - 63 - ] - }), - { - 36: [ - 1, - 48 - ], - 40: [ - 1, - 77 - ] - }, - { - 36: [ - 1, - 48 - ], - 40: [ - 1, - 78 - ] - }, - __expand__($V3, [ - 2, - 46 - ], {47:53,33:[ - 1, - 51 - ],42:[ - 1, - 50 - ],43:[ - 1, - 52 - ],61:[ - 1, - 54 - ],71:[ - 2, - 46 - ] - }), - __expand__($V3, [ - 2, - 47 - ], {47:53,33:[ - 1, - 51 - ],42:[ - 1, - 50 - ],43:[ - 1, - 52 - ],61:[ - 1, - 54 - ],71:[ - 2, - 47 - ] - }), - { - 57: [ - 1, - 79 - ] - }, - { - 46: 62, - 54: [ - 1, - 30 - ], - 56: 80, - 57: [ - 2, - 59 - ], - 58: 60, - 59: [ - 1, - 61 - ] - }, - __expand__($V9, [ - 2, - 60 - ], {59:[ - 2, - 60 - ] - }), - __expand__($V9, [ - 2, - 61 - ], {59:[ - 2, - 61 - ] - }), - __expand__($V6, [ - 2, - 14 - ], {71:[ - 2, - 14 - ] - }), - __expand__($V6, [ - 2, - 16 - ], {71:[ - 2, - 16 - ] - }), - __expand__($V0, [ - 2, - 66 - ], {71:[ - 2, - 66 - ] - }), - { - 66: [ - 2, - 67 - ] - }, - { - 12: [ - 1, - 82 - ], - 69: [ - 1, - 81 - ] - }, - { - 1: [ - 2, - 1 - ] - }, - __expand__($V8, [ - 2, - 17 - ], {71:[ - 2, - 17 - ] - }), - { - 1: [ - 2, - 2 - ] - }, - __expand__($Va, [ - 2, - 79 - ], {10:83,70:84,73:85,74:[ - 1, - 86 - ] - }), - { - 18: [ - 1, - 89 - ], - 19: 90, - 24: 87, - 25: [ - 1, - 88 - ], - 71: [ - 1, - 11 - ] - }, - { - 32: [ - 1, - 91 - ], - 34: [ - 1, - 92 - ] - }, - { - 32: [ - 1, - 93 - ] - }, - { - 32: [ - 2, - 32 - ], - 34: [ - 2, - 32 - ] - }, - __expand__($V2, [ - 2, - 35 - ], {46:23,48:24,52:28,53:29,38:49,39:[ - 1, - 19 - ],41:[ - 1, - 20 - ],44:[ - 1, - 21 - ],45:[ - 1, - 22 - ],49:[ - 1, - 25 - ],50:[ - 1, - 26 - ],51:[ - 1, - 27 - ],54:[ - 1, - 30 - ],55:[ - 1, - 31 - ],60:[ - 1, - 34 - ],62:[ - 1, - 32 - ],63:[ - 1, - 33 - ],71:[ - 2, - 35 - ] - }), - __expand__($V5, [ - 2, - 41 - ], {71:[ - 2, - 41 - ] - }), - __expand__($V5, [ - 2, - 42 - ], {71:[ - 2, - 42 - ] - }), - __expand__($V5, [ - 2, - 57 - ], {71:[ - 2, - 57 - ] - }), - { - 57: [ - 2, - 58 - ] - }, - { - 12: [ - 2, - 70 - ], - 66: [ - 2, - 70 - ] - }, - { - 12: [ - 2, - 71 - ], - 66: [ - 2, - 71 - ] - }, - { - 9: [ - 1, - 94 - ] - }, - { - 9: [ - 2, - 72 - ], - 19: 95, - 71: [ - 1, - 11 - ] - }, - __expand__($Va, [ - 2, - 78 - ], {74:[ - 1, - 96 - ] - }), - __expand__($Va, [ - 2, - 76 - ], {74:[ - 2, - 76 - ] - }), - __expand__($V8, [ - 2, - 19 - ], {71:[ - 2, - 19 - ] - }), - __expand__($Vb, [ - 2, - 23 - ], {26:97,28:98,29:[ - 1, - 99 - ] - }), - __expand__($V8, [ - 2, - 21 - ], {71:[ - 2, - 21 - ] - }), - __expand__($V8, [ - 2, - 22 - ], {71:[ - 2, - 22 - ] - }), - __expand__($V1, [ - 2, - 29 - ], {71:[ - 2, - 29 - ] - }), - { - 12: [ - 1, - 100 - ] - }, - __expand__($V1, [ - 2, - 30 - ], {71:[ - 2, - 30 - ] - }), - { - 1: [ - 2, - 3 - ] - }, - __expand__($Va, [ - 2, - 79 - ], {70:84,73:85,10:101,74:[ - 1, - 86 - ] - }), - __expand__($Va, [ - 2, - 77 - ], {74:[ - 2, - 77 - ] - }), - { - 25: [ - 1, - 103 - ], - 27: [ - 1, - 102 - ] - }, - __expand__($Vb, [ - 2, - 24 - ], {29:[ - 1, - 104 - ] - }), - __expand__($Vb, [ - 2, - 27 - ], {29:[ - 2, - 27 - ] - }), - { - 32: [ - 2, - 33 - ], - 34: [ - 2, - 33 - ] - }, - { - 9: [ - 2, - 73 - ] - }, - __expand__($V8, [ - 2, - 20 - ], {71:[ - 2, - 20 - ] - }), - __expand__($Vb, [ - 2, - 23 - ], {28:98,26:105,29:[ - 1, - 99 - ] - }), - __expand__($Vb, [ - 2, - 28 - ], {29:[ - 2, - 28 - ] - }), - { - 25: [ - 1, - 103 - ], - 27: [ - 1, - 106 - ] - }, - __expand__($Vb, [ - 2, - 26 - ], {28:107,29:[ - 1, - 99 - ] - }), - __expand__($Vb, [ - 2, - 25 - ], {29:[ - 1, - 104 - ] - }) -], -defaultActions: { - 14: [ - 2, - 5 - ], - 66: [ - 2, - 67 - ], - 68: [ - 2, - 1 - ], - 70: [ - 2, - 2 - ], - 80: [ - 2, - 58 - ], - 94: [ - 2, - 3 - ], - 101: [ - 2, - 73 - ] -}, +table: [o($V0,[2,4],{3:1,4:2}),{1:[3]},{5:3,6:$V1,11:4,12:$V2,14:$V3,16:$V4,18:$V5,19:9,20:10,64:$V6,73:$V7},{6:[1,13]},{5:14,6:$V1,11:4,12:$V2,14:$V3,16:$V4,18:$V5,19:9,20:10,64:$V6,73:$V7},o([6,12,14,16,18,36,64,73],$V8,{13:15,35:16,37:17,38:18,46:23,48:24,52:28,53:29,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),{15:35,21:[1,36]},{17:37,21:[1,38]},o($V0,[2,10]),o($V0,[2,11]),o($V0,[2,12]),{2:[1,40],74:[1,39]},{12:$Vl,65:41,67:42},o($Vm,$Vn,{7:44,22:45,23:46,30:$Vo}),{6:[2,5]},o($V0,[2,7]),o([6,12,14,16,18,25,64,73],[2,34],{36:$Vp}),o($Vq,[2,37],{46:23,48:24,52:28,53:29,38:49,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),o($Vr,[2,40],{47:53,33:$Vs,42:$Vt,43:$Vu,61:$Vv}),o($Vw,$V8,{37:17,38:18,46:23,48:24,52:28,53:29,35:55,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),o($Vw,$V8,{37:17,38:18,46:23,48:24,52:28,53:29,35:56,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),{38:57,39:$V9,41:$Va,44:$Vb,45:$Vc,46:23,48:24,49:$Vd,50:$Ve,51:$Vf,52:28,53:29,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk},{38:58,39:$V9,41:$Va,44:$Vb,45:$Vc,46:23,48:24,49:$Vd,50:$Ve,51:$Vf,52:28,53:29,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk},o($Vx,[2,48]),o($Vx,[2,50]),o($Vx,[2,51]),o($Vx,[2,52]),o($Vx,[2,53]),o($Vx,[2,54]),o($Vx,[2,55]),o([6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,57,59,60,61,62,63,64,73],[2,56]),{46:62,54:$Vg,56:59,58:60,59:$Vy},o($Vx,[2,64]),o($Vx,[2,65]),o($Vx,[2,62]),o($V0,[2,8],{21:[1,63]}),o($Vz,[2,13]),o($V0,[2,9],{21:[1,64]}),o($Vz,[2,15]),o($VA,[2,74]),o($VA,[2,75]),{66:[1,65]},{12:$Vl,65:66,66:[2,68],67:42},o($VB,[2,69],{69:[1,67]}),o($Vm,$Vn,{23:46,8:68,22:69,6:[1,71],9:[1,70],30:$Vo}),o($VC,[2,18]),o([18,25,36,73],$V8,{35:16,37:17,38:18,46:23,48:24,52:28,53:29,13:72,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),{12:[1,75],31:73,33:[1,74]},o($Vq,[2,36],{38:18,46:23,48:24,52:28,53:29,37:76,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),o($Vr,[2,39],{47:53,33:$Vs,42:$Vt,43:$Vu,61:$Vv}),o($Vx,[2,43]),o($Vx,[2,44]),o($Vx,[2,45]),o($Vx,[2,49]),o($Vx,[2,63]),{36:$Vp,40:[1,77]},{36:$Vp,40:[1,78]},o($Vr,[2,46],{47:53,33:$Vs,42:$Vt,43:$Vu,61:$Vv}),o($Vr,[2,47],{47:53,33:$Vs,42:$Vt,43:$Vu,61:$Vv}),{57:[1,79]},{46:62,54:$Vg,56:80,57:[2,59],58:60,59:$Vy},o($VD,[2,60]),o($VD,[2,61]),o($Vz,[2,14]),o($Vz,[2,16]),o($V0,[2,66]),{66:[2,67]},{12:[1,82],"undefined":[1,81]},{1:[2,1]},o($VC,[2,17]),{1:[2,2]},o($VE,$VF,{10:83,72:84,75:85,76:$VG}),{18:[1,89],19:90,24:87,25:[1,88],73:$V7},{32:[1,91],34:[1,92]},{32:[1,93]},o($VH,[2,32]),o($Vq,[2,35],{46:23,48:24,52:28,53:29,38:49,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),o($Vx,[2,41]),o($Vx,[2,42]),o($Vx,[2,57]),{57:[2,58]},o($VB,[2,70]),o($VB,[2,71]),{9:[1,94]},{9:[2,72],19:95,73:$V7},o($VE,[2,78],{76:[1,96]}),o($VI,[2,76]),o($VC,[2,19]),o($VJ,$VK,{26:97,28:98,29:$VL}),o($VC,[2,21]),o($VC,[2,22]),o($Vm,[2,29]),{12:[1,100]},o($Vm,[2,30]),{1:[2,3]},o($VE,$VF,{72:84,75:85,10:101,76:$VG}),o($VI,[2,77]),{25:$VM,27:[1,102]},o($VJ,[2,24],{29:$VN}),o($VO,[2,27]),o($VH,[2,33]),{9:[2,73]},o($VC,[2,20]),o($VJ,$VK,{28:98,26:105,29:$VL}),o($VO,[2,28]),{25:$VM,27:[1,106]},o($VJ,[2,26],{28:107,29:$VL}),o($VJ,[2,25],{29:$VN})], +defaultActions: {14:[2,5],66:[2,67],68:[2,1],70:[2,2],80:[2,58],94:[2,3],101:[2,73]}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { - throw new this.JisonParserError(str, hash); + throw new Error(str); } }, parse: function parse(input) { var self = this, stack = [0], - - vstack = [null], // semantic value stack - lstack = [], // location stack + tstack = [], // token stack + vstack = [null], // semantic value stack + lstack = [], // location stack table = this.table, yytext = '', yylineno = 0, yyleng = 0, - recovering = 0, // (only used when the grammar contains error recovery rules) + recovering = 0, TERROR = 2, EOF = 1; @@ -2260,16 +273,8 @@ parse: function parse(input) { //this.reductionCount = this.shiftCount = 0; - var lexer; - if (this.__lexer__) { - lexer = this.__lexer__; - } else { - lexer = this.__lexer__ = Object.create(this.lexer); - } - - var sharedState = { - yy: {} - }; + var lexer = Object.create(this.lexer); + var sharedState = { yy: {} }; // copy state for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { @@ -2280,7 +285,7 @@ parse: function parse(input) { lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; - if (typeof lexer.yylloc === 'undefined') { + if (typeof lexer.yylloc == 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; @@ -2288,17 +293,19 @@ parse: function parse(input) { var ranges = lexer.options && lexer.options.ranges; - // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; - } + } else { + this.parseError = Object.getPrototypeOf(this).parseError; + } - function popStack(n) { + function popStack (n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } +_token_stack: function lex() { var token; token = lexer.lex() || EOF; @@ -2309,166 +316,112 @@ parse: function parse(input) { return token; } - var symbol; - var preErrorSymbol = null; - var state, action, a, r; - var yyval = {}; - var p, len, len1, this_production, lstack_begin, lstack_end, newState; - var expected = []; - var retval = false; + var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; + while (true) { + // retreive state number from top of stack + state = stack[stack.length - 1]; - if (this.pre_parse) { - this.pre_parse.call(this, sharedState.yy); - } - if (sharedState.yy.pre_parse) { - sharedState.yy.pre_parse.call(this, sharedState.yy); - } - - // Return the rule stack depth where the nearest error rule can be found. - // Return FALSE when no error recovery rule was found. - function locateNearestErrorRecoveryRule(state) { - var stack_probe = stack.length - 1; - var depth = 0; - - // try to recover from error - for (;;) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - return depth; - } - if (state === 0 || stack_probe < 2) { - return false; // No suitable error recovery rule available. - } - stack_probe -= 2; // popStack(1): [symbol, action] - state = stack[stack_probe]; - ++depth; - } - } - - - function collect_expected_token_set(state) { - var tokenset = []; - for (var p in table[state]) { - if (p > TERROR) { - if (self.terminal_descriptions_ && self.terminal_descriptions_[p]) { - tokenset.push(self.terminal_descriptions_[p]); - } - else if (self.terminals_[p]) { - tokenset.push("'" + self.terminals_[p] + "'"); - } + // use default actions if available + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol == 'undefined') { + symbol = lex(); } + // read action for current state and first input + action = table[state] && table[state][symbol]; } - return tokenset; - } - - try { - for (;;) { - // retrieve state number from top of stack - state = stack[stack.length - 1]; - - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol === 'undefined') { - symbol = lex(); - } - // read action for current state and first input - action = table[state] && table[state][symbol]; - } - // handle parse error - if (typeof action === 'undefined' || !action.length || !action[0]) { - var error_rule_depth; - var errStr = ''; +_handle_error: + // handle parse error + if (typeof action === 'undefined' || !action.length || !action[0]) { + var error_rule_depth; + var errStr = ''; - if (!recovering) { - // first see if there's any chance at hitting an error recovery rule: - error_rule_depth = locateNearestErrorRecoveryRule(state); + // Return the rule stack depth where the nearest error rule can be found. + // Return FALSE when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = stack.length - 1; + var depth = 0; - // Report error - expected = collect_expected_token_set(state); - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; - } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + - (symbol === EOF ? 'end of input' : - ("'" + (this.terminals_[symbol] || symbol) + "'")); + // try to recover from error + for(;;) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + return depth; } - a = this.parseError(errStr, p = { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: (error_rule_depth !== false) - }); - if (!p.recoverable) { - retval = a; - break; + if (state === 0 || stack_probe < 2) { + return false; // No suitable error recovery rule available. } - } else if (preErrorSymbol !== EOF) { - error_rule_depth = locateNearestErrorRecoveryRule(state); + stack_probe -= 2; // popStack(1): [symbol, action] + state = stack[stack_probe]; + ++depth; } + } - // just recovered from another error - if (recovering === 3) { - if (symbol === EOF || preErrorSymbol === EOF) { - retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; - } + if (!recovering) { + // first see if there's any chance at hitting an error recovery rule: + error_rule_depth = locateNearestErrorRecoveryRule(state); - // discard current lookahead and grab another - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - symbol = lex(); + // Report error + expected = []; + for (p in table[state]) { + if (this.terminals_[p] && p > TERROR) { + expected.push("'"+this.terminals_[p]+"'"); + } } - - // try to recover from error - if (error_rule_depth === false) { - retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { - text: lexer.match, - token: this.terminals_[symbol] || symbol, - line: lexer.yylineno, - loc: yyloc, - expected: expected, - recoverable: false - }); - break; + if (lexer.showPosition) { + errStr = 'Parse error on line '+(yylineno+1)+":\n"+lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol)+ "'"; + } else { + errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + + (symbol == EOF ? "end of input" : + ("'"+(this.terminals_[symbol] || symbol)+"'")); } - popStack(error_rule_depth); - - preErrorSymbol = (symbol === TERROR ? null : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length - 1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { + this.parseError(errStr, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected, - recoverable: false + recoverable: (error_rule_depth !== false) }); - break; + } else if (preErrorSymbol !== EOF) { + error_rule_depth = locateNearestErrorRecoveryRule(state); + } + + // just recovered from another error + if (recovering == 3) { + if (symbol === EOF || preErrorSymbol === EOF) { + throw new Error(errStr || 'Parsing halted while starting to recover from another error.'); + } + + // discard current lookahead and grab another + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + symbol = lex(); + } + + // try to recover from error + if (error_rule_depth === false) { + throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.'); } + popStack(error_rule_depth); + + preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length-1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } + + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array && action.length > 1) { + throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); + } - switch (action[0]) { + switch (action[0]) { case 1: // shift //this.shiftCount++; @@ -2477,7 +430,7 @@ parse: function parse(input) { lstack.push(lexer.yylloc); stack.push(action[1]); // push state symbol = null; - if (!preErrorSymbol) { // normal execution / no error + if (!preErrorSymbol) { // normal execution/no error yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; @@ -2490,75 +443,56 @@ parse: function parse(input) { symbol = preErrorSymbol; preErrorSymbol = null; } - continue; + break; case 2: // reduce //this.reductionCount++; - this_production = this.productions_[action[1]]; - len = this_production[1]; - lstack_end = lstack.length; - lstack_begin = lstack_end - (len1 || 1); - lstack_end--; + len = this.productions_[action[1]][1]; // perform semantic action - yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 + yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 // default location, uses first token for firsts, last for lasts yyval._$ = { - first_line: lstack[lstack_begin].first_line, - last_line: lstack[lstack_end].last_line, - first_column: lstack[lstack_begin].first_column, - last_column: lstack[lstack_end].last_column + first_line: lstack[lstack.length-(len||1)].first_line, + last_line: lstack[lstack.length-1].last_line, + first_column: lstack[lstack.length-(len||1)].first_column, + last_column: lstack[lstack.length-1].last_column }; if (ranges) { - yyval._$.range = [lstack[lstack_begin].range[0], lstack[lstack_end].range[1]]; + yyval._$.range = [lstack[lstack.length-(len||1)].range[0], lstack[lstack.length-1].range[1]]; } r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); if (typeof r !== 'undefined') { - retval = r; - break; + return r; } // pop off stack if (len) { - popStack(len); + stack = stack.slice(0,-1*len*2); + vstack = vstack.slice(0, -1*len); + lstack = lstack.slice(0, -1*len); } - stack.push(this_production[0]); // push nonterminal (reduce) + stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) vstack.push(yyval.$); lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; + newState = table[stack[stack.length-2]][stack[stack.length-1]]; stack.push(newState); - continue; + break; case 3: // accept - retval = true; - break; - } - - // break out of loop: we accept or fail with error - break; + return true; } - } finally { - var rv; - if (sharedState.yy.post_parse) { - rv = sharedState.yy.post_parse.call(this, sharedState.yy, retval); - if (typeof rv !== 'undefined') retval = rv; - } - if (this.post_parse) { - rv = this.post_parse.call(this, sharedState.yy, retval); - if (typeof rv !== 'undefined') retval = rv; - } } - return retval; -} -}; + return true; +}}; function encodeRE (s) { @@ -2572,34 +506,17 @@ function prepareString (s) { return s; }; - -/* generated by jison-lex 0.3.4-100 */ -var lexer = (function () { -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript -function JisonLexerError(msg, hash) { - this.message = msg; - this.hash = hash; - var stacktrace = (new Error(msg)).stack; - if (stacktrace) { - this.stack = stacktrace; - } -} -JisonLexerError.prototype = Object.create(Error.prototype); -JisonLexerError.prototype.constructor = JisonLexerError; -JisonLexerError.prototype.name = 'JisonLexerError'; - +/* generated by jison-lex 0.3.4 */ +var lexer = (function(){ var lexer = ({ EOF:1, -ERROR:2, - parseError:function parseError(str, hash) { if (this.yy.parser) { - return this.yy.parser.parseError(str, hash) || this.ERROR; + this.yy.parser.parseError(str, hash); } else { - throw new this.JisonLexerError(str); + throw new Error(str); } }, @@ -2607,7 +524,7 @@ parseError:function parseError(str, hash) { setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; - this._more = this._backtrack = this._signaled_error_token = this.done = false; + this._more = this._backtrack = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; @@ -2618,7 +535,7 @@ setInput:function (input, yy) { last_column: 0 }; if (this.options.ranges) { - this.yylloc.range = [0, 0]; + this.yylloc.range = [0,0]; } this.offset = 0; return this; @@ -2632,30 +549,7 @@ input:function () { this.offset++; this.match += ch; this.matched += ch; - // Count the linenumber up when we hit the LF (or a stand-alone CR). - // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo - // and we advance immediately past the LF as well, returning both together as if - // it was all a single 'character' only. - var slice_len = 1; - var lines = false; - if (ch === '\n') { - lines = true; - } else if (ch === '\r') { - lines = true; - var ch2 = this._input[1]; - if (ch2 === '\n') { - slice_len++; - ch += ch2; - this.yytext += ch2; - this.yyleng++; - this.offset++; - this.match += ch2; - this.matched += ch2; - if (this.options.ranges) { - this.yylloc.range[1]++; - } - } - } + var lines = ch.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno++; this.yylloc.last_line++; @@ -2666,7 +560,7 @@ input:function () { this.yylloc.range[1]++; } - this._input = this._input.slice(slice_len); + this._input = this._input.slice(1); return ch; }, @@ -2680,8 +574,8 @@ unput:function (ch) { //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - len); - this.matched = this.matched.substr(0, this.matched.length - len); + this.match = this.match.substr(0, this.match.length - 1); + this.matched = this.matched.substr(0, this.matched.length - 1); if (lines.length - 1) { this.yylineno -= lines.length - 1; @@ -2694,8 +588,8 @@ unput:function (ch) { first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len }; if (this.options.ranges) { @@ -2716,15 +610,12 @@ reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { - // when the parseError() call returns, we MUST ensure that the error is registered. - // We accomplish this by signaling an 'error' token to be produced for the current - // .lex() run. - this._signaled_error_token = (this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: this.match, + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: "", token: null, - line: this.yylineno, - loc: this.yylloc - }) || this.ERROR); + line: this.yylineno + }); + } return this; }, @@ -2734,34 +625,26 @@ less:function (n) { this.unput(this.match.slice(n)); }, -// return (part of the) already matched input, i.e. for error messages -pastInput:function (maxSize) { +// displays already matched input, i.e. for error messages +pastInput:function () { var past = this.matched.substr(0, this.matched.length - this.match.length); - if (maxSize < 0) - maxSize = past.length; - else if (!maxSize) - maxSize = 20; - return (past.length > maxSize ? '...' + past.substr(-maxSize) : past); + return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); }, -// return (part of the) upcoming input, i.e. for error messages -upcomingInput:function (maxSize) { +// displays upcoming input, i.e. for error messages +upcomingInput:function () { var next = this.match; - if (maxSize < 0) - maxSize = next.length + this._input.length; - else if (!maxSize) - maxSize = 20; - if (next.length < maxSize) { - next += this._input.substr(0, maxSize - next.length); + if (next.length < 20) { + next += this._input.substr(0, 20-next.length); } - return (next.length > maxSize ? next.substr(0, maxSize) + '...' : next); + return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); }, -// return a string which displays the character position where the lexing error occurred, i.e. for error messages +// displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { - var pre = this.pastInput().replace(/\s/g, ' '); - var c = new Array(pre.length + 1).join('-'); - return pre + this.upcomingInput().replace(/\s/g, ' ') + '\n' + c + '^'; + var pre = this.pastInput(); + var c = new Array(pre.length + 1).join("-"); + return pre + this.upcomingInput() + "\n" + c + "^"; }, // test the lexed token: return FALSE when not a match, otherwise return token @@ -2814,9 +697,8 @@ test_match:function (match, indexed_rule) { this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset + this.yyleng]; + this.yylloc.range = [this.offset, this.offset += this.yyleng]; } - this.offset += this.yyleng; this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); @@ -2833,28 +715,13 @@ test_match:function (match, indexed_rule) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. - } else if (this._signaled_error_token) { - // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! - token = this._signaled_error_token; - this._signaled_error_token = false; - return token; } return false; }, // return next match in input next:function () { - function clear() { - this.yytext = ''; - this.yyleng = 0; - this.match = ''; - this.matches = false; - this._more = false; - this._backtrack = false; - } - if (this.done) { - clear.call(this); return this.EOF; } if (!this._input) { @@ -2866,7 +733,8 @@ next:function () { tempMatch, index; if (!this._more) { - clear.call(this); + this.yytext = ''; + this.match = ''; } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { @@ -2898,42 +766,25 @@ next:function () { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } - if (this._input === '') { - clear.call(this); - this.done = true; + if (this._input === "") { return this.EOF; } else { - token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: this.match + this._input, + return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: "", token: null, - line: this.yylineno, - loc: this.yylloc - }) || this.ERROR; - if (token === this.ERROR) { - // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward one character at a time: - if (!this.match.length) { - this.input(); - } - } - return token; + line: this.yylineno + }); } }, // return next match that has a token lex:function lex() { - var r; - // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: - if (typeof this.options.pre_lex === 'function') { - r = this.options.pre_lex.call(this); - } - while (!r) { - r = this.next(); - } - if (typeof this.options.post_lex === 'function') { - // (also account for a userdef function which does not return any value: keep the token as is) - r = this.options.post_lex.call(this, r) || r; + var r = this.next(); + if (r) { + return r; + } else { + return this.lex(); } - return r; }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) @@ -2956,7 +807,7 @@ _currentRules:function _currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { - return this.conditions['INITIAL'].rules; + return this.conditions["INITIAL"].rules; } }, @@ -2966,7 +817,7 @@ topState:function topState(n) { if (n >= 0) { return this.conditionStack[n]; } else { - return 'INITIAL'; + return "INITIAL"; } }, @@ -2979,119 +830,79 @@ pushState:function pushState(condition) { stateStackSize:function stateStackSize() { return this.conditionStack.length; }, -options: { - "easy_keyword_rules": true, - "ranges": true -}, -JisonLexerError: JisonLexerError, -performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { - -var YYSTATE = YY_START; +options: {"ranges":true}, +performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { +var YYSTATE=YY_START; switch($avoiding_name_collisions) { -case 2 : -/*! Conditions:: action */ -/*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 29; // regexp with braces or quotes (and no spaces) -break; -case 7 : -/*! Conditions:: action */ -/*! Rule:: \{ */ - yy.depth++; return 25; -break; -case 8 : -/*! Conditions:: action */ -/*! Rule:: \} */ - if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 27; -break; -case 10 : -/*! Conditions:: conditions */ -/*! Rule:: > */ - this.popState(); return 32; -break; -case 13 : -/*! Conditions:: rules */ -/*! Rule:: {BR}+ */ - /* empty */ -break; -case 14 : -/*! Conditions:: rules */ -/*! Rule:: \s+{BR}+ */ - /* empty */ -break; -case 15 : -/*! Conditions:: rules */ -/*! Rule:: \s+ */ - this.begin('indented'); -break; -case 16 : -/*! Conditions:: rules */ -/*! Rule:: %% */ - this.begin('code'); return 6; -break; -case 20 : -/*! Conditions:: options */ -/*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 69; -break; -case 21 : -/*! Conditions:: options */ -/*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 69; -break; -case 23 : -/*! Conditions:: options */ -/*! Rule:: {BR}+ */ - this.popState(); return 66; -break; -case 24 : -/*! Conditions:: options */ -/*! Rule:: \s+{BR}+ */ - this.popState(); return 66; -break; -case 25 : -/*! Conditions:: options */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 27 : -/*! Conditions:: start_condition */ -/*! Rule:: {BR}+ */ - this.popState(); -break; -case 28 : -/*! Conditions:: start_condition */ -/*! Rule:: \s+{BR}+ */ - this.popState(); -break; -case 29 : -/*! Conditions:: start_condition */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 30 : -/*! Conditions:: trail */ -/*! Rule:: \s*{BR}+ */ - this.begin('rules'); -break; -case 31 : -/*! Conditions:: indented */ -/*! Rule:: \{ */ - yy.depth = 0; this.begin('action'); return 25; -break; -case 32 : -/*! Conditions:: indented */ -/*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; -break; -case 33 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; -break; -case 34 : -/*! Conditions:: indented */ -/*! Rule:: %include\b */ - +case 0:return 29; +break; +case 1:return 29; +break; +case 2:return 29; // regexp with braces or quotes (and no spaces) +break; +case 3:return 29; +break; +case 4:return 29; +break; +case 5:return 29; +break; +case 6:return 29; +break; +case 7:yy.depth++; return 25; +break; +case 8:if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 27; +break; +case 9:return 12; +break; +case 10:this.popState(); return 32; +break; +case 11:return 34; +break; +case 12:return 33; +break; +case 13:/* empty */ +break; +case 14:/* empty */ +break; +case 15:this.begin('indented'); +break; +case 16:this.begin('code'); return 6; +break; +case 17:return 63; +break; +case 18:return 12; +break; +case 19:return 69; +break; +case 20:yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 'OPTION_VALUE'; +break; +case 21:yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 'OPTION_VALUE'; +break; +case 22:return 'OPTION_VALUE'; +break; +case 23:this.popState(); return 66; +break; +case 24:this.popState(); return 66; +break; +case 25:/* empty */ +break; +case 26:return 21; +break; +case 27:this.popState(); +break; +case 28:this.popState(); +break; +case 29:/* empty */ +break; +case 30:this.begin('rules'); +break; +case 31:yy.depth = 0; this.begin('action'); return 25; +break; +case 32:this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; +break; +case 33:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; +break; +case 34: // This is an include instruction in place of an action: // thanks to the `.+` rule immediately below we need to semi-duplicate // the `%include` token recognition here vs. the almost-identical rule for the same @@ -3108,663 +919,146 @@ case 34 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 71; - -break; -case 35 : -/*! Conditions:: indented */ -/*! Rule:: .+ */ - this.begin('rules'); return 18; -break; -case 36 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - /* ignore */ -break; -case 37 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/\/.* */ - /* ignore */ -break; -case 38 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: {BR}+ */ - /* empty */ -break; -case 39 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 41 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 62; -break; -case 42 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 62; -break; -case 43 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \[ */ - this.pushState('set'); return 55; -break; -case 56 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: < */ - this.begin('conditions'); return 30; -break; -case 57 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/! */ - return 45; // treated as `(?!atom)` -break; -case 58 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \/ */ - return 44; // treated as `(?=atom)` -break; -case 60 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 60; -break; -case 63 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %options\b */ - if (!yy.options) { yy.options = {}; } this.begin('options'); return 64; -break; -case 64 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %s\b */ - this.begin('start_condition'); return 14; -break; -case 65 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %x\b */ - this.begin('start_condition'); return 16; -break; -case 66 : -/*! Conditions:: INITIAL trail code */ -/*! Rule:: %include\b */ - this.pushState('path'); return 71; -break; -case 67 : -/*! Conditions:: INITIAL rules trail code */ -/*! Rule:: %{NAME}[^\r\n]+ */ - + return 73; + +break; +case 35:this.begin('rules'); return 18; +break; +case 36:/* ignore */ +break; +case 37:/* ignore */ +break; +case 38:/* empty */ +break; +case 39:/* empty */ +break; +case 40:return 12; +break; +case 41:yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 62; +break; +case 42:yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 62; +break; +case 43:this.pushState('set'); return 55; +break; +case 44:return 36; +break; +case 45:return 41; +break; +case 46:return 41; +break; +case 47:return 41; +break; +case 48:return 39; +break; +case 49:return 40; +break; +case 50:return 42; +break; +case 51:return 33; +break; +case 52:return 43; +break; +case 53:return 50; +break; +case 54:return 34; +break; +case 55:return 51; +break; +case 56:this.begin('conditions'); return 30; +break; +case 57:return 45; // treated as `(?!atom)` +break; +case 58:return 44; // treated as `(?=atom)` +break; +case 59:return 60; +break; +case 60:yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 60; +break; +case 61:return 51; +break; +case 62:return 49; +break; +case 63:if (!yy.options) { yy.options = {}; } this.begin('options'); return 64; +break; +case 64:this.begin('start_condition'); return 14; +break; +case 65:this.begin('start_condition'); return 16; +break; +case 66:this.pushState('path'); return 73; +break; +case 67: /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - -break; -case 68 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: %% */ - this.begin('rules'); return 6; -break; -case 74 : -/*! Conditions:: indented trail rules INITIAL */ -/*! Rule:: . */ - throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ -break; -case 77 : -/*! Conditions:: set */ -/*! Rule:: \] */ - this.popState('set'); return 57; -break; -case 79 : -/*! Conditions:: code */ -/*! Rule:: [^\r\n]+ */ - return 74; // the bit of CODE just before EOF... -break; -case 80 : -/*! Conditions:: path */ -/*! Rule:: [\r\n] */ - this.popState(); this.unput(yy_.yytext); -break; -case 81 : -/*! Conditions:: path */ -/*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 72; -break; -case 82 : -/*! Conditions:: path */ -/*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 72; -break; -case 83 : -/*! Conditions:: path */ -/*! Rule:: \s+ */ - // skip whitespace in the line -break; -case 84 : -/*! Conditions:: path */ -/*! Rule:: [^\s\r\n]+ */ - this.popState(); return 72; -break; -case 85 : -/*! Conditions:: * */ -/*! Rule:: . */ - + +break; +case 68:this.begin('rules'); return 6; +break; +case 69:return 61; +break; +case 70:return 54; +break; +case 71:return 54; +break; +case 72:return 25; +break; +case 73:return 27; +break; +case 74:throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ +break; +case 75:return 9; +break; +case 76:return 59; +break; +case 77:this.popState('set'); return 57; +break; +case 78:return 76; +break; +case 79:return 76; // the bit of CODE just before EOF... +break; +case 80:this.popState(); this.unput(yy_.yytext); +break; +case 81:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; +break; +case 82:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; +break; +case 83:// skip whitespace in the line +break; +case 84:this.popState(); return 74; +break; +case 85: /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer input: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - + break; -default: - return this.simpleCaseActionClusters[$avoiding_name_collisions]; } }, -simpleCaseActionClusters: { - - /*! Conditions:: action */ - /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 29, - /*! Conditions:: action */ - /*! Rule:: \/\/.* */ - 1 : 29, - /*! Conditions:: action */ - /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 29, - /*! Conditions:: action */ - /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 29, - /*! Conditions:: action */ - /*! Rule:: [/"'][^{}/"']+ */ - 5 : 29, - /*! Conditions:: action */ - /*! Rule:: [^{}/"']+ */ - 6 : 29, - /*! Conditions:: conditions */ - /*! Rule:: {NAME} */ - 9 : 12, - /*! Conditions:: conditions */ - /*! Rule:: , */ - 11 : 34, - /*! Conditions:: conditions */ - /*! Rule:: \* */ - 12 : 33, - /*! Conditions:: rules */ - /*! Rule:: [a-zA-Z0-9_]+ */ - 17 : 63, - /*! Conditions:: options */ - /*! Rule:: {NAME} */ - 18 : 12, - /*! Conditions:: options */ - /*! Rule:: = */ - 19 : 68, - /*! Conditions:: options */ - /*! Rule:: [^\s\r\n]+ */ - 22 : 69, - /*! Conditions:: start_condition */ - /*! Rule:: {NAME} */ - 26 : 21, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: {NAME} */ - 40 : 12, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \| */ - 44 : 36, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \(\?: */ - 45 : 41, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \(\?= */ - 46 : 41, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \(\?! */ - 47 : 41, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \( */ - 48 : 39, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \) */ - 49 : 40, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \+ */ - 50 : 42, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \* */ - 51 : 33, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \? */ - 52 : 43, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \^ */ - 53 : 50, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: , */ - 54 : 34, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: <> */ - 55 : 51, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 60, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \$ */ - 61 : 51, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \. */ - 62 : 49, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 61, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \{{NAME}\} */ - 70 : 54, - /*! Conditions:: set options */ - /*! Rule:: \{{NAME}\} */ - 71 : 54, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \{ */ - 72 : 25, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: \} */ - 73 : 27, - /*! Conditions:: * */ - /*! Rule:: $ */ - 75 : 9, - /*! Conditions:: set */ - /*! Rule:: (\\\\|\\\]|[^\]])+ */ - 76 : 59, - /*! Conditions:: code */ - /*! Rule:: [^\r\n]*(\r|\n)+ */ - 78 : 74 -}, -rules: [ -/^(?:\/\*(.|\n|\r)*?\*\/)/, -/^(?:\/\/.*)/, -/^(?:\/[^ \/]*?['"{}'][^ ]*?\/)/, -/^(?:"(\\\\|\\"|[^"])*")/, -/^(?:'(\\\\|\\'|[^'])*')/, -/^(?:[\/"'][^{}\/"']+)/, -/^(?:[^{}\/"']+)/, -/^(?:\{)/, -/^(?:\})/, -/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, -/^(?:>)/, -/^(?:,)/, -/^(?:\*)/, -/^(?:(\r\n|\n|\r)+)/, -/^(?:\s+(\r\n|\n|\r)+)/, -/^(?:\s+)/, -/^(?:%%)/, -/^(?:[a-zA-Z0-9_]+)/, -/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, -/^(?:=)/, -/^(?:"(\\\\|\\"|[^"])*")/, -/^(?:'(\\\\|\\'|[^'])*')/, -/^(?:[^\s\r\n]+)/, -/^(?:(\r\n|\n|\r)+)/, -/^(?:\s+(\r\n|\n|\r)+)/, -/^(?:\s+)/, -/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, -/^(?:(\r\n|\n|\r)+)/, -/^(?:\s+(\r\n|\n|\r)+)/, -/^(?:\s+)/, -/^(?:\s*(\r\n|\n|\r)+)/, -/^(?:\{)/, -/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, -/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, -/^(?:%include\b)/, -/^(?:.+)/, -/^(?:\/\*(.|\n|\r)*?\*\/)/, -/^(?:\/\/.*)/, -/^(?:(\r\n|\n|\r)+)/, -/^(?:\s+)/, -/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, -/^(?:"(\\\\|\\"|[^"])*")/, -/^(?:'(\\\\|\\'|[^'])*')/, -/^(?:\[)/, -/^(?:\|)/, -/^(?:\(\?:)/, -/^(?:\(\?=)/, -/^(?:\(\?!)/, -/^(?:\()/, -/^(?:\))/, -/^(?:\+)/, -/^(?:\*)/, -/^(?:\?)/, -/^(?:\^)/, -/^(?:,)/, -/^(?:<>)/, -/^(?:<)/, -/^(?:\/!)/, -/^(?:\/)/, -/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/, -/^(?:\\.)/, -/^(?:\$)/, -/^(?:\.)/, -/^(?:%options\b)/, -/^(?:%s\b)/, -/^(?:%x\b)/, -/^(?:%include\b)/, -/^(?:%([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)[^\r\n]+)/, -/^(?:%%)/, -/^(?:\{\d+(,\s?\d+|,)?\})/, -/^(?:\{([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)\})/, -/^(?:\{([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)\})/, -/^(?:\{)/, -/^(?:\})/, -/^(?:.)/, -/^(?:$)/, -/^(?:(\\\\|\\\]|[^\]])+)/, -/^(?:\])/, -/^(?:[^\r\n]*(\r|\n)+)/, -/^(?:[^\r\n]+)/, -/^(?:[\r\n])/, -/^(?:'[^\r\n]+')/, -/^(?:"[^\r\n]+")/, -/^(?:\s+)/, -/^(?:[^\s\r\n]+)/, -/^(?:.)/ -], -conditions: { - "code": { - "rules": [ - 66, - 67, - 75, - 78, - 79, - 85 - ], - "inclusive": false - }, - "start_condition": { - "rules": [ - 26, - 27, - 28, - 29, - 75, - 85 - ], - "inclusive": false - }, - "options": { - "rules": [ - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 71, - 75, - 85 - ], - "inclusive": false - }, - "conditions": { - "rules": [ - 9, - 10, - 11, - 12, - 75, - 85 - ], - "inclusive": false - }, - "action": { - "rules": [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 75, - 85 - ], - "inclusive": false - }, - "path": { - "rules": [ - 75, - 80, - 81, - 82, - 83, - 84, - 85 - ], - "inclusive": false - }, - "set": { - "rules": [ - 71, - 75, - 76, - 77, - 85 - ], - "inclusive": false - }, - "indented": { - "rules": [ - 31, - 32, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 68, - 69, - 70, - 72, - 73, - 74, - 75, - 85 - ], - "inclusive": true - }, - "trail": { - "rules": [ - 30, - 33, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 72, - 73, - 74, - 75, - 85 - ], - "inclusive": true - }, - "rules": { - "rules": [ - 13, - 14, - 15, - 16, - 17, - 33, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 67, - 68, - 69, - 70, - 72, - 73, - 74, - 75, - 85 - ], - "inclusive": true - }, - "INITIAL": { - "rules": [ - 33, - 36, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 72, - 73, - 74, - 75, - 85 - ], - "inclusive": true - } -} +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ \/]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[\/"'][^{}\/"']+)/,/^(?:[^{}\/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/,/^(?:=)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[^\s\r\n]+)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%include\b)/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\[)/,/^(?:\|)/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%include\b)/,/^(?:%([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)[^\r\n]+)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_]*)\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(\\\\|\\\]|[^\]])+)/,/^(?:\])/,/^(?:[^\r\n]*(\r|\n)+)/,/^(?:[^\r\n]+)/,/^(?:[\r\n])/,/^(?:'[^\r\n]+')/,/^(?:"[^\r\n]+")/,/^(?:\s+)/,/^(?:[^\s\r\n]+)/,/^(?:.)/], +conditions: {"code":{"rules":[66,67,75,78,79,85],"inclusive":false},"start_condition":{"rules":[26,27,28,29,75,85],"inclusive":false},"options":{"rules":[18,19,20,21,22,23,24,25,71,75,85],"inclusive":false},"conditions":{"rules":[9,10,11,12,75,85],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,75,85],"inclusive":false},"path":{"rules":[75,80,81,82,83,84,85],"inclusive":false},"set":{"rules":[71,75,76,77,85],"inclusive":false},"indented":{"rules":[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,68,69,70,72,73,74,75,85],"inclusive":true},"trail":{"rules":[30,33,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,72,73,74,75,85],"inclusive":true},"rules":{"rules":[13,14,15,16,17,33,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,67,68,69,70,72,73,74,75,85],"inclusive":true},"INITIAL":{"rules":[33,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,72,73,74,75,85],"inclusive":true}} }); -// lexer.JisonLexerError = JisonLexerError; return lexer; })(); parser.lexer = lexer; - function Parser () { this.yy = {}; } -Parser.prototype = parser; -parser.Parser = Parser; -// parser.JisonParserError = JisonParserError; - -return new Parser(); +Parser.prototype = parser;parser.Parser = Parser; +return new Parser; })(); - - if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lexParser; -exports.Parser = lexParser.Parser; -exports.parse = function () { - return lexParser.parse.apply(lexParser, arguments); +exports.parser = parser; +exports.Parser = parser.Parser; +exports.parse = function () { return parser.parse.apply(parser, arguments); }; +exports.main = function commonjsMain(args) { + if (!args[1]) { + console.log('Usage: '+args[0]+' FILE'); + process.exit(1); + } + var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); + return exports.parser.parse(source); }; - +if (typeof module !== 'undefined' && require.main === module) { + exports.main(process.argv.slice(1)); } +} \ No newline at end of file diff --git a/lex.l b/lex.l index e66849a..b7c18b6 100644 --- a/lex.l +++ b/lex.l @@ -1,5 +1,6 @@ NAME [a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])? +ID [a-zA-Z_][a-zA-Z0-9_]* BR \r\n|\n|\r %s indented trail rules @@ -40,7 +41,7 @@ BR \r\n|\n|\r \s+{BR}+ this.popState(); return 'OPTIONS_END'; \s+ /* empty */ -{NAME} return 'START_COND'; +{ID} return 'START_COND'; {BR}+ this.popState(); \s+{BR}+ this.popState(); \s+ /* empty */ @@ -76,7 +77,7 @@ BR \r\n|\n|\r {BR}+ /* empty */ \s+ /* empty */ -{NAME} return 'NAME'; +{ID} return 'NAME'; \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; "[" this.pushState('set'); return 'REGEX_SET_START'; @@ -112,8 +113,8 @@ BR \r\n|\n|\r %} "%%" this.begin('rules'); return '%%'; "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; -"{"{NAME}"}" return 'NAME_BRACE'; -"{"{NAME}"}" return 'NAME_BRACE'; +"{"{ID}"}" return 'NAME_BRACE'; +"{"{ID}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ @@ -136,7 +137,7 @@ BR \r\n|\n|\r \s+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; -<*>. %{ +<*>. %{ /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); %} diff --git a/tests/all-tests.js b/tests/all-tests.js index 09176ee..dc3ecda 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -22,9 +22,9 @@ function lexer_reset() { } exports["test lex grammar with macros"] = function () { - var lexgrammar = 'D [0-9]\nID [a-zA-Z][a-zA-Z0-9]+\n%%\n\n{D}"ohhai" {print(9);}\n"{" return \'{\';'; + var lexgrammar = 'D [0-9]\nID [a-zA-Z_][a-zA-Z0-9_]+\n%%\n\n{D}"ohhai" {print(9);}\n"{" return \'{\';'; var expected = { - macros: {"D": "[0-9]", "ID": "[a-zA-Z][a-zA-Z0-9]+"}, + macros: {"D": "[0-9]", "ID": "[a-zA-Z_][a-zA-Z0-9_]+"}, rules: [ ["{D}ohhai", "print(9);"], ["\\{", "return '{';"] @@ -350,6 +350,7 @@ exports["test options"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +if (0) { exports["test options with values"] = function () { var lexgrammar = '%options ping=666 bla=blub bool1 s1="s1value" s2=\'s2value\'\n%%\n"foo" return 1;'; var expected = { @@ -384,6 +385,7 @@ exports["test options with string values which have embedded quotes"] = function lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +} exports["test unquoted string rules"] = function () { var lexgrammar = "%%\nfoo* return 1"; diff --git a/tests/lex/bnf.jisonlex b/tests/lex/bnf.jisonlex index 763298b..43d9cfd 100644 --- a/tests/lex/bnf.jisonlex +++ b/tests/lex/bnf.jisonlex @@ -2,7 +2,7 @@ %% \s+ {/* skip whitespace */} "/*"[^*]*"*" {return yy.lexComment(this);} -[a-zA-Z][a-zA-Z0-9_-]* {return 'ID';} +[a-zA-Z_][a-zA-Z0-9_]* {return 'ID';} '"'[^"]+'"' {yytext = yytext.substr(1, yyleng-2); return 'STRING';} "'"[^']+"'" {yytext = yytext.substr(1, yyleng-2); return 'STRING';} ":" {return ':';} diff --git a/tests/lex/bnf.lex.json b/tests/lex/bnf.lex.json index 99aa3d0..be27992 100644 --- a/tests/lex/bnf.lex.json +++ b/tests/lex/bnf.lex.json @@ -2,7 +2,7 @@ "rules": [ ["\\s+", "/* skip whitespace */"], ["\\/\\*[^*]*\\*", "return yy.lexComment(this);"], - ["[a-zA-Z][a-zA-Z0-9_-]*", "return 'ID';"], + ["[a-zA-Z_][a-zA-Z0-9_]*", "return 'ID';"], ["\"[^\"]+\"", "yytext = yytext.substr(1, yyleng-2); return 'STRING';"], ["'[^']+'", "yytext = yytext.substr(1, yyleng-2); return 'STRING';"], [":", "return ':';"], diff --git a/tests/lex/lex_grammar.jisonlex b/tests/lex/lex_grammar.jisonlex index ae7e896..5142b8b 100644 --- a/tests/lex/lex_grammar.jisonlex +++ b/tests/lex/lex_grammar.jisonlex @@ -3,7 +3,7 @@ \n+ {yy.freshLine = true;} \s+ {yy.freshLine = false;} "y{"[^}]*"}" {yytext = yytext.substr(2, yytext.length-3);return 'ACTION';} -[a-zA-Z_][a-zA-Z0-9_-]* {return 'NAME';} +[a-zA-Z_][a-zA-Z0-9_]* {return 'NAME';} '"'([^"]|'\"')*'"' {return 'STRING_LIT';} "'"([^']|"\'")*"'" {return 'STRING_LIT';} "|" {return '|';} diff --git a/tests/lex/lex_grammar.lex.json b/tests/lex/lex_grammar.lex.json index 44d7aac..e608c0b 100644 --- a/tests/lex/lex_grammar.lex.json +++ b/tests/lex/lex_grammar.lex.json @@ -3,7 +3,7 @@ ["\\n+", "yy.freshLine = true;"], ["\\s+", "yy.freshLine = false;"], ["y\\{[^}]*\\}", "yytext = yytext.substr(2, yytext.length-3);return 'ACTION';"], - ["[a-zA-Z_][a-zA-Z0-9_-]*", "return 'NAME';"], + ["[a-zA-Z_][a-zA-Z0-9_]*", "return 'NAME';"], ["\"([^\"]|\\\\\")*\"", "return 'STRING_LIT';"], ["'([^']|\\\\')*'", "return 'STRING_LIT';"], ["\\|", "return '|';"], From 5e950ff32c5c625ace9b6c0f9ed4ca9a4dd985f1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 15:15:14 +0100 Subject: [PATCH 087/417] fix nasty build regression. That's what the `make clean; make prep; make` build process is meant for: when in doubt, nuke all NPM deps, then make sure you install the latest and build from scratch. (And I'm in doubt plenty of time! ;-] ) --- lex-parser.js | 3712 ++++++++++++++++++++++++++++++++++++++------ tests/all-tests.js | 2 - 2 files changed, 3209 insertions(+), 505 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index fa9c9a3..14f6571 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.15 */ +/* parser generated by jison 0.4.15-101 */ /* Returns a Parser object of the following structure: @@ -8,11 +8,13 @@ Parser.prototype: { yy: {}, - trace: function(), + trace: function(errorMessage, errorHash), + JisonParserError: function(msg, hash), symbols_: {associative list: name ==> number}, terminals_: {associative list: number ==> name}, productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), + performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), + (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) table: [...], defaultActions: {...}, parseError: function(str, hash), @@ -20,11 +22,14 @@ lexer: { EOF: 1, + ERROR: 2, + JisonLexerError: function(msg, hash), parseError: function(str, hash), setInput: function(input), input: function(), unput: function(str), more: function(), + reject: function(), less: function(n), pastInput: function(), upcomingInput: function(), @@ -37,12 +42,9 @@ _currentRules: function(), topState: function(), pushState: function(condition), + stateStackSize: function(), - options: { - ranges: boolean (optional: true ==> token location info will include a .range[] member) - flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) - backtrack_lexer: boolean (optional: true ==> lexer regexes are tested in order and for each matching regex the action code is invoked; the lexer terminates the scan when a token is returned by the action code) - }, + options: { ... }, performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), rules: [...], @@ -67,24 +69,544 @@ } while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { loc: (yylloc) - expected: (string describing the set of expected tokens) - recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) + expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) + recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) + } + + You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + These options are available: + + ### options which are global for all parser instances + + Parser.pre_parse: function(yy) + optional: you can specify a pre_parse() function in the chunk following the grammar, + i.e. after the last `%%`. + Parser.post_parse: function(yy, retval) { return retval; } + optional: you can specify a post_parse() function in the chunk following the grammar, + i.e. after the last `%%`. When it does not return any value, the parser will return + the original `retval`. + + ### options which can be set up per parser instance + + yy: { + pre_parse: function(yy) + optional: is invoked before the parse cycle starts (and before the first invocation + of `lex()`) but immediately after the invocation of parser.pre_parse()). + post_parse: function(yy, retval) { return retval; } + optional: is invoked when the parse terminates due to success ('accept') or failure + (even when exceptions are thrown). `retval` contains the return value to be produced + by `Parser.parse()`; this function can override the return value by returning another. + When it does not return any value, the parser will return the original `retval`. + This function is invoked immediately before `Parser.post_parse()`. + parseError: function(str, hash) + optional: overrides the default `parseError` function. + } + + parser.lexer.options: { + ranges: boolean optional: true ==> token location info will include a .range[] member. + flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested + exhaustively to find the longest match. + backtrack_lexer: boolean + optional: true ==> lexer regexes are tested in order and for each matching + regex the action code is invoked; the lexer terminates + the scan when a token is returned by the action code. + pre_lex: function() + optional: is invoked before the lexer is invoked to produce another token. + `this` refers to the Lexer object. + post_lex: function(token) { return token; } + optional: is invoked when the lexer has produced a token `token`; + this function can override the returned token value by returning another. + When it does not return any (truthy) value, the lexer will return the original `token`. + `this` refers to the Lexer object. } */ -var parser = (function(){ -var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[6,12,14,16,18,64,73],$V1=[2,6],$V2=[1,5],$V3=[1,6],$V4=[1,7],$V5=[1,8],$V6=[1,12],$V7=[1,11],$V8=[2,38],$V9=[1,19],$Va=[1,20],$Vb=[1,21],$Vc=[1,22],$Vd=[1,25],$Ve=[1,26],$Vf=[1,27],$Vg=[1,30],$Vh=[1,31],$Vi=[1,34],$Vj=[1,32],$Vk=[1,33],$Vl=[1,43],$Vm=[18,25,36,39,41,44,45,49,50,51,54,55,60,62,63,73],$Vn=[2,31],$Vo=[1,47],$Vp=[1,48],$Vq=[6,12,14,16,18,25,36,40,64,73],$Vr=[6,12,14,16,18,25,36,39,40,41,44,45,49,50,51,54,55,60,62,63,64,73],$Vs=[1,51],$Vt=[1,50],$Vu=[1,52],$Vv=[1,54],$Vw=[36,40],$Vx=[6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,60,61,62,63,64,73],$Vy=[1,61],$Vz=[6,12,14,16,18,21,64,73],$VA=[6,9,12,14,16,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63,64,73,76],$VB=[12,66],$VC=[6,9,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63,73],$VD=[54,57,59],$VE=[9,73],$VF=[2,79],$VG=[1,86],$VH=[32,34],$VI=[9,73,76],$VJ=[25,27],$VK=[2,23],$VL=[1,99],$VM=[1,103],$VN=[1,104],$VO=[25,27,29]; -var parser = {trace: function trace() { }, +var lexParser = (function () { +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +function JisonParserError(msg, hash) { + this.message = msg; + this.hash = hash; + var stacktrace = (new Error(msg)).stack; + if (stacktrace) { + this.stack = stacktrace; + } +} +JisonParserError.prototype = Object.create(Error.prototype); +JisonParserError.prototype.constructor = JisonParserError; +JisonParserError.prototype.name = 'JisonParserError'; + +function __expand__(k, v, o) { + o = o || {}; + for (var l = k.length; l--; ) { + o[k[l]] = v; + } + return o; +} + +var $V0=[6,12,14,16,18,64], + $V1=[18,25,36,39,41,44,45,49,50,51,54,55,60,62,63], + $V2=[6,12,14,16,18,25,36,40,64], + $V3=[6,12,14,16,18,25,36,39,40,41,44,45,49,50,51,54,55,60,62,63,64], + $V4=[36,40], + $V5=[6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,60,61,62,63,64], + $V6=[6,12,14,16,18,21,64], + $V7=[6,9,12,14,16,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63,64,71], + $V8=[6,9,18,25,30,36,39,41,44,45,49,50,51,54,55,60,62,63], + $V9=[54,57], + $Va=[9,71], + $Vb=[25,27]; + +var parser = { +trace: function trace() { }, +JisonParserError: JisonParserError, yy: {}, -symbols_: {"error":2,"lex":3,"init":4,"definitions":5,"%%":6,"rules":7,"epilogue":8,"EOF":9,"extra_lexer_module_code":10,"definition":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"ACTION":18,"include_macro_code":19,"options":20,"START_COND":21,"rule":22,"start_conditions":23,"action":24,"{":25,"action_body":26,"}":27,"action_comments_body":28,"ACTION_BODY":29,"<":30,"name_list":31,">":32,"*":33,",":34,"regex_list":35,"|":36,"regex_concat":37,"regex_base":38,"(":39,")":40,"SPECIAL_GROUP":41,"+":42,"?":43,"/":44,"/!":45,"name_expansion":46,"range_regex":47,"any_group_regex":48,".":49,"^":50,"$":51,"string":52,"escape_char":53,"NAME_BRACE":54,"REGEX_SET_START":55,"regex_set":56,"REGEX_SET_END":57,"regex_set_atom":58,"REGEX_SET":59,"ESCAPE_CHAR":60,"RANGE_REGEX":61,"STRING_LIT":62,"CHARACTER_LIT":63,"OPTIONS":64,"option_list":65,"OPTIONS_END":66,"option":67,"NAME[option]":68,"=":69,"OPTION_VALUE[value]":70,"NAME[value]":71,"optional_module_code_chunk":72,"INCLUDE":73,"PATH":74,"module_code_chunk":75,"CODE":76,"$accept":0,"$end":1}, -terminals_: {2:"error",6:"%%",9:"EOF",12:"NAME",14:"START_INC",16:"START_EXC",18:"ACTION",21:"START_COND",25:"{",27:"}",29:"ACTION_BODY",30:"<",32:">",33:"*",34:",",36:"|",39:"(",40:")",41:"SPECIAL_GROUP",42:"+",43:"?",44:"/",45:"/!",49:".",50:"^",51:"$",54:"NAME_BRACE",55:"REGEX_SET_START",57:"REGEX_SET_END",59:"REGEX_SET",60:"ESCAPE_CHAR",61:"RANGE_REGEX",62:"STRING_LIT",63:"CHARACTER_LIT",64:"OPTIONS",66:"OPTIONS_END",68:"NAME[option]",69:"=",70:"OPTION_VALUE[value]",71:"NAME[value]",73:"INCLUDE",74:"PATH",76:"CODE"}, -productions_: [0,[3,5],[8,1],[8,3],[4,0],[5,2],[5,0],[11,2],[11,2],[11,2],[11,1],[11,1],[11,1],[15,1],[15,2],[17,1],[17,2],[7,2],[7,1],[22,3],[24,3],[24,1],[24,1],[26,0],[26,1],[26,5],[26,4],[28,1],[28,2],[23,3],[23,3],[23,0],[31,1],[31,3],[13,1],[35,3],[35,2],[35,1],[35,0],[37,2],[37,1],[38,3],[38,3],[38,2],[38,2],[38,2],[38,2],[38,2],[38,1],[38,2],[38,1],[38,1],[38,1],[38,1],[38,1],[38,1],[46,1],[48,3],[56,2],[56,1],[58,1],[58,1],[53,1],[47,1],[52,1],[52,1],[20,3],[65,2],[65,1],[67,1],[67,3],[67,3],[10,1],[10,3],[19,2],[19,2],[75,1],[75,2],[72,1],[72,0]], +symbols_: { + "error": 2, + "lex": 3, + "init": 4, + "definitions": 5, + "%%": 6, + "rules": 7, + "epilogue": 8, + "EOF": 9, + "extra_lexer_module_code": 10, + "definition": 11, + "NAME": 12, + "regex": 13, + "START_INC": 14, + "names_inclusive": 15, + "START_EXC": 16, + "names_exclusive": 17, + "ACTION": 18, + "include_macro_code": 19, + "options": 20, + "START_COND": 21, + "rule": 22, + "start_conditions": 23, + "action": 24, + "{": 25, + "action_body": 26, + "}": 27, + "action_comments_body": 28, + "ACTION_BODY": 29, + "<": 30, + "name_list": 31, + ">": 32, + "*": 33, + ",": 34, + "regex_list": 35, + "|": 36, + "regex_concat": 37, + "regex_base": 38, + "(": 39, + ")": 40, + "SPECIAL_GROUP": 41, + "+": 42, + "?": 43, + "/": 44, + "/!": 45, + "name_expansion": 46, + "range_regex": 47, + "any_group_regex": 48, + ".": 49, + "^": 50, + "$": 51, + "string": 52, + "escape_char": 53, + "NAME_BRACE": 54, + "REGEX_SET_START": 55, + "regex_set": 56, + "REGEX_SET_END": 57, + "regex_set_atom": 58, + "REGEX_SET": 59, + "ESCAPE_CHAR": 60, + "RANGE_REGEX": 61, + "STRING_LIT": 62, + "CHARACTER_LIT": 63, + "OPTIONS": 64, + "option_list": 65, + "OPTIONS_END": 66, + "option": 67, + "=": 68, + "OPTION_VALUE": 69, + "optional_module_code_chunk": 70, + "INCLUDE": 71, + "PATH": 72, + "module_code_chunk": 73, + "CODE": 74, + "$accept": 0, + "$end": 1 +}, +terminals_: { + 2: "error", + 6: "%%", + 9: "EOF", + 12: "NAME", + 14: "START_INC", + 16: "START_EXC", + 18: "ACTION", + 21: "START_COND", + 25: "{", + 27: "}", + 29: "ACTION_BODY", + 30: "<", + 32: ">", + 33: "*", + 34: ",", + 36: "|", + 39: "(", + 40: ")", + 41: "SPECIAL_GROUP", + 42: "+", + 43: "?", + 44: "/", + 45: "/!", + 49: ".", + 50: "^", + 51: "$", + 54: "NAME_BRACE", + 55: "REGEX_SET_START", + 57: "REGEX_SET_END", + 59: "REGEX_SET", + 60: "ESCAPE_CHAR", + 61: "RANGE_REGEX", + 62: "STRING_LIT", + 63: "CHARACTER_LIT", + 64: "OPTIONS", + 66: "OPTIONS_END", + 68: "=", + 69: "OPTION_VALUE", + 71: "INCLUDE", + 72: "PATH", + 74: "CODE" +}, +productions_: [ + 0, + [ + 3, + 5 + ], + [ + 8, + 1 + ], + [ + 8, + 3 + ], + [ + 4, + 0 + ], + [ + 5, + 2 + ], + [ + 5, + 0 + ], + [ + 11, + 2 + ], + [ + 11, + 2 + ], + [ + 11, + 2 + ], + [ + 11, + 1 + ], + [ + 11, + 1 + ], + [ + 11, + 1 + ], + [ + 15, + 1 + ], + [ + 15, + 2 + ], + [ + 17, + 1 + ], + [ + 17, + 2 + ], + [ + 7, + 2 + ], + [ + 7, + 1 + ], + [ + 22, + 3 + ], + [ + 24, + 3 + ], + [ + 24, + 1 + ], + [ + 24, + 1 + ], + [ + 26, + 0 + ], + [ + 26, + 1 + ], + [ + 26, + 5 + ], + [ + 26, + 4 + ], + [ + 28, + 1 + ], + [ + 28, + 2 + ], + [ + 23, + 3 + ], + [ + 23, + 3 + ], + [ + 23, + 0 + ], + [ + 31, + 1 + ], + [ + 31, + 3 + ], + [ + 13, + 1 + ], + [ + 35, + 3 + ], + [ + 35, + 2 + ], + [ + 35, + 1 + ], + [ + 35, + 0 + ], + [ + 37, + 2 + ], + [ + 37, + 1 + ], + [ + 38, + 3 + ], + [ + 38, + 3 + ], + [ + 38, + 2 + ], + [ + 38, + 2 + ], + [ + 38, + 2 + ], + [ + 38, + 2 + ], + [ + 38, + 2 + ], + [ + 38, + 1 + ], + [ + 38, + 2 + ], + [ + 38, + 1 + ], + [ + 38, + 1 + ], + [ + 38, + 1 + ], + [ + 38, + 1 + ], + [ + 38, + 1 + ], + [ + 38, + 1 + ], + [ + 46, + 1 + ], + [ + 48, + 3 + ], + [ + 56, + 2 + ], + [ + 56, + 1 + ], + [ + 58, + 1 + ], + [ + 58, + 1 + ], + [ + 53, + 1 + ], + [ + 47, + 1 + ], + [ + 52, + 1 + ], + [ + 52, + 1 + ], + [ + 20, + 3 + ], + [ + 65, + 2 + ], + [ + 65, + 1 + ], + [ + 67, + 1 + ], + [ + 67, + 3 + ], + [ + 67, + 3 + ], + [ + 10, + 1 + ], + [ + 10, + 3 + ], + [ + 19, + 2 + ], + [ + 19, + 2 + ], + [ + 73, + 1 + ], + [ + 73, + 2 + ], + [ + 70, + 1 + ], + [ + 70, + 0 + ] +], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ var $0 = $$.length - 1; switch (yystate) { -case 1: - +case 1 : +/*! Production:: lex : init definitions %% rules epilogue */ + this.$ = { rules: $$[$0-1] }; if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; @@ -94,19 +616,29 @@ case 1: delete yy.options; delete yy.actionInclude; return this.$; - -break; -case 2: case 12: - this.$ = null; -break; -case 3: case 20: case 29: - this.$ = $$[$0-1]; -break; -case 4: - yy.actionInclude = ''; -break; -case 5: - + +break; +case 2 : +/*! Production:: epilogue : EOF */ + case 12 : +/*! Production:: definition : options */ + this.$ = null; +break; +case 3 : +/*! Production:: epilogue : %% extra_lexer_module_code EOF */ + case 20 : +/*! Production:: action : { action_body } */ + case 29 : +/*! Production:: start_conditions : < name_list > */ + this.$ = $$[$0-1]; +break; +case 4 : +/*! Production:: init : */ + yy.actionInclude = ''; +break; +case 5 : +/*! Production:: definitions : definition definitions */ + this.$ = $$[$0]; if ($$[$0-1] != null) { if ('length' in $$[$0-1]) { @@ -119,153 +651,1608 @@ case 5: } } } - -break; -case 6: - this.$ = [null, null]; -break; -case 7: - this.$ = [$$[$0-1], $$[$0]]; -break; -case 8: case 9: case 21: case 22: case 24: case 27: case 62: case 63: case 72: case 76: case 78: - this.$ = $$[$0]; -break; -case 10: case 11: - yy.actionInclude += $$[$0]; this.$ = null; -break; -case 13: - this.$ = {}; this.$[$$[$0]] = 0; -break; -case 14: - this.$ = $$[$0-1]; this.$[$$[$0]] = 0; -break; -case 15: - this.$ = {}; this.$[$$[$0]] = 1; -break; -case 16: - this.$ = $$[$0-1]; this.$[$$[$0]] = 1; -break; -case 17: - this.$ = $$[$0-1]; this.$.push($$[$0]); -break; -case 18: case 32: - this.$ = [$$[$0]]; -break; -case 19: - this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; -break; -case 23: case 38: case 79: - this.$ = ''; -break; -case 25: - this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 26: - this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 28: case 39: case 49: case 58: case 77: - this.$ = $$[$0-1] + $$[$0]; -break; -case 30: - this.$ = ['*']; -break; -case 33: - this.$ = $$[$0-2]; this.$.push($$[$0]); -break; -case 34: - + +break; +case 6 : +/*! Production:: definitions : */ + this.$ = [null, null]; +break; +case 7 : +/*! Production:: definition : NAME regex */ + this.$ = [$$[$0-1], $$[$0]]; +break; +case 8 : +/*! Production:: definition : START_INC names_inclusive */ + case 9 : +/*! Production:: definition : START_EXC names_exclusive */ + case 21 : +/*! Production:: action : ACTION */ + case 22 : +/*! Production:: action : include_macro_code */ + case 24 : +/*! Production:: action_body : action_comments_body */ + case 27 : +/*! Production:: action_comments_body : ACTION_BODY */ + case 62 : +/*! Production:: escape_char : ESCAPE_CHAR */ + case 63 : +/*! Production:: range_regex : RANGE_REGEX */ + case 72 : +/*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + case 76 : +/*! Production:: module_code_chunk : CODE */ + case 78 : +/*! Production:: optional_module_code_chunk : module_code_chunk */ + this.$ = $$[$0]; +break; +case 10 : +/*! Production:: definition : ACTION */ + case 11 : +/*! Production:: definition : include_macro_code */ + yy.actionInclude += $$[$0]; this.$ = null; +break; +case 13 : +/*! Production:: names_inclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 0; +break; +case 14 : +/*! Production:: names_inclusive : names_inclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 0; +break; +case 15 : +/*! Production:: names_exclusive : START_COND */ + this.$ = {}; this.$[$$[$0]] = 1; +break; +case 16 : +/*! Production:: names_exclusive : names_exclusive START_COND */ + this.$ = $$[$0-1]; this.$[$$[$0]] = 1; +break; +case 17 : +/*! Production:: rules : rules rule */ + this.$ = $$[$0-1]; this.$.push($$[$0]); +break; +case 18 : +/*! Production:: rules : rule */ + case 32 : +/*! Production:: name_list : NAME */ + this.$ = [$$[$0]]; +break; +case 19 : +/*! Production:: rule : start_conditions regex action */ + this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; +break; +case 23 : +/*! Production:: action_body : */ + case 38 : +/*! Production:: regex_list : */ + case 79 : +/*! Production:: optional_module_code_chunk : */ + this.$ = ''; +break; +case 25 : +/*! Production:: action_body : action_body { action_body } action_comments_body */ + this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 26 : +/*! Production:: action_body : action_body { action_body } */ + this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 28 : +/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ + case 39 : +/*! Production:: regex_concat : regex_concat regex_base */ + case 49 : +/*! Production:: regex_base : regex_base range_regex */ + case 58 : +/*! Production:: regex_set : regex_set_atom regex_set */ + case 77 : +/*! Production:: module_code_chunk : module_code_chunk CODE */ + this.$ = $$[$0-1] + $$[$0]; +break; +case 30 : +/*! Production:: start_conditions : < * > */ + this.$ = ['*']; +break; +case 33 : +/*! Production:: name_list : name_list , NAME */ + this.$ = $$[$0-2]; this.$.push($$[$0]); +break; +case 34 : +/*! Production:: regex : regex_list */ + this.$ = $$[$0]; if (yy.options && yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { this.$ += "\\b"; } - -break; -case 35: - this.$ = $$[$0-2] + '|' + $$[$0]; -break; -case 36: - this.$ = $$[$0-1] + '|'; -break; -case 41: - this.$ = '(' + $$[$0-1] + ')'; -break; -case 42: - this.$ = $$[$0-2] + $$[$0-1] + ')'; -break; -case 43: - this.$ = $$[$0-1] + '+'; -break; -case 44: - this.$ = $$[$0-1] + '*'; -break; -case 45: - this.$ = $$[$0-1] + '?'; -break; -case 46: - this.$ = '(?=' + $$[$0] + ')'; -break; -case 47: - this.$ = '(?!' + $$[$0] + ')'; -break; -case 51: - this.$ = '.'; -break; -case 52: - this.$ = '^'; -break; -case 53: - this.$ = '$'; -break; -case 57: case 73: - this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 61: - this.$ = '{[' + $$[$0] + ']}'; -break; -case 64: - this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); -break; -case 69: - yy.options[$$[$0]] = true; -break; -case 70: case 71: - yy.options[$$[$0-2]] = $$[$0]; -break; -case 74: - + +break; +case 35 : +/*! Production:: regex_list : regex_list | regex_concat */ + this.$ = $$[$0-2] + '|' + $$[$0]; +break; +case 36 : +/*! Production:: regex_list : regex_list | */ + this.$ = $$[$0-1] + '|'; +break; +case 41 : +/*! Production:: regex_base : ( regex_list ) */ + this.$ = '(' + $$[$0-1] + ')'; +break; +case 42 : +/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ + this.$ = $$[$0-2] + $$[$0-1] + ')'; +break; +case 43 : +/*! Production:: regex_base : regex_base + */ + this.$ = $$[$0-1] + '+'; +break; +case 44 : +/*! Production:: regex_base : regex_base * */ + this.$ = $$[$0-1] + '*'; +break; +case 45 : +/*! Production:: regex_base : regex_base ? */ + this.$ = $$[$0-1] + '?'; +break; +case 46 : +/*! Production:: regex_base : / regex_base */ + this.$ = '(?=' + $$[$0] + ')'; +break; +case 47 : +/*! Production:: regex_base : /! regex_base */ + this.$ = '(?!' + $$[$0] + ')'; +break; +case 51 : +/*! Production:: regex_base : . */ + this.$ = '.'; +break; +case 52 : +/*! Production:: regex_base : ^ */ + this.$ = '^'; +break; +case 53 : +/*! Production:: regex_base : $ */ + this.$ = '$'; +break; +case 57 : +/*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ + case 73 : +/*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ + this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 61 : +/*! Production:: regex_set_atom : name_expansion */ + this.$ = '{[' + $$[$0] + ']}'; +break; +case 64 : +/*! Production:: string : STRING_LIT */ + this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); +break; +case 69 : +/*! Production:: option : NAME */ + yy.options[$$[$0]] = true; +break; +case 70 : +/*! Production:: option : NAME = OPTION_VALUE */ + case 71 : +/*! Production:: option : NAME = NAME */ + yy.options[$$[$0-2]] = $$[$0]; +break; +case 74 : +/*! Production:: include_macro_code : INCLUDE PATH */ + var fs = require('fs'); var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); // And no, we don't support nested '%include': this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; - + break; -case 75: - +case 75 : +/*! Production:: include_macro_code : INCLUDE error */ + console.error("%include MUST be followed by a valid file path"); - + break; } }, -table: [o($V0,[2,4],{3:1,4:2}),{1:[3]},{5:3,6:$V1,11:4,12:$V2,14:$V3,16:$V4,18:$V5,19:9,20:10,64:$V6,73:$V7},{6:[1,13]},{5:14,6:$V1,11:4,12:$V2,14:$V3,16:$V4,18:$V5,19:9,20:10,64:$V6,73:$V7},o([6,12,14,16,18,36,64,73],$V8,{13:15,35:16,37:17,38:18,46:23,48:24,52:28,53:29,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),{15:35,21:[1,36]},{17:37,21:[1,38]},o($V0,[2,10]),o($V0,[2,11]),o($V0,[2,12]),{2:[1,40],74:[1,39]},{12:$Vl,65:41,67:42},o($Vm,$Vn,{7:44,22:45,23:46,30:$Vo}),{6:[2,5]},o($V0,[2,7]),o([6,12,14,16,18,25,64,73],[2,34],{36:$Vp}),o($Vq,[2,37],{46:23,48:24,52:28,53:29,38:49,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),o($Vr,[2,40],{47:53,33:$Vs,42:$Vt,43:$Vu,61:$Vv}),o($Vw,$V8,{37:17,38:18,46:23,48:24,52:28,53:29,35:55,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),o($Vw,$V8,{37:17,38:18,46:23,48:24,52:28,53:29,35:56,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),{38:57,39:$V9,41:$Va,44:$Vb,45:$Vc,46:23,48:24,49:$Vd,50:$Ve,51:$Vf,52:28,53:29,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk},{38:58,39:$V9,41:$Va,44:$Vb,45:$Vc,46:23,48:24,49:$Vd,50:$Ve,51:$Vf,52:28,53:29,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk},o($Vx,[2,48]),o($Vx,[2,50]),o($Vx,[2,51]),o($Vx,[2,52]),o($Vx,[2,53]),o($Vx,[2,54]),o($Vx,[2,55]),o([6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,57,59,60,61,62,63,64,73],[2,56]),{46:62,54:$Vg,56:59,58:60,59:$Vy},o($Vx,[2,64]),o($Vx,[2,65]),o($Vx,[2,62]),o($V0,[2,8],{21:[1,63]}),o($Vz,[2,13]),o($V0,[2,9],{21:[1,64]}),o($Vz,[2,15]),o($VA,[2,74]),o($VA,[2,75]),{66:[1,65]},{12:$Vl,65:66,66:[2,68],67:42},o($VB,[2,69],{69:[1,67]}),o($Vm,$Vn,{23:46,8:68,22:69,6:[1,71],9:[1,70],30:$Vo}),o($VC,[2,18]),o([18,25,36,73],$V8,{35:16,37:17,38:18,46:23,48:24,52:28,53:29,13:72,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),{12:[1,75],31:73,33:[1,74]},o($Vq,[2,36],{38:18,46:23,48:24,52:28,53:29,37:76,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),o($Vr,[2,39],{47:53,33:$Vs,42:$Vt,43:$Vu,61:$Vv}),o($Vx,[2,43]),o($Vx,[2,44]),o($Vx,[2,45]),o($Vx,[2,49]),o($Vx,[2,63]),{36:$Vp,40:[1,77]},{36:$Vp,40:[1,78]},o($Vr,[2,46],{47:53,33:$Vs,42:$Vt,43:$Vu,61:$Vv}),o($Vr,[2,47],{47:53,33:$Vs,42:$Vt,43:$Vu,61:$Vv}),{57:[1,79]},{46:62,54:$Vg,56:80,57:[2,59],58:60,59:$Vy},o($VD,[2,60]),o($VD,[2,61]),o($Vz,[2,14]),o($Vz,[2,16]),o($V0,[2,66]),{66:[2,67]},{12:[1,82],"undefined":[1,81]},{1:[2,1]},o($VC,[2,17]),{1:[2,2]},o($VE,$VF,{10:83,72:84,75:85,76:$VG}),{18:[1,89],19:90,24:87,25:[1,88],73:$V7},{32:[1,91],34:[1,92]},{32:[1,93]},o($VH,[2,32]),o($Vq,[2,35],{46:23,48:24,52:28,53:29,38:49,39:$V9,41:$Va,44:$Vb,45:$Vc,49:$Vd,50:$Ve,51:$Vf,54:$Vg,55:$Vh,60:$Vi,62:$Vj,63:$Vk}),o($Vx,[2,41]),o($Vx,[2,42]),o($Vx,[2,57]),{57:[2,58]},o($VB,[2,70]),o($VB,[2,71]),{9:[1,94]},{9:[2,72],19:95,73:$V7},o($VE,[2,78],{76:[1,96]}),o($VI,[2,76]),o($VC,[2,19]),o($VJ,$VK,{26:97,28:98,29:$VL}),o($VC,[2,21]),o($VC,[2,22]),o($Vm,[2,29]),{12:[1,100]},o($Vm,[2,30]),{1:[2,3]},o($VE,$VF,{72:84,75:85,10:101,76:$VG}),o($VI,[2,77]),{25:$VM,27:[1,102]},o($VJ,[2,24],{29:$VN}),o($VO,[2,27]),o($VH,[2,33]),{9:[2,73]},o($VC,[2,20]),o($VJ,$VK,{28:98,26:105,29:$VL}),o($VO,[2,28]),{25:$VM,27:[1,106]},o($VJ,[2,26],{28:107,29:$VL}),o($VJ,[2,25],{29:$VN})], -defaultActions: {14:[2,5],66:[2,67],68:[2,1],70:[2,2],80:[2,58],94:[2,3],101:[2,73]}, +table: [ + __expand__($V0, [ + 2, + 4 + ], {3:1,4:2,71:[ + 2, + 4 + ] + }), + { + 1: [ + 3 + ] + }, + { + 5: 3, + 6: [ + 2, + 6 + ], + 11: 4, + 12: [ + 1, + 5 + ], + 14: [ + 1, + 6 + ], + 16: [ + 1, + 7 + ], + 18: [ + 1, + 8 + ], + 19: 9, + 20: 10, + 64: [ + 1, + 12 + ], + 71: [ + 1, + 11 + ] + }, + { + 6: [ + 1, + 13 + ] + }, + { + 5: 14, + 6: [ + 2, + 6 + ], + 11: 4, + 12: [ + 1, + 5 + ], + 14: [ + 1, + 6 + ], + 16: [ + 1, + 7 + ], + 18: [ + 1, + 8 + ], + 19: 9, + 20: 10, + 64: [ + 1, + 12 + ], + 71: [ + 1, + 11 + ] + }, + __expand__([6,12,14,16,18,36,64], [ + 2, + 38 + ], {13:15,35:16,37:17,38:18,46:23,48:24,52:28,53:29,39:[ + 1, + 19 + ],41:[ + 1, + 20 + ],44:[ + 1, + 21 + ],45:[ + 1, + 22 + ],49:[ + 1, + 25 + ],50:[ + 1, + 26 + ],51:[ + 1, + 27 + ],54:[ + 1, + 30 + ],55:[ + 1, + 31 + ],60:[ + 1, + 34 + ],62:[ + 1, + 32 + ],63:[ + 1, + 33 + ],71:[ + 2, + 38 + ] + }), + { + 15: 35, + 21: [ + 1, + 36 + ] + }, + { + 17: 37, + 21: [ + 1, + 38 + ] + }, + __expand__($V0, [ + 2, + 10 + ], {71:[ + 2, + 10 + ] + }), + __expand__($V0, [ + 2, + 11 + ], {71:[ + 2, + 11 + ] + }), + __expand__($V0, [ + 2, + 12 + ], {71:[ + 2, + 12 + ] + }), + { + 2: [ + 1, + 40 + ], + 72: [ + 1, + 39 + ] + }, + { + 12: [ + 1, + 43 + ], + 65: 41, + 67: 42 + }, + __expand__($V1, [ + 2, + 31 + ], {7:44,22:45,23:46,30:[ + 1, + 47 + ],71:[ + 2, + 31 + ] + }), + { + 6: [ + 2, + 5 + ] + }, + __expand__($V0, [ + 2, + 7 + ], {71:[ + 2, + 7 + ] + }), + __expand__([6,12,14,16,18,25,64], [ + 2, + 34 + ], {36:[ + 1, + 48 + ],71:[ + 2, + 34 + ] + }), + __expand__($V2, [ + 2, + 37 + ], {46:23,48:24,52:28,53:29,38:49,39:[ + 1, + 19 + ],41:[ + 1, + 20 + ],44:[ + 1, + 21 + ],45:[ + 1, + 22 + ],49:[ + 1, + 25 + ],50:[ + 1, + 26 + ],51:[ + 1, + 27 + ],54:[ + 1, + 30 + ],55:[ + 1, + 31 + ],60:[ + 1, + 34 + ],62:[ + 1, + 32 + ],63:[ + 1, + 33 + ],71:[ + 2, + 37 + ] + }), + __expand__($V3, [ + 2, + 40 + ], {47:53,33:[ + 1, + 51 + ],42:[ + 1, + 50 + ],43:[ + 1, + 52 + ],61:[ + 1, + 54 + ],71:[ + 2, + 40 + ] + }), + __expand__($V4, [ + 2, + 38 + ], {37:17,38:18,46:23,48:24,52:28,53:29,35:55,39:[ + 1, + 19 + ],41:[ + 1, + 20 + ],44:[ + 1, + 21 + ],45:[ + 1, + 22 + ],49:[ + 1, + 25 + ],50:[ + 1, + 26 + ],51:[ + 1, + 27 + ],54:[ + 1, + 30 + ],55:[ + 1, + 31 + ],60:[ + 1, + 34 + ],62:[ + 1, + 32 + ],63:[ + 1, + 33 + ] + }), + __expand__($V4, [ + 2, + 38 + ], {37:17,38:18,46:23,48:24,52:28,53:29,35:56,39:[ + 1, + 19 + ],41:[ + 1, + 20 + ],44:[ + 1, + 21 + ],45:[ + 1, + 22 + ],49:[ + 1, + 25 + ],50:[ + 1, + 26 + ],51:[ + 1, + 27 + ],54:[ + 1, + 30 + ],55:[ + 1, + 31 + ],60:[ + 1, + 34 + ],62:[ + 1, + 32 + ],63:[ + 1, + 33 + ] + }), + { + 38: 57, + 39: [ + 1, + 19 + ], + 41: [ + 1, + 20 + ], + 44: [ + 1, + 21 + ], + 45: [ + 1, + 22 + ], + 46: 23, + 48: 24, + 49: [ + 1, + 25 + ], + 50: [ + 1, + 26 + ], + 51: [ + 1, + 27 + ], + 52: 28, + 53: 29, + 54: [ + 1, + 30 + ], + 55: [ + 1, + 31 + ], + 60: [ + 1, + 34 + ], + 62: [ + 1, + 32 + ], + 63: [ + 1, + 33 + ] + }, + { + 38: 58, + 39: [ + 1, + 19 + ], + 41: [ + 1, + 20 + ], + 44: [ + 1, + 21 + ], + 45: [ + 1, + 22 + ], + 46: 23, + 48: 24, + 49: [ + 1, + 25 + ], + 50: [ + 1, + 26 + ], + 51: [ + 1, + 27 + ], + 52: 28, + 53: 29, + 54: [ + 1, + 30 + ], + 55: [ + 1, + 31 + ], + 60: [ + 1, + 34 + ], + 62: [ + 1, + 32 + ], + 63: [ + 1, + 33 + ] + }, + __expand__($V5, [ + 2, + 48 + ], {71:[ + 2, + 48 + ] + }), + __expand__($V5, [ + 2, + 50 + ], {71:[ + 2, + 50 + ] + }), + __expand__($V5, [ + 2, + 51 + ], {71:[ + 2, + 51 + ] + }), + __expand__($V5, [ + 2, + 52 + ], {71:[ + 2, + 52 + ] + }), + __expand__($V5, [ + 2, + 53 + ], {71:[ + 2, + 53 + ] + }), + __expand__($V5, [ + 2, + 54 + ], {71:[ + 2, + 54 + ] + }), + __expand__($V5, [ + 2, + 55 + ], {71:[ + 2, + 55 + ] + }), + __expand__([6,12,14,16,18,25,33,36,39,40,41,42,43,44,45,49,50,51,54,55,57,59,60,61,62,63,64], [ + 2, + 56 + ], {71:[ + 2, + 56 + ] + }), + { + 46: 62, + 54: [ + 1, + 30 + ], + 56: 59, + 58: 60, + 59: [ + 1, + 61 + ] + }, + __expand__($V5, [ + 2, + 64 + ], {71:[ + 2, + 64 + ] + }), + __expand__($V5, [ + 2, + 65 + ], {71:[ + 2, + 65 + ] + }), + __expand__($V5, [ + 2, + 62 + ], {71:[ + 2, + 62 + ] + }), + __expand__($V0, [ + 2, + 8 + ], {21:[ + 1, + 63 + ],71:[ + 2, + 8 + ] + }), + __expand__($V6, [ + 2, + 13 + ], {71:[ + 2, + 13 + ] + }), + __expand__($V0, [ + 2, + 9 + ], {21:[ + 1, + 64 + ],71:[ + 2, + 9 + ] + }), + __expand__($V6, [ + 2, + 15 + ], {71:[ + 2, + 15 + ] + }), + __expand__($V7, [ + 2, + 74 + ], {74:[ + 2, + 74 + ] + }), + __expand__($V7, [ + 2, + 75 + ], {74:[ + 2, + 75 + ] + }), + { + 66: [ + 1, + 65 + ] + }, + { + 12: [ + 1, + 43 + ], + 65: 66, + 66: [ + 2, + 68 + ], + 67: 42 + }, + __expand__([12,66], [ + 2, + 69 + ], {68:[ + 1, + 67 + ] + }), + __expand__($V1, [ + 2, + 31 + ], {23:46,8:68,22:69,6:[ + 1, + 71 + ],9:[ + 1, + 70 + ],30:[ + 1, + 47 + ],71:[ + 2, + 31 + ] + }), + __expand__($V8, [ + 2, + 18 + ], {71:[ + 2, + 18 + ] + }), + __expand__([18,25,36], [ + 2, + 38 + ], {35:16,37:17,38:18,46:23,48:24,52:28,53:29,13:72,39:[ + 1, + 19 + ],41:[ + 1, + 20 + ],44:[ + 1, + 21 + ],45:[ + 1, + 22 + ],49:[ + 1, + 25 + ],50:[ + 1, + 26 + ],51:[ + 1, + 27 + ],54:[ + 1, + 30 + ],55:[ + 1, + 31 + ],60:[ + 1, + 34 + ],62:[ + 1, + 32 + ],63:[ + 1, + 33 + ],71:[ + 2, + 38 + ] + }), + { + 12: [ + 1, + 75 + ], + 31: 73, + 33: [ + 1, + 74 + ] + }, + __expand__($V2, [ + 2, + 36 + ], {38:18,46:23,48:24,52:28,53:29,37:76,39:[ + 1, + 19 + ],41:[ + 1, + 20 + ],44:[ + 1, + 21 + ],45:[ + 1, + 22 + ],49:[ + 1, + 25 + ],50:[ + 1, + 26 + ],51:[ + 1, + 27 + ],54:[ + 1, + 30 + ],55:[ + 1, + 31 + ],60:[ + 1, + 34 + ],62:[ + 1, + 32 + ],63:[ + 1, + 33 + ],71:[ + 2, + 36 + ] + }), + __expand__($V3, [ + 2, + 39 + ], {47:53,33:[ + 1, + 51 + ],42:[ + 1, + 50 + ],43:[ + 1, + 52 + ],61:[ + 1, + 54 + ],71:[ + 2, + 39 + ] + }), + __expand__($V5, [ + 2, + 43 + ], {71:[ + 2, + 43 + ] + }), + __expand__($V5, [ + 2, + 44 + ], {71:[ + 2, + 44 + ] + }), + __expand__($V5, [ + 2, + 45 + ], {71:[ + 2, + 45 + ] + }), + __expand__($V5, [ + 2, + 49 + ], {71:[ + 2, + 49 + ] + }), + __expand__($V5, [ + 2, + 63 + ], {71:[ + 2, + 63 + ] + }), + { + 36: [ + 1, + 48 + ], + 40: [ + 1, + 77 + ] + }, + { + 36: [ + 1, + 48 + ], + 40: [ + 1, + 78 + ] + }, + __expand__($V3, [ + 2, + 46 + ], {47:53,33:[ + 1, + 51 + ],42:[ + 1, + 50 + ],43:[ + 1, + 52 + ],61:[ + 1, + 54 + ],71:[ + 2, + 46 + ] + }), + __expand__($V3, [ + 2, + 47 + ], {47:53,33:[ + 1, + 51 + ],42:[ + 1, + 50 + ],43:[ + 1, + 52 + ],61:[ + 1, + 54 + ],71:[ + 2, + 47 + ] + }), + { + 57: [ + 1, + 79 + ] + }, + { + 46: 62, + 54: [ + 1, + 30 + ], + 56: 80, + 57: [ + 2, + 59 + ], + 58: 60, + 59: [ + 1, + 61 + ] + }, + __expand__($V9, [ + 2, + 60 + ], {59:[ + 2, + 60 + ] + }), + __expand__($V9, [ + 2, + 61 + ], {59:[ + 2, + 61 + ] + }), + __expand__($V6, [ + 2, + 14 + ], {71:[ + 2, + 14 + ] + }), + __expand__($V6, [ + 2, + 16 + ], {71:[ + 2, + 16 + ] + }), + __expand__($V0, [ + 2, + 66 + ], {71:[ + 2, + 66 + ] + }), + { + 66: [ + 2, + 67 + ] + }, + { + 12: [ + 1, + 82 + ], + 69: [ + 1, + 81 + ] + }, + { + 1: [ + 2, + 1 + ] + }, + __expand__($V8, [ + 2, + 17 + ], {71:[ + 2, + 17 + ] + }), + { + 1: [ + 2, + 2 + ] + }, + __expand__($Va, [ + 2, + 79 + ], {10:83,70:84,73:85,74:[ + 1, + 86 + ] + }), + { + 18: [ + 1, + 89 + ], + 19: 90, + 24: 87, + 25: [ + 1, + 88 + ], + 71: [ + 1, + 11 + ] + }, + { + 32: [ + 1, + 91 + ], + 34: [ + 1, + 92 + ] + }, + { + 32: [ + 1, + 93 + ] + }, + { + 32: [ + 2, + 32 + ], + 34: [ + 2, + 32 + ] + }, + __expand__($V2, [ + 2, + 35 + ], {46:23,48:24,52:28,53:29,38:49,39:[ + 1, + 19 + ],41:[ + 1, + 20 + ],44:[ + 1, + 21 + ],45:[ + 1, + 22 + ],49:[ + 1, + 25 + ],50:[ + 1, + 26 + ],51:[ + 1, + 27 + ],54:[ + 1, + 30 + ],55:[ + 1, + 31 + ],60:[ + 1, + 34 + ],62:[ + 1, + 32 + ],63:[ + 1, + 33 + ],71:[ + 2, + 35 + ] + }), + __expand__($V5, [ + 2, + 41 + ], {71:[ + 2, + 41 + ] + }), + __expand__($V5, [ + 2, + 42 + ], {71:[ + 2, + 42 + ] + }), + __expand__($V5, [ + 2, + 57 + ], {71:[ + 2, + 57 + ] + }), + { + 57: [ + 2, + 58 + ] + }, + { + 12: [ + 2, + 70 + ], + 66: [ + 2, + 70 + ] + }, + { + 12: [ + 2, + 71 + ], + 66: [ + 2, + 71 + ] + }, + { + 9: [ + 1, + 94 + ] + }, + { + 9: [ + 2, + 72 + ], + 19: 95, + 71: [ + 1, + 11 + ] + }, + __expand__($Va, [ + 2, + 78 + ], {74:[ + 1, + 96 + ] + }), + __expand__($Va, [ + 2, + 76 + ], {74:[ + 2, + 76 + ] + }), + __expand__($V8, [ + 2, + 19 + ], {71:[ + 2, + 19 + ] + }), + __expand__($Vb, [ + 2, + 23 + ], {26:97,28:98,29:[ + 1, + 99 + ] + }), + __expand__($V8, [ + 2, + 21 + ], {71:[ + 2, + 21 + ] + }), + __expand__($V8, [ + 2, + 22 + ], {71:[ + 2, + 22 + ] + }), + __expand__($V1, [ + 2, + 29 + ], {71:[ + 2, + 29 + ] + }), + { + 12: [ + 1, + 100 + ] + }, + __expand__($V1, [ + 2, + 30 + ], {71:[ + 2, + 30 + ] + }), + { + 1: [ + 2, + 3 + ] + }, + __expand__($Va, [ + 2, + 79 + ], {70:84,73:85,10:101,74:[ + 1, + 86 + ] + }), + __expand__($Va, [ + 2, + 77 + ], {74:[ + 2, + 77 + ] + }), + { + 25: [ + 1, + 103 + ], + 27: [ + 1, + 102 + ] + }, + __expand__($Vb, [ + 2, + 24 + ], {29:[ + 1, + 104 + ] + }), + __expand__($Vb, [ + 2, + 27 + ], {29:[ + 2, + 27 + ] + }), + { + 32: [ + 2, + 33 + ], + 34: [ + 2, + 33 + ] + }, + { + 9: [ + 2, + 73 + ] + }, + __expand__($V8, [ + 2, + 20 + ], {71:[ + 2, + 20 + ] + }), + __expand__($Vb, [ + 2, + 23 + ], {28:98,26:105,29:[ + 1, + 99 + ] + }), + __expand__($Vb, [ + 2, + 28 + ], {29:[ + 2, + 28 + ] + }), + { + 25: [ + 1, + 103 + ], + 27: [ + 1, + 106 + ] + }, + __expand__($Vb, [ + 2, + 26 + ], {28:107,29:[ + 1, + 99 + ] + }), + __expand__($Vb, [ + 2, + 25 + ], {29:[ + 1, + 104 + ] + }) +], +defaultActions: { + 14: [ + 2, + 5 + ], + 66: [ + 2, + 67 + ], + 68: [ + 2, + 1 + ], + 70: [ + 2, + 2 + ], + 80: [ + 2, + 58 + ], + 94: [ + 2, + 3 + ], + 101: [ + 2, + 73 + ] +}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { - throw new Error(str); + throw new this.JisonParserError(str, hash); } }, parse: function parse(input) { var self = this, stack = [0], - tstack = [], // token stack - vstack = [null], // semantic value stack - lstack = [], // location stack + + vstack = [null], // semantic value stack + lstack = [], // location stack table = this.table, yytext = '', yylineno = 0, yyleng = 0, - recovering = 0, + recovering = 0, // (only used when the grammar contains error recovery rules) TERROR = 2, EOF = 1; @@ -273,8 +2260,16 @@ parse: function parse(input) { //this.reductionCount = this.shiftCount = 0; - var lexer = Object.create(this.lexer); - var sharedState = { yy: {} }; + var lexer; + if (this.__lexer__) { + lexer = this.__lexer__; + } else { + lexer = this.__lexer__ = Object.create(this.lexer); + } + + var sharedState = { + yy: {} + }; // copy state for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { @@ -285,7 +2280,7 @@ parse: function parse(input) { lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; - if (typeof lexer.yylloc == 'undefined') { + if (typeof lexer.yylloc === 'undefined') { lexer.yylloc = {}; } var yyloc = lexer.yylloc; @@ -293,19 +2288,17 @@ parse: function parse(input) { var ranges = lexer.options && lexer.options.ranges; + // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; - } else { - this.parseError = Object.getPrototypeOf(this).parseError; - } + } - function popStack (n) { + function popStack(n) { stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; lstack.length = lstack.length - n; } -_token_stack: function lex() { var token; token = lexer.lex() || EOF; @@ -316,112 +2309,166 @@ _token_stack: return token; } - var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; - while (true) { - // retreive state number from top of stack - state = stack[stack.length - 1]; + var symbol; + var preErrorSymbol = null; + var state, action, a, r; + var yyval = {}; + var p, len, len1, this_production, lstack_begin, lstack_end, newState; + var expected = []; + var retval = false; - // use default actions if available - if (this.defaultActions[state]) { - action = this.defaultActions[state]; - } else { - if (symbol === null || typeof symbol == 'undefined') { - symbol = lex(); + if (this.pre_parse) { + this.pre_parse.call(this, sharedState.yy); + } + if (sharedState.yy.pre_parse) { + sharedState.yy.pre_parse.call(this, sharedState.yy); + } + + // Return the rule stack depth where the nearest error rule can be found. + // Return FALSE when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = stack.length - 1; + var depth = 0; + + // try to recover from error + for (;;) { + // check for error recovery rule in this state + if ((TERROR.toString()) in table[state]) { + return depth; } - // read action for current state and first input - action = table[state] && table[state][symbol]; + if (state === 0 || stack_probe < 2) { + return false; // No suitable error recovery rule available. + } + stack_probe -= 2; // popStack(1): [symbol, action] + state = stack[stack_probe]; + ++depth; } + } -_handle_error: - // handle parse error - if (typeof action === 'undefined' || !action.length || !action[0]) { - var error_rule_depth; - var errStr = ''; - // Return the rule stack depth where the nearest error rule can be found. - // Return FALSE when no error recovery rule was found. - function locateNearestErrorRecoveryRule(state) { - var stack_probe = stack.length - 1; - var depth = 0; + function collect_expected_token_set(state) { + var tokenset = []; + for (var p in table[state]) { + if (p > TERROR) { + if (self.terminal_descriptions_ && self.terminal_descriptions_[p]) { + tokenset.push(self.terminal_descriptions_[p]); + } + else if (self.terminals_[p]) { + tokenset.push("'" + self.terminals_[p] + "'"); + } + } + } + return tokenset; + } + + try { + for (;;) { + // retrieve state number from top of stack + state = stack[stack.length - 1]; - // try to recover from error - for(;;) { - // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { - return depth; - } - if (state === 0 || stack_probe < 2) { - return false; // No suitable error recovery rule available. - } - stack_probe -= 2; // popStack(1): [symbol, action] - state = stack[stack_probe]; - ++depth; + // use default actions if available + if (this.defaultActions[state]) { + action = this.defaultActions[state]; + } else { + if (symbol === null || typeof symbol === 'undefined') { + symbol = lex(); } + // read action for current state and first input + action = table[state] && table[state][symbol]; } - if (!recovering) { - // first see if there's any chance at hitting an error recovery rule: - error_rule_depth = locateNearestErrorRecoveryRule(state); + // handle parse error + if (typeof action === 'undefined' || !action.length || !action[0]) { + var error_rule_depth; + var errStr = ''; + + if (!recovering) { + // first see if there's any chance at hitting an error recovery rule: + error_rule_depth = locateNearestErrorRecoveryRule(state); - // Report error - expected = []; - for (p in table[state]) { - if (this.terminals_[p] && p > TERROR) { - expected.push("'"+this.terminals_[p]+"'"); + // Report error + expected = collect_expected_token_set(state); + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + } else { + errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + + (symbol === EOF ? 'end of input' : + ("'" + (this.terminals_[symbol] || symbol) + "'")); + } + a = this.parseError(errStr, p = { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: (error_rule_depth !== false) + }); + if (!p.recoverable) { + retval = a; + break; } + } else if (preErrorSymbol !== EOF) { + error_rule_depth = locateNearestErrorRecoveryRule(state); } - if (lexer.showPosition) { - errStr = 'Parse error on line '+(yylineno+1)+":\n"+lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol)+ "'"; - } else { - errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " + - (symbol == EOF ? "end of input" : - ("'"+(this.terminals_[symbol] || symbol)+"'")); + + // just recovered from another error + if (recovering === 3) { + if (symbol === EOF || preErrorSymbol === EOF) { + retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; + } + + // discard current lookahead and grab another + yyleng = lexer.yyleng; + yytext = lexer.yytext; + yylineno = lexer.yylineno; + yyloc = lexer.yylloc; + symbol = lex(); + } + + // try to recover from error + if (error_rule_depth === false) { + retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + line: lexer.yylineno, + loc: yyloc, + expected: expected, + recoverable: false + }); + break; } - this.parseError(errStr, { + popStack(error_rule_depth); + + preErrorSymbol = (symbol === TERROR ? null : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + state = stack[stack.length - 1]; + action = table[state] && table[state][TERROR]; + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + } + + + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array && action.length > 1) { + retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { text: lexer.match, token: this.terminals_[symbol] || symbol, line: lexer.yylineno, loc: yyloc, expected: expected, - recoverable: (error_rule_depth !== false) + recoverable: false }); - } else if (preErrorSymbol !== EOF) { - error_rule_depth = locateNearestErrorRecoveryRule(state); - } - - // just recovered from another error - if (recovering == 3) { - if (symbol === EOF || preErrorSymbol === EOF) { - throw new Error(errStr || 'Parsing halted while starting to recover from another error.'); - } - - // discard current lookahead and grab another - yyleng = lexer.yyleng; - yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; - symbol = lex(); - } - - // try to recover from error - if (error_rule_depth === false) { - throw new Error(errStr || 'Parsing halted. No suitable error recovery rule available.'); + break; } - popStack(error_rule_depth); - - preErrorSymbol = (symbol == TERROR ? null : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length-1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error - } - - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol); - } - switch (action[0]) { + switch (action[0]) { case 1: // shift //this.shiftCount++; @@ -430,7 +2477,7 @@ _handle_error: lstack.push(lexer.yylloc); stack.push(action[1]); // push state symbol = null; - if (!preErrorSymbol) { // normal execution/no error + if (!preErrorSymbol) { // normal execution / no error yyleng = lexer.yyleng; yytext = lexer.yytext; yylineno = lexer.yylineno; @@ -443,56 +2490,75 @@ _handle_error: symbol = preErrorSymbol; preErrorSymbol = null; } - break; + continue; case 2: // reduce //this.reductionCount++; - len = this.productions_[action[1]][1]; + this_production = this.productions_[action[1]]; + len = this_production[1]; + lstack_end = lstack.length; + lstack_begin = lstack_end - (len1 || 1); + lstack_end--; // perform semantic action - yyval.$ = vstack[vstack.length-len]; // default to $$ = $1 + yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 // default location, uses first token for firsts, last for lasts yyval._$ = { - first_line: lstack[lstack.length-(len||1)].first_line, - last_line: lstack[lstack.length-1].last_line, - first_column: lstack[lstack.length-(len||1)].first_column, - last_column: lstack[lstack.length-1].last_column + first_line: lstack[lstack_begin].first_line, + last_line: lstack[lstack_end].last_line, + first_column: lstack[lstack_begin].first_column, + last_column: lstack[lstack_end].last_column }; if (ranges) { - yyval._$.range = [lstack[lstack.length-(len||1)].range[0], lstack[lstack.length-1].range[1]]; + yyval._$.range = [lstack[lstack_begin].range[0], lstack[lstack_end].range[1]]; } r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); if (typeof r !== 'undefined') { - return r; + retval = r; + break; } // pop off stack if (len) { - stack = stack.slice(0,-1*len*2); - vstack = vstack.slice(0, -1*len); - lstack = lstack.slice(0, -1*len); + popStack(len); } - stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce) + stack.push(this_production[0]); // push nonterminal (reduce) vstack.push(yyval.$); lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length-2]][stack[stack.length-1]]; + newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); - break; + continue; case 3: // accept - return true; + retval = true; + break; + } + + // break out of loop: we accept or fail with error + break; } + } finally { + var rv; + if (sharedState.yy.post_parse) { + rv = sharedState.yy.post_parse.call(this, sharedState.yy, retval); + if (typeof rv !== 'undefined') retval = rv; + } + if (this.post_parse) { + rv = this.post_parse.call(this, sharedState.yy, retval); + if (typeof rv !== 'undefined') retval = rv; + } } - return true; -}}; + return retval; +} +}; function encodeRE (s) { @@ -506,17 +2572,34 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4 */ -var lexer = (function(){ + +/* generated by jison-lex 0.3.4-100 */ +var lexer = (function () { +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +function JisonLexerError(msg, hash) { + this.message = msg; + this.hash = hash; + var stacktrace = (new Error(msg)).stack; + if (stacktrace) { + this.stack = stacktrace; + } +} +JisonLexerError.prototype = Object.create(Error.prototype); +JisonLexerError.prototype.constructor = JisonLexerError; +JisonLexerError.prototype.name = 'JisonLexerError'; + var lexer = ({ EOF:1, +ERROR:2, + parseError:function parseError(str, hash) { if (this.yy.parser) { - this.yy.parser.parseError(str, hash); + return this.yy.parser.parseError(str, hash) || this.ERROR; } else { - throw new Error(str); + throw new this.JisonLexerError(str); } }, @@ -524,7 +2607,7 @@ parseError:function parseError(str, hash) { setInput:function (input, yy) { this.yy = yy || this.yy || {}; this._input = input; - this._more = this._backtrack = this.done = false; + this._more = this._backtrack = this._signaled_error_token = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; @@ -535,7 +2618,7 @@ setInput:function (input, yy) { last_column: 0 }; if (this.options.ranges) { - this.yylloc.range = [0,0]; + this.yylloc.range = [0, 0]; } this.offset = 0; return this; @@ -549,7 +2632,30 @@ input:function () { this.offset++; this.match += ch; this.matched += ch; - var lines = ch.match(/(?:\r\n?|\n).*/g); + // Count the linenumber up when we hit the LF (or a stand-alone CR). + // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo + // and we advance immediately past the LF as well, returning both together as if + // it was all a single 'character' only. + var slice_len = 1; + var lines = false; + if (ch === '\n') { + lines = true; + } else if (ch === '\r') { + lines = true; + var ch2 = this._input[1]; + if (ch2 === '\n') { + slice_len++; + ch += ch2; + this.yytext += ch2; + this.yyleng++; + this.offset++; + this.match += ch2; + this.matched += ch2; + if (this.options.ranges) { + this.yylloc.range[1]++; + } + } + } if (lines) { this.yylineno++; this.yylloc.last_line++; @@ -560,7 +2666,7 @@ input:function () { this.yylloc.range[1]++; } - this._input = this._input.slice(1); + this._input = this._input.slice(slice_len); return ch; }, @@ -574,8 +2680,8 @@ unput:function (ch) { //this.yyleng -= len; this.offset -= len; var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - 1); - this.matched = this.matched.substr(0, this.matched.length - 1); + this.match = this.match.substr(0, this.match.length - len); + this.matched = this.matched.substr(0, this.matched.length - len); if (lines.length - 1) { this.yylineno -= lines.length - 1; @@ -588,8 +2694,8 @@ unput:function (ch) { first_column: this.yylloc.first_column, last_column: lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len }; if (this.options.ranges) { @@ -610,12 +2716,15 @@ reject:function () { if (this.options.backtrack_lexer) { this._backtrack = true; } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: "", + // when the parseError() call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // .lex() run. + this._signaled_error_token = (this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { + text: this.match, token: null, - line: this.yylineno - }); - + line: this.yylineno, + loc: this.yylloc + }) || this.ERROR); } return this; }, @@ -625,26 +2734,34 @@ less:function (n) { this.unput(this.match.slice(n)); }, -// displays already matched input, i.e. for error messages -pastInput:function () { +// return (part of the) already matched input, i.e. for error messages +pastInput:function (maxSize) { var past = this.matched.substr(0, this.matched.length - this.match.length); - return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + return (past.length > maxSize ? '...' + past.substr(-maxSize) : past); }, -// displays upcoming input, i.e. for error messages -upcomingInput:function () { +// return (part of the) upcoming input, i.e. for error messages +upcomingInput:function (maxSize) { var next = this.match; - if (next.length < 20) { - next += this._input.substr(0, 20-next.length); + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + if (next.length < maxSize) { + next += this._input.substr(0, maxSize - next.length); } - return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); + return (next.length > maxSize ? next.substr(0, maxSize) + '...' : next); }, -// displays the character position where the lexing error occurred, i.e. for error messages +// return a string which displays the character position where the lexing error occurred, i.e. for error messages showPosition:function () { - var pre = this.pastInput(); - var c = new Array(pre.length + 1).join("-"); - return pre + this.upcomingInput() + "\n" + c + "^"; + var pre = this.pastInput().replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput().replace(/\s/g, ' ') + '\n' + c + '^'; }, // test the lexed token: return FALSE when not a match, otherwise return token @@ -697,8 +2814,9 @@ test_match:function (match, indexed_rule) { this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset += this.yyleng]; + this.yylloc.range = [this.offset, this.offset + this.yyleng]; } + this.offset += this.yyleng; this._more = false; this._backtrack = false; this._input = this._input.slice(match[0].length); @@ -715,13 +2833,28 @@ test_match:function (match, indexed_rule) { this[k] = backup[k]; } return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + this._signaled_error_token = false; + return token; } return false; }, // return next match in input next:function () { + function clear() { + this.yytext = ''; + this.yyleng = 0; + this.match = ''; + this.matches = false; + this._more = false; + this._backtrack = false; + } + if (this.done) { + clear.call(this); return this.EOF; } if (!this._input) { @@ -733,8 +2866,7 @@ next:function () { tempMatch, index; if (!this._more) { - this.yytext = ''; - this.match = ''; + clear.call(this); } var rules = this._currentRules(); for (var i = 0; i < rules.length; i++) { @@ -766,25 +2898,42 @@ next:function () { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } - if (this._input === "") { + if (this._input === '') { + clear.call(this); + this.done = true; return this.EOF; } else { - return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: "", + token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { + text: this.match + this._input, token: null, - line: this.yylineno - }); + line: this.yylineno, + loc: this.yylloc + }) || this.ERROR; + if (token === this.ERROR) { + // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward one character at a time: + if (!this.match.length) { + this.input(); + } + } + return token; } }, // return next match that has a token lex:function lex() { - var r = this.next(); - if (r) { - return r; - } else { - return this.lex(); + var r; + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + while (!r) { + r = this.next(); } + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + return r; }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) @@ -807,7 +2956,7 @@ _currentRules:function _currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { - return this.conditions["INITIAL"].rules; + return this.conditions['INITIAL'].rules; } }, @@ -817,7 +2966,7 @@ topState:function topState(n) { if (n >= 0) { return this.conditionStack[n]; } else { - return "INITIAL"; + return 'INITIAL'; } }, @@ -830,79 +2979,119 @@ pushState:function pushState(condition) { stateStackSize:function stateStackSize() { return this.conditionStack.length; }, -options: {"ranges":true}, -performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { -var YYSTATE=YY_START; +options: { + "easy_keyword_rules": true, + "ranges": true +}, +JisonLexerError: JisonLexerError, +performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { + +var YYSTATE = YY_START; switch($avoiding_name_collisions) { -case 0:return 29; -break; -case 1:return 29; -break; -case 2:return 29; // regexp with braces or quotes (and no spaces) -break; -case 3:return 29; -break; -case 4:return 29; -break; -case 5:return 29; -break; -case 6:return 29; -break; -case 7:yy.depth++; return 25; -break; -case 8:if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 27; -break; -case 9:return 12; -break; -case 10:this.popState(); return 32; -break; -case 11:return 34; -break; -case 12:return 33; -break; -case 13:/* empty */ -break; -case 14:/* empty */ -break; -case 15:this.begin('indented'); -break; -case 16:this.begin('code'); return 6; -break; -case 17:return 63; -break; -case 18:return 12; -break; -case 19:return 69; -break; -case 20:yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 'OPTION_VALUE'; -break; -case 21:yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 'OPTION_VALUE'; -break; -case 22:return 'OPTION_VALUE'; -break; -case 23:this.popState(); return 66; -break; -case 24:this.popState(); return 66; -break; -case 25:/* empty */ -break; -case 26:return 21; -break; -case 27:this.popState(); -break; -case 28:this.popState(); -break; -case 29:/* empty */ -break; -case 30:this.begin('rules'); -break; -case 31:yy.depth = 0; this.begin('action'); return 25; -break; -case 32:this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; -break; -case 33:yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; -break; -case 34: +case 2 : +/*! Conditions:: action */ +/*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ + return 29; // regexp with braces or quotes (and no spaces) +break; +case 7 : +/*! Conditions:: action */ +/*! Rule:: \{ */ + yy.depth++; return 25; +break; +case 8 : +/*! Conditions:: action */ +/*! Rule:: \} */ + if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 27; +break; +case 10 : +/*! Conditions:: conditions */ +/*! Rule:: > */ + this.popState(); return 32; +break; +case 13 : +/*! Conditions:: rules */ +/*! Rule:: {BR}+ */ + /* empty */ +break; +case 14 : +/*! Conditions:: rules */ +/*! Rule:: \s+{BR}+ */ + /* empty */ +break; +case 15 : +/*! Conditions:: rules */ +/*! Rule:: \s+ */ + this.begin('indented'); +break; +case 16 : +/*! Conditions:: rules */ +/*! Rule:: %% */ + this.begin('code'); return 6; +break; +case 20 : +/*! Conditions:: options */ +/*! Rule:: "(\\\\|\\"|[^"])*" */ + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 69; +break; +case 21 : +/*! Conditions:: options */ +/*! Rule:: '(\\\\|\\'|[^'])*' */ + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 69; +break; +case 23 : +/*! Conditions:: options */ +/*! Rule:: {BR}+ */ + this.popState(); return 66; +break; +case 24 : +/*! Conditions:: options */ +/*! Rule:: \s+{BR}+ */ + this.popState(); return 66; +break; +case 25 : +/*! Conditions:: options */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 27 : +/*! Conditions:: start_condition */ +/*! Rule:: {BR}+ */ + this.popState(); +break; +case 28 : +/*! Conditions:: start_condition */ +/*! Rule:: \s+{BR}+ */ + this.popState(); +break; +case 29 : +/*! Conditions:: start_condition */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 30 : +/*! Conditions:: trail */ +/*! Rule:: \s*{BR}+ */ + this.begin('rules'); +break; +case 31 : +/*! Conditions:: indented */ +/*! Rule:: \{ */ + yy.depth = 0; this.begin('action'); return 25; +break; +case 32 : +/*! Conditions:: indented */ +/*! Rule:: %\{(.|{BR})*?%\} */ + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; +break; +case 33 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %\{(.|{BR})*?%\} */ + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; +break; +case 34 : +/*! Conditions:: indented */ +/*! Rule:: %include\b */ + // This is an include instruction in place of an action: // thanks to the `.+` rule immediately below we need to semi-duplicate // the `%include` token recognition here vs. the almost-identical rule for the same @@ -919,146 +3108,663 @@ case 34: this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 73; - -break; -case 35:this.begin('rules'); return 18; -break; -case 36:/* ignore */ -break; -case 37:/* ignore */ -break; -case 38:/* empty */ -break; -case 39:/* empty */ -break; -case 40:return 12; -break; -case 41:yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 62; -break; -case 42:yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 62; -break; -case 43:this.pushState('set'); return 55; -break; -case 44:return 36; -break; -case 45:return 41; -break; -case 46:return 41; -break; -case 47:return 41; -break; -case 48:return 39; -break; -case 49:return 40; -break; -case 50:return 42; -break; -case 51:return 33; -break; -case 52:return 43; -break; -case 53:return 50; -break; -case 54:return 34; -break; -case 55:return 51; -break; -case 56:this.begin('conditions'); return 30; -break; -case 57:return 45; // treated as `(?!atom)` -break; -case 58:return 44; // treated as `(?=atom)` -break; -case 59:return 60; -break; -case 60:yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 60; -break; -case 61:return 51; -break; -case 62:return 49; -break; -case 63:if (!yy.options) { yy.options = {}; } this.begin('options'); return 64; -break; -case 64:this.begin('start_condition'); return 14; -break; -case 65:this.begin('start_condition'); return 16; -break; -case 66:this.pushState('path'); return 73; -break; -case 67: + return 71; + +break; +case 35 : +/*! Conditions:: indented */ +/*! Rule:: .+ */ + this.begin('rules'); return 18; +break; +case 36 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /* ignore */ +break; +case 37 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/\/.* */ + /* ignore */ +break; +case 38 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: {BR}+ */ + /* empty */ +break; +case 39 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 41 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: "(\\\\|\\"|[^"])*" */ + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 62; +break; +case 42 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: '(\\\\|\\'|[^'])*' */ + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 62; +break; +case 43 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \[ */ + this.pushState('set'); return 55; +break; +case 56 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: < */ + this.begin('conditions'); return 30; +break; +case 57 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/! */ + return 45; // treated as `(?!atom)` +break; +case 58 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \/ */ + return 44; // treated as `(?=atom)` +break; +case 60 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 60; +break; +case 63 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %options\b */ + if (!yy.options) { yy.options = {}; } this.begin('options'); return 64; +break; +case 64 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %s\b */ + this.begin('start_condition'); return 14; +break; +case 65 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %x\b */ + this.begin('start_condition'); return 16; +break; +case 66 : +/*! Conditions:: INITIAL trail code */ +/*! Rule:: %include\b */ + this.pushState('path'); return 71; +break; +case 67 : +/*! Conditions:: INITIAL rules trail code */ +/*! Rule:: %{NAME}[^\r\n]+ */ + /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - -break; -case 68:this.begin('rules'); return 6; -break; -case 69:return 61; -break; -case 70:return 54; -break; -case 71:return 54; -break; -case 72:return 25; -break; -case 73:return 27; -break; -case 74:throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ -break; -case 75:return 9; -break; -case 76:return 59; -break; -case 77:this.popState('set'); return 57; -break; -case 78:return 76; -break; -case 79:return 76; // the bit of CODE just before EOF... -break; -case 80:this.popState(); this.unput(yy_.yytext); -break; -case 81:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; -break; -case 82:yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; -break; -case 83:// skip whitespace in the line -break; -case 84:this.popState(); return 74; -break; -case 85: + +break; +case 68 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: %% */ + this.begin('rules'); return 6; +break; +case 74 : +/*! Conditions:: indented trail rules INITIAL */ +/*! Rule:: . */ + throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ +break; +case 77 : +/*! Conditions:: set */ +/*! Rule:: \] */ + this.popState('set'); return 57; +break; +case 79 : +/*! Conditions:: code */ +/*! Rule:: [^\r\n]+ */ + return 74; // the bit of CODE just before EOF... +break; +case 80 : +/*! Conditions:: path */ +/*! Rule:: [\r\n] */ + this.popState(); this.unput(yy_.yytext); +break; +case 81 : +/*! Conditions:: path */ +/*! Rule:: '[^\r\n]+' */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 72; +break; +case 82 : +/*! Conditions:: path */ +/*! Rule:: "[^\r\n]+" */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 72; +break; +case 83 : +/*! Conditions:: path */ +/*! Rule:: \s+ */ + // skip whitespace in the line +break; +case 84 : +/*! Conditions:: path */ +/*! Rule:: [^\s\r\n]+ */ + this.popState(); return 72; +break; +case 85 : +/*! Conditions:: * */ +/*! Rule:: . */ + /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer input: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - + break; +default: + return this.simpleCaseActionClusters[$avoiding_name_collisions]; } }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ \/]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[\/"'][^{}\/"']+)/,/^(?:[^{}\/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/,/^(?:=)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[^\s\r\n]+)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:\s*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%include\b)/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\[)/,/^(?:\|)/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%include\b)/,/^(?:%([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)[^\r\n]+)/,/^(?:%%)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_]*)\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(\\\\|\\\]|[^\]])+)/,/^(?:\])/,/^(?:[^\r\n]*(\r|\n)+)/,/^(?:[^\r\n]+)/,/^(?:[\r\n])/,/^(?:'[^\r\n]+')/,/^(?:"[^\r\n]+")/,/^(?:\s+)/,/^(?:[^\s\r\n]+)/,/^(?:.)/], -conditions: {"code":{"rules":[66,67,75,78,79,85],"inclusive":false},"start_condition":{"rules":[26,27,28,29,75,85],"inclusive":false},"options":{"rules":[18,19,20,21,22,23,24,25,71,75,85],"inclusive":false},"conditions":{"rules":[9,10,11,12,75,85],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,75,85],"inclusive":false},"path":{"rules":[75,80,81,82,83,84,85],"inclusive":false},"set":{"rules":[71,75,76,77,85],"inclusive":false},"indented":{"rules":[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,68,69,70,72,73,74,75,85],"inclusive":true},"trail":{"rules":[30,33,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,72,73,74,75,85],"inclusive":true},"rules":{"rules":[13,14,15,16,17,33,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,67,68,69,70,72,73,74,75,85],"inclusive":true},"INITIAL":{"rules":[33,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,72,73,74,75,85],"inclusive":true}} +simpleCaseActionClusters: { + + /*! Conditions:: action */ + /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + 0 : 29, + /*! Conditions:: action */ + /*! Rule:: \/\/.* */ + 1 : 29, + /*! Conditions:: action */ + /*! Rule:: "(\\\\|\\"|[^"])*" */ + 3 : 29, + /*! Conditions:: action */ + /*! Rule:: '(\\\\|\\'|[^'])*' */ + 4 : 29, + /*! Conditions:: action */ + /*! Rule:: [/"'][^{}/"']+ */ + 5 : 29, + /*! Conditions:: action */ + /*! Rule:: [^{}/"']+ */ + 6 : 29, + /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ + 9 : 12, + /*! Conditions:: conditions */ + /*! Rule:: , */ + 11 : 34, + /*! Conditions:: conditions */ + /*! Rule:: \* */ + 12 : 33, + /*! Conditions:: rules */ + /*! Rule:: [a-zA-Z0-9_]+ */ + 17 : 63, + /*! Conditions:: options */ + /*! Rule:: {NAME} */ + 18 : 12, + /*! Conditions:: options */ + /*! Rule:: = */ + 19 : 68, + /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ + 22 : 69, + /*! Conditions:: start_condition */ + /*! Rule:: {ID} */ + 26 : 21, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: {ID} */ + 40 : 12, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \| */ + 44 : 36, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \(\?: */ + 45 : 41, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \(\?= */ + 46 : 41, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \(\?! */ + 47 : 41, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \( */ + 48 : 39, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \) */ + 49 : 40, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \+ */ + 50 : 42, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \* */ + 51 : 33, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \? */ + 52 : 43, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \^ */ + 53 : 50, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: , */ + 54 : 34, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: <> */ + 55 : 51, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + 59 : 60, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \$ */ + 61 : 51, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \. */ + 62 : 49, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \{\d+(,\s?\d+|,)?\} */ + 69 : 61, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \{{ID}\} */ + 70 : 54, + /*! Conditions:: set options */ + /*! Rule:: \{{ID}\} */ + 71 : 54, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \{ */ + 72 : 25, + /*! Conditions:: indented trail rules INITIAL */ + /*! Rule:: \} */ + 73 : 27, + /*! Conditions:: * */ + /*! Rule:: $ */ + 75 : 9, + /*! Conditions:: set */ + /*! Rule:: (\\\\|\\\]|[^\]])+ */ + 76 : 59, + /*! Conditions:: code */ + /*! Rule:: [^\r\n]*(\r|\n)+ */ + 78 : 74 +}, +rules: [ +/^(?:\/\*(.|\n|\r)*?\*\/)/, +/^(?:\/\/.*)/, +/^(?:\/[^ \/]*?['"{}'][^ ]*?\/)/, +/^(?:"(\\\\|\\"|[^"])*")/, +/^(?:'(\\\\|\\'|[^'])*')/, +/^(?:[\/"'][^{}\/"']+)/, +/^(?:[^{}\/"']+)/, +/^(?:\{)/, +/^(?:\})/, +/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, +/^(?:>)/, +/^(?:,)/, +/^(?:\*)/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:\s+(\r\n|\n|\r)+)/, +/^(?:\s+)/, +/^(?:%%)/, +/^(?:[a-zA-Z0-9_]+)/, +/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, +/^(?:=)/, +/^(?:"(\\\\|\\"|[^"])*")/, +/^(?:'(\\\\|\\'|[^'])*')/, +/^(?:[^\s\r\n]+)/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:\s+(\r\n|\n|\r)+)/, +/^(?:\s+)/, +/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:\s+(\r\n|\n|\r)+)/, +/^(?:\s+)/, +/^(?:\s*(\r\n|\n|\r)+)/, +/^(?:\{)/, +/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, +/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, +/^(?:%include\b)/, +/^(?:.+)/, +/^(?:\/\*(.|\n|\r)*?\*\/)/, +/^(?:\/\/.*)/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:\s+)/, +/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/, +/^(?:"(\\\\|\\"|[^"])*")/, +/^(?:'(\\\\|\\'|[^'])*')/, +/^(?:\[)/, +/^(?:\|)/, +/^(?:\(\?:)/, +/^(?:\(\?=)/, +/^(?:\(\?!)/, +/^(?:\()/, +/^(?:\))/, +/^(?:\+)/, +/^(?:\*)/, +/^(?:\?)/, +/^(?:\^)/, +/^(?:,)/, +/^(?:<>)/, +/^(?:<)/, +/^(?:\/!)/, +/^(?:\/)/, +/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/, +/^(?:\\.)/, +/^(?:\$)/, +/^(?:\.)/, +/^(?:%options\b)/, +/^(?:%s\b)/, +/^(?:%x\b)/, +/^(?:%include\b)/, +/^(?:%([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)[^\r\n]+)/, +/^(?:%%)/, +/^(?:\{\d+(,\s?\d+|,)?\})/, +/^(?:\{([a-zA-Z_][a-zA-Z0-9_]*)\})/, +/^(?:\{([a-zA-Z_][a-zA-Z0-9_]*)\})/, +/^(?:\{)/, +/^(?:\})/, +/^(?:.)/, +/^(?:$)/, +/^(?:(\\\\|\\\]|[^\]])+)/, +/^(?:\])/, +/^(?:[^\r\n]*(\r|\n)+)/, +/^(?:[^\r\n]+)/, +/^(?:[\r\n])/, +/^(?:'[^\r\n]+')/, +/^(?:"[^\r\n]+")/, +/^(?:\s+)/, +/^(?:[^\s\r\n]+)/, +/^(?:.)/ +], +conditions: { + "code": { + "rules": [ + 66, + 67, + 75, + 78, + 79, + 85 + ], + "inclusive": false + }, + "start_condition": { + "rules": [ + 26, + 27, + 28, + 29, + 75, + 85 + ], + "inclusive": false + }, + "options": { + "rules": [ + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 71, + 75, + 85 + ], + "inclusive": false + }, + "conditions": { + "rules": [ + 9, + 10, + 11, + 12, + 75, + 85 + ], + "inclusive": false + }, + "action": { + "rules": [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 75, + 85 + ], + "inclusive": false + }, + "path": { + "rules": [ + 75, + 80, + 81, + 82, + 83, + 84, + 85 + ], + "inclusive": false + }, + "set": { + "rules": [ + 71, + 75, + 76, + 77, + 85 + ], + "inclusive": false + }, + "indented": { + "rules": [ + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 68, + 69, + 70, + 72, + 73, + 74, + 75, + 85 + ], + "inclusive": true + }, + "trail": { + "rules": [ + 30, + 33, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 72, + 73, + 74, + 75, + 85 + ], + "inclusive": true + }, + "rules": { + "rules": [ + 13, + 14, + 15, + 16, + 17, + 33, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 67, + 68, + 69, + 70, + 72, + 73, + 74, + 75, + 85 + ], + "inclusive": true + }, + "INITIAL": { + "rules": [ + 33, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 72, + 73, + 74, + 75, + 85 + ], + "inclusive": true + } +} }); +// lexer.JisonLexerError = JisonLexerError; return lexer; })(); parser.lexer = lexer; + function Parser () { this.yy = {}; } -Parser.prototype = parser;parser.Parser = Parser; -return new Parser; +Parser.prototype = parser; +parser.Parser = Parser; +// parser.JisonParserError = JisonParserError; + +return new Parser(); })(); + + if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = parser; -exports.Parser = parser.Parser; -exports.parse = function () { return parser.parse.apply(parser, arguments); }; -exports.main = function commonjsMain(args) { - if (!args[1]) { - console.log('Usage: '+args[0]+' FILE'); - process.exit(1); - } - var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); - return exports.parser.parse(source); +exports.parser = lexParser; +exports.Parser = lexParser.Parser; +exports.parse = function () { + return lexParser.parse.apply(lexParser, arguments); }; -if (typeof module !== 'undefined' && require.main === module) { - exports.main(process.argv.slice(1)); + } -} \ No newline at end of file diff --git a/tests/all-tests.js b/tests/all-tests.js index dc3ecda..f4cf849 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -350,7 +350,6 @@ exports["test options"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; -if (0) { exports["test options with values"] = function () { var lexgrammar = '%options ping=666 bla=blub bool1 s1="s1value" s2=\'s2value\'\n%%\n"foo" return 1;'; var expected = { @@ -385,7 +384,6 @@ exports["test options with string values which have embedded quotes"] = function lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; -} exports["test unquoted string rules"] = function () { var lexgrammar = "%%\nfoo* return 1"; From b80e743f5e6120745e405ba8ba07bf860997b4a7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 15:15:29 +0100 Subject: [PATCH 088/417] Makefile: added `bump` target to increment the *prerelease* number of our package.json file --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 72d9e14..231137d 100644 --- a/Makefile +++ b/Makefile @@ -16,6 +16,12 @@ test: node tests/all-tests.js +# increment the XXX number in the package.json file: version ..- +bump: submodules-bump + npm version --no-git-tag-version prerelease + + + clean: @@ -29,4 +35,4 @@ superclean: clean -.PHONY: all prep npm-install build test clean superclean +.PHONY: all prep npm-install build test clean superclean bump From 0510989ec51439f94619f8c4257164a12484739d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 16:32:34 +0100 Subject: [PATCH 089/417] add a test to check if %options with a hyphen make it through all right; see also https://github.com/GerHobbelt/ebnf-parser/commit/35ebd4fdfe5972e16a9fb63fb4d5f9449d0bb0a5 for what happened; here we add another test to make sure this hyphen-is-allowed-in-%options-names thing in both lexer and parser compilers. --- tests/all-tests.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/all-tests.js b/tests/all-tests.js index f4cf849..d94eec5 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -350,6 +350,19 @@ exports["test options"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test if %options names with a hyphen are correctly recognized"] = function () { + var lexgrammar = '%options token-stack\n%%\n"foo" return 1;'; + var expected = { + rules: [ + ["foo", "return 1;"] + ], + options: {"token-stack": true} + }; + + lexer_reset(); + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + exports["test options with values"] = function () { var lexgrammar = '%options ping=666 bla=blub bool1 s1="s1value" s2=\'s2value\'\n%%\n"foo" return 1;'; var expected = { From fcb421abbc5d487ae687f0d9cc4eda77a989a5fe Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 16:38:43 +0100 Subject: [PATCH 090/417] Makefile: added `git-tag` target which registers the current package.json version as a tag in git (IFF it hasn't been registered already!). We separate the version bump and git registration tasks as we might still have to fiddle a few bits in the submodules after the jison integration tests -- yes, we like to bump our versions *early*, at least in our package.json files! TODO: warn when the tag has already been registered previously. --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 231137d..3fc32df 100644 --- a/Makefile +++ b/Makefile @@ -17,9 +17,12 @@ test: # increment the XXX number in the package.json file: version ..- -bump: submodules-bump +bump: npm version --no-git-tag-version prerelease +git-tag: + node -e 'var pkg = require("./package.json"); console.log(pkg.version);' | xargs git tag + @@ -35,4 +38,4 @@ superclean: clean -.PHONY: all prep npm-install build test clean superclean bump +.PHONY: all prep npm-install build test clean superclean bump git-tag From 8ae43c1b5c424ebc8c35b60e0cc9d5e374db750f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 18:20:06 +0100 Subject: [PATCH 091/417] bumped version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ddfade1..82decca 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-101", + "version": "0.1.4-102", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From e0c8cc667bb4d7197d469ef6d423d610f7687c4c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 26 Oct 2015 20:36:27 +0100 Subject: [PATCH 092/417] removed the line/loc info when reporting unsupported %xyz option/parameter lines in the lexer. --- lex-parser.js | 2 +- lex.l | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index a1e0762..d48b165 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3226,7 +3226,7 @@ case 67 : /*! Rule:: %{NAME}[^\r\n]+ */ /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer option: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); return 21; break; diff --git a/lex.l b/lex.l index e17a488..a593708 100644 --- a/lex.l +++ b/lex.l @@ -109,7 +109,7 @@ BR \r\n|\n|\r "%"{NAME}[^\r\n]+ %{ /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer option: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + console.warn('ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); return 'UNKNOWN_DECL'; %} "%%" this.begin('rules'); return '%%'; From 99a525843bfbf35f53d0539085fc1b79308f14b6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 27 Oct 2015 19:10:22 +0100 Subject: [PATCH 093/417] minor lexer grammar simplification: no change in behaviour, just fewer rules for exactly the same --- lex-parser.js | 372 ++++++++++++++++++++++++-------------------------- lex.y | 16 +-- 2 files changed, 181 insertions(+), 207 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d48b165..1779e91 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -376,10 +376,6 @@ productions_: [ 25, 1 ], - [ - 27, - 0 - ], [ 27, 1 @@ -388,13 +384,9 @@ productions_: [ 27, 5 ], - [ - 27, - 4 - ], [ 29, - 1 + 0 ], [ 29, @@ -635,7 +627,7 @@ case 3 : /*! Production:: epilogue : %% extra_lexer_module_code EOF */ case 21 : /*! Production:: action : { action_body } */ - case 30 : + case 28 : /*! Production:: start_conditions : < name_list > */ this.$ = $$[$0-1]; break; @@ -679,19 +671,17 @@ case 8 : /*! Production:: action : ACTION */ case 23 : /*! Production:: action : include_macro_code */ - case 25 : + case 24 : /*! Production:: action_body : action_comments_body */ - case 28 : -/*! Production:: action_comments_body : ACTION_BODY */ - case 63 : + case 61 : /*! Production:: escape_char : ESCAPE_CHAR */ - case 64 : + case 62 : /*! Production:: range_regex : RANGE_REGEX */ - case 73 : + case 71 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ - case 77 : + case 75 : /*! Production:: module_code_chunk : CODE */ - case 79 : + case 77 : /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = $$[$0]; break; @@ -727,7 +717,7 @@ case 18 : break; case 19 : /*! Production:: rules : rule */ - case 33 : + case 31 : /*! Production:: name_list : NAME */ this.$ = [$$[$0]]; break; @@ -735,43 +725,39 @@ case 20 : /*! Production:: rule : start_conditions regex action */ this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; -case 24 : -/*! Production:: action_body : */ - case 39 : +case 25 : +/*! Production:: action_body : action_body { action_body } action_comments_body */ + this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; +break; +case 26 : +/*! Production:: action_comments_body : */ + case 37 : /*! Production:: regex_list : */ - case 80 : + case 78 : /*! Production:: optional_module_code_chunk : */ this.$ = ''; break; -case 26 : -/*! Production:: action_body : action_body { action_body } action_comments_body */ - this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; case 27 : -/*! Production:: action_body : action_body { action_body } */ - this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; -break; -case 29 : /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - case 40 : + case 38 : /*! Production:: regex_concat : regex_concat regex_base */ - case 50 : + case 48 : /*! Production:: regex_base : regex_base range_regex */ - case 59 : + case 57 : /*! Production:: regex_set : regex_set_atom regex_set */ - case 78 : + case 76 : /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = $$[$0-1] + $$[$0]; break; -case 31 : +case 29 : /*! Production:: start_conditions : < * > */ this.$ = ['*']; break; -case 34 : +case 32 : /*! Production:: name_list : name_list , NAME */ this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 35 : +case 33 : /*! Production:: regex : regex_list */ this.$ = $$[$0]; @@ -780,91 +766,91 @@ case 35 : } break; -case 36 : +case 34 : /*! Production:: regex_list : regex_list | regex_concat */ this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 37 : +case 35 : /*! Production:: regex_list : regex_list | */ this.$ = $$[$0-1] + '|'; break; -case 42 : +case 40 : /*! Production:: regex_base : ( regex_list ) */ this.$ = '(' + $$[$0-1] + ')'; break; -case 43 : +case 41 : /*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 44 : +case 42 : /*! Production:: regex_base : regex_base + */ this.$ = $$[$0-1] + '+'; break; -case 45 : +case 43 : /*! Production:: regex_base : regex_base * */ this.$ = $$[$0-1] + '*'; break; -case 46 : +case 44 : /*! Production:: regex_base : regex_base ? */ this.$ = $$[$0-1] + '?'; break; -case 47 : +case 45 : /*! Production:: regex_base : / regex_base */ this.$ = '(?=' + $$[$0] + ')'; break; -case 48 : +case 46 : /*! Production:: regex_base : /! regex_base */ this.$ = '(?!' + $$[$0] + ')'; break; -case 52 : +case 50 : /*! Production:: regex_base : . */ this.$ = '.'; break; -case 53 : +case 51 : /*! Production:: regex_base : ^ */ this.$ = '^'; break; -case 54 : +case 52 : /*! Production:: regex_base : $ */ this.$ = '$'; break; -case 58 : +case 56 : /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ - case 74 : + case 72 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 62 : +case 60 : /*! Production:: regex_set_atom : name_expansion */ this.$ = '{[' + $$[$0] + ']}'; break; -case 65 : +case 63 : /*! Production:: string : STRING_LIT */ this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; -case 70 : +case 68 : /*! Production:: option : NAME */ yy.options[$$[$0]] = true; break; -case 71 : +case 69 : /*! Production:: option : NAME = OPTION_VALUE */ - case 72 : + case 70 : /*! Production:: option : NAME = NAME */ yy.options[$$[$0-2]] = $$[$0]; break; -case 75 : +case 73 : /*! Production:: include_macro_code : INCLUDE PATH */ - + var fs = require('fs'); var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); // And no, we don't support nested '%include': this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; break; -case 76 : +case 74 : /*! Production:: include_macro_code : INCLUDE error */ - - console.error("%include MUST be followed by a valid file path"); + + console.error("%include MUST be followed by a valid file path"); break; } @@ -967,7 +953,7 @@ table: [ }, __expand__([6,12,14,16,18,21,37,65], [ 2, - 39 + 37 ], {13:16,36:17,38:18,39:19,47:24,49:25,53:29,54:30,40:[ 1, 20 @@ -1006,7 +992,7 @@ table: [ 34 ],72:[ 2, - 39 + 37 ] }), { @@ -1075,13 +1061,13 @@ table: [ }, __expand__($V1, [ 2, - 32 + 30 ], {7:45,23:46,24:47,31:[ 1, 48 ],72:[ 2, - 32 + 30 ] }), { @@ -1100,18 +1086,18 @@ table: [ }), __expand__([6,12,14,16,18,21,26,65], [ 2, - 35 + 33 ], {37:[ 1, 49 ],72:[ 2, - 35 + 33 ] }), __expand__($V2, [ 2, - 38 + 36 ], {47:24,49:25,53:29,54:30,39:50,40:[ 1, 20 @@ -1150,12 +1136,12 @@ table: [ 34 ],72:[ 2, - 38 + 36 ] }), __expand__($V3, [ 2, - 41 + 39 ], {48:54,34:[ 1, 52 @@ -1170,12 +1156,12 @@ table: [ 55 ],72:[ 2, - 41 + 39 ] }), __expand__($V4, [ 2, - 39 + 37 ], {38:18,39:19,47:24,49:25,53:29,54:30,36:56,40:[ 1, 20 @@ -1216,7 +1202,7 @@ table: [ }), __expand__($V4, [ 2, - 39 + 37 ], {38:18,39:19,47:24,49:25,53:29,54:30,36:57,40:[ 1, 20 @@ -1367,66 +1353,66 @@ table: [ }, __expand__($V5, [ 2, - 49 + 47 ], {72:[ 2, - 49 + 47 ] }), __expand__($V5, [ 2, - 51 + 49 ], {72:[ 2, - 51 + 49 ] }), __expand__($V5, [ 2, - 52 + 50 ], {72:[ 2, - 52 + 50 ] }), __expand__($V5, [ 2, - 53 + 51 ], {72:[ 2, - 53 + 51 ] }), __expand__($V5, [ 2, - 54 + 52 ], {72:[ 2, - 54 + 52 ] }), __expand__($V5, [ 2, - 55 + 53 ], {72:[ 2, - 55 + 53 ] }), __expand__($V5, [ 2, - 56 + 54 ], {72:[ 2, - 56 + 54 ] }), __expand__([6,12,14,16,18,21,26,34,37,40,41,42,43,44,45,46,50,51,52,55,56,58,60,61,62,63,64,65], [ 2, - 57 + 55 ], {72:[ 2, - 57 + 55 ] }), { @@ -1444,26 +1430,26 @@ table: [ }, __expand__($V5, [ 2, - 65 + 63 ], {72:[ 2, - 65 + 63 ] }), __expand__($V5, [ 2, - 66 + 64 ], {72:[ 2, - 66 + 64 ] }), __expand__($V5, [ 2, - 63 + 61 ], {72:[ 2, - 63 + 61 ] }), __expand__($V0, [ @@ -1506,18 +1492,18 @@ table: [ }), __expand__($V7, [ 2, - 75 + 73 ], {75:[ 2, - 75 + 73 ] }), __expand__($V7, [ 2, - 76 + 74 ], {75:[ 2, - 76 + 74 ] }), { @@ -1534,13 +1520,13 @@ table: [ 66: 67, 67: [ 2, - 69 + 67 ], 68: 43 }, __expand__([12,67], [ 2, - 70 + 68 ], {69:[ 1, 68 @@ -1548,7 +1534,7 @@ table: [ }), __expand__($V1, [ 2, - 32 + 30 ], {24:47,8:69,23:70,6:[ 1, 72 @@ -1560,7 +1546,7 @@ table: [ 48 ],72:[ 2, - 32 + 30 ] }), __expand__($V8, [ @@ -1573,7 +1559,7 @@ table: [ }), __expand__([18,26,37], [ 2, - 39 + 37 ], {36:17,38:18,39:19,47:24,49:25,53:29,54:30,13:73,40:[ 1, 20 @@ -1612,7 +1598,7 @@ table: [ 34 ],72:[ 2, - 39 + 37 ] }), { @@ -1628,7 +1614,7 @@ table: [ }, __expand__($V2, [ 2, - 37 + 35 ], {39:19,47:24,49:25,53:29,54:30,38:77,40:[ 1, 20 @@ -1667,12 +1653,12 @@ table: [ 34 ],72:[ 2, - 37 + 35 ] }), __expand__($V3, [ 2, - 40 + 38 ], {48:54,34:[ 1, 52 @@ -1687,47 +1673,47 @@ table: [ 55 ],72:[ 2, - 40 + 38 ] }), __expand__($V5, [ 2, - 44 + 42 ], {72:[ 2, - 44 + 42 ] }), __expand__($V5, [ 2, - 45 + 43 ], {72:[ 2, - 45 + 43 ] }), __expand__($V5, [ 2, - 46 + 44 ], {72:[ 2, - 46 + 44 ] }), __expand__($V5, [ 2, - 50 + 48 ], {72:[ 2, - 50 + 48 ] }), __expand__($V5, [ 2, - 64 + 62 ], {72:[ 2, - 64 + 62 ] }), { @@ -1752,7 +1738,7 @@ table: [ }, __expand__($V3, [ 2, - 47 + 45 ], {48:54,34:[ 1, 52 @@ -1767,12 +1753,12 @@ table: [ 55 ],72:[ 2, - 47 + 45 ] }), __expand__($V3, [ 2, - 48 + 46 ], {48:54,34:[ 1, 52 @@ -1787,7 +1773,7 @@ table: [ 55 ],72:[ 2, - 48 + 46 ] }), { @@ -1805,7 +1791,7 @@ table: [ 57: 81, 58: [ 2, - 60 + 58 ], 59: 61, 60: [ @@ -1815,18 +1801,18 @@ table: [ }, __expand__($V9, [ 2, - 61 + 59 ], {60:[ 2, - 61 + 59 ] }), __expand__($V9, [ 2, - 62 + 60 ], {60:[ 2, - 62 + 60 ] }), __expand__($V6, [ @@ -1847,16 +1833,16 @@ table: [ }), __expand__($V0, [ 2, - 67 + 65 ], {72:[ 2, - 67 + 65 ] }), { 67: [ 2, - 68 + 66 ] }, { @@ -1891,7 +1877,7 @@ table: [ }, __expand__($Va, [ 2, - 80 + 78 ], {10:84,71:85,74:86,75:[ 1, 87 @@ -1932,16 +1918,16 @@ table: [ { 33: [ 2, - 33 + 31 ], 35: [ 2, - 33 + 31 ] }, __expand__($V2, [ 2, - 36 + 34 ], {47:24,49:25,53:29,54:30,39:50,40:[ 1, 20 @@ -1980,57 +1966,57 @@ table: [ 34 ],72:[ 2, - 36 + 34 ] }), __expand__($V5, [ 2, - 42 + 40 ], {72:[ 2, - 42 + 40 ] }), __expand__($V5, [ 2, - 43 + 41 ], {72:[ 2, - 43 + 41 ] }), __expand__($V5, [ 2, - 58 + 56 ], {72:[ 2, - 58 + 56 ] }), { 58: [ 2, - 59 + 57 ] }, { 12: [ 2, - 71 + 69 ], 67: [ 2, - 71 + 69 ] }, { 12: [ 2, - 72 + 70 ], 67: [ 2, - 72 + 70 ] }, { @@ -2042,7 +2028,7 @@ table: [ { 9: [ 2, - 73 + 71 ], 19: 96, 72: [ @@ -2052,7 +2038,7 @@ table: [ }, __expand__($Va, [ 2, - 79 + 77 ], {75:[ 1, 97 @@ -2060,10 +2046,10 @@ table: [ }), __expand__($Va, [ 2, - 77 + 75 ], {75:[ 2, - 77 + 75 ] }), __expand__($V8, [ @@ -2076,10 +2062,10 @@ table: [ }), __expand__($Vb, [ 2, - 24 + 26 ], {27:98,29:99,30:[ - 1, - 100 + 2, + 26 ] }), __expand__($V8, [ @@ -2100,24 +2086,24 @@ table: [ }), __expand__($V1, [ 2, - 30 + 28 ], {72:[ 2, - 30 + 28 ] }), { 12: [ 1, - 101 + 100 ] }, __expand__($V1, [ 2, - 31 + 29 ], {72:[ 2, - 31 + 29 ] }), { @@ -2128,60 +2114,52 @@ table: [ }, __expand__($Va, [ 2, - 80 - ], {71:85,74:86,10:102,75:[ + 78 + ], {71:85,74:86,10:101,75:[ 1, 87 ] }), __expand__($Va, [ 2, - 78 + 76 ], {75:[ 2, - 78 + 76 ] }), { 26: [ 1, - 104 + 103 ], 28: [ 1, - 103 + 102 ] }, __expand__($Vb, [ 2, - 25 + 24 ], {30:[ 1, - 105 - ] - }), - __expand__($Vb, [ - 2, - 28 - ], {30:[ - 2, - 28 + 104 ] }), { 33: [ 2, - 34 + 32 ], 35: [ 2, - 34 + 32 ] }, { 9: [ 2, - 74 + 72 ] }, __expand__($V8, [ @@ -2194,44 +2172,44 @@ table: [ }), __expand__($Vb, [ 2, - 24 - ], {29:99,27:106,30:[ - 1, - 100 + 26 + ], {29:99,27:105,30:[ + 2, + 26 ] }), __expand__($Vb, [ 2, - 29 + 27 ], {30:[ 2, - 29 + 27 ] }), { 26: [ 1, - 104 + 103 ], 28: [ 1, - 107 + 106 ] }, __expand__($Vb, [ 2, - 27 - ], {29:108,30:[ - 1, - 100 + 26 + ], {29:107,30:[ + 2, + 26 ] }), __expand__($Vb, [ 2, - 26 + 25 ], {30:[ 1, - 105 + 104 ] }) ], @@ -2242,7 +2220,7 @@ defaultActions: { ], 67: [ 2, - 68 + 66 ], 69: [ 2, @@ -2254,15 +2232,15 @@ defaultActions: { ], 81: [ 2, - 59 + 57 ], 95: [ 2, 3 ], - 102: [ + 101: [ 2, - 74 + 72 ] }, parseError: function parseError(str, hash) { diff --git a/lex.y b/lex.y index 3ad8f08..8bd94ca 100644 --- a/lex.y +++ b/lex.y @@ -113,19 +113,15 @@ action ; action_body - : - { $$ = ''; } - | action_comments_body + : action_comments_body { $$ = $action_comments_body; } | action_body '{' action_body '}' action_comments_body { $$ = $1 + $2 + $3 + $4 + $5; } - | action_body '{' action_body '}' - { $$ = $1 + $2 + $3 + $4; } ; action_comments_body - : ACTION_BODY - { $$ = $ACTION_BODY; } + : + { $$ = ''; } | action_comments_body ACTION_BODY { $$ = $action_comments_body + $ACTION_BODY; } ; @@ -264,15 +260,15 @@ extra_lexer_module_code include_macro_code : INCLUDE PATH - { + { var fs = require('fs'); var fileContent = fs.readFileSync($PATH, { encoding: 'utf-8' }); // And no, we don't support nested '%include': $$ = '\n// Included by Jison: ' + $PATH + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $PATH + '\n\n'; } | INCLUDE error - { - console.error("%include MUST be followed by a valid file path"); + { + console.error("%include MUST be followed by a valid file path"); } ; From f7d32c859017c06ffd92d767cd50062f26203ee7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 27 Oct 2015 19:11:31 +0100 Subject: [PATCH 094/417] make sure `yy.options` is always set up properly no matter what --- lex-parser.js | 12 ++++++++++-- lex.y | 12 ++++++++++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 1779e91..860f8a8 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -610,7 +610,12 @@ case 1 : if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; if ($$[$0-3][2]) this.$.unknownDecls = $$[$0-3][2]; if ($$[$0] && $$[$0].trim() !== '') this.$.moduleInclude = $$[$0]; - if (yy.options) this.$.options = yy.options; + // if there are any options, add them all, otherwise set options to NULL: + // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: + for (var k in yy.options) { + this.$.options = yy.options; + break; + } if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; delete yy.options; delete yy.actionInclude; @@ -633,7 +638,10 @@ case 3 : break; case 4 : /*! Production:: init : */ - yy.actionInclude = ''; + + yy.actionInclude = ''; + if (!yy.options) yy.options = {}; + break; case 5 : /*! Production:: definitions : definition definitions */ diff --git a/lex.y b/lex.y index 8bd94ca..0cb560f 100644 --- a/lex.y +++ b/lex.y @@ -16,7 +16,12 @@ lex if ($definitions[1]) $$.startConditions = $definitions[1]; if ($definitions[2]) $$.unknownDecls = $definitions[2]; if ($epilogue && $epilogue.trim() !== '') $$.moduleInclude = $epilogue; - if (yy.options) $$.options = yy.options; + // if there are any options, add them all, otherwise set options to NULL: + // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: + for (var k in yy.options) { + $$.options = yy.options; + break; + } if (yy.actionInclude) $$.actionInclude = yy.actionInclude; delete yy.options; delete yy.actionInclude; @@ -34,7 +39,10 @@ epilogue // because JISON doesn't support mid-rule actions, we set up `yy` using this empty rule at the start: init : - { yy.actionInclude = ''; } + { + yy.actionInclude = ''; + if (!yy.options) yy.options = {}; + } ; definitions From ffd5cf0e90b5e071ead89380afcac836800373e5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 27 Oct 2015 19:14:42 +0100 Subject: [PATCH 095/417] prepare lexer to be able to accept *an empty rule set* in preparation for the ability to accept custom lexers: an empty rules set is allowed when you are setting up an `%options custom_lexer` --- lex-parser.js | 825 +++++++++++++++++++++++++++----------------------- lex.y | 33 +- 2 files changed, 476 insertions(+), 382 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 860f8a8..649a399 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -150,10 +150,10 @@ var $V0=[6,12,14,16,18,21,65], $V4=[37,41], $V5=[6,12,14,16,18,21,26,34,37,40,41,42,43,44,45,46,50,51,52,55,56,61,62,63,64,65], $V6=[6,12,14,16,18,21,22,65], - $V7=[6,9,12,14,16,18,21,26,31,37,40,42,45,46,50,51,52,55,56,61,63,64,65,72], - $V8=[6,9,18,26,31,37,40,42,45,46,50,51,52,55,56,61,63,64], - $V9=[55,58], - $Va=[9,72], + $V7=[6,8,12,14,16,18,21,26,31,37,40,42,45,46,50,51,52,55,56,61,63,64,65,72], + $V8=[8,72], + $V9=[6,8,18,26,31,37,40,42,45,46,50,51,52,55,56,61,63,64], + $Va=[55,58], $Vb=[26,28]; var parser = { @@ -166,10 +166,10 @@ symbols_: { "init": 4, "definitions": 5, "%%": 6, - "rules": 7, - "epilogue": 8, - "EOF": 9, - "extra_lexer_module_code": 10, + "rules_and_epilogue": 7, + "EOF": 8, + "extra_lexer_module_code": 9, + "rules": 10, "definition": 11, "NAME": 12, "regex": 13, @@ -241,7 +241,7 @@ symbols_: { terminals_: { 2: "error", 6: "%%", - 9: "EOF", + 8: "EOF", 12: "NAME", 14: "START_INC", 16: "START_EXC", @@ -286,16 +286,24 @@ productions_: [ 0, [ 3, - 5 + 4 ], [ - 8, + 7, 1 ], [ - 8, + 7, 3 ], + [ + 7, + 4 + ], + [ + 7, + 2 + ], [ 4, 0 @@ -353,11 +361,11 @@ productions_: [ 2 ], [ - 7, + 10, 2 ], [ - 7, + 10, 1 ], [ @@ -565,11 +573,11 @@ productions_: [ 3 ], [ - 10, + 9, 1 ], [ - 10, + 9, 3 ], [ @@ -603,13 +611,12 @@ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* actio var $0 = $$.length - 1; switch (yystate) { case 1 : -/*! Production:: lex : init definitions %% rules epilogue */ +/*! Production:: lex : init definitions %% rules_and_epilogue */ - this.$ = { rules: $$[$0-1] }; - if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; - if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; - if ($$[$0-3][2]) this.$.unknownDecls = $$[$0-3][2]; - if ($$[$0] && $$[$0].trim() !== '') this.$.moduleInclude = $$[$0]; + this.$ = $$[$0]; + if ($$[$0-2][0]) this.$.macros = $$[$0-2][0]; + if ($$[$0-2][1]) this.$.startConditions = $$[$0-2][1]; + if ($$[$0-2][2]) this.$.unknownDecls = $$[$0-2][2]; // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { @@ -623,27 +630,45 @@ case 1 : break; case 2 : -/*! Production:: epilogue : EOF */ - case 12 : -/*! Production:: definition : options */ - this.$ = null; +/*! Production:: rules_and_epilogue : EOF */ + + this.$ = { rules: null }; + break; case 3 : -/*! Production:: epilogue : %% extra_lexer_module_code EOF */ - case 21 : -/*! Production:: action : { action_body } */ - case 28 : -/*! Production:: start_conditions : < name_list > */ - this.$ = $$[$0-1]; +/*! Production:: rules_and_epilogue : %% extra_lexer_module_code EOF */ + + if ($$[$0-1] && $$[$0-1].trim() !== '') { + this.$ = { rules: null, moduleInclude: $$[$0-1] }; + } else { + this.$ = { rules: null }; + } + break; case 4 : +/*! Production:: rules_and_epilogue : rules %% extra_lexer_module_code EOF */ + + if ($$[$0-1] && $$[$0-1].trim() !== '') { + this.$ = { rules: $$[$0-3], moduleInclude: $$[$0-1] }; + } else { + this.$ = { rules: $$[$0-3] }; + } + +break; +case 5 : +/*! Production:: rules_and_epilogue : rules EOF */ + + this.$ = { rules: $$[$0-1] }; + +break; +case 6 : /*! Production:: init : */ yy.actionInclude = ''; if (!yy.options) yy.options = {}; break; -case 5 : +case 7 : /*! Production:: definitions : definition definitions */ this.$ = $$[$0]; @@ -663,109 +688,119 @@ case 5 : } break; -case 6 : +case 8 : /*! Production:: definitions : */ this.$ = [null, null]; break; -case 7 : +case 9 : /*! Production:: definition : NAME regex */ this.$ = [$$[$0-1], $$[$0]]; break; -case 8 : +case 10 : /*! Production:: definition : START_INC names_inclusive */ - case 9 : + case 11 : /*! Production:: definition : START_EXC names_exclusive */ - case 22 : + case 24 : /*! Production:: action : ACTION */ - case 23 : + case 25 : /*! Production:: action : include_macro_code */ - case 24 : + case 26 : /*! Production:: action_body : action_comments_body */ - case 61 : + case 63 : /*! Production:: escape_char : ESCAPE_CHAR */ - case 62 : + case 64 : /*! Production:: range_regex : RANGE_REGEX */ - case 71 : + case 73 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ - case 75 : -/*! Production:: module_code_chunk : CODE */ case 77 : +/*! Production:: module_code_chunk : CODE */ + case 79 : /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = $$[$0]; break; -case 10 : +case 12 : /*! Production:: definition : ACTION */ - case 11 : + case 13 : /*! Production:: definition : include_macro_code */ yy.actionInclude += $$[$0]; this.$ = null; break; -case 13 : +case 14 : +/*! Production:: definition : options */ + this.$ = null; +break; +case 15 : /*! Production:: definition : UNKNOWN_DECL */ this.$ = {type: 'unknown', body: $$[$0]}; break; -case 14 : +case 16 : /*! Production:: names_inclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; break; -case 15 : +case 17 : /*! Production:: names_inclusive : names_inclusive START_COND */ this.$ = $$[$0-1]; this.$.names[$$[$0]] = 0; break; -case 16 : +case 18 : /*! Production:: names_exclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; break; -case 17 : +case 19 : /*! Production:: names_exclusive : names_exclusive START_COND */ this.$ = $$[$0-1]; this.$.names[$$[$0]] = 1; break; -case 18 : +case 20 : /*! Production:: rules : rules rule */ this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 19 : +case 21 : /*! Production:: rules : rule */ - case 31 : + case 33 : /*! Production:: name_list : NAME */ this.$ = [$$[$0]]; break; -case 20 : +case 22 : /*! Production:: rule : start_conditions regex action */ this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; -case 25 : +case 23 : +/*! Production:: action : { action_body } */ + case 30 : +/*! Production:: start_conditions : < name_list > */ + this.$ = $$[$0-1]; +break; +case 27 : /*! Production:: action_body : action_body { action_body } action_comments_body */ this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 26 : +case 28 : /*! Production:: action_comments_body : */ - case 37 : + case 39 : /*! Production:: regex_list : */ - case 78 : + case 80 : /*! Production:: optional_module_code_chunk : */ this.$ = ''; break; -case 27 : +case 29 : /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - case 38 : + case 40 : /*! Production:: regex_concat : regex_concat regex_base */ - case 48 : + case 50 : /*! Production:: regex_base : regex_base range_regex */ - case 57 : + case 59 : /*! Production:: regex_set : regex_set_atom regex_set */ - case 76 : + case 78 : /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = $$[$0-1] + $$[$0]; break; -case 29 : +case 31 : /*! Production:: start_conditions : < * > */ this.$ = ['*']; break; -case 32 : +case 34 : /*! Production:: name_list : name_list , NAME */ this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 33 : +case 35 : /*! Production:: regex : regex_list */ this.$ = $$[$0]; @@ -774,79 +809,79 @@ case 33 : } break; -case 34 : +case 36 : /*! Production:: regex_list : regex_list | regex_concat */ this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 35 : +case 37 : /*! Production:: regex_list : regex_list | */ this.$ = $$[$0-1] + '|'; break; -case 40 : +case 42 : /*! Production:: regex_base : ( regex_list ) */ this.$ = '(' + $$[$0-1] + ')'; break; -case 41 : +case 43 : /*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 42 : +case 44 : /*! Production:: regex_base : regex_base + */ this.$ = $$[$0-1] + '+'; break; -case 43 : +case 45 : /*! Production:: regex_base : regex_base * */ this.$ = $$[$0-1] + '*'; break; -case 44 : +case 46 : /*! Production:: regex_base : regex_base ? */ this.$ = $$[$0-1] + '?'; break; -case 45 : +case 47 : /*! Production:: regex_base : / regex_base */ this.$ = '(?=' + $$[$0] + ')'; break; -case 46 : +case 48 : /*! Production:: regex_base : /! regex_base */ this.$ = '(?!' + $$[$0] + ')'; break; -case 50 : +case 52 : /*! Production:: regex_base : . */ this.$ = '.'; break; -case 51 : +case 53 : /*! Production:: regex_base : ^ */ this.$ = '^'; break; -case 52 : +case 54 : /*! Production:: regex_base : $ */ this.$ = '$'; break; -case 56 : +case 58 : /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ - case 72 : + case 74 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 60 : +case 62 : /*! Production:: regex_set_atom : name_expansion */ this.$ = '{[' + $$[$0] + ']}'; break; -case 63 : +case 65 : /*! Production:: string : STRING_LIT */ this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; -case 68 : +case 70 : /*! Production:: option : NAME */ yy.options[$$[$0]] = true; break; -case 69 : +case 71 : /*! Production:: option : NAME = OPTION_VALUE */ - case 70 : + case 72 : /*! Production:: option : NAME = NAME */ yy.options[$$[$0-2]] = $$[$0]; break; -case 73 : +case 75 : /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); @@ -855,7 +890,7 @@ case 73 : this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; break; -case 74 : +case 76 : /*! Production:: include_macro_code : INCLUDE error */ console.error("%include MUST be followed by a valid file path"); @@ -866,10 +901,10 @@ break; table: [ __expand__($V0, [ 2, - 4 + 6 ], {3:1,4:2,72:[ 2, - 4 + 6 ] }), { @@ -881,7 +916,7 @@ table: [ 5: 3, 6: [ 2, - 6 + 8 ], 11: 4, 12: [ @@ -925,7 +960,7 @@ table: [ 5: 15, 6: [ 2, - 6 + 8 ], 11: 4, 12: [ @@ -961,7 +996,7 @@ table: [ }, __expand__([6,12,14,16,18,21,37,65], [ 2, - 37 + 39 ], {13:16,36:17,38:18,39:19,47:24,49:25,53:29,54:30,40:[ 1, 20 @@ -1000,7 +1035,7 @@ table: [ 34 ],72:[ 2, - 37 + 39 ] }), { @@ -1019,34 +1054,34 @@ table: [ }, __expand__($V0, [ 2, - 10 + 12 ], {72:[ 2, - 10 + 12 ] }), __expand__($V0, [ 2, - 11 + 13 ], {72:[ 2, - 11 + 13 ] }), __expand__($V0, [ 2, - 12 + 14 ], {72:[ 2, - 12 + 14 ] }), __expand__($V0, [ 2, - 13 + 15 ], {72:[ 2, - 13 + 15 ] }), { @@ -1069,44 +1104,50 @@ table: [ }, __expand__($V1, [ 2, - 30 - ], {7:45,23:46,24:47,31:[ + 32 + ], {7:45,10:48,23:49,24:50,6:[ 1, - 48 + 47 + ],8:[ + 1, + 46 + ],31:[ + 1, + 51 ],72:[ 2, - 30 + 32 ] }), { 6: [ 2, - 5 + 7 ] }, __expand__($V0, [ 2, - 7 + 9 ], {72:[ 2, - 7 + 9 ] }), __expand__([6,12,14,16,18,21,26,65], [ 2, - 33 + 35 ], {37:[ 1, - 49 + 52 ],72:[ 2, - 33 + 35 ] }), __expand__($V2, [ 2, - 36 - ], {47:24,49:25,53:29,54:30,39:50,40:[ + 38 + ], {47:24,49:25,53:29,54:30,39:53,40:[ 1, 20 ],42:[ @@ -1144,33 +1185,33 @@ table: [ 34 ],72:[ 2, - 36 + 38 ] }), __expand__($V3, [ 2, - 39 - ], {48:54,34:[ + 41 + ], {48:57,34:[ 1, - 52 + 55 ],43:[ 1, - 51 + 54 ],44:[ 1, - 53 + 56 ],62:[ 1, - 55 + 58 ],72:[ 2, - 39 + 41 ] }), __expand__($V4, [ 2, - 37 - ], {38:18,39:19,47:24,49:25,53:29,54:30,36:56,40:[ + 39 + ], {38:18,39:19,47:24,49:25,53:29,54:30,36:59,40:[ 1, 20 ],42:[ @@ -1210,8 +1251,8 @@ table: [ }), __expand__($V4, [ 2, - 37 - ], {38:18,39:19,47:24,49:25,53:29,54:30,36:57,40:[ + 39 + ], {38:18,39:19,47:24,49:25,53:29,54:30,36:60,40:[ 1, 20 ],42:[ @@ -1250,7 +1291,7 @@ table: [ ] }), { - 39: 58, + 39: 61, 40: [ 1, 20 @@ -1305,7 +1346,7 @@ table: [ ] }, { - 39: 59, + 39: 62, 40: [ 1, 20 @@ -1361,163 +1402,163 @@ table: [ }, __expand__($V5, [ 2, - 47 + 49 ], {72:[ 2, - 47 + 49 ] }), __expand__($V5, [ 2, - 49 + 51 ], {72:[ 2, - 49 + 51 ] }), __expand__($V5, [ 2, - 50 + 52 ], {72:[ 2, - 50 + 52 ] }), __expand__($V5, [ 2, - 51 + 53 ], {72:[ 2, - 51 + 53 ] }), __expand__($V5, [ 2, - 52 + 54 ], {72:[ 2, - 52 + 54 ] }), __expand__($V5, [ 2, - 53 + 55 ], {72:[ 2, - 53 + 55 ] }), __expand__($V5, [ 2, - 54 + 56 ], {72:[ 2, - 54 + 56 ] }), __expand__([6,12,14,16,18,21,26,34,37,40,41,42,43,44,45,46,50,51,52,55,56,58,60,61,62,63,64,65], [ 2, - 55 + 57 ], {72:[ 2, - 55 + 57 ] }), { - 47: 63, + 47: 66, 55: [ 1, 31 ], - 57: 60, - 59: 61, + 57: 63, + 59: 64, 60: [ 1, - 62 + 65 ] }, __expand__($V5, [ 2, - 63 + 65 ], {72:[ 2, - 63 + 65 ] }), __expand__($V5, [ 2, - 64 + 66 ], {72:[ 2, - 64 + 66 ] }), __expand__($V5, [ 2, - 61 + 63 ], {72:[ 2, - 61 + 63 ] }), __expand__($V0, [ 2, - 8 + 10 ], {22:[ 1, - 64 + 67 ],72:[ 2, - 8 + 10 ] }), __expand__($V6, [ 2, - 14 + 16 ], {72:[ 2, - 14 + 16 ] }), __expand__($V0, [ 2, - 9 + 11 ], {22:[ 1, - 65 + 68 ],72:[ 2, - 9 + 11 ] }), __expand__($V6, [ 2, - 16 + 18 ], {72:[ 2, - 16 + 18 ] }), __expand__($V7, [ 2, - 73 + 75 ], {75:[ 2, - 73 + 75 ] }), __expand__($V7, [ 2, - 74 + 76 ], {75:[ 2, - 74 + 76 ] }), { 67: [ 1, - 66 + 69 ] }, { @@ -1525,50 +1566,70 @@ table: [ 1, 44 ], - 66: 67, + 66: 70, 67: [ 2, - 67 + 69 ], 68: 43 }, __expand__([12,67], [ 2, - 68 + 70 ], {69:[ 1, - 68 + 71 + ] + }), + { + 1: [ + 2, + 1 + ] + }, + { + 1: [ + 2, + 2 + ] + }, + __expand__($V8, [ + 2, + 80 + ], {9:72,71:73,74:74,75:[ + 1, + 75 ] }), __expand__($V1, [ 2, - 30 - ], {24:47,8:69,23:70,6:[ + 32 + ], {24:50,23:78,6:[ 1, - 72 - ],9:[ + 76 + ],8:[ 1, - 71 + 77 ],31:[ 1, - 48 + 51 ],72:[ 2, - 30 + 32 ] }), - __expand__($V8, [ + __expand__($V9, [ 2, - 19 + 21 ], {72:[ 2, - 19 + 21 ] }), __expand__([18,26,37], [ 2, - 37 - ], {36:17,38:18,39:19,47:24,49:25,53:29,54:30,13:73,40:[ + 39 + ], {36:17,38:18,39:19,47:24,49:25,53:29,54:30,13:79,40:[ 1, 20 ],42:[ @@ -1606,24 +1667,24 @@ table: [ 34 ],72:[ 2, - 37 + 39 ] }), { 12: [ 1, - 76 + 82 ], - 32: 74, + 32: 80, 34: [ 1, - 75 + 81 ] }, __expand__($V2, [ 2, - 35 - ], {39:19,47:24,49:25,53:29,54:30,38:77,40:[ + 37 + ], {39:19,47:24,49:25,53:29,54:30,38:83,40:[ 1, 20 ],42:[ @@ -1661,246 +1722,273 @@ table: [ 34 ],72:[ 2, - 35 + 37 ] }), __expand__($V3, [ 2, - 38 - ], {48:54,34:[ + 40 + ], {48:57,34:[ 1, - 52 + 55 ],43:[ 1, - 51 + 54 ],44:[ 1, - 53 + 56 ],62:[ 1, - 55 + 58 ],72:[ 2, - 38 + 40 ] }), __expand__($V5, [ 2, - 42 + 44 ], {72:[ 2, - 42 + 44 ] }), __expand__($V5, [ 2, - 43 + 45 ], {72:[ 2, - 43 + 45 ] }), __expand__($V5, [ 2, - 44 + 46 ], {72:[ 2, - 44 + 46 ] }), __expand__($V5, [ 2, - 48 + 50 ], {72:[ 2, - 48 + 50 ] }), __expand__($V5, [ 2, - 62 + 64 ], {72:[ 2, - 62 + 64 ] }), { 37: [ 1, - 49 + 52 ], 41: [ 1, - 78 + 84 ] }, { 37: [ 1, - 49 + 52 ], 41: [ 1, - 79 + 85 ] }, __expand__($V3, [ 2, - 45 - ], {48:54,34:[ + 47 + ], {48:57,34:[ 1, - 52 + 55 ],43:[ 1, - 51 + 54 ],44:[ 1, - 53 + 56 ],62:[ 1, - 55 + 58 ],72:[ 2, - 45 + 47 ] }), __expand__($V3, [ 2, - 46 - ], {48:54,34:[ + 48 + ], {48:57,34:[ 1, - 52 + 55 ],43:[ 1, - 51 + 54 ],44:[ 1, - 53 + 56 ],62:[ 1, - 55 + 58 ],72:[ 2, - 46 + 48 ] }), { 58: [ 1, - 80 + 86 ] }, { - 47: 63, + 47: 66, 55: [ 1, 31 ], - 57: 81, + 57: 87, 58: [ 2, - 58 + 60 ], - 59: 61, + 59: 64, 60: [ 1, - 62 + 65 ] }, - __expand__($V9, [ + __expand__($Va, [ 2, - 59 + 61 ], {60:[ 2, - 59 + 61 ] }), - __expand__($V9, [ + __expand__($Va, [ 2, - 60 + 62 ], {60:[ 2, - 60 + 62 ] }), __expand__($V6, [ 2, - 15 + 17 ], {72:[ 2, - 15 + 17 ] }), __expand__($V6, [ 2, - 17 + 19 ], {72:[ 2, - 17 + 19 ] }), __expand__($V0, [ 2, - 65 + 67 ], {72:[ 2, - 65 + 67 ] }), { 67: [ 2, - 66 + 68 ] }, { 12: [ 1, - 83 + 89 ], 70: [ 1, - 82 + 88 ] }, { - 1: [ + 8: [ + 1, + 90 + ] + }, + { + 8: [ 2, - 1 + 73 + ], + 19: 91, + 72: [ + 1, + 12 ] }, __expand__($V8, [ 2, - 18 - ], {72:[ + 79 + ], {75:[ + 1, + 92 + ] + }), + __expand__($V8, [ 2, - 18 + 77 + ], {75:[ + 2, + 77 + ] + }), + __expand__($V8, [ + 2, + 80 + ], {71:73,74:74,9:93,75:[ + 1, + 75 ] }), { 1: [ 2, - 2 + 5 ] }, - __expand__($Va, [ + __expand__($V9, [ 2, - 78 - ], {10:84,71:85,74:86,75:[ - 1, - 87 + 20 + ], {72:[ + 2, + 20 ] }), { 18: [ 1, - 90 + 96 ], - 19: 91, - 25: 88, + 19: 97, + 25: 94, 26: [ 1, - 89 + 95 ], 72: [ 1, @@ -1910,33 +1998,33 @@ table: [ { 33: [ 1, - 92 + 98 ], 35: [ 1, - 93 + 99 ] }, { 33: [ 1, - 94 + 100 ] }, { 33: [ 2, - 31 + 33 ], 35: [ 2, - 31 + 33 ] }, __expand__($V2, [ 2, - 34 - ], {47:24,49:25,53:29,54:30,39:50,40:[ + 36 + ], {47:24,49:25,53:29,54:30,39:53,40:[ 1, 20 ],42:[ @@ -1974,281 +2062,268 @@ table: [ 34 ],72:[ 2, - 34 + 36 ] }), __expand__($V5, [ 2, - 40 + 42 ], {72:[ 2, - 40 + 42 ] }), __expand__($V5, [ 2, - 41 + 43 ], {72:[ 2, - 41 + 43 ] }), __expand__($V5, [ 2, - 56 + 58 ], {72:[ 2, - 56 + 58 ] }), { 58: [ 2, - 57 + 59 ] }, { 12: [ 2, - 69 + 71 ], 67: [ 2, - 69 + 71 ] }, { 12: [ 2, - 70 + 72 ], 67: [ 2, - 70 - ] - }, - { - 9: [ - 1, - 95 + 72 ] }, { - 9: [ + 1: [ 2, - 71 - ], - 19: 96, - 72: [ - 1, - 12 + 3 ] }, - __expand__($Va, [ + __expand__($V8, [ 2, - 77 - ], {75:[ + 80 + ], {71:73,74:74,9:101,75:[ 1, - 97 + 75 ] }), - __expand__($Va, [ + __expand__($V8, [ 2, - 75 + 78 ], {75:[ 2, - 75 + 78 ] }), - __expand__($V8, [ + { + 8: [ + 1, + 102 + ] + }, + __expand__($V9, [ 2, - 20 + 22 ], {72:[ 2, - 20 + 22 ] }), __expand__($Vb, [ 2, - 26 - ], {27:98,29:99,30:[ + 28 + ], {27:103,29:104,30:[ 2, - 26 + 28 ] }), - __expand__($V8, [ + __expand__($V9, [ 2, - 22 + 24 ], {72:[ 2, - 22 + 24 ] }), - __expand__($V8, [ + __expand__($V9, [ 2, - 23 + 25 ], {72:[ 2, - 23 + 25 ] }), __expand__($V1, [ 2, - 28 + 30 ], {72:[ 2, - 28 + 30 ] }), { 12: [ 1, - 100 + 105 ] }, __expand__($V1, [ 2, - 29 + 31 ], {72:[ 2, - 29 + 31 ] }), { - 1: [ + 8: [ 2, - 3 + 74 ] }, - __expand__($Va, [ - 2, - 78 - ], {71:85,74:86,10:101,75:[ - 1, - 87 - ] - }), - __expand__($Va, [ - 2, - 76 - ], {75:[ + { + 1: [ 2, - 76 + 4 ] - }), + }, { 26: [ 1, - 103 + 107 ], 28: [ 1, - 102 + 106 ] }, __expand__($Vb, [ 2, - 24 + 26 ], {30:[ 1, - 104 + 108 ] }), { 33: [ 2, - 32 + 34 ], 35: [ 2, - 32 - ] - }, - { - 9: [ - 2, - 72 + 34 ] }, - __expand__($V8, [ + __expand__($V9, [ 2, - 21 + 23 ], {72:[ 2, - 21 + 23 ] }), __expand__($Vb, [ 2, - 26 - ], {29:99,27:105,30:[ + 28 + ], {29:104,27:109,30:[ 2, - 26 + 28 ] }), __expand__($Vb, [ 2, - 27 + 29 ], {30:[ 2, - 27 + 29 ] }), { 26: [ 1, - 103 + 107 ], 28: [ 1, - 106 + 110 ] }, __expand__($Vb, [ 2, - 26 - ], {29:107,30:[ + 28 + ], {29:111,30:[ 2, - 26 + 28 ] }), __expand__($Vb, [ 2, - 25 + 27 ], {30:[ 1, - 104 + 108 ] }) ], defaultActions: { 15: [ 2, - 5 - ], - 67: [ - 2, - 66 + 7 ], - 69: [ + 45: [ 2, 1 ], - 71: [ + 46: [ 2, 2 ], - 81: [ + 70: [ 2, - 57 + 68 ], - 95: [ + 77: [ + 2, + 5 + ], + 87: [ + 2, + 59 + ], + 90: [ 2, 3 ], 101: [ 2, - 72 + 74 + ], + 102: [ + 2, + 4 ] }, parseError: function parseError(str, hash) { @@ -3382,7 +3457,7 @@ simpleCaseActionClusters: { 73 : 28, /*! Conditions:: * */ /*! Rule:: $ */ - 75 : 9, + 75 : 8, /*! Conditions:: set */ /*! Rule:: (\\\\|\\\]|[^\]])+ */ 76 : 60, diff --git a/lex.y b/lex.y index 0cb560f..551b57e 100644 --- a/lex.y +++ b/lex.y @@ -9,13 +9,12 @@ %% lex - : init definitions '%%' rules epilogue + : init definitions '%%' rules_and_epilogue { - $$ = { rules: $rules }; + $$ = $rules_and_epilogue; if ($definitions[0]) $$.macros = $definitions[0]; if ($definitions[1]) $$.startConditions = $definitions[1]; if ($definitions[2]) $$.unknownDecls = $definitions[2]; - if ($epilogue && $epilogue.trim() !== '') $$.moduleInclude = $epilogue; // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { @@ -29,11 +28,31 @@ lex } ; -epilogue - : EOF - { $$ = null; } +rules_and_epilogue + : /* an empty rules set is allowed when you are setting up an `%options custom_lexer` */ EOF + { + $$ = { rules: null }; + } | '%%' extra_lexer_module_code EOF - { $$ = $extra_lexer_module_code; } + { + if ($extra_lexer_module_code && $extra_lexer_module_code.trim() !== '') { + $$ = { rules: null, moduleInclude: $extra_lexer_module_code }; + } else { + $$ = { rules: null }; + } + } + | rules '%%' extra_lexer_module_code EOF + { + if ($extra_lexer_module_code && $extra_lexer_module_code.trim() !== '') { + $$ = { rules: $rules, moduleInclude: $extra_lexer_module_code }; + } else { + $$ = { rules: $rules }; + } + } + | rules EOF + { + $$ = { rules: $rules }; + } ; // because JISON doesn't support mid-rule actions, we set up `yy` using this empty rule at the start: From 8975b23a8dcc44dc9f8e77b9d7ea12d10c48d7da Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 27 Oct 2015 19:16:22 +0100 Subject: [PATCH 096/417] removed the non-obvious `yy.options` setup bit of action code from lex.l as now lives where the others are too: lex.y --- lex.l | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex.l b/lex.l index a593708..3e5d49d 100644 --- a/lex.l +++ b/lex.l @@ -102,7 +102,7 @@ BR \r\n|\n|\r "\\". yytext = yytext.replace(/^\\/g, ''); return 'ESCAPE_CHAR'; "$" return '$'; "." return '.'; -"%options" if (!yy.options) { yy.options = {}; } this.begin('options'); return 'OPTIONS'; +"%options" this.begin('options'); return 'OPTIONS'; "%s" this.begin('start_condition'); return 'START_INC'; "%x" this.begin('start_condition'); return 'START_EXC'; "%include" this.pushState('path'); return 'INCLUDE'; From 21a6e3a814ca850ece04661671f115ebb14d216d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 27 Oct 2015 19:40:22 +0100 Subject: [PATCH 097/417] extended the literal feature of lison/lex: now accept any non-regex, non-lex, non-string-delim, non-escape-starter, non-space character as-is. After all, it's not just the alphanumerics that can be entered unquoted in a rule like that. --- lex-parser.js | 16 +++++++++++----- lex.l | 10 +++++++--- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 649a399..a709e95 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3119,6 +3119,15 @@ case 16 : /*! Rule:: %% */ this.begin('code'); return 6; break; +case 17 : +/*! Conditions:: rules */ +/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ */ + + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 64; + +break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ @@ -3265,7 +3274,7 @@ break; case 63 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %options\b */ - if (!yy.options) { yy.options = {}; } this.begin('options'); return 65; + this.begin('options'); return 65; break; case 64 : /*! Conditions:: indented trail rules INITIAL */ @@ -3377,9 +3386,6 @@ simpleCaseActionClusters: { /*! Conditions:: conditions */ /*! Rule:: \* */ 12 : 34, - /*! Conditions:: rules */ - /*! Rule:: [a-zA-Z0-9_]+ */ - 17 : 64, /*! Conditions:: options */ /*! Rule:: {NAME} */ 18 : 12, @@ -3483,7 +3489,7 @@ rules: [ /^(?:\s+(\r\n|\n|\r)+)/, /^(?:\s+)/, /^(?:%%)/, -/^(?:[a-zA-Z0-9_]+)/, +/^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+)/, /^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, /^(?:=)/, /^(?:"(\\\\|\\"|[^"])*")/, diff --git a/lex.l b/lex.l index 3e5d49d..4f5f3fc 100644 --- a/lex.l +++ b/lex.l @@ -30,8 +30,12 @@ BR \r\n|\n|\r \s+{BR}+ /* empty */ \s+ this.begin('indented'); "%%" this.begin('code'); return '%%'; -[a-zA-Z0-9_]+ return 'CHARACTER_LIT'; - +[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ + %{ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 'CHARACTER_LIT'; + %} {NAME} return 'NAME'; "=" return '='; \"("\\\\"|'\"'|[^"])*\" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; @@ -134,7 +138,7 @@ BR \r\n|\n|\r [\r\n] this.popState(); this.unput(yytext); "'"[^\r\n]+"'" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; -\"[^\r\n]+\" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +'"'[^\r\n]+'"' yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; \s+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; From 465b356ffe7ea53a66f07eb467af679d8f1b1fb3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 28 Oct 2015 12:28:02 +0100 Subject: [PATCH 098/417] `make bump` version bump + rebuild. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 82decca..ab79c43 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-102", + "version": "0.1.4-103", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 49a155e87e3fb4fc956757f813629a187893dce2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 28 Oct 2015 14:33:10 +0100 Subject: [PATCH 099/417] rebuild --- lex-parser.js | 293 +++++++++++++++++++++++++------------------------- 1 file changed, 145 insertions(+), 148 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index a709e95..10f7b4f 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,125 +1,125 @@ -/* parser generated by jison 0.4.15-101 */ +/* parser generated by jison 0.4.15-103 */ /* - Returns a Parser object of the following structure: - - Parser: { - yy: {} - } - - Parser.prototype: { - yy: {}, - trace: function(errorMessage, errorHash), - JisonParserError: function(msg, hash), - symbols_: {associative list: name ==> number}, - terminals_: {associative list: number ==> name}, - productions_: [...], - performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), - (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) - table: [...], - defaultActions: {...}, - parseError: function(str, hash), - parse: function(input), - - lexer: { - EOF: 1, - ERROR: 2, - JisonLexerError: function(msg, hash), - parseError: function(str, hash), - setInput: function(input), - input: function(), - unput: function(str), - more: function(), - reject: function(), - less: function(n), - pastInput: function(), - upcomingInput: function(), - showPosition: function(), - test_match: function(regex_match_array, rule_index), - next: function(), - lex: function(), - begin: function(condition), - popState: function(), - _currentRules: function(), - topState: function(), - pushState: function(condition), - stateStackSize: function(), - - options: { ... }, - - performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - rules: [...], - conditions: {associative list: name ==> set}, - } - } - - - token location info (@$, _$, etc.): { - first_line: n, - last_line: n, - first_column: n, - last_column: n, - range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) - } - - - the parseError function receives a 'hash' object with these members for lexer and parser errors: { - text: (matched text) - token: (the produced terminal token, if any) - line: (yylineno) - } - while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { - loc: (yylloc) - expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) - recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) - } - - You can specify parser options by setting / modifying the `.yy` object of your Parser instance. - These options are available: - - ### options which are global for all parser instances - - Parser.pre_parse: function(yy) - optional: you can specify a pre_parse() function in the chunk following the grammar, - i.e. after the last `%%`. - Parser.post_parse: function(yy, retval) { return retval; } - optional: you can specify a post_parse() function in the chunk following the grammar, - i.e. after the last `%%`. When it does not return any value, the parser will return - the original `retval`. - - ### options which can be set up per parser instance - - yy: { - pre_parse: function(yy) - optional: is invoked before the parse cycle starts (and before the first invocation - of `lex()`) but immediately after the invocation of parser.pre_parse()). - post_parse: function(yy, retval) { return retval; } - optional: is invoked when the parse terminates due to success ('accept') or failure - (even when exceptions are thrown). `retval` contains the return value to be produced - by `Parser.parse()`; this function can override the return value by returning another. - When it does not return any value, the parser will return the original `retval`. - This function is invoked immediately before `Parser.post_parse()`. - parseError: function(str, hash) - optional: overrides the default `parseError` function. - } - - parser.lexer.options: { - ranges: boolean optional: true ==> token location info will include a .range[] member. - flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested - exhaustively to find the longest match. - backtrack_lexer: boolean - optional: true ==> lexer regexes are tested in order and for each matching - regex the action code is invoked; the lexer terminates - the scan when a token is returned by the action code. - pre_lex: function() - optional: is invoked before the lexer is invoked to produce another token. - `this` refers to the Lexer object. - post_lex: function(token) { return token; } - optional: is invoked when the lexer has produced a token `token`; - this function can override the returned token value by returning another. - When it does not return any (truthy) value, the lexer will return the original `token`. - `this` refers to the Lexer object. - } -*/ + * Returns a Parser object of the following structure: + * + * Parser: { + * yy: {} + * } + * + * Parser.prototype: { + * yy: {}, + * trace: function(errorMessage, errorHash), + * JisonParserError: function(msg, hash), + * symbols_: {associative list: name ==> number}, + * terminals_: {associative list: number ==> name}, + * productions_: [...], + * performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), + * (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) + * table: [...], + * defaultActions: {...}, + * parseError: function(str, hash), + * parse: function(input), + * + * lexer: { + * EOF: 1, + * ERROR: 2, + * JisonLexerError: function(msg, hash), + * parseError: function(str, hash), + * setInput: function(input), + * input: function(), + * unput: function(str), + * more: function(), + * reject: function(), + * less: function(n), + * pastInput: function(), + * upcomingInput: function(), + * showPosition: function(), + * test_match: function(regex_match_array, rule_index), + * next: function(), + * lex: function(), + * begin: function(condition), + * popState: function(), + * _currentRules: function(), + * topState: function(), + * pushState: function(condition), + * stateStackSize: function(), + * + * options: { ... }, + * + * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + * rules: [...], + * conditions: {associative list: name ==> set}, + * } + * } + * + * + * token location info (@$, _$, etc.): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + * } + * + * + * the parseError function receives a 'hash' object with these members for lexer and parser errors: { + * text: (matched text) + * token: (the produced terminal token, if any) + * line: (yylineno) + * } + * while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { + * loc: (yylloc) + * expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) + * } + * + * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + * These options are available: + * + * ### options which are global for all parser instances + * + * Parser.pre_parse: function(yy) + * optional: you can specify a pre_parse() function in the chunk following the grammar, + * i.e. after the last `%%`. + * Parser.post_parse: function(yy, retval) { return retval; } + * optional: you can specify a post_parse() function in the chunk following the grammar, + * i.e. after the last `%%`. When it does not return any value, the parser will return + * the original `retval`. + * + * ### options which can be set up per parser instance + * + * yy: { + * pre_parse: function(yy) + * optional: is invoked before the parse cycle starts (and before the first invocation + * of `lex()`) but immediately after the invocation of parser.pre_parse()). + * post_parse: function(yy, retval) { return retval; } + * optional: is invoked when the parse terminates due to success ('accept') or failure + * (even when exceptions are thrown). `retval` contains the return value to be produced + * by `Parser.parse()`; this function can override the return value by returning another. + * When it does not return any value, the parser will return the original `retval`. + * This function is invoked immediately before `Parser.post_parse()`. + * parseError: function(str, hash) + * optional: overrides the default `parseError` function. + * } + * + * parser.lexer.options: { + * ranges: boolean optional: true ==> token location info will include a .range[] member. + * flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: true ==> lexer regexes are tested in order and for each matching + * regex the action code is invoked; the lexer terminates + * the scan when a token is returned by the action code. + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return the original `token`. + * `this` refers to the Lexer object. + * } + */ var lexParser = (function () { // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript @@ -611,7 +611,7 @@ performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* actio var $0 = $$.length - 1; switch (yystate) { case 1 : -/*! Production:: lex : init definitions %% rules_and_epilogue */ +/*! Production:: lex : init definitions '%%' rules_and_epilogue */ this.$ = $$[$0]; if ($$[$0-2][0]) this.$.macros = $$[$0-2][0]; @@ -636,7 +636,7 @@ case 2 : break; case 3 : -/*! Production:: rules_and_epilogue : %% extra_lexer_module_code EOF */ +/*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ if ($$[$0-1] && $$[$0-1].trim() !== '') { this.$ = { rules: null, moduleInclude: $$[$0-1] }; @@ -646,7 +646,7 @@ case 3 : break; case 4 : -/*! Production:: rules_and_epilogue : rules %% extra_lexer_module_code EOF */ +/*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code EOF */ if ($$[$0-1] && $$[$0-1].trim() !== '') { this.$ = { rules: $$[$0-3], moduleInclude: $$[$0-1] }; @@ -763,13 +763,13 @@ case 22 : this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; break; case 23 : -/*! Production:: action : { action_body } */ +/*! Production:: action : '{' action_body '}' */ case 30 : -/*! Production:: start_conditions : < name_list > */ +/*! Production:: start_conditions : '<' name_list '>' */ this.$ = $$[$0-1]; break; case 27 : -/*! Production:: action_body : action_body { action_body } action_comments_body */ +/*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; case 28 : @@ -793,11 +793,11 @@ case 29 : this.$ = $$[$0-1] + $$[$0]; break; case 31 : -/*! Production:: start_conditions : < * > */ +/*! Production:: start_conditions : '<' '*' '>' */ this.$ = ['*']; break; case 34 : -/*! Production:: name_list : name_list , NAME */ +/*! Production:: name_list : name_list ',' NAME */ this.$ = $$[$0-2]; this.$.push($$[$0]); break; case 35 : @@ -810,51 +810,51 @@ case 35 : break; case 36 : -/*! Production:: regex_list : regex_list | regex_concat */ +/*! Production:: regex_list : regex_list '|' regex_concat */ this.$ = $$[$0-2] + '|' + $$[$0]; break; case 37 : -/*! Production:: regex_list : regex_list | */ +/*! Production:: regex_list : regex_list '|' */ this.$ = $$[$0-1] + '|'; break; case 42 : -/*! Production:: regex_base : ( regex_list ) */ +/*! Production:: regex_base : '(' regex_list ')' */ this.$ = '(' + $$[$0-1] + ')'; break; case 43 : -/*! Production:: regex_base : SPECIAL_GROUP regex_list ) */ +/*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ this.$ = $$[$0-2] + $$[$0-1] + ')'; break; case 44 : -/*! Production:: regex_base : regex_base + */ +/*! Production:: regex_base : regex_base '+' */ this.$ = $$[$0-1] + '+'; break; case 45 : -/*! Production:: regex_base : regex_base * */ +/*! Production:: regex_base : regex_base '*' */ this.$ = $$[$0-1] + '*'; break; case 46 : -/*! Production:: regex_base : regex_base ? */ +/*! Production:: regex_base : regex_base '?' */ this.$ = $$[$0-1] + '?'; break; case 47 : -/*! Production:: regex_base : / regex_base */ +/*! Production:: regex_base : '/' regex_base */ this.$ = '(?=' + $$[$0] + ')'; break; case 48 : -/*! Production:: regex_base : /! regex_base */ +/*! Production:: regex_base : '/!' regex_base */ this.$ = '(?!' + $$[$0] + ')'; break; case 52 : -/*! Production:: regex_base : . */ +/*! Production:: regex_base : '.' */ this.$ = '.'; break; case 53 : -/*! Production:: regex_base : ^ */ +/*! Production:: regex_base : '^' */ this.$ = '^'; break; case 54 : -/*! Production:: regex_base : $ */ +/*! Production:: regex_base : '$' */ this.$ = '$'; break; case 58 : @@ -872,13 +872,13 @@ case 65 : this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; case 70 : -/*! Production:: option : NAME */ +/*! Production:: option : NAME[option] */ yy.options[$$[$0]] = true; break; case 71 : -/*! Production:: option : NAME = OPTION_VALUE */ +/*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ case 72 : -/*! Production:: option : NAME = NAME */ +/*! Production:: option : NAME[option] '=' NAME[value] */ yy.options[$$[$0-2]] = $$[$0]; break; case 75 : @@ -2664,7 +2664,7 @@ function prepareString (s) { }; -/* generated by jison-lex 0.3.4-100 */ +/* generated by jison-lex 0.3.4-103 */ var lexer = (function () { // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript @@ -3127,7 +3127,6 @@ case 17 : // non-escape-starter, non-space character as-is return 64; -break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ @@ -3210,7 +3209,6 @@ case 34 : this.pushState('path'); return 72; -break; case 35 : /*! Conditions:: indented */ /*! Rule:: .+ */ @@ -3299,7 +3297,6 @@ case 67 : console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); return 21; -break; case 68 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %% */ From 841270ba278c8f414f9f685ba54041996375e8a6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 28 Oct 2015 18:20:32 +0100 Subject: [PATCH 100/417] synced the lexer shown in `README.md` with the one in `lex.l` --- README.md | 48 ++++++++++++++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 0484b22..60b5b3a 100644 --- a/README.md +++ b/README.md @@ -27,10 +27,11 @@ The parser can parse its own lexical grammar, shown below: ``` NAME [a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])? +ID [a-zA-Z_][a-zA-Z0-9_]* BR \r\n|\n|\r %s indented trail rules -%x code start_condition options conditions action path +%x code start_condition options conditions action path set %options easy_keyword_rules %options ranges @@ -56,14 +57,22 @@ BR \r\n|\n|\r \s+{BR}+ /* empty */ \s+ this.begin('indented'); "%%" this.begin('code'); return '%%'; -[a-zA-Z0-9_]+ return 'CHARACTER_LIT'; - -{NAME} yy.options[yytext] = true; -{BR}+ this.popState(); -\s+{BR}+ this.popState(); +[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ + %{ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 'CHARACTER_LIT'; + %} +{NAME} return 'NAME'; +"=" return '='; +\"("\\\\"|'\"'|[^"])*\" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; +"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; +[^\s\r\n]+ return 'OPTION_VALUE'; +{BR}+ this.popState(); return 'OPTIONS_END'; +\s+{BR}+ this.popState(); return 'OPTIONS_END'; \s+ /* empty */ -{NAME} return 'START_COND'; +{ID} return 'START_COND'; {BR}+ this.popState(); \s+{BR}+ this.popState(); \s+ /* empty */ @@ -99,11 +108,12 @@ BR \r\n|\n|\r {BR}+ /* empty */ \s+ /* empty */ -{NAME} return 'NAME'; +{ID} return 'NAME'; \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; +"[" this.pushState('set'); return 'REGEX_SET_START'; "|" return '|'; -"["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; +// "["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; "(?:" return 'SPECIAL_GROUP'; "(?=" return 'SPECIAL_GROUP'; "(?!" return 'SPECIAL_GROUP'; @@ -116,31 +126,37 @@ BR \r\n|\n|\r "," return ','; "<>" return '$'; "<" this.begin('conditions'); return '<'; -"/!" return '/!'; -"/" return '/'; +"/!" return '/!'; // treated as `(?!atom)` +"/" return '/'; // treated as `(?=atom)` "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR'; "\\". yytext = yytext.replace(/^\\/g, ''); return 'ESCAPE_CHAR'; "$" return '$'; "." return '.'; -"%options" if (!yy.options) { yy.options = {}; } this.begin('options'); return false; +"%options" this.begin('options'); return 'OPTIONS'; "%s" this.begin('start_condition'); return 'START_INC'; "%x" this.begin('start_condition'); return 'START_EXC'; "%include" this.pushState('path'); return 'INCLUDE'; "%"{NAME}[^\r\n]+ %{ /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer option: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + console.warn('ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + return 'UNKNOWN_DECL'; %} "%%" this.begin('rules'); return '%%'; "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; -"{"{NAME}"}" return 'NAME_BRACE'; +"{"{ID}"}" return 'NAME_BRACE'; +"{"{ID}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ <*><> return 'EOF'; +("\\\\"|"\]"|[^\]])+ return 'REGEX_SET'; +"]" this.popState('set'); return 'REGEX_SET_END'; + + // in the trailing CODE block, only accept these `%include` macros when they appear at the start of a line // and make sure the rest of lexer regexes account for this one so it'll match that way only: [^\r\n]*(\r|\n)+ return 'CODE'; @@ -149,11 +165,11 @@ BR \r\n|\n|\r [\r\n] this.popState(); this.unput(yytext); "'"[^\r\n]+"'" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; -\"[^\r\n]+\" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +'"'[^\r\n]+'"' yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; \s+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; -<*>. %{ +<*>. %{ /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); %} From bb4bef3e83e0c79ecbc71e47da07f4e8842beb7e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 28 Oct 2015 18:20:46 +0100 Subject: [PATCH 101/417] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ab79c43..c365f15 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-103", + "version": "0.1.4-105", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From bae2273345722bc4be0948a121b5aaea11eaba15 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 28 Oct 2015 22:38:46 +0100 Subject: [PATCH 102/417] whitespace police raid: trim trailing --- lex-parser.js | 20 ++++++++++---------- lex.l | 24 ++++++++++++------------ 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 10f7b4f..d831677 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3122,8 +3122,8 @@ break; case 17 : /*! Conditions:: rules */ /*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ */ - - // accept any non-regex, non-lex, non-string-delim, + + // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is return 64; @@ -3191,9 +3191,9 @@ case 34 : /*! Conditions:: indented */ /*! Rule:: %include\b */ - // This is an include instruction in place of an action: - // thanks to the `.+` rule immediately below we need to semi-duplicate - // the `%include` token recognition here vs. the almost-identical rule for the same + // This is an include instruction in place of an action: + // thanks to the `.+` rule immediately below we need to semi-duplicate + // the `%include` token recognition here vs. the almost-identical rule for the same // further below. // There's no real harm as we need to do something special in this case anyway: // push 2 (two!) conditions. @@ -3204,9 +3204,9 @@ case 34 : // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... - this.pushState('trail'); + this.pushState('trail'); // then push the immediate need: the 'path' condition. - this.pushState('path'); + this.pushState('path'); return 72; case 35 : @@ -3262,7 +3262,7 @@ break; case 58 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/ */ - return 45; // treated as `(?=atom)` + return 45; // treated as `(?=atom)` break; case 60 : /*! Conditions:: indented trail rules INITIAL */ @@ -3292,7 +3292,7 @@ break; case 67 : /*! Conditions:: INITIAL rules trail code */ /*! Rule:: %{NAME}[^\r\n]+ */ - + /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); return 21; @@ -3345,7 +3345,7 @@ break; case 85 : /*! Conditions:: * */ /*! Rule:: . */ - + /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer input: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); diff --git a/lex.l b/lex.l index 4f5f3fc..95c837e 100644 --- a/lex.l +++ b/lex.l @@ -31,8 +31,8 @@ BR \r\n|\n|\r \s+ this.begin('indented'); "%%" this.begin('code'); return '%%'; [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ - %{ - // accept any non-regex, non-lex, non-string-delim, + %{ + // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is return 'CHARACTER_LIT'; %} @@ -56,9 +56,9 @@ BR \r\n|\n|\r "%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; "%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; "%include" %{ - // This is an include instruction in place of an action: - // thanks to the `.+` rule immediately below we need to semi-duplicate - // the `%include` token recognition here vs. the almost-identical rule for the same + // This is an include instruction in place of an action: + // thanks to the `.+` rule immediately below we need to semi-duplicate + // the `%include` token recognition here vs. the almost-identical rule for the same // further below. // There's no real harm as we need to do something special in this case anyway: // push 2 (two!) conditions. @@ -69,11 +69,11 @@ BR \r\n|\n|\r // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... - this.pushState('trail'); + this.pushState('trail'); // then push the immediate need: the 'path' condition. - this.pushState('path'); + this.pushState('path'); return 'INCLUDE'; - %} + %} .+ this.begin('rules'); return 'ACTION'; "/*"(.|\n|\r)*?"*/" /* ignore */ @@ -100,7 +100,7 @@ BR \r\n|\n|\r "<>" return '$'; "<" this.begin('conditions'); return '<'; "/!" return '/!'; // treated as `(?!atom)` -"/" return '/'; // treated as `(?=atom)` +"/" return '/'; // treated as `(?=atom)` "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR'; "\\". yytext = yytext.replace(/^\\/g, ''); return 'ESCAPE_CHAR'; @@ -110,8 +110,8 @@ BR \r\n|\n|\r "%s" this.begin('start_condition'); return 'START_INC'; "%x" this.begin('start_condition'); return 'START_EXC'; "%include" this.pushState('path'); return 'INCLUDE'; -"%"{NAME}[^\r\n]+ - %{ +"%"{NAME}[^\r\n]+ + %{ /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); return 'UNKNOWN_DECL'; @@ -142,7 +142,7 @@ BR \r\n|\n|\r \s+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; -<*>. %{ +<*>. %{ /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); %} From 5004e4c48688e838d1c287402369efc12f9b66d0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 28 Oct 2015 22:45:06 +0100 Subject: [PATCH 103/417] bump version and rebuild --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c365f15..ed9405a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-105", + "version": "0.1.4-106", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 961c840df565be84504f9ab512d53e48c495ffce Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 28 Oct 2015 23:01:44 +0100 Subject: [PATCH 104/417] rebuild from scratch --- lex-parser.js | 157 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 94 insertions(+), 63 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d831677..e71d60b 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.15-103 */ +/* parser generated by jison 0.4.15-106 */ /* * Returns a Parser object of the following structure: * @@ -61,23 +61,41 @@ * range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) * } * + * --- * - * the parseError function receives a 'hash' object with these members for lexer and parser errors: { + * The parseError function receives a 'hash' object with these members for lexer and parser errors: + * + * { * text: (matched text) * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) * line: (yylineno) - * } - * while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { * loc: (yylloc) + * } + * + * parser (grammar) errors will also provide these additional members: + * + * { * expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) + * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, for instance, for advanced error analysis and reporting) * } - * - * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. - * These options are available: - * - * ### options which are global for all parser instances - * + * + * while `this` will reference the current parser instance. + * + * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* instance, while these additional `hash` fields will also be provided: + * + * { + * lexer: (reference to the current lexer instance which reported the error) + * } + * + * --- + * + * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + * These options are available: + * + * ### options which are global for all parser instances + * * Parser.pre_parse: function(yy) * optional: you can specify a pre_parse() function in the chunk following the grammar, * i.e. after the last `%%`. @@ -85,8 +103,8 @@ * optional: you can specify a post_parse() function in the chunk following the grammar, * i.e. after the last `%%`. When it does not return any value, the parser will return * the original `retval`. - * - * ### options which can be set up per parser instance + * + * ### options which can be set up per parser instance * * yy: { * pre_parse: function(yy) @@ -101,7 +119,7 @@ * parseError: function(str, hash) * optional: overrides the default `parseError` function. * } - * + * * parser.lexer.options: { * ranges: boolean optional: true ==> token location info will include a .range[] member. * flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested @@ -605,7 +623,7 @@ productions_: [ 0 ] ], -performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { +performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */, yystack) { /* this == yyval */ var $0 = $$.length - 1; @@ -2358,8 +2376,8 @@ parse: function parse(input) { lexer = this.__lexer__ = Object.create(this.lexer); } - var sharedState = { - yy: {} + var sharedState = { + yy: {} }; // copy state for (var k in this.yy) { @@ -2382,7 +2400,7 @@ parse: function parse(input) { // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; - } + } function popStack(n) { stack.length = stack.length - 2 * n; @@ -2489,10 +2507,12 @@ parse: function parse(input) { a = this.parseError(errStr, p = { text: lexer.match, token: this.terminals_[symbol] || symbol, + token_id: symbol, line: lexer.yylineno, loc: yyloc, expected: expected, - recoverable: (error_rule_depth !== false) + recoverable: (error_rule_depth !== false), + state_stack: stack }); if (!p.recoverable) { retval = a; @@ -2508,10 +2528,12 @@ parse: function parse(input) { retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { text: lexer.match, token: this.terminals_[symbol] || symbol, + token_id: symbol, line: lexer.yylineno, loc: yyloc, expected: expected, - recoverable: false + recoverable: false, + state_stack: stack }); break; } @@ -2529,10 +2551,12 @@ parse: function parse(input) { retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { text: lexer.match, token: this.terminals_[symbol] || symbol, + token_id, line: lexer.yylineno, loc: yyloc, expected: expected, - recoverable: false + recoverable: false, + state_stack: stack }); break; } @@ -2551,10 +2575,12 @@ parse: function parse(input) { retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { text: lexer.match, token: this.terminals_[symbol] || symbol, + token_id: symbol, line: lexer.yylineno, loc: yyloc, expected: expected, - recoverable: false + recoverable: false, + state_stack: stack }); break; } @@ -2587,7 +2613,7 @@ parse: function parse(input) { // reduce //this.reductionCount++; - this_production = this.productions_[action[1]]; + this_production = this.productions_[action[1]]; len = this_production[1]; lstack_end = lstack.length; lstack_begin = lstack_end - (len1 || 1); @@ -2605,7 +2631,7 @@ parse: function parse(input) { if (ranges) { yyval._$.range = [lstack[lstack_begin].range[0], lstack[lstack_end].range[1]]; } - r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack].concat(args)); + r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack, stack].concat(args)); if (typeof r !== 'undefined') { retval = r; @@ -2664,7 +2690,7 @@ function prepareString (s) { }; -/* generated by jison-lex 0.3.4-103 */ +/* generated by jison-lex 0.3.4-106 */ var lexer = (function () { // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript @@ -2687,7 +2713,7 @@ EOF:1, ERROR:2, parseError:function parseError(str, hash) { - if (this.yy.parser) { + if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { return this.yy.parser.parseError(str, hash) || this.ERROR; } else { throw new this.JisonLexerError(str); @@ -2717,6 +2743,10 @@ setInput:function (input, yy) { // consumes and returns one char from the input input:function () { + if (!this._input) { + this.done = true; + return null; + } var ch = this._input[0]; this.yytext += ch; this.yyleng++; @@ -2725,7 +2755,7 @@ input:function () { this.matched += ch; // Count the linenumber up when we hit the LF (or a stand-alone CR). // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo - // and we advance immediately past the LF as well, returning both together as if + // and we advance immediately past the LF as well, returning both together as if // it was all a single 'character' only. var slice_len = 1; var lines = false; @@ -2746,7 +2776,7 @@ input:function () { this.yylloc.range[1]++; } } - } + } if (lines) { this.yylineno++; this.yylloc.last_line++; @@ -2777,22 +2807,18 @@ unput:function (ch) { if (lines.length - 1) { this.yylineno -= lines.length - 1; } - var r = this.yylloc.range; - this.yylloc = { - first_line: this.yylloc.first_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.first_column, - last_column: lines ? + this.yylloc.last_line = this.yylineno + 1; + this.yylloc.last_column = (lines ? (lines.length === oldLines.length ? this.yylloc.first_column : 0) + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len - }; + this.yylloc.first_column - len); if (this.options.ranges) { - this.yylloc.range = [r[0], r[0] + this.yyleng - len]; + this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng - len; } this.yyleng = this.yytext.length; + this.done = false; return this; }, @@ -2814,7 +2840,8 @@ reject:function () { text: this.match, token: null, line: this.yylineno, - loc: this.yylloc + loc: this.yylloc, + lexer: this }) || this.ERROR); } return this; @@ -2998,10 +3025,11 @@ next:function () { text: this.match + this._input, token: null, line: this.yylineno, - loc: this.yylloc + loc: this.yylloc, + lexer: this }) || this.ERROR; if (token === this.ERROR) { - // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward one character at a time: + // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward at least one character at a time: if (!this.match.length) { this.input(); } @@ -3071,8 +3099,8 @@ stateStackSize:function stateStackSize() { return this.conditionStack.length; }, options: { - "easy_keyword_rules": true, - "ranges": true + easy_keyword_rules: true, + ranges: true }, JisonLexerError: JisonLexerError, performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { @@ -3127,6 +3155,7 @@ case 17 : // non-escape-starter, non-space character as-is return 64; +break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ @@ -3209,6 +3238,7 @@ case 34 : this.pushState('path'); return 72; +break; case 35 : /*! Conditions:: indented */ /*! Rule:: .+ */ @@ -3297,6 +3327,7 @@ case 67 : console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); return 21; +break; case 68 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %% */ @@ -3558,7 +3589,7 @@ rules: [ ], conditions: { "code": { - "rules": [ + rules: [ 66, 67, 75, @@ -3566,10 +3597,10 @@ conditions: { 79, 85 ], - "inclusive": false + inclusive: false }, "start_condition": { - "rules": [ + rules: [ 26, 27, 28, @@ -3577,10 +3608,10 @@ conditions: { 75, 85 ], - "inclusive": false + inclusive: false }, "options": { - "rules": [ + rules: [ 18, 19, 20, @@ -3593,10 +3624,10 @@ conditions: { 75, 85 ], - "inclusive": false + inclusive: false }, "conditions": { - "rules": [ + rules: [ 9, 10, 11, @@ -3604,10 +3635,10 @@ conditions: { 75, 85 ], - "inclusive": false + inclusive: false }, "action": { - "rules": [ + rules: [ 0, 1, 2, @@ -3620,10 +3651,10 @@ conditions: { 75, 85 ], - "inclusive": false + inclusive: false }, "path": { - "rules": [ + rules: [ 75, 80, 81, @@ -3632,20 +3663,20 @@ conditions: { 84, 85 ], - "inclusive": false + inclusive: false }, "set": { - "rules": [ + rules: [ 71, 75, 76, 77, 85 ], - "inclusive": false + inclusive: false }, "indented": { - "rules": [ + rules: [ 31, 32, 33, @@ -3690,10 +3721,10 @@ conditions: { 75, 85 ], - "inclusive": true + inclusive: true }, "trail": { - "rules": [ + rules: [ 30, 33, 36, @@ -3737,10 +3768,10 @@ conditions: { 75, 85 ], - "inclusive": true + inclusive: true }, "rules": { - "rules": [ + rules: [ 13, 14, 15, @@ -3787,10 +3818,10 @@ conditions: { 75, 85 ], - "inclusive": true + inclusive: true }, "INITIAL": { - "rules": [ + rules: [ 33, 36, 37, @@ -3833,7 +3864,7 @@ conditions: { 75, 85 ], - "inclusive": true + inclusive: true } } }); From 9e5a17ff18e1b1a8bc8e34e16d19877e16763fc2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 29 Oct 2015 21:51:02 +0100 Subject: [PATCH 105/417] - fix bug in lexer lexer (lex.l !) which prevented the jison lexer from properly detecting macro usage inside `[...]` sets in regexes when those regexes are more complex than maybe just a couple of sets. --- lex-parser.js | 53 ++++++++++++++++++++++++++++----------------------- lex.l | 4 ++-- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index e71d60b..b52bba2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3338,42 +3338,42 @@ case 74 : /*! Rule:: . */ throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ break; -case 77 : +case 78 : /*! Conditions:: set */ /*! Rule:: \] */ this.popState('set'); return 58; break; -case 79 : +case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ return 75; // the bit of CODE just before EOF... break; -case 80 : +case 81 : /*! Conditions:: path */ /*! Rule:: [\r\n] */ this.popState(); this.unput(yy_.yytext); break; -case 81 : +case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 73; break; -case 82 : +case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 73; break; -case 83 : +case 84 : /*! Conditions:: path */ /*! Rule:: \s+ */ // skip whitespace in the line break; -case 84 : +case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ this.popState(); return 73; break; -case 85 : +case 86 : /*! Conditions:: * */ /*! Rule:: . */ @@ -3493,11 +3493,14 @@ simpleCaseActionClusters: { /*! Rule:: $ */ 75 : 8, /*! Conditions:: set */ - /*! Rule:: (\\\\|\\\]|[^\]])+ */ + /*! Rule:: (\\\\|\\\]|[^\]{])+ */ 76 : 60, + /*! Conditions:: set */ + /*! Rule:: \{ */ + 77 : 60, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 78 : 75 + 79 : 75 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, @@ -3576,7 +3579,8 @@ rules: [ /^(?:\})/, /^(?:.)/, /^(?:$)/, -/^(?:(\\\\|\\\]|[^\]])+)/, +/^(?:(\\\\|\\\]|[^\]{])+)/, +/^(?:\{)/, /^(?:\])/, /^(?:[^\r\n]*(\r|\n)+)/, /^(?:[^\r\n]+)/, @@ -3593,9 +3597,9 @@ conditions: { 66, 67, 75, - 78, 79, - 85 + 80, + 86 ], inclusive: false }, @@ -3606,7 +3610,7 @@ conditions: { 28, 29, 75, - 85 + 86 ], inclusive: false }, @@ -3622,7 +3626,7 @@ conditions: { 25, 71, 75, - 85 + 86 ], inclusive: false }, @@ -3633,7 +3637,7 @@ conditions: { 11, 12, 75, - 85 + 86 ], inclusive: false }, @@ -3649,19 +3653,19 @@ conditions: { 7, 8, 75, - 85 + 86 ], inclusive: false }, "path": { rules: [ 75, - 80, 81, 82, 83, 84, - 85 + 85, + 86 ], inclusive: false }, @@ -3671,7 +3675,8 @@ conditions: { 75, 76, 77, - 85 + 78, + 86 ], inclusive: false }, @@ -3719,7 +3724,7 @@ conditions: { 73, 74, 75, - 85 + 86 ], inclusive: true }, @@ -3766,7 +3771,7 @@ conditions: { 73, 74, 75, - 85 + 86 ], inclusive: true }, @@ -3816,7 +3821,7 @@ conditions: { 73, 74, 75, - 85 + 86 ], inclusive: true }, @@ -3862,7 +3867,7 @@ conditions: { 73, 74, 75, - 85 + 86 ], inclusive: true } diff --git a/lex.l b/lex.l index 95c837e..0e77216 100644 --- a/lex.l +++ b/lex.l @@ -86,7 +86,6 @@ BR \r\n|\n|\r "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; "[" this.pushState('set'); return 'REGEX_SET_START'; "|" return '|'; -// "["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; "(?:" return 'SPECIAL_GROUP'; "(?=" return 'SPECIAL_GROUP'; "(?!" return 'SPECIAL_GROUP'; @@ -126,7 +125,8 @@ BR \r\n|\n|\r <*><> return 'EOF'; -("\\\\"|"\]"|[^\]])+ return 'REGEX_SET'; +("\\\\"|"\]"|[^\]{])+ return 'REGEX_SET'; +"{" return 'REGEX_SET'; "]" this.popState('set'); return 'REGEX_SET_END'; From cbe5c6ef1b669a0dd6a7d08da6702c8cba1f1b00 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 29 Oct 2015 23:23:40 +0100 Subject: [PATCH 106/417] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ed9405a..0d4727f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-106", + "version": "0.1.4-107", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 299898442874e89fd689380679697f8ee28587e9 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 1 Nov 2015 15:16:19 +0100 Subject: [PATCH 107/417] - simplify the way we can detect a custom lexer being defined: when there's zero rules defined, we have to assume the user is defining a hand-coded (non-lex/flex) lexer via the %{...%} action block(s) and/or %include statements. - version bump --- lex-parser.js | 6 +++--- lex.y | 6 +++--- package.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index b52bba2..5bc3b4a 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -650,16 +650,16 @@ break; case 2 : /*! Production:: rules_and_epilogue : EOF */ - this.$ = { rules: null }; + this.$ = { rules: [] }; break; case 3 : /*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ if ($$[$0-1] && $$[$0-1].trim() !== '') { - this.$ = { rules: null, moduleInclude: $$[$0-1] }; + this.$ = { rules: [], moduleInclude: $$[$0-1] }; } else { - this.$ = { rules: null }; + this.$ = { rules: [] }; } break; diff --git a/lex.y b/lex.y index 551b57e..a3e7865 100644 --- a/lex.y +++ b/lex.y @@ -31,14 +31,14 @@ lex rules_and_epilogue : /* an empty rules set is allowed when you are setting up an `%options custom_lexer` */ EOF { - $$ = { rules: null }; + $$ = { rules: [] }; } | '%%' extra_lexer_module_code EOF { if ($extra_lexer_module_code && $extra_lexer_module_code.trim() !== '') { - $$ = { rules: null, moduleInclude: $extra_lexer_module_code }; + $$ = { rules: [], moduleInclude: $extra_lexer_module_code }; } else { - $$ = { rules: null }; + $$ = { rules: [] }; } } | rules '%%' extra_lexer_module_code EOF diff --git a/package.json b/package.json index 0d4727f..ba6d636 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-107", + "version": "0.1.4-108", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 2d42fea0e66c539c10edf344ee4f057450d5d234 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Nov 2015 22:42:22 +0100 Subject: [PATCH 108/417] update packages and regenerate the parsers. All tests pass. --- lex-parser.js | 290 ++++++++++++++++++++++++++++++++++++++------------ package.json | 2 +- 2 files changed, 221 insertions(+), 71 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 5bc3b4a..63f5d7e 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.15-106 */ +/* parser generated by jison 0.4.15-108 */ /* * Returns a Parser object of the following structure: * @@ -179,82 +179,82 @@ trace: function trace() { }, JisonParserError: JisonParserError, yy: {}, symbols_: { - "error": 2, - "lex": 3, - "init": 4, - "definitions": 5, + "$": 52, + "$accept": 0, + "$end": 1, "%%": 6, - "rules_and_epilogue": 7, - "EOF": 8, - "extra_lexer_module_code": 9, - "rules": 10, - "definition": 11, - "NAME": 12, - "regex": 13, - "START_INC": 14, - "names_inclusive": 15, - "START_EXC": 16, - "names_exclusive": 17, - "ACTION": 18, - "include_macro_code": 19, - "options": 20, - "UNKNOWN_DECL": 21, - "START_COND": 22, - "rule": 23, - "start_conditions": 24, - "action": 25, - "{": 26, - "action_body": 27, - "}": 28, - "action_comments_body": 29, - "ACTION_BODY": 30, - "<": 31, - "name_list": 32, - ">": 33, - "*": 34, - ",": 35, - "regex_list": 36, - "|": 37, - "regex_concat": 38, - "regex_base": 39, "(": 40, ")": 41, - "SPECIAL_GROUP": 42, + "*": 34, "+": 43, - "?": 44, + ",": 35, + ".": 50, "/": 45, "/!": 46, - "name_expansion": 47, - "range_regex": 48, - "any_group_regex": 49, - ".": 50, - "^": 51, - "$": 52, - "string": 53, - "escape_char": 54, - "NAME_BRACE": 55, - "REGEX_SET_START": 56, - "regex_set": 57, - "REGEX_SET_END": 58, - "regex_set_atom": 59, - "REGEX_SET": 60, - "ESCAPE_CHAR": 61, - "RANGE_REGEX": 62, - "STRING_LIT": 63, + "<": 31, + "=": 69, + ">": 33, + "?": 44, + "ACTION": 18, + "ACTION_BODY": 30, "CHARACTER_LIT": 64, + "CODE": 75, + "EOF": 8, + "ESCAPE_CHAR": 61, + "INCLUDE": 72, + "NAME": 12, + "NAME_BRACE": 55, "OPTIONS": 65, - "option_list": 66, "OPTIONS_END": 67, - "option": 68, - "=": 69, "OPTION_VALUE": 70, - "optional_module_code_chunk": 71, - "INCLUDE": 72, "PATH": 73, + "RANGE_REGEX": 62, + "REGEX_SET": 60, + "REGEX_SET_END": 58, + "REGEX_SET_START": 56, + "SPECIAL_GROUP": 42, + "START_COND": 22, + "START_EXC": 16, + "START_INC": 14, + "STRING_LIT": 63, + "UNKNOWN_DECL": 21, + "^": 51, + "action": 25, + "action_body": 27, + "action_comments_body": 29, + "any_group_regex": 49, + "definition": 11, + "definitions": 5, + "error": 2, + "escape_char": 54, + "extra_lexer_module_code": 9, + "include_macro_code": 19, + "init": 4, + "lex": 3, "module_code_chunk": 74, - "CODE": 75, - "$accept": 0, - "$end": 1 + "name_expansion": 47, + "name_list": 32, + "names_exclusive": 17, + "names_inclusive": 15, + "option": 68, + "option_list": 66, + "optional_module_code_chunk": 71, + "options": 20, + "range_regex": 48, + "regex": 13, + "regex_base": 39, + "regex_concat": 38, + "regex_list": 36, + "regex_set": 57, + "regex_set_atom": 59, + "rule": 23, + "rules": 10, + "rules_and_epilogue": 7, + "start_conditions": 24, + "string": 53, + "{": 26, + "|": 37, + "}": 28 }, terminals_: { 2: "error", @@ -300,6 +300,155 @@ terminals_: { 73: "PATH", 75: "CODE" }, +nonterminals_: { + "lex": { + 1: "init definitions %% rules_and_epilogue" + }, + "rules_and_epilogue": { + 2: "EOF", + 3: "%% extra_lexer_module_code EOF", + 4: "rules %% extra_lexer_module_code EOF", + 5: "rules EOF" + }, + "init": { + 6: "" + }, + "definitions": { + 7: "definition definitions", + 8: "" + }, + "definition": { + 9: "NAME regex", + 10: "START_INC names_inclusive", + 11: "START_EXC names_exclusive", + 12: "ACTION", + 13: "include_macro_code", + 14: "options", + 15: "UNKNOWN_DECL" + }, + "names_inclusive": { + 16: "START_COND", + 17: "names_inclusive START_COND" + }, + "names_exclusive": { + 18: "START_COND", + 19: "names_exclusive START_COND" + }, + "rules": { + 20: "rules rule", + 21: "rule" + }, + "rule": { + 22: "start_conditions regex action" + }, + "action": { + 23: "{ action_body }", + 24: "ACTION", + 25: "include_macro_code" + }, + "action_body": { + 26: "action_comments_body", + 27: "action_body { action_body } action_comments_body" + }, + "action_comments_body": { + 28: "", + 29: "action_comments_body ACTION_BODY" + }, + "start_conditions": { + 30: "< name_list >", + 31: "< * >", + 32: "" + }, + "name_list": { + 33: "NAME", + 34: "name_list , NAME" + }, + "regex": { + 35: "regex_list" + }, + "regex_list": { + 36: "regex_list | regex_concat", + 37: "regex_list |", + 38: "regex_concat", + 39: "" + }, + "regex_concat": { + 40: "regex_concat regex_base", + 41: "regex_base" + }, + "regex_base": { + 42: "( regex_list )", + 43: "SPECIAL_GROUP regex_list )", + 44: "regex_base +", + 45: "regex_base *", + 46: "regex_base ?", + 47: "/ regex_base", + 48: "/! regex_base", + 49: "name_expansion", + 50: "regex_base range_regex", + 51: "any_group_regex", + 52: ".", + 53: "^", + 54: "$", + 55: "string", + 56: "escape_char" + }, + "name_expansion": { + 57: "NAME_BRACE" + }, + "any_group_regex": { + 58: "REGEX_SET_START regex_set REGEX_SET_END" + }, + "regex_set": { + 59: "regex_set_atom regex_set", + 60: "regex_set_atom" + }, + "regex_set_atom": { + 61: "REGEX_SET", + 62: "name_expansion" + }, + "escape_char": { + 63: "ESCAPE_CHAR" + }, + "range_regex": { + 64: "RANGE_REGEX" + }, + "string": { + 65: "STRING_LIT", + 66: "CHARACTER_LIT" + }, + "options": { + 67: "OPTIONS option_list OPTIONS_END" + }, + "option_list": { + 68: "option option_list", + 69: "option" + }, + "option": { + 70: "NAME", + 71: "NAME = OPTION_VALUE", + 72: "NAME = NAME" + }, + "extra_lexer_module_code": { + 73: "optional_module_code_chunk", + 74: "optional_module_code_chunk include_macro_code extra_lexer_module_code" + }, + "include_macro_code": { + 75: "INCLUDE PATH", + 76: "INCLUDE error" + }, + "module_code_chunk": { + 77: "CODE", + 78: "module_code_chunk CODE" + }, + "optional_module_code_chunk": { + 79: "module_code_chunk", + 80: "" + }, + "$accept": { + 0: "lex $end" + } +}, productions_: [ 0, [ @@ -2422,7 +2571,7 @@ parse: function parse(input) { var preErrorSymbol = null; var state, action, a, r; var yyval = {}; - var p, len, len1, this_production, lstack_begin, lstack_end, newState; + var p, len, this_production, lstack_begin, lstack_end, newState; var expected = []; var retval = false; @@ -2616,7 +2765,7 @@ parse: function parse(input) { this_production = this.productions_[action[1]]; len = this_production[1]; lstack_end = lstack.length; - lstack_begin = lstack_end - (len1 || 1); + lstack_begin = lstack_end - (len || 1); lstack_end--; // perform semantic action @@ -2690,7 +2839,7 @@ function prepareString (s) { }; -/* generated by jison-lex 0.3.4-106 */ +/* generated by jison-lex 0.3.4-108 */ var lexer = (function () { // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript @@ -2706,7 +2855,7 @@ JisonLexerError.prototype = Object.create(Error.prototype); JisonLexerError.prototype.constructor = JisonLexerError; JisonLexerError.prototype.name = 'JisonLexerError'; -var lexer = ({ +var lexer = { EOF:1, @@ -3872,7 +4021,8 @@ conditions: { inclusive: true } } -}); +}; + // lexer.JisonLexerError = JisonLexerError; return lexer; })(); diff --git a/package.json b/package.json index ba6d636..f4297d1 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ ], "license": "MIT", "devDependencies": { - "jison": "git://github.com/GerHobbelt/jison.git#master", + "jison": "GerHobbelt/jison#master", "test": ">=0.6.0" } } From 5e711487d1c9edbfc607a653691a04b1f7b8b2ff Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Nov 2015 22:45:16 +0100 Subject: [PATCH 109/417] bumped version; regenerate the parsers. All tests pass. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f4297d1..a5ad978 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-108", + "version": "0.1.4-109", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From e4121f4f1b39a4f3bbe0256e3fc727ecb7e68d1c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 29 Nov 2015 23:14:52 +0100 Subject: [PATCH 110/417] bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a5ad978..5ac84d7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-109", + "version": "0.1.4-111", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From b7eff87731d2b0a4acda4c1858ba780171240c1b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Nov 2015 01:50:36 +0100 Subject: [PATCH 111/417] bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5ac84d7..5bdbabc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-111", + "version": "0.1.4-112", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 8be55c60046c3a4898581bfc805506e05d2f27e2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Nov 2015 02:45:45 +0100 Subject: [PATCH 112/417] rebuild --- lex-parser.js | 1303 +++++++++++++++++++++++++------------------------ 1 file changed, 655 insertions(+), 648 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 63f5d7e..a9cfc34 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.15-108 */ +/* parser generated by jison 0.4.15-112 */ /* * Returns a Parser object of the following structure: * @@ -161,146 +161,150 @@ function __expand__(k, v, o) { return o; } -var $V0=[6,12,14,16,18,21,65], - $V1=[18,26,37,40,42,45,46,50,51,52,55,56,61,63,64], - $V2=[6,12,14,16,18,21,26,37,41,65], - $V3=[6,12,14,16,18,21,26,37,40,41,42,45,46,50,51,52,55,56,61,63,64,65], - $V4=[37,41], - $V5=[6,12,14,16,18,21,26,34,37,40,41,42,43,44,45,46,50,51,52,55,56,61,62,63,64,65], - $V6=[6,12,14,16,18,21,22,65], - $V7=[6,8,12,14,16,18,21,26,31,37,40,42,45,46,50,51,52,55,56,61,63,64,65,72], - $V8=[8,72], - $V9=[6,8,18,26,31,37,40,42,45,46,50,51,52,55,56,61,63,64], - $Va=[55,58], - $Vb=[26,28]; +var $V0=[130,136,138,140,142,145,174], + $V1=[36,40,46,47,94,123,124,142,157,158,164,165,170,172,173], + $V2=[41,123,124,130,136,138,140,142,145,174], + $V3=[36,40,41,46,47,94,123,124,130,136,138,140,142,145,157,158,164,165,170,172,173,174], + $V4=[41,124], + $V5=[36,40,41,42,43,46,47,63,94,123,124,130,136,138,140,142,145,157,158,164,165,170,171,172,173,174], + $V6=[130,136,138,140,142,145,146,174], + $V7=[36,40,46,47,60,94,123,124,130,132,136,138,140,142,145,157,158,164,165,170,172,173,174,180], + $V8=[132,180], + $V9=[36,40,46,47,60,94,123,124,130,132,142,157,158,164,165,170,172,173], + $Va=[164,167], + $Vb=[123,125]; var parser = { trace: function trace() { }, JisonParserError: JisonParserError, yy: {}, symbols_: { - "$": 52, + "$": 36, "$accept": 0, "$end": 1, - "%%": 6, + "%%": 130, "(": 40, ")": 41, - "*": 34, + "*": 42, "+": 43, - ",": 35, - ".": 50, - "/": 45, - "/!": 46, - "<": 31, - "=": 69, - ">": 33, - "?": 44, - "ACTION": 18, - "ACTION_BODY": 30, - "CHARACTER_LIT": 64, - "CODE": 75, - "EOF": 8, - "ESCAPE_CHAR": 61, - "INCLUDE": 72, - "NAME": 12, - "NAME_BRACE": 55, - "OPTIONS": 65, - "OPTIONS_END": 67, - "OPTION_VALUE": 70, - "PATH": 73, - "RANGE_REGEX": 62, - "REGEX_SET": 60, - "REGEX_SET_END": 58, - "REGEX_SET_START": 56, - "SPECIAL_GROUP": 42, - "START_COND": 22, - "START_EXC": 16, - "START_INC": 14, - "STRING_LIT": 63, - "UNKNOWN_DECL": 21, - "^": 51, - "action": 25, - "action_body": 27, - "action_comments_body": 29, - "any_group_regex": 49, - "definition": 11, - "definitions": 5, + ",": 44, + ".": 46, + "/": 47, + "/!": 158, + "<": 60, + "=": 61, + ">": 62, + "?": 63, + "ACTION": 142, + "ACTION_BODY": 152, + "CHARACTER_LIT": 173, + "CODE": 183, + "EOF": 132, + "ESCAPE_CHAR": 170, + "INCLUDE": 180, + "NAME": 136, + "NAME_BRACE": 164, + "OPTIONS": 174, + "OPTIONS_END": 176, + "OPTION_VALUE": 178, + "PATH": 181, + "RANGE_REGEX": 171, + "REGEX_SET": 169, + "REGEX_SET_END": 167, + "REGEX_SET_START": 165, + "SPECIAL_GROUP": 157, + "START_COND": 146, + "START_EXC": 140, + "START_INC": 138, + "STRING_LIT": 172, + "UNKNOWN_DECL": 145, + "^": 94, + "action": 149, + "action_body": 150, + "action_comments_body": 151, + "any_group_regex": 161, + "definition": 135, + "definitions": 129, "error": 2, - "escape_char": 54, - "extra_lexer_module_code": 9, - "include_macro_code": 19, - "init": 4, - "lex": 3, - "module_code_chunk": 74, - "name_expansion": 47, - "name_list": 32, - "names_exclusive": 17, - "names_inclusive": 15, - "option": 68, - "option_list": 66, - "optional_module_code_chunk": 71, - "options": 20, - "range_regex": 48, - "regex": 13, - "regex_base": 39, - "regex_concat": 38, - "regex_list": 36, - "regex_set": 57, - "regex_set_atom": 59, - "rule": 23, - "rules": 10, - "rules_and_epilogue": 7, - "start_conditions": 24, - "string": 53, - "{": 26, - "|": 37, - "}": 28 + "escape_char": 163, + "extra_lexer_module_code": 133, + "include_macro_code": 143, + "init": 128, + "lex": 127, + "module_code_chunk": 182, + "name_expansion": 159, + "name_list": 153, + "names_exclusive": 141, + "names_inclusive": 139, + "option": 177, + "option_list": 175, + "optional_module_code_chunk": 179, + "options": 144, + "range_regex": 160, + "regex": 137, + "regex_base": 156, + "regex_concat": 155, + "regex_list": 154, + "regex_set": 166, + "regex_set_atom": 168, + "rule": 147, + "rules": 134, + "rules_and_epilogue": 131, + "start_conditions": 148, + "string": 162, + "{": 123, + "|": 124, + "}": 125 }, terminals_: { + 1: "$end", 2: "error", - 6: "%%", - 8: "EOF", - 12: "NAME", - 14: "START_INC", - 16: "START_EXC", - 18: "ACTION", - 21: "UNKNOWN_DECL", - 22: "START_COND", - 26: "{", - 28: "}", - 30: "ACTION_BODY", - 31: "<", - 33: ">", - 34: "*", - 35: ",", - 37: "|", + 36: "$", 40: "(", 41: ")", - 42: "SPECIAL_GROUP", + 42: "*", 43: "+", - 44: "?", - 45: "/", - 46: "/!", - 50: ".", - 51: "^", - 52: "$", - 55: "NAME_BRACE", - 56: "REGEX_SET_START", - 58: "REGEX_SET_END", - 60: "REGEX_SET", - 61: "ESCAPE_CHAR", - 62: "RANGE_REGEX", - 63: "STRING_LIT", - 64: "CHARACTER_LIT", - 65: "OPTIONS", - 67: "OPTIONS_END", - 69: "=", - 70: "OPTION_VALUE", - 72: "INCLUDE", - 73: "PATH", - 75: "CODE" + 44: ",", + 46: ".", + 47: "/", + 60: "<", + 61: "=", + 62: ">", + 63: "?", + 94: "^", + 123: "{", + 124: "|", + 125: "}", + 130: "%%", + 132: "EOF", + 136: "NAME", + 138: "START_INC", + 140: "START_EXC", + 142: "ACTION", + 145: "UNKNOWN_DECL", + 146: "START_COND", + 152: "ACTION_BODY", + 157: "SPECIAL_GROUP", + 158: "/!", + 164: "NAME_BRACE", + 165: "REGEX_SET_START", + 167: "REGEX_SET_END", + 169: "REGEX_SET", + 170: "ESCAPE_CHAR", + 171: "RANGE_REGEX", + 172: "STRING_LIT", + 173: "CHARACTER_LIT", + 174: "OPTIONS", + 176: "OPTIONS_END", + 178: "OPTION_VALUE", + 180: "INCLUDE", + 181: "PATH", + 183: "CODE" }, nonterminals_: { + "$accept": { + 0: "lex $end" + }, "lex": { 1: "init definitions %% rules_and_epilogue" }, @@ -444,331 +448,328 @@ nonterminals_: { "optional_module_code_chunk": { 79: "module_code_chunk", 80: "" - }, - "$accept": { - 0: "lex $end" } }, productions_: [ 0, [ - 3, + 127, 4 ], [ - 7, + 131, 1 ], [ - 7, + 131, 3 ], [ - 7, + 131, 4 ], [ - 7, + 131, 2 ], [ - 4, + 128, 0 ], [ - 5, + 129, 2 ], [ - 5, + 129, 0 ], [ - 11, + 135, 2 ], [ - 11, + 135, 2 ], [ - 11, + 135, 2 ], [ - 11, + 135, 1 ], [ - 11, + 135, 1 ], [ - 11, + 135, 1 ], [ - 11, + 135, 1 ], [ - 15, + 139, 1 ], [ - 15, + 139, 2 ], [ - 17, + 141, 1 ], [ - 17, + 141, 2 ], [ - 10, + 134, 2 ], [ - 10, + 134, 1 ], [ - 23, + 147, 3 ], [ - 25, + 149, 3 ], [ - 25, + 149, 1 ], [ - 25, + 149, 1 ], [ - 27, + 150, 1 ], [ - 27, + 150, 5 ], [ - 29, + 151, 0 ], [ - 29, + 151, 2 ], [ - 24, + 148, 3 ], [ - 24, + 148, 3 ], [ - 24, + 148, 0 ], [ - 32, + 153, 1 ], [ - 32, + 153, 3 ], [ - 13, + 137, 1 ], [ - 36, + 154, 3 ], [ - 36, + 154, 2 ], [ - 36, + 154, 1 ], [ - 36, + 154, 0 ], [ - 38, + 155, 2 ], [ - 38, + 155, 1 ], [ - 39, + 156, 3 ], [ - 39, + 156, 3 ], [ - 39, + 156, 2 ], [ - 39, + 156, 2 ], [ - 39, + 156, 2 ], [ - 39, + 156, 2 ], [ - 39, + 156, 2 ], [ - 39, + 156, 1 ], [ - 39, + 156, 2 ], [ - 39, + 156, 1 ], [ - 39, + 156, 1 ], [ - 39, + 156, 1 ], [ - 39, + 156, 1 ], [ - 39, + 156, 1 ], [ - 39, + 156, 1 ], [ - 47, + 159, 1 ], [ - 49, + 161, 3 ], [ - 57, + 166, 2 ], [ - 57, + 166, 1 ], [ - 59, + 168, 1 ], [ - 59, + 168, 1 ], [ - 54, + 163, 1 ], [ - 48, + 160, 1 ], [ - 53, + 162, 1 ], [ - 53, + 162, 1 ], [ - 20, + 144, 3 ], [ - 66, + 175, 2 ], [ - 66, + 175, 1 ], [ - 68, + 177, 1 ], [ - 68, + 177, 3 ], [ - 68, + 177, 3 ], [ - 9, + 133, 1 ], [ - 9, + 133, 3 ], [ - 19, + 143, 2 ], [ - 19, + 143, 2 ], [ - 74, + 182, 1 ], [ - 74, + 182, 2 ], [ - 71, + 179, 1 ], [ - 71, + 179, 0 ] ], @@ -1069,7 +1070,7 @@ table: [ __expand__($V0, [ 2, 6 - ], {3:1,4:2,72:[ + ], {127:1,128:2,180:[ 2, 6 ] @@ -1080,141 +1081,141 @@ table: [ ] }, { - 5: 3, - 6: [ + 129: 3, + 130: [ 2, 8 ], - 11: 4, - 12: [ + 135: 4, + 136: [ 1, 5 ], - 14: [ + 138: [ 1, 6 ], - 16: [ + 140: [ 1, 7 ], - 18: [ + 142: [ 1, 8 ], - 19: 9, - 20: 10, - 21: [ + 143: 9, + 144: 10, + 145: [ 1, 11 ], - 65: [ + 174: [ 1, 13 ], - 72: [ + 180: [ 1, 12 ] }, { - 6: [ + 130: [ 1, 14 ] }, { - 5: 15, - 6: [ + 129: 15, + 130: [ 2, 8 ], - 11: 4, - 12: [ + 135: 4, + 136: [ 1, 5 ], - 14: [ + 138: [ 1, 6 ], - 16: [ + 140: [ 1, 7 ], - 18: [ + 142: [ 1, 8 ], - 19: 9, - 20: 10, - 21: [ + 143: 9, + 144: 10, + 145: [ 1, 11 ], - 65: [ + 174: [ 1, 13 ], - 72: [ + 180: [ 1, 12 ] }, - __expand__([6,12,14,16,18,21,37,65], [ + __expand__([124,130,136,138,140,142,145,174], [ 2, 39 - ], {13:16,36:17,38:18,39:19,47:24,49:25,53:29,54:30,40:[ + ], {137:16,154:17,155:18,156:19,159:24,161:25,162:29,163:30,36:[ 1, - 20 - ],42:[ - 1, - 21 - ],45:[ + 28 + ],40:[ 1, - 22 + 20 ],46:[ - 1, - 23 - ],50:[ 1, 26 - ],51:[ + ],47:[ + 1, + 22 + ],94:[ 1, 27 - ],52:[ + ],157:[ 1, - 28 - ],55:[ + 21 + ],158:[ + 1, + 23 + ],164:[ 1, 31 - ],56:[ + ],165:[ 1, 32 - ],61:[ + ],170:[ 1, 35 - ],63:[ + ],172:[ 1, 33 - ],64:[ + ],173:[ 1, 34 - ],72:[ + ],180:[ 2, 39 ] }), { - 15: 36, - 22: [ + 139: 36, + 146: [ 1, 37 ] }, { - 17: 38, - 22: [ + 141: 38, + 146: [ 1, 39 ] @@ -1222,7 +1223,7 @@ table: [ __expand__($V0, [ 2, 12 - ], {72:[ + ], {180:[ 2, 12 ] @@ -1230,7 +1231,7 @@ table: [ __expand__($V0, [ 2, 13 - ], {72:[ + ], {180:[ 2, 13 ] @@ -1238,7 +1239,7 @@ table: [ __expand__($V0, [ 2, 14 - ], {72:[ + ], {180:[ 2, 14 ] @@ -1246,7 +1247,7 @@ table: [ __expand__($V0, [ 2, 15 - ], {72:[ + ], {180:[ 2, 15 ] @@ -1256,38 +1257,38 @@ table: [ 1, 41 ], - 73: [ + 181: [ 1, 40 ] }, { - 12: [ + 136: [ 1, 44 ], - 66: 42, - 68: 43 + 175: 42, + 177: 43 }, __expand__($V1, [ 2, 32 - ], {7:45,10:48,23:49,24:50,6:[ + ], {131:45,134:48,147:49,148:50,60:[ + 1, + 51 + ],130:[ 1, 47 - ],8:[ + ],132:[ 1, 46 - ],31:[ - 1, - 51 - ],72:[ + ],180:[ 2, 32 ] }), { - 6: [ + 130: [ 2, 7 ] @@ -1295,18 +1296,18 @@ table: [ __expand__($V0, [ 2, 9 - ], {72:[ + ], {180:[ 2, 9 ] }), - __expand__([6,12,14,16,18,21,26,65], [ + __expand__([123,130,136,138,140,142,145,174], [ 2, 35 - ], {37:[ + ], {124:[ 1, 52 - ],72:[ + ],180:[ 2, 35 ] @@ -1314,43 +1315,43 @@ table: [ __expand__($V2, [ 2, 38 - ], {47:24,49:25,53:29,54:30,39:53,40:[ + ], {159:24,161:25,162:29,163:30,156:53,36:[ 1, - 20 - ],42:[ - 1, - 21 - ],45:[ + 28 + ],40:[ 1, - 22 + 20 ],46:[ - 1, - 23 - ],50:[ 1, 26 - ],51:[ + ],47:[ + 1, + 22 + ],94:[ 1, 27 - ],52:[ + ],157:[ 1, - 28 - ],55:[ + 21 + ],158:[ + 1, + 23 + ],164:[ 1, 31 - ],56:[ + ],165:[ 1, 32 - ],61:[ + ],170:[ 1, 35 - ],63:[ + ],172:[ 1, 33 - ],64:[ + ],173:[ 1, 34 - ],72:[ + ],180:[ 2, 38 ] @@ -1358,19 +1359,19 @@ table: [ __expand__($V3, [ 2, 41 - ], {48:57,34:[ + ], {160:57,42:[ 1, 55 ],43:[ 1, 54 - ],44:[ + ],63:[ 1, 56 - ],62:[ + ],171:[ 1, 58 - ],72:[ + ],180:[ 2, 41 ] @@ -1378,40 +1379,40 @@ table: [ __expand__($V4, [ 2, 39 - ], {38:18,39:19,47:24,49:25,53:29,54:30,36:59,40:[ + ], {155:18,156:19,159:24,161:25,162:29,163:30,154:59,36:[ 1, - 20 - ],42:[ - 1, - 21 - ],45:[ + 28 + ],40:[ 1, - 22 + 20 ],46:[ - 1, - 23 - ],50:[ 1, 26 - ],51:[ + ],47:[ + 1, + 22 + ],94:[ 1, 27 - ],52:[ + ],157:[ 1, - 28 - ],55:[ + 21 + ],158:[ + 1, + 23 + ],164:[ 1, 31 - ],56:[ + ],165:[ 1, 32 - ],61:[ + ],170:[ 1, 35 - ],63:[ + ],172:[ 1, 33 - ],64:[ + ],173:[ 1, 34 ] @@ -1419,150 +1420,150 @@ table: [ __expand__($V4, [ 2, 39 - ], {38:18,39:19,47:24,49:25,53:29,54:30,36:60,40:[ + ], {155:18,156:19,159:24,161:25,162:29,163:30,154:60,36:[ 1, - 20 - ],42:[ - 1, - 21 - ],45:[ + 28 + ],40:[ 1, - 22 + 20 ],46:[ - 1, - 23 - ],50:[ 1, 26 - ],51:[ + ],47:[ + 1, + 22 + ],94:[ 1, 27 - ],52:[ + ],157:[ 1, - 28 - ],55:[ + 21 + ],158:[ + 1, + 23 + ],164:[ 1, 31 - ],56:[ + ],165:[ 1, 32 - ],61:[ + ],170:[ 1, 35 - ],63:[ + ],172:[ 1, 33 - ],64:[ + ],173:[ 1, 34 ] }), { - 39: 61, + 36: [ + 1, + 28 + ], 40: [ 1, 20 ], - 42: [ + 46: [ 1, - 21 + 26 ], - 45: [ + 47: [ 1, 22 ], - 46: [ - 1, - 23 - ], - 47: 24, - 49: 25, - 50: [ + 94: [ 1, - 26 + 27 ], - 51: [ + 156: 61, + 157: [ 1, - 27 + 21 ], - 52: [ + 158: [ 1, - 28 + 23 ], - 53: 29, - 54: 30, - 55: [ + 159: 24, + 161: 25, + 162: 29, + 163: 30, + 164: [ 1, 31 ], - 56: [ + 165: [ 1, 32 ], - 61: [ + 170: [ 1, 35 ], - 63: [ + 172: [ 1, 33 ], - 64: [ + 173: [ 1, 34 ] }, { - 39: 62, + 36: [ + 1, + 28 + ], 40: [ 1, 20 ], - 42: [ + 46: [ 1, - 21 + 26 ], - 45: [ + 47: [ 1, 22 ], - 46: [ - 1, - 23 - ], - 47: 24, - 49: 25, - 50: [ + 94: [ 1, - 26 + 27 ], - 51: [ + 156: 62, + 157: [ 1, - 27 + 21 ], - 52: [ + 158: [ 1, - 28 + 23 ], - 53: 29, - 54: 30, - 55: [ + 159: 24, + 161: 25, + 162: 29, + 163: 30, + 164: [ 1, 31 ], - 56: [ + 165: [ 1, 32 ], - 61: [ + 170: [ 1, 35 ], - 63: [ + 172: [ 1, 33 ], - 64: [ + 173: [ 1, 34 ] @@ -1570,7 +1571,7 @@ table: [ __expand__($V5, [ 2, 49 - ], {72:[ + ], {180:[ 2, 49 ] @@ -1578,7 +1579,7 @@ table: [ __expand__($V5, [ 2, 51 - ], {72:[ + ], {180:[ 2, 51 ] @@ -1586,7 +1587,7 @@ table: [ __expand__($V5, [ 2, 52 - ], {72:[ + ], {180:[ 2, 52 ] @@ -1594,7 +1595,7 @@ table: [ __expand__($V5, [ 2, 53 - ], {72:[ + ], {180:[ 2, 53 ] @@ -1602,7 +1603,7 @@ table: [ __expand__($V5, [ 2, 54 - ], {72:[ + ], {180:[ 2, 54 ] @@ -1610,7 +1611,7 @@ table: [ __expand__($V5, [ 2, 55 - ], {72:[ + ], {180:[ 2, 55 ] @@ -1618,28 +1619,28 @@ table: [ __expand__($V5, [ 2, 56 - ], {72:[ + ], {180:[ 2, 56 ] }), - __expand__([6,12,14,16,18,21,26,34,37,40,41,42,43,44,45,46,50,51,52,55,56,58,60,61,62,63,64,65], [ + __expand__([36,40,41,42,43,46,47,63,94,123,124,130,136,138,140,142,145,157,158,164,165,167,169,170,171,172,173,174], [ 2, 57 - ], {72:[ + ], {180:[ 2, 57 ] }), { - 47: 66, - 55: [ + 159: 66, + 164: [ 1, 31 ], - 57: 63, - 59: 64, - 60: [ + 166: 63, + 168: 64, + 169: [ 1, 65 ] @@ -1647,7 +1648,7 @@ table: [ __expand__($V5, [ 2, 65 - ], {72:[ + ], {180:[ 2, 65 ] @@ -1655,7 +1656,7 @@ table: [ __expand__($V5, [ 2, 66 - ], {72:[ + ], {180:[ 2, 66 ] @@ -1663,7 +1664,7 @@ table: [ __expand__($V5, [ 2, 63 - ], {72:[ + ], {180:[ 2, 63 ] @@ -1671,10 +1672,10 @@ table: [ __expand__($V0, [ 2, 10 - ], {22:[ + ], {146:[ 1, 67 - ],72:[ + ],180:[ 2, 10 ] @@ -1682,7 +1683,7 @@ table: [ __expand__($V6, [ 2, 16 - ], {72:[ + ], {180:[ 2, 16 ] @@ -1690,10 +1691,10 @@ table: [ __expand__($V0, [ 2, 11 - ], {22:[ + ], {146:[ 1, 68 - ],72:[ + ],180:[ 2, 11 ] @@ -1701,7 +1702,7 @@ table: [ __expand__($V6, [ 2, 18 - ], {72:[ + ], {180:[ 2, 18 ] @@ -1709,7 +1710,7 @@ table: [ __expand__($V7, [ 2, 75 - ], {75:[ + ], {183:[ 2, 75 ] @@ -1717,37 +1718,43 @@ table: [ __expand__($V7, [ 2, 76 - ], {75:[ + ], {183:[ 2, 76 ] }), { - 67: [ + 176: [ 1, 69 ] }, { - 12: [ + 136: [ 1, 44 ], - 66: 70, - 67: [ + 175: 70, + 176: [ 2, 69 ], - 68: 43 + 177: 43 }, - __expand__([12,67], [ - 2, - 70 - ], {69:[ + { + 61: [ 1, 71 + ], + 136: [ + 2, + 70 + ], + 176: [ + 2, + 70 ] - }), + }, { 1: [ 2, @@ -1763,7 +1770,7 @@ table: [ __expand__($V8, [ 2, 80 - ], {9:72,71:73,74:74,75:[ + ], {133:72,179:73,182:74,183:[ 1, 75 ] @@ -1771,16 +1778,16 @@ table: [ __expand__($V1, [ 2, 32 - ], {24:50,23:78,6:[ + ], {148:50,147:78,60:[ + 1, + 51 + ],130:[ 1, 76 - ],8:[ + ],132:[ 1, 77 - ],31:[ - 1, - 51 - ],72:[ + ],180:[ 2, 32 ] @@ -1788,106 +1795,106 @@ table: [ __expand__($V9, [ 2, 21 - ], {72:[ + ], {180:[ 2, 21 ] }), - __expand__([18,26,37], [ + __expand__([123,124,142], [ 2, 39 - ], {36:17,38:18,39:19,47:24,49:25,53:29,54:30,13:79,40:[ - 1, - 20 - ],42:[ + ], {154:17,155:18,156:19,159:24,161:25,162:29,163:30,137:79,36:[ 1, - 21 - ],45:[ + 28 + ],40:[ 1, - 22 + 20 ],46:[ - 1, - 23 - ],50:[ 1, 26 - ],51:[ + ],47:[ + 1, + 22 + ],94:[ 1, 27 - ],52:[ + ],157:[ 1, - 28 - ],55:[ + 21 + ],158:[ + 1, + 23 + ],164:[ 1, 31 - ],56:[ + ],165:[ 1, 32 - ],61:[ + ],170:[ 1, 35 - ],63:[ + ],172:[ 1, 33 - ],64:[ + ],173:[ 1, 34 - ],72:[ + ],180:[ 2, 39 ] }), { - 12: [ + 42: [ 1, - 82 + 81 ], - 32: 80, - 34: [ + 136: [ 1, - 81 - ] + 82 + ], + 153: 80 }, __expand__($V2, [ 2, 37 - ], {39:19,47:24,49:25,53:29,54:30,38:83,40:[ - 1, - 20 - ],42:[ + ], {156:19,159:24,161:25,162:29,163:30,155:83,36:[ 1, - 21 - ],45:[ + 28 + ],40:[ 1, - 22 + 20 ],46:[ - 1, - 23 - ],50:[ 1, 26 - ],51:[ + ],47:[ + 1, + 22 + ],94:[ 1, 27 - ],52:[ + ],157:[ 1, - 28 - ],55:[ + 21 + ],158:[ + 1, + 23 + ],164:[ 1, 31 - ],56:[ + ],165:[ 1, 32 - ],61:[ + ],170:[ 1, 35 - ],63:[ + ],172:[ 1, 33 - ],64:[ + ],173:[ 1, 34 - ],72:[ + ],180:[ 2, 37 ] @@ -1895,19 +1902,19 @@ table: [ __expand__($V3, [ 2, 40 - ], {48:57,34:[ + ], {160:57,42:[ 1, 55 ],43:[ 1, 54 - ],44:[ + ],63:[ 1, 56 - ],62:[ + ],171:[ 1, 58 - ],72:[ + ],180:[ 2, 40 ] @@ -1915,7 +1922,7 @@ table: [ __expand__($V5, [ 2, 44 - ], {72:[ + ], {180:[ 2, 44 ] @@ -1923,7 +1930,7 @@ table: [ __expand__($V5, [ 2, 45 - ], {72:[ + ], {180:[ 2, 45 ] @@ -1931,7 +1938,7 @@ table: [ __expand__($V5, [ 2, 46 - ], {72:[ + ], {180:[ 2, 46 ] @@ -1939,7 +1946,7 @@ table: [ __expand__($V5, [ 2, 50 - ], {72:[ + ], {180:[ 2, 50 ] @@ -1947,47 +1954,47 @@ table: [ __expand__($V5, [ 2, 64 - ], {72:[ + ], {180:[ 2, 64 ] }), { - 37: [ - 1, - 52 - ], 41: [ 1, 84 + ], + 124: [ + 1, + 52 ] }, { - 37: [ - 1, - 52 - ], 41: [ 1, 85 + ], + 124: [ + 1, + 52 ] }, __expand__($V3, [ 2, 47 - ], {48:57,34:[ + ], {160:57,42:[ 1, 55 ],43:[ 1, 54 - ],44:[ + ],63:[ 1, 56 - ],62:[ + ],171:[ 1, 58 - ],72:[ + ],180:[ 2, 47 ] @@ -1995,42 +2002,42 @@ table: [ __expand__($V3, [ 2, 48 - ], {48:57,34:[ + ], {160:57,42:[ 1, 55 ],43:[ 1, 54 - ],44:[ + ],63:[ 1, 56 - ],62:[ + ],171:[ 1, 58 - ],72:[ + ],180:[ 2, 48 ] }), { - 58: [ + 167: [ 1, 86 ] }, { - 47: 66, - 55: [ + 159: 66, + 164: [ 1, 31 ], - 57: 87, - 58: [ + 166: 87, + 167: [ 2, 60 ], - 59: 64, - 60: [ + 168: 64, + 169: [ 1, 65 ] @@ -2038,7 +2045,7 @@ table: [ __expand__($Va, [ 2, 61 - ], {60:[ + ], {169:[ 2, 61 ] @@ -2046,7 +2053,7 @@ table: [ __expand__($Va, [ 2, 62 - ], {60:[ + ], {169:[ 2, 62 ] @@ -2054,7 +2061,7 @@ table: [ __expand__($V6, [ 2, 17 - ], {72:[ + ], {180:[ 2, 17 ] @@ -2062,7 +2069,7 @@ table: [ __expand__($V6, [ 2, 19 - ], {72:[ + ], {180:[ 2, 19 ] @@ -2070,40 +2077,40 @@ table: [ __expand__($V0, [ 2, 67 - ], {72:[ + ], {180:[ 2, 67 ] }), { - 67: [ + 176: [ 2, 68 ] }, { - 12: [ + 136: [ 1, 89 ], - 70: [ + 178: [ 1, 88 ] }, { - 8: [ + 132: [ 1, 90 ] }, { - 8: [ + 132: [ 2, 73 ], - 19: 91, - 72: [ + 143: 91, + 180: [ 1, 12 ] @@ -2111,7 +2118,7 @@ table: [ __expand__($V8, [ 2, 79 - ], {75:[ + ], {183:[ 1, 92 ] @@ -2119,7 +2126,7 @@ table: [ __expand__($V8, [ 2, 77 - ], {75:[ + ], {183:[ 2, 77 ] @@ -2127,7 +2134,7 @@ table: [ __expand__($V8, [ 2, 80 - ], {71:73,74:74,9:93,75:[ + ], {179:73,182:74,133:93,183:[ 1, 75 ] @@ -2141,49 +2148,49 @@ table: [ __expand__($V9, [ 2, 20 - ], {72:[ + ], {180:[ 2, 20 ] }), { - 18: [ + 123: [ 1, - 96 + 95 ], - 19: 97, - 25: 94, - 26: [ + 142: [ 1, - 95 + 96 ], - 72: [ + 143: 97, + 149: 94, + 180: [ 1, 12 ] }, { - 33: [ + 44: [ 1, - 98 + 99 ], - 35: [ + 62: [ 1, - 99 + 98 ] }, { - 33: [ + 62: [ 1, 100 ] }, { - 33: [ + 44: [ 2, 33 ], - 35: [ + 62: [ 2, 33 ] @@ -2191,43 +2198,43 @@ table: [ __expand__($V2, [ 2, 36 - ], {47:24,49:25,53:29,54:30,39:53,40:[ - 1, - 20 - ],42:[ + ], {159:24,161:25,162:29,163:30,156:53,36:[ 1, - 21 - ],45:[ + 28 + ],40:[ 1, - 22 + 20 ],46:[ - 1, - 23 - ],50:[ 1, 26 - ],51:[ + ],47:[ + 1, + 22 + ],94:[ 1, 27 - ],52:[ + ],157:[ 1, - 28 - ],55:[ + 21 + ],158:[ + 1, + 23 + ],164:[ 1, 31 - ],56:[ + ],165:[ 1, 32 - ],61:[ + ],170:[ 1, 35 - ],63:[ + ],172:[ 1, 33 - ],64:[ + ],173:[ 1, 34 - ],72:[ + ],180:[ 2, 36 ] @@ -2235,7 +2242,7 @@ table: [ __expand__($V5, [ 2, 42 - ], {72:[ + ], {180:[ 2, 42 ] @@ -2243,7 +2250,7 @@ table: [ __expand__($V5, [ 2, 43 - ], {72:[ + ], {180:[ 2, 43 ] @@ -2251,33 +2258,33 @@ table: [ __expand__($V5, [ 2, 58 - ], {72:[ + ], {180:[ 2, 58 ] }), { - 58: [ + 167: [ 2, 59 ] }, { - 12: [ + 136: [ 2, 71 ], - 67: [ + 176: [ 2, 71 ] }, { - 12: [ + 136: [ 2, 72 ], - 67: [ + 176: [ 2, 72 ] @@ -2291,7 +2298,7 @@ table: [ __expand__($V8, [ 2, 80 - ], {71:73,74:74,9:101,75:[ + ], {179:73,182:74,133:101,183:[ 1, 75 ] @@ -2299,13 +2306,13 @@ table: [ __expand__($V8, [ 2, 78 - ], {75:[ + ], {183:[ 2, 78 ] }), { - 8: [ + 132: [ 1, 102 ] @@ -2313,7 +2320,7 @@ table: [ __expand__($V9, [ 2, 22 - ], {72:[ + ], {180:[ 2, 22 ] @@ -2321,7 +2328,7 @@ table: [ __expand__($Vb, [ 2, 28 - ], {27:103,29:104,30:[ + ], {150:103,151:104,152:[ 2, 28 ] @@ -2329,7 +2336,7 @@ table: [ __expand__($V9, [ 2, 24 - ], {72:[ + ], {180:[ 2, 24 ] @@ -2337,7 +2344,7 @@ table: [ __expand__($V9, [ 2, 25 - ], {72:[ + ], {180:[ 2, 25 ] @@ -2345,13 +2352,13 @@ table: [ __expand__($V1, [ 2, 30 - ], {72:[ + ], {180:[ 2, 30 ] }), { - 12: [ + 136: [ 1, 105 ] @@ -2359,13 +2366,13 @@ table: [ __expand__($V1, [ 2, 31 - ], {72:[ + ], {180:[ 2, 31 ] }), { - 8: [ + 132: [ 2, 74 ] @@ -2377,11 +2384,11 @@ table: [ ] }, { - 26: [ + 123: [ 1, 107 ], - 28: [ + 125: [ 1, 106 ] @@ -2389,17 +2396,17 @@ table: [ __expand__($Vb, [ 2, 26 - ], {30:[ + ], {152:[ 1, 108 ] }), { - 33: [ + 44: [ 2, 34 ], - 35: [ + 62: [ 2, 34 ] @@ -2407,7 +2414,7 @@ table: [ __expand__($V9, [ 2, 23 - ], {72:[ + ], {180:[ 2, 23 ] @@ -2415,7 +2422,7 @@ table: [ __expand__($Vb, [ 2, 28 - ], {29:104,27:109,30:[ + ], {151:104,150:109,152:[ 2, 28 ] @@ -2423,17 +2430,17 @@ table: [ __expand__($Vb, [ 2, 29 - ], {30:[ + ], {152:[ 2, 29 ] }), { - 26: [ + 123: [ 1, 107 ], - 28: [ + 125: [ 1, 110 ] @@ -2441,7 +2448,7 @@ table: [ __expand__($Vb, [ 2, 28 - ], {29:111,30:[ + ], {151:111,152:[ 2, 28 ] @@ -2449,7 +2456,7 @@ table: [ __expand__($Vb, [ 2, 27 - ], {30:[ + ], {152:[ 1, 108 ] @@ -2700,7 +2707,7 @@ parse: function parse(input) { retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { text: lexer.match, token: this.terminals_[symbol] || symbol, - token_id, + token_id: symbol, line: lexer.yylineno, loc: yyloc, expected: expected, @@ -2839,7 +2846,7 @@ function prepareString (s) { }; -/* generated by jison-lex 0.3.4-108 */ +/* generated by jison-lex 0.3.4-112 */ var lexer = (function () { // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript @@ -3259,22 +3266,22 @@ switch($avoiding_name_collisions) { case 2 : /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 30; // regexp with braces or quotes (and no spaces) + return 152; // regexp with braces or quotes (and no spaces) break; case 7 : /*! Conditions:: action */ /*! Rule:: \{ */ - yy.depth++; return 26; + yy.depth++; return 123; break; case 8 : /*! Conditions:: action */ /*! Rule:: \} */ - if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 28; + if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 125; break; case 10 : /*! Conditions:: conditions */ /*! Rule:: > */ - this.popState(); return 33; + this.popState(); return 62; break; case 13 : /*! Conditions:: rules */ @@ -3294,7 +3301,7 @@ break; case 16 : /*! Conditions:: rules */ /*! Rule:: %% */ - this.begin('code'); return 6; + this.begin('code'); return 130; break; case 17 : /*! Conditions:: rules */ @@ -3302,28 +3309,28 @@ case 17 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 64; + return 173; break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 70; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 178; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 70; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 178; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 67; + this.popState(); return 176; break; case 24 : /*! Conditions:: options */ /*! Rule:: \s+{BR}+ */ - this.popState(); return 67; + this.popState(); return 176; break; case 25 : /*! Conditions:: options */ @@ -3353,17 +3360,17 @@ break; case 31 : /*! Conditions:: indented */ /*! Rule:: \{ */ - yy.depth = 0; this.begin('action'); return 26; + yy.depth = 0; this.begin('action'); return 123; break; case 32 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; break; case 33 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; break; case 34 : /*! Conditions:: indented */ @@ -3385,13 +3392,13 @@ case 34 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 72; + return 180; break; case 35 : /*! Conditions:: indented */ /*! Rule:: .+ */ - this.begin('rules'); return 18; + this.begin('rules'); return 142; break; case 36 : /*! Conditions:: indented trail rules INITIAL */ @@ -3416,57 +3423,57 @@ break; case 41 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 63; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 172; break; case 42 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 63; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 172; break; case 43 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \[ */ - this.pushState('set'); return 56; + this.pushState('set'); return 165; break; case 56 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: < */ - this.begin('conditions'); return 31; + this.begin('conditions'); return 60; break; case 57 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/! */ - return 46; // treated as `(?!atom)` + return 158; // treated as `(?!atom)` break; case 58 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \/ */ - return 45; // treated as `(?=atom)` + return 47; // treated as `(?=atom)` break; case 60 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 61; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 170; break; case 63 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 65; + this.begin('options'); return 174; break; case 64 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %s\b */ - this.begin('start_condition'); return 14; + this.begin('start_condition'); return 138; break; case 65 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %x\b */ - this.begin('start_condition'); return 16; + this.begin('start_condition'); return 140; break; case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 72; + this.pushState('path'); return 180; break; case 67 : /*! Conditions:: INITIAL rules trail code */ @@ -3474,13 +3481,13 @@ case 67 : /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - return 21; + return 145; break; case 68 : /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: %% */ - this.begin('rules'); return 6; + this.begin('rules'); return 130; break; case 74 : /*! Conditions:: indented trail rules INITIAL */ @@ -3490,12 +3497,12 @@ break; case 78 : /*! Conditions:: set */ /*! Rule:: \] */ - this.popState('set'); return 58; + this.popState('set'); return 167; break; case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 75; // the bit of CODE just before EOF... + return 183; // the bit of CODE just before EOF... break; case 81 : /*! Conditions:: path */ @@ -3505,12 +3512,12 @@ break; case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 73; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 181; break; case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 73; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 181; break; case 84 : /*! Conditions:: path */ @@ -3520,7 +3527,7 @@ break; case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 73; + this.popState(); return 181; break; case 86 : /*! Conditions:: * */ @@ -3538,58 +3545,58 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 30, + 0 : 152, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 30, + 1 : 152, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 30, + 3 : 152, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 30, + 4 : 152, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 30, + 5 : 152, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 30, + 6 : 152, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 9 : 12, + 9 : 136, /*! Conditions:: conditions */ /*! Rule:: , */ - 11 : 35, + 11 : 44, /*! Conditions:: conditions */ /*! Rule:: \* */ - 12 : 34, + 12 : 42, /*! Conditions:: options */ /*! Rule:: {NAME} */ - 18 : 12, + 18 : 136, /*! Conditions:: options */ /*! Rule:: = */ - 19 : 69, + 19 : 61, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 70, + 22 : 178, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 26 : 22, + 26 : 146, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: {ID} */ - 40 : 12, + 40 : 136, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \| */ - 44 : 37, + 44 : 124, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?: */ - 45 : 42, + 45 : 157, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?= */ - 46 : 42, + 46 : 157, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \(\?! */ - 47 : 42, + 47 : 157, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \( */ 48 : 40, @@ -3601,55 +3608,55 @@ simpleCaseActionClusters: { 50 : 43, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \* */ - 51 : 34, + 51 : 42, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \? */ - 52 : 44, + 52 : 63, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \^ */ - 53 : 51, + 53 : 94, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: , */ - 54 : 35, + 54 : 44, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: <> */ - 55 : 52, + 55 : 36, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 61, + 59 : 170, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \$ */ - 61 : 52, + 61 : 36, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \. */ - 62 : 50, + 62 : 46, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 62, + 69 : 171, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 55, + 70 : 164, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 55, + 71 : 164, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \{ */ - 72 : 26, + 72 : 123, /*! Conditions:: indented trail rules INITIAL */ /*! Rule:: \} */ - 73 : 28, + 73 : 125, /*! Conditions:: * */ /*! Rule:: $ */ - 75 : 8, + 75 : 132, /*! Conditions:: set */ /*! Rule:: (\\\\|\\\]|[^\]{])+ */ - 76 : 60, + 76 : 169, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 60, + 77 : 169, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 75 + 79 : 183 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, From 4761cf1c2d9cbd9d1495566583545d04292a0fba Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Nov 2015 03:04:17 +0100 Subject: [PATCH 113/417] 0.1.4-113 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5bdbabc..8eeb881 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-112", + "version": "0.1.4-113", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 7da759ea89b27a4eefcdd9353c379368e65d1e30 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Nov 2015 17:48:48 +0100 Subject: [PATCH 114/417] rebuild --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index a9cfc34..6a5e0f7 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.15-112 */ +/* parser generated by jison 0.4.15-113 */ /* * Returns a Parser object of the following structure: * From aaa6d4d01035ff91a4497242e9d69833125b2458 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 15 Feb 2016 02:17:21 +0100 Subject: [PATCH 115/417] - introducing the `%option xregexp` feature which allows us to use advanced XRegExp regular expression constructs in the lexer, e.g. Unicode slugs like `\p{Alphabetical}` to represent the huge set of Unicode alphanumerical characters. - bump build number to 114. - lex.y: fix regex escape to ensure all platforms output the same safe regex code. - lex.y: no need to test if `yy.options` exists in some rule action as the `init` rule action code ensures it'll always be present! --- lex-parser.js | 20 +++++++++++++++++--- lex.y | 24 +++++++++++++++++++++--- package.json | 5 ++++- 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 6a5e0f7..e76aaa3 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -972,7 +972,7 @@ case 35 : /*! Production:: regex : regex_list */ this.$ = $$[$0]; - if (yy.options && yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { + if (yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { this.$ += "\\b"; } @@ -1033,7 +1033,19 @@ case 58 : break; case 62 : /*! Production:: regex_set_atom : name_expansion */ - this.$ = '{[' + $$[$0] + ']}'; + + console.log('LEXED NAME: ', { + name: $$[$0].replace(/[{}]/g, ''), + is_unicode_slug: XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')), + upcheck: $$[$0].toUpperCase() !== $$[$0] + }); + if ((yy.options.xregexp || 1) && XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { + // treat this as part of an XRegExp `\p{...}` Unicode slug: + this.$ = $$[$0]; + } else { + this.$ = '{[' + $$[$0] + ']}'; + } + break; case 65 : /*! Production:: string : STRING_LIT */ @@ -2834,8 +2846,10 @@ parse: function parse(input) { }; +var XRegExp = require('xregexp'); + function encodeRE (s) { - return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); + return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); } function prepareString (s) { diff --git a/lex.y b/lex.y index a3e7865..e186f8a 100644 --- a/lex.y +++ b/lex.y @@ -60,6 +60,10 @@ init : { yy.actionInclude = ''; + console.log('yy/options: ', { + yyoptions: yy.options, + lexeroptions: yy.lexer && yy.lexer.options + }); if (!yy.options) yy.options = {}; } ; @@ -172,7 +176,7 @@ regex : regex_list { $$ = $regex_list; - if (yy.options && yy.options.easy_keyword_rules && $$.match(/[\w\d]$/) && !$$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { + if (yy.options.easy_keyword_rules && $$.match(/[\w\d]$/) && !$$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { $$ += "\\b"; } } @@ -241,7 +245,19 @@ regex_set regex_set_atom : REGEX_SET | name_expansion - { $$ = '{[' + $name_expansion + ']}'; } + { + console.log('LEXED NAME: ', { + name: $name_expansion.replace(/[{}]/g, ''), + is_unicode_slug: XRegExp.isUnicodeSlug($name_expansion.replace(/[{}]/g, '')), + upcheck: $name_expansion.toUpperCase() !== $name_expansion + }); + if ((yy.options.xregexp || 1) && XRegExp.isUnicodeSlug($name_expansion.replace(/[{}]/g, '')) && $name_expansion.toUpperCase() !== $name_expansion) { + // treat this as part of an XRegExp `\p{...}` Unicode slug: + $$ = $name_expansion; + } else { + $$ = '{[' + $name_expansion + ']}'; + } + } ; escape_char @@ -315,8 +331,10 @@ optional_module_code_chunk %% +var XRegExp = require('xregexp'); + function encodeRE (s) { - return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); + return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); } function prepareString (s) { diff --git a/package.json b/package.json index 8eeb881..8db34e7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-113", + "version": "0.1.4-114", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { @@ -22,6 +22,9 @@ "jison" ], "license": "MIT", + "dependencies": { + "xregexp": "GerHobbelt/xregexp#master" + }, "devDependencies": { "jison": "GerHobbelt/jison#master", "test": ">=0.6.0" From c46b6879c16c74b630087bac7e43618af05e0bf7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 15 Feb 2016 02:32:36 +0100 Subject: [PATCH 116/417] clean out debugging code --- lex-parser.js | 8 +------- lex.y | 11 +---------- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index e76aaa3..b842874 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1033,13 +1033,7 @@ case 58 : break; case 62 : /*! Production:: regex_set_atom : name_expansion */ - - console.log('LEXED NAME: ', { - name: $$[$0].replace(/[{}]/g, ''), - is_unicode_slug: XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')), - upcheck: $$[$0].toUpperCase() !== $$[$0] - }); - if ((yy.options.xregexp || 1) && XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { + if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { // treat this as part of an XRegExp `\p{...}` Unicode slug: this.$ = $$[$0]; } else { diff --git a/lex.y b/lex.y index e186f8a..96736a4 100644 --- a/lex.y +++ b/lex.y @@ -60,10 +60,6 @@ init : { yy.actionInclude = ''; - console.log('yy/options: ', { - yyoptions: yy.options, - lexeroptions: yy.lexer && yy.lexer.options - }); if (!yy.options) yy.options = {}; } ; @@ -246,12 +242,7 @@ regex_set_atom : REGEX_SET | name_expansion { - console.log('LEXED NAME: ', { - name: $name_expansion.replace(/[{}]/g, ''), - is_unicode_slug: XRegExp.isUnicodeSlug($name_expansion.replace(/[{}]/g, '')), - upcheck: $name_expansion.toUpperCase() !== $name_expansion - }); - if ((yy.options.xregexp || 1) && XRegExp.isUnicodeSlug($name_expansion.replace(/[{}]/g, '')) && $name_expansion.toUpperCase() !== $name_expansion) { + if (XRegExp.isUnicodeSlug($name_expansion.replace(/[{}]/g, '')) && $name_expansion.toUpperCase() !== $name_expansion) { // treat this as part of an XRegExp `\p{...}` Unicode slug: $$ = $name_expansion; } else { From 44dfa057caace18ed2a25c7331329f489e50ea78 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 15 Feb 2016 03:51:40 +0100 Subject: [PATCH 117/417] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8db34e7..6901fd3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-114", + "version": "0.1.4-115", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 3cc53a337023b4e8a9c2592a9c299d6fc90ed9c2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 15 Feb 2016 04:32:22 +0100 Subject: [PATCH 118/417] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6901fd3..63bdef0 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-115", + "version": "0.1.4-116", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 80b237ff37f6fec3b158131c6fe071916b296723 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 17 Feb 2016 00:55:33 +0100 Subject: [PATCH 119/417] use array to collect actionInclude chunks and separate chunks by double newline to make them a little more obvious in the generated output. --- lex-parser.js | 14 ++++++++++---- lex.y | 15 ++++++++++----- 2 files changed, 20 insertions(+), 9 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index b842874..bfa6813 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -791,7 +791,13 @@ case 1 : this.$.options = yy.options; break; } - if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; + if (yy.actionInclude) { + var asrc = yy.actionInclude.join('\n\n'); + // Only a non-empty action code chunk should actually make it through: + if (asrc.trim() !== '') { + this.$.actionInclude = asrc; + } + } delete yy.options; delete yy.actionInclude; return this.$; @@ -832,7 +838,7 @@ break; case 6 : /*! Production:: init : */ - yy.actionInclude = ''; + yy.actionInclude = []; if (!yy.options) yy.options = {}; break; @@ -890,7 +896,7 @@ case 12 : /*! Production:: definition : ACTION */ case 13 : /*! Production:: definition : include_macro_code */ - yy.actionInclude += $$[$0]; this.$ = null; + yy.actionInclude.push($$[$0]); this.$ = null; break; case 14 : /*! Production:: definition : options */ @@ -1033,6 +1039,7 @@ case 58 : break; case 62 : /*! Production:: regex_set_atom : name_expansion */ + if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { // treat this as part of an XRegExp `\p{...}` Unicode slug: this.$ = $$[$0]; @@ -2853,7 +2860,6 @@ function prepareString (s) { return s; }; - /* generated by jison-lex 0.3.4-112 */ var lexer = (function () { // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript diff --git a/lex.y b/lex.y index 96736a4..c6bbcb8 100644 --- a/lex.y +++ b/lex.y @@ -21,7 +21,13 @@ lex $$.options = yy.options; break; } - if (yy.actionInclude) $$.actionInclude = yy.actionInclude; + if (yy.actionInclude) { + var asrc = yy.actionInclude.join('\n\n'); + // Only a non-empty action code chunk should actually make it through: + if (asrc.trim() !== '') { + $$.actionInclude = asrc; + } + } delete yy.options; delete yy.actionInclude; return $$; @@ -59,7 +65,7 @@ rules_and_epilogue init : { - yy.actionInclude = ''; + yy.actionInclude = []; if (!yy.options) yy.options = {}; } ; @@ -95,9 +101,9 @@ definition | START_EXC names_exclusive { $$ = $names_exclusive; } | ACTION - { yy.actionInclude += $ACTION; $$ = null; } + { yy.actionInclude.push($ACTION); $$ = null; } | include_macro_code - { yy.actionInclude += $include_macro_code; $$ = null; } + { yy.actionInclude.push($include_macro_code); $$ = null; } | options { $$ = null; } | UNKNOWN_DECL @@ -334,4 +340,3 @@ function prepareString (s) { s = encodeRE(s); return s; }; - From 59e39a5499a7bbd832fee3f15e7538978e9d0c69 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 17 Feb 2016 15:34:37 +0100 Subject: [PATCH 120/417] add test to make sure camelCasing of options does NOT happen early, i.e. does NOT happen at any stage between parsing JISON grammar and producing (intermediate) JSON format (which is used in these tests). --- tests/all-tests.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/all-tests.js b/tests/all-tests.js index 96792dc..a4a8a78 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -24,7 +24,10 @@ function lexer_reset() { exports["test lex grammar with macros"] = function () { var lexgrammar = 'D [0-9]\nID [a-zA-Z_][a-zA-Z0-9_]+\n%%\n\n{D}"ohhai" {print(9);}\n"{" return \'{\';'; var expected = { - macros: {"D": "[0-9]", "ID": "[a-zA-Z_][a-zA-Z0-9_]+"}, + macros: { + "D": "[0-9]", + "ID": "[a-zA-Z_][a-zA-Z0-9_]+" + }, rules: [ ["{D}ohhai", "print(9);"], ["\\{", "return '{';"] @@ -380,7 +383,7 @@ exports["test if %options names with a hyphen are correctly recognized"] = funct }; exports["test options with values"] = function () { - var lexgrammar = '%options ping=666 bla=blub bool1 s1="s1value" s2=\'s2value\'\n%%\n"foo" return 1;'; + var lexgrammar = '%options ping=666 bla=blub bool1 s1="s1value" s2=\'s2value\' a-b-c="d"\n%%\n"foo" return 1;'; var expected = { rules: [ ["foo", "return 1;"] @@ -390,7 +393,8 @@ exports["test options with values"] = function () { bla: "blub", bool1: true, s1: "s1value", - s2: "s2value" + s2: "s2value", + "a-b-c": "d" // %option camel-casing is done very late in the game: see Jison.Generator source code. } }; From c67edf65f95bf58c61481758693bde086c5f802a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 5 Mar 2016 18:57:40 +0100 Subject: [PATCH 121/417] - add support for direct literals in lexer macros, next to the existing support in lexer *rules*, e.g. IDOCTAL (0[0-9]+) Note the first '0' in there doesn't have to be quoted any more! - sync the lexer rules way of coding with ebnf-parser: this includes a whitespace parse fix --- lex.l | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/lex.l b/lex.l index 0e77216..7987c34 100644 --- a/lex.l +++ b/lex.l @@ -2,8 +2,12 @@ NAME [a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])? ID [a-zA-Z_][a-zA-Z0-9_]* BR \r\n|\n|\r +// WhiteSpace MUST NOT match CR/LF and the regex `\s` DOES, so we cannot use that one directly. +// Instead we define the {WS} macro here: +WS [^\S\r\n] -%s indented trail rules + +%s indented trail rules macro %x code start_condition options conditions action path set %options easy_keyword_rules @@ -27,10 +31,10 @@ BR \r\n|\n|\r "*" return '*'; {BR}+ /* empty */ -\s+{BR}+ /* empty */ +{WS}+{BR}+ /* empty */ \s+ this.begin('indented'); "%%" this.begin('code'); return '%%'; -[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ +[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ %{ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is @@ -42,15 +46,13 @@ BR \r\n|\n|\r "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; [^\s\r\n]+ return 'OPTION_VALUE'; {BR}+ this.popState(); return 'OPTIONS_END'; -\s+{BR}+ this.popState(); return 'OPTIONS_END'; -\s+ /* empty */ +{WS}+ /* skip whitespace */ {ID} return 'START_COND'; {BR}+ this.popState(); -\s+{BR}+ this.popState(); -\s+ /* empty */ +{WS}+ /* empty */ -\s*{BR}+ this.begin('rules'); +{WS}*{BR}+ this.begin('rules'); "{" yy.depth = 0; this.begin('action'); return '{'; "%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; @@ -79,9 +81,20 @@ BR \r\n|\n|\r "/*"(.|\n|\r)*?"*/" /* ignore */ "//".* /* ignore */ +{ID} this.pushState('macro'); return 'NAME'; +{BR}+ this.popState('macro'); + +// Accept any non-regex-special character as a direct literal without the need to put quotes around it: +[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ + %{ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 'CHARACTER_LIT'; + %} + {BR}+ /* empty */ \s+ /* empty */ -{ID} return 'NAME'; + \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; "[" this.pushState('set'); return 'REGEX_SET_START'; @@ -121,7 +134,9 @@ BR \r\n|\n|\r "{"{ID}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; + . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ + <*><> return 'EOF'; @@ -136,10 +151,10 @@ BR \r\n|\n|\r [^\r\n]+ return 'CODE'; // the bit of CODE just before EOF... -[\r\n] this.popState(); this.unput(yytext); +{BR} this.popState(); this.unput(yytext); "'"[^\r\n]+"'" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; '"'[^\r\n]+'"' yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; -\s+ // skip whitespace in the line +{WS}+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; <*>. %{ From 0d9764da3f1aeded4b2bfa16ec8f5726134fc152 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 5 Mar 2016 18:57:58 +0100 Subject: [PATCH 122/417] regenerated parser --- lex-parser.js | 238 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 142 insertions(+), 96 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index bfa6813..8dc2f42 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3304,7 +3304,7 @@ case 13 : break; case 14 : /*! Conditions:: rules */ -/*! Rule:: \s+{BR}+ */ +/*! Rule:: {WS}+{BR}+ */ /* empty */ break; case 15 : @@ -3319,7 +3319,7 @@ case 16 : break; case 17 : /*! Conditions:: rules */ -/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ */ +/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ */ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is @@ -3343,50 +3343,40 @@ case 23 : break; case 24 : /*! Conditions:: options */ -/*! Rule:: \s+{BR}+ */ - this.popState(); return 176; -break; -case 25 : -/*! Conditions:: options */ -/*! Rule:: \s+ */ - /* empty */ +/*! Rule:: {WS}+ */ + /* skip whitespace */ break; -case 27 : +case 26 : /*! Conditions:: start_condition */ /*! Rule:: {BR}+ */ this.popState(); break; -case 28 : -/*! Conditions:: start_condition */ -/*! Rule:: \s+{BR}+ */ - this.popState(); -break; -case 29 : +case 27 : /*! Conditions:: start_condition */ -/*! Rule:: \s+ */ +/*! Rule:: {WS}+ */ /* empty */ break; -case 30 : +case 28 : /*! Conditions:: trail */ -/*! Rule:: \s*{BR}+ */ +/*! Rule:: {WS}*{BR}+ */ this.begin('rules'); break; -case 31 : +case 29 : /*! Conditions:: indented */ /*! Rule:: \{ */ yy.depth = 0; this.begin('action'); return 123; break; -case 32 : +case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; break; -case 33 : -/*! Conditions:: indented trail rules INITIAL */ +case 31 : +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; break; -case 34 : +case 32 : /*! Conditions:: indented */ /*! Rule:: %include\b */ @@ -3409,78 +3399,97 @@ case 34 : return 180; break; -case 35 : +case 33 : /*! Conditions:: indented */ /*! Rule:: .+ */ this.begin('rules'); return 142; break; -case 36 : -/*! Conditions:: indented trail rules INITIAL */ +case 34 : +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ /* ignore */ break; -case 37 : -/*! Conditions:: indented trail rules INITIAL */ +case 35 : +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/\/.* */ /* ignore */ break; +case 36 : +/*! Conditions:: INITIAL */ +/*! Rule:: {ID} */ + this.pushState('macro'); return 136; +break; +case 37 : +/*! Conditions:: macro */ +/*! Rule:: {BR}+ */ + this.popState('macro'); +break; case 38 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: macro */ +/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ */ + + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 173; + +break; +case 39 : +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: {BR}+ */ /* empty */ break; -case 39 : -/*! Conditions:: indented trail rules INITIAL */ +case 40 : +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \s+ */ /* empty */ break; case 41 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 172; break; case 42 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 172; break; case 43 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ this.pushState('set'); return 165; break; case 56 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: < */ this.begin('conditions'); return 60; break; case 57 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ return 158; // treated as `(?!atom)` break; case 58 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/ */ return 47; // treated as `(?=atom)` break; case 60 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 170; break; case 63 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ this.begin('options'); return 174; break; case 64 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %s\b */ this.begin('start_condition'); return 138; break; case 65 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %x\b */ this.begin('start_condition'); return 140; break; @@ -3499,12 +3508,12 @@ case 67 : break; case 68 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %% */ this.begin('rules'); return 130; break; case 74 : -/*! Conditions:: indented trail rules INITIAL */ +/*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: . */ throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ break; @@ -3520,7 +3529,7 @@ case 80 : break; case 81 : /*! Conditions:: path */ -/*! Rule:: [\r\n] */ +/*! Rule:: {BR} */ this.popState(); this.unput(yy_.yytext); break; case 82 : @@ -3535,7 +3544,7 @@ case 83 : break; case 84 : /*! Conditions:: path */ -/*! Rule:: \s+ */ +/*! Rule:: {WS}+ */ // skip whitespace in the line break; case 85 : @@ -3595,68 +3604,65 @@ simpleCaseActionClusters: { 22 : 178, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 26 : 146, - /*! Conditions:: indented trail rules INITIAL */ - /*! Rule:: {ID} */ - 40 : 136, - /*! Conditions:: indented trail rules INITIAL */ + 25 : 146, + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \| */ 44 : 124, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ 45 : 157, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ 46 : 157, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ 47 : 157, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ 48 : 40, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \) */ 49 : 41, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \+ */ 50 : 43, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \* */ 51 : 42, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \? */ 52 : 63, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \^ */ 53 : 94, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: , */ 54 : 44, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: <> */ 55 : 36, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ 59 : 170, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ 61 : 36, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \. */ 62 : 46, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ 69 : 171, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ 70 : 164, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ 71 : 164, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ 72 : 123, - /*! Conditions:: indented trail rules INITIAL */ + /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \} */ 73 : 125, /*! Conditions:: * */ @@ -3687,23 +3693,21 @@ rules: [ /^(?:,)/, /^(?:\*)/, /^(?:(\r\n|\n|\r)+)/, -/^(?:\s+(\r\n|\n|\r)+)/, +/^(?:([^\S\r\n])+(\r\n|\n|\r)+)/, /^(?:\s+)/, /^(?:%%)/, -/^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+)/, +/^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+)/, /^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, /^(?:=)/, /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, /^(?:[^\s\r\n]+)/, /^(?:(\r\n|\n|\r)+)/, -/^(?:\s+(\r\n|\n|\r)+)/, -/^(?:\s+)/, +/^(?:([^\S\r\n])+)/, /^(?:([a-zA-Z_][a-zA-Z0-9_]*))/, /^(?:(\r\n|\n|\r)+)/, -/^(?:\s+(\r\n|\n|\r)+)/, -/^(?:\s+)/, -/^(?:\s*(\r\n|\n|\r)+)/, +/^(?:([^\S\r\n])+)/, +/^(?:([^\S\r\n])*(\r\n|\n|\r)+)/, /^(?:\{)/, /^(?:%\{(.|(\r\n|\n|\r))*?%\})/, /^(?:%\{(.|(\r\n|\n|\r))*?%\})/, @@ -3711,9 +3715,11 @@ rules: [ /^(?:.+)/, /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/.*)/, +/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+)/, /^(?:(\r\n|\n|\r)+)/, /^(?:\s+)/, -/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/, /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, /^(?:\[)/, @@ -3754,10 +3760,10 @@ rules: [ /^(?:\])/, /^(?:[^\r\n]*(\r|\n)+)/, /^(?:[^\r\n]+)/, -/^(?:[\r\n])/, +/^(?:(\r\n|\n|\r))/, /^(?:'[^\r\n]+')/, /^(?:"[^\r\n]+")/, -/^(?:\s+)/, +/^(?:([^\S\r\n])+)/, /^(?:[^\s\r\n]+)/, /^(?:.)/ ], @@ -3775,10 +3781,9 @@ conditions: { }, "start_condition": { rules: [ + 25, 26, 27, - 28, - 29, 75, 86 ], @@ -3793,7 +3798,6 @@ conditions: { 22, 23, 24, - 25, 71, 75, 86 @@ -3852,14 +3856,13 @@ conditions: { }, "indented": { rules: [ + 29, + 30, 31, 32, 33, 34, 35, - 36, - 37, - 38, 39, 40, 41, @@ -3900,11 +3903,10 @@ conditions: { }, "trail": { rules: [ - 30, - 33, - 36, - 37, - 38, + 28, + 31, + 34, + 35, 39, 40, 41, @@ -3952,8 +3954,53 @@ conditions: { 15, 16, 17, - 33, - 36, + 31, + 34, + 35, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 67, + 68, + 69, + 70, + 72, + 73, + 74, + 75, + 86 + ], + inclusive: true + }, + "macro": { + rules: [ + 31, + 34, + 35, 37, 38, 39, @@ -3983,7 +4030,6 @@ conditions: { 63, 64, 65, - 67, 68, 69, 70, @@ -3997,10 +4043,10 @@ conditions: { }, "INITIAL": { rules: [ - 33, + 31, + 34, + 35, 36, - 37, - 38, 39, 40, 41, From 711afe02172e7e49a54b5aed675d8945ce72d164 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 6 Mar 2016 23:25:27 +0100 Subject: [PATCH 123/417] `make bump`: new release = new build number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 63bdef0..05ec472 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-116", + "version": "0.1.4-117", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 33c331fa2c5133e831501c0f466a100ad0a88276 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 7 Mar 2016 04:46:02 +0100 Subject: [PATCH 124/417] bump version number: new feature is now working: table compression mode 2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 05ec472..e135341 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-117", + "version": "0.1.4-118", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 4bd9354a67831cc5e293c560a5b18544b1ae5d12 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 13 Mar 2016 21:30:18 +0100 Subject: [PATCH 125/417] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e135341..0ed3639 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-118", + "version": "0.1.4-119", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From d24f32ad93cc8a7f8ada6554929a1c52d3d84e90 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 22 Mar 2016 14:52:28 +0100 Subject: [PATCH 126/417] - `ncu -a` = updated all NPM packages in `package.json` for both jison and all submodules - rebuild after version bump --- lex-parser.js | 3485 ++++++++++++++++++++++--------------------------- package.json | 2 +- 2 files changed, 1576 insertions(+), 1911 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8dc2f42..e7033c1 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.15-113 */ +/* parser generated by jison 0.4.17-119 */ /* * Returns a Parser object of the following structure: * @@ -8,16 +8,54 @@ * * Parser.prototype: { * yy: {}, + * EOF: 1, + * TERROR: 2, + * * trace: function(errorMessage, errorHash), + * * JisonParserError: function(msg, hash), + * + * quoteName: function(name), + * Helper function which can be overridden by user code later on: put suitable + * quotes around literal IDs in a description string. + * + * describeSymbol: function(symbol), + * Return a more-or-less human-readable description of the given symbol, when + * available, or the symbol itself, serving as its own 'description' for lack + * of something better to serve up. + * + * Return NULL when the symbol is unknown to the parser. + * * symbols_: {associative list: name ==> number}, * terminals_: {associative list: number ==> name}, * productions_: [...], - * performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, ...), - * (where `...` denotes the (optional) additional arguments the user passed to `parser.parse(str, ...)`) + * + * performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, yystack, ...), + * where `...` denotes the (optional) additional arguments the user passed to + * `parser.parse(str, ...)` + * * table: [...], + * State transition table + * ---------------------- + * + * index levels are: + * - `state` --> hash table + * - `symbol` --> action (number or array) + * + * If the `action` is an array, these are the elements' meaning: + * - index [0]: 1 = shift, 2 = reduce, 3 = accept + * - index [1]: GOTO `state` + * + * If the `action` is a number, it is the GOTO `state` + * * defaultActions: {...}, + * * parseError: function(str, hash), + * yyErrOk: function(), + * yyClearIn: function(), + * + * options: { ... parser %options ... }, + * * parse: function(input), * * lexer: { @@ -44,7 +82,7 @@ * pushState: function(condition), * stateStackSize: function(), * - * options: { ... }, + * options: { ... lexer %options ... }, * * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), * rules: [...], @@ -58,12 +96,14 @@ * last_line: n, * first_column: n, * last_column: n, - * range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) * } * * --- * - * The parseError function receives a 'hash' object with these members for lexer and parser errors: + * The parseError function receives a 'hash' object with these members for lexer and + * parser errors: * * { * text: (matched text) @@ -76,19 +116,40 @@ * parser (grammar) errors will also provide these additional members: * * { - * expected: (array describing the set of expected tokens; may be empty when we cannot easily produce such a set) - * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule available for this particular error) - * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, for instance, for advanced error analysis and reporting) + * expected: (array describing the set of expected tokens; + * may be empty when we cannot easily produce such a set) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, + * for instance, for advanced error analysis and reporting) + * value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used, + * for instance, for advanced error analysis and reporting) + * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) * } * * while `this` will reference the current parser instance. * - * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* instance, while these additional `hash` fields will also be provided: + * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: * * { * lexer: (reference to the current lexer instance which reported the error) * } * + * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired + * from either the parser or lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * exception: (reference to the exception thrown) + * } + * + * Please do note that in the latter situation, the `expected` field will be omitted as + * type of failure is assumed not to be due to *parse errors* but rather due to user + * action code in either parser or lexer failing unexpectedly. + * * --- * * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. @@ -96,55 +157,77 @@ * * ### options which are global for all parser instances * - * Parser.pre_parse: function(yy) - * optional: you can specify a pre_parse() function in the chunk following the grammar, - * i.e. after the last `%%`. - * Parser.post_parse: function(yy, retval) { return retval; } - * optional: you can specify a post_parse() function in the chunk following the grammar, - * i.e. after the last `%%`. When it does not return any value, the parser will return - * the original `retval`. + * Parser.pre_parse: function(yy [, optional parse() args]) + * optional: you can specify a pre_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. + * Parser.post_parse: function(yy, retval [, optional parse() args]) { return retval; } + * optional: you can specify a post_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. When it does not return any value, + * the parser will return the original `retval`. * * ### options which can be set up per parser instance * * yy: { - * pre_parse: function(yy) - * optional: is invoked before the parse cycle starts (and before the first invocation - * of `lex()`) but immediately after the invocation of parser.pre_parse()). - * post_parse: function(yy, retval) { return retval; } - * optional: is invoked when the parse terminates due to success ('accept') or failure - * (even when exceptions are thrown). `retval` contains the return value to be produced - * by `Parser.parse()`; this function can override the return value by returning another. - * When it does not return any value, the parser will return the original `retval`. - * This function is invoked immediately before `Parser.post_parse()`. + * pre_parse: function(yy [, optional parse() args]) + * optional: is invoked before the parse cycle starts (and before the first + * invocation of `lex()`) but immediately after the invocation of + * `parser.pre_parse()`). + * post_parse: function(yy, retval [, optional parse() args]) { return retval; } + * optional: is invoked when the parse terminates due to success ('accept') + * or failure (even when exceptions are thrown). + * `retval` contains the return value to be produced by `Parser.parse()`; + * this function can override the return value by returning another. + * When it does not return any value, the parser will return the original + * `retval`. + * This function is invoked immediately before `Parser.post_parse()`. + * * parseError: function(str, hash) - * optional: overrides the default `parseError` function. + * optional: overrides the default `parseError` function. + * quoteName: function(name), + * optional: overrides the default `quoteName` function. * } * * parser.lexer.options: { - * ranges: boolean optional: true ==> token location info will include a .range[] member. - * flex: boolean optional: true ==> flex-like lexing behaviour where the rules are tested - * exhaustively to find the longest match. - * backtrack_lexer: boolean - * optional: true ==> lexer regexes are tested in order and for each matching - * regex the action code is invoked; the lexer terminates - * the scan when a token is returned by the action code. * pre_lex: function() - * optional: is invoked before the lexer is invoked to produce another token. - * `this` refers to the Lexer object. + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. * post_lex: function(token) { return token; } - * optional: is invoked when the lexer has produced a token `token`; - * this function can override the returned token value by returning another. - * When it does not return any (truthy) value, the lexer will return the original `token`. - * `this` refers to the Lexer object. + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. * } */ var lexParser = (function () { -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript + +// See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript function JisonParserError(msg, hash) { this.message = msg; this.hash = hash; - var stacktrace = (new Error(msg)).stack; + var stacktrace; + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + if (!stacktrace) { + stacktrace = (new Error(msg)).stack; + } if (stacktrace) { this.stack = stacktrace; } @@ -153,31 +236,119 @@ JisonParserError.prototype = Object.create(Error.prototype); JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -function __expand__(k, v, o) { - o = o || {}; - for (var l = k.length; l--; ) { - o[k[l]] = v; - } - return o; -} -var $V0=[130,136,138,140,142,145,174], - $V1=[36,40,46,47,94,123,124,142,157,158,164,165,170,172,173], - $V2=[41,123,124,130,136,138,140,142,145,174], - $V3=[36,40,41,46,47,94,123,124,130,136,138,140,142,145,157,158,164,165,170,172,173,174], - $V4=[41,124], - $V5=[36,40,41,42,43,46,47,63,94,123,124,130,136,138,140,142,145,157,158,164,165,170,171,172,173,174], - $V6=[130,136,138,140,142,145,146,174], - $V7=[36,40,46,47,60,94,123,124,130,132,136,138,140,142,145,157,158,164,165,170,172,173,174,180], - $V8=[132,180], - $V9=[36,40,46,47,60,94,123,124,130,132,142,157,158,164,165,170,172,173], - $Va=[164,167], - $Vb=[123,125]; +// helper: reconstruct the productions[] table +function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); + } + return rv; + } + +// helper: reconstruct the defaultActions[] table +function bda(s) { + var rv = {}; + var d = s.idx; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = [ + p[i], + r[i] + ]; + } + return rv; + } + +// helper: reconstruct the 'goto' table +function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; + + case 0: + q[z] = a.shift(); + break; + + default: + // type === 1: accept + q[z] = [ + 3 + ]; + } + } + rv.push(q); + } + return rv; + } + +// helper: runlength encoding with increment step: code, length: step (default step = 0) +// `this` references an array +function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } + } + +// helper: duplicate sequence from *relative* offset and length. +// `this` references an array +function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } + } + +// helper: unpack an array using helpers and data, all passed in an array argument 'a'. +function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; + } var parser = { -trace: function trace() { }, +EOF: 1, +TERROR: 2, +trace: function no_op_trace() { }, JisonParserError: JisonParserError, yy: {}, +options: { + type: "lalr" +}, symbols_: { "$": 36, "$accept": 0, @@ -450,330 +621,118 @@ nonterminals_: { 80: "" } }, -productions_: [ +productions_: bp({ + pop: u([ + 127, + s, + [131, 4], + 128, + 129, + 129, + s, + [135, 7], + 139, + 139, + 141, + 141, + 134, + 134, + 147, + s, + [149, 3], + 150, + 150, + 151, + 151, + s, + [148, 3], + 153, + 153, + 137, + s, + [154, 4], + 155, + 155, + s, + [156, 15], + 159, + 161, + 166, + 166, + 168, + 168, + 163, + 160, + 162, + 162, + 144, + 175, + 175, + s, + [177, 3], + 133, + 133, + 143, + 143, + 182, + 182, + 179, + 179 +]), + rule: u([ + 4, + 1, + 3, + 4, + 2, 0, - [ - 127, - 4 - ], - [ - 131, - 1 - ], - [ - 131, - 3 - ], - [ - 131, - 4 - ], - [ - 131, - 2 - ], - [ - 128, - 0 - ], - [ - 129, - 2 - ], - [ - 129, - 0 - ], - [ - 135, - 2 - ], - [ - 135, - 2 - ], - [ - 135, - 2 - ], - [ - 135, - 1 - ], - [ - 135, - 1 - ], - [ - 135, - 1 - ], - [ - 135, - 1 - ], - [ - 139, - 1 - ], - [ - 139, - 2 - ], - [ - 141, - 1 - ], - [ - 141, - 2 - ], - [ - 134, - 2 - ], - [ - 134, - 1 - ], - [ - 147, - 3 - ], - [ - 149, - 3 - ], - [ - 149, - 1 - ], - [ - 149, - 1 - ], - [ - 150, - 1 - ], - [ - 150, - 5 - ], - [ - 151, - 0 - ], - [ - 151, - 2 - ], - [ - 148, - 3 - ], - [ - 148, - 3 - ], - [ - 148, - 0 - ], - [ - 153, - 1 - ], - [ - 153, - 3 - ], - [ - 137, - 1 - ], - [ - 154, - 3 - ], - [ - 154, - 2 - ], - [ - 154, - 1 - ], - [ - 154, - 0 - ], - [ - 155, - 2 - ], - [ - 155, - 1 - ], - [ - 156, - 3 - ], - [ - 156, - 3 - ], - [ - 156, - 2 - ], - [ - 156, - 2 - ], - [ - 156, - 2 - ], - [ - 156, - 2 - ], - [ - 156, - 2 - ], - [ - 156, - 1 - ], - [ - 156, - 2 - ], - [ - 156, - 1 - ], - [ - 156, - 1 - ], - [ - 156, - 1 - ], - [ - 156, - 1 - ], - [ - 156, - 1 - ], - [ - 156, - 1 - ], - [ - 159, - 1 - ], - [ - 161, - 3 - ], - [ - 166, - 2 - ], - [ - 166, - 1 - ], - [ - 168, - 1 - ], - [ - 168, - 1 - ], - [ - 163, - 1 - ], - [ - 160, - 1 - ], - [ - 162, - 1 - ], - [ - 162, - 1 - ], - [ - 144, - 3 - ], - [ - 175, - 2 - ], - [ - 175, - 1 - ], - [ - 177, - 1 - ], - [ - 177, - 3 - ], - [ - 177, - 3 - ], - [ - 133, - 1 - ], - [ - 133, - 3 - ], - [ - 143, - 2 - ], - [ - 143, - 2 - ], - [ - 182, - 1 - ], - [ - 182, - 2 - ], - [ - 179, - 1 - ], - [ - 179, - 0 - ] -], -performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */, yystack) { + 2, + 0, + s, + [2, 3], + s, + [1, 5], + 2, + 1, + c, + [9, 3], + 3, + 3, + s, + [1, 3], + 5, + 0, + 2, + 3, + 3, + 0, + 1, + 3, + 1, + s, + [3, 4, -1], + c, + [20, 4], + s, + [2, 5], + c, + [33, 3], + s, + [1, 6], + c, + [22, 3], + c, + [9, 10], + c, + [49, 3], + c, + [31, 3], + c, + [28, 3], + 0 +]) +}), +performAction: function anonymous(yytext, yy, yystate /* action[1] */, $$ /* vstack */) { /* this == yyval */ var $0 = $$.length - 1; @@ -1079,1440 +1038,999 @@ case 76 : break; } }, -table: [ - __expand__($V0, [ - 2, - 6 - ], {127:1,128:2,180:[ - 2, - 6 - ] - }), - { - 1: [ - 3 - ] - }, - { - 129: 3, - 130: [ - 2, - 8 - ], - 135: 4, - 136: [ - 1, - 5 - ], - 138: [ - 1, - 6 - ], - 140: [ - 1, - 7 - ], - 142: [ - 1, - 8 - ], - 143: 9, - 144: 10, - 145: [ - 1, - 11 - ], - 174: [ - 1, - 13 - ], - 180: [ - 1, - 12 - ] - }, - { - 130: [ - 1, - 14 - ] - }, - { - 129: 15, - 130: [ - 2, - 8 - ], - 135: 4, - 136: [ - 1, - 5 - ], - 138: [ - 1, - 6 - ], - 140: [ - 1, - 7 - ], - 142: [ - 1, - 8 - ], - 143: 9, - 144: 10, - 145: [ - 1, - 11 - ], - 174: [ - 1, - 13 - ], - 180: [ - 1, - 12 - ] - }, - __expand__([124,130,136,138,140,142,145,174], [ - 2, - 39 - ], {137:16,154:17,155:18,156:19,159:24,161:25,162:29,163:30,36:[ - 1, - 28 - ],40:[ - 1, - 20 - ],46:[ - 1, - 26 - ],47:[ - 1, - 22 - ],94:[ - 1, - 27 - ],157:[ - 1, - 21 - ],158:[ - 1, - 23 - ],164:[ - 1, - 31 - ],165:[ - 1, - 32 - ],170:[ - 1, - 35 - ],172:[ - 1, - 33 - ],173:[ - 1, - 34 - ],180:[ - 2, - 39 - ] - }), - { - 139: 36, - 146: [ - 1, - 37 - ] - }, - { - 141: 38, - 146: [ - 1, - 39 - ] - }, - __expand__($V0, [ - 2, - 12 - ], {180:[ - 2, - 12 - ] - }), - __expand__($V0, [ - 2, - 13 - ], {180:[ - 2, - 13 - ] - }), - __expand__($V0, [ - 2, - 14 - ], {180:[ - 2, - 14 - ] - }), - __expand__($V0, [ - 2, - 15 - ], {180:[ - 2, - 15 - ] - }), - { - 2: [ - 1, - 41 - ], - 181: [ - 1, - 40 - ] - }, - { - 136: [ - 1, - 44 - ], - 175: 42, - 177: 43 - }, - __expand__($V1, [ - 2, - 32 - ], {131:45,134:48,147:49,148:50,60:[ - 1, - 51 - ],130:[ - 1, - 47 - ],132:[ - 1, - 46 - ],180:[ - 2, - 32 - ] - }), - { - 130: [ - 2, - 7 - ] - }, - __expand__($V0, [ - 2, - 9 - ], {180:[ - 2, - 9 - ] - }), - __expand__([123,130,136,138,140,142,145,174], [ - 2, - 35 - ], {124:[ - 1, - 52 - ],180:[ - 2, - 35 - ] - }), - __expand__($V2, [ - 2, - 38 - ], {159:24,161:25,162:29,163:30,156:53,36:[ - 1, - 28 - ],40:[ - 1, - 20 - ],46:[ - 1, - 26 - ],47:[ - 1, - 22 - ],94:[ - 1, - 27 - ],157:[ - 1, - 21 - ],158:[ - 1, - 23 - ],164:[ - 1, - 31 - ],165:[ - 1, - 32 - ],170:[ - 1, - 35 - ],172:[ - 1, - 33 - ],173:[ - 1, - 34 - ],180:[ - 2, - 38 - ] - }), - __expand__($V3, [ - 2, - 41 - ], {160:57,42:[ - 1, - 55 - ],43:[ - 1, - 54 - ],63:[ - 1, - 56 - ],171:[ - 1, - 58 - ],180:[ - 2, - 41 - ] - }), - __expand__($V4, [ - 2, - 39 - ], {155:18,156:19,159:24,161:25,162:29,163:30,154:59,36:[ - 1, - 28 - ],40:[ - 1, - 20 - ],46:[ - 1, - 26 - ],47:[ - 1, - 22 - ],94:[ - 1, - 27 - ],157:[ - 1, - 21 - ],158:[ - 1, - 23 - ],164:[ - 1, - 31 - ],165:[ - 1, - 32 - ],170:[ - 1, - 35 - ],172:[ - 1, - 33 - ],173:[ - 1, - 34 - ] - }), - __expand__($V4, [ - 2, - 39 - ], {155:18,156:19,159:24,161:25,162:29,163:30,154:60,36:[ - 1, - 28 - ],40:[ - 1, - 20 - ],46:[ - 1, - 26 - ],47:[ - 1, - 22 - ],94:[ - 1, - 27 - ],157:[ - 1, - 21 - ],158:[ - 1, - 23 - ],164:[ - 1, - 31 - ],165:[ - 1, - 32 - ],170:[ - 1, - 35 - ],172:[ - 1, - 33 - ],173:[ - 1, - 34 - ] - }), - { - 36: [ - 1, - 28 - ], - 40: [ - 1, - 20 - ], - 46: [ - 1, - 26 - ], - 47: [ - 1, - 22 - ], - 94: [ - 1, - 27 - ], - 156: 61, - 157: [ - 1, - 21 - ], - 158: [ - 1, - 23 - ], - 159: 24, - 161: 25, - 162: 29, - 163: 30, - 164: [ - 1, - 31 - ], - 165: [ - 1, - 32 - ], - 170: [ - 1, - 35 - ], - 172: [ - 1, - 33 - ], - 173: [ - 1, - 34 - ] - }, - { - 36: [ - 1, - 28 - ], - 40: [ - 1, - 20 - ], - 46: [ - 1, - 26 - ], - 47: [ - 1, - 22 - ], - 94: [ - 1, - 27 - ], - 156: 62, - 157: [ - 1, - 21 - ], - 158: [ - 1, - 23 - ], - 159: 24, - 161: 25, - 162: 29, - 163: 30, - 164: [ - 1, - 31 - ], - 165: [ - 1, - 32 - ], - 170: [ - 1, - 35 - ], - 172: [ - 1, - 33 - ], - 173: [ - 1, - 34 - ] - }, - __expand__($V5, [ - 2, - 49 - ], {180:[ - 2, - 49 - ] - }), - __expand__($V5, [ - 2, - 51 - ], {180:[ - 2, - 51 - ] - }), - __expand__($V5, [ - 2, - 52 - ], {180:[ - 2, - 52 - ] - }), - __expand__($V5, [ - 2, - 53 - ], {180:[ - 2, - 53 - ] - }), - __expand__($V5, [ - 2, - 54 - ], {180:[ - 2, - 54 - ] - }), - __expand__($V5, [ - 2, - 55 - ], {180:[ - 2, - 55 - ] - }), - __expand__($V5, [ - 2, - 56 - ], {180:[ - 2, - 56 - ] - }), - __expand__([36,40,41,42,43,46,47,63,94,123,124,130,136,138,140,142,145,157,158,164,165,167,169,170,171,172,173,174], [ - 2, - 57 - ], {180:[ - 2, - 57 - ] - }), - { - 159: 66, - 164: [ - 1, - 31 - ], - 166: 63, - 168: 64, - 169: [ - 1, - 65 - ] - }, - __expand__($V5, [ - 2, - 65 - ], {180:[ - 2, - 65 - ] - }), - __expand__($V5, [ - 2, - 66 - ], {180:[ - 2, - 66 - ] - }), - __expand__($V5, [ - 2, - 63 - ], {180:[ - 2, - 63 - ] - }), - __expand__($V0, [ - 2, - 10 - ], {146:[ - 1, - 67 - ],180:[ - 2, - 10 - ] - }), - __expand__($V6, [ - 2, - 16 - ], {180:[ - 2, - 16 - ] - }), - __expand__($V0, [ - 2, - 11 - ], {146:[ - 1, - 68 - ],180:[ - 2, - 11 - ] - }), - __expand__($V6, [ - 2, - 18 - ], {180:[ - 2, - 18 - ] - }), - __expand__($V7, [ - 2, - 75 - ], {183:[ - 2, - 75 - ] - }), - __expand__($V7, [ - 2, - 76 - ], {183:[ - 2, - 76 - ] - }), - { - 176: [ - 1, - 69 - ] - }, - { - 136: [ - 1, - 44 - ], - 175: 70, - 176: [ - 2, - 69 - ], - 177: 43 - }, - { - 61: [ - 1, - 71 - ], - 136: [ - 2, - 70 - ], - 176: [ - 2, - 70 - ] - }, - { - 1: [ - 2, - 1 - ] - }, - { - 1: [ - 2, - 2 - ] - }, - __expand__($V8, [ - 2, - 80 - ], {133:72,179:73,182:74,183:[ - 1, - 75 - ] - }), - __expand__($V1, [ - 2, - 32 - ], {148:50,147:78,60:[ - 1, - 51 - ],130:[ - 1, - 76 - ],132:[ - 1, - 77 - ],180:[ - 2, - 32 - ] - }), - __expand__($V9, [ - 2, - 21 - ], {180:[ - 2, - 21 - ] - }), - __expand__([123,124,142], [ - 2, - 39 - ], {154:17,155:18,156:19,159:24,161:25,162:29,163:30,137:79,36:[ - 1, - 28 - ],40:[ - 1, - 20 - ],46:[ - 1, - 26 - ],47:[ - 1, - 22 - ],94:[ - 1, - 27 - ],157:[ - 1, - 21 - ],158:[ - 1, - 23 - ],164:[ - 1, - 31 - ],165:[ - 1, - 32 - ],170:[ - 1, - 35 - ],172:[ - 1, - 33 - ],173:[ - 1, - 34 - ],180:[ - 2, - 39 - ] - }), - { - 42: [ - 1, - 81 - ], - 136: [ - 1, - 82 - ], - 153: 80 - }, - __expand__($V2, [ - 2, - 37 - ], {156:19,159:24,161:25,162:29,163:30,155:83,36:[ - 1, - 28 - ],40:[ - 1, - 20 - ],46:[ - 1, - 26 - ],47:[ - 1, - 22 - ],94:[ - 1, - 27 - ],157:[ - 1, - 21 - ],158:[ - 1, - 23 - ],164:[ - 1, - 31 - ],165:[ - 1, - 32 - ],170:[ - 1, - 35 - ],172:[ - 1, - 33 - ],173:[ - 1, - 34 - ],180:[ - 2, - 37 - ] - }), - __expand__($V3, [ - 2, - 40 - ], {160:57,42:[ - 1, - 55 - ],43:[ - 1, - 54 - ],63:[ - 1, - 56 - ],171:[ - 1, - 58 - ],180:[ - 2, - 40 - ] - }), - __expand__($V5, [ - 2, - 44 - ], {180:[ - 2, - 44 - ] - }), - __expand__($V5, [ - 2, - 45 - ], {180:[ - 2, - 45 - ] - }), - __expand__($V5, [ - 2, - 46 - ], {180:[ - 2, - 46 - ] - }), - __expand__($V5, [ - 2, - 50 - ], {180:[ - 2, - 50 - ] - }), - __expand__($V5, [ - 2, - 64 - ], {180:[ - 2, - 64 - ] - }), - { - 41: [ - 1, - 84 - ], - 124: [ - 1, - 52 - ] - }, - { - 41: [ - 1, - 85 - ], - 124: [ - 1, - 52 - ] - }, - __expand__($V3, [ - 2, - 47 - ], {160:57,42:[ - 1, - 55 - ],43:[ - 1, - 54 - ],63:[ - 1, - 56 - ],171:[ - 1, - 58 - ],180:[ - 2, - 47 - ] - }), - __expand__($V3, [ - 2, - 48 - ], {160:57,42:[ - 1, - 55 - ],43:[ - 1, - 54 - ],63:[ - 1, - 56 - ],171:[ - 1, - 58 - ],180:[ - 2, - 48 - ] - }), - { - 167: [ - 1, - 86 - ] - }, - { - 159: 66, - 164: [ - 1, - 31 - ], - 166: 87, - 167: [ - 2, - 60 - ], - 168: 64, - 169: [ - 1, - 65 - ] - }, - __expand__($Va, [ - 2, - 61 - ], {169:[ - 2, - 61 - ] - }), - __expand__($Va, [ - 2, - 62 - ], {169:[ - 2, - 62 - ] - }), - __expand__($V6, [ - 2, - 17 - ], {180:[ - 2, - 17 - ] - }), - __expand__($V6, [ - 2, - 19 - ], {180:[ - 2, - 19 - ] - }), - __expand__($V0, [ - 2, - 67 - ], {180:[ - 2, - 67 - ] - }), - { - 176: [ - 2, - 68 - ] - }, - { - 136: [ - 1, - 89 - ], - 178: [ - 1, - 88 - ] - }, - { - 132: [ - 1, - 90 - ] - }, - { - 132: [ - 2, - 73 - ], - 143: 91, - 180: [ - 1, - 12 - ] - }, - __expand__($V8, [ - 2, - 79 - ], {183:[ - 1, - 92 - ] - }), - __expand__($V8, [ - 2, - 77 - ], {183:[ - 2, - 77 - ] - }), - __expand__($V8, [ - 2, - 80 - ], {179:73,182:74,133:93,183:[ - 1, - 75 - ] - }), - { - 1: [ - 2, - 5 - ] - }, - __expand__($V9, [ - 2, - 20 - ], {180:[ - 2, - 20 - ] - }), - { - 123: [ - 1, - 95 - ], - 142: [ - 1, - 96 - ], - 143: 97, - 149: 94, - 180: [ - 1, - 12 - ] - }, - { - 44: [ - 1, - 99 - ], - 62: [ - 1, - 98 - ] - }, - { - 62: [ - 1, - 100 - ] - }, - { - 44: [ - 2, - 33 - ], - 62: [ - 2, - 33 - ] - }, - __expand__($V2, [ - 2, - 36 - ], {159:24,161:25,162:29,163:30,156:53,36:[ - 1, - 28 - ],40:[ - 1, - 20 - ],46:[ - 1, - 26 - ],47:[ - 1, - 22 - ],94:[ - 1, - 27 - ],157:[ - 1, - 21 - ],158:[ - 1, - 23 - ],164:[ - 1, - 31 - ],165:[ - 1, - 32 - ],170:[ - 1, - 35 - ],172:[ - 1, - 33 - ],173:[ - 1, - 34 - ],180:[ - 2, - 36 - ] - }), - __expand__($V5, [ - 2, - 42 - ], {180:[ - 2, - 42 - ] - }), - __expand__($V5, [ - 2, - 43 - ], {180:[ - 2, - 43 - ] - }), - __expand__($V5, [ - 2, - 58 - ], {180:[ - 2, - 58 - ] - }), - { - 167: [ - 2, - 59 - ] - }, - { - 136: [ - 2, - 71 - ], - 176: [ - 2, - 71 - ] - }, - { - 136: [ - 2, - 72 - ], - 176: [ - 2, - 72 - ] - }, - { - 1: [ - 2, - 3 - ] - }, - __expand__($V8, [ - 2, - 80 - ], {179:73,182:74,133:101,183:[ - 1, - 75 - ] - }), - __expand__($V8, [ - 2, - 78 - ], {183:[ - 2, - 78 - ] - }), - { - 132: [ - 1, - 102 - ] - }, - __expand__($V9, [ - 2, - 22 - ], {180:[ - 2, - 22 - ] - }), - __expand__($Vb, [ - 2, - 28 - ], {150:103,151:104,152:[ - 2, - 28 - ] - }), - __expand__($V9, [ - 2, - 24 - ], {180:[ - 2, - 24 - ] - }), - __expand__($V9, [ - 2, - 25 - ], {180:[ - 2, - 25 - ] - }), - __expand__($V1, [ - 2, - 30 - ], {180:[ - 2, - 30 - ] - }), - { - 136: [ - 1, - 105 - ] - }, - __expand__($V1, [ - 2, - 31 - ], {180:[ - 2, - 31 - ] - }), - { - 132: [ - 2, - 74 - ] - }, - { - 1: [ - 2, - 4 - ] - }, - { - 123: [ - 1, - 107 - ], - 125: [ - 1, - 106 - ] - }, - __expand__($Vb, [ - 2, - 26 - ], {152:[ - 1, - 108 - ] - }), - { - 44: [ - 2, - 34 - ], - 62: [ - 2, - 34 - ] - }, - __expand__($V9, [ - 2, - 23 - ], {180:[ - 2, - 23 - ] - }), - __expand__($Vb, [ - 2, - 28 - ], {151:104,150:109,152:[ - 2, - 28 - ] - }), - __expand__($Vb, [ - 2, - 29 - ], {152:[ - 2, - 29 - ] - }), - { - 123: [ - 1, - 107 - ], - 125: [ - 1, - 110 - ] - }, - __expand__($Vb, [ - 2, - 28 - ], {151:111,152:[ - 2, - 28 - ] - }), - __expand__($Vb, [ - 2, - 27 - ], {152:[ - 1, - 108 - ] - }) -], -defaultActions: { - 15: [ - 2, - 7 - ], - 45: [ - 2, - 1 - ], - 46: [ - 2, - 2 - ], - 70: [ - 2, - 68 - ], - 77: [ - 2, - 5 - ], - 87: [ - 2, - 59 - ], - 90: [ - 2, - 3 - ], - 101: [ - 2, - 74 - ], - 102: [ - 2, - 4 - ] -}, +table: bt({ + len: u([ + 10, + 1, + 12, + 1, + 12, + 29, + 2, + 2, + s, + [8, 4], + 2, + 3, + 23, + 1, + 8, + 10, + 28, + 28, + 21, + 21, + 17, + 17, + s, + [27, 7], + 29, + 5, + s, + [27, 3], + s, + [9, 4], + 25, + 25, + 1, + 4, + 3, + 1, + 1, + 6, + 21, + 19, + 24, + 3, + 29, + 28, + s, + [27, 5], + 2, + 2, + 28, + 28, + 1, + 6, + 3, + 3, + 9, + 9, + 8, + 1, + 2, + 1, + s, + [3, 3], + 6, + 1, + 19, + 5, + 2, + 1, + 2, + c, + [30, 4], + 1, + 2, + 2, + c, + [27, 3], + c, + [16, 3], + 19, + 19, + 16, + 1, + 16, + 1, + 1, + 2, + 3, + 2, + 19, + 5, + 3, + 2, + 4, + 3 +]), + symbol: u([ + 127, + 128, + 130, + s, + [136, 4, 2], + 145, + 174, + 180, + 1, + 129, + 130, + 135, + c, + [11, 4], + 143, + 144, + c, + [13, 3], + 130, + c, + [13, 12], + 36, + 40, + 46, + 47, + 94, + 124, + 130, + 136, + 137, + c, + [41, 4], + s, + [154, 6, 1], + s, + [161, 5, 1], + 170, + 172, + 173, + 174, + 180, + 139, + 146, + 141, + 146, + c, + [67, 8], + c, + [8, 24], + 2, + 181, + 136, + 175, + 177, + c, + [70, 4], + 60, + 94, + 123, + 124, + 130, + 131, + 132, + 134, + 142, + 147, + 148, + 157, + 158, + c, + [65, 5], + 180, + 130, + c, + [37, 8], + c, + [26, 3], + c, + [10, 7], + 36, + 40, + 41, + c, + [113, 3], + c, + [16, 8], + c, + [111, 14], + c, + [28, 3], + 42, + 43, + 46, + 47, + 63, + c, + [31, 9], + 157, + 158, + 160, + c, + [27, 3], + s, + [171, 4, 1], + c, + [56, 7], + 124, + c, + [162, 14], + c, + [21, 23], + c, + [20, 3], + c, + [17, 31], + c, + [104, 17], + c, + [103, 11], + c, + [27, 180], + 167, + s, + [169, 6, 1], + 180, + 159, + 164, + 166, + 168, + 169, + c, + [115, 81], + c, + [16, 6], + 146, + c, + [9, 29], + c, + [514, 9], + 132, + c, + [61, 10], + c, + [60, 4], + 183, + c, + [25, 25], + 176, + 136, + 175, + 176, + 177, + 61, + 136, + 176, + 1, + 1, + 132, + 133, + 179, + 180, + 182, + c, + [41, 11], + c, + [578, 11], + c, + [21, 11], + c, + [19, 12], + c, + [18, 3], + 137, + 142, + c, + [503, 14], + 180, + 42, + 136, + 153, + c, + [605, 14], + c, + [717, 15], + c, + [606, 31], + c, + [476, 132], + 41, + 124, + 41, + 124, + c, + [167, 47], + c, + [28, 9], + 167, + c, + [508, 3], + 167, + 168, + 169, + 164, + 167, + c, + [3, 4], + c, + [425, 24], + 174, + 180, + 176, + 136, + 178, + 132, + 132, + 143, + 180, + 132, + 180, + 183, + c, + [3, 4], + c, + [377, 5], + 1, + c, + [357, 19], + 123, + 142, + 143, + 149, + 180, + 44, + 62, + 62, + 44, + 62, + c, + [945, 47], + c, + [257, 62], + 167, + 136, + 176, + c, + [529, 3], + c, + [151, 6], + c, + [160, 4], + c, + [154, 20], + 125, + 150, + 151, + 152, + c, + [535, 23], + c, + [554, 22], + c, + [16, 9], + 136, + c, + [17, 16], + 132, + 1, + 123, + 125, + 123, + 125, + 152, + c, + [229, 4], + c, + [104, 22], + c, + [29, 3], + c, + [34, 4], + c, + [9, 5] +]), + type: u([ + 0, + 0, + s, + [2, 8], + 1, + 0, + 2, + c, + [12, 5], + c, + [18, 6], + c, + [13, 13], + s, + [2, 7], + c, + [18, 7], + c, + [7, 3], + s, + [0, 4], + c, + [21, 9], + c, + [35, 12], + s, + [2, 25], + c, + [73, 11], + c, + [50, 4], + c, + [88, 13], + c, + [58, 31], + c, + [111, 13], + c, + [33, 22], + c, + [107, 15], + c, + [51, 19], + c, + [21, 19], + c, + [17, 34], + s, + [2, 213], + c, + [381, 45], + c, + [174, 132], + c, + [577, 9], + c, + [465, 15], + c, + [235, 38], + c, + [469, 15], + c, + [54, 15], + c, + [555, 20], + c, + [606, 30], + c, + [296, 153], + c, + [28, 36], + c, + [891, 5], + c, + [81, 47], + c, + [377, 16], + c, + [388, 33], + c, + [839, 102], + c, + [151, 27], + c, + [542, 39], + c, + [134, 71], + c, + [304, 12] +]), + state: u([ + s, + [1, 4, 1], + 9, + 10, + 15, + c, + [4, 3], + s, + [16, 4, 1], + 24, + 25, + 29, + 30, + 36, + 38, + 42, + 43, + 45, + 48, + 49, + 50, + 53, + c, + [13, 4], + 57, + 59, + c, + [21, 6], + 60, + c, + [7, 6], + 61, + c, + [5, 4], + 62, + c, + [5, 4], + 66, + 63, + 64, + 70, + 43, + 72, + 73, + 74, + 78, + 50, + 79, + c, + [56, 7], + 80, + 83, + c, + [7, 5], + s, + [57, 3], + 66, + 87, + 64, + 91, + 93, + 73, + 74, + 97, + 94, + c, + [67, 5], + 101, + 73, + 74, + 103, + 104, + 109, + 104, + 111 +]), + mode: u([ + s, + [2, 9], + s, + [1, 8], + c, + [9, 9], + c, + [13, 5], + c, + [28, 13], + c, + [9, 4], + s, + [2, 32], + c, + [53, 7], + c, + [5, 4], + c, + [45, 21], + c, + [20, 9], + c, + [106, 6], + c, + [126, 15], + c, + [26, 8], + c, + [39, 10], + c, + [54, 11], + c, + [50, 7], + c, + [157, 10], + c, + [174, 16], + s, + [1, 19], + s, + [2, 218], + c, + [220, 89], + c, + [88, 18], + c, + [106, 62], + c, + [421, 4], + c, + [454, 12], + c, + [188, 33], + c, + [441, 8], + c, + [657, 12], + c, + [556, 48], + c, + [421, 137], + c, + [202, 7], + c, + [166, 25], + c, + [749, 28], + c, + [95, 36], + c, + [38, 4], + c, + [267, 7], + c, + [332, 25], + c, + [953, 6], + c, + [322, 23], + c, + [581, 90], + c, + [96, 77], + c, + [77, 19], + c, + [315, 19], + c, + [802, 20], + 1 +]), + goto: u([ + s, + [6, 8], + 8, + s, + [5, 4, 1], + 11, + 13, + 12, + 14, + c, + [9, 8], + 28, + 20, + 26, + 22, + 27, + s, + [39, 7], + 21, + 23, + 31, + 32, + 35, + 33, + 34, + 39, + 39, + 37, + 39, + s, + [12, 8], + s, + [13, 8], + s, + [14, 8], + s, + [15, 8], + 41, + 40, + 44, + s, + [32, 4], + 51, + s, + [32, 3], + 47, + 46, + s, + [32, 9], + 7, + s, + [9, 8], + 35, + 52, + s, + [35, 8], + 28, + 20, + 38, + c, + [97, 3], + s, + [38, 8], + c, + [98, 7], + 38, + 38, + s, + [41, 3], + 55, + 54, + 41, + 41, + 56, + s, + [41, 14], + 58, + s, + [41, 4], + 28, + 20, + 39, + c, + [147, 4], + c, + [43, 7], + c, + [14, 16], + c, + [13, 3], + c, + [12, 19], + s, + [49, 27], + s, + [51, 27], + s, + [52, 27], + s, + [53, 27], + s, + [54, 27], + s, + [55, 27], + s, + [56, 27], + s, + [57, 29], + 31, + s, + [65, 28], + s, + [66, 27], + s, + [63, 27], + s, + [10, 6], + 67, + 10, + 10, + s, + [16, 9], + s, + [11, 6], + 68, + 11, + 11, + s, + [18, 9], + s, + [75, 25], + s, + [76, 25], + 69, + 44, + 69, + 71, + 70, + 70, + 1, + 2, + 80, + 80, + 75, + c, + [538, 8], + 76, + 77, + s, + [32, 9], + s, + [21, 19], + c, + [634, 8], + c, + [630, 8], + 81, + 82, + 28, + 20, + 37, + c, + [19, 3], + s, + [37, 8], + c, + [24, 7], + 37, + 37, + s, + [40, 3], + 55, + 54, + 40, + 40, + 56, + s, + [40, 14], + 58, + s, + [40, 4], + s, + [44, 27], + s, + [45, 27], + s, + [46, 27], + s, + [50, 27], + s, + [64, 27], + 84, + 52, + 85, + 52, + s, + [47, 3], + 55, + 54, + 47, + 47, + 56, + s, + [47, 14], + 58, + s, + [47, 4], + s, + [48, 3], + 55, + 54, + 48, + 48, + 56, + s, + [48, 14], + 58, + s, + [48, 4], + 86, + 31, + 60, + 65, + s, + [61, 3], + s, + [62, 3], + s, + [17, 9], + s, + [19, 9], + s, + [67, 8], + 68, + 89, + 88, + 90, + 73, + 12, + 79, + 79, + 92, + s, + [77, 3], + c, + [350, 3], + 5, + s, + [20, 19], + 95, + 96, + 12, + 99, + 98, + 100, + 33, + 33, + 28, + 20, + 36, + c, + [322, 3], + s, + [36, 8], + c, + [322, 7], + 36, + 36, + s, + [42, 27], + s, + [43, 27], + s, + [58, 27], + 59, + 71, + 71, + 72, + 72, + 3, + c, + [141, 3], + s, + [78, 3], + 102, + s, + [22, 19], + s, + [28, 3], + s, + [24, 19], + s, + [25, 19], + s, + [30, 16], + 105, + s, + [31, 16], + 74, + 4, + 107, + 106, + 26, + 26, + 108, + 34, + 34, + s, + [23, 19], + s, + [28, 3], + s, + [29, 3], + 107, + 110, + s, + [28, 3], + 27, + 27, + 108 +]) +}), +defaultActions: bda({ + idx: u([ + 15, + 45, + 46, + 70, + 77, + 87, + 90, + 101, + 102 +]), + pop: u([ + s, + [2, 9] +]), + rule: u([ + 7, + 1, + 2, + 68, + 5, + 59, + 3, + 74, + 4 +]) +}), parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); @@ -2520,21 +2038,33 @@ parseError: function parseError(str, hash) { throw new this.JisonParserError(str, hash); } }, +quoteName: function quoteName(id_str) { + return '"' + id_str + '"'; +}, +describeSymbol: function describeSymbol(symbol) { + if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { + return this.terminal_descriptions_[symbol]; + } + else if (symbol === this.EOF) { + return 'end of input'; + } + else if (this.terminals_[symbol]) { + return this.quoteName(this.terminals_[symbol]); + } + return null; +}, parse: function parse(input) { var self = this, - stack = [0], + stack = [0], // state stack: stores pairs of state (odd indexes) and token (even indexes) vstack = [null], // semantic value stack - lstack = [], // location stack - table = this.table, - yytext = '', - yylineno = 0, - yyleng = 0, - recovering = 0, // (only used when the grammar contains error recovery rules) - TERROR = 2, - EOF = 1; - var args = lstack.slice.call(arguments, 1); + table = this.table; + var recovering = 0; // (only used when the grammar contains error recovery rules) + var TERROR = this.TERROR, + EOF = this.EOF; + + var args = stack.slice.call(arguments, 1); //this.reductionCount = this.shiftCount = 0; @@ -2555,28 +2085,49 @@ parse: function parse(input) { } } - lexer.setInput(input, sharedState.yy); sharedState.yy.lexer = lexer; sharedState.yy.parser = this; - if (typeof lexer.yylloc === 'undefined') { - lexer.yylloc = {}; + + + + + + + lexer.setInput(input, sharedState.yy); + + + + + + + + if (typeof lexer.yytext === 'undefined') { + lexer.yytext = ''; + } + var yytext = lexer.yytext; + if (typeof lexer.yylineno === 'undefined') { + lexer.yylineno = 0; } - var yyloc = lexer.yylloc; - lstack.push(yyloc); - var ranges = lexer.options && lexer.options.ranges; // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } + // Does the shared state override the default `quoteName` that already comes with this instance? + if (typeof sharedState.yy.quoteName === 'function') { + this.quoteName = sharedState.yy.quoteName; + } function popStack(n) { + + if (!n) return; stack.length = stack.length - 2 * n; vstack.length = vstack.length - n; - lstack.length = lstack.length - n; + } + function lex() { var token; token = lexer.lex() || EOF; @@ -2587,21 +2138,25 @@ parse: function parse(input) { return token; } - var symbol; + + var symbol = null; var preErrorSymbol = null; - var state, action, a, r; + var state, action, r; var yyval = {}; - var p, len, this_production, lstack_begin, lstack_end, newState; + var p, len, this_production; + + var newState; var expected = []; var retval = false; if (this.pre_parse) { - this.pre_parse.call(this, sharedState.yy); + this.pre_parse.apply(this, [sharedState.yy].concat(args)); } if (sharedState.yy.pre_parse) { - sharedState.yy.pre_parse.call(this, sharedState.yy); + sharedState.yy.pre_parse.apply(this, [sharedState.yy].concat(args)); } + // Return the rule stack depth where the nearest error rule can be found. // Return FALSE when no error recovery rule was found. function locateNearestErrorRecoveryRule(state) { @@ -2611,10 +2166,11 @@ parse: function parse(input) { // try to recover from error for (;;) { // check for error recovery rule in this state - if ((TERROR.toString()) in table[state]) { + var action = table[state][TERROR]; + if (action && action.length && action[0]) { return depth; } - if (state === 0 || stack_probe < 2) { + if (state === 0 /* $accept rule */ || stack_probe < 2) { return false; // No suitable error recovery rule available. } stack_probe -= 2; // popStack(1): [symbol, action] @@ -2624,15 +2180,28 @@ parse: function parse(input) { } + // Produce a (more or less) human-readable list of expected tokens at the point of failure. + // + // The produced list may contain token or token set descriptions instead of the tokens + // themselves to help turning this output into something that easier to read by humans. + // + // The returned list (array) will not contain any duplicate entries. function collect_expected_token_set(state) { var tokenset = []; + var check = {}; + // Has this (error?) state been outfitted with a custom expectations description text for human consumption? + // If so, use that one instead of the less palatable token set. + if (self.state_descriptions_ && self.state_descriptions_[p]) { + return [ + self.state_descriptions_[p] + ]; + } for (var p in table[state]) { - if (p > TERROR) { - if (self.terminal_descriptions_ && self.terminal_descriptions_[p]) { - tokenset.push(self.terminal_descriptions_[p]); - } - else if (self.terminals_[p]) { - tokenset.push("'" + self.terminals_[p] + "'"); + if (p !== TERROR) { + var d = self.describeSymbol(p); + if (d && !check[d]) { + tokenset.push(d); + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. } } } @@ -2648,17 +2217,24 @@ parse: function parse(input) { if (this.defaultActions[state]) { action = this.defaultActions[state]; } else { - if (symbol === null || typeof symbol === 'undefined') { + // The single `==` condition below covers both these `===` comparisons in a single + // operation: + // + // if (symbol === null || typeof symbol === 'undefined') ... + if (symbol == null) { symbol = lex(); } // read action for current state and first input action = table[state] && table[state][symbol]; } + + + // handle parse error - if (typeof action === 'undefined' || !action.length || !action[0]) { - var error_rule_depth; - var errStr = ''; + if (!action || !action.length || !action[0]) { + var error_rule_depth = 0; + var errStr = null; if (!recovering) { // first see if there's any chance at hitting an error recovery rule: @@ -2667,30 +2243,39 @@ parse: function parse(input) { // Report error expected = collect_expected_token_set(state); if (lexer.showPosition) { - errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ", got '" + (this.terminals_[symbol] || symbol) + "'"; + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ':\n' + lexer.showPosition() + '\n'; } else { - errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + - (symbol === EOF ? 'end of input' : - ("'" + (this.terminals_[symbol] || symbol) + "'")); + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; } - a = this.parseError(errStr, p = { + if (expected.length) { + errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + (this.describeSymbol(symbol) || symbol); + } else { + errStr += 'Unexpected ' + (this.describeSymbol(symbol) || symbol); + } + r = this.parseError(errStr, p = { text: lexer.match, token: this.terminals_[symbol] || symbol, token_id: symbol, line: lexer.yylineno, - loc: yyloc, + loc: lexer.yylloc, expected: expected, recoverable: (error_rule_depth !== false), - state_stack: stack + state_stack: stack, + value_stack: vstack, + + lexer: lexer }); + if (!p.recoverable) { - retval = a; + retval = r; break; } } else if (preErrorSymbol !== EOF) { error_rule_depth = locateNearestErrorRecoveryRule(state); } + + // just recovered from another error if (recovering === 3) { if (symbol === EOF || preErrorSymbol === EOF) { @@ -2699,20 +2284,25 @@ parse: function parse(input) { token: this.terminals_[symbol] || symbol, token_id: symbol, line: lexer.yylineno, - loc: yyloc, + loc: lexer.yylloc, expected: expected, recoverable: false, - state_stack: stack + state_stack: stack, + value_stack: vstack, + + lexer: lexer }); break; } // discard current lookahead and grab another - yyleng = lexer.yyleng; + yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; + + symbol = lex(); + + } // try to recover from error @@ -2722,85 +2312,121 @@ parse: function parse(input) { token: this.terminals_[symbol] || symbol, token_id: symbol, line: lexer.yylineno, - loc: yyloc, + loc: lexer.yylloc, expected: expected, recoverable: false, - state_stack: stack + state_stack: stack, + value_stack: vstack, + + lexer: lexer }); break; } popStack(error_rule_depth); preErrorSymbol = (symbol === TERROR ? null : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - state = stack[stack.length - 1]; - action = table[state] && table[state][TERROR]; - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + symbol = TERROR; // insert generic error symbol as new lookahead + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + + + + continue; } - // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array && action.length > 1) { - retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { + + switch (action[0]) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action[0] instanceof Array) { + retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { + text: lexer.match, + token: this.terminals_[symbol] || symbol, + token_id: symbol, + line: lexer.yylineno, + loc: lexer.yylloc, + expected: expected, + recoverable: false, + state_stack: stack, + value_stack: vstack, + + lexer: lexer + }); + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + retval = this.parseError('Parsing halted. No viable error recovery approach available due to internal system failure.', { text: lexer.match, token: this.terminals_[symbol] || symbol, token_id: symbol, line: lexer.yylineno, - loc: yyloc, + loc: lexer.yylloc, expected: expected, recoverable: false, - state_stack: stack + state_stack: stack, + value_stack: vstack, + + lexer: lexer }); break; - } - switch (action[0]) { - case 1: // shift + // shift: + case 1: //this.shiftCount++; stack.push(symbol); vstack.push(lexer.yytext); - lstack.push(lexer.yylloc); + stack.push(action[1]); // push state symbol = null; if (!preErrorSymbol) { // normal execution / no error - yyleng = lexer.yyleng; + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + yytext = lexer.yytext; - yylineno = lexer.yylineno; - yyloc = lexer.yylloc; + + + if (recovering > 0) { recovering--; + } } else { // error just occurred, resume old lookahead f/ before error symbol = preErrorSymbol; preErrorSymbol = null; + } + continue; + // reduce: case 2: - // reduce //this.reductionCount++; - - this_production = this.productions_[action[1]]; + newState = action[1]; + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... len = this_production[1]; - lstack_end = lstack.length; - lstack_begin = lstack_end - (len || 1); - lstack_end--; + + + + + // perform semantic action yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 // default location, uses first token for firsts, last for lasts - yyval._$ = { - first_line: lstack[lstack_begin].first_line, - last_line: lstack[lstack_end].last_line, - first_column: lstack[lstack_begin].first_column, - last_column: lstack[lstack_end].last_column - }; - if (ranges) { - yyval._$.range = [lstack[lstack_begin].range[0], lstack[lstack_end].range[1]]; - } - r = this.performAction.apply(yyval, [yytext, yyleng, yylineno, sharedState.yy, action[1], vstack, lstack, stack].concat(args)); + + + + + + + + + + + r = this.performAction.apply(yyval, [yytext, sharedState.yy, newState, vstack].concat(args)); if (typeof r !== 'undefined') { retval = r; @@ -2808,36 +2434,75 @@ parse: function parse(input) { } // pop off stack - if (len) { - popStack(len); - } + popStack(len); stack.push(this_production[0]); // push nonterminal (reduce) vstack.push(yyval.$); - lstack.push(yyval._$); + // goto new state = table[STATE][NONTERMINAL] newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; stack.push(newState); + continue; + // accept: case 3: - // accept retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + if (typeof yyval.$ !== 'undefined') { + retval = yyval.$; + } break; } // break out of loop: we accept or fail with error break; } + } catch (ex) { + // report exceptions through the parseError callback too: + retval = this.parseError('Parsing aborted due to exception.', { + exception: ex, + text: lexer.match, + token: this.terminals_[symbol] || symbol, + token_id: symbol, + line: lexer.yylineno, + loc: lexer.yylloc, + // expected: expected, + recoverable: false, + state_stack: stack, + value_stack: vstack, + + lexer: lexer + }); } finally { var rv; if (sharedState.yy.post_parse) { - rv = sharedState.yy.post_parse.call(this, sharedState.yy, retval); + rv = sharedState.yy.post_parse.apply(this, [sharedState.yy, retval].concat(args)); if (typeof rv !== 'undefined') retval = rv; } if (this.post_parse) { - rv = this.post_parse.call(this, sharedState.yy, retval); + rv = this.post_parse.apply(this, [sharedState.yy, retval].concat(args)); if (typeof rv !== 'undefined') retval = rv; } } @@ -2860,9 +2525,9 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-112 */ +/* generated by jison-lex 0.3.4-119 */ var lexer = (function () { -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +// See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript function JisonLexerError(msg, hash) { this.message = msg; @@ -4095,7 +3760,7 @@ return lexer; })(); parser.lexer = lexer; -function Parser () { +function Parser() { this.yy = {}; } Parser.prototype = parser; diff --git a/package.json b/package.json index 0ed3639..93effb7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-119", + "version": "0.1.4-120", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 68eca9a444bc056e07202509642b923b0335e4f7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 22 Mar 2016 17:21:34 +0100 Subject: [PATCH 127/417] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 93effb7..a8434f8 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-120", + "version": "0.1.4-121", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From e0d0f2afbedd051cb56b013be43169b589698ea1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 22 Mar 2016 18:04:44 +0100 Subject: [PATCH 128/417] rebuild --- lex-parser.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index e7033c1..5681bcc 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-119 */ +/* parser generated by jison 0.4.17-121 */ /* * Returns a Parser object of the following structure: * @@ -28,6 +28,8 @@ * * symbols_: {associative list: name ==> number}, * terminals_: {associative list: number ==> name}, + * nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}}, + * terminal_descriptions_: (if there are any) {associative list: number ==> description}, * productions_: [...], * * performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, yystack, ...), @@ -2375,7 +2377,6 @@ parse: function parse(input) { // shift: case 1: //this.shiftCount++; - stack.push(symbol); vstack.push(lexer.yytext); @@ -2525,7 +2526,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-119 */ +/* generated by jison-lex 0.3.4-120 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript From b3863f96dad384b13ad46ac11baa6ec758cfe6b9 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 22 Mar 2016 19:01:10 +0100 Subject: [PATCH 129/417] rebuild --- lex-parser.js | 151 +------------------------------------------------- 1 file changed, 1 insertion(+), 150 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 5681bcc..8e128ce 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -474,155 +474,6 @@ terminals_: { 181: "PATH", 183: "CODE" }, -nonterminals_: { - "$accept": { - 0: "lex $end" - }, - "lex": { - 1: "init definitions %% rules_and_epilogue" - }, - "rules_and_epilogue": { - 2: "EOF", - 3: "%% extra_lexer_module_code EOF", - 4: "rules %% extra_lexer_module_code EOF", - 5: "rules EOF" - }, - "init": { - 6: "" - }, - "definitions": { - 7: "definition definitions", - 8: "" - }, - "definition": { - 9: "NAME regex", - 10: "START_INC names_inclusive", - 11: "START_EXC names_exclusive", - 12: "ACTION", - 13: "include_macro_code", - 14: "options", - 15: "UNKNOWN_DECL" - }, - "names_inclusive": { - 16: "START_COND", - 17: "names_inclusive START_COND" - }, - "names_exclusive": { - 18: "START_COND", - 19: "names_exclusive START_COND" - }, - "rules": { - 20: "rules rule", - 21: "rule" - }, - "rule": { - 22: "start_conditions regex action" - }, - "action": { - 23: "{ action_body }", - 24: "ACTION", - 25: "include_macro_code" - }, - "action_body": { - 26: "action_comments_body", - 27: "action_body { action_body } action_comments_body" - }, - "action_comments_body": { - 28: "", - 29: "action_comments_body ACTION_BODY" - }, - "start_conditions": { - 30: "< name_list >", - 31: "< * >", - 32: "" - }, - "name_list": { - 33: "NAME", - 34: "name_list , NAME" - }, - "regex": { - 35: "regex_list" - }, - "regex_list": { - 36: "regex_list | regex_concat", - 37: "regex_list |", - 38: "regex_concat", - 39: "" - }, - "regex_concat": { - 40: "regex_concat regex_base", - 41: "regex_base" - }, - "regex_base": { - 42: "( regex_list )", - 43: "SPECIAL_GROUP regex_list )", - 44: "regex_base +", - 45: "regex_base *", - 46: "regex_base ?", - 47: "/ regex_base", - 48: "/! regex_base", - 49: "name_expansion", - 50: "regex_base range_regex", - 51: "any_group_regex", - 52: ".", - 53: "^", - 54: "$", - 55: "string", - 56: "escape_char" - }, - "name_expansion": { - 57: "NAME_BRACE" - }, - "any_group_regex": { - 58: "REGEX_SET_START regex_set REGEX_SET_END" - }, - "regex_set": { - 59: "regex_set_atom regex_set", - 60: "regex_set_atom" - }, - "regex_set_atom": { - 61: "REGEX_SET", - 62: "name_expansion" - }, - "escape_char": { - 63: "ESCAPE_CHAR" - }, - "range_regex": { - 64: "RANGE_REGEX" - }, - "string": { - 65: "STRING_LIT", - 66: "CHARACTER_LIT" - }, - "options": { - 67: "OPTIONS option_list OPTIONS_END" - }, - "option_list": { - 68: "option option_list", - 69: "option" - }, - "option": { - 70: "NAME", - 71: "NAME = OPTION_VALUE", - 72: "NAME = NAME" - }, - "extra_lexer_module_code": { - 73: "optional_module_code_chunk", - 74: "optional_module_code_chunk include_macro_code extra_lexer_module_code" - }, - "include_macro_code": { - 75: "INCLUDE PATH", - 76: "INCLUDE error" - }, - "module_code_chunk": { - 77: "CODE", - 78: "module_code_chunk CODE" - }, - "optional_module_code_chunk": { - 79: "module_code_chunk", - 80: "" - } -}, productions_: bp({ pop: u([ 127, @@ -2526,7 +2377,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-120 */ +/* generated by jison-lex 0.3.4-121 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript From 673175a3bce86f9b754dcb13c85b2e448716b654 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 8 May 2016 17:44:46 +0200 Subject: [PATCH 130/417] bumped version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a8434f8..af9d991 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-121", + "version": "0.1.4-122", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 63b3f89822162c3f1bb0c2c200a1167964318757 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 28 May 2016 20:02:13 +0200 Subject: [PATCH 131/417] bump revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index af9d991..4b87761 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-122", + "version": "0.1.4-123", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 19fc3e4a0894824bc3e34e0ded12d4dfceb666c6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 28 May 2016 20:27:54 +0200 Subject: [PATCH 132/417] regenerated tool from scratch --- lex-parser.js | 346 ++++++++++++++++++++++++++++++-------------------- 1 file changed, 209 insertions(+), 137 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8e128ce..bffd245 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-121 */ +/* parser generated by jison 0.4.17-123 */ /* * Returns a Parser object of the following structure: * @@ -217,130 +217,160 @@ var lexParser = (function () { // See also: -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 +// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility +// with userland code which might access the derived class in a 'classic' way. function JisonParserError(msg, hash) { - this.message = msg; + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonParserError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + this.hash = hash; + var stacktrace; if (hash && hash.exception instanceof Error) { - var ex2 = hash.exception; - this.message = ex2.message || msg; - stacktrace = ex2.stack; + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; } if (!stacktrace) { - stacktrace = (new Error(msg)).stack; + if (Error.hasOwnProperty('captureStackTrace')) { // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = (new Error(msg)).stack; + } } if (stacktrace) { - this.stack = stacktrace; + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); } } -JisonParserError.prototype = Object.create(Error.prototype); + +if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonParserError.prototype, Error.prototype); +} else { + JisonParserError.prototype = Object.create(Error.prototype); +} JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; + // helper: reconstruct the productions[] table function bp(s) { - var rv = []; - var p = s.pop; - var r = s.rule; - for (var i = 0, l = p.length; i < l; i++) { - rv.push([ - p[i], - r[i] - ]); - } - return rv; + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); } + return rv; +} // helper: reconstruct the defaultActions[] table function bda(s) { - var rv = {}; - var d = s.idx; - var p = s.pop; - var r = s.rule; - for (var i = 0, l = d.length; i < l; i++) { - var j = d[i]; - rv[j] = [ - p[i], - r[i] - ]; - } - return rv; + var rv = {}; + var d = s.idx; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = [ + p[i], + r[i] + ]; } + return rv; +} // helper: reconstruct the 'goto' table function bt(s) { - var rv = []; - var d = s.len; - var y = s.symbol; - var t = s.type; - var a = s.state; - var m = s.mode; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var n = d[i]; - var q = {}; - for (var j = 0; j < n; j++) { - var z = y.shift(); - switch (t.shift()) { - case 2: - q[z] = [ - m.shift(), - g.shift() - ]; - break; + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; - case 0: - q[z] = a.shift(); - break; + case 0: + q[z] = a.shift(); + break; - default: - // type === 1: accept - q[z] = [ - 3 - ]; - } + default: + // type === 1: accept + q[z] = [ + 3 + ]; } - rv.push(q); } - return rv; + rv.push(q); } + return rv; +} // helper: runlength encoding with increment step: code, length: step (default step = 0) // `this` references an array function s(c, l, a) { - a = a || 0; - for (var i = 0; i < l; i++) { - this.push(c); - c += a; - } + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; } +} // helper: duplicate sequence from *relative* offset and length. // `this` references an array function c(i, l) { - i = this.length - i; - for (l += i; i < l; i++) { - this.push(this[i]); - } + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); } +} // helper: unpack an array using helpers and data, all passed in an array argument 'a'. function u(a) { - var rv = []; - for (var i = 0, l = a.length; i < l; i++) { - var e = a[i]; - // Is this entry a helper function? - if (typeof e === 'function') { - i++; - e.apply(rv, a[i]); - } else { - rv.push(e); - } + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); } - return rv; } + return rv; +} var parser = { EOF: 1, @@ -594,9 +624,9 @@ case 1 : /*! Production:: lex : init definitions '%%' rules_and_epilogue */ this.$ = $$[$0]; - if ($$[$0-2][0]) this.$.macros = $$[$0-2][0]; - if ($$[$0-2][1]) this.$.startConditions = $$[$0-2][1]; - if ($$[$0-2][2]) this.$.unknownDecls = $$[$0-2][2]; + if ($$[$0 - 2][0]) this.$.macros = $$[$0 - 2][0]; + if ($$[$0 - 2][1]) this.$.startConditions = $$[$0 - 2][1]; + if ($$[$0 - 2][2]) this.$.unknownDecls = $$[$0 - 2][2]; // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { @@ -624,8 +654,8 @@ break; case 3 : /*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ - if ($$[$0-1] && $$[$0-1].trim() !== '') { - this.$ = { rules: [], moduleInclude: $$[$0-1] }; + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + this.$ = { rules: [], moduleInclude: $$[$0 - 1] }; } else { this.$ = { rules: [] }; } @@ -634,17 +664,17 @@ break; case 4 : /*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code EOF */ - if ($$[$0-1] && $$[$0-1].trim() !== '') { - this.$ = { rules: $$[$0-3], moduleInclude: $$[$0-1] }; + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + this.$ = { rules: $$[$0 - 3], moduleInclude: $$[$0 - 1] }; } else { - this.$ = { rules: $$[$0-3] }; + this.$ = { rules: $$[$0 - 3] }; } break; case 5 : /*! Production:: rules_and_epilogue : rules EOF */ - this.$ = { rules: $$[$0-1] }; + this.$ = { rules: $$[$0 - 1] }; break; case 6 : @@ -658,18 +688,18 @@ case 7 : /*! Production:: definitions : definition definitions */ this.$ = $$[$0]; - if ($$[$0-1] != null) { - if ('length' in $$[$0-1]) { + if ($$[$0 - 1] != null) { + if ('length' in $$[$0 - 1]) { this.$[0] = this.$[0] || {}; - this.$[0][$$[$0-1][0]] = $$[$0-1][1]; - } else if ($$[$0-1].type === 'names') { + this.$[0][$$[$0 - 1][0]] = $$[$0 - 1][1]; + } else if ($$[$0 - 1].type === 'names') { this.$[1] = this.$[1] || {}; - for (var name in $$[$0-1].names) { - this.$[1][name] = $$[$0-1].names[name]; + for (var name in $$[$0 - 1].names) { + this.$[1][name] = $$[$0 - 1].names[name]; } - } else if ($$[$0-1].type === 'unknown') { + } else if ($$[$0 - 1].type === 'unknown') { this.$[2] = this.$[2] || []; - this.$[2].push($$[$0-1].body); + this.$[2].push($$[$0 - 1].body); } } @@ -680,7 +710,7 @@ case 8 : break; case 9 : /*! Production:: definition : NAME regex */ - this.$ = [$$[$0-1], $$[$0]]; + this.$ = [$$[$0 - 1], $$[$0]]; break; case 10 : /*! Production:: definition : START_INC names_inclusive */ @@ -724,7 +754,7 @@ case 16 : break; case 17 : /*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0-1]; this.$.names[$$[$0]] = 0; + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; break; case 18 : /*! Production:: names_exclusive : START_COND */ @@ -732,11 +762,11 @@ case 18 : break; case 19 : /*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0-1]; this.$.names[$$[$0]] = 1; + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; break; case 20 : /*! Production:: rules : rules rule */ - this.$ = $$[$0-1]; this.$.push($$[$0]); + this.$ = $$[$0 - 1]; this.$.push($$[$0]); break; case 21 : /*! Production:: rules : rule */ @@ -746,17 +776,17 @@ case 21 : break; case 22 : /*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1], $$[$0]]; + this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; break; case 23 : /*! Production:: action : '{' action_body '}' */ case 30 : /*! Production:: start_conditions : '<' name_list '>' */ - this.$ = $$[$0-1]; + this.$ = $$[$0 - 1]; break; case 27 : /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ - this.$ = $$[$0-4] + $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; + this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; case 28 : /*! Production:: action_comments_body : */ @@ -776,7 +806,7 @@ case 29 : /*! Production:: regex_set : regex_set_atom regex_set */ case 78 : /*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = $$[$0-1] + $$[$0]; + this.$ = $$[$0 - 1] + $$[$0]; break; case 31 : /*! Production:: start_conditions : '<' '*' '>' */ @@ -784,7 +814,7 @@ case 31 : break; case 34 : /*! Production:: name_list : name_list ',' NAME */ - this.$ = $$[$0-2]; this.$.push($$[$0]); + this.$ = $$[$0 - 2]; this.$.push($$[$0]); break; case 35 : /*! Production:: regex : regex_list */ @@ -797,31 +827,31 @@ case 35 : break; case 36 : /*! Production:: regex_list : regex_list '|' regex_concat */ - this.$ = $$[$0-2] + '|' + $$[$0]; + this.$ = $$[$0 - 2] + '|' + $$[$0]; break; case 37 : /*! Production:: regex_list : regex_list '|' */ - this.$ = $$[$0-1] + '|'; + this.$ = $$[$0 - 1] + '|'; break; case 42 : /*! Production:: regex_base : '(' regex_list ')' */ - this.$ = '(' + $$[$0-1] + ')'; + this.$ = '(' + $$[$0 - 1] + ')'; break; case 43 : /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ - this.$ = $$[$0-2] + $$[$0-1] + ')'; + this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; break; case 44 : /*! Production:: regex_base : regex_base '+' */ - this.$ = $$[$0-1] + '+'; + this.$ = $$[$0 - 1] + '+'; break; case 45 : /*! Production:: regex_base : regex_base '*' */ - this.$ = $$[$0-1] + '*'; + this.$ = $$[$0 - 1] + '*'; break; case 46 : /*! Production:: regex_base : regex_base '?' */ - this.$ = $$[$0-1] + '?'; + this.$ = $$[$0 - 1] + '?'; break; case 47 : /*! Production:: regex_base : '/' regex_base */ @@ -847,7 +877,7 @@ case 58 : /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ case 74 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = $$[$0-2] + $$[$0-1] + $$[$0]; + this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; case 62 : /*! Production:: regex_set_atom : name_expansion */ @@ -872,7 +902,7 @@ case 71 : /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ case 72 : /*! Production:: option : NAME[option] '=' NAME[value] */ - yy.options[$$[$0-2]] = $$[$0]; + yy.options[$$[$0 - 2]] = $$[$0]; break; case 75 : /*! Production:: include_macro_code : INCLUDE PATH */ @@ -2107,7 +2137,8 @@ parse: function parse(input) { } r = this.parseError(errStr, p = { text: lexer.match, - token: this.terminals_[symbol] || symbol, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, token_id: symbol, line: lexer.yylineno, loc: lexer.yylloc, @@ -2134,7 +2165,8 @@ parse: function parse(input) { if (symbol === EOF || preErrorSymbol === EOF) { retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { text: lexer.match, - token: this.terminals_[symbol] || symbol, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, token_id: symbol, line: lexer.yylineno, loc: lexer.yylloc, @@ -2162,7 +2194,8 @@ parse: function parse(input) { if (error_rule_depth === false) { retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { text: lexer.match, - token: this.terminals_[symbol] || symbol, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, token_id: symbol, line: lexer.yylineno, loc: lexer.yylloc, @@ -2195,7 +2228,8 @@ parse: function parse(input) { if (action[0] instanceof Array) { retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { text: lexer.match, - token: this.terminals_[symbol] || symbol, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, token_id: symbol, line: lexer.yylineno, loc: lexer.yylloc, @@ -2212,7 +2246,8 @@ parse: function parse(input) { // or a buggy LUT (LookUp Table): retval = this.parseError('Parsing halted. No viable error recovery approach available due to internal system failure.', { text: lexer.match, - token: this.terminals_[symbol] || symbol, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, token_id: symbol, line: lexer.yylineno, loc: lexer.yylloc, @@ -2335,7 +2370,8 @@ parse: function parse(input) { retval = this.parseError('Parsing aborted due to exception.', { exception: ex, text: lexer.match, - token: this.terminals_[symbol] || symbol, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, token_id: symbol, line: lexer.yylineno, loc: lexer.yylloc, @@ -2377,21 +2413,59 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-121 */ +/* generated by jison-lex 0.3.4-123 */ var lexer = (function () { // See also: -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 +// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility +// with userland code which might access the derived class in a 'classic' way. function JisonLexerError(msg, hash) { - this.message = msg; + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonLexerError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + this.hash = hash; - var stacktrace = (new Error(msg)).stack; + + var stacktrace; + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = (new Error(msg)).stack; + } + } if (stacktrace) { - this.stack = stacktrace; + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); } } -JisonLexerError.prototype = Object.create(Error.prototype); -JisonLexerError.prototype.constructor = JisonLexerError; -JisonLexerError.prototype.name = 'JisonLexerError'; + + if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); + } else { + JisonLexerError.prototype = Object.create(Error.prototype); + } + JisonLexerError.prototype.constructor = JisonLexerError; + JisonLexerError.prototype.name = 'JisonLexerError'; + var lexer = { @@ -3607,7 +3681,6 @@ conditions: { } }; -// lexer.JisonLexerError = JisonLexerError; return lexer; })(); parser.lexer = lexer; @@ -3617,7 +3690,6 @@ function Parser() { } Parser.prototype = parser; parser.Parser = Parser; -// parser.JisonParserError = JisonParserError; return new Parser(); })(); @@ -3626,10 +3698,10 @@ return new Parser(); if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = lexParser; -exports.Parser = lexParser.Parser; -exports.parse = function () { - return lexParser.parse.apply(lexParser, arguments); -}; + exports.parser = lexParser; + exports.Parser = lexParser.Parser; + exports.parse = function () { + return lexParser.parse.apply(lexParser, arguments); + }; } From 89c3e8ec8bb72a2f164dd737d2319f4ee455bd99 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 28 May 2016 21:18:45 +0200 Subject: [PATCH 133/417] apply the new %empty/%epsilon feature to the tool grammar itself --- lex.y | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lex.y b/lex.y index c6bbcb8..25bf71a 100644 --- a/lex.y +++ b/lex.y @@ -63,7 +63,7 @@ rules_and_epilogue // because JISON doesn't support mid-rule actions, we set up `yy` using this empty rule at the start: init - : + : %epsilon { yy.actionInclude = []; if (!yy.options) yy.options = {}; @@ -89,7 +89,7 @@ definitions } } } - | + | %epsilon { $$ = [null, null]; } ; @@ -153,7 +153,7 @@ action_body ; action_comments_body - : + : %epsilon { $$ = ''; } | action_comments_body ACTION_BODY { $$ = $action_comments_body + $ACTION_BODY; } @@ -190,7 +190,7 @@ regex_list | regex_list '|' { $$ = $1 + '|'; } | regex_concat - | + | %epsilon { $$ = ''; } ; @@ -322,7 +322,7 @@ module_code_chunk optional_module_code_chunk : module_code_chunk { $$ = $module_code_chunk; } - | /* nil */ + | %epsilon { $$ = ''; } ; From cdd55f07e5b7718fb2f12d6d8411028b6757de79 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 31 May 2016 18:11:41 +0200 Subject: [PATCH 134/417] bump revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4b87761..e9203ad 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-123", + "version": "0.1.4-124", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 9c6bd98c32f4880c87c1d9325781255a39f89fe0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Jun 2016 12:31:35 +0200 Subject: [PATCH 135/417] add full Unicode support for IDs and NAMEs in jison grammars. --- lex-parser.js | 14 +++++++------- lex.l | 20 ++++++++++++++++++-- 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index bffd245..a7b4fd3 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3279,7 +3279,7 @@ rules: [ /^(?:[^{}\/"']+)/, /^(?:\{)/, /^(?:\})/, -/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, +/^(?:([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_](?:[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™-]*[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™])?))/, /^(?:>)/, /^(?:,)/, /^(?:\*)/, @@ -3288,14 +3288,14 @@ rules: [ /^(?:\s+)/, /^(?:%%)/, /^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+)/, -/^(?:([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?))/, +/^(?:([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_](?:[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™-]*[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™])?))/, /^(?:=)/, /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, /^(?:[^\s\r\n]+)/, /^(?:(\r\n|\n|\r)+)/, /^(?:([^\S\r\n])+)/, -/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/, +/^(?:([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_][A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™]*))/, /^(?:(\r\n|\n|\r)+)/, /^(?:([^\S\r\n])+)/, /^(?:([^\S\r\n])*(\r\n|\n|\r)+)/, @@ -3306,7 +3306,7 @@ rules: [ /^(?:.+)/, /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/.*)/, -/^(?:([a-zA-Z_][a-zA-Z0-9_]*))/, +/^(?:([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_][A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™]*))/, /^(?:(\r\n|\n|\r)+)/, /^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+)/, /^(?:(\r\n|\n|\r)+)/, @@ -3337,11 +3337,11 @@ rules: [ /^(?:%s\b)/, /^(?:%x\b)/, /^(?:%include\b)/, -/^(?:%([a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])?)[^\r\n]+)/, +/^(?:%([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_](?:[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™-]*[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™])?)[^\r\n]+)/, /^(?:%%)/, /^(?:\{\d+(,\s?\d+|,)?\})/, -/^(?:\{([a-zA-Z_][a-zA-Z0-9_]*)\})/, -/^(?:\{([a-zA-Z_][a-zA-Z0-9_]*)\})/, +/^(?:\{([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_][A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™]*)\})/, +/^(?:\{([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_][A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™]*)\})/, /^(?:\{)/, /^(?:\})/, /^(?:.)/, diff --git a/lex.l b/lex.l index 7987c34..2b3ca3c 100644 --- a/lex.l +++ b/lex.l @@ -1,6 +1,13 @@ -NAME [a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])? -ID [a-zA-Z_][a-zA-Z0-9_]* +ASCII_LETTER [a-zA-z] +// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge with {UNICODE_LETTER}: +UNICODE_LETTER [\p{Alphabetic}] +ALPHA [{UNICODE_LETTER}_] +DIGIT [\p{Number}] +WHITESPACE [\s\r\n\p{Separator}] + +NAME [{ALPHA}](?:[{ALPHA}{DIGIT}-]*[{ALPHA}{DIGIT}])? +ID [{ALPHA}][{ALPHA}{DIGIT}]* BR \r\n|\n|\r // WhiteSpace MUST NOT match CR/LF and the regex `\s` DOES, so we cannot use that one directly. // Instead we define the {WS} macro here: @@ -10,6 +17,15 @@ WS [^\S\r\n] %s indented trail rules macro %x code start_condition options conditions action path set + +// Off Topic +// --------- +// +// Do not specify the xregexp option as we want the XRegExp \p{...} regex macros converted to +// native regexes and used as such: +// +// %options xregexp + %options easy_keyword_rules %options ranges From fd4370d22535fcbad57c837df01ff6162e7ca05f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Jun 2016 16:03:31 +0200 Subject: [PATCH 136/417] - 'easy keyword rules' option now only accepts lexer rules which *only* carry a keyword (without any non-keyword prefix) - 'easy keyword rules' option now accepts Unicode/hex/octal escapes (as long as these produce a 'alphanumeric' character i.e. part of the keyword) and Unicode literals - bump revision --- lex-parser.js | 157 +++++++++++++++++++++++---------------------- lex.y | 29 ++++++++- package.json | 2 +- tests/all-tests.js | 12 ++-- 4 files changed, 115 insertions(+), 85 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index a7b4fd3..6213126 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -622,8 +622,7 @@ var $0 = $$.length - 1; switch (yystate) { case 1 : /*! Production:: lex : init definitions '%%' rules_and_epilogue */ - - this.$ = $$[$0]; + this.$ = $$[$0]; if ($$[$0 - 2][0]) this.$.macros = $$[$0 - 2][0]; if ($$[$0 - 2][1]) this.$.startConditions = $$[$0 - 2][1]; if ($$[$0 - 2][2]) this.$.unknownDecls = $$[$0 - 2][2]; @@ -642,52 +641,40 @@ case 1 : } delete yy.options; delete yy.actionInclude; - return this.$; - + return this.$; break; case 2 : /*! Production:: rules_and_epilogue : EOF */ - - this.$ = { rules: [] }; - + this.$ = { rules: [] }; break; case 3 : /*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ - - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { this.$ = { rules: [], moduleInclude: $$[$0 - 1] }; } else { this.$ = { rules: [] }; - } - + } break; case 4 : /*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code EOF */ - - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { this.$ = { rules: $$[$0 - 3], moduleInclude: $$[$0 - 1] }; } else { this.$ = { rules: $$[$0 - 3] }; - } - + } break; case 5 : /*! Production:: rules_and_epilogue : rules EOF */ - - this.$ = { rules: $$[$0 - 1] }; - + this.$ = { rules: $$[$0 - 1] }; break; case 6 : /*! Production:: init : */ - - yy.actionInclude = []; - if (!yy.options) yy.options = {}; - + yy.actionInclude = []; + if (!yy.options) yy.options = {}; break; case 7 : /*! Production:: definitions : definition definitions */ - - this.$ = $$[$0]; + this.$ = $$[$0]; if ($$[$0 - 1] != null) { if ('length' in $$[$0 - 1]) { this.$[0] = this.$[0] || {}; @@ -701,16 +688,15 @@ case 7 : this.$[2] = this.$[2] || []; this.$[2].push($$[$0 - 1].body); } - } - + } break; case 8 : /*! Production:: definitions : */ - this.$ = [null, null]; + this.$ = [null, null]; break; case 9 : /*! Production:: definition : NAME regex */ - this.$ = [$$[$0 - 1], $$[$0]]; + this.$ = [$$[$0 - 1], $$[$0]]; break; case 10 : /*! Production:: definition : START_INC names_inclusive */ @@ -732,61 +718,61 @@ case 10 : /*! Production:: module_code_chunk : CODE */ case 79 : /*! Production:: optional_module_code_chunk : module_code_chunk */ - this.$ = $$[$0]; + this.$ = $$[$0]; break; case 12 : /*! Production:: definition : ACTION */ case 13 : /*! Production:: definition : include_macro_code */ - yy.actionInclude.push($$[$0]); this.$ = null; + yy.actionInclude.push($$[$0]); this.$ = null; break; case 14 : /*! Production:: definition : options */ - this.$ = null; + this.$ = null; break; case 15 : /*! Production:: definition : UNKNOWN_DECL */ - this.$ = {type: 'unknown', body: $$[$0]}; + this.$ = {type: 'unknown', body: $$[$0]}; break; case 16 : /*! Production:: names_inclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; break; case 17 : /*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; break; case 18 : /*! Production:: names_exclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; break; case 19 : /*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; break; case 20 : /*! Production:: rules : rules rule */ - this.$ = $$[$0 - 1]; this.$.push($$[$0]); + this.$ = $$[$0 - 1]; this.$.push($$[$0]); break; case 21 : /*! Production:: rules : rule */ case 33 : /*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; + this.$ = [$$[$0]]; break; case 22 : /*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; + this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; break; case 23 : /*! Production:: action : '{' action_body '}' */ case 30 : /*! Production:: start_conditions : '<' name_list '>' */ - this.$ = $$[$0 - 1]; + this.$ = $$[$0 - 1]; break; case 27 : /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ - this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; case 28 : /*! Production:: action_comments_body : */ @@ -794,7 +780,7 @@ case 28 : /*! Production:: regex_list : */ case 80 : /*! Production:: optional_module_code_chunk : */ - this.$ = ''; + this.$ = ''; break; case 29 : /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ @@ -806,118 +792,135 @@ case 29 : /*! Production:: regex_set : regex_set_atom regex_set */ case 78 : /*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = $$[$0 - 1] + $$[$0]; + this.$ = $$[$0 - 1] + $$[$0]; break; case 31 : /*! Production:: start_conditions : '<' '*' '>' */ - this.$ = ['*']; + this.$ = ['*']; break; case 34 : /*! Production:: name_list : name_list ',' NAME */ - this.$ = $$[$0 - 2]; this.$.push($$[$0]); + this.$ = $$[$0 - 2]; this.$.push($$[$0]); break; case 35 : /*! Production:: regex : regex_list */ - + // Detect if the regex is a pure (Unicode) word; + // we *do* consider escaped characters which are 'alphanumeric' to be equivalent to their non-escaped version, + // hence these are all valid 'words' for the 'easy keyword rules' option: + // + // - hello_kitty + // - γεια_σου_γατοÏλα + // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 + // + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicodeAAA#12869914 + // this.$ = $$[$0]; - if (yy.options.easy_keyword_rules && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { - this.$ += "\\b"; - } - + if (yy.options.easy_keyword_rules && !this.$.match(/\\[^ux0-9]|"/)) { + try { + // no need to 'protect' JSON.parse here through `AAA$AAA$.replace(/"/g, '\\"')` as we already checked + // against that occasion above: keywords are not allowed to contain double-quotes anyway. + // JSON.parse *does* gobble some escapes (such as `\b`) but we protect against that through + // the simple regex in the condition above. It will also catch escaped escapes (`\\`), which + // cannot be part of a keyword either, so no need to worry about JSON.parse 'correctly' + // converting convoluted constructs like '\\\\\\\\\\b' in here. + this.$ = JSON.parse('"' + this.$ + '"'); + if (this.$.match(/^[\w\d]+$/u)) { + this.$ = $$[$0] + "\\b"; + } else { + this.$ = $$[$0]; + } + } catch (ex) { + this.$ = $$[$0]; + } + } break; case 36 : /*! Production:: regex_list : regex_list '|' regex_concat */ - this.$ = $$[$0 - 2] + '|' + $$[$0]; + this.$ = $$[$0 - 2] + '|' + $$[$0]; break; case 37 : /*! Production:: regex_list : regex_list '|' */ - this.$ = $$[$0 - 1] + '|'; + this.$ = $$[$0 - 1] + '|'; break; case 42 : /*! Production:: regex_base : '(' regex_list ')' */ - this.$ = '(' + $$[$0 - 1] + ')'; + this.$ = '(' + $$[$0 - 1] + ')'; break; case 43 : /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; + this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; break; case 44 : /*! Production:: regex_base : regex_base '+' */ - this.$ = $$[$0 - 1] + '+'; + this.$ = $$[$0 - 1] + '+'; break; case 45 : /*! Production:: regex_base : regex_base '*' */ - this.$ = $$[$0 - 1] + '*'; + this.$ = $$[$0 - 1] + '*'; break; case 46 : /*! Production:: regex_base : regex_base '?' */ - this.$ = $$[$0 - 1] + '?'; + this.$ = $$[$0 - 1] + '?'; break; case 47 : /*! Production:: regex_base : '/' regex_base */ - this.$ = '(?=' + $$[$0] + ')'; + this.$ = '(?=' + $$[$0] + ')'; break; case 48 : /*! Production:: regex_base : '/!' regex_base */ - this.$ = '(?!' + $$[$0] + ')'; + this.$ = '(?!' + $$[$0] + ')'; break; case 52 : /*! Production:: regex_base : '.' */ - this.$ = '.'; + this.$ = '.'; break; case 53 : /*! Production:: regex_base : '^' */ - this.$ = '^'; + this.$ = '^'; break; case 54 : /*! Production:: regex_base : '$' */ - this.$ = '$'; + this.$ = '$'; break; case 58 : /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ case 74 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; case 62 : /*! Production:: regex_set_atom : name_expansion */ - - if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { + if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { // treat this as part of an XRegExp `\p{...}` Unicode slug: this.$ = $$[$0]; } else { this.$ = '{[' + $$[$0] + ']}'; - } - + } break; case 65 : /*! Production:: string : STRING_LIT */ - this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); + this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; case 70 : /*! Production:: option : NAME[option] */ - yy.options[$$[$0]] = true; + yy.options[$$[$0]] = true; break; case 71 : /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ case 72 : /*! Production:: option : NAME[option] '=' NAME[value] */ - yy.options[$$[$0 - 2]] = $$[$0]; + yy.options[$$[$0 - 2]] = $$[$0]; break; case 75 : /*! Production:: include_macro_code : INCLUDE PATH */ - - var fs = require('fs'); + var fs = require('fs'); var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); // And no, we don't support nested '%include': - this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; - + this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; break; case 76 : /*! Production:: include_macro_code : INCLUDE error */ - - console.error("%include MUST be followed by a valid file path"); - + console.error("%include MUST be followed by a valid file path"); break; } }, diff --git a/lex.y b/lex.y index 25bf71a..f195141 100644 --- a/lex.y +++ b/lex.y @@ -177,9 +177,34 @@ name_list regex : regex_list { + // Detect if the regex is a pure (Unicode) word; + // we *do* consider escaped characters which are 'alphanumeric' to be equivalent to their non-escaped version, + // hence these are all valid 'words' for the 'easy keyword rules' option: + // + // - hello_kitty + // - γεια_σου_γατοÏλα + // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 + // + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // $$ = $regex_list; - if (yy.options.easy_keyword_rules && $$.match(/[\w\d]$/) && !$$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { - $$ += "\\b"; + if (yy.options.easy_keyword_rules && !$$.match(/\\[^ux0-9]|"/)) { + try { + // no need to 'protect' JSON.parse here through `$$.replace(/"/g, '\\"')` as we already checked + // against that occasion above: keywords are not allowed to contain double-quotes anyway. + // JSON.parse *does* gobble some escapes (such as `\b`) but we protect against that through + // the simple regex in the condition above. It will also catch escaped escapes (`\\`), which + // cannot be part of a keyword either, so no need to worry about JSON.parse 'correctly' + // converting convoluted constructs like '\\\\\\\\\\b' in here. + $$ = JSON.parse('"' + $$ + '"'); + if ($$.match(/^[\w\d]+$/u)) { + $$ = $regex_list + "\\b"; + } else { + $$ = $regex_list; + } + } catch (ex) { + $$ = $regex_list; + } } } ; diff --git a/package.json b/package.json index e9203ad..ad2b6d0 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-124", + "version": "0.1.4-126", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { diff --git a/tests/all-tests.js b/tests/all-tests.js index a4a8a78..084e002 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -510,6 +510,7 @@ exports["test %options easy_keyword_rules"] = function () { var lexgrammar = '%options easy_keyword_rules\n'+ '%s TEST TEST2\n%x EAT\n%%\n'+ '"enter-test" {this.begin(\'TEST\');}\n'+ + '"enter_test" {this.begin(\'TEST\');}\n'+ '"x" {return \'T\';}\n'+ '<*>"z" {return \'Z\';}\n'+ '"y" {this.begin(\'INITIAL\'); return \'TY\';}\n'+ @@ -523,19 +524,20 @@ exports["test %options easy_keyword_rules"] = function () { "EAT": 1, }, rules: [ - ["enter-test\\b", "this.begin('TEST');" ], + ["enter-test", "this.begin('TEST');" ], // '-' dash is NOT accepted as being part of a *keyword*, hence no automatic `\b` word-boundary check added! + ["enter_test\\b", "this.begin('TEST');" ], [["TEST","EAT"], "x\\b", "return 'T';" ], [["*"], "z\\b", "return 'Z';" ], [["TEST"], "y\\b", "this.begin('INITIAL'); return 'TY';" ], - ["\"'a\\b", "return 1;"], - ["\"'\\\\\\*i\\b", "return 1;"], + ["\"'a", "return 1;"], // only keywords *without any non-keyword prefix*, i.e. keywords 'on their own', get the special 'easy keyword' treatment! + ["\"'\\\\\\*i", "return 1;"], ["a\\b", "return 2;"], ["\\cA", ""], ["\\012", ""], ["\\xFF", ""], ["\\[[^\\\\]\\]", "return true;"], - ["f\"oo'bar\\b", "return 'baz2';"], - ['fo"obar\\b', "return 'baz';"] + ["f\"oo'bar", "return 'baz2';"], + ['fo"obar', "return 'baz';"] ], options: { "easy_keyword_rules": true From b81caabe307871dd36c7cd53ffe6dab5e06d3f26 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Jun 2016 17:03:55 +0200 Subject: [PATCH 137/417] regenerated parser --- lex-parser.js | 574 +++++++++++++++++++++++++------------------------- 1 file changed, 288 insertions(+), 286 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 6213126..52af80c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -393,74 +393,74 @@ symbols_: { ",": 44, ".": 46, "/": 47, - "/!": 158, + "/!": 157, "<": 60, "=": 61, ">": 62, "?": 63, - "ACTION": 142, - "ACTION_BODY": 152, - "CHARACTER_LIT": 173, - "CODE": 183, - "EOF": 132, - "ESCAPE_CHAR": 170, - "INCLUDE": 180, - "NAME": 136, - "NAME_BRACE": 164, - "OPTIONS": 174, - "OPTIONS_END": 176, - "OPTION_VALUE": 178, - "PATH": 181, - "RANGE_REGEX": 171, - "REGEX_SET": 169, - "REGEX_SET_END": 167, - "REGEX_SET_START": 165, - "SPECIAL_GROUP": 157, - "START_COND": 146, - "START_EXC": 140, - "START_INC": 138, - "STRING_LIT": 172, - "UNKNOWN_DECL": 145, + "ACTION": 141, + "ACTION_BODY": 151, + "CHARACTER_LIT": 172, + "CODE": 182, + "EOF": 1, + "ESCAPE_CHAR": 169, + "INCLUDE": 179, + "NAME": 135, + "NAME_BRACE": 163, + "OPTIONS": 173, + "OPTIONS_END": 175, + "OPTION_VALUE": 177, + "PATH": 180, + "RANGE_REGEX": 170, + "REGEX_SET": 168, + "REGEX_SET_END": 166, + "REGEX_SET_START": 164, + "SPECIAL_GROUP": 156, + "START_COND": 145, + "START_EXC": 139, + "START_INC": 137, + "STRING_LIT": 171, + "UNKNOWN_DECL": 144, "^": 94, - "action": 149, - "action_body": 150, - "action_comments_body": 151, - "any_group_regex": 161, - "definition": 135, + "action": 148, + "action_body": 149, + "action_comments_body": 150, + "any_group_regex": 160, + "definition": 134, "definitions": 129, "error": 2, - "escape_char": 163, - "extra_lexer_module_code": 133, - "include_macro_code": 143, + "escape_char": 162, + "extra_lexer_module_code": 132, + "include_macro_code": 142, "init": 128, "lex": 127, - "module_code_chunk": 182, - "name_expansion": 159, - "name_list": 153, - "names_exclusive": 141, - "names_inclusive": 139, - "option": 177, - "option_list": 175, - "optional_module_code_chunk": 179, - "options": 144, - "range_regex": 160, - "regex": 137, - "regex_base": 156, - "regex_concat": 155, - "regex_list": 154, - "regex_set": 166, - "regex_set_atom": 168, - "rule": 147, - "rules": 134, + "module_code_chunk": 181, + "name_expansion": 158, + "name_list": 152, + "names_exclusive": 140, + "names_inclusive": 138, + "option": 176, + "option_list": 174, + "optional_module_code_chunk": 178, + "options": 143, + "range_regex": 159, + "regex": 136, + "regex_base": 155, + "regex_concat": 154, + "regex_list": 153, + "regex_set": 165, + "regex_set_atom": 167, + "rule": 146, + "rules": 133, "rules_and_epilogue": 131, - "start_conditions": 148, - "string": 162, + "start_conditions": 147, + "string": 161, "{": 123, "|": 124, "}": 125 }, terminals_: { - 1: "$end", + 1: "EOF", 2: "error", 36: "$", 40: "(", @@ -479,30 +479,29 @@ terminals_: { 124: "|", 125: "}", 130: "%%", - 132: "EOF", - 136: "NAME", - 138: "START_INC", - 140: "START_EXC", - 142: "ACTION", - 145: "UNKNOWN_DECL", - 146: "START_COND", - 152: "ACTION_BODY", - 157: "SPECIAL_GROUP", - 158: "/!", - 164: "NAME_BRACE", - 165: "REGEX_SET_START", - 167: "REGEX_SET_END", - 169: "REGEX_SET", - 170: "ESCAPE_CHAR", - 171: "RANGE_REGEX", - 172: "STRING_LIT", - 173: "CHARACTER_LIT", - 174: "OPTIONS", - 176: "OPTIONS_END", - 178: "OPTION_VALUE", - 180: "INCLUDE", - 181: "PATH", - 183: "CODE" + 135: "NAME", + 137: "START_INC", + 139: "START_EXC", + 141: "ACTION", + 144: "UNKNOWN_DECL", + 145: "START_COND", + 151: "ACTION_BODY", + 156: "SPECIAL_GROUP", + 157: "/!", + 163: "NAME_BRACE", + 164: "REGEX_SET_START", + 166: "REGEX_SET_END", + 168: "REGEX_SET", + 169: "ESCAPE_CHAR", + 170: "RANGE_REGEX", + 171: "STRING_LIT", + 172: "CHARACTER_LIT", + 173: "OPTIONS", + 175: "OPTIONS_END", + 177: "OPTION_VALUE", + 179: "INCLUDE", + 180: "PATH", + 182: "CODE" }, productions_: bp({ pop: u([ @@ -513,54 +512,54 @@ productions_: bp({ 129, 129, s, - [135, 7], - 139, - 139, - 141, - 141, - 134, - 134, - 147, + [134, 7], + 138, + 138, + 140, + 140, + 133, + 133, + 146, s, - [149, 3], + [148, 3], + 149, + 149, 150, 150, - 151, - 151, s, - [148, 3], - 153, - 153, - 137, + [147, 3], + 152, + 152, + 136, s, - [154, 4], - 155, - 155, + [153, 4], + 154, + 154, s, - [156, 15], - 159, - 161, - 166, - 166, - 168, - 168, - 163, + [155, 15], + 158, 160, + 165, + 165, + 167, + 167, 162, - 162, - 144, - 175, - 175, - s, - [177, 3], - 133, - 133, - 143, + 159, + 161, + 161, 143, - 182, - 182, - 179, - 179 + 174, + 174, + s, + [176, 3], + 132, + 132, + 142, + 142, + 181, + 181, + 178, + 178 ]), rule: u([ 4, @@ -668,7 +667,7 @@ case 5 : this.$ = { rules: $$[$0 - 1] }; break; case 6 : -/*! Production:: init : */ +/*! Production:: init : ε */ yy.actionInclude = []; if (!yy.options) yy.options = {}; break; @@ -691,7 +690,7 @@ case 7 : } break; case 8 : -/*! Production:: definitions : */ +/*! Production:: definitions : ε */ this.$ = [null, null]; break; case 9 : @@ -775,11 +774,11 @@ case 27 : this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; case 28 : -/*! Production:: action_comments_body : */ +/*! Production:: action_comments_body : ε */ case 39 : -/*! Production:: regex_list : */ +/*! Production:: regex_list : ε */ case 80 : -/*! Production:: optional_module_code_chunk : */ +/*! Production:: optional_module_code_chunk : ε */ this.$ = ''; break; case 29 : @@ -812,12 +811,12 @@ case 35 : // - γεια_σου_γατοÏλα // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 // - // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicodeAAA#12869914 + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 // this.$ = $$[$0]; if (yy.options.easy_keyword_rules && !this.$.match(/\\[^ux0-9]|"/)) { try { - // no need to 'protect' JSON.parse here through `AAA$AAA$.replace(/"/g, '\\"')` as we already checked + // no need to 'protect' JSON.parse here through `$$.replace(/"/g, '\\"')` as we already checked // against that occasion above: keywords are not allowed to contain double-quotes anyway. // JSON.parse *does* gobble some escapes (such as `\b`) but we protect against that through // the simple regex in the condition above. It will also catch escaped escapes (`\\`), which @@ -1026,18 +1025,18 @@ table: bt({ 128, 130, s, - [136, 4, 2], - 145, - 174, - 180, + [135, 4, 2], + 144, + 173, + 179, 1, 129, 130, - 135, + 134, c, [11, 4], + 142, 143, - 144, c, [13, 3], 130, @@ -1050,55 +1049,55 @@ table: bt({ 94, 124, 130, + 135, 136, - 137, c, [41, 4], s, - [154, 6, 1], + [153, 6, 1], s, - [161, 5, 1], - 170, + [160, 5, 1], + 169, + 171, 172, 173, - 174, - 180, - 139, - 146, - 141, - 146, + 179, + 138, + 145, + 140, + 145, c, [67, 8], c, [8, 24], 2, - 181, - 136, - 175, - 177, + 180, + 135, + 174, + 176, + 1, c, - [70, 4], + [71, 4], 60, 94, 123, 124, 130, 131, - 132, - 134, - 142, + 133, + 141, + 146, 147, - 148, + 156, 157, - 158, c, [65, 5], - 180, + 179, 130, c, [37, 8], c, - [26, 3], + [25, 3], c, [10, 7], 36, @@ -1119,13 +1118,13 @@ table: bt({ 63, c, [31, 9], + 156, 157, - 158, - 160, + 159, c, [27, 3], s, - [171, 4, 1], + [170, 4, 1], c, [56, 7], 124, @@ -1143,47 +1142,45 @@ table: bt({ [103, 11], c, [27, 180], - 167, - s, - [169, 6, 1], - 180, - 159, - 164, 166, + s, + [168, 6, 1], + 179, + 158, + 163, + 165, + 167, 168, - 169, c, [115, 81], c, [16, 6], - 146, + 145, c, [9, 29], c, - [514, 9], - 132, + [514, 10], c, [61, 10], c, [60, 4], - 183, + 182, c, [25, 25], - 176, - 136, + 175, + 135, + 174, 175, 176, - 177, 61, - 136, - 176, - 1, - 1, + 135, + 175, + s, + [1, 3], 132, - 133, + 178, 179, - 180, - 182, + 181, c, [41, 11], c, @@ -1191,17 +1188,19 @@ table: bt({ c, [21, 11], c, - [19, 12], + [19, 8], c, - [18, 3], - 137, - 142, + [463, 5], + 123, + 124, + 136, + 141, c, [503, 14], - 180, + 179, 42, - 136, - 153, + 135, + 152, c, [605, 14], c, @@ -1218,42 +1217,41 @@ table: bt({ [167, 47], c, [28, 9], - 167, + 166, c, [508, 3], + 166, 167, 168, - 169, - 164, - 167, + 163, + 166, c, [3, 4], c, [425, 24], - 174, - 180, - 176, - 136, - 178, - 132, - 132, - 143, - 180, - 132, - 180, - 183, + 173, + 179, + 175, + 135, + 177, + 1, + 1, + 142, + 179, + 1, c, - [3, 4], + [409, 3], c, - [377, 5], - 1, + [3, 3], + c, + [377, 6], c, [357, 19], 123, + 141, 142, - 143, - 149, - 180, + 148, + 179, 44, 62, 62, @@ -1263,41 +1261,41 @@ table: bt({ [945, 47], c, [257, 62], - 167, - 136, - 176, + 166, + 135, + 175, c, - [529, 3], + [529, 4], c, [151, 6], c, - [160, 4], + [160, 3], c, [154, 20], 125, + 149, 150, 151, - 152, c, - [535, 23], + [24, 19], c, - [554, 22], + [554, 26], c, [16, 9], - 136, + 135, c, [17, 16], - 132, + 1, 1, 123, 125, 123, 125, - 152, - c, - [229, 4], + 151, + 44, + 62, c, - [104, 22], + [104, 24], c, [29, 3], c, @@ -1334,9 +1332,9 @@ table: bt({ s, [2, 25], c, - [73, 11], + [73, 12], c, - [50, 4], + [12, 3], c, [88, 13], c, @@ -1360,11 +1358,11 @@ table: bt({ c, [174, 132], c, - [577, 9], + [565, 10], c, - [465, 15], + [593, 24], c, - [235, 38], + [235, 28], c, [469, 15], c, @@ -1378,13 +1376,15 @@ table: bt({ c, [28, 36], c, - [891, 5], + [324, 4], c, - [81, 47], + [209, 39], c, - [377, 16], + [306, 10], c, - [388, 33], + [51, 26], + c, + [312, 22], c, [839, 102], c, @@ -1489,11 +1489,11 @@ table: bt({ s, [2, 32], c, - [53, 7], + [54, 8], c, [5, 4], c, - [45, 21], + [45, 20], c, [20, 9], c, @@ -1503,11 +1503,11 @@ table: bt({ c, [26, 8], c, - [39, 10], + [59, 16], c, - [54, 11], + [83, 6], c, - [50, 7], + [50, 6], c, [157, 10], c, @@ -1525,15 +1525,17 @@ table: bt({ c, [421, 4], c, - [454, 12], + [179, 12], + c, + [538, 24], c, - [188, 33], + [650, 14], c, - [441, 8], + [532, 11], c, - [657, 12], + [492, 9], c, - [556, 48], + [556, 43], c, [421, 137], c, @@ -1607,13 +1609,13 @@ table: bt({ 41, 40, 44, + 46, s, [32, 4], 51, s, [32, 3], 47, - 46, s, [32, 9], 7, @@ -1711,10 +1713,10 @@ table: bt({ 80, 80, 75, + 77, c, [538, 8], 76, - 77, s, [32, 9], s, @@ -2874,7 +2876,7 @@ switch($avoiding_name_collisions) { case 2 : /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 152; // regexp with braces or quotes (and no spaces) + return 151; // regexp with braces or quotes (and no spaces) break; case 7 : /*! Conditions:: action */ @@ -2917,23 +2919,23 @@ case 17 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 173; + return 172; break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 178; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 177; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 178; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 177; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 176; + this.popState(); return 175; break; case 24 : /*! Conditions:: options */ @@ -2963,12 +2965,12 @@ break; case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 141; break; case 31 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 141; break; case 32 : /*! Conditions:: indented */ @@ -2990,13 +2992,13 @@ case 32 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 180; + return 179; break; case 33 : /*! Conditions:: indented */ /*! Rule:: .+ */ - this.begin('rules'); return 142; + this.begin('rules'); return 141; break; case 34 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3011,7 +3013,7 @@ break; case 36 : /*! Conditions:: INITIAL */ /*! Rule:: {ID} */ - this.pushState('macro'); return 136; + this.pushState('macro'); return 135; break; case 37 : /*! Conditions:: macro */ @@ -3024,7 +3026,7 @@ case 38 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 173; + return 172; break; case 39 : @@ -3040,17 +3042,17 @@ break; case 41 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 172; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 171; break; case 42 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 172; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 171; break; case 43 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ - this.pushState('set'); return 165; + this.pushState('set'); return 164; break; case 56 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3060,7 +3062,7 @@ break; case 57 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ - return 158; // treated as `(?!atom)` + return 157; // treated as `(?!atom)` break; case 58 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3070,27 +3072,27 @@ break; case 60 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 170; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 169; break; case 63 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 174; + this.begin('options'); return 173; break; case 64 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %s\b */ - this.begin('start_condition'); return 138; + this.begin('start_condition'); return 137; break; case 65 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %x\b */ - this.begin('start_condition'); return 140; + this.begin('start_condition'); return 139; break; case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 180; + this.pushState('path'); return 179; break; case 67 : /*! Conditions:: INITIAL rules trail code */ @@ -3098,7 +3100,7 @@ case 67 : /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - return 145; + return 144; break; case 68 : @@ -3114,12 +3116,12 @@ break; case 78 : /*! Conditions:: set */ /*! Rule:: \] */ - this.popState('set'); return 167; + this.popState('set'); return 166; break; case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 183; // the bit of CODE just before EOF... + return 182; // the bit of CODE just before EOF... break; case 81 : /*! Conditions:: path */ @@ -3129,12 +3131,12 @@ break; case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 181; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 180; break; case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 181; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 180; break; case 84 : /*! Conditions:: path */ @@ -3144,7 +3146,7 @@ break; case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 181; + this.popState(); return 180; break; case 86 : /*! Conditions:: * */ @@ -3162,25 +3164,25 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 152, + 0 : 151, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 152, + 1 : 151, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 152, + 3 : 151, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 152, + 4 : 151, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 152, + 5 : 151, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 152, + 6 : 151, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 9 : 136, + 9 : 135, /*! Conditions:: conditions */ /*! Rule:: , */ 11 : 44, @@ -3189,28 +3191,28 @@ simpleCaseActionClusters: { 12 : 42, /*! Conditions:: options */ /*! Rule:: {NAME} */ - 18 : 136, + 18 : 135, /*! Conditions:: options */ /*! Rule:: = */ 19 : 61, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 178, + 22 : 177, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 25 : 146, + 25 : 145, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \| */ 44 : 124, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ - 45 : 157, + 45 : 156, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ - 46 : 157, + 46 : 156, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ - 47 : 157, + 47 : 156, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ 48 : 40, @@ -3237,7 +3239,7 @@ simpleCaseActionClusters: { 55 : 36, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 170, + 59 : 169, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ 61 : 36, @@ -3246,13 +3248,13 @@ simpleCaseActionClusters: { 62 : 46, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 171, + 69 : 170, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 164, + 70 : 163, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 164, + 71 : 163, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ 72 : 123, @@ -3261,16 +3263,16 @@ simpleCaseActionClusters: { 73 : 125, /*! Conditions:: * */ /*! Rule:: $ */ - 75 : 132, + 75 : 1, /*! Conditions:: set */ /*! Rule:: (\\\\|\\\]|[^\]{])+ */ - 76 : 169, + 76 : 168, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 169, + 77 : 168, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 183 + 79 : 182 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, From 5b646a81ae29a4b82ca70bb136fbdda763f35c02 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 2 Jun 2016 02:40:22 +0200 Subject: [PATCH 138/417] - minimal, inconsequential tweak to one of the regexes: no submatch needed hence `(?:...)` suffices instead of `(...)` - debugging line --- lex-parser.js | 7 ++++--- lex.l | 2 +- lex.y | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 52af80c..85ac645 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -894,7 +894,8 @@ case 62 : this.$ = $$[$0]; } else { this.$ = '{[' + $$[$0] + ']}'; - } + } + console.log("name expansion for: ", { name: $$[$0], redux: $$[$0].replace(/[{}]/g, ''), output: this.$ }); break; case 65 : /*! Production:: string : STRING_LIT */ @@ -3265,7 +3266,7 @@ simpleCaseActionClusters: { /*! Rule:: $ */ 75 : 1, /*! Conditions:: set */ - /*! Rule:: (\\\\|\\\]|[^\]{])+ */ + /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ 76 : 168, /*! Conditions:: set */ /*! Rule:: \{ */ @@ -3351,7 +3352,7 @@ rules: [ /^(?:\})/, /^(?:.)/, /^(?:$)/, -/^(?:(\\\\|\\\]|[^\]{])+)/, +/^(?:(?:\\\\|\\\]|[^\]{])+)/, /^(?:\{)/, /^(?:\])/, /^(?:[^\r\n]*(\r|\n)+)/, diff --git a/lex.l b/lex.l index 2b3ca3c..a8926e2 100644 --- a/lex.l +++ b/lex.l @@ -156,7 +156,7 @@ WS [^\S\r\n] <*><> return 'EOF'; -("\\\\"|"\]"|[^\]{])+ return 'REGEX_SET'; +(?:"\\\\"|"\\]"|[^\]{])+ return 'REGEX_SET'; "{" return 'REGEX_SET'; "]" this.popState('set'); return 'REGEX_SET_END'; diff --git a/lex.y b/lex.y index f195141..65e7600 100644 --- a/lex.y +++ b/lex.y @@ -279,6 +279,7 @@ regex_set_atom } else { $$ = '{[' + $name_expansion + ']}'; } + console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); } ; From 6d63626d4b481f4a9ea93e49f099a2565fd8953c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 2 Jun 2016 03:42:19 +0200 Subject: [PATCH 139/417] partially revert commit SHA-1: fd4370d22535fcbad57c837df01ff6162e7ca05f as it breaks jison: the 'easy keyword rule' option must apply to all keywords at the *tail* *end* of a lexer rule, or we won't be able to use it for things like keyword-ing lexer rules like `"%options"` (due to that `%` in there) - reverted and updated: 'easy keyword rules' option now accepts lexer rules which carry a keyword with any non-keyword prefix - 'easy keyword rules' option now accepts Unicode/hex/octal escapes as part of a 'keyword' as long as these produce a 'alphanumeric' character i.e. part of the keyword - 'easy keyword rules' option now accepts Unicode literals as part of a 'keyword' as long as these are 'alphanumeric' characters i.e. part of the keyword --- lex-parser.js | 32 ++++++++++++++++++++++++-------- lex.y | 32 ++++++++++++++++++++++++-------- tests/all-tests.js | 10 +++++----- 3 files changed, 53 insertions(+), 21 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 85ac645..85d5bb2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -803,7 +803,7 @@ case 34 : break; case 35 : /*! Production:: regex : regex_list */ - // Detect if the regex is a pure (Unicode) word; + // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' to be equivalent to their non-escaped version, // hence these are all valid 'words' for the 'easy keyword rules' option: // @@ -813,17 +813,33 @@ case 35 : // // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 // + // As we only check the *tail*, we also accept these as 'easy keywords': + // + // - %options + // - %foo-bar + // - +++a:b:c1 + // + // Note the dash in that last example: there the code will consider `bar` to be the keyword, + // which is fine with us as we're only interested in the taiol boundary and patching that one + // for the `easy_keyword_rules` option. this.$ = $$[$0]; - if (yy.options.easy_keyword_rules && !this.$.match(/\\[^ux0-9]|"/)) { + if (yy.options.easy_keyword_rules) { try { - // no need to 'protect' JSON.parse here through `$$.replace(/"/g, '\\"')` as we already checked - // against that occasion above: keywords are not allowed to contain double-quotes anyway. + // We need to 'protect' JSON.parse here as keywords are allowed to contain double-quotes and + // other leading cruft. // JSON.parse *does* gobble some escapes (such as `\b`) but we protect against that through - // the simple regex in the condition above. It will also catch escaped escapes (`\\`), which - // cannot be part of a keyword either, so no need to worry about JSON.parse 'correctly' - // converting convoluted constructs like '\\\\\\\\\\b' in here. + // a simple replace regex: we're not interested in the special escapes' exact value anyway. + // It will also catch escaped escapes (`\\`), which are not word characters either, + // so no need to worry about JSON.parse 'correctly' converting convoluted constructs like + // '\\\\\\\\\\b' in here. + this.$ = this.$ + .replace(/"/g, '.' /* '\\"' */) + .replace(/\\c[A-Z]/g, '.') + .replace(/\\[^xu0-9]/g, '.'); + this.$ = JSON.parse('"' + this.$ + '"'); - if (this.$.match(/^[\w\d]+$/u)) { + // a 'keyword' starts with an alphanumeric character, followed by zero or more alphanumerics or digits: + if (this.$.match(/\w[\w\d]*$/u)) { this.$ = $$[$0] + "\\b"; } else { this.$ = $$[$0]; diff --git a/lex.y b/lex.y index 65e7600..7bb8337 100644 --- a/lex.y +++ b/lex.y @@ -177,7 +177,7 @@ name_list regex : regex_list { - // Detect if the regex is a pure (Unicode) word; + // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' to be equivalent to their non-escaped version, // hence these are all valid 'words' for the 'easy keyword rules' option: // @@ -187,17 +187,33 @@ regex // // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 // + // As we only check the *tail*, we also accept these as 'easy keywords': + // + // - %options + // - %foo-bar + // - +++a:b:c1 + // + // Note the dash in that last example: there the code will consider `bar` to be the keyword, + // which is fine with us as we're only interested in the taiol boundary and patching that one + // for the `easy_keyword_rules` option. $$ = $regex_list; - if (yy.options.easy_keyword_rules && !$$.match(/\\[^ux0-9]|"/)) { + if (yy.options.easy_keyword_rules) { try { - // no need to 'protect' JSON.parse here through `$$.replace(/"/g, '\\"')` as we already checked - // against that occasion above: keywords are not allowed to contain double-quotes anyway. + // We need to 'protect' JSON.parse here as keywords are allowed to contain double-quotes and + // other leading cruft. // JSON.parse *does* gobble some escapes (such as `\b`) but we protect against that through - // the simple regex in the condition above. It will also catch escaped escapes (`\\`), which - // cannot be part of a keyword either, so no need to worry about JSON.parse 'correctly' - // converting convoluted constructs like '\\\\\\\\\\b' in here. + // a simple replace regex: we're not interested in the special escapes' exact value anyway. + // It will also catch escaped escapes (`\\`), which are not word characters either, + // so no need to worry about JSON.parse 'correctly' converting convoluted constructs like + // '\\\\\\\\\\b' in here. + $$ = $$ + .replace(/"/g, '.' /* '\\"' */) + .replace(/\\c[A-Z]/g, '.') + .replace(/\\[^xu0-9]/g, '.'); + $$ = JSON.parse('"' + $$ + '"'); - if ($$.match(/^[\w\d]+$/u)) { + // a 'keyword' starts with an alphanumeric character, followed by zero or more alphanumerics or digits: + if ($$.match(/\w[\w\d]*$/u)) { $$ = $regex_list + "\\b"; } else { $$ = $regex_list; diff --git a/tests/all-tests.js b/tests/all-tests.js index 084e002..b633b5f 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -524,20 +524,20 @@ exports["test %options easy_keyword_rules"] = function () { "EAT": 1, }, rules: [ - ["enter-test", "this.begin('TEST');" ], // '-' dash is NOT accepted as being part of a *keyword*, hence no automatic `\b` word-boundary check added! + ["enter-test\\b", "this.begin('TEST');" ], // '-' dash is accepted as it's *followed* by a word, hence the *tail* is an 'easy keyword', hence it merits an automatic `\b` word-boundary check added! ["enter_test\\b", "this.begin('TEST');" ], [["TEST","EAT"], "x\\b", "return 'T';" ], [["*"], "z\\b", "return 'Z';" ], [["TEST"], "y\\b", "this.begin('INITIAL'); return 'TY';" ], - ["\"'a", "return 1;"], // only keywords *without any non-keyword prefix*, i.e. keywords 'on their own', get the special 'easy keyword' treatment! - ["\"'\\\\\\*i", "return 1;"], + ["\"'a\\b", "return 1;"], // keywords *with any non-keyword prefix*, i.e. keywords 'at the tail end', get the special 'easy keyword' treatment too! + ["\"'\\\\\\*i\\b", "return 1;"], ["a\\b", "return 2;"], ["\\cA", ""], ["\\012", ""], ["\\xFF", ""], ["\\[[^\\\\]\\]", "return true;"], - ["f\"oo'bar", "return 'baz2';"], - ['fo"obar', "return 'baz';"] + ["f\"oo'bar\\b", "return 'baz2';"], + ['fo"obar\\b', "return 'baz';"] ], options: { "easy_keyword_rules": true From 9d7cee0b9820840b6bbb3d0069eb2a52b82d759c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 2 Jun 2016 04:02:01 +0200 Subject: [PATCH 140/417] regenerate parser + temporarily disable bug-triggering comment... --- lex-parser.js | 702 ++++++++++++++++++++++++++------------------------ lex.y | 2 +- 2 files changed, 362 insertions(+), 342 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 85d5bb2..8ca451c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -393,74 +393,74 @@ symbols_: { ",": 44, ".": 46, "/": 47, - "/!": 157, + "/!": 158, "<": 60, "=": 61, ">": 62, "?": 63, - "ACTION": 141, - "ACTION_BODY": 151, - "CHARACTER_LIT": 172, - "CODE": 182, - "EOF": 1, - "ESCAPE_CHAR": 169, - "INCLUDE": 179, - "NAME": 135, - "NAME_BRACE": 163, - "OPTIONS": 173, - "OPTIONS_END": 175, - "OPTION_VALUE": 177, - "PATH": 180, - "RANGE_REGEX": 170, - "REGEX_SET": 168, - "REGEX_SET_END": 166, - "REGEX_SET_START": 164, - "SPECIAL_GROUP": 156, - "START_COND": 145, - "START_EXC": 139, - "START_INC": 137, - "STRING_LIT": 171, - "UNKNOWN_DECL": 144, + "ACTION": 142, + "ACTION_BODY": 152, + "CHARACTER_LIT": 173, + "CODE": 183, + "EOF": 132, + "ESCAPE_CHAR": 170, + "INCLUDE": 180, + "NAME": 136, + "NAME_BRACE": 164, + "OPTIONS": 174, + "OPTIONS_END": 176, + "OPTION_VALUE": 178, + "PATH": 181, + "RANGE_REGEX": 171, + "REGEX_SET": 169, + "REGEX_SET_END": 167, + "REGEX_SET_START": 165, + "SPECIAL_GROUP": 157, + "START_COND": 146, + "START_EXC": 140, + "START_INC": 138, + "STRING_LIT": 172, + "UNKNOWN_DECL": 145, "^": 94, - "action": 148, - "action_body": 149, - "action_comments_body": 150, - "any_group_regex": 160, - "definition": 134, + "action": 149, + "action_body": 150, + "action_comments_body": 151, + "any_group_regex": 161, + "definition": 135, "definitions": 129, "error": 2, - "escape_char": 162, - "extra_lexer_module_code": 132, - "include_macro_code": 142, + "escape_char": 163, + "extra_lexer_module_code": 133, + "include_macro_code": 143, "init": 128, "lex": 127, - "module_code_chunk": 181, - "name_expansion": 158, - "name_list": 152, - "names_exclusive": 140, - "names_inclusive": 138, - "option": 176, - "option_list": 174, - "optional_module_code_chunk": 178, - "options": 143, - "range_regex": 159, - "regex": 136, - "regex_base": 155, - "regex_concat": 154, - "regex_list": 153, - "regex_set": 165, - "regex_set_atom": 167, - "rule": 146, - "rules": 133, + "module_code_chunk": 182, + "name_expansion": 159, + "name_list": 153, + "names_exclusive": 141, + "names_inclusive": 139, + "option": 177, + "option_list": 175, + "optional_module_code_chunk": 179, + "options": 144, + "range_regex": 160, + "regex": 137, + "regex_base": 156, + "regex_concat": 155, + "regex_list": 154, + "regex_set": 166, + "regex_set_atom": 168, + "rule": 147, + "rules": 134, "rules_and_epilogue": 131, - "start_conditions": 147, - "string": 161, + "start_conditions": 148, + "string": 162, "{": 123, "|": 124, "}": 125 }, terminals_: { - 1: "EOF", + 1: "$end", 2: "error", 36: "$", 40: "(", @@ -479,29 +479,30 @@ terminals_: { 124: "|", 125: "}", 130: "%%", - 135: "NAME", - 137: "START_INC", - 139: "START_EXC", - 141: "ACTION", - 144: "UNKNOWN_DECL", - 145: "START_COND", - 151: "ACTION_BODY", - 156: "SPECIAL_GROUP", - 157: "/!", - 163: "NAME_BRACE", - 164: "REGEX_SET_START", - 166: "REGEX_SET_END", - 168: "REGEX_SET", - 169: "ESCAPE_CHAR", - 170: "RANGE_REGEX", - 171: "STRING_LIT", - 172: "CHARACTER_LIT", - 173: "OPTIONS", - 175: "OPTIONS_END", - 177: "OPTION_VALUE", - 179: "INCLUDE", - 180: "PATH", - 182: "CODE" + 132: "EOF", + 136: "NAME", + 138: "START_INC", + 140: "START_EXC", + 142: "ACTION", + 145: "UNKNOWN_DECL", + 146: "START_COND", + 152: "ACTION_BODY", + 157: "SPECIAL_GROUP", + 158: "/!", + 164: "NAME_BRACE", + 165: "REGEX_SET_START", + 167: "REGEX_SET_END", + 169: "REGEX_SET", + 170: "ESCAPE_CHAR", + 171: "RANGE_REGEX", + 172: "STRING_LIT", + 173: "CHARACTER_LIT", + 174: "OPTIONS", + 176: "OPTIONS_END", + 178: "OPTION_VALUE", + 180: "INCLUDE", + 181: "PATH", + 183: "CODE" }, productions_: bp({ pop: u([ @@ -512,54 +513,54 @@ productions_: bp({ 129, 129, s, - [134, 7], - 138, - 138, - 140, - 140, - 133, - 133, - 146, + [135, 7], + 139, + 139, + 141, + 141, + 134, + 134, + 147, s, - [148, 3], - 149, - 149, + [149, 3], 150, 150, + 151, + 151, s, - [147, 3], - 152, - 152, - 136, + [148, 3], + 153, + 153, + 137, s, - [153, 4], - 154, - 154, + [154, 4], + 155, + 155, s, - [155, 15], - 158, - 160, - 165, - 165, - 167, - 167, - 162, + [156, 15], 159, 161, - 161, - 143, - 174, - 174, + 166, + 166, + 168, + 168, + 163, + 160, + 162, + 162, + 144, + 175, + 175, s, - [176, 3], - 132, - 132, - 142, - 142, - 181, - 181, - 178, - 178 + [177, 3], + 133, + 133, + 143, + 143, + 182, + 182, + 179, + 179 ]), rule: u([ 4, @@ -621,7 +622,8 @@ var $0 = $$.length - 1; switch (yystate) { case 1 : /*! Production:: lex : init definitions '%%' rules_and_epilogue */ - this.$ = $$[$0]; + + this.$ = $$[$0]; if ($$[$0 - 2][0]) this.$.macros = $$[$0 - 2][0]; if ($$[$0 - 2][1]) this.$.startConditions = $$[$0 - 2][1]; if ($$[$0 - 2][2]) this.$.unknownDecls = $$[$0 - 2][2]; @@ -640,40 +642,52 @@ case 1 : } delete yy.options; delete yy.actionInclude; - return this.$; + return this.$; + break; case 2 : /*! Production:: rules_and_epilogue : EOF */ - this.$ = { rules: [] }; + + this.$ = { rules: [] }; + break; case 3 : /*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { this.$ = { rules: [], moduleInclude: $$[$0 - 1] }; } else { this.$ = { rules: [] }; - } + } + break; case 4 : /*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code EOF */ - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { this.$ = { rules: $$[$0 - 3], moduleInclude: $$[$0 - 1] }; } else { this.$ = { rules: $$[$0 - 3] }; - } + } + break; case 5 : /*! Production:: rules_and_epilogue : rules EOF */ - this.$ = { rules: $$[$0 - 1] }; + + this.$ = { rules: $$[$0 - 1] }; + break; case 6 : -/*! Production:: init : ε */ - yy.actionInclude = []; - if (!yy.options) yy.options = {}; +/*! Production:: init : */ + + yy.actionInclude = []; + if (!yy.options) yy.options = {}; + break; case 7 : /*! Production:: definitions : definition definitions */ - this.$ = $$[$0]; + + this.$ = $$[$0]; if ($$[$0 - 1] != null) { if ('length' in $$[$0 - 1]) { this.$[0] = this.$[0] || {}; @@ -687,15 +701,16 @@ case 7 : this.$[2] = this.$[2] || []; this.$[2].push($$[$0 - 1].body); } - } + } + break; case 8 : -/*! Production:: definitions : ε */ - this.$ = [null, null]; +/*! Production:: definitions : */ + this.$ = [null, null]; break; case 9 : /*! Production:: definition : NAME regex */ - this.$ = [$$[$0 - 1], $$[$0]]; + this.$ = [$$[$0 - 1], $$[$0]]; break; case 10 : /*! Production:: definition : START_INC names_inclusive */ @@ -717,69 +732,69 @@ case 10 : /*! Production:: module_code_chunk : CODE */ case 79 : /*! Production:: optional_module_code_chunk : module_code_chunk */ - this.$ = $$[$0]; + this.$ = $$[$0]; break; case 12 : /*! Production:: definition : ACTION */ case 13 : /*! Production:: definition : include_macro_code */ - yy.actionInclude.push($$[$0]); this.$ = null; + yy.actionInclude.push($$[$0]); this.$ = null; break; case 14 : /*! Production:: definition : options */ - this.$ = null; + this.$ = null; break; case 15 : /*! Production:: definition : UNKNOWN_DECL */ - this.$ = {type: 'unknown', body: $$[$0]}; + this.$ = {type: 'unknown', body: $$[$0]}; break; case 16 : /*! Production:: names_inclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; break; case 17 : /*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; break; case 18 : /*! Production:: names_exclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; break; case 19 : /*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; break; case 20 : /*! Production:: rules : rules rule */ - this.$ = $$[$0 - 1]; this.$.push($$[$0]); + this.$ = $$[$0 - 1]; this.$.push($$[$0]); break; case 21 : /*! Production:: rules : rule */ case 33 : /*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; + this.$ = [$$[$0]]; break; case 22 : /*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; + this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; break; case 23 : /*! Production:: action : '{' action_body '}' */ case 30 : /*! Production:: start_conditions : '<' name_list '>' */ - this.$ = $$[$0 - 1]; + this.$ = $$[$0 - 1]; break; case 27 : /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ - this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; case 28 : -/*! Production:: action_comments_body : ε */ +/*! Production:: action_comments_body : */ case 39 : -/*! Production:: regex_list : ε */ +/*! Production:: regex_list : */ case 80 : -/*! Production:: optional_module_code_chunk : ε */ - this.$ = ''; +/*! Production:: optional_module_code_chunk : */ + this.$ = ''; break; case 29 : /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ @@ -791,19 +806,20 @@ case 29 : /*! Production:: regex_set : regex_set_atom regex_set */ case 78 : /*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = $$[$0 - 1] + $$[$0]; + this.$ = $$[$0 - 1] + $$[$0]; break; case 31 : /*! Production:: start_conditions : '<' '*' '>' */ - this.$ = ['*']; + this.$ = ['*']; break; case 34 : /*! Production:: name_list : name_list ',' NAME */ - this.$ = $$[$0 - 2]; this.$.push($$[$0]); + this.$ = $$[$0 - 2]; this.$.push($$[$0]); break; case 35 : /*! Production:: regex : regex_list */ - // Detect if the regex ends with a pure (Unicode) word; + + // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' to be equivalent to their non-escaped version, // hence these are all valid 'words' for the 'easy keyword rules' option: // @@ -811,7 +827,7 @@ case 35 : // - γεια_σου_γατοÏλα // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 // - // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode# 12869914 // // As we only check the *tail*, we also accept these as 'easy keywords': // @@ -847,96 +863,103 @@ case 35 : } catch (ex) { this.$ = $$[$0]; } - } + } + break; case 36 : /*! Production:: regex_list : regex_list '|' regex_concat */ - this.$ = $$[$0 - 2] + '|' + $$[$0]; + this.$ = $$[$0 - 2] + '|' + $$[$0]; break; case 37 : /*! Production:: regex_list : regex_list '|' */ - this.$ = $$[$0 - 1] + '|'; + this.$ = $$[$0 - 1] + '|'; break; case 42 : /*! Production:: regex_base : '(' regex_list ')' */ - this.$ = '(' + $$[$0 - 1] + ')'; + this.$ = '(' + $$[$0 - 1] + ')'; break; case 43 : /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; + this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; break; case 44 : /*! Production:: regex_base : regex_base '+' */ - this.$ = $$[$0 - 1] + '+'; + this.$ = $$[$0 - 1] + '+'; break; case 45 : /*! Production:: regex_base : regex_base '*' */ - this.$ = $$[$0 - 1] + '*'; + this.$ = $$[$0 - 1] + '*'; break; case 46 : /*! Production:: regex_base : regex_base '?' */ - this.$ = $$[$0 - 1] + '?'; + this.$ = $$[$0 - 1] + '?'; break; case 47 : /*! Production:: regex_base : '/' regex_base */ - this.$ = '(?=' + $$[$0] + ')'; + this.$ = '(?=' + $$[$0] + ')'; break; case 48 : /*! Production:: regex_base : '/!' regex_base */ - this.$ = '(?!' + $$[$0] + ')'; + this.$ = '(?!' + $$[$0] + ')'; break; case 52 : /*! Production:: regex_base : '.' */ - this.$ = '.'; + this.$ = '.'; break; case 53 : /*! Production:: regex_base : '^' */ - this.$ = '^'; + this.$ = '^'; break; case 54 : /*! Production:: regex_base : '$' */ - this.$ = '$'; + this.$ = '$'; break; case 58 : /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ case 74 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; case 62 : /*! Production:: regex_set_atom : name_expansion */ - if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { + + if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { // treat this as part of an XRegExp `\p{...}` Unicode slug: this.$ = $$[$0]; } else { this.$ = '{[' + $$[$0] + ']}'; } - console.log("name expansion for: ", { name: $$[$0], redux: $$[$0].replace(/[{}]/g, ''), output: this.$ }); + console.log("name expansion for: ", { name: $$[$0], redux: $$[$0].replace(/[{}]/g, ''), output: this.$ }); + break; case 65 : /*! Production:: string : STRING_LIT */ - this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); + this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; case 70 : /*! Production:: option : NAME[option] */ - yy.options[$$[$0]] = true; + yy.options[$$[$0]] = true; break; case 71 : /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ case 72 : /*! Production:: option : NAME[option] '=' NAME[value] */ - yy.options[$$[$0 - 2]] = $$[$0]; + yy.options[$$[$0 - 2]] = $$[$0]; break; case 75 : /*! Production:: include_macro_code : INCLUDE PATH */ - var fs = require('fs'); + + var fs = require('fs'); var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); // And no, we don't support nested '%include': - this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; + this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; + break; case 76 : /*! Production:: include_macro_code : INCLUDE error */ - console.error("%include MUST be followed by a valid file path"); + + console.error("%include MUST be followed by a valid file path"); + break; } }, @@ -1042,18 +1065,18 @@ table: bt({ 128, 130, s, - [135, 4, 2], - 144, - 173, - 179, + [136, 4, 2], + 145, + 174, + 180, 1, 129, 130, - 134, + 135, c, [11, 4], - 142, 143, + 144, c, [13, 3], 130, @@ -1066,55 +1089,55 @@ table: bt({ 94, 124, 130, - 135, 136, + 137, c, [41, 4], s, - [153, 6, 1], + [154, 6, 1], s, - [160, 5, 1], - 169, - 171, + [161, 5, 1], + 170, 172, 173, - 179, - 138, - 145, - 140, - 145, + 174, + 180, + 139, + 146, + 141, + 146, c, [67, 8], c, [8, 24], 2, - 180, - 135, - 174, - 176, - 1, + 181, + 136, + 175, + 177, c, - [71, 4], + [70, 4], 60, 94, 123, 124, 130, 131, - 133, - 141, - 146, + 132, + 134, + 142, 147, - 156, + 148, 157, + 158, c, [65, 5], - 179, + 180, 130, c, [37, 8], c, - [25, 3], + [26, 3], c, [10, 7], 36, @@ -1135,13 +1158,13 @@ table: bt({ 63, c, [31, 9], - 156, 157, - 159, + 158, + 160, c, [27, 3], s, - [170, 4, 1], + [171, 4, 1], c, [56, 7], 124, @@ -1159,45 +1182,47 @@ table: bt({ [103, 11], c, [27, 180], - 166, - s, - [168, 6, 1], - 179, - 158, - 163, - 165, 167, + s, + [169, 6, 1], + 180, + 159, + 164, + 166, 168, + 169, c, [115, 81], c, [16, 6], - 145, + 146, c, [9, 29], c, - [514, 10], + [514, 9], + 132, c, [61, 10], c, [60, 4], - 182, + 183, c, [25, 25], - 175, - 135, - 174, + 176, + 136, 175, 176, + 177, 61, - 135, - 175, - s, - [1, 3], + 136, + 176, + 1, + 1, 132, - 178, + 133, 179, - 181, + 180, + 182, c, [41, 11], c, @@ -1205,19 +1230,17 @@ table: bt({ c, [21, 11], c, - [19, 8], + [19, 12], c, - [463, 5], - 123, - 124, - 136, - 141, + [18, 3], + 137, + 142, c, [503, 14], - 179, + 180, 42, - 135, - 152, + 136, + 153, c, [605, 14], c, @@ -1234,41 +1257,42 @@ table: bt({ [167, 47], c, [28, 9], - 166, + 167, c, [508, 3], - 166, 167, 168, - 163, - 166, + 169, + 164, + 167, c, [3, 4], c, [425, 24], - 173, - 179, - 175, - 135, - 177, - 1, - 1, - 142, - 179, - 1, - c, - [409, 3], + 174, + 180, + 176, + 136, + 178, + 132, + 132, + 143, + 180, + 132, + 180, + 183, c, - [3, 3], + [3, 4], c, - [377, 6], + [377, 5], + 1, c, [357, 19], 123, - 141, 142, - 148, - 179, + 143, + 149, + 180, 44, 62, 62, @@ -1278,41 +1302,41 @@ table: bt({ [945, 47], c, [257, 62], - 166, - 135, - 175, + 167, + 136, + 176, c, - [529, 4], + [529, 3], c, [151, 6], c, - [160, 3], + [160, 4], c, [154, 20], 125, - 149, 150, 151, + 152, c, - [24, 19], + [535, 23], c, - [554, 26], + [554, 22], c, [16, 9], - 135, + 136, c, [17, 16], - 1, + 132, 1, 123, 125, 123, 125, - 151, - 44, - 62, + 152, + c, + [229, 4], c, - [104, 24], + [104, 22], c, [29, 3], c, @@ -1349,9 +1373,9 @@ table: bt({ s, [2, 25], c, - [73, 12], + [73, 11], c, - [12, 3], + [50, 4], c, [88, 13], c, @@ -1375,11 +1399,11 @@ table: bt({ c, [174, 132], c, - [565, 10], + [577, 9], c, - [593, 24], + [465, 15], c, - [235, 28], + [235, 38], c, [469, 15], c, @@ -1393,15 +1417,13 @@ table: bt({ c, [28, 36], c, - [324, 4], + [891, 5], c, - [209, 39], + [81, 47], c, - [306, 10], + [377, 16], c, - [51, 26], - c, - [312, 22], + [388, 33], c, [839, 102], c, @@ -1506,11 +1528,11 @@ table: bt({ s, [2, 32], c, - [54, 8], + [53, 7], c, [5, 4], c, - [45, 20], + [45, 21], c, [20, 9], c, @@ -1520,11 +1542,11 @@ table: bt({ c, [26, 8], c, - [59, 16], + [39, 10], c, - [83, 6], + [54, 11], c, - [50, 6], + [50, 7], c, [157, 10], c, @@ -1542,17 +1564,15 @@ table: bt({ c, [421, 4], c, - [179, 12], - c, - [538, 24], + [454, 12], c, - [650, 14], + [188, 33], c, - [532, 11], + [441, 8], c, - [492, 9], + [657, 12], c, - [556, 43], + [556, 48], c, [421, 137], c, @@ -1626,13 +1646,13 @@ table: bt({ 41, 40, 44, - 46, s, [32, 4], 51, s, [32, 3], 47, + 46, s, [32, 9], 7, @@ -1730,10 +1750,10 @@ table: bt({ 80, 80, 75, - 77, c, [538, 8], 76, + 77, s, [32, 9], s, @@ -2893,7 +2913,7 @@ switch($avoiding_name_collisions) { case 2 : /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 151; // regexp with braces or quotes (and no spaces) + return 152; // regexp with braces or quotes (and no spaces) break; case 7 : /*! Conditions:: action */ @@ -2936,23 +2956,23 @@ case 17 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 172; + return 173; break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 177; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 178; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 177; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 178; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 175; + this.popState(); return 176; break; case 24 : /*! Conditions:: options */ @@ -2982,12 +3002,12 @@ break; case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 141; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; break; case 31 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 141; + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; break; case 32 : /*! Conditions:: indented */ @@ -3009,13 +3029,13 @@ case 32 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 179; + return 180; break; case 33 : /*! Conditions:: indented */ /*! Rule:: .+ */ - this.begin('rules'); return 141; + this.begin('rules'); return 142; break; case 34 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3030,7 +3050,7 @@ break; case 36 : /*! Conditions:: INITIAL */ /*! Rule:: {ID} */ - this.pushState('macro'); return 135; + this.pushState('macro'); return 136; break; case 37 : /*! Conditions:: macro */ @@ -3043,7 +3063,7 @@ case 38 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 172; + return 173; break; case 39 : @@ -3059,17 +3079,17 @@ break; case 41 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 171; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 172; break; case 42 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 171; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 172; break; case 43 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ - this.pushState('set'); return 164; + this.pushState('set'); return 165; break; case 56 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3079,7 +3099,7 @@ break; case 57 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ - return 157; // treated as `(?!atom)` + return 158; // treated as `(?!atom)` break; case 58 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3089,27 +3109,27 @@ break; case 60 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 169; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 170; break; case 63 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 173; + this.begin('options'); return 174; break; case 64 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %s\b */ - this.begin('start_condition'); return 137; + this.begin('start_condition'); return 138; break; case 65 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %x\b */ - this.begin('start_condition'); return 139; + this.begin('start_condition'); return 140; break; case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 179; + this.pushState('path'); return 180; break; case 67 : /*! Conditions:: INITIAL rules trail code */ @@ -3117,7 +3137,7 @@ case 67 : /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - return 144; + return 145; break; case 68 : @@ -3133,12 +3153,12 @@ break; case 78 : /*! Conditions:: set */ /*! Rule:: \] */ - this.popState('set'); return 166; + this.popState('set'); return 167; break; case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 182; // the bit of CODE just before EOF... + return 183; // the bit of CODE just before EOF... break; case 81 : /*! Conditions:: path */ @@ -3148,12 +3168,12 @@ break; case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 180; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 181; break; case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 180; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 181; break; case 84 : /*! Conditions:: path */ @@ -3163,7 +3183,7 @@ break; case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 180; + this.popState(); return 181; break; case 86 : /*! Conditions:: * */ @@ -3181,25 +3201,25 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 151, + 0 : 152, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 151, + 1 : 152, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 151, + 3 : 152, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 151, + 4 : 152, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 151, + 5 : 152, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 151, + 6 : 152, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 9 : 135, + 9 : 136, /*! Conditions:: conditions */ /*! Rule:: , */ 11 : 44, @@ -3208,28 +3228,28 @@ simpleCaseActionClusters: { 12 : 42, /*! Conditions:: options */ /*! Rule:: {NAME} */ - 18 : 135, + 18 : 136, /*! Conditions:: options */ /*! Rule:: = */ 19 : 61, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 177, + 22 : 178, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 25 : 145, + 25 : 146, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \| */ 44 : 124, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ - 45 : 156, + 45 : 157, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ - 46 : 156, + 46 : 157, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ - 47 : 156, + 47 : 157, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ 48 : 40, @@ -3256,7 +3276,7 @@ simpleCaseActionClusters: { 55 : 36, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 169, + 59 : 170, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ 61 : 36, @@ -3265,13 +3285,13 @@ simpleCaseActionClusters: { 62 : 46, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 170, + 69 : 171, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 163, + 70 : 164, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 163, + 71 : 164, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ 72 : 123, @@ -3280,16 +3300,16 @@ simpleCaseActionClusters: { 73 : 125, /*! Conditions:: * */ /*! Rule:: $ */ - 75 : 1, + 75 : 132, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 76 : 168, + 76 : 169, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 168, + 77 : 169, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 182 + 79 : 183 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, diff --git a/lex.y b/lex.y index 7bb8337..42e7be1 100644 --- a/lex.y +++ b/lex.y @@ -185,7 +185,7 @@ regex // - γεια_σου_γατοÏλα // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 // - // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode# 12869914 // // As we only check the *tail*, we also accept these as 'easy keywords': // From 288818c06d1a9c7fe77b7b0cd39246ef272643d8 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 2 Jun 2016 04:10:25 +0200 Subject: [PATCH 141/417] rebuilt using latest jison; tested OK -- also restored the bug-triggering comment: older jison versions will barf on this lex.y due to the `#` in the url being (incorrectly) detected as a grammar element **location reference** --- lex-parser.js | 744 ++++++++++++++++++++++++-------------------------- lex.y | 2 +- 2 files changed, 363 insertions(+), 383 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8ca451c..69198ae 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-123 */ +/* parser generated by jison 0.4.17-126 */ /* * Returns a Parser object of the following structure: * @@ -393,74 +393,74 @@ symbols_: { ",": 44, ".": 46, "/": 47, - "/!": 158, + "/!": 157, "<": 60, "=": 61, ">": 62, "?": 63, - "ACTION": 142, - "ACTION_BODY": 152, - "CHARACTER_LIT": 173, - "CODE": 183, - "EOF": 132, - "ESCAPE_CHAR": 170, - "INCLUDE": 180, - "NAME": 136, - "NAME_BRACE": 164, - "OPTIONS": 174, - "OPTIONS_END": 176, - "OPTION_VALUE": 178, - "PATH": 181, - "RANGE_REGEX": 171, - "REGEX_SET": 169, - "REGEX_SET_END": 167, - "REGEX_SET_START": 165, - "SPECIAL_GROUP": 157, - "START_COND": 146, - "START_EXC": 140, - "START_INC": 138, - "STRING_LIT": 172, - "UNKNOWN_DECL": 145, + "ACTION": 141, + "ACTION_BODY": 151, + "CHARACTER_LIT": 172, + "CODE": 182, + "EOF": 1, + "ESCAPE_CHAR": 169, + "INCLUDE": 179, + "NAME": 135, + "NAME_BRACE": 163, + "OPTIONS": 173, + "OPTIONS_END": 175, + "OPTION_VALUE": 177, + "PATH": 180, + "RANGE_REGEX": 170, + "REGEX_SET": 168, + "REGEX_SET_END": 166, + "REGEX_SET_START": 164, + "SPECIAL_GROUP": 156, + "START_COND": 145, + "START_EXC": 139, + "START_INC": 137, + "STRING_LIT": 171, + "UNKNOWN_DECL": 144, "^": 94, - "action": 149, - "action_body": 150, - "action_comments_body": 151, - "any_group_regex": 161, - "definition": 135, + "action": 148, + "action_body": 149, + "action_comments_body": 150, + "any_group_regex": 160, + "definition": 134, "definitions": 129, "error": 2, - "escape_char": 163, - "extra_lexer_module_code": 133, - "include_macro_code": 143, + "escape_char": 162, + "extra_lexer_module_code": 132, + "include_macro_code": 142, "init": 128, "lex": 127, - "module_code_chunk": 182, - "name_expansion": 159, - "name_list": 153, - "names_exclusive": 141, - "names_inclusive": 139, - "option": 177, - "option_list": 175, - "optional_module_code_chunk": 179, - "options": 144, - "range_regex": 160, - "regex": 137, - "regex_base": 156, - "regex_concat": 155, - "regex_list": 154, - "regex_set": 166, - "regex_set_atom": 168, - "rule": 147, - "rules": 134, + "module_code_chunk": 181, + "name_expansion": 158, + "name_list": 152, + "names_exclusive": 140, + "names_inclusive": 138, + "option": 176, + "option_list": 174, + "optional_module_code_chunk": 178, + "options": 143, + "range_regex": 159, + "regex": 136, + "regex_base": 155, + "regex_concat": 154, + "regex_list": 153, + "regex_set": 165, + "regex_set_atom": 167, + "rule": 146, + "rules": 133, "rules_and_epilogue": 131, - "start_conditions": 148, - "string": 162, + "start_conditions": 147, + "string": 161, "{": 123, "|": 124, "}": 125 }, terminals_: { - 1: "$end", + 1: "EOF", 2: "error", 36: "$", 40: "(", @@ -479,30 +479,29 @@ terminals_: { 124: "|", 125: "}", 130: "%%", - 132: "EOF", - 136: "NAME", - 138: "START_INC", - 140: "START_EXC", - 142: "ACTION", - 145: "UNKNOWN_DECL", - 146: "START_COND", - 152: "ACTION_BODY", - 157: "SPECIAL_GROUP", - 158: "/!", - 164: "NAME_BRACE", - 165: "REGEX_SET_START", - 167: "REGEX_SET_END", - 169: "REGEX_SET", - 170: "ESCAPE_CHAR", - 171: "RANGE_REGEX", - 172: "STRING_LIT", - 173: "CHARACTER_LIT", - 174: "OPTIONS", - 176: "OPTIONS_END", - 178: "OPTION_VALUE", - 180: "INCLUDE", - 181: "PATH", - 183: "CODE" + 135: "NAME", + 137: "START_INC", + 139: "START_EXC", + 141: "ACTION", + 144: "UNKNOWN_DECL", + 145: "START_COND", + 151: "ACTION_BODY", + 156: "SPECIAL_GROUP", + 157: "/!", + 163: "NAME_BRACE", + 164: "REGEX_SET_START", + 166: "REGEX_SET_END", + 168: "REGEX_SET", + 169: "ESCAPE_CHAR", + 170: "RANGE_REGEX", + 171: "STRING_LIT", + 172: "CHARACTER_LIT", + 173: "OPTIONS", + 175: "OPTIONS_END", + 177: "OPTION_VALUE", + 179: "INCLUDE", + 180: "PATH", + 182: "CODE" }, productions_: bp({ pop: u([ @@ -513,54 +512,54 @@ productions_: bp({ 129, 129, s, - [135, 7], - 139, - 139, - 141, - 141, - 134, - 134, - 147, + [134, 7], + 138, + 138, + 140, + 140, + 133, + 133, + 146, s, - [149, 3], + [148, 3], + 149, + 149, 150, 150, - 151, - 151, s, - [148, 3], - 153, - 153, - 137, + [147, 3], + 152, + 152, + 136, s, - [154, 4], - 155, - 155, + [153, 4], + 154, + 154, s, - [156, 15], - 159, - 161, - 166, - 166, - 168, - 168, - 163, + [155, 15], + 158, 160, + 165, + 165, + 167, + 167, 162, - 162, - 144, - 175, - 175, - s, - [177, 3], - 133, - 133, - 143, + 159, + 161, + 161, 143, - 182, - 182, - 179, - 179 + 174, + 174, + s, + [176, 3], + 132, + 132, + 142, + 142, + 181, + 181, + 178, + 178 ]), rule: u([ 4, @@ -622,8 +621,7 @@ var $0 = $$.length - 1; switch (yystate) { case 1 : /*! Production:: lex : init definitions '%%' rules_and_epilogue */ - - this.$ = $$[$0]; + this.$ = $$[$0]; if ($$[$0 - 2][0]) this.$.macros = $$[$0 - 2][0]; if ($$[$0 - 2][1]) this.$.startConditions = $$[$0 - 2][1]; if ($$[$0 - 2][2]) this.$.unknownDecls = $$[$0 - 2][2]; @@ -642,52 +640,40 @@ case 1 : } delete yy.options; delete yy.actionInclude; - return this.$; - + return this.$; break; case 2 : /*! Production:: rules_and_epilogue : EOF */ - - this.$ = { rules: [] }; - + this.$ = { rules: [] }; break; case 3 : /*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ - - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { this.$ = { rules: [], moduleInclude: $$[$0 - 1] }; } else { this.$ = { rules: [] }; - } - + } break; case 4 : /*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code EOF */ - - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { this.$ = { rules: $$[$0 - 3], moduleInclude: $$[$0 - 1] }; } else { this.$ = { rules: $$[$0 - 3] }; - } - + } break; case 5 : /*! Production:: rules_and_epilogue : rules EOF */ - - this.$ = { rules: $$[$0 - 1] }; - + this.$ = { rules: $$[$0 - 1] }; break; case 6 : -/*! Production:: init : */ - - yy.actionInclude = []; - if (!yy.options) yy.options = {}; - +/*! Production:: init : ε */ + yy.actionInclude = []; + if (!yy.options) yy.options = {}; break; case 7 : /*! Production:: definitions : definition definitions */ - - this.$ = $$[$0]; + this.$ = $$[$0]; if ($$[$0 - 1] != null) { if ('length' in $$[$0 - 1]) { this.$[0] = this.$[0] || {}; @@ -701,16 +687,15 @@ case 7 : this.$[2] = this.$[2] || []; this.$[2].push($$[$0 - 1].body); } - } - + } break; case 8 : -/*! Production:: definitions : */ - this.$ = [null, null]; +/*! Production:: definitions : ε */ + this.$ = [null, null]; break; case 9 : /*! Production:: definition : NAME regex */ - this.$ = [$$[$0 - 1], $$[$0]]; + this.$ = [$$[$0 - 1], $$[$0]]; break; case 10 : /*! Production:: definition : START_INC names_inclusive */ @@ -732,69 +717,69 @@ case 10 : /*! Production:: module_code_chunk : CODE */ case 79 : /*! Production:: optional_module_code_chunk : module_code_chunk */ - this.$ = $$[$0]; + this.$ = $$[$0]; break; case 12 : /*! Production:: definition : ACTION */ case 13 : /*! Production:: definition : include_macro_code */ - yy.actionInclude.push($$[$0]); this.$ = null; + yy.actionInclude.push($$[$0]); this.$ = null; break; case 14 : /*! Production:: definition : options */ - this.$ = null; + this.$ = null; break; case 15 : /*! Production:: definition : UNKNOWN_DECL */ - this.$ = {type: 'unknown', body: $$[$0]}; + this.$ = {type: 'unknown', body: $$[$0]}; break; case 16 : /*! Production:: names_inclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; break; case 17 : /*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; break; case 18 : /*! Production:: names_exclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; break; case 19 : /*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; break; case 20 : /*! Production:: rules : rules rule */ - this.$ = $$[$0 - 1]; this.$.push($$[$0]); + this.$ = $$[$0 - 1]; this.$.push($$[$0]); break; case 21 : /*! Production:: rules : rule */ case 33 : /*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; + this.$ = [$$[$0]]; break; case 22 : /*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; + this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; break; case 23 : /*! Production:: action : '{' action_body '}' */ case 30 : /*! Production:: start_conditions : '<' name_list '>' */ - this.$ = $$[$0 - 1]; + this.$ = $$[$0 - 1]; break; case 27 : /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ - this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; case 28 : -/*! Production:: action_comments_body : */ +/*! Production:: action_comments_body : ε */ case 39 : -/*! Production:: regex_list : */ +/*! Production:: regex_list : ε */ case 80 : -/*! Production:: optional_module_code_chunk : */ - this.$ = ''; +/*! Production:: optional_module_code_chunk : ε */ + this.$ = ''; break; case 29 : /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ @@ -806,20 +791,19 @@ case 29 : /*! Production:: regex_set : regex_set_atom regex_set */ case 78 : /*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = $$[$0 - 1] + $$[$0]; + this.$ = $$[$0 - 1] + $$[$0]; break; case 31 : /*! Production:: start_conditions : '<' '*' '>' */ - this.$ = ['*']; + this.$ = ['*']; break; case 34 : /*! Production:: name_list : name_list ',' NAME */ - this.$ = $$[$0 - 2]; this.$.push($$[$0]); + this.$ = $$[$0 - 2]; this.$.push($$[$0]); break; case 35 : /*! Production:: regex : regex_list */ - - // Detect if the regex ends with a pure (Unicode) word; + // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' to be equivalent to their non-escaped version, // hence these are all valid 'words' for the 'easy keyword rules' option: // @@ -827,7 +811,7 @@ case 35 : // - γεια_σου_γατοÏλα // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 // - // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode# 12869914 + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 // // As we only check the *tail*, we also accept these as 'easy keywords': // @@ -863,103 +847,96 @@ case 35 : } catch (ex) { this.$ = $$[$0]; } - } - + } break; case 36 : /*! Production:: regex_list : regex_list '|' regex_concat */ - this.$ = $$[$0 - 2] + '|' + $$[$0]; + this.$ = $$[$0 - 2] + '|' + $$[$0]; break; case 37 : /*! Production:: regex_list : regex_list '|' */ - this.$ = $$[$0 - 1] + '|'; + this.$ = $$[$0 - 1] + '|'; break; case 42 : /*! Production:: regex_base : '(' regex_list ')' */ - this.$ = '(' + $$[$0 - 1] + ')'; + this.$ = '(' + $$[$0 - 1] + ')'; break; case 43 : /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; + this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; break; case 44 : /*! Production:: regex_base : regex_base '+' */ - this.$ = $$[$0 - 1] + '+'; + this.$ = $$[$0 - 1] + '+'; break; case 45 : /*! Production:: regex_base : regex_base '*' */ - this.$ = $$[$0 - 1] + '*'; + this.$ = $$[$0 - 1] + '*'; break; case 46 : /*! Production:: regex_base : regex_base '?' */ - this.$ = $$[$0 - 1] + '?'; + this.$ = $$[$0 - 1] + '?'; break; case 47 : /*! Production:: regex_base : '/' regex_base */ - this.$ = '(?=' + $$[$0] + ')'; + this.$ = '(?=' + $$[$0] + ')'; break; case 48 : /*! Production:: regex_base : '/!' regex_base */ - this.$ = '(?!' + $$[$0] + ')'; + this.$ = '(?!' + $$[$0] + ')'; break; case 52 : /*! Production:: regex_base : '.' */ - this.$ = '.'; + this.$ = '.'; break; case 53 : /*! Production:: regex_base : '^' */ - this.$ = '^'; + this.$ = '^'; break; case 54 : /*! Production:: regex_base : '$' */ - this.$ = '$'; + this.$ = '$'; break; case 58 : /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ case 74 : /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; case 62 : /*! Production:: regex_set_atom : name_expansion */ - - if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { + if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { // treat this as part of an XRegExp `\p{...}` Unicode slug: this.$ = $$[$0]; } else { this.$ = '{[' + $$[$0] + ']}'; } - console.log("name expansion for: ", { name: $$[$0], redux: $$[$0].replace(/[{}]/g, ''), output: this.$ }); - + console.log("name expansion for: ", { name: $$[$0], redux: $$[$0].replace(/[{}]/g, ''), output: this.$ }); break; case 65 : /*! Production:: string : STRING_LIT */ - this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); + this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; case 70 : /*! Production:: option : NAME[option] */ - yy.options[$$[$0]] = true; + yy.options[$$[$0]] = true; break; case 71 : /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ case 72 : /*! Production:: option : NAME[option] '=' NAME[value] */ - yy.options[$$[$0 - 2]] = $$[$0]; + yy.options[$$[$0 - 2]] = $$[$0]; break; case 75 : /*! Production:: include_macro_code : INCLUDE PATH */ - - var fs = require('fs'); + var fs = require('fs'); var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); // And no, we don't support nested '%include': - this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; - + this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; break; case 76 : /*! Production:: include_macro_code : INCLUDE error */ - - console.error("%include MUST be followed by a valid file path"); - + console.error("%include MUST be followed by a valid file path"); break; } }, @@ -1065,18 +1042,18 @@ table: bt({ 128, 130, s, - [136, 4, 2], - 145, - 174, - 180, + [135, 4, 2], + 144, + 173, + 179, 1, 129, 130, - 135, + 134, c, [11, 4], + 142, 143, - 144, c, [13, 3], 130, @@ -1089,55 +1066,55 @@ table: bt({ 94, 124, 130, + 135, 136, - 137, c, [41, 4], s, - [154, 6, 1], + [153, 6, 1], s, - [161, 5, 1], - 170, + [160, 5, 1], + 169, + 171, 172, 173, - 174, - 180, - 139, - 146, - 141, - 146, + 179, + 138, + 145, + 140, + 145, c, [67, 8], c, [8, 24], 2, - 181, - 136, - 175, - 177, + 180, + 135, + 174, + 176, + 1, c, - [70, 4], + [71, 4], 60, 94, 123, 124, 130, 131, - 132, - 134, - 142, + 133, + 141, + 146, 147, - 148, + 156, 157, - 158, c, [65, 5], - 180, + 179, 130, c, [37, 8], c, - [26, 3], + [25, 3], c, [10, 7], 36, @@ -1158,13 +1135,13 @@ table: bt({ 63, c, [31, 9], + 156, 157, - 158, - 160, + 159, c, [27, 3], s, - [171, 4, 1], + [170, 4, 1], c, [56, 7], 124, @@ -1182,47 +1159,45 @@ table: bt({ [103, 11], c, [27, 180], - 167, - s, - [169, 6, 1], - 180, - 159, - 164, 166, + s, + [168, 6, 1], + 179, + 158, + 163, + 165, + 167, 168, - 169, c, [115, 81], c, [16, 6], - 146, + 145, c, [9, 29], c, - [514, 9], - 132, + [514, 10], c, [61, 10], c, [60, 4], - 183, + 182, c, [25, 25], - 176, - 136, + 175, + 135, + 174, 175, 176, - 177, 61, - 136, - 176, - 1, - 1, + 135, + 175, + s, + [1, 3], 132, - 133, + 178, 179, - 180, - 182, + 181, c, [41, 11], c, @@ -1230,17 +1205,19 @@ table: bt({ c, [21, 11], c, - [19, 12], + [19, 8], c, - [18, 3], - 137, - 142, + [463, 5], + 123, + 124, + 136, + 141, c, [503, 14], - 180, + 179, 42, - 136, - 153, + 135, + 152, c, [605, 14], c, @@ -1257,42 +1234,41 @@ table: bt({ [167, 47], c, [28, 9], - 167, + 166, c, [508, 3], + 166, 167, 168, - 169, - 164, - 167, + 163, + 166, c, [3, 4], c, [425, 24], - 174, - 180, - 176, - 136, - 178, - 132, - 132, - 143, - 180, - 132, - 180, - 183, + 173, + 179, + 175, + 135, + 177, + 1, + 1, + 142, + 179, + 1, c, - [3, 4], + [409, 3], c, - [377, 5], - 1, + [3, 3], + c, + [377, 6], c, [357, 19], 123, + 141, 142, - 143, - 149, - 180, + 148, + 179, 44, 62, 62, @@ -1302,41 +1278,41 @@ table: bt({ [945, 47], c, [257, 62], - 167, - 136, - 176, + 166, + 135, + 175, c, - [529, 3], + [529, 4], c, [151, 6], c, - [160, 4], + [160, 3], c, [154, 20], 125, + 149, 150, 151, - 152, c, - [535, 23], + [24, 19], c, - [554, 22], + [554, 26], c, [16, 9], - 136, + 135, c, [17, 16], - 132, + 1, 1, 123, 125, 123, 125, - 152, - c, - [229, 4], + 151, + 44, + 62, c, - [104, 22], + [104, 24], c, [29, 3], c, @@ -1373,9 +1349,9 @@ table: bt({ s, [2, 25], c, - [73, 11], + [73, 12], c, - [50, 4], + [12, 3], c, [88, 13], c, @@ -1399,11 +1375,11 @@ table: bt({ c, [174, 132], c, - [577, 9], + [565, 10], c, - [465, 15], + [593, 24], c, - [235, 38], + [235, 28], c, [469, 15], c, @@ -1417,13 +1393,15 @@ table: bt({ c, [28, 36], c, - [891, 5], + [324, 4], c, - [81, 47], + [209, 39], c, - [377, 16], + [306, 10], c, - [388, 33], + [51, 26], + c, + [312, 22], c, [839, 102], c, @@ -1528,11 +1506,11 @@ table: bt({ s, [2, 32], c, - [53, 7], + [54, 8], c, [5, 4], c, - [45, 21], + [45, 20], c, [20, 9], c, @@ -1542,11 +1520,11 @@ table: bt({ c, [26, 8], c, - [39, 10], + [59, 16], c, - [54, 11], + [83, 6], c, - [50, 7], + [50, 6], c, [157, 10], c, @@ -1564,15 +1542,17 @@ table: bt({ c, [421, 4], c, - [454, 12], + [179, 12], + c, + [538, 24], c, - [188, 33], + [650, 14], c, - [441, 8], + [532, 11], c, - [657, 12], + [492, 9], c, - [556, 48], + [556, 43], c, [421, 137], c, @@ -1646,13 +1626,13 @@ table: bt({ 41, 40, 44, + 46, s, [32, 4], 51, s, [32, 3], 47, - 46, s, [32, 9], 7, @@ -1750,10 +1730,10 @@ table: bt({ 80, 80, 75, + 77, c, [538, 8], 76, - 77, s, [32, 9], s, @@ -2455,7 +2435,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-123 */ +/* generated by jison-lex 0.3.4-126 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 @@ -2515,7 +2495,7 @@ EOF:1, ERROR:2, -parseError:function parseError(str, hash) { +parseError:function lexer_parseError(str, hash) { if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { return this.yy.parser.parseError(str, hash) || this.ERROR; } else { @@ -2524,7 +2504,7 @@ parseError:function parseError(str, hash) { }, // resets the lexer, sets new input -setInput:function (input, yy) { +setInput:function lexer_setInput(input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this._signaled_error_token = this.done = false; @@ -2545,7 +2525,7 @@ setInput:function (input, yy) { }, // consumes and returns one char from the input -input:function () { +input:function lexer_input() { if (!this._input) { this.done = true; return null; @@ -2595,7 +2575,7 @@ input:function () { }, // unshifts one char (or a string) into the input -unput:function (ch) { +unput:function lexer_unput(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); @@ -2626,13 +2606,13 @@ unput:function (ch) { }, // When called from action, caches matched text and appends it on next action -more:function () { +more:function lexer_more() { this._more = true; return this; }, // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. -reject:function () { +reject:function lexer_reject() { if (this.options.backtrack_lexer) { this._backtrack = true; } else { @@ -2651,12 +2631,12 @@ reject:function () { }, // retain first n characters of the match -less:function (n) { +less:function lexer_less(n) { this.unput(this.match.slice(n)); }, // return (part of the) already matched input, i.e. for error messages -pastInput:function (maxSize) { +pastInput:function lexer_pastInput(maxSize) { var past = this.matched.substr(0, this.matched.length - this.match.length); if (maxSize < 0) maxSize = past.length; @@ -2666,7 +2646,7 @@ pastInput:function (maxSize) { }, // return (part of the) upcoming input, i.e. for error messages -upcomingInput:function (maxSize) { +upcomingInput:function lexer_upcomingInput(maxSize) { var next = this.match; if (maxSize < 0) maxSize = next.length + this._input.length; @@ -2679,14 +2659,14 @@ upcomingInput:function (maxSize) { }, // return a string which displays the character position where the lexing error occurred, i.e. for error messages -showPosition:function () { +showPosition:function lexer_showPosition() { var pre = this.pastInput().replace(/\s/g, ' '); var c = new Array(pre.length + 1).join('-'); return pre + this.upcomingInput().replace(/\s/g, ' ') + '\n' + c + '^'; }, // test the lexed token: return FALSE when not a match, otherwise return token -test_match:function (match, indexed_rule) { +test_match:function lexer_test_match(match, indexed_rule) { var token, lines, backup; @@ -2764,7 +2744,7 @@ test_match:function (match, indexed_rule) { }, // return next match in input -next:function () { +next:function lexer_next() { function clear() { this.yytext = ''; this.yyleng = 0; @@ -2842,7 +2822,7 @@ next:function () { }, // return next match that has a token -lex:function lex() { +lex:function lexer_lex() { var r; // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: if (typeof this.options.pre_lex === 'function') { @@ -2859,12 +2839,12 @@ lex:function lex() { }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) -begin:function begin(condition) { +begin:function lexer_begin(condition) { this.conditionStack.push(condition); }, // pop the previously active lexer condition state off the condition stack -popState:function popState() { +popState:function lexer_popState() { var n = this.conditionStack.length - 1; if (n > 0) { return this.conditionStack.pop(); @@ -2874,7 +2854,7 @@ popState:function popState() { }, // produce the lexer rule set which is active for the currently active lexer condition state -_currentRules:function _currentRules() { +_currentRules:function lexer__currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; } else { @@ -2883,7 +2863,7 @@ _currentRules:function _currentRules() { }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available -topState:function topState(n) { +topState:function lexer_topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; @@ -2893,12 +2873,12 @@ topState:function topState(n) { }, // alias for begin(condition) -pushState:function pushState(condition) { +pushState:function lexer_pushState(condition) { this.begin(condition); }, // return the number of states currently on the stack -stateStackSize:function stateStackSize() { +stateStackSize:function lexer_stateStackSize() { return this.conditionStack.length; }, options: { @@ -2913,7 +2893,7 @@ switch($avoiding_name_collisions) { case 2 : /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 152; // regexp with braces or quotes (and no spaces) + return 151; // regexp with braces or quotes (and no spaces) break; case 7 : /*! Conditions:: action */ @@ -2956,23 +2936,23 @@ case 17 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 173; + return 172; break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 178; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 177; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 178; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 177; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 176; + this.popState(); return 175; break; case 24 : /*! Conditions:: options */ @@ -3002,12 +2982,12 @@ break; case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 141; break; case 31 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 141; break; case 32 : /*! Conditions:: indented */ @@ -3029,13 +3009,13 @@ case 32 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 180; + return 179; break; case 33 : /*! Conditions:: indented */ /*! Rule:: .+ */ - this.begin('rules'); return 142; + this.begin('rules'); return 141; break; case 34 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3050,7 +3030,7 @@ break; case 36 : /*! Conditions:: INITIAL */ /*! Rule:: {ID} */ - this.pushState('macro'); return 136; + this.pushState('macro'); return 135; break; case 37 : /*! Conditions:: macro */ @@ -3063,7 +3043,7 @@ case 38 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 173; + return 172; break; case 39 : @@ -3079,17 +3059,17 @@ break; case 41 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 172; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 171; break; case 42 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 172; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 171; break; case 43 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ - this.pushState('set'); return 165; + this.pushState('set'); return 164; break; case 56 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3099,7 +3079,7 @@ break; case 57 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ - return 158; // treated as `(?!atom)` + return 157; // treated as `(?!atom)` break; case 58 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3109,27 +3089,27 @@ break; case 60 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 170; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 169; break; case 63 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 174; + this.begin('options'); return 173; break; case 64 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %s\b */ - this.begin('start_condition'); return 138; + this.begin('start_condition'); return 137; break; case 65 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %x\b */ - this.begin('start_condition'); return 140; + this.begin('start_condition'); return 139; break; case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 180; + this.pushState('path'); return 179; break; case 67 : /*! Conditions:: INITIAL rules trail code */ @@ -3137,7 +3117,7 @@ case 67 : /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - return 145; + return 144; break; case 68 : @@ -3153,12 +3133,12 @@ break; case 78 : /*! Conditions:: set */ /*! Rule:: \] */ - this.popState('set'); return 167; + this.popState('set'); return 166; break; case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 183; // the bit of CODE just before EOF... + return 182; // the bit of CODE just before EOF... break; case 81 : /*! Conditions:: path */ @@ -3168,12 +3148,12 @@ break; case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 181; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 180; break; case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 181; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 180; break; case 84 : /*! Conditions:: path */ @@ -3183,7 +3163,7 @@ break; case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 181; + this.popState(); return 180; break; case 86 : /*! Conditions:: * */ @@ -3201,25 +3181,25 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 152, + 0 : 151, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 152, + 1 : 151, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 152, + 3 : 151, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 152, + 4 : 151, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 152, + 5 : 151, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 152, + 6 : 151, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 9 : 136, + 9 : 135, /*! Conditions:: conditions */ /*! Rule:: , */ 11 : 44, @@ -3228,28 +3208,28 @@ simpleCaseActionClusters: { 12 : 42, /*! Conditions:: options */ /*! Rule:: {NAME} */ - 18 : 136, + 18 : 135, /*! Conditions:: options */ /*! Rule:: = */ 19 : 61, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 178, + 22 : 177, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 25 : 146, + 25 : 145, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \| */ 44 : 124, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ - 45 : 157, + 45 : 156, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ - 46 : 157, + 46 : 156, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ - 47 : 157, + 47 : 156, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ 48 : 40, @@ -3276,7 +3256,7 @@ simpleCaseActionClusters: { 55 : 36, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 170, + 59 : 169, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ 61 : 36, @@ -3285,13 +3265,13 @@ simpleCaseActionClusters: { 62 : 46, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 171, + 69 : 170, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 164, + 70 : 163, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 164, + 71 : 163, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ 72 : 123, @@ -3300,16 +3280,16 @@ simpleCaseActionClusters: { 73 : 125, /*! Conditions:: * */ /*! Rule:: $ */ - 75 : 132, + 75 : 1, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 76 : 169, + 76 : 168, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 169, + 77 : 168, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 183 + 79 : 182 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, diff --git a/lex.y b/lex.y index 42e7be1..7bb8337 100644 --- a/lex.y +++ b/lex.y @@ -185,7 +185,7 @@ regex // - γεια_σου_γατοÏλα // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 // - // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode# 12869914 + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 // // As we only check the *tail*, we also accept these as 'easy keywords': // From b54eb1a021106971239f6c013378947b2ef1fee7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 2 Jun 2016 04:14:25 +0200 Subject: [PATCH 142/417] disable debugging statement(s) --- lex-parser.js | 2 +- lex.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 69198ae..4024369 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -911,7 +911,7 @@ case 62 : } else { this.$ = '{[' + $$[$0] + ']}'; } - console.log("name expansion for: ", { name: $$[$0], redux: $$[$0].replace(/[{}]/g, ''), output: this.$ }); + //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; case 65 : /*! Production:: string : STRING_LIT */ diff --git a/lex.y b/lex.y index 7bb8337..2c8ec14 100644 --- a/lex.y +++ b/lex.y @@ -295,7 +295,7 @@ regex_set_atom } else { $$ = '{[' + $name_expansion + ']}'; } - console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); } ; From d25e6647c804a75a8c190c090b1c406161a5fd54 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 2 Jun 2016 05:15:26 +0200 Subject: [PATCH 143/417] bumped revision number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ad2b6d0..875335e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-126", + "version": "0.1.4-127", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 033442eec0b73a893cc781212da882f1392f3dc6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 2 Jun 2016 05:19:03 +0200 Subject: [PATCH 144/417] regenerate parser --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 4024369..4ee6402 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-126 */ +/* parser generated by jison 0.4.17-127 */ /* * Returns a Parser object of the following structure: * @@ -2435,7 +2435,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-126 */ +/* generated by jison-lex 0.3.4-127 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From 10ad6c37957334bce28eb008cdbd0d8cb2435f25 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 3 Jun 2016 16:11:01 +0200 Subject: [PATCH 145/417] bumped revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 875335e..a62bbbc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-127", + "version": "0.1.4-128", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 222e2df3faf6656ab30c43c9fff433ef8b688340 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 8 Jun 2016 20:09:20 +0200 Subject: [PATCH 146/417] added a few more tests to cover modern features --- tests/all-tests.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/tests/all-tests.js b/tests/all-tests.js index b633b5f..ec42f6c 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -38,6 +38,24 @@ exports["test lex grammar with macros"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test lex grammar with macros in regex sets"] = function () { + var lexgrammar = 'D [0-9]\nL [a-zA-Z]\nID [{L}_][{L}{D}_]+\n%%\n\n[{D}]"ohhai" {print(9);}\n"{" return \'{\';'; + var expected = { + macros: { + "D": "[0-9]", + "L": "[a-zA-Z]", + "ID": "[{L}_][{L}{D}_]+" + }, + rules: [ + ["[{D}]ohhai", "print(9);"], + ["\\{", "return '{';"] + ] + }; + + lexer_reset(); + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + exports["test escaped chars"] = function () { var lexgrammar = '%%\n"\\n"+ {return \'NL\';}\n\\n+ {return \'NL2\';}\n\\s+ {/* skip */}'; var expected = { @@ -307,6 +325,19 @@ exports["test unicode"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test unquoted lexer rule literals"] = function () { + var lexgrammar = '%%\nÏ€ return 1;\n-abc return 2;'; + var expected = { + rules: [ + ["Ï€", "return 1;"], + ["-abc", "return 2;"] + ] + }; + + lexer_reset(); + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + exports["test bugs"] = function () { var lexgrammar = '%%\n\\\'([^\\\\\']+|\\\\(\\n|.))*?\\\' return 1;'; var expected = { From fa2113e3d58d7a5742ace87c7ce3a672c83c39f1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 8 Jun 2016 20:11:05 +0200 Subject: [PATCH 147/417] do not rewrite macros inside regex [...] set as {[{MACRO}]} any more; the processor (exapnder) should just cope with this. Reason: json-based grammars should follow the same format as the regular ones, so no fancy footwork like this any more in the jison lexing/parsing: it's the wrong place to do this sort of thing. --- lex-parser.js | 2 +- lex.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 4ee6402..d8ca038 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -909,7 +909,7 @@ case 62 : // treat this as part of an XRegExp `\p{...}` Unicode slug: this.$ = $$[$0]; } else { - this.$ = '{[' + $$[$0] + ']}'; + this.$ = $$[$0]; } //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; diff --git a/lex.y b/lex.y index 2c8ec14..c5d168b 100644 --- a/lex.y +++ b/lex.y @@ -293,7 +293,7 @@ regex_set_atom // treat this as part of an XRegExp `\p{...}` Unicode slug: $$ = $name_expansion; } else { - $$ = '{[' + $name_expansion + ']}'; + $$ = $name_expansion; } //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); } From 6da4b47b4b4fc88f542f3cdbb4bd96b8e28c3dae Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 10 Jun 2016 16:52:54 +0200 Subject: [PATCH 148/417] bumped revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a62bbbc..13aec80 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-128", + "version": "0.1.4-129", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 79e45345c550f6e7de4c9edd6421461fdd4f2f15 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 10 Jun 2016 17:08:51 +0200 Subject: [PATCH 149/417] regenerated toolkit --- lex-parser.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d8ca038..8fc15c2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-127 */ +/* parser generated by jison 0.4.17-129 */ /* * Returns a Parser object of the following structure: * @@ -2435,7 +2435,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-127 */ +/* generated by jison-lex 0.3.4-129 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 @@ -3294,14 +3294,14 @@ simpleCaseActionClusters: { rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/.*)/, -/^(?:\/[^ \/]*?['"{}'][^ ]*?\/)/, +/^(?:\/[^ \/]*?["'{}][^ ]*?\/)/, /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, /^(?:[\/"'][^{}\/"']+)/, /^(?:[^{}\/"']+)/, /^(?:\{)/, /^(?:\})/, -/^(?:([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_](?:[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™-]*[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™])?))/, +/^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff](?:[^\u0000-,.\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*[^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff])?))/, /^(?:>)/, /^(?:,)/, /^(?:\*)/, @@ -3310,14 +3310,14 @@ rules: [ /^(?:\s+)/, /^(?:%%)/, /^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+)/, -/^(?:([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_](?:[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™-]*[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™])?))/, +/^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff](?:[^\u0000-,.\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*[^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff])?))/, /^(?:=)/, /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, /^(?:[^\s\r\n]+)/, /^(?:(\r\n|\n|\r)+)/, /^(?:([^\S\r\n])+)/, -/^(?:([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_][A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™]*))/, +/^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff][^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*))/, /^(?:(\r\n|\n|\r)+)/, /^(?:([^\S\r\n])+)/, /^(?:([^\S\r\n])*(\r\n|\n|\r)+)/, @@ -3328,7 +3328,7 @@ rules: [ /^(?:.+)/, /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/.*)/, -/^(?:([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_][A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™]*))/, +/^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff][^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*))/, /^(?:(\r\n|\n|\r)+)/, /^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+)/, /^(?:(\r\n|\n|\r)+)/, @@ -3351,7 +3351,7 @@ rules: [ /^(?:<)/, /^(?:\/!)/, /^(?:\/)/, -/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/, +/^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[0-9A-F]{2}|u[0-9A-Fa-f]{4}))/, /^(?:\\.)/, /^(?:\$)/, /^(?:\.)/, @@ -3359,11 +3359,11 @@ rules: [ /^(?:%s\b)/, /^(?:%x\b)/, /^(?:%include\b)/, -/^(?:%([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_](?:[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™-]*[A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™])?)[^\r\n]+)/, +/^(?:%([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff](?:[^\u0000-,.\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*[^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff])?)[^\n\r]+)/, /^(?:%%)/, /^(?:\{\d+(,\s?\d+|,)?\})/, -/^(?:\{([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_][A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™]*)\})/, -/^(?:\{([A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_][A-Za-zªµºÀ-ÖØ-öø-ˈ-ˑˠ-ˤˬˮͅͰ-ʹͶͷͺ-ͽͿΆΈ-ΊΌΎ-ΡΣ-ϵϷ-ÒÒŠ-Ô¯Ô±-Õ–Õ™Õ¡-Ö‡Ö°-Ö½Ö¿×ׇׂׅׄ×-תװ-ײØ-ؚؠ-Ù—Ù™-ٟٮ-Û“Û•-ۜۡ-Û¨Û­-Û¯Ûº-Û¼Û¿Ü-Ü¿Ý-ޱߊ-ߪߴߵߺࠀ-à —à š-ࠬࡀ-ࡘࢠ-ࢴࣣ-ࣰࣩ-ऻऽ-ौॎ-à¥à¥•-ॣॱ-ঃঅ-ঌà¦à¦à¦“-নপ-রলশ-হঽ-ৄেৈোৌৎৗড়à§à§Ÿ-ৣৰৱà¨-ਃਅ-ਊà¨à¨à¨“-ਨਪ-ਰਲਲ਼ਵਸ਼ਸਹਾ-ੂੇੈੋੌੑਖ਼-ੜਫ਼ੰ-ੵàª-ઃઅ-àªàª-ઑઓ-નપ-રલળવ-હઽ-ૅે-ૉોૌà«à« -ૣૹà¬-ଃଅ-ଌà¬à¬à¬“-ନପ-ରଲଳଵ-ହଽ-ୄେୈୋୌୖୗଡ଼à­à­Ÿ-ୣୱஂஃஅ-ஊஎ-à®à®’-கஙசஜஞடணதந-பம-ஹா-ூெ-ைொ-ௌà¯à¯—à°€-ఃఅ-ఌఎ-à°à°’-నప-హఽ-ౄె-ైొ-ౌౕౖౘ-ౚౠ-à±£à²-ಃಅ-ಌಎ-à²à²’-ನಪ-ಳವ-ಹಽ-ೄೆ-ೈೊ-ೌೕೖೞೠ-ೣೱೲà´-ഃഅ-ഌഎ-à´à´’-ഺഽ-ൄെ-ൈൊ-ൌൎൗൟ-ൣൺ-ൿංඃඅ-à¶–à¶š-නඳ-රලව-à·†à·-ුූෘ-ෟෲෳà¸-ฺเ-ๆà¹àºàº‚ຄງຈຊàºàº”-ທນ-ຟມ-ຣລວສຫອ-ູົ-ຽເ-ໄໆà»à»œ-ໟༀཀ-ཇཉ-ཬཱ-à¾à¾ˆ-ྗྙ-ྼက-ံးျ-ဿá-á¢á¥-á¨á®-ႆႎႜá‚á‚ -ჅჇáƒáƒ-ჺჼ-ቈቊ-á‰á‰-ቖቘቚ-á‰á‰ -ኈኊ-áŠáŠ-ኰኲ-ኵኸ-ኾዀዂ-ዅወ-ዖዘ-áŒáŒ’-ጕጘ-ášáŸáŽ€-áŽáŽ -áµá¸-á½á-ᙬᙯ-ᙿáš-áššáš -ᛪᛮ-ᛸᜀ-ᜌᜎ-ᜓᜠ-ᜳá€-á“á -á¬á®-á°á²á³áž€-ឳា-ៈៗៜᠠ-ᡷᢀ-ᢪᢰ-ᣵᤀ-ᤞᤠ-ᤫᤰ-ᤸá¥-ᥭᥰ-ᥴᦀ-ᦫᦰ-ᧉᨀ-ᨛᨠ-ᩞᩡ-ᩴᪧᬀ-ᬳᬵ-ᭃᭅ-ᭋᮀ-ᮩᮬ-ᮯᮺ-ᯥᯧ-ᯱᰀ-á°µá±-á±á±š-ᱽᳩ-ᳬᳮ-ᳳᳵᳶᴀ-á¶¿á·§-ᷴḀ-ἕἘ-á¼á¼ -ὅὈ-á½á½-ὗὙὛá½á½Ÿ-ώᾀ-á¾´á¾¶-ᾼιῂ-ῄῆ-ῌá¿-á¿“á¿–-Ίῠ-Ῥῲ-á¿´á¿¶-ῼâ±â¿â‚-ₜℂℇℊ-â„“â„•â„™-â„ℤΩℨK-ℭℯ-ℹℼ-â„¿â……-ⅉⅎⅠ-ↈⒶ-â“©â°€-Ⱞⰰ-ⱞⱠ-ⳤⳫ-ⳮⳲⳳⴀ-ⴥⴧⴭⴰ-ⵧⵯⶀ-â¶–â¶ -ⶦⶨ-ⶮⶰ-ⶶⶸ-ⶾⷀ-ⷆⷈ-â·Žâ·-â·–â·˜-â·žâ· -ⷿⸯ々-〇〡-〩〱-〵〸-〼ã-ã‚–ã‚-ゟァ-ヺー-ヿㄅ-ㄭㄱ-ㆎㆠ-ㆺㇰ-ㇿã€-䶵一-鿕ꀀ-ê’Œê“-ꓽꔀ-ꘌê˜-ꘟꘪꘫꙀ-ꙮꙴ-ꙻꙿ-ꛯꜗ-ꜟꜢ-ꞈꞋ-êž­êž°-ꞷꟷ-ê ê ƒ-ê …ê ‡-ê Šê Œ-ê §ê¡€-ꡳꢀ-ꣃꣲ-ꣷꣻꣽꤊ-ꤪꤰ-ꥒꥠ-ꥼꦀ-ꦲꦴ-ꦿê§ê§ -ꧤꧦ-ꧯꧺ-ꧾꨀ-ꨶꩀ-ê©ê© -ꩶꩺꩾ-ꪾꫀꫂꫛ-ê«ê« -ꫯꫲ-ꫵê¬-ꬆꬉ-ꬎꬑ-ꬖꬠ-ꬦꬨ-ꬮꬰ-ê­šê­œ-ꭥꭰ-ꯪ가-힣ힰ-ퟆퟋ-ퟻ豈-ï©­ï©°-龎ff-stﬓ-ﬗï¬-ﬨשׁ-זּטּ-לּמּנּï­ï­ƒï­„ï­†-ﮱﯓ-ï´½ïµ-ï¶ï¶’-ﷇﷰ-ﷻﹰ-ï¹´ï¹¶-ﻼA-Zï½-zヲ-하-ᅦᅧ-ï¿ï¿’-ᅲᅳ-ᅵ_0-9²³¹¼-¾٠-Ù©Û°-۹߀-߉०-९০-৯৴-৹੦-੯૦-૯୦-୯୲-୷௦-௲౦-౯౸-౾೦-೯൦-൵෦-à·¯à¹-๙à»-໙༠-༳á€-á‰á‚-á‚™á©-á¼á›®-ᛰ០-៩៰-៹á -᠙᥆-á¥á§-᧚᪀-᪉áª-᪙á­-᭙᮰-᮹᱀-᱉á±-á±™â°â´-â¹â‚€-₉â…-ↂↅ-↉①-⒛⓪-â“¿â¶-➓⳽〇〡-〩〸-〺㆒-㆕㈠-㈩㉈-ã‰ã‰‘-㉟㊀-㊉㊱-㊿꘠-꘩ꛦ-ꛯ꠰-ê µê£-꣙꤀-꤉ê§-꧙꧰-ê§¹ê©-꩙꯰-꯹ï¼-ï¼™]*)\})/, +/^(?:\{([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff][^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*)\})/, +/^(?:\{([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff][^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*)\})/, /^(?:\{)/, /^(?:\})/, /^(?:.)/, From edf0306585a454b4a0431ce2db23de22baa0433a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 10 Jun 2016 19:23:05 +0200 Subject: [PATCH 150/417] - killed lingering debug code in regexp-lexer - updated the README with proper developer build instructions - minimal code cleanup --- README.md | 95 ++++++++++++++++++++++++++++++++++++--------------- lex-parser.js | 56 ++++++++++++++++++------------ lex.l | 32 +++++++++++------ lex.y | 45 +++++++++++++++--------- 4 files changed, 153 insertions(+), 75 deletions(-) diff --git a/README.md b/README.md index 60b5b3a..5ee1512 100644 --- a/README.md +++ b/README.md @@ -10,10 +10,17 @@ A parser for lexical grammars used by [jison](http://jison.org) and jison-lex. To build the parser yourself, clone the git repo then run: + make prep + +to install required packages and then run: + make + +to run the unit tests. This will generate `lex-parser.js`. + ## usage var lexParser = require("lex-parser"); @@ -21,18 +28,40 @@ This will generate `lex-parser.js`. // parse a lexical grammar and return JSON lexParser.parse("%% ... "); + ## example The parser can parse its own lexical grammar, shown below: ``` -NAME [a-zA-Z_](?:[a-zA-Z0-9_-]*[a-zA-Z0-9_])? -ID [a-zA-Z_][a-zA-Z0-9_]* + +ASCII_LETTER [a-zA-z] +// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge with {UNICODE_LETTER}: +UNICODE_LETTER [\p{Alphabetic}] +ALPHA [{UNICODE_LETTER}_] +DIGIT [\p{Number}] +WHITESPACE [\s\r\n\p{Separator}] + +NAME [{ALPHA}](?:[{ALPHA}{DIGIT}-]*[{ALPHA}{DIGIT}])? +ID [{ALPHA}][{ALPHA}{DIGIT}]* BR \r\n|\n|\r +// WhiteSpace MUST NOT match CR/LF and the regex `\s` DOES, so we cannot use that one directly. +// Instead we define the {WS} macro here: +WS [^\S\r\n] -%s indented trail rules + +%s indented trail rules macro %x code start_condition options conditions action path set + +// Off Topic +// --------- +// +// Do not specify the xregexp option as we want the XRegExp \p{...} regex macros converted to +// native regexes and used as such: +// +// %options xregexp + %options easy_keyword_rules %options ranges @@ -54,12 +83,12 @@ BR \r\n|\n|\r "*" return '*'; {BR}+ /* empty */ -\s+{BR}+ /* empty */ +{WS}+{BR}+ /* empty */ \s+ this.begin('indented'); "%%" this.begin('code'); return '%%'; -[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ - %{ - // accept any non-regex, non-lex, non-string-delim, +[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ + %{ + // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is return 'CHARACTER_LIT'; %} @@ -69,23 +98,21 @@ BR \r\n|\n|\r "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; [^\s\r\n]+ return 'OPTION_VALUE'; {BR}+ this.popState(); return 'OPTIONS_END'; -\s+{BR}+ this.popState(); return 'OPTIONS_END'; -\s+ /* empty */ +{WS}+ /* skip whitespace */ {ID} return 'START_COND'; {BR}+ this.popState(); -\s+{BR}+ this.popState(); -\s+ /* empty */ +{WS}+ /* empty */ -\s*{BR}+ this.begin('rules'); +{WS}*{BR}+ this.begin('rules'); "{" yy.depth = 0; this.begin('action'); return '{'; "%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; "%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; "%include" %{ - // This is an include instruction in place of an action: - // thanks to the `.+` rule immediately below we need to semi-duplicate - // the `%include` token recognition here vs. the almost-identical rule for the same + // This is an include instruction in place of an action: + // thanks to the `.+` rule immediately below we need to semi-duplicate + // the `%include` token recognition here vs. the almost-identical rule for the same // further below. // There's no real harm as we need to do something special in this case anyway: // push 2 (two!) conditions. @@ -96,24 +123,34 @@ BR \r\n|\n|\r // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... - this.pushState('trail'); + this.pushState('trail'); // then push the immediate need: the 'path' condition. - this.pushState('path'); + this.pushState('path'); return 'INCLUDE'; - %} + %} .+ this.begin('rules'); return 'ACTION'; "/*"(.|\n|\r)*?"*/" /* ignore */ "//".* /* ignore */ +{ID} this.pushState('macro'); return 'NAME'; +{BR}+ this.popState('macro'); + +// Accept any non-regex-special character as a direct literal without the need to put quotes around it: +[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ + %{ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 'CHARACTER_LIT'; + %} + {BR}+ /* empty */ \s+ /* empty */ -{ID} return 'NAME'; + \"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; "'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; "[" this.pushState('set'); return 'REGEX_SET_START'; "|" return '|'; -// "["("\\\\"|"\]"|[^\]])*"]" return 'ANY_GROUP_REGEX'; "(?:" return 'SPECIAL_GROUP'; "(?=" return 'SPECIAL_GROUP'; "(?!" return 'SPECIAL_GROUP'; @@ -127,7 +164,7 @@ BR \r\n|\n|\r "<>" return '$'; "<" this.begin('conditions'); return '<'; "/!" return '/!'; // treated as `(?!atom)` -"/" return '/'; // treated as `(?=atom)` +"/" return '/'; // treated as `(?=atom)` "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) return 'ESCAPE_CHAR'; "\\". yytext = yytext.replace(/^\\/g, ''); return 'ESCAPE_CHAR'; @@ -137,8 +174,8 @@ BR \r\n|\n|\r "%s" this.begin('start_condition'); return 'START_INC'; "%x" this.begin('start_condition'); return 'START_EXC'; "%include" this.pushState('path'); return 'INCLUDE'; -"%"{NAME}[^\r\n]+ - %{ +"%"{NAME}[^\r\n]+ + %{ /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); return 'UNKNOWN_DECL'; @@ -149,11 +186,14 @@ BR \r\n|\n|\r "{"{ID}"}" return 'NAME_BRACE'; "{" return '{'; "}" return '}'; + . throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ + <*><> return 'EOF'; -("\\\\"|"\]"|[^\]])+ return 'REGEX_SET'; +(?:"\\\\"|"\\]"|[^\]{])+ return 'REGEX_SET'; +"{" return 'REGEX_SET'; "]" this.popState('set'); return 'REGEX_SET_END'; @@ -163,13 +203,13 @@ BR \r\n|\n|\r [^\r\n]+ return 'CODE'; // the bit of CODE just before EOF... -[\r\n] this.popState(); this.unput(yytext); +{BR} this.popState(); this.unput(yytext); "'"[^\r\n]+"'" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; '"'[^\r\n]+'"' yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; -\s+ // skip whitespace in the line +{WS}+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; -<*>. %{ +<*>. %{ /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); %} @@ -177,6 +217,7 @@ BR \r\n|\n|\r %% ``` + ## license MIT diff --git a/lex-parser.js b/lex-parser.js index 8fc15c2..f91567c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -804,8 +804,9 @@ break; case 35 : /*! Production:: regex : regex_list */ // Detect if the regex ends with a pure (Unicode) word; - // we *do* consider escaped characters which are 'alphanumeric' to be equivalent to their non-escaped version, - // hence these are all valid 'words' for the 'easy keyword rules' option: + // we *do* consider escaped characters which are 'alphanumeric' + // to be equivalent to their non-escaped version, hence these are + // all valid 'words' for the 'easy keyword rules' option: // // - hello_kitty // - γεια_σου_γατοÏλα @@ -813,32 +814,38 @@ case 35 : // // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 // - // As we only check the *tail*, we also accept these as 'easy keywords': + // As we only check the *tail*, we also accept these as + // 'easy keywords': // // - %options // - %foo-bar // - +++a:b:c1 // - // Note the dash in that last example: there the code will consider `bar` to be the keyword, - // which is fine with us as we're only interested in the taiol boundary and patching that one - // for the `easy_keyword_rules` option. + // Note the dash in that last example: there the code will consider + // `bar` to be the keyword, which is fine with us as we're only + // interested in the taiol boundary and patching that one for + // the `easy_keyword_rules` option. this.$ = $$[$0]; if (yy.options.easy_keyword_rules) { try { - // We need to 'protect' JSON.parse here as keywords are allowed to contain double-quotes and - // other leading cruft. - // JSON.parse *does* gobble some escapes (such as `\b`) but we protect against that through - // a simple replace regex: we're not interested in the special escapes' exact value anyway. - // It will also catch escaped escapes (`\\`), which are not word characters either, - // so no need to worry about JSON.parse 'correctly' converting convoluted constructs like - // '\\\\\\\\\\b' in here. + // We need to 'protect' JSON.parse here as keywords are allowed + // to contain double-quotes and other leading cruft. + // JSON.parse *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `JSON.parse()` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. this.$ = this.$ .replace(/"/g, '.' /* '\\"' */) .replace(/\\c[A-Z]/g, '.') .replace(/\\[^xu0-9]/g, '.'); this.$ = JSON.parse('"' + this.$ + '"'); - // a 'keyword' starts with an alphanumeric character, followed by zero or more alphanumerics or digits: + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: if (this.$.match(/\w[\w\d]*$/u)) { this.$ = $$[$0] + "\\b"; } else { @@ -905,7 +912,9 @@ case 58 : break; case 62 : /*! Production:: regex_set_atom : name_expansion */ - if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0]) { + if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) + && $$[$0].toUpperCase() !== $$[$0] + ) { // treat this as part of an XRegExp `\p{...}` Unicode slug: this.$ = $$[$0]; } else { @@ -2890,11 +2899,6 @@ performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) var YYSTATE = YY_START; switch($avoiding_name_collisions) { -case 2 : -/*! Conditions:: action */ -/*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - return 151; // regexp with braces or quotes (and no spaces) -break; case 7 : /*! Conditions:: action */ /*! Rule:: \{ */ @@ -2903,7 +2907,14 @@ break; case 8 : /*! Conditions:: action */ /*! Rule:: \} */ - if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return 125; + + if (yy.depth == 0) { + this.begin('trail'); + } else { + yy.depth--; + } + return 125; + break; case 10 : /*! Conditions:: conditions */ @@ -3186,6 +3197,9 @@ simpleCaseActionClusters: { /*! Rule:: \/\/.* */ 1 : 151, /*! Conditions:: action */ + /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ + 2 : 151, + /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ 3 : 151, /*! Conditions:: action */ diff --git a/lex.l b/lex.l index a8926e2..65b23b2 100644 --- a/lex.l +++ b/lex.l @@ -1,6 +1,8 @@ ASCII_LETTER [a-zA-z] -// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge with {UNICODE_LETTER}: +// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge +// with {UNICODE_LETTER} (though jison has code to optimize if you *did* +// include the `[a-zA-Z]` anyway): UNICODE_LETTER [\p{Alphabetic}] ALPHA [{UNICODE_LETTER}_] DIGIT [\p{Number}] @@ -9,8 +11,8 @@ WHITESPACE [\s\r\n\p{Separator}] NAME [{ALPHA}](?:[{ALPHA}{DIGIT}-]*[{ALPHA}{DIGIT}])? ID [{ALPHA}][{ALPHA}{DIGIT}]* BR \r\n|\n|\r -// WhiteSpace MUST NOT match CR/LF and the regex `\s` DOES, so we cannot use that one directly. -// Instead we define the {WS} macro here: +// WhiteSpace MUST NOT match CR/LF and the regex `\s` DOES, so we cannot use +// that one directly. Instead we define the {WS} macro here: WS [^\S\r\n] @@ -21,8 +23,8 @@ WS [^\S\r\n] // Off Topic // --------- // -// Do not specify the xregexp option as we want the XRegExp \p{...} regex macros converted to -// native regexes and used as such: +// Do not specify the xregexp option as we want the XRegExp \p{...} +// regex macros converted to native regexes and used as such: // // %options xregexp @@ -33,13 +35,21 @@ WS [^\S\r\n] "/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; "//".* return 'ACTION_BODY'; -"/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; // regexp with braces or quotes (and no spaces) +// regexp with braces or quotes (and no spaces): +"/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; \"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; "'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; [/"'][^{}/"']+ return 'ACTION_BODY'; [^{}/"']+ return 'ACTION_BODY'; "{" yy.depth++; return '{'; -"}" if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return '}'; +"}" %{ + if (yy.depth == 0) { + this.begin('trail'); + } else { + yy.depth--; + } + return '}'; + %} {NAME} return 'NAME'; ">" this.popState(); return '>'; @@ -100,7 +110,8 @@ WS [^\S\r\n] {ID} this.pushState('macro'); return 'NAME'; {BR}+ this.popState('macro'); -// Accept any non-regex-special character as a direct literal without the need to put quotes around it: +// Accept any non-regex-special character as a direct literal without +// the need to put quotes around it: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ %{ // accept any non-regex, non-lex, non-string-delim, @@ -161,8 +172,9 @@ WS [^\S\r\n] "]" this.popState('set'); return 'REGEX_SET_END'; -// in the trailing CODE block, only accept these `%include` macros when they appear at the start of a line -// and make sure the rest of lexer regexes account for this one so it'll match that way only: +// in the trailing CODE block, only accept these `%include` macros when +// they appear at the start of a line and make sure the rest of lexer +// regexes account for this one so it'll match that way only: [^\r\n]*(\r|\n)+ return 'CODE'; [^\r\n]+ return 'CODE'; // the bit of CODE just before EOF... diff --git a/lex.y b/lex.y index c5d168b..08f6595 100644 --- a/lex.y +++ b/lex.y @@ -35,7 +35,8 @@ lex ; rules_and_epilogue - : /* an empty rules set is allowed when you are setting up an `%options custom_lexer` */ EOF + : /* an empty rules set is allowed when you are setting up an `%options custom_lexer` */ + EOF { $$ = { rules: [] }; } @@ -61,7 +62,8 @@ rules_and_epilogue } ; -// because JISON doesn't support mid-rule actions, we set up `yy` using this empty rule at the start: +// because JISON doesn't support mid-rule actions, +// we set up `yy` using this empty rule at the start: init : %epsilon { @@ -178,8 +180,9 @@ regex : regex_list { // Detect if the regex ends with a pure (Unicode) word; - // we *do* consider escaped characters which are 'alphanumeric' to be equivalent to their non-escaped version, - // hence these are all valid 'words' for the 'easy keyword rules' option: + // we *do* consider escaped characters which are 'alphanumeric' + // to be equivalent to their non-escaped version, hence these are + // all valid 'words' for the 'easy keyword rules' option: // // - hello_kitty // - γεια_σου_γατοÏλα @@ -187,32 +190,38 @@ regex // // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 // - // As we only check the *tail*, we also accept these as 'easy keywords': + // As we only check the *tail*, we also accept these as + // 'easy keywords': // // - %options // - %foo-bar // - +++a:b:c1 // - // Note the dash in that last example: there the code will consider `bar` to be the keyword, - // which is fine with us as we're only interested in the taiol boundary and patching that one - // for the `easy_keyword_rules` option. + // Note the dash in that last example: there the code will consider + // `bar` to be the keyword, which is fine with us as we're only + // interested in the taiol boundary and patching that one for + // the `easy_keyword_rules` option. $$ = $regex_list; if (yy.options.easy_keyword_rules) { try { - // We need to 'protect' JSON.parse here as keywords are allowed to contain double-quotes and - // other leading cruft. - // JSON.parse *does* gobble some escapes (such as `\b`) but we protect against that through - // a simple replace regex: we're not interested in the special escapes' exact value anyway. - // It will also catch escaped escapes (`\\`), which are not word characters either, - // so no need to worry about JSON.parse 'correctly' converting convoluted constructs like - // '\\\\\\\\\\b' in here. + // We need to 'protect' JSON.parse here as keywords are allowed + // to contain double-quotes and other leading cruft. + // JSON.parse *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `JSON.parse()` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. $$ = $$ .replace(/"/g, '.' /* '\\"' */) .replace(/\\c[A-Z]/g, '.') .replace(/\\[^xu0-9]/g, '.'); $$ = JSON.parse('"' + $$ + '"'); - // a 'keyword' starts with an alphanumeric character, followed by zero or more alphanumerics or digits: + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: if ($$.match(/\w[\w\d]*$/u)) { $$ = $regex_list + "\\b"; } else { @@ -289,7 +298,9 @@ regex_set_atom : REGEX_SET | name_expansion { - if (XRegExp.isUnicodeSlug($name_expansion.replace(/[{}]/g, '')) && $name_expansion.toUpperCase() !== $name_expansion) { + if (XRegExp.isUnicodeSlug($name_expansion.replace(/[{}]/g, '')) + && $name_expansion.toUpperCase() !== $name_expansion + ) { // treat this as part of an XRegExp `\p{...}` Unicode slug: $$ = $name_expansion; } else { From e71cdf1cfbfadcece0e635e305d25ec8a1fe6ca3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 10 Jun 2016 19:43:32 +0200 Subject: [PATCH 151/417] bump revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 13aec80..6c9643e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-129", + "version": "0.1.4-130", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 557a553600898eff2a3a5a2f4f87377264ead0f0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 14 Jun 2016 15:33:08 +0200 Subject: [PATCH 152/417] bumped revision and rebuilt; also extended the jison CONTRIBUTING.md documentation to describe how to produce a 'release' of jison including GIT TAGging it with the latest version number. --- lex-parser.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index f91567c..2bfab12 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-129 */ +/* parser generated by jison 0.4.17-130 */ /* * Returns a Parser object of the following structure: * @@ -2444,7 +2444,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-129 */ +/* generated by jison-lex 0.3.4-130 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 diff --git a/package.json b/package.json index 6c9643e..e5c756f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-130", + "version": "0.1.4-131", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From a63dcbb94a250a987cfc893795bb6090e180a7df Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 14 Jun 2016 15:46:55 +0200 Subject: [PATCH 153/417] rebuilt as per CONTRIBUTION.md release description, after pushing and fetching the latest code to/from github: observe the internal build numbers jump to the current rev/build: build 131 --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 2bfab12..980f3d9 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-130 */ +/* parser generated by jison 0.4.17-131 */ /* * Returns a Parser object of the following structure: * @@ -2444,7 +2444,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-130 */ +/* generated by jison-lex 0.3.4-131 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From 4154c865131485fc7e5e0905504d8841f1cd9c94 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 6 Jul 2016 15:16:04 +0200 Subject: [PATCH 154/417] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e5c756f..fc7f465 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-131", + "version": "0.1.4-132", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 11c15044901b289a225c3a3fec992a85492d636a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 6 Jul 2016 17:24:52 +0200 Subject: [PATCH 155/417] - added warning about refoctoring one of the grammar rules in here which is just begging for it: if you try, you'll hit reduce/reduce conflicts as then the grammar is not exactly LALR(1) any longer! (I tried it because I wasn't careful and had forgotten about the hassle `rules_and_epilogue` has given me before... >:-( ) --- lex.y | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/lex.y b/lex.y index 08f6595..a3539d1 100644 --- a/lex.y +++ b/lex.y @@ -34,9 +34,18 @@ lex } ; +/* + * WARNING: when you want to refactor this rule, you'll get into a world of hurt + * as then the grammar won't be LALR(1) any longer! The shite start to happen + * as soon as you take away the EOF in here and move it to the top grammar rule + * where it really belongs. Other refactorings of this rule to reduce the code + * duplication in these action blocks leads to the same effect, thanks to the + * different refactored rules then fighting it out in reduce/reduce conflicts + * thanks to the epsilon rules everywhere in there. You have been warned... + */ rules_and_epilogue - : /* an empty rules set is allowed when you are setting up an `%options custom_lexer` */ - EOF + : EOF + /* an empty rules set is allowed when you are setting up an `%options custom_lexer` */ { $$ = { rules: [] }; } @@ -65,7 +74,7 @@ rules_and_epilogue // because JISON doesn't support mid-rule actions, // we set up `yy` using this empty rule at the start: init - : %epsilon + : ε { yy.actionInclude = []; if (!yy.options) yy.options = {}; @@ -91,7 +100,7 @@ definitions } } } - | %epsilon + | ε { $$ = [null, null]; } ; @@ -155,7 +164,7 @@ action_body ; action_comments_body - : %epsilon + : ε { $$ = ''; } | action_comments_body ACTION_BODY { $$ = $action_comments_body + $ACTION_BODY; } @@ -240,7 +249,7 @@ regex_list | regex_list '|' { $$ = $1 + '|'; } | regex_concat - | %epsilon + | ε { $$ = ''; } ; @@ -375,7 +384,7 @@ module_code_chunk optional_module_code_chunk : module_code_chunk { $$ = $module_code_chunk; } - | %epsilon + | ε { $$ = ''; } ; From 37f87b36d47a0f8b1828c6ec9eea2bf3d3fb7353 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 6 Jul 2016 17:25:19 +0200 Subject: [PATCH 156/417] `make` = regenerate grammar --- lex-parser.js | 55 +++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 13 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 980f3d9..02ccfe9 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,9 +1,12 @@ -/* parser generated by jison 0.4.17-131 */ +/* parser generated by jison 0.4.17-132 */ /* * Returns a Parser object of the following structure: * * Parser: { - * yy: {} + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a derivative/copy of this one, + * not a direct reference! * } * * Parser.prototype: { @@ -32,7 +35,7 @@ * terminal_descriptions_: (if there are any) {associative list: number ==> description}, * productions_: [...], * - * performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$, yystack, ...), + * performAction: function parser__performAction(yytext, yyleng, yylineno, yy, yystate, $$, _$, yystack, ...), * where `...` denotes the (optional) additional arguments the user passed to * `parser.parse(str, ...)` * @@ -61,27 +64,29 @@ * parse: function(input), * * lexer: { + * yy: {...}, A reference to the so-called "shared state" `yy` once + * received via a call to the `.setInput(input, yy)` lexer API. * EOF: 1, * ERROR: 2, * JisonLexerError: function(msg, hash), * parseError: function(str, hash), - * setInput: function(input), + * setInput: function(input, [yy]), * input: function(), * unput: function(str), * more: function(), * reject: function(), * less: function(n), - * pastInput: function(), - * upcomingInput: function(), + * pastInput: function(n), + * upcomingInput: function(n), * showPosition: function(), * test_match: function(regex_match_array, rule_index), * next: function(), * lex: function(), * begin: function(condition), + * pushState: function(condition), * popState: function(), - * _currentRules: function(), * topState: function(), - * pushState: function(condition), + * _currentRules: function(), * stateStackSize: function(), * * options: { ... lexer %options ... }, @@ -128,6 +133,9 @@ * for instance, for advanced error analysis and reporting) * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, * for instance, for advanced error analysis and reporting) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) * lexer: (reference to the current lexer instance used by the parser) * } * @@ -614,7 +622,7 @@ productions_: bp({ 0 ]) }), -performAction: function anonymous(yytext, yy, yystate /* action[1] */, $$ /* vstack */) { +performAction: function parser__PerformAction(yytext, yy, yystate /* action[1] */, $$ /* vstack */) { /* this == yyval */ var $0 = $$.length - 1; @@ -1964,6 +1972,20 @@ describeSymbol: function describeSymbol(symbol) { } else if (this.terminals_[symbol]) { return this.quoteName(this.terminals_[symbol]); + } + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. + // + // An example of this may be where a rule's action code contains a call like this: + // + // parser.describeSymbol(#$) + // + // to obtain a human-readable description or name of the current grammar rule. This comes handy in + // error handling action code blocks, for example. + var s = this.symbols_; + for (var key in s) { + if (s[key] === symbol) { + return key; + } } return null; }, @@ -2178,6 +2200,7 @@ parse: function parse(input) { state_stack: stack, value_stack: vstack, + yy: sharedState.yy, lexer: lexer }); @@ -2206,6 +2229,7 @@ parse: function parse(input) { state_stack: stack, value_stack: vstack, + yy: sharedState.yy, lexer: lexer }); break; @@ -2235,6 +2259,7 @@ parse: function parse(input) { state_stack: stack, value_stack: vstack, + yy: sharedState.yy, lexer: lexer }); break; @@ -2269,6 +2294,7 @@ parse: function parse(input) { state_stack: stack, value_stack: vstack, + yy: sharedState.yy, lexer: lexer }); break; @@ -2287,6 +2313,7 @@ parse: function parse(input) { state_stack: stack, value_stack: vstack, + yy: sharedState.yy, lexer: lexer }); break; @@ -2411,6 +2438,7 @@ parse: function parse(input) { state_stack: stack, value_stack: vstack, + yy: sharedState.yy, lexer: lexer }); } finally { @@ -2444,7 +2472,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-131 */ +/* generated by jison-lex 0.3.4-132 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 @@ -2641,7 +2669,7 @@ reject:function lexer_reject() { // retain first n characters of the match less:function lexer_less(n) { - this.unput(this.match.slice(n)); + return this.unput(this.match.slice(n)); }, // return (part of the) already matched input, i.e. for error messages @@ -2849,7 +2877,7 @@ lex:function lexer_lex() { // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) begin:function lexer_begin(condition) { - this.conditionStack.push(condition); + return this.pushState(condition); }, // pop the previously active lexer condition state off the condition stack @@ -2883,7 +2911,8 @@ topState:function lexer_topState(n) { // alias for begin(condition) pushState:function lexer_pushState(condition) { - this.begin(condition); + this.conditionStack.push(condition); + return this; }, // return the number of states currently on the stack From c211dbdabd64b9454e9f2d028f0c2897663b8ac1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 03:46:02 +0200 Subject: [PATCH 157/417] `make clean; make prep; make site` --- lex-parser.js | 857 +++++++++++++++++++++++++++----------------------- 1 file changed, 471 insertions(+), 386 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 02ccfe9..16b223c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -627,334 +627,380 @@ performAction: function parser__PerformAction(yytext, yy, yystate /* action[1] * var $0 = $$.length - 1; switch (yystate) { -case 1 : -/*! Production:: lex : init definitions '%%' rules_and_epilogue */ - this.$ = $$[$0]; - if ($$[$0 - 2][0]) this.$.macros = $$[$0 - 2][0]; - if ($$[$0 - 2][1]) this.$.startConditions = $$[$0 - 2][1]; - if ($$[$0 - 2][2]) this.$.unknownDecls = $$[$0 - 2][2]; - // if there are any options, add them all, otherwise set options to NULL: - // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: - for (var k in yy.options) { - this.$.options = yy.options; - break; - } - if (yy.actionInclude) { - var asrc = yy.actionInclude.join('\n\n'); - // Only a non-empty action code chunk should actually make it through: - if (asrc.trim() !== '') { - this.$.actionInclude = asrc; - } - } - delete yy.options; - delete yy.actionInclude; - return this.$; -break; -case 2 : -/*! Production:: rules_and_epilogue : EOF */ - this.$ = { rules: [] }; -break; -case 3 : -/*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { - this.$ = { rules: [], moduleInclude: $$[$0 - 1] }; - } else { - this.$ = { rules: [] }; - } -break; -case 4 : -/*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code EOF */ - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { - this.$ = { rules: $$[$0 - 3], moduleInclude: $$[$0 - 1] }; +case 1: + /*! Production:: lex : init definitions '%%' rules_and_epilogue */ + this.$ = $$[$0]; + if ($$[$0 - 2][0]) this.$.macros = $$[$0 - 2][0]; + if ($$[$0 - 2][1]) this.$.startConditions = $$[$0 - 2][1]; + if ($$[$0 - 2][2]) this.$.unknownDecls = $$[$0 - 2][2]; + // if there are any options, add them all, otherwise set options to NULL: + // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: + for (var k in yy.options) { + this.$.options = yy.options; + break; + } + if (yy.actionInclude) { + var asrc = yy.actionInclude.join('\n\n'); + // Only a non-empty action code chunk should actually make it through: + if (asrc.trim() !== '') { + this.$.actionInclude = asrc; + } + } + delete yy.options; + delete yy.actionInclude; + return this.$; + break; + +case 2: + /*! Production:: rules_and_epilogue : EOF */ + this.$ = { rules: [] }; + break; + +case 3: + /*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + this.$ = { rules: [], moduleInclude: $$[$0 - 1] }; + } else { + this.$ = { rules: [] }; + } + break; + +case 4: + /*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code EOF */ + if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { + this.$ = { rules: $$[$0 - 3], moduleInclude: $$[$0 - 1] }; + } else { + this.$ = { rules: $$[$0 - 3] }; + } + break; + +case 5: + /*! Production:: rules_and_epilogue : rules EOF */ + this.$ = { rules: $$[$0 - 1] }; + break; + +case 6: + /*! Production:: init : ε */ + yy.actionInclude = []; + if (!yy.options) yy.options = {}; + break; + +case 7: + /*! Production:: definitions : definition definitions */ + this.$ = $$[$0]; + if ($$[$0 - 1] != null) { + if ('length' in $$[$0 - 1]) { + this.$[0] = this.$[0] || {}; + this.$[0][$$[$0 - 1][0]] = $$[$0 - 1][1]; + } else if ($$[$0 - 1].type === 'names') { + this.$[1] = this.$[1] || {}; + for (var name in $$[$0 - 1].names) { + this.$[1][name] = $$[$0 - 1].names[name]; + } + } else if ($$[$0 - 1].type === 'unknown') { + this.$[2] = this.$[2] || []; + this.$[2].push($$[$0 - 1].body); + } + } + break; + +case 8: + /*! Production:: definitions : ε */ + this.$ = [null, null]; + break; + +case 9: + /*! Production:: definition : NAME regex */ + this.$ = [$$[$0 - 1], $$[$0]]; + break; + +case 10: + /*! Production:: definition : START_INC names_inclusive */ +case 11: + /*! Production:: definition : START_EXC names_exclusive */ +case 24: + /*! Production:: action : ACTION */ +case 25: + /*! Production:: action : include_macro_code */ +case 26: + /*! Production:: action_body : action_comments_body */ +case 63: + /*! Production:: escape_char : ESCAPE_CHAR */ +case 64: + /*! Production:: range_regex : RANGE_REGEX */ +case 73: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ +case 77: + /*! Production:: module_code_chunk : CODE */ +case 79: + /*! Production:: optional_module_code_chunk : module_code_chunk */ + this.$ = $$[$0]; + break; + +case 12: + /*! Production:: definition : ACTION */ +case 13: + /*! Production:: definition : include_macro_code */ + yy.actionInclude.push($$[$0]); this.$ = null; + break; + +case 14: + /*! Production:: definition : options */ + this.$ = null; + break; + +case 15: + /*! Production:: definition : UNKNOWN_DECL */ + this.$ = {type: 'unknown', body: $$[$0]}; + break; + +case 16: + /*! Production:: names_inclusive : START_COND */ + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; + break; + +case 17: + /*! Production:: names_inclusive : names_inclusive START_COND */ + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; + break; + +case 18: + /*! Production:: names_exclusive : START_COND */ + this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; + break; + +case 19: + /*! Production:: names_exclusive : names_exclusive START_COND */ + this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; + break; + +case 20: + /*! Production:: rules : rules rule */ + this.$ = $$[$0 - 1]; this.$.push($$[$0]); + break; + +case 21: + /*! Production:: rules : rule */ +case 33: + /*! Production:: name_list : NAME */ + this.$ = [$$[$0]]; + break; + +case 22: + /*! Production:: rule : start_conditions regex action */ + this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; + break; + +case 23: + /*! Production:: action : '{' action_body '}' */ +case 30: + /*! Production:: start_conditions : '<' name_list '>' */ + this.$ = $$[$0 - 1]; + break; + +case 27: + /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ + this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + break; + +case 28: + /*! Production:: action_comments_body : ε */ +case 39: + /*! Production:: regex_list : ε */ +case 80: + /*! Production:: optional_module_code_chunk : ε */ + this.$ = ''; + break; + +case 29: + /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ +case 40: + /*! Production:: regex_concat : regex_concat regex_base */ +case 50: + /*! Production:: regex_base : regex_base range_regex */ +case 59: + /*! Production:: regex_set : regex_set_atom regex_set */ +case 78: + /*! Production:: module_code_chunk : module_code_chunk CODE */ + this.$ = $$[$0 - 1] + $$[$0]; + break; + +case 31: + /*! Production:: start_conditions : '<' '*' '>' */ + this.$ = ['*']; + break; + +case 34: + /*! Production:: name_list : name_list ',' NAME */ + this.$ = $$[$0 - 2]; this.$.push($$[$0]); + break; + +case 35: + /*! Production:: regex : regex_list */ + // Detect if the regex ends with a pure (Unicode) word; + // we *do* consider escaped characters which are 'alphanumeric' + // to be equivalent to their non-escaped version, hence these are + // all valid 'words' for the 'easy keyword rules' option: + // + // - hello_kitty + // - γεια_σου_γατοÏλα + // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 + // + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // + // As we only check the *tail*, we also accept these as + // 'easy keywords': + // + // - %options + // - %foo-bar + // - +++a:b:c1 + // + // Note the dash in that last example: there the code will consider + // `bar` to be the keyword, which is fine with us as we're only + // interested in the taiol boundary and patching that one for + // the `easy_keyword_rules` option. + this.$ = $$[$0]; + if (yy.options.easy_keyword_rules) { + try { + // We need to 'protect' JSON.parse here as keywords are allowed + // to contain double-quotes and other leading cruft. + // JSON.parse *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `JSON.parse()` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. + this.$ = this.$ + .replace(/"/g, '.' /* '\\"' */) + .replace(/\\c[A-Z]/g, '.') + .replace(/\\[^xu0-9]/g, '.'); + + this.$ = JSON.parse('"' + this.$ + '"'); + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: + if (this.$.match(/\w[\w\d]*$/u)) { + this.$ = $$[$0] + "\\b"; } else { - this.$ = { rules: $$[$0 - 3] }; - } -break; -case 5 : -/*! Production:: rules_and_epilogue : rules EOF */ - this.$ = { rules: $$[$0 - 1] }; -break; -case 6 : -/*! Production:: init : ε */ - yy.actionInclude = []; - if (!yy.options) yy.options = {}; -break; -case 7 : -/*! Production:: definitions : definition definitions */ - this.$ = $$[$0]; - if ($$[$0 - 1] != null) { - if ('length' in $$[$0 - 1]) { - this.$[0] = this.$[0] || {}; - this.$[0][$$[$0 - 1][0]] = $$[$0 - 1][1]; - } else if ($$[$0 - 1].type === 'names') { - this.$[1] = this.$[1] || {}; - for (var name in $$[$0 - 1].names) { - this.$[1][name] = $$[$0 - 1].names[name]; - } - } else if ($$[$0 - 1].type === 'unknown') { - this.$[2] = this.$[2] || []; - this.$[2].push($$[$0 - 1].body); - } - } -break; -case 8 : -/*! Production:: definitions : ε */ - this.$ = [null, null]; -break; -case 9 : -/*! Production:: definition : NAME regex */ - this.$ = [$$[$0 - 1], $$[$0]]; -break; -case 10 : -/*! Production:: definition : START_INC names_inclusive */ - case 11 : -/*! Production:: definition : START_EXC names_exclusive */ - case 24 : -/*! Production:: action : ACTION */ - case 25 : -/*! Production:: action : include_macro_code */ - case 26 : -/*! Production:: action_body : action_comments_body */ - case 63 : -/*! Production:: escape_char : ESCAPE_CHAR */ - case 64 : -/*! Production:: range_regex : RANGE_REGEX */ - case 73 : -/*! Production:: extra_lexer_module_code : optional_module_code_chunk */ - case 77 : -/*! Production:: module_code_chunk : CODE */ - case 79 : -/*! Production:: optional_module_code_chunk : module_code_chunk */ - this.$ = $$[$0]; -break; -case 12 : -/*! Production:: definition : ACTION */ - case 13 : -/*! Production:: definition : include_macro_code */ - yy.actionInclude.push($$[$0]); this.$ = null; -break; -case 14 : -/*! Production:: definition : options */ - this.$ = null; -break; -case 15 : -/*! Production:: definition : UNKNOWN_DECL */ - this.$ = {type: 'unknown', body: $$[$0]}; -break; -case 16 : -/*! Production:: names_inclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; -break; -case 17 : -/*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; -break; -case 18 : -/*! Production:: names_exclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; -break; -case 19 : -/*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; -break; -case 20 : -/*! Production:: rules : rules rule */ - this.$ = $$[$0 - 1]; this.$.push($$[$0]); -break; -case 21 : -/*! Production:: rules : rule */ - case 33 : -/*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; -break; -case 22 : -/*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; -break; -case 23 : -/*! Production:: action : '{' action_body '}' */ - case 30 : -/*! Production:: start_conditions : '<' name_list '>' */ - this.$ = $$[$0 - 1]; -break; -case 27 : -/*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ - this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; -break; -case 28 : -/*! Production:: action_comments_body : ε */ - case 39 : -/*! Production:: regex_list : ε */ - case 80 : -/*! Production:: optional_module_code_chunk : ε */ - this.$ = ''; -break; -case 29 : -/*! Production:: action_comments_body : action_comments_body ACTION_BODY */ - case 40 : -/*! Production:: regex_concat : regex_concat regex_base */ - case 50 : -/*! Production:: regex_base : regex_base range_regex */ - case 59 : -/*! Production:: regex_set : regex_set_atom regex_set */ - case 78 : -/*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = $$[$0 - 1] + $$[$0]; -break; -case 31 : -/*! Production:: start_conditions : '<' '*' '>' */ - this.$ = ['*']; -break; -case 34 : -/*! Production:: name_list : name_list ',' NAME */ - this.$ = $$[$0 - 2]; this.$.push($$[$0]); -break; -case 35 : -/*! Production:: regex : regex_list */ - // Detect if the regex ends with a pure (Unicode) word; - // we *do* consider escaped characters which are 'alphanumeric' - // to be equivalent to their non-escaped version, hence these are - // all valid 'words' for the 'easy keyword rules' option: - // - // - hello_kitty - // - γεια_σου_γατοÏλα - // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 - // - // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 - // - // As we only check the *tail*, we also accept these as - // 'easy keywords': - // - // - %options - // - %foo-bar - // - +++a:b:c1 - // - // Note the dash in that last example: there the code will consider - // `bar` to be the keyword, which is fine with us as we're only - // interested in the taiol boundary and patching that one for - // the `easy_keyword_rules` option. this.$ = $$[$0]; - if (yy.options.easy_keyword_rules) { - try { - // We need to 'protect' JSON.parse here as keywords are allowed - // to contain double-quotes and other leading cruft. - // JSON.parse *does* gobble some escapes (such as `\b`) but - // we protect against that through a simple replace regex: - // we're not interested in the special escapes' exact value - // anyway. - // It will also catch escaped escapes (`\\`), which are not - // word characters either, so no need to worry about - // `JSON.parse()` 'correctly' converting convoluted constructs - // like '\\\\\\\\\\b' in here. - this.$ = this.$ - .replace(/"/g, '.' /* '\\"' */) - .replace(/\\c[A-Z]/g, '.') - .replace(/\\[^xu0-9]/g, '.'); - - this.$ = JSON.parse('"' + this.$ + '"'); - // a 'keyword' starts with an alphanumeric character, - // followed by zero or more alphanumerics or digits: - if (this.$.match(/\w[\w\d]*$/u)) { - this.$ = $$[$0] + "\\b"; - } else { - this.$ = $$[$0]; - } - } catch (ex) { - this.$ = $$[$0]; - } - } -break; -case 36 : -/*! Production:: regex_list : regex_list '|' regex_concat */ - this.$ = $$[$0 - 2] + '|' + $$[$0]; -break; -case 37 : -/*! Production:: regex_list : regex_list '|' */ - this.$ = $$[$0 - 1] + '|'; -break; -case 42 : -/*! Production:: regex_base : '(' regex_list ')' */ - this.$ = '(' + $$[$0 - 1] + ')'; -break; -case 43 : -/*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; -break; -case 44 : -/*! Production:: regex_base : regex_base '+' */ - this.$ = $$[$0 - 1] + '+'; -break; -case 45 : -/*! Production:: regex_base : regex_base '*' */ - this.$ = $$[$0 - 1] + '*'; -break; -case 46 : -/*! Production:: regex_base : regex_base '?' */ - this.$ = $$[$0 - 1] + '?'; -break; -case 47 : -/*! Production:: regex_base : '/' regex_base */ - this.$ = '(?=' + $$[$0] + ')'; -break; -case 48 : -/*! Production:: regex_base : '/!' regex_base */ - this.$ = '(?!' + $$[$0] + ')'; -break; -case 52 : -/*! Production:: regex_base : '.' */ - this.$ = '.'; -break; -case 53 : -/*! Production:: regex_base : '^' */ - this.$ = '^'; -break; -case 54 : -/*! Production:: regex_base : '$' */ - this.$ = '$'; -break; -case 58 : -/*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ - case 74 : -/*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; -break; -case 62 : -/*! Production:: regex_set_atom : name_expansion */ - if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) - && $$[$0].toUpperCase() !== $$[$0] - ) { - // treat this as part of an XRegExp `\p{...}` Unicode slug: - this.$ = $$[$0]; - } else { - this.$ = $$[$0]; - } - //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); -break; -case 65 : -/*! Production:: string : STRING_LIT */ - this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); -break; -case 70 : -/*! Production:: option : NAME[option] */ - yy.options[$$[$0]] = true; -break; -case 71 : -/*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ - case 72 : -/*! Production:: option : NAME[option] '=' NAME[value] */ - yy.options[$$[$0 - 2]] = $$[$0]; -break; -case 75 : -/*! Production:: include_macro_code : INCLUDE PATH */ - var fs = require('fs'); - var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); - // And no, we don't support nested '%include': - this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; -break; -case 76 : -/*! Production:: include_macro_code : INCLUDE error */ - console.error("%include MUST be followed by a valid file path"); -break; + } + } catch (ex) { + this.$ = $$[$0]; + } + } + break; + +case 36: + /*! Production:: regex_list : regex_list '|' regex_concat */ + this.$ = $$[$0 - 2] + '|' + $$[$0]; + break; + +case 37: + /*! Production:: regex_list : regex_list '|' */ + this.$ = $$[$0 - 1] + '|'; + break; + +case 42: + /*! Production:: regex_base : '(' regex_list ')' */ + this.$ = '(' + $$[$0 - 1] + ')'; + break; + +case 43: + /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ + this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; + break; + +case 44: + /*! Production:: regex_base : regex_base '+' */ + this.$ = $$[$0 - 1] + '+'; + break; + +case 45: + /*! Production:: regex_base : regex_base '*' */ + this.$ = $$[$0 - 1] + '*'; + break; + +case 46: + /*! Production:: regex_base : regex_base '?' */ + this.$ = $$[$0 - 1] + '?'; + break; + +case 47: + /*! Production:: regex_base : '/' regex_base */ + this.$ = '(?=' + $$[$0] + ')'; + break; + +case 48: + /*! Production:: regex_base : '/!' regex_base */ + this.$ = '(?!' + $$[$0] + ')'; + break; + +case 52: + /*! Production:: regex_base : '.' */ + this.$ = '.'; + break; + +case 53: + /*! Production:: regex_base : '^' */ + this.$ = '^'; + break; + +case 54: + /*! Production:: regex_base : '$' */ + this.$ = '$'; + break; + +case 58: + /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ +case 74: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ + this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + break; + +case 62: + /*! Production:: regex_set_atom : name_expansion */ + if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) + && $$[$0].toUpperCase() !== $$[$0] + ) { + // treat this as part of an XRegExp `\p{...}` Unicode slug: + this.$ = $$[$0]; + } else { + this.$ = $$[$0]; + } + //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + break; + +case 65: + /*! Production:: string : STRING_LIT */ + this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); + break; + +case 70: + /*! Production:: option : NAME[option] */ + yy.options[$$[$0]] = true; + break; + +case 71: + /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ +case 72: + /*! Production:: option : NAME[option] '=' NAME[value] */ + yy.options[$$[$0 - 2]] = $$[$0]; + break; + +case 75: + /*! Production:: include_macro_code : INCLUDE PATH */ + var fs = require('fs'); + var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); + // And no, we don't support nested '%include': + this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; + break; + +case 76: + /*! Production:: include_macro_code : INCLUDE error */ + console.error("%include MUST be followed by a valid file path"); + break; + } }, table: bt({ @@ -2116,6 +2162,10 @@ parse: function parse(input) { } + // SHA-1: c4ea524b22935710d98252a1d9e04ddb82555e56 :: shut up error reports about non-strict mode in Chrome in the demo pages: + // (NodeJS doesn't care, so this semicolon is only important for the demo web pages which run the jison *GENERATOR* in a web page...) + ; + // Produce a (more or less) human-readable list of expected tokens at the point of failure. // // The produced list may contain token or token set descriptions instead of the tokens @@ -2527,27 +2577,34 @@ function JisonLexerError(msg, hash) { var lexer = { + EOF: 1, + ERROR: 2, + + // JisonLexerError: JisonLexerError, // <-- injected by the code generator -EOF:1, + // options: {}, // <-- injected by the code generator -ERROR:2, + // yy: ..., // <-- injected by setInput() + + __currentRuleSet__: null, // <-- internal rule set cache for the current lexer state -parseError:function lexer_parseError(str, hash) { + parseError: function lexer_parseError(str, hash) { if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { return this.yy.parser.parseError(str, hash) || this.ERROR; } else { throw new this.JisonLexerError(str); } }, - -// resets the lexer, sets new input -setInput:function lexer_setInput(input, yy) { + + // resets the lexer, sets new input + setInput: function lexer_setInput(input, yy) { this.yy = yy || this.yy || {}; this._input = input; this._more = this._backtrack = this._signaled_error_token = this.done = false; this.yylineno = this.yyleng = 0; this.yytext = this.matched = this.match = ''; this.conditionStack = ['INITIAL']; + this.__currentRuleSet__ = null; this.yylloc = { first_line: 1, first_column: 0, @@ -2561,8 +2618,8 @@ setInput:function lexer_setInput(input, yy) { return this; }, -// consumes and returns one char from the input -input:function lexer_input() { + // consumes and returns one char from the input + input: function lexer_input() { if (!this._input) { this.done = true; return null; @@ -2611,8 +2668,8 @@ input:function lexer_input() { return ch; }, -// unshifts one char (or a string) into the input -unput:function lexer_unput(ch) { + // unshifts one char (or a string) into the input + unput: function lexer_unput(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); @@ -2642,14 +2699,14 @@ unput:function lexer_unput(ch) { return this; }, -// When called from action, caches matched text and appends it on next action -more:function lexer_more() { + // When called from action, caches matched text and appends it on next action + more: function lexer_more() { this._more = true; return this; }, -// When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. -reject:function lexer_reject() { + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function lexer_reject() { if (this.options.backtrack_lexer) { this._backtrack = true; } else { @@ -2667,13 +2724,13 @@ reject:function lexer_reject() { return this; }, -// retain first n characters of the match -less:function lexer_less(n) { + // retain first n characters of the match + less: function lexer_less(n) { return this.unput(this.match.slice(n)); }, -// return (part of the) already matched input, i.e. for error messages -pastInput:function lexer_pastInput(maxSize) { + // return (part of the) already matched input, i.e. for error messages + pastInput: function lexer_pastInput(maxSize) { var past = this.matched.substr(0, this.matched.length - this.match.length); if (maxSize < 0) maxSize = past.length; @@ -2682,8 +2739,8 @@ pastInput:function lexer_pastInput(maxSize) { return (past.length > maxSize ? '...' + past.substr(-maxSize) : past); }, -// return (part of the) upcoming input, i.e. for error messages -upcomingInput:function lexer_upcomingInput(maxSize) { + // return (part of the) upcoming input, i.e. for error messages + upcomingInput: function lexer_upcomingInput(maxSize) { var next = this.match; if (maxSize < 0) maxSize = next.length + this._input.length; @@ -2695,18 +2752,30 @@ upcomingInput:function lexer_upcomingInput(maxSize) { return (next.length > maxSize ? next.substr(0, maxSize) + '...' : next); }, -// return a string which displays the character position where the lexing error occurred, i.e. for error messages -showPosition:function lexer_showPosition() { + // return a string which displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function lexer_showPosition() { var pre = this.pastInput().replace(/\s/g, ' '); var c = new Array(pre.length + 1).join('-'); return pre + this.upcomingInput().replace(/\s/g, ' ') + '\n' + c + '^'; }, -// test the lexed token: return FALSE when not a match, otherwise return token -test_match:function lexer_test_match(match, indexed_rule) { + // test the lexed token: return FALSE when not a match, otherwise return token. + // + // `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + // contains the actually matched text string. + // + // Also move the input cursor forward and update the match collectors: + // - yytext + // - yyleng + // - match + // - matches + // - yylloc + // - offset + test_match: function lexer_test_match(match, indexed_rule) { var token, lines, - backup; + backup, + match_str; if (this.options.backtrack_lexer) { // save context @@ -2735,7 +2804,8 @@ test_match:function lexer_test_match(match, indexed_rule) { } } - lines = match[0].match(/(?:\r\n?|\n).*/g); + match_str = match[0]; + lines = match_str.match(/(?:\r\n?|\n).*/g); if (lines) { this.yylineno += lines.length; } @@ -2745,20 +2815,23 @@ test_match:function lexer_test_match(match, indexed_rule) { first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : - this.yylloc.last_column + match[0].length + this.yylloc.last_column + match_str.length }; - this.yytext += match[0]; - this.match += match[0]; + this.yytext += match_str; + this.match += match_str; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset + this.yyleng]; } - this.offset += this.yyleng; + // previous lex rules MAY have invoked the `more()` API rather than producing a token: + // those rules will already have moved this `offset` forward matching their match lengths, + // hence we must only add our own match length now: + this.offset += match_str.length; this._more = false; this._backtrack = false; - this._input = this._input.slice(match[0].length); - this.matched += match[0]; + this._input = this._input.slice(match_str.length); + this.matched += match_str; token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); if (this.done && this._input) { this.done = false; @@ -2770,6 +2843,7 @@ test_match:function lexer_test_match(match, indexed_rule) { for (var k in backup) { this[k] = backup[k]; } + this.__currentRuleSet__ = null; return false; // rule action called reject() implying the next rule should be tested instead. } else if (this._signaled_error_token) { // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! @@ -2780,8 +2854,8 @@ test_match:function lexer_test_match(match, indexed_rule) { return false; }, -// return next match in input -next:function lexer_next() { + // return next match in input + next: function lexer_next() { function clear() { this.yytext = ''; this.yyleng = 0; @@ -2806,8 +2880,15 @@ next:function lexer_next() { if (!this._more) { clear.call(this); } - var rules = this._currentRules(); - for (var i = 0; i < rules.length; i++) { + var rules = this.__currentRuleSet__; + if (!rules) { + // Update the ruleset cache as we apparently encountered a state change or just started lexing. + // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will + // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps + // speed up those activities a tiny bit. + rules = this.__currentRuleSet__ = this._currentRules(); + } + for (var i = 0, len = rules.length; i < len; i++) { tempMatch = this._input.match(this.rules[rules[i]]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; @@ -2817,7 +2898,7 @@ next:function lexer_next() { if (token !== false) { return token; } else if (this._backtrack) { - match = false; + match = undefined; continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) @@ -2858,8 +2939,8 @@ next:function lexer_next() { } }, -// return next match that has a token -lex:function lexer_lex() { + // return next match that has a token + lex: function lexer_lex() { var r; // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: if (typeof this.options.pre_lex === 'function') { @@ -2875,32 +2956,33 @@ lex:function lexer_lex() { return r; }, -// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) -begin:function lexer_begin(condition) { + // backwards compatible alias for `pushState()`; + // the latter is symmetrical with `popState()` and we advise to use + // those APIs in any modern lexer code, rather than `begin()`. + begin: function lexer_begin(condition) { return this.pushState(condition); }, -// pop the previously active lexer condition state off the condition stack -popState:function lexer_popState() { + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + pushState: function lexer_pushState(condition) { + this.conditionStack.push(condition); + this.__currentRuleSet__ = null; + return this; + }, + + // pop the previously active lexer condition state off the condition stack + popState: function lexer_popState() { var n = this.conditionStack.length - 1; if (n > 0) { + this.__currentRuleSet__ = null; return this.conditionStack.pop(); } else { return this.conditionStack[0]; } }, -// produce the lexer rule set which is active for the currently active lexer condition state -_currentRules:function lexer__currentRules() { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; - } else { - return this.conditions['INITIAL'].rules; - } - }, - -// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available -topState:function lexer_topState(n) { + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function lexer_topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { return this.conditionStack[n]; @@ -2909,14 +2991,17 @@ topState:function lexer_topState(n) { } }, -// alias for begin(condition) -pushState:function lexer_pushState(condition) { - this.conditionStack.push(condition); - return this; + // (internal) determine the lexer rule set which is active for the currently active lexer condition state + _currentRules: function lexer__currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + } else { + return this.conditions['INITIAL'].rules; + } }, -// return the number of states currently on the stack -stateStackSize:function lexer_stateStackSize() { + // return the number of states currently on the stack + stateStackSize: function lexer_stateStackSize() { return this.conditionStack.length; }, options: { From 19abe6a5adedd9035a778eba48dcca0be91a924d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 03:48:01 +0200 Subject: [PATCH 158/417] tagged previous commit & version bump for the next release... --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fc7f465..01f4077 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-132", + "version": "0.1.4-133", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 4fc675214c6a28cdcc457c92a7bcb3d9c07df3f6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 04:21:37 +0200 Subject: [PATCH 159/417] `make site` --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 16b223c..57f199c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-132 */ +/* parser generated by jison 0.4.17-133 */ /* * Returns a Parser object of the following structure: * @@ -2522,7 +2522,7 @@ function prepareString (s) { return s; }; -/* generated by jison-lex 0.3.4-132 */ +/* generated by jison-lex 0.3.4-133 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From 2096764cacfaa439d5430e5dc2c29ef1c7bfb7aa Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 22:32:32 +0200 Subject: [PATCH 160/417] support multiline actions which are not contained within `{...}` or `%{...%}` curly braces, but merely indented (every line); added test for this as well. --- lex.l | 6 +++--- lex.y | 34 +++++++++++++++++++++------------- tests/all-tests.js | 12 ++++++++++++ 3 files changed, 36 insertions(+), 16 deletions(-) diff --git a/lex.l b/lex.l index 65b23b2..923428c 100644 --- a/lex.l +++ b/lex.l @@ -58,7 +58,7 @@ WS [^\S\r\n] {BR}+ /* empty */ {WS}+{BR}+ /* empty */ -\s+ this.begin('indented'); +{WS}+ this.begin('indented'); "%%" this.begin('code'); return '%%'; [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ %{ @@ -102,10 +102,10 @@ WS [^\S\r\n] this.pushState('path'); return 'INCLUDE'; %} -.+ this.begin('rules'); return 'ACTION'; +.* this.popState(); return 'ACTION'; "/*"(.|\n|\r)*?"*/" /* ignore */ -"//".* /* ignore */ +"//"[^\r\n]* /* ignore */ {ID} this.pushState('macro'); return 'NAME'; {BR}+ this.popState('macro'); diff --git a/lex.y b/lex.y index a3539d1..96ccdc3 100644 --- a/lex.y +++ b/lex.y @@ -111,10 +111,8 @@ definition { $$ = $names_inclusive; } | START_EXC names_exclusive { $$ = $names_exclusive; } - | ACTION - { yy.actionInclude.push($ACTION); $$ = null; } - | include_macro_code - { yy.actionInclude.push($include_macro_code); $$ = null; } + | action + { yy.actionInclude.push($action); $$ = null; } | options { $$ = null; } | UNKNOWN_DECL @@ -150,12 +148,18 @@ rule action : '{' action_body '}' { $$ = $action_body; } - | ACTION - { $$ = $ACTION; } + | unbracketed_action_body + { $$ = $unbracketed_action_body; } | include_macro_code { $$ = $include_macro_code; } ; +unbracketed_action_body + : ACTION + | unbracketed_action_body ACTION + { $$ = $unbracketed_action_body + '\n' + $ACTION; } + ; + action_body : action_comments_body { $$ = $action_comments_body; } @@ -186,7 +190,7 @@ name_list ; regex - : regex_list + : nonempty_regex_list[re] { // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' @@ -208,9 +212,9 @@ regex // // Note the dash in that last example: there the code will consider // `bar` to be the keyword, which is fine with us as we're only - // interested in the taiol boundary and patching that one for + // interested in the trailing boundary and patching that one for // the `easy_keyword_rules` option. - $$ = $regex_list; + $$ = $re; if (yy.options.easy_keyword_rules) { try { // We need to 'protect' JSON.parse here as keywords are allowed @@ -232,23 +236,27 @@ regex // a 'keyword' starts with an alphanumeric character, // followed by zero or more alphanumerics or digits: if ($$.match(/\w[\w\d]*$/u)) { - $$ = $regex_list + "\\b"; + $$ = $re + "\\b"; } else { - $$ = $regex_list; + $$ = $re; } } catch (ex) { - $$ = $regex_list; + $$ = $re; } } } ; -regex_list +nonempty_regex_list : regex_list '|' regex_concat { $$ = $1 + '|' + $3; } | regex_list '|' { $$ = $1 + '|'; } | regex_concat + ; + +regex_list + : nonempty_regex_list | ε { $$ = ''; } ; diff --git a/tests/all-tests.js b/tests/all-tests.js index ec42f6c..c069e5a 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -171,6 +171,18 @@ exports["test multiline action with braces in regexp"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test multiline (indented) action without braces"] = function () { + var lexgrammar = '%%\n"["[^\\]]"]"\n var b=/{/;\n // { \n return 2 / 3;\n'; + var expected = { + rules: [ + ["\\[[^\\]]\\]", "var b=/{/;\n// { \nreturn 2 / 3;"] + ] + }; + + lexer_reset(); + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + exports["test include"] = function () { var lexgrammar = '\nRULE [0-9]\n\n%{\n hi \n%}\n%%\n"["[^\\]]"]" %{\nreturn true;\n%}\n'; var expected = { From cecdd0462d5e3b4c92d2ca764e79f57d1a78df5e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 22:36:43 +0200 Subject: [PATCH 161/417] regenerated parser --- lex-parser.js | 1558 +++++++++++++++++++++++++------------------------ 1 file changed, 793 insertions(+), 765 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 57f199c..8fb7214 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -401,68 +401,70 @@ symbols_: { ",": 44, ".": 46, "/": 47, - "/!": 157, + "/!": 159, "<": 60, "=": 61, ">": 62, "?": 63, - "ACTION": 141, - "ACTION_BODY": 151, - "CHARACTER_LIT": 172, - "CODE": 182, + "ACTION": 150, + "ACTION_BODY": 152, + "CHARACTER_LIT": 174, + "CODE": 184, "EOF": 1, - "ESCAPE_CHAR": 169, - "INCLUDE": 179, + "ESCAPE_CHAR": 171, + "INCLUDE": 181, "NAME": 135, - "NAME_BRACE": 163, - "OPTIONS": 173, - "OPTIONS_END": 175, - "OPTION_VALUE": 177, - "PATH": 180, - "RANGE_REGEX": 170, - "REGEX_SET": 168, - "REGEX_SET_END": 166, - "REGEX_SET_START": 164, - "SPECIAL_GROUP": 156, - "START_COND": 145, + "NAME_BRACE": 165, + "OPTIONS": 175, + "OPTIONS_END": 177, + "OPTION_VALUE": 179, + "PATH": 182, + "RANGE_REGEX": 172, + "REGEX_SET": 170, + "REGEX_SET_END": 168, + "REGEX_SET_START": 166, + "SPECIAL_GROUP": 158, + "START_COND": 144, "START_EXC": 139, "START_INC": 137, - "STRING_LIT": 171, - "UNKNOWN_DECL": 144, + "STRING_LIT": 173, + "UNKNOWN_DECL": 143, "^": 94, - "action": 148, - "action_body": 149, - "action_comments_body": 150, - "any_group_regex": 160, + "action": 141, + "action_body": 147, + "action_comments_body": 151, + "any_group_regex": 162, "definition": 134, "definitions": 129, "error": 2, - "escape_char": 162, + "escape_char": 164, "extra_lexer_module_code": 132, - "include_macro_code": 142, + "include_macro_code": 149, "init": 128, "lex": 127, - "module_code_chunk": 181, - "name_expansion": 158, - "name_list": 152, + "module_code_chunk": 183, + "name_expansion": 160, + "name_list": 153, "names_exclusive": 140, "names_inclusive": 138, - "option": 176, - "option_list": 174, - "optional_module_code_chunk": 178, - "options": 143, - "range_regex": 159, + "nonempty_regex_list": 154, + "option": 178, + "option_list": 176, + "optional_module_code_chunk": 180, + "options": 142, + "range_regex": 161, "regex": 136, - "regex_base": 155, - "regex_concat": 154, - "regex_list": 153, - "regex_set": 165, - "regex_set_atom": 167, - "rule": 146, + "regex_base": 157, + "regex_concat": 156, + "regex_list": 155, + "regex_set": 167, + "regex_set_atom": 169, + "rule": 145, "rules": 133, "rules_and_epilogue": 131, - "start_conditions": 147, - "string": 161, + "start_conditions": 146, + "string": 163, + "unbracketed_action_body": 148, "{": 123, "|": 124, "}": 125 @@ -490,26 +492,26 @@ terminals_: { 135: "NAME", 137: "START_INC", 139: "START_EXC", - 141: "ACTION", - 144: "UNKNOWN_DECL", - 145: "START_COND", - 151: "ACTION_BODY", - 156: "SPECIAL_GROUP", - 157: "/!", - 163: "NAME_BRACE", - 164: "REGEX_SET_START", - 166: "REGEX_SET_END", - 168: "REGEX_SET", - 169: "ESCAPE_CHAR", - 170: "RANGE_REGEX", - 171: "STRING_LIT", - 172: "CHARACTER_LIT", - 173: "OPTIONS", - 175: "OPTIONS_END", - 177: "OPTION_VALUE", - 179: "INCLUDE", - 180: "PATH", - 182: "CODE" + 143: "UNKNOWN_DECL", + 144: "START_COND", + 150: "ACTION", + 152: "ACTION_BODY", + 158: "SPECIAL_GROUP", + 159: "/!", + 165: "NAME_BRACE", + 166: "REGEX_SET_START", + 168: "REGEX_SET_END", + 170: "REGEX_SET", + 171: "ESCAPE_CHAR", + 172: "RANGE_REGEX", + 173: "STRING_LIT", + 174: "CHARACTER_LIT", + 175: "OPTIONS", + 177: "OPTIONS_END", + 179: "OPTION_VALUE", + 181: "INCLUDE", + 182: "PATH", + 184: "CODE" }, productions_: bp({ pop: u([ @@ -520,54 +522,58 @@ productions_: bp({ 129, 129, s, - [134, 7], + [134, 6], 138, 138, 140, 140, 133, 133, - 146, + 145, s, - [148, 3], - 149, - 149, - 150, - 150, + [141, 3], + 148, + 148, + 147, + 147, + 151, + 151, s, - [147, 3], - 152, - 152, + [146, 3], + 153, + 153, 136, s, - [153, 4], - 154, - 154, + [154, 3], + 155, + 155, + 156, + 156, s, - [155, 15], - 158, + [157, 15], 160, - 165, - 165, + 162, 167, 167, - 162, - 159, - 161, + 169, + 169, + 164, 161, - 143, - 174, - 174, + 163, + 163, + 142, + 176, + 176, s, - [176, 3], + [178, 3], 132, 132, - 142, - 142, - 181, - 181, - 178, - 178 + 149, + 149, + 183, + 183, + 180, + 180 ]), rule: u([ 4, @@ -581,15 +587,15 @@ productions_: bp({ s, [2, 3], s, - [1, 5], + [1, 4], 2, 1, c, - [9, 3], + [8, 3], 3, 3, - s, - [1, 3], + c, + [10, 5], 5, 0, 2, @@ -599,22 +605,24 @@ productions_: bp({ 1, 3, 1, - s, - [3, 4, -1], + 3, + c, + [27, 3], + 0, c, - [20, 4], + [23, 4], s, [2, 5], c, - [33, 3], + [26, 3], s, [1, 6], c, - [22, 3], + [23, 4], c, - [9, 10], + [9, 9], c, - [49, 3], + [52, 3], c, [31, 3], c, @@ -718,125 +726,128 @@ case 10: /*! Production:: definition : START_INC names_inclusive */ case 11: /*! Production:: definition : START_EXC names_exclusive */ +case 23: + /*! Production:: action : unbracketed_action_body */ case 24: - /*! Production:: action : ACTION */ -case 25: /*! Production:: action : include_macro_code */ -case 26: +case 27: /*! Production:: action_body : action_comments_body */ -case 63: +case 65: /*! Production:: escape_char : ESCAPE_CHAR */ -case 64: +case 66: /*! Production:: range_regex : RANGE_REGEX */ -case 73: +case 75: /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 77: - /*! Production:: module_code_chunk : CODE */ case 79: + /*! Production:: module_code_chunk : CODE */ +case 81: /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = $$[$0]; break; case 12: - /*! Production:: definition : ACTION */ -case 13: - /*! Production:: definition : include_macro_code */ + /*! Production:: definition : action */ yy.actionInclude.push($$[$0]); this.$ = null; break; -case 14: +case 13: /*! Production:: definition : options */ this.$ = null; break; -case 15: +case 14: /*! Production:: definition : UNKNOWN_DECL */ this.$ = {type: 'unknown', body: $$[$0]}; break; -case 16: +case 15: /*! Production:: names_inclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; break; -case 17: +case 16: /*! Production:: names_inclusive : names_inclusive START_COND */ this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; break; -case 18: +case 17: /*! Production:: names_exclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; break; -case 19: +case 18: /*! Production:: names_exclusive : names_exclusive START_COND */ this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; break; -case 20: +case 19: /*! Production:: rules : rules rule */ this.$ = $$[$0 - 1]; this.$.push($$[$0]); break; -case 21: +case 20: /*! Production:: rules : rule */ -case 33: +case 34: /*! Production:: name_list : NAME */ this.$ = [$$[$0]]; break; -case 22: +case 21: /*! Production:: rule : start_conditions regex action */ this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; break; -case 23: +case 22: /*! Production:: action : '{' action_body '}' */ -case 30: +case 31: /*! Production:: start_conditions : '<' name_list '>' */ this.$ = $$[$0 - 1]; break; -case 27: +case 26: + /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ + this.$ = $$[$0 - 1] + '\n' + $$[$0]; + break; + +case 28: /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; -case 28: +case 29: /*! Production:: action_comments_body : ε */ -case 39: +case 41: /*! Production:: regex_list : ε */ -case 80: +case 82: /*! Production:: optional_module_code_chunk : ε */ this.$ = ''; break; -case 29: +case 30: /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ -case 40: +case 42: /*! Production:: regex_concat : regex_concat regex_base */ -case 50: +case 52: /*! Production:: regex_base : regex_base range_regex */ -case 59: +case 61: /*! Production:: regex_set : regex_set_atom regex_set */ -case 78: +case 80: /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = $$[$0 - 1] + $$[$0]; break; -case 31: +case 32: /*! Production:: start_conditions : '<' '*' '>' */ this.$ = ['*']; break; -case 34: +case 35: /*! Production:: name_list : name_list ',' NAME */ this.$ = $$[$0 - 2]; this.$.push($$[$0]); break; -case 35: - /*! Production:: regex : regex_list */ +case 36: + /*! Production:: regex : nonempty_regex_list[re] */ // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' // to be equivalent to their non-escaped version, hence these are @@ -857,7 +868,7 @@ case 35: // // Note the dash in that last example: there the code will consider // `bar` to be the keyword, which is fine with us as we're only - // interested in the taiol boundary and patching that one for + // interested in the trailing boundary and patching that one for // the `easy_keyword_rules` option. this.$ = $$[$0]; if (yy.options.easy_keyword_rules) { @@ -891,74 +902,74 @@ case 35: } break; -case 36: - /*! Production:: regex_list : regex_list '|' regex_concat */ +case 37: + /*! Production:: nonempty_regex_list : regex_list '|' regex_concat */ this.$ = $$[$0 - 2] + '|' + $$[$0]; break; -case 37: - /*! Production:: regex_list : regex_list '|' */ +case 38: + /*! Production:: nonempty_regex_list : regex_list '|' */ this.$ = $$[$0 - 1] + '|'; break; -case 42: +case 44: /*! Production:: regex_base : '(' regex_list ')' */ this.$ = '(' + $$[$0 - 1] + ')'; break; -case 43: +case 45: /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; break; -case 44: +case 46: /*! Production:: regex_base : regex_base '+' */ this.$ = $$[$0 - 1] + '+'; break; -case 45: +case 47: /*! Production:: regex_base : regex_base '*' */ this.$ = $$[$0 - 1] + '*'; break; -case 46: +case 48: /*! Production:: regex_base : regex_base '?' */ this.$ = $$[$0 - 1] + '?'; break; -case 47: +case 49: /*! Production:: regex_base : '/' regex_base */ this.$ = '(?=' + $$[$0] + ')'; break; -case 48: +case 50: /*! Production:: regex_base : '/!' regex_base */ this.$ = '(?!' + $$[$0] + ')'; break; -case 52: +case 54: /*! Production:: regex_base : '.' */ this.$ = '.'; break; -case 53: +case 55: /*! Production:: regex_base : '^' */ this.$ = '^'; break; -case 54: +case 56: /*! Production:: regex_base : '$' */ this.$ = '$'; break; -case 58: +case 60: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 74: +case 76: /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; -case 62: +case 64: /*! Production:: regex_set_atom : name_expansion */ if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0] @@ -971,24 +982,24 @@ case 62: //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 65: +case 67: /*! Production:: string : STRING_LIT */ this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; -case 70: +case 72: /*! Production:: option : NAME[option] */ yy.options[$$[$0]] = true; break; -case 71: +case 73: /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ -case 72: +case 74: /*! Production:: option : NAME[option] '=' NAME[value] */ yy.options[$$[$0 - 2]] = $$[$0]; break; -case 75: +case 77: /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); @@ -996,7 +1007,7 @@ case 75: this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; break; -case 76: +case 78: /*! Production:: include_macro_code : INCLUDE error */ console.error("%include MUST be followed by a valid file path"); break; @@ -1005,26 +1016,31 @@ case 76: }, table: bt({ len: u([ - 10, + 11, 1, - 12, + 15, 1, - 12, - 29, + 15, + 22, 2, 2, s, - [8, 4], - 2, + [9, 3], + 5, + 24, + 24, 3, - 23, + 24, + 2, + 20, 1, - 8, + 9, 10, + 1, 28, 28, - 21, - 21, + 22, + 22, 17, 17, s, @@ -1034,34 +1050,40 @@ table: bt({ s, [27, 3], s, - [9, 4], - 25, - 25, + [10, 4], + 2, + 3, + 24, 1, 4, 3, + 25, + 25, 1, 1, 6, - 21, - 19, - 24, + 18, + 16, + 22, 3, 29, 28, s, [27, 5], - 2, - 2, + s, + [2, 3], 28, 28, 1, 6, 3, 3, + 10, + 10, + 24, + 5, + 3, 9, - 9, - 8, 1, 2, 1, @@ -1069,529 +1091,538 @@ table: bt({ [3, 3], 6, 1, - 19, - 5, + 16, + 6, 2, 1, 2, c, - [30, 4], + [34, 4], 1, - 2, - 2, - c, - [27, 3], + s, + [2, 3], c, - [16, 3], - 19, - 19, - 16, + [31, 3], 1, 16, + 13, + 1, + 13, + 4, 1, 1, 2, - 3, - 2, - 19, - 5, - 3, - 2, - 4, 3 ]), symbol: u([ + 123, 127, 128, 130, - s, - [135, 4, 2], - 144, - 173, - 179, + 135, + 137, + 139, + 143, + 150, + 175, + 181, 1, + 123, 129, 130, 134, - c, - [11, 4], + s, + [135, 4, 2], 142, 143, + 148, + 149, c, - [13, 3], + [16, 3], 130, c, - [13, 12], + [16, 15], 36, 40, 46, 47, 94, 124, - 130, - 135, 136, - c, - [41, 4], s, - [153, 6, 1], + [154, 7, 1], s, - [160, 5, 1], - 169, + [162, 5, 1], 171, - 172, 173, - 179, + 174, 138, - 145, + 144, 140, - 145, + 144, + 123, c, [67, 8], c, - [8, 24], - 2, - 180, - 135, - 174, - 176, + [9, 19], + 125, + 147, + 151, + 152, 1, c, - [71, 4], + [59, 4], 60, 94, 123, 124, - 130, - 131, - 133, - 141, - 146, - 147, - 156, - 157, - c, - [65, 5], - 179, - 130, c, - [37, 8], + [22, 6], + 158, + 159, c, - [25, 3], + [58, 5], c, - [10, 7], - 36, - 40, - 41, + [114, 3], c, - [113, 3], + [24, 23], + 135, + 176, + 178, + c, + [27, 24], + 2, + 182, + c, + [26, 7], + 124, + 130, + 131, + 133, + 145, + 146, c, - [16, 8], + [24, 7], + 130, c, - [111, 14], + [112, 10], c, - [28, 3], + [49, 7], + 175, + 181, + 124, + 36, + 40, + 41, + c, + [177, 3], + c, + [17, 8], + c, + [180, 12], + c, + [204, 4], + 41, 42, 43, 46, 47, 63, c, - [31, 9], - 156, - 157, - 159, + [97, 11], + 161, c, [27, 3], s, - [170, 4, 1], + [172, 4, 1], c, - [56, 7], - 124, + [28, 4], + c, + [233, 4], c, - [162, 14], + [232, 15], c, - [21, 23], + [22, 24], c, - [20, 3], + [21, 3], c, [17, 31], c, - [104, 17], + [106, 17], c, - [103, 11], + [105, 11], c, [27, 180], - 166, + 168, s, - [168, 6, 1], - 179, - 158, - 163, + [170, 6, 1], + 181, + 160, 165, 167, - 168, + 169, + 170, c, [115, 81], c, - [16, 6], - 145, - c, - [9, 29], - c, - [514, 10], + [458, 6], + 144, c, - [61, 10], + [580, 9], c, - [60, 4], - 182, + [10, 25], + 125, + 123, + 125, c, - [25, 25], - 175, + [601, 25], + 177, 135, - 174, - 175, 176, + 177, + 178, 61, 135, - 175, - s, - [1, 3], + 177, + c, + [32, 24], + 184, + c, + [25, 26], + 1, + 1, 132, - 178, - 179, + 180, 181, + 183, c, - [41, 11], + [33, 8], + 124, + 130, c, - [578, 11], + [612, 9], c, - [21, 11], + [18, 9], c, - [19, 8], + [16, 7], c, - [463, 5], - 123, - 124, - 136, - 141, - c, - [503, 14], - 179, + [783, 22], 42, 135, - 152, + 153, c, - [605, 14], + [632, 14], c, - [717, 15], + [30, 13], c, - [606, 31], + [633, 33], c, - [476, 132], + [501, 132], 41, 124, 41, 124, + 41, c, - [167, 47], + [830, 4], + c, + [169, 44], c, [28, 9], - 166, + 168, c, - [508, 3], - 166, - 167, + [535, 3], + 168, + 169, + 170, + 165, 168, - 163, - 166, c, [3, 4], c, - [425, 24], - 173, - 179, - 175, - 135, + [441, 20], + c, + [379, 24], + c, + [1066, 5], + c, + [468, 3], + c, + [971, 9], 177, + 135, + 179, 1, 1, - 142, - 179, + 149, + 181, 1, c, - [409, 3], + [405, 3], c, [3, 3], c, - [377, 6], + [406, 6], c, - [357, 19], + [389, 16], 123, 141, - 142, - 148, - 179, + c, + [1179, 3], + 181, 44, 62, 62, 44, 62, c, - [945, 47], + [1007, 47], c, - [257, 62], - 166, + [292, 62], + 168, + 123, + 125, 135, - 175, - c, - [529, 4], + 177, c, - [151, 6], + [608, 3], c, - [160, 3], + [151, 7], c, - [154, 20], - 125, - 149, - 150, - 151, + [568, 4], c, - [24, 19], + [543, 21], c, - [554, 26], - c, - [16, 9], + [13, 7], 135, c, - [17, 16], - 1, - 1, - 123, - 125, + [14, 13], 123, 125, - 151, + c, + [1299, 3], + 1, 44, 62, c, - [104, 24], - c, - [29, 3], - c, - [34, 4], - c, - [9, 5] + [237, 3] ]), type: u([ + 2, 0, 0, s, [2, 8], 1, + 2, 0, 2, c, - [12, 5], + [13, 4], c, - [18, 6], + [18, 3], c, - [13, 13], - s, - [2, 7], + [21, 7], c, - [18, 7], + [16, 16], c, - [7, 3], + [20, 5], s, [0, 4], c, - [21, 9], + [7, 6], c, - [35, 12], + [36, 11], s, - [2, 25], + [2, 27], c, - [73, 12], - c, - [12, 3], + [60, 11], + s, + [2, 41], c, - [88, 13], + [52, 37], c, - [58, 31], + [131, 9], c, - [111, 13], + [83, 38], c, - [33, 22], + [49, 32], c, - [107, 15], + [27, 16], c, - [51, 19], + [232, 15], c, - [21, 19], + [22, 27], c, [17, 34], s, [2, 213], c, - [381, 45], + [535, 13], c, - [174, 132], + [157, 147], c, - [565, 10], + [59, 57], c, - [593, 24], + [60, 13], c, - [235, 28], + [228, 31], c, - [469, 15], + [783, 16], c, - [54, 15], + [584, 17], c, - [555, 20], + [581, 20], c, - [606, 30], + [633, 30], c, - [296, 153], + [340, 155], c, [28, 36], c, - [324, 4], + [318, 4], c, - [209, 39], + [211, 54], c, - [306, 10], + [293, 20], c, - [51, 26], + [19, 9], c, - [312, 22], + [406, 14], c, - [839, 102], + [384, 12], c, - [151, 27], + [1007, 54], c, - [542, 39], + [276, 72], c, - [134, 71], + [237, 53], c, - [304, 12] + [51, 9] ]), state: u([ s, [1, 4, 1], + 8, 9, - 10, - 15, + 12, + 13, + 18, c, - [4, 3], + [6, 5], s, - [16, 4, 1], - 24, - 25, + [19, 5, 1], + 28, 29, - 30, - 36, - 38, + 33, + 34, + 40, 42, - 43, + 44, 45, + 47, 48, - 49, - 50, - 53, - c, - [13, 4], + 52, + 55, + 56, 57, - 59, - c, - [21, 6], 60, c, - [7, 6], - 61, + [15, 4], + 64, + 67, + 66, c, - [5, 4], - 62, + [24, 6], + 67, + 68, + c, + [8, 6], + 69, c, [5, 4], - 66, - 63, - 64, 70, - 43, - 72, - 73, - 74, - 78, - 50, - 79, c, - [56, 7], - 80, + [5, 4], + 74, + 71, + 72, + 81, + 48, 83, + 84, + 85, + 89, + 57, + 90, c, - [7, 5], - s, - [57, 3], - 66, - 87, - 64, + [61, 8], 91, - 93, - 73, - 74, - 97, 94, c, - [67, 5], - 101, - 73, + [7, 5], + s, + [64, 3], 74, + 98, + 72, + 99, + 45, 103, - 104, - 109, - 104, - 111 + 105, + 84, + 85, + 106, + 12, + 13, + c, + [73, 5], + 111, + 84, + 85, + 114 ]), mode: u([ s, [2, 9], + 1, + 2, s, - [1, 8], + [1, 9], c, - [9, 9], + [10, 10], c, - [13, 5], + [13, 13], + s, + [2, 44], c, - [28, 13], + [45, 34], c, - [9, 4], - s, - [2, 32], + [34, 25], c, - [54, 8], + [106, 7], c, - [5, 4], + [5, 3], c, - [45, 20], + [69, 28], c, - [20, 9], + [154, 7], c, - [106, 6], + [15, 11], c, - [126, 15], + [163, 9], c, - [26, 8], + [7, 4], c, - [59, 16], + [59, 15], c, - [83, 6], + [82, 6], c, [50, 6], c, - [157, 10], + [218, 13], c, - [174, 16], + [235, 13], s, [1, 19], s, @@ -1599,142 +1630,142 @@ table: bt({ c, [220, 89], c, - [88, 18], - c, - [106, 62], + [88, 20], c, - [421, 4], + [20, 14], c, - [179, 12], + [417, 19], c, - [538, 24], + [29, 13], c, - [650, 14], + [154, 57], c, - [532, 11], + [570, 33], c, - [492, 9], + [735, 17], c, - [556, 43], + [580, 48], c, - [421, 137], + [445, 139], c, - [202, 7], + [170, 5], c, - [166, 25], + [168, 27], c, - [749, 28], + [775, 28], c, - [95, 36], + [130, 68], c, - [38, 4], + [71, 5], c, - [267, 7], + [302, 7], c, - [332, 25], + [361, 22], c, - [953, 6], + [165, 6], c, - [322, 23], + [354, 23], c, - [581, 90], + [719, 88], c, - [96, 77], + [278, 5], c, - [77, 19], - c, - [315, 19], - c, - [802, 20], + [1146, 52], 1 ]), goto: u([ s, - [6, 8], - 8, - s, - [5, 4, 1], + [6, 9], 11, - 13, - 12, + 8, + 5, + 6, + 7, + 10, + 15, 14, + 16, + 17, c, - [9, 8], - 28, - 20, + [10, 9], + 32, + 24, + 30, 26, - 22, - 27, - s, - [39, 7], - 21, - 23, 31, - 32, + 41, + 25, + 27, 35, - 33, - 34, - 39, + 36, 39, 37, - 39, + 38, + 41, + 43, s, - [12, 8], + [12, 9], s, - [13, 8], + [13, 9], s, - [14, 8], + [14, 9], s, - [15, 8], - 41, - 40, - 44, + [29, 3], + s, + [23, 14], 46, s, - [32, 4], + [23, 9], + s, + [24, 24], + 49, + s, + [25, 24], 51, + 50, + 53, s, - [32, 3], - 47, + [33, 4], + 58, + 33, + 33, + 54, s, - [32, 9], + [33, 7], 7, s, - [9, 8], - 35, - 52, + [9, 9], s, - [35, 8], - 28, - 20, - 38, + [36, 10], + 59, + 32, + 24, + 39, c, - [97, 3], + [158, 3], s, - [38, 8], + [39, 8], c, - [98, 7], - 38, - 38, + [165, 7], + 39, + 39, s, - [41, 3], - 55, - 54, - 41, - 41, - 56, + [43, 3], + 62, + 61, + 43, + 43, + 63, s, - [41, 14], - 58, + [43, 14], + 65, s, - [41, 4], - 28, - 20, - 39, - c, - [147, 4], + [43, 4], + 32, + 24, + 41, c, - [43, 7], + [208, 11], c, [14, 16], c, @@ -1742,12 +1773,8 @@ table: bt({ c, [12, 19], s, - [49, 27], - s, [51, 27], s, - [52, 27], - s, [53, 27], s, [54, 27], @@ -1756,232 +1783,233 @@ table: bt({ s, [56, 27], s, - [57, 29], - 31, + [57, 27], + s, + [58, 27], s, - [65, 28], + [59, 29], + 35, + 73, s, - [66, 27], + [67, 27], s, - [63, 27], + [68, 27], + s, + [65, 27], s, [10, 6], - 67, - 10, - 10, + 75, + s, + [10, 3], s, - [16, 9], + [15, 10], s, [11, 6], - 68, - 11, - 11, + 76, s, - [18, 9], + [11, 3], s, - [75, 25], + [17, 10], + 78, + 77, + 27, + 27, + 79, s, - [76, 25], - 69, - 44, - 69, + [26, 24], + 80, + 49, 71, - 70, - 70, + 82, + 72, + 72, + s, + [77, 25], + s, + [78, 25], 1, 2, - 80, - 80, - 75, - 77, + 82, + 82, + 86, + 88, c, - [538, 8], - 76, + [570, 7], + 87, s, - [32, 9], + [33, 7], s, - [21, 19], + [20, 16], c, - [634, 8], - c, - [630, 8], - 81, - 82, - 28, - 20, - 37, + [722, 13], + 92, + 93, + 32, + 24, + 38, c, - [19, 3], + [16, 3], s, - [37, 8], + [38, 8], c, - [24, 7], - 37, - 37, - s, - [40, 3], - 55, - 54, - 40, - 40, - 56, - s, - [40, 14], - 58, + [23, 7], + 38, + 38, s, - [40, 4], + [42, 3], + 62, + 61, + 42, + 42, + 63, s, - [44, 27], + [42, 14], + 65, s, - [45, 27], + [42, 4], s, [46, 27], s, - [50, 27], + [47, 27], s, - [64, 27], - 84, - 52, - 85, - 52, + [48, 27], s, - [47, 3], - 55, - 54, - 47, - 47, - 56, + [52, 27], s, - [47, 14], - 58, + [66, 27], + 95, + 59, + 40, + 40, + 96, + 59, s, - [47, 4], + [49, 3], + 62, + 61, + 49, + 49, + 63, s, - [48, 3], - 55, - 54, - 48, - 48, - 56, + [49, 14], + 65, s, - [48, 14], - 58, + [49, 4], s, - [48, 4], - 86, - 31, - 60, + [50, 3], + 62, + 61, + 50, + 50, + 63, + s, + [50, 14], 65, s, - [61, 3], + [50, 4], + 97, + 35, + 62, + 73, s, - [62, 3], + [63, 3], s, - [17, 9], + [64, 3], s, - [19, 9], + [16, 10], s, - [67, 8], - 68, - 89, - 88, - 90, - 73, - 12, - 79, - 79, - 92, + [18, 10], s, - [77, 3], + [22, 24], + s, + [29, 3], + s, + [30, 3], + s, + [69, 9], + 70, + 101, + 100, + 102, + 75, + 16, + 81, + 81, + 104, + s, + [79, 3], c, - [350, 3], + [376, 3], 5, s, - [20, 19], - 95, - 96, - 12, - 99, - 98, - 100, - 33, - 33, - 28, - 20, - 36, + [19, 16], + 11, + 15, + 16, + 108, + 107, + 109, + 34, + 34, + 32, + 24, + 37, c, - [322, 3], + [354, 3], s, - [36, 8], + [37, 8], c, - [322, 7], - 36, - 36, + [354, 7], + 37, + 37, s, - [42, 27], + [44, 27], s, - [43, 27], + [45, 27], s, - [58, 27], - 59, - 71, - 71, - 72, - 72, + [60, 27], + 61, + 78, + 110, + 73, + 73, + 74, + 74, 3, c, - [141, 3], - s, - [78, 3], - 102, - s, - [22, 19], - s, - [28, 3], - s, - [24, 19], - s, - [25, 19], + [140, 3], s, - [30, 16], - 105, + [80, 3], + 112, s, - [31, 16], - 74, - 4, - 107, - 106, - 26, - 26, - 108, - 34, - 34, + [21, 16], s, - [23, 19], + [31, 13], + 113, s, - [28, 3], + [32, 13], s, [29, 3], - 107, - 110, - s, - [28, 3], - 27, - 27, - 108 + 76, + 4, + 35, + 35, + 28, + 28, + 79 ]) }), defaultActions: bda({ idx: u([ - 15, - 45, - 46, - 70, - 77, - 87, - 90, - 101, - 102 + 18, + 52, + 53, + 81, + 88, + 98, + 102, + 111, + 112 ]), pop: u([ s, @@ -1991,11 +2019,11 @@ defaultActions: bda({ 7, 1, 2, - 68, + 70, 5, - 59, + 61, 3, - 74, + 76, 4 ]) }), @@ -3047,7 +3075,7 @@ case 14 : break; case 15 : /*! Conditions:: rules */ -/*! Rule:: \s+ */ +/*! Rule:: {WS}+ */ this.begin('indented'); break; case 16 : @@ -3061,23 +3089,23 @@ case 17 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 172; + return 174; break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 177; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 179; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 177; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 179; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 175; + this.popState(); return 177; break; case 24 : /*! Conditions:: options */ @@ -3107,12 +3135,12 @@ break; case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 141; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 150; break; case 31 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 141; + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 150; break; case 32 : /*! Conditions:: indented */ @@ -3134,13 +3162,13 @@ case 32 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 179; + return 181; break; case 33 : /*! Conditions:: indented */ -/*! Rule:: .+ */ - this.begin('rules'); return 141; +/*! Rule:: .* */ + this.popState(); return 150; break; case 34 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3149,7 +3177,7 @@ case 34 : break; case 35 : /*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \/\/.* */ +/*! Rule:: \/\/[^\r\n]* */ /* ignore */ break; case 36 : @@ -3168,7 +3196,7 @@ case 38 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 172; + return 174; break; case 39 : @@ -3184,17 +3212,17 @@ break; case 41 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 171; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 173; break; case 42 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 171; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 173; break; case 43 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ - this.pushState('set'); return 164; + this.pushState('set'); return 166; break; case 56 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3204,7 +3232,7 @@ break; case 57 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ - return 157; // treated as `(?!atom)` + return 159; // treated as `(?!atom)` break; case 58 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3214,12 +3242,12 @@ break; case 60 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 169; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 171; break; case 63 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 173; + this.begin('options'); return 175; break; case 64 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3234,7 +3262,7 @@ break; case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 179; + this.pushState('path'); return 181; break; case 67 : /*! Conditions:: INITIAL rules trail code */ @@ -3242,7 +3270,7 @@ case 67 : /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - return 144; + return 143; break; case 68 : @@ -3258,12 +3286,12 @@ break; case 78 : /*! Conditions:: set */ /*! Rule:: \] */ - this.popState('set'); return 166; + this.popState('set'); return 168; break; case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 182; // the bit of CODE just before EOF... + return 184; // the bit of CODE just before EOF... break; case 81 : /*! Conditions:: path */ @@ -3273,12 +3301,12 @@ break; case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 180; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 182; break; case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 180; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 182; break; case 84 : /*! Conditions:: path */ @@ -3288,7 +3316,7 @@ break; case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 180; + this.popState(); return 182; break; case 86 : /*! Conditions:: * */ @@ -3306,25 +3334,25 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 151, + 0 : 152, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 151, + 1 : 152, /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - 2 : 151, + 2 : 152, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 151, + 3 : 152, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 151, + 4 : 152, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 151, + 5 : 152, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 151, + 6 : 152, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ 9 : 135, @@ -3342,22 +3370,22 @@ simpleCaseActionClusters: { 19 : 61, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 177, + 22 : 179, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 25 : 145, + 25 : 144, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \| */ 44 : 124, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ - 45 : 156, + 45 : 158, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ - 46 : 156, + 46 : 158, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ - 47 : 156, + 47 : 158, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ 48 : 40, @@ -3384,7 +3412,7 @@ simpleCaseActionClusters: { 55 : 36, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 169, + 59 : 171, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ 61 : 36, @@ -3393,13 +3421,13 @@ simpleCaseActionClusters: { 62 : 46, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 170, + 69 : 172, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 163, + 70 : 165, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 163, + 71 : 165, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ 72 : 123, @@ -3411,13 +3439,13 @@ simpleCaseActionClusters: { 75 : 1, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 76 : 168, + 76 : 170, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 168, + 77 : 170, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 182 + 79 : 184 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, @@ -3435,7 +3463,7 @@ rules: [ /^(?:\*)/, /^(?:(\r\n|\n|\r)+)/, /^(?:([^\S\r\n])+(\r\n|\n|\r)+)/, -/^(?:\s+)/, +/^(?:([^\S\r\n])+)/, /^(?:%%)/, /^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+)/, /^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff](?:[^\u0000-,.\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*[^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff])?))/, @@ -3453,9 +3481,9 @@ rules: [ /^(?:%\{(.|(\r\n|\n|\r))*?%\})/, /^(?:%\{(.|(\r\n|\n|\r))*?%\})/, /^(?:%include\b)/, -/^(?:.+)/, +/^(?:.*)/, /^(?:\/\*(.|\n|\r)*?\*\/)/, -/^(?:\/\/.*)/, +/^(?:\/\/[^\r\n]*)/, /^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff][^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*))/, /^(?:(\r\n|\n|\r)+)/, /^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+)/, From b946affa9b7d3a3f16f7946867d9df120616adff Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 22:57:15 +0200 Subject: [PATCH 162/417] investigating why grammar fails to parse regexes all of a sudden; cannot see the error in my grammar :-( --- lex-parser.js | 525 ++++++++++++++++++++++++++------------------------ lex.y | 14 +- 2 files changed, 279 insertions(+), 260 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8fb7214..9e9d17a 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -447,7 +447,7 @@ symbols_: { "name_list": 153, "names_exclusive": 140, "names_inclusive": 138, - "nonempty_regex_list": 154, + "nonempty_regex_list": 155, "option": 178, "option_list": 176, "optional_module_code_chunk": 180, @@ -456,7 +456,7 @@ symbols_: { "regex": 136, "regex_base": 157, "regex_concat": 156, - "regex_list": 155, + "regex_list": 154, "regex_set": 167, "regex_set_atom": 169, "rule": 145, @@ -543,10 +543,10 @@ productions_: bp({ 153, 153, 136, + 154, + 154, s, - [154, 3], - 155, - 155, + [155, 3], 156, 156, s, @@ -603,24 +603,24 @@ productions_: bp({ 3, 0, 1, - 3, - 1, - 3, c, - [27, 3], + [13, 3], 0, + 3, + c, + [24, 3], c, - [23, 4], + [23, 3], s, [2, 5], c, - [26, 3], + [10, 3], s, [1, 6], c, - [23, 4], + [21, 3], c, - [9, 9], + [9, 10], c, [52, 3], c, @@ -816,7 +816,7 @@ case 28: case 29: /*! Production:: action_comments_body : ε */ -case 41: +case 38: /*! Production:: regex_list : ε */ case 82: /*! Production:: optional_module_code_chunk : ε */ @@ -847,7 +847,7 @@ case 35: break; case 36: - /*! Production:: regex : nonempty_regex_list[re] */ + /*! Production:: regex : regex_list[re] */ // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' // to be equivalent to their non-escaped version, hence these are @@ -902,12 +902,12 @@ case 36: } break; -case 37: +case 39: /*! Production:: nonempty_regex_list : regex_list '|' regex_concat */ this.$ = $$[$0 - 2] + '|' + $$[$0]; break; -case 38: +case 40: /*! Production:: nonempty_regex_list : regex_list '|' */ this.$ = $$[$0 - 1] + '|'; break; @@ -1021,7 +1021,7 @@ table: bt({ 15, 1, 15, - 22, + 31, 2, 2, s, @@ -1032,11 +1032,11 @@ table: bt({ 3, 24, 2, - 20, + 23, 1, 9, 10, - 1, + 11, 28, 28, 22, @@ -1062,16 +1062,16 @@ table: bt({ 1, 1, 6, - 18, - 16, - 22, + 21, + 19, + 25, 3, 29, 28, s, [27, 5], - s, - [2, 3], + 2, + 2, 28, 28, 1, @@ -1091,23 +1091,23 @@ table: bt({ [3, 3], 6, 1, - 16, + 19, 6, 2, 1, 2, c, - [34, 4], + [33, 4], 1, s, [2, 3], c, [31, 3], 1, + 19, 16, - 13, 1, - 13, + 16, 4, 1, 1, @@ -1147,8 +1147,13 @@ table: bt({ 46, 47, 94, + 123, 124, + 130, + 135, 136, + c, + [48, 4], s, [154, 7, 1], s, @@ -1156,13 +1161,15 @@ table: bt({ 171, 173, 174, + 175, + 181, 138, 144, 140, 144, 123, c, - [67, 8], + [76, 8], c, [9, 19], 125, @@ -1171,21 +1178,18 @@ table: bt({ 152, 1, c, - [59, 4], + [68, 4], 60, - 94, - 123, - 124, c, - [22, 6], + [69, 5], + c, + [22, 4], 158, 159, c, - [58, 5], - c, - [114, 3], + [60, 7], c, - [24, 23], + [24, 24], 135, 176, 178, @@ -1194,53 +1198,52 @@ table: bt({ 2, 182, c, - [26, 7], - 124, - 130, + [26, 10], 131, 133, 145, 146, c, - [24, 7], - 130, + [26, 8], + c, + [183, 3], c, - [112, 10], + [115, 9], c, - [49, 7], + [52, 7], 175, 181, - 124, + 41, + c, + [11, 10], 36, 40, 41, c, - [177, 3], + [199, 7], c, - [17, 8], + [16, 4], c, - [180, 12], + [195, 14], c, - [204, 4], - 41, + [28, 3], 42, 43, 46, 47, 63, c, - [97, 11], + [110, 11], 161, c, [27, 3], s, [172, 4, 1], c, - [28, 4], - c, - [233, 4], + [56, 7], + 124, c, - [232, 15], + [247, 15], c, [22, 24], c, @@ -1265,17 +1268,17 @@ table: bt({ c, [115, 81], c, - [458, 6], + [468, 6], 144, c, - [580, 9], + [593, 9], c, [10, 25], 125, 123, 125, c, - [601, 25], + [614, 25], 177, 135, 176, @@ -1296,42 +1299,41 @@ table: bt({ 181, 183, c, - [33, 8], - 124, - 130, + [33, 11], c, - [612, 9], + [625, 11], c, - [18, 9], + [21, 10], c, - [16, 7], + [19, 9], c, - [783, 22], + [811, 7], + 136, + c, + [806, 16], + 181, 42, 135, 153, c, - [632, 14], + [641, 14], c, - [30, 13], + [837, 15], c, - [633, 33], + [642, 31], c, - [501, 132], + [510, 132], 41, 124, 41, 124, - 41, c, - [830, 4], - c, - [169, 44], + [167, 47], c, [28, 9], 168, c, - [535, 3], + [542, 3], 168, 169, 170, @@ -1340,15 +1342,15 @@ table: bt({ c, [3, 4], c, - [441, 20], + [448, 20], c, - [379, 24], + [386, 24], c, - [1066, 5], + [1086, 5], c, - [468, 3], + [475, 3], c, - [971, 9], + [988, 9], 177, 135, 179, @@ -1358,17 +1360,17 @@ table: bt({ 181, 1, c, - [405, 3], + [412, 3], c, [3, 3], c, - [406, 6], + [413, 6], c, - [389, 16], + [393, 19], 123, 141, c, - [1179, 3], + [1211, 3], 181, 44, 62, @@ -1376,36 +1378,36 @@ table: bt({ 44, 62, c, - [1007, 47], + [1017, 47], c, - [292, 62], + [293, 62], 168, 123, 125, 135, 177, c, - [608, 3], + [618, 3], c, - [151, 7], + [154, 7], c, - [568, 4], + [578, 4], c, - [543, 21], + [550, 25], c, - [13, 7], + [16, 9], 135, c, - [14, 13], + [17, 16], 123, 125, c, - [1299, 3], + [1331, 3], 1, 44, 62, c, - [237, 3] + [249, 3] ]), type: u([ 2, @@ -1425,80 +1427,82 @@ table: bt({ [21, 7], c, [16, 16], + s, + [2, 7], c, - [20, 5], + [13, 5], s, [0, 4], c, - [7, 6], + [6, 8], c, - [36, 11], + [45, 11], s, [2, 27], c, - [60, 11], + [69, 14], s, - [2, 41], + [2, 38], c, - [52, 37], + [52, 38], c, - [131, 9], + [134, 11], c, - [83, 38], + [96, 48], c, - [49, 32], + [61, 32], c, [27, 16], c, - [232, 15], + [247, 17], c, - [22, 27], + [22, 25], c, [17, 34], s, [2, 213], c, - [535, 13], + [557, 16], c, - [157, 147], + [157, 144], c, [59, 57], c, - [60, 13], + [60, 14], c, - [228, 31], + [229, 37], c, - [783, 16], + [268, 4], c, - [584, 17], + [537, 16], c, - [581, 20], + [56, 15], c, - [633, 30], + [590, 20], c, - [340, 155], + [642, 30], c, - [28, 36], + [347, 153], c, - [318, 4], + [28, 36], c, - [211, 54], + [325, 4], c, - [293, 20], + [209, 54], c, - [19, 9], + [291, 20], c, - [406, 14], + [341, 10], c, - [384, 12], + [86, 25], c, - [1007, 54], + [347, 24], c, - [276, 72], + [909, 104], c, - [237, 53], + [154, 26], c, - [51, 9] + [342, 46] ]), state: u([ s, @@ -1530,57 +1534,55 @@ table: bt({ c, [15, 4], 64, - 67, 66, c, - [24, 6], + [24, 7], 67, + c, + [8, 7], 68, c, - [8, 6], + [5, 4], 69, c, [5, 4], + 73, 70, - c, - [5, 4], - 74, 71, - 72, - 81, + 80, 48, + 82, 83, 84, - 85, - 89, + 88, 57, - 90, + 89, c, [61, 8], - 91, - 94, + 90, + 93, c, [7, 5], s, [64, 3], - 74, + 73, + 97, + 71, 98, - 72, - 99, 45, - 103, - 105, + 102, + 104, + 83, 84, - 85, - 106, + 105, 12, 13, c, [73, 5], - 111, + 110, + 83, 84, - 85, - 114 + 113 ]), mode: u([ s, @@ -1592,37 +1594,43 @@ table: bt({ c, [10, 10], c, - [13, 13], + [13, 4], + c, + [32, 8], + c, + [15, 8], + c, + [19, 10], s, - [2, 44], + [2, 36], c, [45, 34], c, [34, 25], c, - [106, 7], + [125, 7], c, - [5, 3], + [5, 4], c, - [69, 28], + [36, 21], c, - [154, 7], + [21, 20], c, - [15, 11], + [189, 6], c, - [163, 9], + [180, 17], c, - [7, 4], + [26, 6], c, - [59, 15], + [50, 16], c, - [82, 6], + [95, 6], c, [50, 6], c, - [218, 13], + [253, 13], c, - [235, 13], + [257, 13], s, [1, 19], s, @@ -1630,47 +1638,51 @@ table: bt({ c, [220, 89], c, - [88, 20], + [429, 21], + c, + [123, 17], + c, + [524, 27], c, - [20, 14], + [586, 35], c, - [417, 19], + [212, 29], c, - [29, 13], + [583, 25], c, - [154, 57], + [557, 13], c, - [570, 33], + [565, 11], c, - [735, 17], + [525, 9], c, - [580, 48], + [589, 43], c, - [445, 139], + [454, 137], c, - [170, 5], + [202, 7], c, - [168, 27], + [166, 25], c, - [775, 28], + [782, 28], c, - [130, 68], + [128, 69], c, - [71, 5], + [71, 4], c, - [302, 7], + [300, 7], c, - [361, 22], + [365, 25], c, - [165, 6], + [1101, 6], c, - [354, 23], + [355, 23], c, - [719, 88], + [729, 88], c, - [278, 5], + [520, 33], c, - [1146, 52], + [464, 33], 1 ]), goto: u([ @@ -1693,14 +1705,16 @@ table: bt({ 30, 26, 31, - 41, + s, + [38, 8], 25, 27, 35, 36, 39, 37, - 38, + s, + [38, 3], 41, 43, s, @@ -1727,28 +1741,31 @@ table: bt({ s, [33, 4], 58, - 33, - 33, + s, + [33, 3], 54, s, - [33, 7], + [33, 9], 7, s, [9, 9], - s, - [36, 10], + 36, 59, + s, + [36, 8], + s, + [37, 11], 32, 24, - 39, + 41, c, - [158, 3], + [180, 3], s, - [39, 8], + [41, 8], c, - [165, 7], - 39, - 39, + [180, 7], + 41, + 41, s, [43, 3], 62, @@ -1763,9 +1780,11 @@ table: bt({ [43, 4], 32, 24, - 41, + 38, + c, + [230, 4], c, - [208, 11], + [43, 7], c, [14, 16], c, @@ -1789,7 +1808,7 @@ table: bt({ s, [59, 29], 35, - 73, + 72, s, [67, 27], s, @@ -1798,29 +1817,29 @@ table: bt({ [65, 27], s, [10, 6], - 75, + 74, s, [10, 3], s, [15, 10], s, [11, 6], - 76, + 75, s, [11, 3], s, [17, 10], - 78, 77, + 76, 27, 27, - 79, + 78, s, [26, 24], - 80, + 79, 49, 71, - 82, + 81, 72, 72, s, @@ -1831,30 +1850,32 @@ table: bt({ 2, 82, 82, - 86, - 88, - c, - [570, 7], + 85, 87, + c, + [583, 8], + 86, s, - [33, 7], + [33, 9], s, - [20, 16], + [20, 19], + c, + [750, 8], c, - [722, 13], + [745, 8], + 91, 92, - 93, 32, 24, - 38, + 40, c, - [16, 3], + [19, 3], s, - [38, 8], + [40, 8], c, - [23, 7], - 38, - 38, + [24, 7], + 40, + 40, s, [42, 3], 62, @@ -1877,11 +1898,9 @@ table: bt({ [52, 27], s, [66, 27], - 95, + 94, 59, - 40, - 40, - 96, + 95, 59, s, [49, 3], @@ -1907,10 +1926,10 @@ table: bt({ 65, s, [50, 4], - 97, + 96, 35, 62, - 73, + 72, s, [63, 3], s, @@ -1928,40 +1947,40 @@ table: bt({ s, [69, 9], 70, - 101, 100, - 102, + 99, + 101, 75, 16, 81, 81, - 104, + 103, s, [79, 3], c, - [376, 3], + [383, 3], 5, s, - [19, 16], + [19, 19], 11, 15, 16, - 108, 107, - 109, + 106, + 108, 34, 34, 32, 24, - 37, + 39, c, - [354, 3], + [355, 3], s, - [37, 8], + [39, 8], c, - [354, 7], - 37, - 37, + [355, 7], + 39, + 39, s, [44, 27], s, @@ -1969,25 +1988,25 @@ table: bt({ s, [60, 27], 61, - 78, - 110, + 77, + 109, 73, 73, 74, 74, 3, c, - [140, 3], + [143, 3], s, [80, 3], - 112, + 111, s, - [21, 16], + [21, 19], s, - [31, 13], - 113, + [31, 16], + 112, s, - [32, 13], + [32, 16], s, [29, 3], 76, @@ -1996,7 +2015,7 @@ table: bt({ 35, 28, 28, - 79 + 78 ]) }), defaultActions: bda({ @@ -2004,12 +2023,12 @@ defaultActions: bda({ 18, 52, 53, - 81, - 88, - 98, - 102, - 111, - 112 + 80, + 87, + 97, + 101, + 110, + 111 ]), pop: u([ s, diff --git a/lex.y b/lex.y index 96ccdc3..53f0267 100644 --- a/lex.y +++ b/lex.y @@ -190,7 +190,7 @@ name_list ; regex - : nonempty_regex_list[re] + : regex_list[re] { // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' @@ -247,6 +247,12 @@ regex } ; +regex_list + : nonempty_regex_list + | ε + { $$ = ''; } + ; + nonempty_regex_list : regex_list '|' regex_concat { $$ = $1 + '|' + $3; } @@ -255,12 +261,6 @@ nonempty_regex_list | regex_concat ; -regex_list - : nonempty_regex_list - | ε - { $$ = ''; } - ; - regex_concat : regex_concat regex_base { $$ = $1 + $2; } From 28a0e3498258cc0c13709c8ef7736b59fe3ce8c4 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 23:04:10 +0200 Subject: [PATCH 163/417] hmmmm.... looks like jison has a problem with indirect left recursion... this grammar works and AFAICT its synonymous to the one in SHA cecdd0462d5e3b4c92d2ca764e79f57d1a78df5e --- lex-parser.js | 779 ++++++++++++++++++++++++++------------------------ lex.y | 10 +- 2 files changed, 409 insertions(+), 380 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 9e9d17a..f22fb7c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -447,7 +447,7 @@ symbols_: { "name_list": 153, "names_exclusive": 140, "names_inclusive": 138, - "nonempty_regex_list": 155, + "nonempty_regex_list": 154, "option": 178, "option_list": 176, "optional_module_code_chunk": 180, @@ -456,7 +456,7 @@ symbols_: { "regex": 136, "regex_base": 157, "regex_concat": 156, - "regex_list": 154, + "regex_list": 155, "regex_set": 167, "regex_set_atom": 169, "rule": 145, @@ -543,10 +543,10 @@ productions_: bp({ 153, 153, 136, - 154, - 154, + 155, + 155, s, - [155, 3], + [154, 5], 156, 156, s, @@ -608,25 +608,24 @@ productions_: bp({ 0, 3, c, - [24, 3], + [30, 4], c, - [23, 3], + [25, 4], s, [2, 5], c, [10, 3], s, [1, 6], + 3, c, - [21, 3], - c, - [9, 10], - c, - [52, 3], + [9, 12], c, - [31, 3], + [54, 3], c, - [28, 3], + [39, 4], + 2, + 1, 0 ]) }), @@ -732,15 +731,15 @@ case 24: /*! Production:: action : include_macro_code */ case 27: /*! Production:: action_body : action_comments_body */ -case 65: +case 67: /*! Production:: escape_char : ESCAPE_CHAR */ -case 66: +case 68: /*! Production:: range_regex : RANGE_REGEX */ -case 75: +case 77: /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 79: - /*! Production:: module_code_chunk : CODE */ case 81: + /*! Production:: module_code_chunk : CODE */ +case 83: /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = $$[$0]; break; @@ -818,20 +817,20 @@ case 29: /*! Production:: action_comments_body : ε */ case 38: /*! Production:: regex_list : ε */ -case 82: +case 84: /*! Production:: optional_module_code_chunk : ε */ this.$ = ''; break; case 30: /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ -case 42: +case 44: /*! Production:: regex_concat : regex_concat regex_base */ -case 52: +case 54: /*! Production:: regex_base : regex_base range_regex */ -case 61: +case 63: /*! Production:: regex_set : regex_set_atom regex_set */ -case 80: +case 82: /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = $$[$0 - 1] + $$[$0]; break; @@ -847,7 +846,7 @@ case 35: break; case 36: - /*! Production:: regex : regex_list[re] */ + /*! Production:: regex : nonempty_regex_list[re] */ // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' // to be equivalent to their non-escaped version, hence these are @@ -903,73 +902,83 @@ case 36: break; case 39: - /*! Production:: nonempty_regex_list : regex_list '|' regex_concat */ + /*! Production:: nonempty_regex_list : nonempty_regex_list '|' regex_concat */ this.$ = $$[$0 - 2] + '|' + $$[$0]; break; case 40: - /*! Production:: nonempty_regex_list : regex_list '|' */ + /*! Production:: nonempty_regex_list : nonempty_regex_list '|' */ this.$ = $$[$0 - 1] + '|'; break; -case 44: +case 41: + /*! Production:: nonempty_regex_list : '|' nonempty_regex_list */ + this.$ = '|' + $$[$0]; + break; + +case 42: + /*! Production:: nonempty_regex_list : '|' */ + this.$ = '|'; + break; + +case 46: /*! Production:: regex_base : '(' regex_list ')' */ this.$ = '(' + $$[$0 - 1] + ')'; break; -case 45: +case 47: /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; break; -case 46: +case 48: /*! Production:: regex_base : regex_base '+' */ this.$ = $$[$0 - 1] + '+'; break; -case 47: +case 49: /*! Production:: regex_base : regex_base '*' */ this.$ = $$[$0 - 1] + '*'; break; -case 48: +case 50: /*! Production:: regex_base : regex_base '?' */ this.$ = $$[$0 - 1] + '?'; break; -case 49: +case 51: /*! Production:: regex_base : '/' regex_base */ this.$ = '(?=' + $$[$0] + ')'; break; -case 50: +case 52: /*! Production:: regex_base : '/!' regex_base */ this.$ = '(?!' + $$[$0] + ')'; break; -case 54: +case 56: /*! Production:: regex_base : '.' */ this.$ = '.'; break; -case 55: +case 57: /*! Production:: regex_base : '^' */ this.$ = '^'; break; -case 56: +case 58: /*! Production:: regex_base : '$' */ this.$ = '$'; break; -case 60: +case 62: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 76: +case 78: /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; -case 64: +case 66: /*! Production:: regex_set_atom : name_expansion */ if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0] @@ -982,24 +991,24 @@ case 64: //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 67: +case 69: /*! Production:: string : STRING_LIT */ this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); break; -case 72: +case 74: /*! Production:: option : NAME[option] */ yy.options[$$[$0]] = true; break; -case 73: +case 75: /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ -case 74: +case 76: /*! Production:: option : NAME[option] '=' NAME[value] */ yy.options[$$[$0 - 2]] = $$[$0]; break; -case 77: +case 79: /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); @@ -1007,7 +1016,7 @@ case 77: this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; break; -case 78: +case 80: /*! Production:: include_macro_code : INCLUDE error */ console.error("%include MUST be followed by a valid file path"); break; @@ -1021,7 +1030,7 @@ table: bt({ 15, 1, 15, - 31, + 21, 2, 2, s, @@ -1032,11 +1041,11 @@ table: bt({ 3, 24, 2, - 23, + 20, 1, 9, 10, - 11, + 30, 28, 28, 22, @@ -1062,16 +1071,18 @@ table: bt({ 1, 1, 6, + 18, + 16, 21, - 19, - 25, 3, 29, + 11, 28, s, [27, 5], + 1, 2, - 2, + 1, 28, 28, 1, @@ -1084,30 +1095,29 @@ table: bt({ 5, 3, 9, - 1, - 2, - 1, + c, + [15, 3], s, [3, 3], 6, 1, - 19, + 16, 6, 2, 1, 2, c, - [33, 4], + [34, 4], 1, s, [2, 3], c, [31, 3], 1, - 19, 16, + 13, 1, - 16, + 13, 4, 1, 1, @@ -1147,29 +1157,23 @@ table: bt({ 46, 47, 94, - 123, 124, - 130, - 135, 136, - c, - [48, 4], + 154, s, - [154, 7, 1], + [156, 5, 1], s, [162, 5, 1], 171, 173, 174, - 175, - 181, 138, 144, 140, 144, 123, c, - [76, 8], + [66, 8], c, [9, 19], 125, @@ -1178,18 +1182,21 @@ table: bt({ 152, 1, c, - [68, 4], + [58, 4], 60, + 94, + 123, + 124, c, - [69, 5], - c, - [22, 4], + [22, 6], 158, 159, c, - [60, 7], + [58, 5], c, - [24, 24], + [113, 3], + c, + [24, 23], 135, 176, 178, @@ -1198,42 +1205,40 @@ table: bt({ 2, 182, c, - [26, 10], + [26, 7], + 124, + 130, 131, 133, 145, 146, c, - [26, 8], + [24, 7], + 130, c, - [183, 3], + [112, 10], c, - [115, 9], + [49, 7], c, - [52, 7], - 175, - 181, + [174, 4], 41, c, - [11, 10], - 36, - 40, - 41, + [175, 3], c, - [199, 7], + [16, 8], c, - [16, 4], + [181, 14], c, - [195, 14], + [30, 16], c, - [28, 3], + [28, 17], 42, 43, 46, 47, 63, c, - [110, 11], + [126, 11], 161, c, [27, 3], @@ -1242,8 +1247,10 @@ table: bt({ c, [56, 7], 124, + s, + [154, 7, 1], c, - [247, 15], + [52, 8], c, [22, 24], c, @@ -1268,17 +1275,17 @@ table: bt({ c, [115, 81], c, - [468, 6], + [487, 6], 144, c, - [593, 9], + [609, 9], c, [10, 25], 125, 123, 125, c, - [614, 25], + [630, 25], 177, 135, 176, @@ -1299,41 +1306,42 @@ table: bt({ 181, 183, c, - [33, 11], - c, - [625, 11], + [33, 8], + 124, + 130, c, - [21, 10], + [641, 9], c, - [19, 9], + [18, 9], c, - [811, 7], - 136, + [16, 7], c, - [806, 16], - 181, + [811, 21], 42, 135, 153, c, - [641, 14], + [631, 14], + c, + [660, 15], + 41, c, - [837, 15], + [701, 13], c, - [642, 31], + [643, 28], c, - [510, 132], + [511, 132], 41, - 124, 41, 124, + 41, c, [167, 47], c, [28, 9], 168, c, - [542, 3], + [543, 3], 168, 169, 170, @@ -1342,15 +1350,15 @@ table: bt({ c, [3, 4], c, - [448, 20], + [449, 20], c, - [386, 24], + [387, 24], c, - [1086, 5], + [1103, 5], c, - [475, 3], + [476, 3], c, - [988, 9], + [1008, 9], 177, 135, 179, @@ -1360,17 +1368,17 @@ table: bt({ 181, 1, c, - [412, 3], + [413, 3], c, [3, 3], c, - [413, 6], + [414, 6], c, - [393, 19], + [397, 16], 123, 141, c, - [1211, 3], + [1215, 3], 181, 44, 62, @@ -1378,36 +1386,36 @@ table: bt({ 44, 62, c, - [1017, 47], + [1015, 47], c, - [293, 62], + [290, 62], 168, 123, 125, 135, 177, c, - [618, 3], + [616, 3], c, - [154, 7], + [151, 7], c, - [578, 4], + [576, 4], c, - [550, 25], + [551, 21], c, - [16, 9], + [13, 7], 135, c, - [17, 16], + [14, 13], 123, 125, c, - [1331, 3], + [1336, 3], 1, 44, 62, c, - [249, 3] + [237, 3] ]), type: u([ 2, @@ -1427,82 +1435,84 @@ table: bt({ [21, 7], c, [16, 16], - s, - [2, 7], c, - [13, 5], + [20, 5], s, - [0, 4], + [0, 3], c, [6, 8], c, - [45, 11], + [35, 9], s, [2, 27], c, - [69, 14], + [59, 11], s, - [2, 38], + [2, 41], + c, + [52, 37], + c, + [131, 9], c, - [52, 38], + [82, 38], c, - [134, 11], + [181, 12], c, - [96, 48], + [30, 17], c, - [61, 32], + [78, 32], c, [27, 16], c, - [247, 17], + [261, 15], c, - [22, 25], + [22, 27], c, [17, 34], s, [2, 213], c, - [557, 16], + [563, 13], c, - [157, 144], + [157, 147], c, [59, 57], c, - [60, 14], + [60, 13], c, - [229, 37], + [228, 31], c, - [268, 4], + [528, 17], c, - [537, 16], + [47, 15], c, - [56, 15], + [660, 29], c, - [590, 20], + [643, 32], c, - [642, 30], - c, - [347, 153], + [348, 153], c, [28, 36], c, - [325, 4], + [326, 4], c, [209, 54], c, - [291, 20], + [302, 20], + c, + [19, 9], c, - [341, 10], + [414, 14], c, - [86, 25], + [1021, 14], c, - [347, 24], + [1015, 52], c, - [909, 104], + [276, 72], c, - [154, 26], + [237, 53], c, - [342, 46] + [51, 9] ]), state: u([ s, @@ -1514,8 +1524,10 @@ table: bt({ 18, c, [6, 5], - s, - [19, 5, 1], + 19, + 20, + 22, + 23, 28, 29, 33, @@ -1532,57 +1544,62 @@ table: bt({ 57, 60, c, - [15, 4], - 64, - 66, + [17, 6], + 61, c, - [24, 7], + [5, 4], + 65, + 68, 67, c, - [8, 7], + [14, 6], 68, + 69, + c, + [8, 6], + 70, c, [5, 4], - 69, + 71, c, [5, 4], + 75, + 72, 73, - 70, - 71, - 80, - 48, 82, - 83, + 48, 84, - 88, + 85, + 86, + 90, 57, - 89, + 91, c, - [61, 8], - 90, - 93, + [67, 7], + 92, + 95, c, [7, 5], s, - [64, 3], + [65, 3], + 75, + 99, 73, - 97, - 71, - 98, + 100, 45, - 102, 104, - 83, - 84, - 105, + 106, + 85, + 86, + 107, 12, 13, c, - [73, 5], - 110, - 83, - 84, - 113 + [72, 5], + 112, + 85, + 86, + 115 ]), mode: u([ s, @@ -1593,96 +1610,94 @@ table: bt({ [1, 9], c, [10, 10], - c, - [13, 4], - c, - [32, 8], - c, - [15, 8], - c, - [19, 10], s, - [2, 36], + [1, 13], + s, + [2, 44], c, [45, 34], c, [34, 25], c, - [125, 7], + [106, 7], c, - [5, 4], + [5, 3], c, - [36, 21], + [35, 19], c, - [21, 20], + [19, 9], c, - [189, 6], + [166, 6], c, - [180, 17], + [16, 8], c, - [26, 6], + [162, 9], c, - [50, 16], + [23, 7], c, - [95, 6], + [75, 10], c, - [50, 6], + [185, 9], c, - [253, 13], + [30, 5], c, - [257, 13], - s, - [1, 19], + [77, 19], + c, + [239, 16], + c, + [253, 23], + c, + [266, 57], s, - [2, 218], + [2, 174], c, [220, 89], c, - [429, 21], + [88, 20], c, - [123, 17], + [20, 14], c, - [524, 27], + [417, 19], c, - [586, 35], + [29, 13], c, - [212, 29], + [154, 57], c, - [583, 25], + [592, 28], c, - [557, 13], + [551, 12], c, - [565, 11], + [516, 14], c, - [525, 9], + [580, 19], c, - [589, 43], + [64, 12], c, - [454, 137], + [591, 24], c, - [202, 7], + [456, 136], c, - [166, 25], + [246, 6], c, - [782, 28], + [166, 27], c, - [128, 69], + [784, 28], c, - [71, 4], + [584, 68], c, - [300, 7], + [71, 5], c, - [365, 25], + [891, 7], c, - [1101, 6], + [370, 23], c, - [355, 23], + [943, 28], c, - [729, 88], + [728, 88], c, - [520, 33], + [278, 5], c, - [464, 33], + [1177, 52], 1 ]), goto: u([ @@ -1705,16 +1720,14 @@ table: bt({ 30, 26, 31, - s, - [38, 8], + 21, 25, 27, 35, 36, 39, 37, - s, - [38, 3], + 38, 41, 43, s, @@ -1741,11 +1754,11 @@ table: bt({ s, [33, 4], 58, - s, - [33, 3], + 33, + 33, 54, s, - [33, 9], + [33, 7], 7, s, [9, 9], @@ -1753,38 +1766,47 @@ table: bt({ 59, s, [36, 8], - s, - [37, 11], 32, 24, - 41, + 42, c, - [180, 3], + [157, 3], + 42, + 21, s, - [41, 8], + [42, 6], c, - [180, 7], - 41, - 41, + [164, 7], + 42, + 42, + 32, + 24, + 43, + c, + [23, 3], s, - [43, 3], - 62, - 61, + [43, 8], + c, + [23, 7], 43, 43, + s, + [45, 3], 63, + 62, + 45, + 45, + 64, s, - [43, 14], - 65, + [45, 14], + 66, s, - [43, 4], + [45, 4], 32, 24, 38, c, - [230, 4], - c, - [43, 7], + [230, 11], c, [14, 16], c, @@ -1792,12 +1814,8 @@ table: bt({ c, [12, 19], s, - [51, 27], - s, [53, 27], s, - [54, 27], - s, [55, 27], s, [56, 27], @@ -1806,134 +1824,141 @@ table: bt({ s, [58, 27], s, - [59, 29], + [59, 27], + s, + [60, 27], + s, + [61, 29], 35, - 72, + 74, s, - [67, 27], + [69, 27], s, - [68, 27], + [70, 27], s, - [65, 27], + [67, 27], s, [10, 6], - 74, + 76, s, [10, 3], s, [15, 10], s, [11, 6], - 75, + 77, s, [11, 3], s, [17, 10], - 77, - 76, + 79, + 78, 27, 27, - 78, + 80, s, [26, 24], - 79, - 49, - 71, 81, - 72, - 72, + 49, + 73, + 83, + 74, + 74, s, - [77, 25], + [79, 25], s, - [78, 25], + [80, 25], 1, 2, - 82, - 82, - 85, + 84, + 84, 87, + 89, c, - [583, 8], - 86, + [592, 7], + 88, s, - [33, 9], + [33, 7], s, - [20, 19], + [20, 16], c, - [750, 8], - c, - [745, 8], - 91, - 92, + [744, 13], + 93, + 94, 32, 24, 40, c, - [19, 3], + [16, 3], s, [40, 8], c, - [24, 7], + [23, 7], 40, 40, + 41, + 41, + 59, s, - [42, 3], - 62, - 61, - 42, - 42, + [41, 8], + s, + [44, 3], 63, + 62, + 44, + 44, + 64, s, - [42, 14], - 65, + [44, 14], + 66, s, - [42, 4], + [44, 4], s, - [46, 27], + [48, 27], s, - [47, 27], + [49, 27], s, - [48, 27], + [50, 27], s, - [52, 27], + [54, 27], s, - [66, 27], - 94, - 59, - 95, + [68, 27], + 96, + 37, 59, + 97, s, - [49, 3], - 62, - 61, - 49, - 49, + [51, 3], 63, + 62, + 51, + 51, + 64, s, - [49, 14], - 65, + [51, 14], + 66, s, - [49, 4], + [51, 4], s, - [50, 3], - 62, - 61, - 50, - 50, + [52, 3], 63, + 62, + 52, + 52, + 64, s, - [50, 14], - 65, + [52, 14], + 66, s, - [50, 4], - 96, + [52, 4], + 98, 35, - 62, - 72, + 64, + 74, s, - [63, 3], + [65, 3], s, - [64, 3], + [66, 3], s, [16, 10], s, @@ -1945,77 +1970,77 @@ table: bt({ s, [30, 3], s, - [69, 9], - 70, - 100, - 99, + [71, 9], + 72, + 102, 101, - 75, - 16, - 81, - 81, 103, + 77, + 16, + 83, + 83, + 105, s, - [79, 3], + [81, 3], c, - [383, 3], + [385, 3], 5, s, - [19, 19], + [19, 16], 11, 15, 16, - 107, - 106, + 109, 108, + 110, 34, 34, 32, 24, 39, c, - [355, 3], + [363, 3], s, [39, 8], c, - [355, 7], + [363, 7], 39, 39, s, - [44, 27], + [46, 27], s, - [45, 27], + [47, 27], s, - [60, 27], - 61, - 77, - 109, - 73, - 73, - 74, - 74, + [62, 27], + 63, + 79, + 111, + 75, + 75, + 76, + 76, 3, c, - [143, 3], + [140, 3], s, - [80, 3], - 111, + [82, 3], + 113, s, - [21, 19], + [21, 16], s, - [31, 16], - 112, + [31, 13], + 114, s, - [32, 16], + [32, 13], s, [29, 3], - 76, + 78, 4, 35, 35, 28, 28, - 78 + 80 ]) }), defaultActions: bda({ @@ -2023,12 +2048,12 @@ defaultActions: bda({ 18, 52, 53, - 80, - 87, - 97, - 101, - 110, - 111 + 82, + 89, + 99, + 103, + 112, + 113 ]), pop: u([ s, @@ -2038,11 +2063,11 @@ defaultActions: bda({ 7, 1, 2, - 70, + 72, 5, - 61, + 63, 3, - 76, + 78, 4 ]) }), diff --git a/lex.y b/lex.y index 53f0267..a851b65 100644 --- a/lex.y +++ b/lex.y @@ -190,7 +190,7 @@ name_list ; regex - : regex_list[re] + : nonempty_regex_list[re] { // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' @@ -254,10 +254,14 @@ regex_list ; nonempty_regex_list - : regex_list '|' regex_concat + : nonempty_regex_list '|' regex_concat { $$ = $1 + '|' + $3; } - | regex_list '|' + | nonempty_regex_list '|' { $$ = $1 + '|'; } + | '|' nonempty_regex_list + { $$ = '|' + $2; } + | '|' + { $$ = '|'; } | regex_concat ; From 1246dbb75472cee8e4e91318cc5a0d4739a8fe12 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 23:07:47 +0200 Subject: [PATCH 164/417] yup! indirect left-recursive equivalent is *TOAST*: cannot parse `bnf.l` (line 13, `BR \r\n|\n|\r`) --- lex-parser.js | 950 +++++++++++++++++++++++++------------------------- lex.y | 8 +- 2 files changed, 486 insertions(+), 472 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index f22fb7c..6b86a99 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -401,69 +401,70 @@ symbols_: { ",": 44, ".": 46, "/": 47, - "/!": 159, + "/!": 160, "<": 60, "=": 61, ">": 62, "?": 63, "ACTION": 150, "ACTION_BODY": 152, - "CHARACTER_LIT": 174, - "CODE": 184, + "BUGGER": 157, + "CHARACTER_LIT": 175, + "CODE": 185, "EOF": 1, - "ESCAPE_CHAR": 171, - "INCLUDE": 181, + "ESCAPE_CHAR": 172, + "INCLUDE": 182, "NAME": 135, - "NAME_BRACE": 165, - "OPTIONS": 175, - "OPTIONS_END": 177, - "OPTION_VALUE": 179, - "PATH": 182, - "RANGE_REGEX": 172, - "REGEX_SET": 170, - "REGEX_SET_END": 168, - "REGEX_SET_START": 166, - "SPECIAL_GROUP": 158, + "NAME_BRACE": 166, + "OPTIONS": 176, + "OPTIONS_END": 178, + "OPTION_VALUE": 180, + "PATH": 183, + "RANGE_REGEX": 173, + "REGEX_SET": 171, + "REGEX_SET_END": 169, + "REGEX_SET_START": 167, + "SPECIAL_GROUP": 159, "START_COND": 144, "START_EXC": 139, "START_INC": 137, - "STRING_LIT": 173, + "STRING_LIT": 174, "UNKNOWN_DECL": 143, "^": 94, "action": 141, "action_body": 147, "action_comments_body": 151, - "any_group_regex": 162, + "any_group_regex": 163, "definition": 134, "definitions": 129, "error": 2, - "escape_char": 164, + "escape_char": 165, "extra_lexer_module_code": 132, "include_macro_code": 149, "init": 128, "lex": 127, - "module_code_chunk": 183, - "name_expansion": 160, + "module_code_chunk": 184, + "name_expansion": 161, "name_list": 153, "names_exclusive": 140, "names_inclusive": 138, "nonempty_regex_list": 154, - "option": 178, - "option_list": 176, - "optional_module_code_chunk": 180, + "option": 179, + "option_list": 177, + "optional_module_code_chunk": 181, "options": 142, - "range_regex": 161, + "range_regex": 162, "regex": 136, - "regex_base": 157, + "regex_base": 158, "regex_concat": 156, "regex_list": 155, - "regex_set": 167, - "regex_set_atom": 169, + "regex_set": 168, + "regex_set_atom": 170, "rule": 145, "rules": 133, "rules_and_epilogue": 131, "start_conditions": 146, - "string": 163, + "string": 164, "unbracketed_action_body": 148, "{": 123, "|": 124, @@ -496,22 +497,23 @@ terminals_: { 144: "START_COND", 150: "ACTION", 152: "ACTION_BODY", - 158: "SPECIAL_GROUP", - 159: "/!", - 165: "NAME_BRACE", - 166: "REGEX_SET_START", - 168: "REGEX_SET_END", - 170: "REGEX_SET", - 171: "ESCAPE_CHAR", - 172: "RANGE_REGEX", - 173: "STRING_LIT", - 174: "CHARACTER_LIT", - 175: "OPTIONS", - 177: "OPTIONS_END", - 179: "OPTION_VALUE", - 181: "INCLUDE", - 182: "PATH", - 184: "CODE" + 157: "BUGGER", + 159: "SPECIAL_GROUP", + 160: "/!", + 166: "NAME_BRACE", + 167: "REGEX_SET_START", + 169: "REGEX_SET_END", + 171: "REGEX_SET", + 172: "ESCAPE_CHAR", + 173: "RANGE_REGEX", + 174: "STRING_LIT", + 175: "CHARACTER_LIT", + 176: "OPTIONS", + 178: "OPTIONS_END", + 180: "OPTION_VALUE", + 182: "INCLUDE", + 183: "PATH", + 185: "CODE" }, productions_: bp({ pop: u([ @@ -550,30 +552,30 @@ productions_: bp({ 156, 156, s, - [157, 15], - 160, - 162, - 167, - 167, - 169, - 169, - 164, + [158, 15], 161, 163, - 163, + 168, + 168, + 170, + 170, + 165, + 162, + 164, + 164, 142, - 176, - 176, + 177, + 177, s, - [178, 3], + [179, 3], 132, 132, 149, 149, - 183, - 183, - 180, - 180 + 184, + 184, + 181, + 181 ]), rule: u([ 4, @@ -607,25 +609,28 @@ productions_: bp({ [13, 3], 0, 3, + 2, + 3, c, - [30, 4], + [26, 3], c, - [25, 4], + [25, 3], s, [2, 5], c, [10, 3], s, [1, 6], - 3, c, - [9, 12], + [21, 3], + c, + [9, 10], c, [54, 3], c, - [39, 4], - 2, - 1, + [31, 3], + c, + [28, 3], 0 ]) }), @@ -902,22 +907,22 @@ case 36: break; case 39: - /*! Production:: nonempty_regex_list : nonempty_regex_list '|' regex_concat */ + /*! Production:: nonempty_regex_list : regex_list '|' regex_concat */ this.$ = $$[$0 - 2] + '|' + $$[$0]; break; case 40: - /*! Production:: nonempty_regex_list : nonempty_regex_list '|' */ + /*! Production:: nonempty_regex_list : regex_list '|' */ this.$ = $$[$0 - 1] + '|'; break; case 41: - /*! Production:: nonempty_regex_list : '|' nonempty_regex_list */ - this.$ = '|' + $$[$0]; + /*! Production:: nonempty_regex_list : BUGGER '|' nonempty_regex_list */ + this.$ = '|' + $$[$0 - 1]; break; case 42: - /*! Production:: nonempty_regex_list : '|' */ + /*! Production:: nonempty_regex_list : BUGGER '|' */ this.$ = '|'; break; @@ -1030,26 +1035,27 @@ table: bt({ 15, 1, 15, - 21, + 23, 2, 2, s, [9, 3], 5, - 24, - 24, + 25, + 25, 3, - 24, + 25, 2, - 20, + 21, 1, 9, 10, - 30, + 1, + 1, 28, 28, - 22, - 22, + 23, + 23, 17, 17, s, @@ -1062,27 +1068,26 @@ table: bt({ [10, 4], 2, 3, - 24, + 25, 1, 4, 3, - 25, - 25, + 26, + 26, 1, 1, 6, - 18, - 16, - 21, + 19, + 17, + 23, 3, 29, - 11, + 32, 28, s, [27, 5], - 1, - 2, - 1, + s, + [2, 3], 28, 28, 1, @@ -1091,33 +1096,36 @@ table: bt({ 3, 10, 10, - 24, + 25, 5, 3, 9, - c, - [15, 3], + 1, + 2, + 1, s, [3, 3], 6, 1, - 16, + 17, 6, 2, 1, 2, - c, - [34, 4], + 28, + 11, + s, + [27, 3], 1, s, [2, 3], c, - [31, 3], + [32, 3], 1, - 16, - 13, + 17, + 14, 1, - 13, + 14, 4, 1, 1, @@ -1134,8 +1142,8 @@ table: bt({ 139, 143, 150, - 175, - 181, + 176, + 182, 1, 123, 129, @@ -1159,21 +1167,20 @@ table: bt({ 94, 124, 136, - 154, s, - [156, 5, 1], + [154, 8, 1], s, - [162, 5, 1], - 171, - 173, + [163, 5, 1], + 172, 174, + 175, 138, 144, 140, 144, 123, c, - [66, 8], + [68, 8], c, [9, 19], 125, @@ -1182,30 +1189,31 @@ table: bt({ 152, 1, c, - [58, 4], + [60, 4], 60, 94, 123, 124, c, [22, 6], - 158, + 157, 159, + 160, c, - [58, 5], + [59, 5], c, - [113, 3], + [116, 3], c, - [24, 23], + [25, 24], 135, - 176, - 178, + 177, + 179, c, - [27, 24], + [28, 25], 2, - 182, + 183, c, - [26, 7], + [27, 7], 124, 130, 131, @@ -1213,209 +1221,221 @@ table: bt({ 145, 146, c, - [24, 7], + [25, 8], 130, c, - [112, 10], + [116, 10], c, - [49, 7], - c, - [174, 4], + [51, 7], + 176, + 182, + 124, + 124, + 36, + 40, 41, c, - [175, 3], - c, - [16, 8], + [183, 3], c, - [181, 14], + [18, 8], c, - [30, 16], + [185, 12], c, - [28, 17], + [210, 4], + 41, 42, 43, 46, 47, 63, c, - [126, 11], - 161, + [31, 9], + 159, + 160, + 162, c, [27, 3], s, - [172, 4, 1], + [173, 4, 1], c, - [56, 7], - 124, - s, - [154, 7, 1], + [28, 4], c, - [52, 8], + [239, 4], c, - [22, 24], + [238, 16], c, - [21, 3], + [23, 25], + c, + [22, 3], c, [17, 31], c, - [106, 17], + [108, 17], c, - [105, 11], + [107, 11], c, [27, 180], - 168, - s, - [170, 6, 1], - 181, - 160, - 165, - 167, 169, + s, + [171, 6, 1], + 182, + 161, + 166, + 168, 170, + 171, c, [115, 81], c, - [487, 6], + [461, 6], 144, c, - [609, 9], + [587, 9], c, [10, 25], 125, 123, 125, c, - [630, 25], - 177, + [608, 26], + 178, 135, - 176, 177, 178, + 179, 61, 135, - 177, + 178, c, - [32, 24], - 184, + [33, 25], + 185, c, - [25, 26], + [26, 27], 1, 1, 132, - 180, 181, - 183, + 182, + 184, c, - [33, 8], + [34, 8], 124, 130, c, - [641, 9], + [619, 10], c, - [18, 9], + [19, 9], c, - [16, 7], + [17, 8], c, - [811, 21], + [796, 23], 42, 135, 153, c, - [631, 14], + [640, 14], + 156, + c, + [641, 17], c, - [660, 15], - 41, + [29, 11], c, - [701, 13], + [62, 16], c, - [643, 28], + [673, 33], c, - [511, 132], + [539, 132], 41, + 124, 41, 124, 41, c, - [167, 47], + [870, 4], + c, + [169, 44], c, [28, 9], - 168, + 169, c, - [543, 3], - 168, + [573, 3], 169, 170, - 165, - 168, + 171, + 166, + 169, c, [3, 4], c, - [449, 20], + [479, 20], c, - [387, 24], + [415, 25], c, - [1103, 5], + [1112, 5], c, - [476, 3], + [507, 3], c, - [1008, 9], - 177, + [1013, 9], + 178, 135, - 179, + 180, 1, 1, 149, - 181, + 182, 1, c, - [413, 3], + [441, 3], c, [3, 3], c, - [414, 6], + [442, 6], c, - [397, 16], + [424, 17], 123, 141, c, - [1215, 3], - 181, + [1227, 3], + 182, 44, 62, 62, 44, 62, c, - [1015, 47], + [1049, 28], + 41, c, - [290, 62], - 168, + [1090, 10], + c, + [305, 81], + 169, 123, 125, 135, - 177, + 178, c, - [616, 3], + [658, 3], c, - [151, 7], + [163, 7], c, - [576, 4], + [616, 4], c, - [551, 21], + [590, 22], c, - [13, 7], + [14, 8], 135, c, - [14, 13], + [15, 14], 123, 125, c, - [1336, 3], + [1360, 3], 1, 44, 62, c, - [237, 3] + [252, 3] ]), type: u([ 2, @@ -1440,79 +1460,81 @@ table: bt({ s, [0, 3], c, - [6, 8], + [23, 4], + c, + [8, 5], c, - [35, 9], + [37, 10], s, [2, 27], c, - [59, 11], + [61, 11], s, - [2, 41], - c, - [52, 37], + [2, 43], c, - [131, 9], + [54, 38], c, - [82, 38], + [134, 9], c, - [181, 12], + [86, 40], c, - [30, 17], - c, - [78, 32], + [51, 32], c, [27, 16], c, - [261, 15], + [238, 16], c, - [22, 27], + [23, 28], c, [17, 34], s, [2, 213], c, - [563, 13], + [543, 13], + c, + [158, 148], c, - [157, 147], + [61, 59], c, - [59, 57], + [62, 13], c, - [60, 13], + [231, 33], c, - [228, 31], + [796, 17], c, - [528, 17], + [592, 17], c, - [47, 15], + [24, 4], c, - [660, 29], + [531, 25], c, - [643, 32], + [620, 23], c, - [348, 153], + [673, 30], + c, + [377, 155], c, [28, 36], c, - [326, 4], + [242, 4], c, - [209, 54], + [211, 55], c, - [302, 20], + [294, 20], c, [19, 9], c, - [414, 14], + [442, 14], c, - [1021, 14], + [356, 14], c, - [1015, 52], + [1049, 53], c, - [276, 72], + [289, 83], c, - [237, 53], + [250, 56], c, - [51, 9] + [54, 9] ]), state: u([ s, @@ -1526,80 +1548,81 @@ table: bt({ [6, 5], 19, 20, - 22, + 21, 23, - 28, + 24, 29, - 33, + 30, 34, - 40, - 42, - 44, + 35, + 41, + 43, 45, - 47, + 46, 48, - 52, - 55, + 49, + 53, 56, 57, - 60, - c, - [17, 6], - 61, + 58, + 62, c, - [5, 4], - 65, + [15, 4], + 66, + 69, 68, - 67, c, - [14, 6], - 68, + [24, 6], 69, - c, - [8, 6], 70, c, - [5, 4], + [8, 6], 71, c, [5, 4], - 75, 72, + c, + [5, 4], + 76, 73, - 82, - 48, - 84, + 74, + 83, + 49, 85, 86, - 90, - 57, + 87, 91, - c, - [67, 7], + 58, 92, - 95, + c, + [61, 8], + 93, + 96, c, [7, 5], + 97, + c, + [15, 7], s, - [65, 3], - 75, - 99, - 73, - 100, - 45, - 104, + [66, 3], + 76, + 101, + 74, + 102, + 46, 106, - 85, + 108, 86, - 107, + 87, + 109, 12, 13, c, - [72, 5], - 112, - 85, + [81, 5], + 114, 86, - 115 + 87, + 117 ]), mode: u([ s, @@ -1610,46 +1633,42 @@ table: bt({ [1, 9], c, [10, 10], - s, - [1, 13], + c, + [13, 14], s, [2, 44], c, - [45, 34], + [45, 36], c, - [34, 25], + [36, 26], c, - [106, 7], + [109, 7], c, [5, 3], c, - [35, 19], - c, - [19, 9], + [72, 29], c, - [166, 6], + [160, 8], c, - [16, 8], + [16, 12], c, - [162, 9], + [15, 8], c, - [23, 7], + [7, 4], c, - [75, 10], + [61, 15], c, - [185, 9], + [84, 6], c, - [30, 5], + [50, 6], c, - [77, 19], + [225, 14], c, - [239, 16], - c, - [253, 23], - c, - [266, 57], + [242, 13], + s, + [1, 20], s, - [2, 174], + [2, 218], c, [220, 89], c, @@ -1657,47 +1676,45 @@ table: bt({ c, [20, 14], c, - [417, 19], + [419, 19], c, - [29, 13], + [30, 14], c, - [154, 57], + [155, 59], c, - [592, 28], + [577, 35], c, - [551, 12], + [748, 22], c, - [516, 14], + [588, 17], c, - [580, 19], + [23, 21], c, - [64, 12], + [612, 30], c, - [591, 24], + [475, 139], c, - [456, 136], + [170, 5], c, - [246, 6], + [168, 27], c, - [166, 27], + [807, 28], c, - [784, 28], + [131, 69], c, - [584, 68], - c, - [71, 5], + [72, 5], c, - [891, 7], + [303, 7], c, - [370, 23], + [388, 23], c, - [943, 28], + [357, 24], c, - [728, 88], + [762, 104], c, - [278, 5], + [291, 5], c, - [1177, 52], + [1196, 55], 1 ]), goto: u([ @@ -1715,21 +1732,22 @@ table: bt({ 17, c, [10, 9], - 32, - 24, - 30, - 26, - 31, - 21, + 33, 25, + 31, 27, - 35, + 32, + 38, + 22, + 26, + 28, 36, - 39, 37, + 40, 38, - 41, - 43, + 39, + 42, + 44, s, [12, 9], s, @@ -1740,77 +1758,64 @@ table: bt({ [29, 3], s, [23, 14], - 46, + 47, s, - [23, 9], + [23, 10], s, - [24, 24], - 49, + [24, 25], + 50, s, - [25, 24], + [25, 25], + 52, 51, - 50, - 53, + 54, s, [33, 4], - 58, + 59, 33, 33, - 54, + 55, s, - [33, 7], + [33, 8], 7, s, [9, 9], - 36, - 59, - s, - [36, 8], - 32, - 24, - 42, - c, - [157, 3], - 42, - 21, s, - [42, 6], - c, - [164, 7], - 42, - 42, - 32, - 24, + [36, 10], + 60, + 61, + 33, + 25, 43, c, - [23, 3], + [164, 3], s, [43, 8], c, - [23, 7], + [170, 7], 43, 43, s, [45, 3], + 64, 63, - 62, 45, 45, - 64, + 65, s, [45, 14], - 66, + 67, s, [45, 4], - 32, - 24, + 33, + 25, 38, c, - [230, 11], + [214, 12], c, - [14, 16], + [15, 17], c, - [13, 3], + [14, 3], c, [12, 19], s, @@ -1829,8 +1834,8 @@ table: bt({ [60, 27], s, [61, 29], - 35, - 74, + 36, + 75, s, [69, 27], s, @@ -1839,78 +1844,83 @@ table: bt({ [67, 27], s, [10, 6], - 76, + 77, s, [10, 3], s, [15, 10], s, [11, 6], - 77, + 78, s, [11, 3], s, [17, 10], + 80, 79, - 78, 27, 27, - 80, - s, - [26, 24], 81, - 49, + s, + [26, 25], + 82, + 50, 73, - 83, + 84, 74, 74, s, - [79, 25], + [79, 26], s, - [80, 25], + [80, 26], 1, 2, 84, 84, - 87, - 89, - c, - [592, 7], 88, + 90, + c, + [577, 7], + 89, s, - [33, 7], + [33, 8], s, - [20, 16], + [20, 17], c, - [744, 13], - 93, + [735, 14], 94, - 32, - 24, + 95, + 33, + 25, 40, c, - [16, 3], + [17, 3], s, [40, 8], c, [23, 7], 40, 40, - 41, - 41, - 59, + 33, + 25, + 42, + c, + [23, 3], s, - [41, 8], + [42, 8], + c, + [782, 9], + 42, s, [44, 3], + 64, 63, - 62, 44, 44, - 64, + 65, s, [44, 14], - 66, + 67, s, [44, 4], s, @@ -1923,38 +1933,40 @@ table: bt({ [54, 27], s, [68, 27], - 96, + 98, + 60, 37, - 59, - 97, + 37, + 99, + 60, s, [51, 3], + 64, 63, - 62, 51, 51, - 64, + 65, s, [51, 14], - 66, + 67, s, [51, 4], s, [52, 3], + 64, 63, - 62, 52, 52, - 64, + 65, s, [52, 14], - 66, + 67, s, [52, 4], - 98, - 35, + 100, + 36, 64, - 74, + 75, s, [65, 3], s, @@ -1964,7 +1976,7 @@ table: bt({ s, [18, 10], s, - [22, 24], + [22, 25], s, [29, 3], s, @@ -1972,66 +1984,68 @@ table: bt({ s, [71, 9], 72, - 102, - 101, + 104, 103, + 105, 77, 16, 83, 83, - 105, + 107, s, [81, 3], c, - [385, 3], + [404, 3], 5, s, - [19, 16], + [19, 17], 11, 15, 16, - 109, - 108, + 111, 110, + 112, 34, 34, - 32, - 24, + 33, + 25, 39, c, - [363, 3], + [357, 3], s, [39, 8], c, - [363, 7], + [356, 7], 39, 39, s, + [41, 11], + s, [46, 27], s, [47, 27], s, [62, 27], 63, - 79, - 111, + 80, + 113, 75, 75, 76, 76, 3, c, - [140, 3], + [152, 3], s, [82, 3], - 113, + 115, s, - [21, 16], + [21, 17], s, - [31, 13], - 114, + [31, 14], + 116, s, - [32, 13], + [32, 14], s, [29, 3], 78, @@ -2040,20 +2054,20 @@ table: bt({ 35, 28, 28, - 80 + 81 ]) }), defaultActions: bda({ idx: u([ 18, - 52, 53, - 82, - 89, - 99, - 103, - 112, - 113 + 54, + 83, + 90, + 101, + 105, + 114, + 115 ]), pop: u([ s, @@ -3133,23 +3147,23 @@ case 17 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 174; + return 175; break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 179; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 180; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 179; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 180; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 177; + this.popState(); return 178; break; case 24 : /*! Conditions:: options */ @@ -3206,7 +3220,7 @@ case 32 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 181; + return 182; break; case 33 : @@ -3240,7 +3254,7 @@ case 38 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 174; + return 175; break; case 39 : @@ -3256,17 +3270,17 @@ break; case 41 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 173; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 174; break; case 42 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 173; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 174; break; case 43 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ - this.pushState('set'); return 166; + this.pushState('set'); return 167; break; case 56 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3276,7 +3290,7 @@ break; case 57 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ - return 159; // treated as `(?!atom)` + return 160; // treated as `(?!atom)` break; case 58 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3286,12 +3300,12 @@ break; case 60 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 171; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 172; break; case 63 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 175; + this.begin('options'); return 176; break; case 64 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3306,7 +3320,7 @@ break; case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 181; + this.pushState('path'); return 182; break; case 67 : /*! Conditions:: INITIAL rules trail code */ @@ -3330,12 +3344,12 @@ break; case 78 : /*! Conditions:: set */ /*! Rule:: \] */ - this.popState('set'); return 168; + this.popState('set'); return 169; break; case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 184; // the bit of CODE just before EOF... + return 185; // the bit of CODE just before EOF... break; case 81 : /*! Conditions:: path */ @@ -3345,12 +3359,12 @@ break; case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 182; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 183; break; case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 182; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 183; break; case 84 : /*! Conditions:: path */ @@ -3360,7 +3374,7 @@ break; case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 182; + this.popState(); return 183; break; case 86 : /*! Conditions:: * */ @@ -3414,7 +3428,7 @@ simpleCaseActionClusters: { 19 : 61, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 179, + 22 : 180, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ 25 : 144, @@ -3423,13 +3437,13 @@ simpleCaseActionClusters: { 44 : 124, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ - 45 : 158, + 45 : 159, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ - 46 : 158, + 46 : 159, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ - 47 : 158, + 47 : 159, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ 48 : 40, @@ -3456,7 +3470,7 @@ simpleCaseActionClusters: { 55 : 36, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 171, + 59 : 172, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ 61 : 36, @@ -3465,13 +3479,13 @@ simpleCaseActionClusters: { 62 : 46, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 172, + 69 : 173, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 165, + 70 : 166, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 165, + 71 : 166, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ 72 : 123, @@ -3483,13 +3497,13 @@ simpleCaseActionClusters: { 75 : 1, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 76 : 170, + 76 : 171, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 170, + 77 : 171, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 184 + 79 : 185 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, diff --git a/lex.y b/lex.y index a851b65..1cae3ba 100644 --- a/lex.y +++ b/lex.y @@ -254,13 +254,13 @@ regex_list ; nonempty_regex_list - : nonempty_regex_list '|' regex_concat + : regex_list '|' regex_concat { $$ = $1 + '|' + $3; } - | nonempty_regex_list '|' + | regex_list '|' { $$ = $1 + '|'; } - | '|' nonempty_regex_list + | BUGGER '|' nonempty_regex_list { $$ = '|' + $2; } - | '|' + | BUGGER '|' { $$ = '|'; } | regex_concat ; From f49e214fdf28bc8fcab1f9e8b9805b2fad2a8351 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 23:18:20 +0200 Subject: [PATCH 165/417] added failing test: fails when we have a grammar with indirect recursion A->B->A like we have now. --- tests/all-tests.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/all-tests.js b/tests/all-tests.js index c069e5a..53c120e 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -524,6 +524,21 @@ exports["test no brace action with surplus whitespace between rules"] = function assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +`BR \r\n|\n|\r` + +exports["test macro for commit SHA-1: 1246dbb75472cee8e4e91318cc5a0d4739a8fe12"] = function () { + var lexgrammar = 'BR \\r\\n|\\n|\\r\n%%\r\n{BR} %{\r\nreturn true;\r\n%}\r\n'; + var expected = { + macros: {"BR": "\\r\\n|\\n|\\r"}, + rules: [ + ["{BR}", "\r\nreturn true;\r\n"] + ] + }; + + lexer_reset(); + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); +}; + exports["test windows line endings"] = function () { var lexgrammar = '%%\r\n"["[^\\]]"]" %{\r\nreturn true;\r\n%}\r\n'; var expected = { From ceecbcb81cfe9eb6006ac5f06e8eee32832c6a2a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 23:24:10 +0200 Subject: [PATCH 166/417] temporarily revert to the quickfix in SHA-1: 28a0e3498258cc0c13709c8ef7736b59fe3ce8c4 as it turns out GerHobbelt/jison#1 *is* a real problem --- lex.y | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lex.y b/lex.y index 1cae3ba..a851b65 100644 --- a/lex.y +++ b/lex.y @@ -254,13 +254,13 @@ regex_list ; nonempty_regex_list - : regex_list '|' regex_concat + : nonempty_regex_list '|' regex_concat { $$ = $1 + '|' + $3; } - | regex_list '|' + | nonempty_regex_list '|' { $$ = $1 + '|'; } - | BUGGER '|' nonempty_regex_list + | '|' nonempty_regex_list { $$ = '|' + $2; } - | BUGGER '|' + | '|' { $$ = '|'; } | regex_concat ; From c212c056fb7dd76eb403a1c41039d8c7cafb7209 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 7 Jul 2016 23:31:03 +0200 Subject: [PATCH 167/417] regenerated parser --- lex-parser.js | 950 +++++++++++++++++++++++++------------------------- 1 file changed, 468 insertions(+), 482 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 6b86a99..f22fb7c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -401,70 +401,69 @@ symbols_: { ",": 44, ".": 46, "/": 47, - "/!": 160, + "/!": 159, "<": 60, "=": 61, ">": 62, "?": 63, "ACTION": 150, "ACTION_BODY": 152, - "BUGGER": 157, - "CHARACTER_LIT": 175, - "CODE": 185, + "CHARACTER_LIT": 174, + "CODE": 184, "EOF": 1, - "ESCAPE_CHAR": 172, - "INCLUDE": 182, + "ESCAPE_CHAR": 171, + "INCLUDE": 181, "NAME": 135, - "NAME_BRACE": 166, - "OPTIONS": 176, - "OPTIONS_END": 178, - "OPTION_VALUE": 180, - "PATH": 183, - "RANGE_REGEX": 173, - "REGEX_SET": 171, - "REGEX_SET_END": 169, - "REGEX_SET_START": 167, - "SPECIAL_GROUP": 159, + "NAME_BRACE": 165, + "OPTIONS": 175, + "OPTIONS_END": 177, + "OPTION_VALUE": 179, + "PATH": 182, + "RANGE_REGEX": 172, + "REGEX_SET": 170, + "REGEX_SET_END": 168, + "REGEX_SET_START": 166, + "SPECIAL_GROUP": 158, "START_COND": 144, "START_EXC": 139, "START_INC": 137, - "STRING_LIT": 174, + "STRING_LIT": 173, "UNKNOWN_DECL": 143, "^": 94, "action": 141, "action_body": 147, "action_comments_body": 151, - "any_group_regex": 163, + "any_group_regex": 162, "definition": 134, "definitions": 129, "error": 2, - "escape_char": 165, + "escape_char": 164, "extra_lexer_module_code": 132, "include_macro_code": 149, "init": 128, "lex": 127, - "module_code_chunk": 184, - "name_expansion": 161, + "module_code_chunk": 183, + "name_expansion": 160, "name_list": 153, "names_exclusive": 140, "names_inclusive": 138, "nonempty_regex_list": 154, - "option": 179, - "option_list": 177, - "optional_module_code_chunk": 181, + "option": 178, + "option_list": 176, + "optional_module_code_chunk": 180, "options": 142, - "range_regex": 162, + "range_regex": 161, "regex": 136, - "regex_base": 158, + "regex_base": 157, "regex_concat": 156, "regex_list": 155, - "regex_set": 168, - "regex_set_atom": 170, + "regex_set": 167, + "regex_set_atom": 169, "rule": 145, "rules": 133, "rules_and_epilogue": 131, "start_conditions": 146, - "string": 164, + "string": 163, "unbracketed_action_body": 148, "{": 123, "|": 124, @@ -497,23 +496,22 @@ terminals_: { 144: "START_COND", 150: "ACTION", 152: "ACTION_BODY", - 157: "BUGGER", - 159: "SPECIAL_GROUP", - 160: "/!", - 166: "NAME_BRACE", - 167: "REGEX_SET_START", - 169: "REGEX_SET_END", - 171: "REGEX_SET", - 172: "ESCAPE_CHAR", - 173: "RANGE_REGEX", - 174: "STRING_LIT", - 175: "CHARACTER_LIT", - 176: "OPTIONS", - 178: "OPTIONS_END", - 180: "OPTION_VALUE", - 182: "INCLUDE", - 183: "PATH", - 185: "CODE" + 158: "SPECIAL_GROUP", + 159: "/!", + 165: "NAME_BRACE", + 166: "REGEX_SET_START", + 168: "REGEX_SET_END", + 170: "REGEX_SET", + 171: "ESCAPE_CHAR", + 172: "RANGE_REGEX", + 173: "STRING_LIT", + 174: "CHARACTER_LIT", + 175: "OPTIONS", + 177: "OPTIONS_END", + 179: "OPTION_VALUE", + 181: "INCLUDE", + 182: "PATH", + 184: "CODE" }, productions_: bp({ pop: u([ @@ -552,30 +550,30 @@ productions_: bp({ 156, 156, s, - [158, 15], - 161, - 163, - 168, - 168, - 170, - 170, - 165, + [157, 15], + 160, 162, + 167, + 167, + 169, + 169, 164, - 164, + 161, + 163, + 163, 142, - 177, - 177, + 176, + 176, s, - [179, 3], + [178, 3], 132, 132, 149, 149, - 184, - 184, - 181, - 181 + 183, + 183, + 180, + 180 ]), rule: u([ 4, @@ -609,28 +607,25 @@ productions_: bp({ [13, 3], 0, 3, - 2, - 3, c, - [26, 3], + [30, 4], c, - [25, 3], + [25, 4], s, [2, 5], c, [10, 3], s, [1, 6], + 3, c, - [21, 3], - c, - [9, 10], + [9, 12], c, [54, 3], c, - [31, 3], - c, - [28, 3], + [39, 4], + 2, + 1, 0 ]) }), @@ -907,22 +902,22 @@ case 36: break; case 39: - /*! Production:: nonempty_regex_list : regex_list '|' regex_concat */ + /*! Production:: nonempty_regex_list : nonempty_regex_list '|' regex_concat */ this.$ = $$[$0 - 2] + '|' + $$[$0]; break; case 40: - /*! Production:: nonempty_regex_list : regex_list '|' */ + /*! Production:: nonempty_regex_list : nonempty_regex_list '|' */ this.$ = $$[$0 - 1] + '|'; break; case 41: - /*! Production:: nonempty_regex_list : BUGGER '|' nonempty_regex_list */ - this.$ = '|' + $$[$0 - 1]; + /*! Production:: nonempty_regex_list : '|' nonempty_regex_list */ + this.$ = '|' + $$[$0]; break; case 42: - /*! Production:: nonempty_regex_list : BUGGER '|' */ + /*! Production:: nonempty_regex_list : '|' */ this.$ = '|'; break; @@ -1035,27 +1030,26 @@ table: bt({ 15, 1, 15, - 23, + 21, 2, 2, s, [9, 3], 5, - 25, - 25, + 24, + 24, 3, - 25, + 24, 2, - 21, + 20, 1, 9, 10, - 1, - 1, + 30, 28, 28, - 23, - 23, + 22, + 22, 17, 17, s, @@ -1068,26 +1062,27 @@ table: bt({ [10, 4], 2, 3, - 25, + 24, 1, 4, 3, - 26, - 26, + 25, + 25, 1, 1, 6, - 19, - 17, - 23, + 18, + 16, + 21, 3, 29, - 32, + 11, 28, s, [27, 5], - s, - [2, 3], + 1, + 2, + 1, 28, 28, 1, @@ -1096,36 +1091,33 @@ table: bt({ 3, 10, 10, - 25, + 24, 5, 3, 9, - 1, - 2, - 1, + c, + [15, 3], s, [3, 3], 6, 1, - 17, + 16, 6, 2, 1, 2, - 28, - 11, - s, - [27, 3], + c, + [34, 4], 1, s, [2, 3], c, - [32, 3], + [31, 3], 1, - 17, - 14, + 16, + 13, 1, - 14, + 13, 4, 1, 1, @@ -1142,8 +1134,8 @@ table: bt({ 139, 143, 150, - 176, - 182, + 175, + 181, 1, 123, 129, @@ -1167,20 +1159,21 @@ table: bt({ 94, 124, 136, + 154, s, - [154, 8, 1], + [156, 5, 1], s, - [163, 5, 1], - 172, + [162, 5, 1], + 171, + 173, 174, - 175, 138, 144, 140, 144, 123, c, - [68, 8], + [66, 8], c, [9, 19], 125, @@ -1189,31 +1182,30 @@ table: bt({ 152, 1, c, - [60, 4], + [58, 4], 60, 94, 123, 124, c, [22, 6], - 157, + 158, 159, - 160, c, - [59, 5], + [58, 5], c, - [116, 3], + [113, 3], c, - [25, 24], + [24, 23], 135, - 177, - 179, + 176, + 178, c, - [28, 25], + [27, 24], 2, - 183, + 182, c, - [27, 7], + [26, 7], 124, 130, 131, @@ -1221,221 +1213,209 @@ table: bt({ 145, 146, c, - [25, 8], + [24, 7], 130, c, - [116, 10], + [112, 10], c, - [51, 7], - 176, - 182, - 124, - 124, - 36, - 40, + [49, 7], + c, + [174, 4], 41, c, - [183, 3], + [175, 3], c, - [18, 8], + [16, 8], c, - [185, 12], + [181, 14], c, - [210, 4], - 41, + [30, 16], + c, + [28, 17], 42, 43, 46, 47, 63, c, - [31, 9], - 159, - 160, - 162, + [126, 11], + 161, c, [27, 3], s, - [173, 4, 1], + [172, 4, 1], c, - [28, 4], - c, - [239, 4], + [56, 7], + 124, + s, + [154, 7, 1], c, - [238, 16], + [52, 8], c, - [23, 25], + [22, 24], c, - [22, 3], + [21, 3], c, [17, 31], c, - [108, 17], + [106, 17], c, - [107, 11], + [105, 11], c, [27, 180], - 169, - s, - [171, 6, 1], - 182, - 161, - 166, 168, + s, + [170, 6, 1], + 181, + 160, + 165, + 167, + 169, 170, - 171, c, [115, 81], c, - [461, 6], + [487, 6], 144, c, - [587, 9], + [609, 9], c, [10, 25], 125, 123, 125, c, - [608, 26], - 178, + [630, 25], + 177, 135, + 176, 177, 178, - 179, 61, 135, - 178, + 177, c, - [33, 25], - 185, + [32, 24], + 184, c, - [26, 27], + [25, 26], 1, 1, 132, + 180, 181, - 182, - 184, + 183, c, - [34, 8], + [33, 8], 124, 130, c, - [619, 10], + [641, 9], c, - [19, 9], + [18, 9], c, - [17, 8], + [16, 7], c, - [796, 23], + [811, 21], 42, 135, 153, c, - [640, 14], - 156, - c, - [641, 17], + [631, 14], c, - [29, 11], + [660, 15], + 41, c, - [62, 16], + [701, 13], c, - [673, 33], + [643, 28], c, - [539, 132], + [511, 132], 41, - 124, 41, 124, 41, c, - [870, 4], - c, - [169, 44], + [167, 47], c, [28, 9], - 169, + 168, c, - [573, 3], + [543, 3], + 168, 169, 170, - 171, - 166, - 169, + 165, + 168, c, [3, 4], c, - [479, 20], + [449, 20], c, - [415, 25], + [387, 24], c, - [1112, 5], + [1103, 5], c, - [507, 3], + [476, 3], c, - [1013, 9], - 178, + [1008, 9], + 177, 135, - 180, + 179, 1, 1, 149, - 182, + 181, 1, c, - [441, 3], + [413, 3], c, [3, 3], c, - [442, 6], + [414, 6], c, - [424, 17], + [397, 16], 123, 141, c, - [1227, 3], - 182, + [1215, 3], + 181, 44, 62, 62, 44, 62, c, - [1049, 28], - 41, + [1015, 47], c, - [1090, 10], - c, - [305, 81], - 169, + [290, 62], + 168, 123, 125, 135, - 178, + 177, c, - [658, 3], + [616, 3], c, - [163, 7], + [151, 7], c, - [616, 4], + [576, 4], c, - [590, 22], + [551, 21], c, - [14, 8], + [13, 7], 135, c, - [15, 14], + [14, 13], 123, 125, c, - [1360, 3], + [1336, 3], 1, 44, 62, c, - [252, 3] + [237, 3] ]), type: u([ 2, @@ -1460,81 +1440,79 @@ table: bt({ s, [0, 3], c, - [23, 4], - c, - [8, 5], + [6, 8], c, - [37, 10], + [35, 9], s, [2, 27], c, - [61, 11], + [59, 11], s, - [2, 43], + [2, 41], + c, + [52, 37], c, - [54, 38], + [131, 9], c, - [134, 9], + [82, 38], c, - [86, 40], + [181, 12], c, - [51, 32], + [30, 17], + c, + [78, 32], c, [27, 16], c, - [238, 16], + [261, 15], c, - [23, 28], + [22, 27], c, [17, 34], s, [2, 213], c, - [543, 13], - c, - [158, 148], + [563, 13], c, - [61, 59], + [157, 147], c, - [62, 13], + [59, 57], c, - [231, 33], + [60, 13], c, - [796, 17], + [228, 31], c, - [592, 17], + [528, 17], c, - [24, 4], + [47, 15], c, - [531, 25], + [660, 29], c, - [620, 23], + [643, 32], c, - [673, 30], - c, - [377, 155], + [348, 153], c, [28, 36], c, - [242, 4], + [326, 4], c, - [211, 55], + [209, 54], c, - [294, 20], + [302, 20], c, [19, 9], c, - [442, 14], + [414, 14], c, - [356, 14], + [1021, 14], c, - [1049, 53], + [1015, 52], c, - [289, 83], + [276, 72], c, - [250, 56], + [237, 53], c, - [54, 9] + [51, 9] ]), state: u([ s, @@ -1548,81 +1526,80 @@ table: bt({ [6, 5], 19, 20, - 21, + 22, 23, - 24, + 28, 29, - 30, + 33, 34, - 35, - 41, - 43, + 40, + 42, + 44, 45, - 46, + 47, 48, - 49, - 53, + 52, + 55, 56, 57, - 58, - 62, + 60, c, - [15, 4], - 66, - 69, + [17, 6], + 61, + c, + [5, 4], + 65, 68, + 67, c, - [24, 6], + [14, 6], + 68, 69, - 70, c, [8, 6], - 71, + 70, c, [5, 4], - 72, + 71, c, [5, 4], - 76, + 75, + 72, 73, - 74, - 83, - 49, + 82, + 48, + 84, 85, 86, - 87, + 90, + 57, 91, - 58, - 92, c, - [61, 8], - 93, - 96, + [67, 7], + 92, + 95, c, [7, 5], - 97, - c, - [15, 7], s, - [66, 3], - 76, - 101, - 74, - 102, - 46, + [65, 3], + 75, + 99, + 73, + 100, + 45, + 104, 106, - 108, + 85, 86, - 87, - 109, + 107, 12, 13, c, - [81, 5], - 114, + [72, 5], + 112, + 85, 86, - 87, - 117 + 115 ]), mode: u([ s, @@ -1633,42 +1610,46 @@ table: bt({ [1, 9], c, [10, 10], - c, - [13, 14], + s, + [1, 13], s, [2, 44], c, - [45, 36], + [45, 34], c, - [36, 26], + [34, 25], c, - [109, 7], + [106, 7], c, [5, 3], c, - [72, 29], + [35, 19], c, - [160, 8], + [19, 9], c, - [16, 12], + [166, 6], c, - [15, 8], + [16, 8], c, - [7, 4], + [162, 9], c, - [61, 15], + [23, 7], c, - [84, 6], + [75, 10], c, - [50, 6], + [185, 9], c, - [225, 14], + [30, 5], c, - [242, 13], - s, - [1, 20], + [77, 19], + c, + [239, 16], + c, + [253, 23], + c, + [266, 57], s, - [2, 218], + [2, 174], c, [220, 89], c, @@ -1676,45 +1657,47 @@ table: bt({ c, [20, 14], c, - [419, 19], + [417, 19], c, - [30, 14], + [29, 13], c, - [155, 59], + [154, 57], c, - [577, 35], + [592, 28], c, - [748, 22], + [551, 12], c, - [588, 17], + [516, 14], c, - [23, 21], + [580, 19], c, - [612, 30], + [64, 12], c, - [475, 139], + [591, 24], c, - [170, 5], + [456, 136], c, - [168, 27], + [246, 6], c, - [807, 28], + [166, 27], c, - [131, 69], + [784, 28], c, - [72, 5], + [584, 68], + c, + [71, 5], c, - [303, 7], + [891, 7], c, - [388, 23], + [370, 23], c, - [357, 24], + [943, 28], c, - [762, 104], + [728, 88], c, - [291, 5], + [278, 5], c, - [1196, 55], + [1177, 52], 1 ]), goto: u([ @@ -1732,22 +1715,21 @@ table: bt({ 17, c, [10, 9], - 33, - 25, - 31, - 27, 32, - 38, - 22, + 24, + 30, 26, - 28, + 31, + 21, + 25, + 27, + 35, 36, + 39, 37, - 40, 38, - 39, - 42, - 44, + 41, + 43, s, [12, 9], s, @@ -1758,64 +1740,77 @@ table: bt({ [29, 3], s, [23, 14], - 47, + 46, s, - [23, 10], + [23, 9], s, - [24, 25], - 50, + [24, 24], + 49, s, - [25, 25], - 52, + [25, 24], 51, - 54, + 50, + 53, s, [33, 4], - 59, + 58, 33, 33, - 55, + 54, s, - [33, 8], + [33, 7], 7, s, [9, 9], + 36, + 59, s, - [36, 10], - 60, - 61, - 33, - 25, + [36, 8], + 32, + 24, + 42, + c, + [157, 3], + 42, + 21, + s, + [42, 6], + c, + [164, 7], + 42, + 42, + 32, + 24, 43, c, - [164, 3], + [23, 3], s, [43, 8], c, - [170, 7], + [23, 7], 43, 43, s, [45, 3], - 64, 63, + 62, 45, 45, - 65, + 64, s, [45, 14], - 67, + 66, s, [45, 4], - 33, - 25, + 32, + 24, 38, c, - [214, 12], + [230, 11], c, - [15, 17], + [14, 16], c, - [14, 3], + [13, 3], c, [12, 19], s, @@ -1834,8 +1829,8 @@ table: bt({ [60, 27], s, [61, 29], - 36, - 75, + 35, + 74, s, [69, 27], s, @@ -1844,83 +1839,78 @@ table: bt({ [67, 27], s, [10, 6], - 77, + 76, s, [10, 3], s, [15, 10], s, [11, 6], - 78, + 77, s, [11, 3], s, [17, 10], - 80, 79, + 78, 27, 27, - 81, + 80, s, - [26, 25], - 82, - 50, + [26, 24], + 81, + 49, 73, - 84, + 83, 74, 74, s, - [79, 26], + [79, 25], s, - [80, 26], + [80, 25], 1, 2, 84, 84, - 88, - 90, - c, - [577, 7], + 87, 89, + c, + [592, 7], + 88, s, - [33, 8], + [33, 7], s, - [20, 17], + [20, 16], c, - [735, 14], + [744, 13], + 93, 94, - 95, - 33, - 25, + 32, + 24, 40, c, - [17, 3], + [16, 3], s, [40, 8], c, [23, 7], 40, 40, - 33, - 25, - 42, - c, - [23, 3], + 41, + 41, + 59, s, - [42, 8], - c, - [782, 9], - 42, + [41, 8], s, [44, 3], - 64, 63, + 62, 44, 44, - 65, + 64, s, [44, 14], - 67, + 66, s, [44, 4], s, @@ -1933,40 +1923,38 @@ table: bt({ [54, 27], s, [68, 27], - 98, - 60, - 37, + 96, 37, - 99, - 60, + 59, + 97, s, [51, 3], - 64, 63, + 62, 51, 51, - 65, + 64, s, [51, 14], - 67, + 66, s, [51, 4], s, [52, 3], - 64, 63, + 62, 52, 52, - 65, + 64, s, [52, 14], - 67, + 66, s, [52, 4], - 100, - 36, + 98, + 35, 64, - 75, + 74, s, [65, 3], s, @@ -1976,7 +1964,7 @@ table: bt({ s, [18, 10], s, - [22, 25], + [22, 24], s, [29, 3], s, @@ -1984,68 +1972,66 @@ table: bt({ s, [71, 9], 72, - 104, + 102, + 101, 103, - 105, 77, 16, 83, 83, - 107, + 105, s, [81, 3], c, - [404, 3], + [385, 3], 5, s, - [19, 17], + [19, 16], 11, 15, 16, - 111, + 109, + 108, 110, - 112, 34, 34, - 33, - 25, + 32, + 24, 39, c, - [357, 3], + [363, 3], s, [39, 8], c, - [356, 7], + [363, 7], 39, 39, s, - [41, 11], - s, [46, 27], s, [47, 27], s, [62, 27], 63, - 80, - 113, + 79, + 111, 75, 75, 76, 76, 3, c, - [152, 3], + [140, 3], s, [82, 3], - 115, + 113, s, - [21, 17], + [21, 16], s, - [31, 14], - 116, + [31, 13], + 114, s, - [32, 14], + [32, 13], s, [29, 3], 78, @@ -2054,20 +2040,20 @@ table: bt({ 35, 28, 28, - 81 + 80 ]) }), defaultActions: bda({ idx: u([ 18, + 52, 53, - 54, - 83, - 90, - 101, - 105, - 114, - 115 + 82, + 89, + 99, + 103, + 112, + 113 ]), pop: u([ s, @@ -3147,23 +3133,23 @@ case 17 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 175; + return 174; break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 180; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 179; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 180; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 179; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 178; + this.popState(); return 177; break; case 24 : /*! Conditions:: options */ @@ -3220,7 +3206,7 @@ case 32 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 182; + return 181; break; case 33 : @@ -3254,7 +3240,7 @@ case 38 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 175; + return 174; break; case 39 : @@ -3270,17 +3256,17 @@ break; case 41 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 174; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 173; break; case 42 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 174; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 173; break; case 43 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ - this.pushState('set'); return 167; + this.pushState('set'); return 166; break; case 56 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3290,7 +3276,7 @@ break; case 57 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ - return 160; // treated as `(?!atom)` + return 159; // treated as `(?!atom)` break; case 58 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3300,12 +3286,12 @@ break; case 60 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 172; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 171; break; case 63 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 176; + this.begin('options'); return 175; break; case 64 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3320,7 +3306,7 @@ break; case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 182; + this.pushState('path'); return 181; break; case 67 : /*! Conditions:: INITIAL rules trail code */ @@ -3344,12 +3330,12 @@ break; case 78 : /*! Conditions:: set */ /*! Rule:: \] */ - this.popState('set'); return 169; + this.popState('set'); return 168; break; case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 185; // the bit of CODE just before EOF... + return 184; // the bit of CODE just before EOF... break; case 81 : /*! Conditions:: path */ @@ -3359,12 +3345,12 @@ break; case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 183; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 182; break; case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 183; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 182; break; case 84 : /*! Conditions:: path */ @@ -3374,7 +3360,7 @@ break; case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 183; + this.popState(); return 182; break; case 86 : /*! Conditions:: * */ @@ -3428,7 +3414,7 @@ simpleCaseActionClusters: { 19 : 61, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 180, + 22 : 179, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ 25 : 144, @@ -3437,13 +3423,13 @@ simpleCaseActionClusters: { 44 : 124, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ - 45 : 159, + 45 : 158, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ - 46 : 159, + 46 : 158, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ - 47 : 159, + 47 : 158, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ 48 : 40, @@ -3470,7 +3456,7 @@ simpleCaseActionClusters: { 55 : 36, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 172, + 59 : 171, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ 61 : 36, @@ -3479,13 +3465,13 @@ simpleCaseActionClusters: { 62 : 46, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 173, + 69 : 172, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 166, + 70 : 165, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 166, + 71 : 165, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ 72 : 123, @@ -3497,13 +3483,13 @@ simpleCaseActionClusters: { 75 : 1, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 76 : 171, + 76 : 170, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 171, + 77 : 170, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 185 + 79 : 184 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, From ed2233dd96104d2ed674d0f18c4d6c0b9b2515af Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 8 Jul 2016 01:29:14 +0200 Subject: [PATCH 168/417] fix GerHobbelt/jison#1: fix grammar errors which caused a whole slew of conflicts which I didn't spot -- must be blind! --- lex.y | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lex.y b/lex.y index a851b65..c3499dd 100644 --- a/lex.y +++ b/lex.y @@ -111,8 +111,12 @@ definition { $$ = $names_inclusive; } | START_EXC names_exclusive { $$ = $names_exclusive; } - | action - { yy.actionInclude.push($action); $$ = null; } + | '{' action_body '}' + { yy.actionInclude.push($action_body); $$ = null; } + | ACTION + { yy.actionInclude.push($ACTION); $$ = null; } + | include_macro_code + { yy.actionInclude.push($include_macro_code); $$ = null; } | options { $$ = null; } | UNKNOWN_DECL @@ -254,14 +258,10 @@ regex_list ; nonempty_regex_list - : nonempty_regex_list '|' regex_concat + : regex_concat '|' regex_list { $$ = $1 + '|' + $3; } - | nonempty_regex_list '|' - { $$ = $1 + '|'; } - | '|' nonempty_regex_list + | '|' regex_list { $$ = '|' + $2; } - | '|' - { $$ = '|'; } | regex_concat ; From 2b2a5d7dfab952cde3f17d3c0e33e7196234b2d5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 8 Jul 2016 01:29:35 +0200 Subject: [PATCH 169/417] fix GerHobbelt/jison#1: fix grammar errors which caused a whole slew of conflicts which I didn't spot -- regenerated parser --- lex-parser.js | 1041 ++++++++++++++++++++++++------------------------- 1 file changed, 504 insertions(+), 537 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index f22fb7c..458eca5 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -406,7 +406,7 @@ symbols_: { "=": 61, ">": 62, "?": 63, - "ACTION": 150, + "ACTION": 142, "ACTION_BODY": 152, "CHARACTER_LIT": 174, "CODE": 184, @@ -424,14 +424,14 @@ symbols_: { "REGEX_SET_END": 168, "REGEX_SET_START": 166, "SPECIAL_GROUP": 158, - "START_COND": 144, + "START_COND": 146, "START_EXC": 139, "START_INC": 137, "STRING_LIT": 173, - "UNKNOWN_DECL": 143, + "UNKNOWN_DECL": 145, "^": 94, - "action": 141, - "action_body": 147, + "action": 149, + "action_body": 141, "action_comments_body": 151, "any_group_regex": 162, "definition": 134, @@ -439,7 +439,7 @@ symbols_: { "error": 2, "escape_char": 164, "extra_lexer_module_code": 132, - "include_macro_code": 149, + "include_macro_code": 143, "init": 128, "lex": 127, "module_code_chunk": 183, @@ -451,7 +451,7 @@ symbols_: { "option": 178, "option_list": 176, "optional_module_code_chunk": 180, - "options": 142, + "options": 144, "range_regex": 161, "regex": 136, "regex_base": 157, @@ -459,12 +459,12 @@ symbols_: { "regex_list": 155, "regex_set": 167, "regex_set_atom": 169, - "rule": 145, + "rule": 147, "rules": 133, "rules_and_epilogue": 131, - "start_conditions": 146, + "start_conditions": 148, "string": 163, - "unbracketed_action_body": 148, + "unbracketed_action_body": 150, "{": 123, "|": 124, "}": 125 @@ -492,9 +492,9 @@ terminals_: { 135: "NAME", 137: "START_INC", 139: "START_EXC", - 143: "UNKNOWN_DECL", - 144: "START_COND", - 150: "ACTION", + 142: "ACTION", + 145: "UNKNOWN_DECL", + 146: "START_COND", 152: "ACTION_BODY", 158: "SPECIAL_GROUP", 159: "/!", @@ -522,31 +522,31 @@ productions_: bp({ 129, 129, s, - [134, 6], + [134, 8], 138, 138, 140, 140, 133, 133, - 145, - s, - [141, 3], - 148, - 148, - 147, 147, + s, + [149, 3], + 150, + 150, + 141, + 141, 151, 151, s, - [146, 3], + [148, 3], 153, 153, 136, 155, 155, s, - [154, 5], + [154, 3], 156, 156, s, @@ -561,15 +561,15 @@ productions_: bp({ 161, 163, 163, - 142, + 144, 176, 176, s, [178, 3], 132, 132, - 149, - 149, + 143, + 143, 183, 183, 180, @@ -586,16 +586,19 @@ productions_: bp({ 0, s, [2, 3], + 3, s, - [1, 4], + [1, 5], + 2, + 1, + 2, 2, 1, - c, - [8, 3], - 3, 3, c, - [10, 5], + [12, 4], + 2, + 1, 5, 0, 2, @@ -608,24 +611,25 @@ productions_: bp({ 0, 3, c, - [30, 4], + [24, 3], c, - [25, 4], + [23, 3], s, [2, 5], c, [10, 3], s, [1, 6], - 3, c, - [9, 12], + [21, 3], c, - [54, 3], + [9, 10], c, - [39, 4], - 2, - 1, + [52, 3], + c, + [31, 3], + c, + [28, 3], 0 ]) }), @@ -725,11 +729,11 @@ case 10: /*! Production:: definition : START_INC names_inclusive */ case 11: /*! Production:: definition : START_EXC names_exclusive */ -case 23: +case 25: /*! Production:: action : unbracketed_action_body */ -case 24: +case 26: /*! Production:: action : include_macro_code */ -case 27: +case 29: /*! Production:: action_body : action_comments_body */ case 67: /*! Production:: escape_char : ESCAPE_CHAR */ @@ -745,84 +749,91 @@ case 83: break; case 12: - /*! Production:: definition : action */ - yy.actionInclude.push($$[$0]); this.$ = null; + /*! Production:: definition : '{' action_body '}' */ + yy.actionInclude.push($$[$0 - 1]); this.$ = null; break; case 13: + /*! Production:: definition : ACTION */ +case 14: + /*! Production:: definition : include_macro_code */ + yy.actionInclude.push($$[$0]); this.$ = null; + break; + +case 15: /*! Production:: definition : options */ this.$ = null; break; -case 14: +case 16: /*! Production:: definition : UNKNOWN_DECL */ this.$ = {type: 'unknown', body: $$[$0]}; break; -case 15: +case 17: /*! Production:: names_inclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; break; -case 16: +case 18: /*! Production:: names_inclusive : names_inclusive START_COND */ this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; break; -case 17: +case 19: /*! Production:: names_exclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; break; -case 18: +case 20: /*! Production:: names_exclusive : names_exclusive START_COND */ this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; break; -case 19: +case 21: /*! Production:: rules : rules rule */ this.$ = $$[$0 - 1]; this.$.push($$[$0]); break; -case 20: +case 22: /*! Production:: rules : rule */ -case 34: +case 36: /*! Production:: name_list : NAME */ this.$ = [$$[$0]]; break; -case 21: +case 23: /*! Production:: rule : start_conditions regex action */ this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; break; -case 22: +case 24: /*! Production:: action : '{' action_body '}' */ -case 31: +case 33: /*! Production:: start_conditions : '<' name_list '>' */ this.$ = $$[$0 - 1]; break; -case 26: +case 28: /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ this.$ = $$[$0 - 1] + '\n' + $$[$0]; break; -case 28: +case 30: /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; break; -case 29: +case 31: /*! Production:: action_comments_body : ε */ -case 38: +case 40: /*! Production:: regex_list : ε */ case 84: /*! Production:: optional_module_code_chunk : ε */ this.$ = ''; break; -case 30: +case 32: /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ case 44: /*! Production:: regex_concat : regex_concat regex_base */ @@ -835,17 +846,17 @@ case 82: this.$ = $$[$0 - 1] + $$[$0]; break; -case 32: +case 34: /*! Production:: start_conditions : '<' '*' '>' */ this.$ = ['*']; break; -case 35: +case 37: /*! Production:: name_list : name_list ',' NAME */ this.$ = $$[$0 - 2]; this.$.push($$[$0]); break; -case 36: +case 38: /*! Production:: regex : nonempty_regex_list[re] */ // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' @@ -901,24 +912,14 @@ case 36: } break; -case 39: - /*! Production:: nonempty_regex_list : nonempty_regex_list '|' regex_concat */ - this.$ = $$[$0 - 2] + '|' + $$[$0]; - break; - -case 40: - /*! Production:: nonempty_regex_list : nonempty_regex_list '|' */ - this.$ = $$[$0 - 1] + '|'; - break; - case 41: - /*! Production:: nonempty_regex_list : '|' nonempty_regex_list */ - this.$ = '|' + $$[$0]; + /*! Production:: nonempty_regex_list : regex_concat '|' regex_list */ + this.$ = $$[$0 - 2] + '|' + $$[$0]; break; case 42: - /*! Production:: nonempty_regex_list : '|' */ - this.$ = '|'; + /*! Production:: nonempty_regex_list : '|' regex_list */ + this.$ = '|' + $$[$0]; break; case 46: @@ -1027,26 +1028,23 @@ table: bt({ len: u([ 11, 1, - 15, + 13, 1, - 15, + 13, 21, 2, 2, - s, - [9, 3], 5, - 24, - 24, - 3, - 24, + s, + [9, 4], 2, + 3, 20, 1, 9, - 10, - 30, + 9, 28, + 31, 28, 22, 22, @@ -1062,12 +1060,11 @@ table: bt({ [10, 4], 2, 3, - 24, + 25, + 25, 1, 4, 3, - 25, - 25, 1, 1, 6, @@ -1075,13 +1072,13 @@ table: bt({ 16, 21, 3, - 29, - 11, + 31, 28, + 10, + 10, s, [27, 5], 1, - 2, 1, 28, 28, @@ -1091,12 +1088,13 @@ table: bt({ 3, 10, 10, - 24, + 9, 5, 3, 9, - c, - [15, 3], + 1, + 2, + 1, s, [3, 3], 6, @@ -1107,7 +1105,7 @@ table: bt({ 1, 2, c, - [34, 4], + [33, 4], 1, s, [2, 3], @@ -1115,14 +1113,20 @@ table: bt({ [31, 3], 1, 16, - 13, - 1, - 13, + 5, + 17, + 16, + 17, + c, + [107, 3], 4, 1, 1, 2, - 3 + 17, + 2, + 3, + 16 ]), symbol: u([ 123, @@ -1132,8 +1136,8 @@ table: bt({ 135, 137, 139, - 143, - 150, + 142, + 145, 175, 181, 1, @@ -1141,17 +1145,15 @@ table: bt({ 129, 130, 134, - s, - [135, 4, 2], - 142, + c, + [12, 4], 143, - 148, - 149, + 144, c, - [16, 3], + [14, 3], 130, c, - [16, 15], + [14, 13], 36, 40, 46, @@ -1168,89 +1170,78 @@ table: bt({ 173, 174, 138, - 144, + 146, 140, - 144, + 146, 123, - c, - [66, 8], - c, - [9, 19], 125, - 147, + 141, 151, 152, - 1, - c, - [58, 4], - 60, - 94, 123, - 124, - c, - [22, 6], - 158, - 159, c, - [58, 5], + [67, 8], c, - [113, 3], - c, - [24, 23], + [9, 27], + 2, + 182, 135, 176, 178, + 1, c, - [27, 24], - 2, - 182, - c, - [26, 7], + [72, 4], + 60, + 94, 124, 130, 131, 133, - 145, - 146, + 147, + 148, + 158, + 159, c, - [24, 7], + [70, 5], 130, c, - [112, 10], - c, - [49, 7], - c, - [174, 4], + [44, 18], + 36, + 40, 41, c, - [175, 3], + [111, 3], + 123, + 124, c, - [16, 8], + [16, 6], c, - [181, 14], + [115, 12], c, - [30, 16], + [28, 16], + s, + [154, 7, 1], c, - [28, 17], + [31, 13], 42, 43, 46, 47, 63, c, - [126, 11], + [34, 9], + 158, + 159, 161, c, [27, 3], s, [172, 4, 1], c, - [56, 7], + [59, 7], 124, - s, - [154, 7, 1], c, - [52, 8], + [52, 15], c, [22, 24], c, @@ -1275,17 +1266,23 @@ table: bt({ c, [115, 81], c, - [487, 6], - 144, - c, - [609, 9], + [478, 7], + 146, c, - [10, 25], + [10, 33], 125, 123, 125, + 152, + c, + [553, 7], c, - [630, 25], + [70, 13], + c, + [69, 4], + 184, + c, + [25, 25], 177, 135, 176, @@ -1294,54 +1291,45 @@ table: bt({ 61, 135, 177, - c, - [32, 24], - 184, - c, - [25, 26], - 1, - 1, + s, + [1, 3], 132, 180, 181, 183, c, - [33, 8], + [41, 8], 124, 130, c, - [641, 9], + [617, 9], c, [18, 9], c, [16, 7], c, - [811, 21], + [724, 21], 42, 135, 153, c, - [631, 14], - c, - [660, 15], + [610, 59], 41, c, - [701, 13], + [707, 9], c, - [643, 28], + [10, 10], c, - [511, 132], + [498, 135], 41, 41, - 124, - 41, c, - [167, 47], + [795, 31], c, - [28, 9], + [28, 25], 168, c, - [543, 3], + [528, 3], 168, 169, 170, @@ -1350,35 +1338,35 @@ table: bt({ c, [3, 4], c, - [449, 20], + [444, 27], c, - [387, 24], + [443, 4], c, - [1103, 5], - c, - [476, 3], + [1037, 4], + 125, c, - [1008, 9], + [1040, 10], 177, 135, 179, 1, 1, - 149, + 143, 181, 1, c, - [413, 3], + [440, 3], c, [3, 3], c, - [414, 6], + [408, 6], c, - [397, 16], + [391, 16], 123, - 141, - c, - [1215, 3], + 142, + 143, + 149, + 150, 181, 44, 62, @@ -1386,22 +1374,31 @@ table: bt({ 44, 62, c, - [1015, 47], - c, - [290, 62], + [309, 91], 168, 123, 125, 135, 177, c, - [616, 3], + [542, 4], + c, + [133, 6], + c, + [142, 3], + c, + [136, 17], c, - [151, 7], + [189, 4], c, - [576, 4], + [21, 9], + 142, + c, + [565, 23], c, - [551, 21], + [33, 17], + c, + [582, 6], c, [13, 7], 135, @@ -1410,12 +1407,18 @@ table: bt({ 123, 125, c, - [1336, 3], + [81, 3], 1, + 123, + 125, + c, + [52, 17], 44, 62, c, - [237, 3] + [739, 10], + c, + [90, 9] ]), type: u([ 2, @@ -1428,178 +1431,170 @@ table: bt({ 0, 2, c, - [13, 4], + [13, 5], c, - [18, 3], + [19, 7], c, - [21, 7], + [14, 14], c, - [16, 16], + [11, 6], c, - [20, 5], - s, - [0, 3], + [13, 4], c, - [6, 8], + [6, 6], c, - [35, 9], - s, - [2, 27], + [33, 9], c, - [59, 11], + [32, 11], s, - [2, 41], - c, - [52, 37], + [2, 31], c, - [131, 9], + [74, 17], c, - [82, 38], + [55, 39], c, - [181, 12], - c, - [30, 17], + [47, 27], c, - [78, 32], + [146, 15], c, - [27, 16], + [64, 24], c, - [261, 15], + [52, 35], c, - [22, 27], + [22, 20], c, [17, 34], s, [2, 213], c, - [563, 13], + [472, 3], c, - [157, 147], + [227, 180], c, - [59, 57], + [688, 7], c, - [60, 13], + [616, 5], c, - [228, 31], + [436, 12], c, - [528, 17], + [204, 30], c, - [47, 15], + [504, 17], c, - [660, 29], + [47, 15], c, - [643, 32], + [610, 52], c, - [348, 153], + [307, 171], c, [28, 36], c, - [326, 4], + [335, 4], c, - [209, 54], + [227, 39], c, - [302, 20], + [294, 20], c, [19, 9], c, - [414, 14], + [408, 14], c, - [1021, 14], + [355, 13], c, - [1015, 52], + [243, 107], c, - [276, 72], + [204, 26], c, - [237, 53], + [135, 82], c, - [51, 9] + [81, 44] ]), state: u([ s, [1, 4, 1], - 8, - 9, - 12, - 13, - 18, + 10, + 11, + 16, c, - [6, 5], + [4, 3], + 17, + 18, 19, - 20, - 22, - 23, - 28, - 29, - 33, - 34, - 40, + 21, + 26, + 27, + 31, + 32, + 38, + 40, 42, - 44, - 45, + 43, + 46, 47, - 48, + 49, 52, - 55, - 56, + 53, + 54, 57, - 60, c, - [17, 6], - 61, + [15, 4], + 59, + 58, c, - [5, 4], + [23, 6], + 63, + 59, 65, - 68, - 67, c, - [14, 6], - 68, - 69, + [9, 6], + 59, + 66, c, [8, 6], - 70, + 67, c, [5, 4], - 71, + 68, c, [5, 4], - 75, 72, - 73, + 69, + 70, + 79, + 47, + 81, 82, - 48, - 84, - 85, - 86, - 90, - 57, - 91, + 83, + 87, + 54, + 88, c, - [67, 7], + [68, 7], + 89, + 59, 92, - 95, c, - [7, 5], - s, - [65, 3], - 75, - 99, - 73, - 100, - 45, + [54, 7], + 63, + 63, + 72, + 96, + 70, + 97, + 43, + 101, + 103, + 82, + 83, + 107, 104, 106, - 85, - 86, - 107, - 12, - 13, - c, - [72, 5], - 112, - 85, - 86, - 115 + 113, + 82, + 83, + 115, + 43, + 118 ]), mode: u([ s, @@ -1613,200 +1608,179 @@ table: bt({ s, [1, 13], s, - [2, 44], + [2, 39], c, - [45, 34], - c, - [34, 25], - c, - [106, 7], + [43, 8], c, [5, 3], c, - [35, 19], - c, - [19, 9], - c, - [166, 6], + [51, 27], c, - [16, 8], + [102, 6], c, - [162, 9], + [34, 8], c, - [23, 7], + [98, 9], c, - [75, 10], + [23, 23], c, - [185, 9], + [49, 6], c, - [30, 5], + [80, 16], c, - [77, 19], + [103, 6], c, - [239, 16], + [175, 15], c, - [253, 23], + [189, 23], c, - [266, 57], + [202, 52], s, - [2, 174], + [2, 179], c, - [220, 89], + [220, 90], c, - [88, 20], + [89, 20], c, - [20, 14], + [20, 13], c, [417, 19], c, - [29, 13], - c, - [154, 57], + [178, 39], c, - [592, 28], + [494, 9], c, - [551, 12], + [567, 31], c, - [516, 14], + [456, 18], c, - [580, 19], + [556, 47], c, - [64, 12], + [441, 160], c, - [591, 24], + [184, 27], c, - [456, 136], + [767, 28], c, - [246, 6], + [111, 53], c, - [166, 27], + [56, 5], c, - [784, 28], + [303, 7], c, - [584, 68], + [362, 23], c, - [71, 5], + [683, 103], c, - [891, 7], + [250, 5], c, - [370, 23], + [635, 48], c, - [943, 28], + [689, 53], c, - [728, 88], + [211, 23], c, - [278, 5], - c, - [1177, 52], - 1 + [22, 17] ]), goto: u([ s, [6, 9], - 11, + 8, 8, 5, 6, 7, - 10, - 15, + 9, + 12, 14, - 16, - 17, + 13, + 15, c, [10, 9], - 32, - 24, 30, - 26, - 31, - 21, + 22, + 28, + 24, + 29, + 20, + 23, 25, - 27, + 33, + 34, + 37, 35, 36, 39, - 37, - 38, 41, - 43, s, - [12, 9], + [31, 3], s, [13, 9], s, [14, 9], s, - [29, 3], + [15, 9], s, - [23, 14], - 46, - s, - [23, 9], - s, - [24, 24], - 49, - s, - [25, 24], - 51, + [16, 9], + 45, + 44, + 48, 50, - 53, s, - [33, 4], - 58, - 33, - 33, - 54, + [35, 4], + 55, + 35, + 35, + 51, s, - [33, 7], + [35, 7], 7, s, [9, 9], - 36, - 59, s, - [36, 8], - 32, - 24, - 42, + [38, 9], + 30, + 22, + 43, c, - [157, 3], - 42, - 21, + [93, 3], + 43, + 56, s, - [42, 6], + [43, 6], c, - [164, 7], - 42, - 42, - 32, - 24, + [100, 7], 43, + 43, + 30, + 22, + 40, c, [23, 3], + 40, + 20, s, - [43, 8], + [40, 6], c, [23, 7], - 43, - 43, + 40, + 40, s, [45, 3], - 63, - 62, + 61, + 60, 45, 45, - 64, + 62, s, [45, 14], - 66, + 64, s, [45, 4], - 32, - 24, - 38, c, - [230, 11], + [50, 6], + c, + [166, 8], c, [14, 16], c, @@ -1829,8 +1803,8 @@ table: bt({ [60, 27], s, [61, 29], - 35, - 74, + 33, + 71, s, [69, 27], s, @@ -1838,82 +1812,69 @@ table: bt({ s, [67, 27], s, - [10, 6], - 76, + [10, 7], + 73, + 10, + 10, s, - [10, 3], + [17, 10], s, - [15, 10], + [11, 7], + 74, + 11, + 11, s, - [11, 6], + [19, 10], + 76, + 75, + 29, + 29, 77, s, - [11, 3], + [79, 25], s, - [17, 10], - 79, + [80, 25], 78, - 27, - 27, - 80, - s, - [26, 24], - 81, - 49, + 48, 73, - 83, + 80, 74, 74, - s, - [79, 25], - s, - [80, 25], 1, 2, - 84, - 84, - 87, - 89, + s, + [84, 3], + 86, c, - [592, 7], - 88, + [567, 7], + 85, s, - [33, 7], + [35, 7], s, - [20, 16], + [22, 16], c, - [744, 13], - 93, - 94, - 32, - 24, - 40, - c, - [16, 3], - s, - [40, 8], + [656, 13], + 90, + 91, c, - [23, 7], - 40, - 40, - 41, - 41, - 59, - s, - [41, 8], + [556, 23], s, [44, 3], - 63, - 62, + 61, + 60, 44, 44, - 64, + 62, s, [44, 14], - 66, + 64, s, [44, 4], s, + [42, 10], + s, + [39, 10], + s, [48, 27], s, [49, 27], @@ -1923,89 +1884,78 @@ table: bt({ [54, 27], s, [68, 27], - 96, - 37, - 59, - 97, + 93, + 94, s, [51, 3], - 63, - 62, + 61, + 60, 51, 51, - 64, + 62, s, [51, 14], - 66, + 64, s, [51, 4], s, [52, 3], - 63, - 62, + 61, + 60, 52, 52, - 64, + 62, s, [52, 14], - 66, + 64, s, [52, 4], - 98, - 35, + 95, + 33, 64, - 74, + 71, s, [65, 3], s, [66, 3], s, - [16, 10], - s, [18, 10], s, - [22, 24], + [20, 10], + s, + [12, 9], s, - [29, 3], + [31, 3], s, - [30, 3], + [32, 3], s, [71, 9], 72, - 102, - 101, - 103, + 99, + 98, + 100, 77, - 16, + 13, 83, 83, - 105, + 102, s, [81, 3], - c, - [385, 3], + s, + [84, 3], 5, s, - [19, 16], - 11, - 15, - 16, - 109, + [21, 16], + 105, 108, + 13, 110, - 34, - 34, - 32, - 24, - 39, - c, - [363, 3], + 109, + 111, + 36, + 36, s, - [39, 8], - c, - [363, 7], - 39, - 39, + [41, 10], s, [46, 27], s, @@ -2013,47 +1963,64 @@ table: bt({ s, [62, 27], 63, - 79, - 111, + 76, + 112, 75, 75, 76, 76, 3, - c, - [140, 3], + s, + [84, 3], s, [82, 3], - 113, + 114, s, - [21, 16], + [23, 16], s, - [31, 13], - 114, + [31, 3], + s, + [25, 9], + 116, + s, + [25, 7], s, - [32, 13], + [26, 16], s, - [29, 3], + [27, 17], + s, + [33, 13], + 117, + s, + [34, 13], + s, + [31, 3], 78, 4, - 35, - 35, - 28, - 28, - 80 + 76, + 119, + s, + [28, 17], + 37, + 37, + 30, + 30, + 77, + s, + [24, 16] ]) }), defaultActions: bda({ idx: u([ - 18, - 52, - 53, - 82, - 89, - 99, - 103, - 112, - 113 + 16, + 49, + 50, + 79, + 86, + 96, + 100, + 113, + 114 ]), pop: u([ s, @@ -3179,12 +3146,12 @@ break; case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 150; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; break; case 31 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 150; + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; break; case 32 : /*! Conditions:: indented */ @@ -3212,7 +3179,7 @@ break; case 33 : /*! Conditions:: indented */ /*! Rule:: .* */ - this.popState(); return 150; + this.popState(); return 142; break; case 34 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3314,7 +3281,7 @@ case 67 : /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - return 143; + return 145; break; case 68 : @@ -3417,7 +3384,7 @@ simpleCaseActionClusters: { 22 : 179, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 25 : 144, + 25 : 146, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \| */ 44 : 124, From fa16fa7a6fb52199b9273a82d38ddd5f2b4d33df Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 17 Jul 2016 22:59:57 +0200 Subject: [PATCH 170/417] The grammar keyword is `%options`, not `%option`! Comments corrected accordingly. --- tests/all-tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/all-tests.js b/tests/all-tests.js index 53c120e..e9ec54b 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -437,7 +437,7 @@ exports["test options with values"] = function () { bool1: true, s1: "s1value", s2: "s2value", - "a-b-c": "d" // %option camel-casing is done very late in the game: see Jison.Generator source code. + "a-b-c": "d" // `%options camel-casing` is done very late in the game: see Jison.Generator source code. } }; From 9a02b680b2ac9b9c8c5fda0ac5384b960efb8e9d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 21 Jul 2016 03:17:47 +0200 Subject: [PATCH 171/417] bump version number & rebuild --- lex-parser.js | 1660 +++++++++++++++++++++++++------------------------ package.json | 2 +- 2 files changed, 834 insertions(+), 828 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 458eca5..f738b20 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -14,7 +14,7 @@ * EOF: 1, * TERROR: 2, * - * trace: function(errorMessage, errorHash), + * trace: function(errorMessage, ...), * * JisonParserError: function(msg, hash), * @@ -22,6 +22,12 @@ * Helper function which can be overridden by user code later on: put suitable * quotes around literal IDs in a description string. * + * originalQuoteName: function(name), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * References the original quoteName handler as it was just before the invocation of `parse()`; + * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function + * at the end of the `parse()`. + * * describeSymbol: function(symbol), * Return a more-or-less human-readable description of the given symbol, when * available, or the symbol itself, serving as its own 'description' for lack @@ -35,7 +41,7 @@ * terminal_descriptions_: (if there are any) {associative list: number ==> description}, * productions_: [...], * - * performAction: function parser__performAction(yytext, yyleng, yylineno, yy, yystate, $$, _$, yystack, ...), + * performAction: function parser__performAction(yytext, yyleng, yylineno, yy, yystate, $0, $$, _$, yystack, yysstack, ...), * where `...` denotes the (optional) additional arguments the user passed to * `parser.parse(str, ...)` * @@ -59,9 +65,35 @@ * yyErrOk: function(), * yyClearIn: function(), * + * constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this parser kernel in many places; example usage: + * + * var infoObj = parser.constructParseErrorInfo('fail!', null, + * parser.collect_expected_token_set(state), true); + * var retVal = parser.parseError(infoObj.errStr, infoObj); + * + * originalParseError: function(str, hash), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * References the original parseError handler as it was just before the invocation of `parse()`; + * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function + * at the end of the `parse()`. + * * options: { ... parser %options ... }, * - * parse: function(input), + * parse: function(input[, args...]), + * Parse the given `input` and return the parsed value (or `true` when none was provided by + * the root action, in which case the parser is acting as a *matcher*). + * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: + * these extra `args...` are passed verbatim to the grammar rules' action code. + * + * cleanupAfterParse: function(resultValue, invoke_post_methods), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown + * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY + * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and + * the internal parser gets properly garbage collected under these particular circumstances. * * lexer: { * yy: {...}, A reference to the so-called "shared state" `yy` once @@ -124,7 +156,14 @@ * * { * expected: (array describing the set of expected tokens; - * may be empty when we cannot easily produce such a set) + * may be UNDEFINED when we cannot easily produce such a set) + * state: (integer (or array when the table includes grammar collisions); + * represents the current internal state of the parser kernel. + * can, for example, be used to pass to the `collect_expected_token_set()` + * API to obtain the expected token set) + * action: (integer; represents the current internal action which will be executed) + * new_state: (integer; represents the next/planned internal state, once the current + * action has executed) * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule * available for this particular error) * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, @@ -291,21 +330,7 @@ function bp(s) { return rv; } -// helper: reconstruct the defaultActions[] table -function bda(s) { - var rv = {}; - var d = s.idx; - var p = s.pop; - var r = s.rule; - for (var i = 0, l = d.length; i < l; i++) { - var j = d[i]; - rv[j] = [ - p[i], - r[i] - ]; - } - return rv; -} + // helper: reconstruct the 'goto' table function bt(s) { @@ -381,8 +406,6 @@ function u(a) { } var parser = { -EOF: 1, -TERROR: 2, trace: function no_op_trace() { }, JisonParserError: JisonParserError, yy: {}, @@ -393,7 +416,7 @@ symbols_: { "$": 36, "$accept": 0, "$end": 1, - "%%": 130, + "%%": 6, "(": 40, ")": 41, "*": 42, @@ -401,70 +424,70 @@ symbols_: { ",": 44, ".": 46, "/": 47, - "/!": 159, + "/!": 35, "<": 60, "=": 61, ">": 62, "?": 63, - "ACTION": 142, - "ACTION_BODY": 152, - "CHARACTER_LIT": 174, - "CODE": 184, + "ACTION": 18, + "ACTION_BODY": 28, + "CHARACTER_LIT": 58, + "CODE": 72, "EOF": 1, - "ESCAPE_CHAR": 171, - "INCLUDE": 181, - "NAME": 135, - "NAME_BRACE": 165, - "OPTIONS": 175, - "OPTIONS_END": 177, - "OPTION_VALUE": 179, - "PATH": 182, - "RANGE_REGEX": 172, - "REGEX_SET": 170, - "REGEX_SET_END": 168, - "REGEX_SET_START": 166, - "SPECIAL_GROUP": 158, - "START_COND": 146, - "START_EXC": 139, - "START_INC": 137, - "STRING_LIT": 173, - "UNKNOWN_DECL": 145, + "ESCAPE_CHAR": 55, + "INCLUDE": 69, + "NAME": 11, + "NAME_BRACE": 49, + "OPTIONS": 59, + "OPTIONS_END": 65, + "OPTION_VALUE": 67, + "PATH": 70, + "RANGE_REGEX": 56, + "REGEX_SET": 54, + "REGEX_SET_END": 52, + "REGEX_SET_START": 50, + "SPECIAL_GROUP": 34, + "START_COND": 22, + "START_EXC": 15, + "START_INC": 13, + "STRING_LIT": 57, + "UNKNOWN_DECL": 21, "^": 94, - "action": 149, - "action_body": 141, - "action_comments_body": 151, - "any_group_regex": 162, - "definition": 134, - "definitions": 129, + "action": 25, + "action_body": 17, + "action_comments_body": 27, + "any_group_regex": 39, + "definition": 10, + "definitions": 5, "error": 2, - "escape_char": 164, - "extra_lexer_module_code": 132, - "include_macro_code": 143, - "init": 128, - "lex": 127, - "module_code_chunk": 183, - "name_expansion": 160, - "name_list": 153, - "names_exclusive": 140, - "names_inclusive": 138, - "nonempty_regex_list": 154, - "option": 178, - "option_list": 176, - "optional_module_code_chunk": 180, - "options": 144, - "range_regex": 161, - "regex": 136, - "regex_base": 157, - "regex_concat": 156, - "regex_list": 155, - "regex_set": 167, - "regex_set_atom": 169, - "rule": 147, - "rules": 133, - "rules_and_epilogue": 131, - "start_conditions": 148, - "string": 163, - "unbracketed_action_body": 150, + "escape_char": 48, + "extra_lexer_module_code": 8, + "include_macro_code": 19, + "init": 4, + "lex": 3, + "module_code_chunk": 71, + "name_expansion": 37, + "name_list": 29, + "names_exclusive": 16, + "names_inclusive": 14, + "nonempty_regex_list": 30, + "option": 66, + "option_list": 64, + "optional_module_code_chunk": 68, + "options": 20, + "range_regex": 38, + "regex": 12, + "regex_base": 33, + "regex_concat": 32, + "regex_list": 31, + "regex_set": 51, + "regex_set_atom": 53, + "rule": 23, + "rules": 9, + "rules_and_epilogue": 7, + "start_conditions": 24, + "string": 45, + "unbracketed_action_body": 26, "{": 123, "|": 124, "}": 125 @@ -472,6 +495,16 @@ symbols_: { terminals_: { 1: "EOF", 2: "error", + 6: "%%", + 11: "NAME", + 13: "START_INC", + 15: "START_EXC", + 18: "ACTION", + 21: "UNKNOWN_DECL", + 22: "START_COND", + 28: "ACTION_BODY", + 34: "SPECIAL_GROUP", + 35: "/!", 36: "$", 40: "(", 41: ")", @@ -480,100 +513,172 @@ terminals_: { 44: ",", 46: ".", 47: "/", + 49: "NAME_BRACE", + 50: "REGEX_SET_START", + 52: "REGEX_SET_END", + 54: "REGEX_SET", + 55: "ESCAPE_CHAR", + 56: "RANGE_REGEX", + 57: "STRING_LIT", + 58: "CHARACTER_LIT", + 59: "OPTIONS", 60: "<", 61: "=", 62: ">", 63: "?", + 65: "OPTIONS_END", + 67: "OPTION_VALUE", + 69: "INCLUDE", + 70: "PATH", + 72: "CODE", 94: "^", 123: "{", 124: "|", - 125: "}", - 130: "%%", - 135: "NAME", - 137: "START_INC", - 139: "START_EXC", - 142: "ACTION", - 145: "UNKNOWN_DECL", - 146: "START_COND", - 152: "ACTION_BODY", - 158: "SPECIAL_GROUP", - 159: "/!", - 165: "NAME_BRACE", - 166: "REGEX_SET_START", - 168: "REGEX_SET_END", - 170: "REGEX_SET", - 171: "ESCAPE_CHAR", - 172: "RANGE_REGEX", - 173: "STRING_LIT", - 174: "CHARACTER_LIT", - 175: "OPTIONS", - 177: "OPTIONS_END", - 179: "OPTION_VALUE", - 181: "INCLUDE", - 182: "PATH", - 184: "CODE" + 125: "}" +}, +TERROR: 2, +EOF: 1, + +// internals: defined here so the object *structure* doesn't get modified by parse() et al, +// thus helping JIT compilers like Chrome V8. +originalQuoteName: null, +originalParseError: null, +cleanupAfterParse: null, +constructParseErrorInfo: null, + +// APIs which will be set up depending on user action code analysis: +//yyErrOk: 0, +//yyClearIn: 0, + +// Helper APIs +// ----------- + +// Helper function which can be overridden by user code later on: put suitable quotes around +// literal IDs in a description string. +quoteName: function parser_quoteName(id_str) { + return '"' + id_str + '"'; +}, + +// Return a more-or-less human-readable description of the given symbol, when available, +// or the symbol itself, serving as its own 'description' for lack of something better to serve up. +// +// Return NULL when the symbol is unknown to the parser. +describeSymbol: function parser_describeSymbol(symbol) { + if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { + return this.terminal_descriptions_[symbol]; + } + else if (symbol === this.EOF) { + return 'end of input'; + } + else if (this.terminals_[symbol]) { + return this.quoteName(this.terminals_[symbol]); + } + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. + // + // An example of this may be where a rule's action code contains a call like this: + // + // parser.describeSymbol(#$) + // + // to obtain a human-readable description or name of the current grammar rule. This comes handy in + // error handling action code blocks, for example. + var s = this.symbols_; + for (var key in s) { + if (s[key] === symbol) { + return key; + } + } + return null; +}, + +// Produce a (more or less) human-readable list of expected tokens at the point of failure. +// +// The produced list may contain token or token set descriptions instead of the tokens +// themselves to help turning this output into something that easier to read by humans. +// +// The returned list (array) will not contain any duplicate entries. +collect_expected_token_set: function parser_collect_expected_token_set(state) { + var TERROR = this.TERROR; + var tokenset = []; + var check = {}; + // Has this (error?) state been outfitted with a custom expectations description text for human consumption? + // If so, use that one instead of the less palatable token set. + if (this.state_descriptions_ && this.state_descriptions_[p]) { + return [ + this.state_descriptions_[p] + ]; + } + for (var p in this.table[state]) { + if (p !== TERROR) { + var d = this.describeSymbol(p); + if (d && !check[d]) { + tokenset.push(d); + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + } + } + } + return tokenset; }, productions_: bp({ pop: u([ - 127, - s, - [131, 4], - 128, - 129, - 129, - s, - [134, 8], - 138, - 138, - 140, - 140, - 133, - 133, - 147, - s, - [149, 3], - 150, - 150, - 141, - 141, - 151, - 151, - s, - [148, 3], - 153, - 153, - 136, - 155, - 155, - s, - [154, 3], - 156, - 156, - s, - [157, 15], - 160, - 162, - 167, - 167, - 169, - 169, - 164, - 161, - 163, - 163, - 144, - 176, - 176, - s, - [178, 3], - 132, - 132, - 143, - 143, - 183, - 183, - 180, - 180 + 3, + s, + [7, 4], + 4, + 5, + 5, + s, + [10, 8], + 14, + 14, + 16, + 16, + 9, + 9, + 23, + s, + [25, 3], + 26, + 26, + 17, + 17, + 27, + 27, + s, + [24, 3], + 29, + 29, + 12, + 31, + 31, + s, + [30, 3], + 32, + 32, + s, + [33, 15], + 37, + 39, + 51, + 51, + 53, + 53, + 48, + 38, + 45, + 45, + 20, + 64, + 64, + s, + [66, 3], + 8, + 8, + 19, + 19, + 71, + 71, + 68, + 68 ]), rule: u([ 4, @@ -633,10 +738,9 @@ productions_: bp({ 0 ]) }), -performAction: function parser__PerformAction(yytext, yy, yystate /* action[1] */, $$ /* vstack */) { +performAction: function parser__PerformAction(yytext, yy, yystate /* action[1] */, $0, $$ /* vstack */) { /* this == yyval */ -var $0 = $$.length - 1; switch (yystate) { case 1: /*! Production:: lex : init definitions '%%' rules_and_epilogue */ @@ -1129,245 +1233,242 @@ table: bt({ 16 ]), symbol: u([ + 3, + 4, + 6, + 11, + 13, + 15, + 18, + 21, + 59, + 69, 123, - 127, - 128, - 130, - 135, - 137, - 139, - 142, - 145, - 175, - 181, 1, - 123, - 129, - 130, - 134, + 5, + 6, + 10, c, [12, 4], - 143, - 144, + 19, + 20, c, - [14, 3], - 130, + [14, 4], + 6, c, [14, 13], - 36, + 12, + 30, + s, + [32, 6, 1], + 39, 40, - 46, - 47, + s, + [45, 6, 1], + 55, + 57, + 58, 94, 124, - 136, - 154, - s, - [156, 5, 1], - s, - [162, 5, 1], - 171, - 173, - 174, - 138, - 146, - 140, - 146, + 14, + 22, + 16, + 22, + 17, + 27, + 28, 123, 125, - 141, - 151, - 152, - 123, c, - [67, 8], + [67, 9], c, [9, 27], 2, - 182, - 135, - 176, - 178, + 70, + 11, + 64, + 66, 1, + 6, + 7, + 9, + 23, + 24, + c, + [73, 3], + 40, + 46, + 47, c, - [72, 4], + [69, 5], 60, 94, 124, - 130, - 131, - 133, - 147, - 148, - 158, - 159, - c, - [70, 5], - 130, - c, - [44, 18], - 36, - 40, + 6, + c, + [53, 24], + c, + [113, 7], 41, c, - [111, 3], + [114, 9], + 59, + 69, + 94, 123, 124, c, - [16, 6], - c, - [115, 12], - c, - [28, 16], + [28, 6], s, - [154, 7, 1], - c, - [31, 13], - 42, - 43, - 46, - 47, - 63, + [30, 8, 1], c, - [34, 9], - 158, - 159, - 161, + [31, 23], c, [27, 3], + 38, s, - [172, 4, 1], + [40, 4, 1], c, - [59, 7], - 124, + [102, 5], + s, + [56, 4, 1], + 63, c, - [52, 15], + [28, 4], c, - [22, 24], + [53, 20], + 94, c, - [21, 3], + [22, 23], c, - [17, 31], + [238, 17], c, - [106, 17], + [17, 17], c, - [105, 11], + [106, 9], c, - [27, 180], - 168, + [105, 18], + c, + [27, 179], + 52, s, - [170, 6, 1], - 181, - 160, - 165, - 167, - 169, - 170, + [54, 6, 1], c, - [115, 81], + [29, 5], + 37, + 49, + 51, + 53, + 54, c, - [478, 7], - 146, + [115, 87], + 22, c, - [10, 33], - 125, + [479, 9], + c, + [10, 24], 123, 125, - 152, c, - [553, 7], + [594, 3], + 1, c, - [70, 13], + [73, 10], + c, + [554, 7], + 59, + 60, + 69, + 72, c, - [69, 4], - 184, + [70, 3], c, [25, 25], - 177, - 135, - 176, - 177, - 178, + 65, + 11, + 64, + 65, + 66, + 11, 61, - 135, - 177, + 65, s, [1, 3], - 132, - 180, - 181, - 183, - c, - [41, 8], - 124, - 130, - c, - [617, 9], + 8, + 68, + 69, + 71, + 72, + 1, + 6, c, - [18, 9], + [617, 16], + 1, + 6, c, - [16, 7], + [16, 14], c, [724, 21], + 11, + 29, 42, - 135, - 153, c, [610, 59], + c, + [28, 6], 41, c, - [707, 9], + [208, 9], c, [10, 10], c, - [498, 135], + [498, 129], 41, 41, c, - [795, 31], + [185, 34], c, - [28, 25], - 168, + [28, 22], + 52, c, [528, 3], - 168, - 169, - 170, - 165, - 168, + 52, + 53, + 54, + 49, + 52, c, [3, 4], c, - [444, 27], + [444, 26], c, - [443, 4], + [9, 3], c, - [1037, 4], - 125, + [1037, 5], c, - [1040, 10], - 177, - 135, - 179, + [1040, 12], + 65, + 11, + 67, 1, 1, - 143, - 181, + 19, + 69, 1, + 69, + 72, c, - [440, 3], - c, - [3, 3], + [3, 4], c, [408, 6], c, [391, 16], + 18, + 19, + 25, + 26, + 69, 123, - 142, - 143, - 149, - 150, - 181, 44, 62, 62, @@ -1375,59 +1476,53 @@ table: bt({ 62, c, [309, 91], - 168, + 52, 123, 125, - 135, - 177, + 11, + 65, + 11, c, - [542, 4], + [542, 3], c, [133, 6], c, [142, 3], c, - [136, 17], - c, - [189, 4], + [136, 16], c, - [21, 9], - 142, + [189, 5], + 1, + 6, + 18, c, - [565, 23], + [565, 30], c, [33, 17], c, - [582, 6], + [14, 11], c, - [13, 7], - 135, + [574, 3], c, [14, 13], - 123, - 125, c, - [81, 3], + [81, 5], 1, - 123, - 125, c, - [52, 17], + [85, 19], 44, 62, c, - [739, 10], + [107, 5], c, - [90, 9] + [21, 14] ]), type: u([ - 2, 0, 0, s, - [2, 8], + [2, 9], 1, - 2, 0, 2, c, @@ -1435,79 +1530,87 @@ table: bt({ c, [19, 7], c, - [14, 14], + [14, 13], + s, + [0, 4], c, - [11, 6], + [13, 6], c, - [13, 4], + [7, 3], c, - [6, 6], + [51, 8], c, - [33, 9], + [13, 4], c, - [32, 11], + [64, 11], s, - [2, 31], + [2, 33], c, - [74, 17], + [44, 4], c, - [55, 39], + [73, 7], c, - [47, 27], + [47, 37], c, - [146, 15], + [51, 8], c, - [64, 24], + [114, 10], c, - [52, 35], + [75, 11], c, - [22, 20], + [144, 8], c, - [17, 34], - s, - [2, 213], + [31, 21], + c, + [62, 7], c, - [472, 3], + [53, 37], c, - [227, 180], + [22, 23], c, - [688, 7], + [238, 16], + c, + [255, 18], + s, + [2, 217], c, - [616, 5], + [470, 46], c, - [436, 12], + [183, 140], c, - [204, 30], + [616, 9], c, - [504, 17], + [466, 8], c, - [47, 15], + [655, 30], c, - [610, 52], + [724, 19], c, - [307, 171], + [535, 31], c, - [28, 36], + [610, 31], c, - [335, 4], + [297, 168], c, - [227, 39], + [28, 46], c, - [294, 20], + [1000, 5], c, - [19, 9], + [993, 40], c, - [408, 14], + [83, 27], c, - [355, 13], + [408, 7], c, - [243, 107], + [392, 19], c, - [204, 26], + [253, 108], c, - [135, 82], + [204, 24], c, - [81, 44] + [134, 82], + c, + [81, 46] ]), state: u([ s, @@ -1598,95 +1701,88 @@ table: bt({ ]), mode: u([ s, - [2, 9], - 1, - 2, + [2, 10], s, [1, 9], c, [10, 10], s, - [1, 13], + [1, 14], s, [2, 39], c, - [43, 8], + [44, 16], c, - [5, 3], + [56, 28], c, - [51, 27], + [111, 12], c, - [102, 6], + [42, 4], c, - [34, 8], - c, - [98, 9], + [44, 7], c, [23, 23], c, - [49, 6], + [28, 7], c, - [80, 16], + [86, 9], c, - [103, 6], + [10, 5], c, - [175, 15], + [178, 18], c, - [189, 23], + [192, 24], c, - [202, 52], + [202, 49], s, [2, 179], c, - [220, 90], + [220, 89], c, - [89, 20], + [88, 20], c, - [20, 13], + [20, 14], c, - [417, 19], + [344, 55], c, - [178, 39], + [482, 6], c, - [494, 9], + [65, 18], c, - [567, 31], + [77, 19], c, - [456, 18], + [454, 21], c, - [556, 47], + [556, 44], c, - [441, 160], + [441, 168], c, [184, 27], c, - [767, 28], + [767, 18], c, - [111, 53], + [219, 53], c, - [56, 5], + [309, 5], c, - [303, 7], + [377, 9], c, [362, 23], c, - [683, 103], - c, - [250, 5], + [242, 103], c, - [635, 48], + [415, 26], c, - [689, 53], + [130, 61], c, - [211, 23], + [577, 21], c, - [22, 17] + [40, 38] ]), goto: u([ s, [6, 9], 8, - 8, 5, 6, 7, @@ -1694,22 +1790,23 @@ table: bt({ 12, 14, 13, + 8, 15, c, [10, 9], + 23, + 25, 30, 22, 28, 24, - 29, - 20, - 23, - 25, 33, 34, 37, 35, 36, + 29, + 20, 39, 41, s, @@ -1726,67 +1823,63 @@ table: bt({ 44, 48, 50, + 51, s, - [35, 4], + [35, 11], 55, 35, 35, - 51, - s, - [35, 7], 7, s, [9, 9], s, [38, 9], - 30, - 22, - 43, - c, - [93, 3], - 43, - 56, s, [43, 6], c, - [100, 7], + [98, 4], 43, - 43, - 30, - 22, - 40, c, - [23, 3], - 40, - 20, + [99, 7], + 43, + 43, + 29, + 43, + 56, s, [40, 6], c, + [23, 4], + 40, + c, [23, 7], 40, 40, + 29, + 40, + 20, s, - [45, 3], + [45, 11], 61, 60, - 45, - 45, - 62, s, - [45, 14], + [45, 5], 64, s, + [45, 3], + 62, + s, [45, 4], c, - [50, 6], - c, - [166, 8], + [44, 12], + 29, + 20, c, - [14, 16], + [14, 18], c, - [13, 3], + [13, 8], c, - [12, 19], + [12, 12], s, [53, 27], s, @@ -1812,24 +1905,24 @@ table: bt({ s, [67, 27], s, - [10, 7], + [10, 6], 73, - 10, - 10, + s, + [10, 3], s, [17, 10], s, - [11, 7], + [11, 6], 74, - 11, - 11, + s, + [11, 3], s, [19, 10], 76, 75, + 77, 29, 29, - 77, s, [79, 25], s, @@ -1837,38 +1930,36 @@ table: bt({ 78, 48, 73, - 80, 74, + 80, 74, 1, 2, s, [84, 3], 86, - c, - [567, 7], 85, - s, - [35, 7], + c, + [567, 14], s, [22, 16], c, [656, 13], - 90, 91, + 90, c, [556, 23], s, - [44, 3], + [44, 11], 61, 60, - 44, - 44, - 62, s, - [44, 14], + [44, 5], 64, s, + [44, 3], + 62, + s, [44, 4], s, [42, 10], @@ -1887,28 +1978,28 @@ table: bt({ 93, 94, s, - [51, 3], + [51, 11], 61, 60, - 51, - 51, - 62, s, - [51, 14], + [51, 5], 64, s, + [51, 3], + 62, + s, [51, 4], s, - [52, 3], + [52, 11], 61, 60, - 52, - 52, - 62, s, - [52, 14], + [52, 5], 64, s, + [52, 3], + 62, + s, [52, 4], 95, 33, @@ -1946,9 +2037,9 @@ table: bt({ 5, s, [21, 16], - 105, 108, 13, + 105, 110, 109, 111, @@ -1979,11 +2070,11 @@ table: bt({ [23, 16], s, [31, 3], - s, - [25, 9], + 25, + 25, 116, s, - [25, 7], + [25, 14], s, [26, 16], s, @@ -2003,41 +2094,24 @@ table: bt({ [28, 17], 37, 37, + 77, 30, 30, - 77, s, [24, 16] ]) }), -defaultActions: bda({ - idx: u([ - 16, - 49, - 50, - 79, - 86, - 96, - 100, - 113, - 114 -]), - pop: u([ - s, - [2, 9] -]), - rule: u([ - 7, - 1, - 2, - 72, - 5, - 63, - 3, - 78, - 4 -]) -}), +defaultActions: { + 16: 7, + 49: 1, + 50: 2, + 79: 72, + 86: 5, + 96: 63, + 100: 3, + 113: 78, + 114: 4 +}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); @@ -2045,45 +2119,19 @@ parseError: function parseError(str, hash) { throw new this.JisonParserError(str, hash); } }, -quoteName: function quoteName(id_str) { - return '"' + id_str + '"'; -}, -describeSymbol: function describeSymbol(symbol) { - if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { - return this.terminal_descriptions_[symbol]; - } - else if (symbol === this.EOF) { - return 'end of input'; - } - else if (this.terminals_[symbol]) { - return this.quoteName(this.terminals_[symbol]); - } - // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. - // - // An example of this may be where a rule's action code contains a call like this: - // - // parser.describeSymbol(#$) - // - // to obtain a human-readable description or name of the current grammar rule. This comes handy in - // error handling action code blocks, for example. - var s = this.symbols_; - for (var key in s) { - if (s[key] === symbol) { - return key; - } - } - return null; -}, parse: function parse(input) { var self = this, - stack = [0], // state stack: stores pairs of state (odd indexes) and token (even indexes) + stack = new Array(128), // token stack: stores token which leads to state at the same index (column storage) + sstack = new Array(128), // state stack: stores states - vstack = [null], // semantic value stack + vstack = new Array(128), // semantic value stack - table = this.table; + table = this.table, + sp = 0; // 'stack pointer': index into the stacks var recovering = 0; // (only used when the grammar contains error recovery rules) var TERROR = this.TERROR, EOF = this.EOF; + var NO_ACTION = [0, table.length /* ensures that anyone using this new state will fail dramatically! */]; var args = stack.slice.call(arguments, 1); @@ -2121,7 +2169,11 @@ parse: function parse(input) { - + vstack[sp] = null; + sstack[sp] = 0; + stack[sp] = 0; + ++sp; + if (typeof lexer.yytext === 'undefined') { lexer.yytext = ''; } @@ -2132,42 +2184,102 @@ parse: function parse(input) { // Does the shared state override the default `parseError` that already comes with this instance? + if (!this.originalParseError) { + this.originalParseError = this.parseError; + } if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; } + // Does the shared state override the default `quoteName` that already comes with this instance? + if (!this.originalQuoteName) { + this.originalQuoteName = this.quoteName; + } if (typeof sharedState.yy.quoteName === 'function') { this.quoteName = sharedState.yy.quoteName; } - function popStack(n) { + // set up the cleanup function; make it an API so that external code can re-use this one in case of + // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which + // case this parse() API method doesn't come with a `finally { ... }` block any more! + if (typeof this.cleanupAfterParse !== 'function') { + this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods) { + var rv; + + if (invoke_post_methods) { + if (sharedState.yy.post_parse) { + rv = sharedState.yy.post_parse.apply(this, [sharedState.yy, resultValue].concat(args)); + if (typeof rv !== 'undefined') resultValue = rv; + } + if (this.post_parse) { + rv = this.post_parse.apply(this, [sharedState.yy, resultValue].concat(args)); + if (typeof rv !== 'undefined') resultValue = rv; + } + } - if (!n) return; - stack.length = stack.length - 2 * n; - vstack.length = vstack.length - n; + // prevent lingering circular references from causing memory leaks: + sharedState.yy.parseError = undefined; + this.parseError = this.originalParseError; + sharedState.yy.quoteName = undefined; + this.quoteName = this.originalQuoteName; + sharedState.yy.lexer = undefined; + sharedState.yy.parser = undefined; + if (lexer.yy === sharedState.yy) { + lexer.yy = undefined; + } + // nuke the vstack[] array at least as that one will still reference obsoleted user values. + // To be safe, we nuke the other internal stack columns as well... + stack.length = 0; // fastest way to nuke an array without overly bothering the GC + sstack.length = 0; + vstack.length = 0; + return resultValue; + }; + } + + if (typeof this.constructParseErrorInfo !== 'function') { + this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { + return { + errStr: msg, + exception: ex, + text: lexer.match, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, + token_id: symbol, + line: lexer.yylineno, + loc: lexer.yylloc, + expected: expected, + recoverable: recoverable, + state: state, + action: action, + new_state: newState, + state_stack: stack, + value_stack: vstack, + + yy: sharedState.yy, + lexer: lexer + }; + }; } function lex() { - var token; - token = lexer.lex() || EOF; + var token = lexer.lex(); // if token isn't its numeric value, convert if (typeof token !== 'number') { token = self.symbols_[token] || token; } - return token; + return token || EOF; } - var symbol = null; - var preErrorSymbol = null; - var state, action, r; + var symbol = 0; + var preErrorSymbol = 0; + var state, action, r, t; var yyval = {}; var p, len, this_production; var newState; - var expected = []; var retval = false; if (this.pre_parse) { @@ -2179,242 +2291,151 @@ parse: function parse(input) { // Return the rule stack depth where the nearest error rule can be found. - // Return FALSE when no error recovery rule was found. + // Return -1 when no error recovery rule was found. function locateNearestErrorRecoveryRule(state) { - var stack_probe = stack.length - 1; + var stack_probe = sp - 1; var depth = 0; // try to recover from error for (;;) { // check for error recovery rule in this state - var action = table[state][TERROR]; - if (action && action.length && action[0]) { + var t = table[state][TERROR] || NO_ACTION; + if (t[0]) { return depth; } - if (state === 0 /* $accept rule */ || stack_probe < 2) { - return false; // No suitable error recovery rule available. + if (state === 0 /* $accept rule */ || stack_probe < 1) { + return -1; // No suitable error recovery rule available. } - stack_probe -= 2; // popStack(1): [symbol, action] - state = stack[stack_probe]; + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; ++depth; } } - - // SHA-1: c4ea524b22935710d98252a1d9e04ddb82555e56 :: shut up error reports about non-strict mode in Chrome in the demo pages: - // (NodeJS doesn't care, so this semicolon is only important for the demo web pages which run the jison *GENERATOR* in a web page...) - ; - - // Produce a (more or less) human-readable list of expected tokens at the point of failure. - // - // The produced list may contain token or token set descriptions instead of the tokens - // themselves to help turning this output into something that easier to read by humans. - // - // The returned list (array) will not contain any duplicate entries. - function collect_expected_token_set(state) { - var tokenset = []; - var check = {}; - // Has this (error?) state been outfitted with a custom expectations description text for human consumption? - // If so, use that one instead of the less palatable token set. - if (self.state_descriptions_ && self.state_descriptions_[p]) { - return [ - self.state_descriptions_[p] - ]; - } - for (var p in table[state]) { - if (p !== TERROR) { - var d = self.describeSymbol(p); - if (d && !check[d]) { - tokenset.push(d); - check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. - } - } - } - return tokenset; - } - try { + newState = sstack[sp - 1]; for (;;) { // retrieve state number from top of stack - state = stack[stack.length - 1]; + state = newState; // sstack[sp - 1]; // use default actions if available if (this.defaultActions[state]) { - action = this.defaultActions[state]; + action = 2; + newState = this.defaultActions[state]; } else { // The single `==` condition below covers both these `===` comparisons in a single // operation: - // + // // if (symbol === null || typeof symbol === 'undefined') ... - if (symbol == null) { + if (!symbol) { symbol = lex(); } // read action for current state and first input - action = table[state] && table[state][symbol]; - } + t = (table[state] && table[state][symbol]) || NO_ACTION; + newState = t[1]; + action = t[0]; - // handle parse error - if (!action || !action.length || !action[0]) { - var error_rule_depth = 0; - var errStr = null; - - if (!recovering) { + // handle parse error + if (!action) { // first see if there's any chance at hitting an error recovery rule: - error_rule_depth = locateNearestErrorRecoveryRule(state); - - // Report error - expected = collect_expected_token_set(state); - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ':\n' + lexer.showPosition() + '\n'; - } else { - errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; - } - if (expected.length) { - errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + (this.describeSymbol(symbol) || symbol); - } else { - errStr += 'Unexpected ' + (this.describeSymbol(symbol) || symbol); - } - r = this.parseError(errStr, p = { - text: lexer.match, - value: lexer.yytext, - token: this.describeSymbol(symbol) || symbol, - token_id: symbol, - line: lexer.yylineno, - loc: lexer.yylloc, - expected: expected, - recoverable: (error_rule_depth !== false), - state_stack: stack, - value_stack: vstack, - - yy: sharedState.yy, - lexer: lexer - }); - - if (!p.recoverable) { - retval = r; - break; + var error_rule_depth = locateNearestErrorRecoveryRule(state); + var errStr = null; + var errSymbolDescr = (this.describeSymbol(symbol) || symbol); + var expected = this.collect_expected_token_set(state); + + if (!recovering) { + // Report error + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ':\n' + lexer.showPosition() + '\n'; + } else { + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; + } + if (expected.length) { + errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; + } else { + errStr += 'Unexpected ' + errSymbolDescr; + } + p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0)); + r = this.parseError(p.errStr, p); + + if (!p.recoverable) { + retval = r; + break; + } } - } else if (preErrorSymbol !== EOF) { - error_rule_depth = locateNearestErrorRecoveryRule(state); - } - // just recovered from another error - if (recovering === 3) { - if (symbol === EOF || preErrorSymbol === EOF) { - retval = this.parseError(errStr || 'Parsing halted while starting to recover from another error.', { - text: lexer.match, - value: lexer.yytext, - token: this.describeSymbol(symbol) || symbol, - token_id: symbol, - line: lexer.yylineno, - loc: lexer.yylloc, - expected: expected, - recoverable: false, - state_stack: stack, - value_stack: vstack, - - yy: sharedState.yy, - lexer: lexer - }); - break; - } + // just recovered from another error + if (recovering === 3 && error_rule_depth >= 0) { + // only barf a fatal hairball when we're out of look-ahead symbols and none hit a match; + // this DOES discard look-ahead while recovering from an error when said look-ahead doesn't + // suit the error recovery rules... The error HAS been reported already so we're fine with + // throwing away a few items if that is what it takes to match the nearest recovery rule! + if (symbol === EOF || preErrorSymbol === EOF) { + p = this.constructParseErrorInfo((errStr || 'Parsing halted while starting to recover from another error.'), null, expected, false); + retval = this.parseError(p.errStr, p); + break; + } - // discard current lookahead and grab another + // discard current lookahead and grab another - yytext = lexer.yytext; + yytext = lexer.yytext; - symbol = lex(); + symbol = lex(); - } + } - // try to recover from error - if (error_rule_depth === false) { - retval = this.parseError(errStr || 'Parsing halted. No suitable error recovery rule available.', { - text: lexer.match, - value: lexer.yytext, - token: this.describeSymbol(symbol) || symbol, - token_id: symbol, - line: lexer.yylineno, - loc: lexer.yylloc, - expected: expected, - recoverable: false, - state_stack: stack, - value_stack: vstack, - - yy: sharedState.yy, - lexer: lexer - }); - break; - } - popStack(error_rule_depth); + // try to recover from error + if (error_rule_depth < 0) { + p = this.constructParseErrorInfo((errStr || 'Parsing halted. No suitable error recovery rule available.'), null, expected, false); + retval = this.parseError(p.errStr, p); + break; + } + sp -= error_rule_depth; - preErrorSymbol = (symbol === TERROR ? null : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + newState = sstack[sp - 1]; - continue; - } + continue; + } + } - switch (action[0]) { + switch (action) { // catch misc. parse failures: default: // this shouldn't happen, unless resolve defaults are off - if (action[0] instanceof Array) { - retval = this.parseError('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, { - text: lexer.match, - value: lexer.yytext, - token: this.describeSymbol(symbol) || symbol, - token_id: symbol, - line: lexer.yylineno, - loc: lexer.yylloc, - expected: expected, - recoverable: false, - state_stack: stack, - value_stack: vstack, - - yy: sharedState.yy, - lexer: lexer - }); + if (action instanceof Array) { + p = this.constructParseErrorInfo(('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol), null, null, false); + retval = this.parseError(p.errStr, p); break; } // Another case of better safe than sorry: in case state transitions come out of another error recovery process // or a buggy LUT (LookUp Table): - retval = this.parseError('Parsing halted. No viable error recovery approach available due to internal system failure.', { - text: lexer.match, - value: lexer.yytext, - token: this.describeSymbol(symbol) || symbol, - token_id: symbol, - line: lexer.yylineno, - loc: lexer.yylloc, - expected: expected, - recoverable: false, - state_stack: stack, - value_stack: vstack, - - yy: sharedState.yy, - lexer: lexer - }); + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p); break; // shift: - case 1: + case 1: //this.shiftCount++; - stack.push(symbol); - vstack.push(lexer.yytext); + stack[sp] = symbol; + vstack[sp] = lexer.yytext; - stack.push(action[1]); // push state - symbol = null; + sstack[sp] = newState; // push state + ++sp; + symbol = 0; if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: @@ -2429,17 +2450,16 @@ parse: function parse(input) { } else { // error just occurred, resume old lookahead f/ before error symbol = preErrorSymbol; - preErrorSymbol = null; + preErrorSymbol = 0; } - + continue; // reduce: case 2: //this.reductionCount++; - newState = action[1]; - this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... len = this_production[1]; @@ -2447,9 +2467,15 @@ parse: function parse(input) { + // Make sure subsequent `$$ = $1` default action doesn't fail + // for rules where len==0 as then there's no $1 (you're reducing an epsilon rule then!) + // + // Also do this to prevent nasty action block codes to *read* `$0` or `$$` + // and *not* get `undefined` as a result for their efforts! + vstack[sp] = undefined; + // perform semantic action - yyval.$ = vstack[vstack.length - len]; // default to $$ = $1 - // default location, uses first token for firsts, last for lasts + yyval.$ = vstack[sp - len]; // default to $$ = $1; result must produce `undefined` when len == 0, as then there's no $1 @@ -2460,7 +2486,7 @@ parse: function parse(input) { - r = this.performAction.apply(yyval, [yytext, sharedState.yy, newState, vstack].concat(args)); + r = this.performAction.apply(yyval, [yytext, sharedState.yy, newState, sp - 1, vstack].concat(args)); if (typeof r !== 'undefined') { retval = r; @@ -2468,14 +2494,17 @@ parse: function parse(input) { } // pop off stack - popStack(len); + sp -= len; - stack.push(this_production[0]); // push nonterminal (reduce) - vstack.push(yyval.$); + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; // goto new state = table[STATE][NONTERMINAL] - newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; - stack.push(newState); + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; continue; @@ -2483,19 +2512,19 @@ parse: function parse(input) { case 3: retval = true; // Return the `$accept` rule's `$$` result, if available. - // - // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, // default, action): - // + // // $accept: $end // %{ $$ = $1; @$ = @1; %} - // - // which, combined with the parse kernel's `$accept` state behaviour coded below, - // will produce the `$$` value output of the rule as the parse result, + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, // IFF that result is *not* `undefined`. (See also the parser kernel code.) - // + // // In code: - // + // // %{ // @$ = @1; // if location tracking support is included // if (typeof $1 !== 'undefined') @@ -2514,33 +2543,10 @@ parse: function parse(input) { } } catch (ex) { // report exceptions through the parseError callback too: - retval = this.parseError('Parsing aborted due to exception.', { - exception: ex, - text: lexer.match, - value: lexer.yytext, - token: this.describeSymbol(symbol) || symbol, - token_id: symbol, - line: lexer.yylineno, - loc: lexer.yylloc, - // expected: expected, - recoverable: false, - state_stack: stack, - value_stack: vstack, - - yy: sharedState.yy, - lexer: lexer - }); + p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); + retval = this.parseError(p.errStr, p); } finally { - var rv; - - if (sharedState.yy.post_parse) { - rv = sharedState.yy.post_parse.apply(this, [sharedState.yy, retval].concat(args)); - if (typeof rv !== 'undefined') retval = rv; - } - if (this.post_parse) { - rv = this.post_parse.apply(this, [sharedState.yy, retval].concat(args)); - if (typeof rv !== 'undefined') retval = rv; - } + retval = this.cleanupAfterParse(retval, true); } return retval; @@ -3092,7 +3098,7 @@ break; case 16 : /*! Conditions:: rules */ /*! Rule:: %% */ - this.begin('code'); return 130; + this.begin('code'); return 6; break; case 17 : /*! Conditions:: rules */ @@ -3100,23 +3106,23 @@ case 17 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 174; + return 58; break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 179; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 67; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 179; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 67; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 177; + this.popState(); return 65; break; case 24 : /*! Conditions:: options */ @@ -3146,12 +3152,12 @@ break; case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; break; case 31 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 142; + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; break; case 32 : /*! Conditions:: indented */ @@ -3173,13 +3179,13 @@ case 32 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 181; + return 69; break; case 33 : /*! Conditions:: indented */ /*! Rule:: .* */ - this.popState(); return 142; + this.popState(); return 18; break; case 34 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3194,7 +3200,7 @@ break; case 36 : /*! Conditions:: INITIAL */ /*! Rule:: {ID} */ - this.pushState('macro'); return 135; + this.pushState('macro'); return 11; break; case 37 : /*! Conditions:: macro */ @@ -3207,7 +3213,7 @@ case 38 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 174; + return 58; break; case 39 : @@ -3223,17 +3229,17 @@ break; case 41 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 173; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 57; break; case 42 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 173; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 57; break; case 43 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ - this.pushState('set'); return 166; + this.pushState('set'); return 50; break; case 56 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3243,7 +3249,7 @@ break; case 57 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ - return 159; // treated as `(?!atom)` + return 35; // treated as `(?!atom)` break; case 58 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3253,27 +3259,27 @@ break; case 60 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 171; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 55; break; case 63 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 175; + this.begin('options'); return 59; break; case 64 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %s\b */ - this.begin('start_condition'); return 137; + this.begin('start_condition'); return 13; break; case 65 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %x\b */ - this.begin('start_condition'); return 139; + this.begin('start_condition'); return 15; break; case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 181; + this.pushState('path'); return 69; break; case 67 : /*! Conditions:: INITIAL rules trail code */ @@ -3281,13 +3287,13 @@ case 67 : /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - return 145; + return 21; break; case 68 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %% */ - this.begin('rules'); return 130; + this.begin('rules'); return 6; break; case 74 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3297,12 +3303,12 @@ break; case 78 : /*! Conditions:: set */ /*! Rule:: \] */ - this.popState('set'); return 168; + this.popState('set'); return 52; break; case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 184; // the bit of CODE just before EOF... + return 72; // the bit of CODE just before EOF... break; case 81 : /*! Conditions:: path */ @@ -3312,12 +3318,12 @@ break; case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 182; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 70; break; case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 182; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 70; break; case 84 : /*! Conditions:: path */ @@ -3327,7 +3333,7 @@ break; case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 182; + this.popState(); return 70; break; case 86 : /*! Conditions:: * */ @@ -3345,28 +3351,28 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 152, + 0 : 28, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 152, + 1 : 28, /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - 2 : 152, + 2 : 28, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 152, + 3 : 28, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 152, + 4 : 28, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 152, + 5 : 28, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 152, + 6 : 28, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 9 : 135, + 9 : 11, /*! Conditions:: conditions */ /*! Rule:: , */ 11 : 44, @@ -3375,28 +3381,28 @@ simpleCaseActionClusters: { 12 : 42, /*! Conditions:: options */ /*! Rule:: {NAME} */ - 18 : 135, + 18 : 11, /*! Conditions:: options */ /*! Rule:: = */ 19 : 61, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 179, + 22 : 67, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 25 : 146, + 25 : 22, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \| */ 44 : 124, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ - 45 : 158, + 45 : 34, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ - 46 : 158, + 46 : 34, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ - 47 : 158, + 47 : 34, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ 48 : 40, @@ -3423,7 +3429,7 @@ simpleCaseActionClusters: { 55 : 36, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 171, + 59 : 55, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ 61 : 36, @@ -3432,13 +3438,13 @@ simpleCaseActionClusters: { 62 : 46, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 172, + 69 : 56, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 165, + 70 : 49, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 165, + 71 : 49, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ 72 : 123, @@ -3450,13 +3456,13 @@ simpleCaseActionClusters: { 75 : 1, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 76 : 170, + 76 : 54, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 170, + 77 : 54, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 184 + 79 : 72 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, diff --git a/package.json b/package.json index 01f4077..a98f058 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-133", + "version": "0.1.4-134", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From dc12cf6f7424018911ae2efdacb5549effe81069 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 22 Jul 2016 19:51:13 +0200 Subject: [PATCH 172/417] version bump --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a98f058..c19bf20 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-134", + "version": "0.1.4-135", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From e58fcf402b83cbc6e8776baac1fdca6ca574a1d3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 23 Jul 2016 17:10:13 +0200 Subject: [PATCH 173/417] `make bump`: bump build number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c19bf20..85004ca 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-135", + "version": "0.1.4-136", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 9eea1a3304861dad6c055d51cfeff987d75a7679 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 23 Jul 2016 17:18:54 +0200 Subject: [PATCH 174/417] `make superclean; make prep; make; make site` --- lex-parser.js | 1367 ++++++++++++++++++++++++++----------------------- 1 file changed, 712 insertions(+), 655 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index f738b20..cc69eb0 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-133 */ +/* parser generated by jison 0.4.17-136 */ /* * Returns a Parser object of the following structure: * @@ -23,9 +23,8 @@ * quotes around literal IDs in a description string. * * originalQuoteName: function(name), - * Helper function **which will be set up during the first invocation of the `parse()` method**. - * References the original quoteName handler as it was just before the invocation of `parse()`; - * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function + * The basic quoteName handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function * at the end of the `parse()`. * * describeSymbol: function(symbol), @@ -41,7 +40,7 @@ * terminal_descriptions_: (if there are any) {associative list: number ==> description}, * productions_: [...], * - * performAction: function parser__performAction(yytext, yyleng, yylineno, yy, yystate, $0, $$, _$, yystack, yysstack, ...), + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yy, yystate, $0, $$, _$, yystack, yysstack, ...), * where `...` denotes the (optional) additional arguments the user passed to * `parser.parse(str, ...)` * @@ -75,8 +74,7 @@ * var retVal = parser.parseError(infoObj.errStr, infoObj); * * originalParseError: function(str, hash), - * Helper function **which will be set up during the first invocation of the `parse()` method**. - * References the original parseError handler as it was just before the invocation of `parse()`; + * The basic parseError handler provided by JISON. * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function * at the end of the `parse()`. * @@ -410,131 +408,132 @@ trace: function no_op_trace() { }, JisonParserError: JisonParserError, yy: {}, options: { - type: "lalr" + type: "lalr", + errorRecoveryTokenDiscardCount: 3 }, symbols_: { - "$": 36, + "$": 17, "$accept": 0, "$end": 1, - "%%": 6, - "(": 40, - ")": 41, - "*": 42, - "+": 43, - ",": 44, - ".": 46, - "/": 47, - "/!": 35, - "<": 60, - "=": 61, - ">": 62, - "?": 63, - "ACTION": 18, - "ACTION_BODY": 28, - "CHARACTER_LIT": 58, - "CODE": 72, + "%%": 22, + "(": 10, + ")": 11, + "*": 7, + "+": 12, + ",": 8, + ".": 15, + "/": 14, + "/!": 51, + "<": 5, + "=": 18, + ">": 6, + "?": 13, + "ACTION": 34, + "ACTION_BODY": 44, + "CHARACTER_LIT": 66, + "CODE": 76, "EOF": 1, - "ESCAPE_CHAR": 55, - "INCLUDE": 69, - "NAME": 11, - "NAME_BRACE": 49, - "OPTIONS": 59, - "OPTIONS_END": 65, - "OPTION_VALUE": 67, - "PATH": 70, - "RANGE_REGEX": 56, - "REGEX_SET": 54, - "REGEX_SET_END": 52, - "REGEX_SET_START": 50, - "SPECIAL_GROUP": 34, - "START_COND": 22, - "START_EXC": 15, - "START_INC": 13, - "STRING_LIT": 57, - "UNKNOWN_DECL": 21, - "^": 94, - "action": 25, - "action_body": 17, - "action_comments_body": 27, - "any_group_regex": 39, - "definition": 10, - "definitions": 5, + "ESCAPE_CHAR": 63, + "INCLUDE": 73, + "NAME": 27, + "NAME_BRACE": 57, + "OPTIONS": 67, + "OPTIONS_END": 69, + "OPTION_VALUE": 71, + "PATH": 74, + "RANGE_REGEX": 64, + "REGEX_SET": 62, + "REGEX_SET_END": 60, + "REGEX_SET_START": 58, + "SPECIAL_GROUP": 50, + "START_COND": 38, + "START_EXC": 31, + "START_INC": 29, + "STRING_LIT": 65, + "UNKNOWN_DECL": 37, + "^": 16, + "action": 41, + "action_body": 33, + "action_comments_body": 43, + "any_group_regex": 54, + "definition": 26, + "definitions": 21, "error": 2, - "escape_char": 48, - "extra_lexer_module_code": 8, - "include_macro_code": 19, - "init": 4, - "lex": 3, - "module_code_chunk": 71, - "name_expansion": 37, - "name_list": 29, - "names_exclusive": 16, - "names_inclusive": 14, - "nonempty_regex_list": 30, - "option": 66, - "option_list": 64, - "optional_module_code_chunk": 68, - "options": 20, - "range_regex": 38, - "regex": 12, - "regex_base": 33, - "regex_concat": 32, - "regex_list": 31, - "regex_set": 51, - "regex_set_atom": 53, - "rule": 23, - "rules": 9, - "rules_and_epilogue": 7, - "start_conditions": 24, - "string": 45, - "unbracketed_action_body": 26, - "{": 123, - "|": 124, - "}": 125 + "escape_char": 56, + "extra_lexer_module_code": 24, + "include_macro_code": 35, + "init": 20, + "lex": 19, + "module_code_chunk": 75, + "name_expansion": 52, + "name_list": 45, + "names_exclusive": 32, + "names_inclusive": 30, + "nonempty_regex_list": 46, + "option": 70, + "option_list": 68, + "optional_module_code_chunk": 72, + "options": 36, + "range_regex": 53, + "regex": 28, + "regex_base": 49, + "regex_concat": 48, + "regex_list": 47, + "regex_set": 59, + "regex_set_atom": 61, + "rule": 39, + "rules": 25, + "rules_and_epilogue": 23, + "start_conditions": 40, + "string": 55, + "unbracketed_action_body": 42, + "{": 3, + "|": 9, + "}": 4 }, terminals_: { 1: "EOF", 2: "error", - 6: "%%", - 11: "NAME", - 13: "START_INC", - 15: "START_EXC", - 18: "ACTION", - 21: "UNKNOWN_DECL", - 22: "START_COND", - 28: "ACTION_BODY", - 34: "SPECIAL_GROUP", - 35: "/!", - 36: "$", - 40: "(", - 41: ")", - 42: "*", - 43: "+", - 44: ",", - 46: ".", - 47: "/", - 49: "NAME_BRACE", - 50: "REGEX_SET_START", - 52: "REGEX_SET_END", - 54: "REGEX_SET", - 55: "ESCAPE_CHAR", - 56: "RANGE_REGEX", - 57: "STRING_LIT", - 58: "CHARACTER_LIT", - 59: "OPTIONS", - 60: "<", - 61: "=", - 62: ">", - 63: "?", - 65: "OPTIONS_END", - 67: "OPTION_VALUE", - 69: "INCLUDE", - 70: "PATH", - 72: "CODE", - 94: "^", - 123: "{", - 124: "|", - 125: "}" + 3: "{", + 4: "}", + 5: "<", + 6: ">", + 7: "*", + 8: ",", + 9: "|", + 10: "(", + 11: ")", + 12: "+", + 13: "?", + 14: "/", + 15: ".", + 16: "^", + 17: "$", + 18: "=", + 22: "%%", + 27: "NAME", + 29: "START_INC", + 31: "START_EXC", + 34: "ACTION", + 37: "UNKNOWN_DECL", + 38: "START_COND", + 44: "ACTION_BODY", + 50: "SPECIAL_GROUP", + 51: "/!", + 57: "NAME_BRACE", + 58: "REGEX_SET_START", + 60: "REGEX_SET_END", + 62: "REGEX_SET", + 63: "ESCAPE_CHAR", + 64: "RANGE_REGEX", + 65: "STRING_LIT", + 66: "CHARACTER_LIT", + 67: "OPTIONS", + 69: "OPTIONS_END", + 71: "OPTION_VALUE", + 73: "INCLUDE", + 74: "PATH", + 76: "CODE" }, TERROR: 2, EOF: 1, @@ -546,6 +545,8 @@ originalParseError: null, cleanupAfterParse: null, constructParseErrorInfo: null, +__reentrant_call_depth: 0, // INTERNAL USE ONLY + // APIs which will be set up depending on user action code analysis: //yyErrOk: 0, //yyClearIn: 0, @@ -593,23 +594,26 @@ describeSymbol: function parser_describeSymbol(symbol) { // Produce a (more or less) human-readable list of expected tokens at the point of failure. // // The produced list may contain token or token set descriptions instead of the tokens -// themselves to help turning this output into something that easier to read by humans. +// themselves to help turning this output into something that easier to read by humans +// unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*, +// expected terminals and nonterminals is produced. // // The returned list (array) will not contain any duplicate entries. -collect_expected_token_set: function parser_collect_expected_token_set(state) { +collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) { var TERROR = this.TERROR; var tokenset = []; var check = {}; // Has this (error?) state been outfitted with a custom expectations description text for human consumption? // If so, use that one instead of the less palatable token set. - if (this.state_descriptions_ && this.state_descriptions_[p]) { + if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { return [ - this.state_descriptions_[p] + this.state_descriptions_[state] ]; } for (var p in this.table[state]) { + p = +p; if (p !== TERROR) { - var d = this.describeSymbol(p); + var d = do_not_describe ? p : this.describeSymbol(p); if (d && !check[d]) { tokenset.push(d); check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. @@ -620,65 +624,65 @@ collect_expected_token_set: function parser_collect_expected_token_set(state) { }, productions_: bp({ pop: u([ - 3, - s, - [7, 4], - 4, - 5, - 5, - s, - [10, 8], - 14, - 14, - 16, - 16, - 9, - 9, - 23, - s, - [25, 3], - 26, - 26, - 17, - 17, - 27, - 27, + 19, s, - [24, 3], - 29, - 29, - 12, - 31, - 31, + [23, 4], + 20, + 21, + 21, s, - [30, 3], + [26, 8], + 30, + 30, 32, 32, - s, - [33, 15], - 37, + 25, + 25, 39, - 51, - 51, - 53, - 53, - 48, - 38, + s, + [41, 3], + 42, + 42, + 33, + 33, + 43, + 43, + s, + [40, 3], 45, 45, - 20, - 64, - 64, + 28, + 47, + 47, s, - [66, 3], - 8, - 8, - 19, - 19, - 71, - 71, + [46, 3], + 48, + 48, + s, + [49, 15], + 52, + 54, + 59, + 59, + 61, + 61, + 56, + 53, + 55, + 55, + 36, 68, - 68 + 68, + s, + [70, 3], + 24, + 24, + 35, + 35, + 75, + 75, + 72, + 72 ]), rule: u([ 4, @@ -1234,295 +1238,299 @@ table: bt({ ]), symbol: u([ 3, - 4, - 6, - 11, - 13, - 15, - 18, - 21, - 59, - 69, - 123, + 19, + 20, + 22, + 27, + 29, + 31, + 34, + 37, + 67, + 73, 1, - 5, - 6, - 10, + 3, + 21, + 22, + 26, c, [12, 4], - 19, - 20, + 35, + 36, c, - [14, 4], - 6, + [14, 3], + 22, c, [14, 13], - 12, - 30, - s, - [32, 6, 1], - 39, - 40, + 9, + 10, s, - [45, 6, 1], - 55, - 57, - 58, - 94, - 124, - 14, - 22, - 16, - 22, - 17, - 27, + [14, 4, 1], 28, - 123, - 125, + 46, + s, + [48, 5, 1], + s, + [54, 5, 1], + 63, + 65, + 66, + 30, + 38, + 32, + 38, + 3, + 4, + 33, + 43, + 44, + 3, c, - [67, 9], + [67, 8], c, [9, 27], 2, + 74, + 27, + 68, 70, - 11, - 64, - 66, 1, - 6, - 7, - 9, - 23, - 24, + 5, c, - [73, 3], + [73, 6], + 22, + 23, + 25, + 39, 40, - 46, - 47, + 50, + 51, c, - [69, 5], - 60, - 94, - 124, - 6, + [70, 5], + 22, + c, + [53, 19], + 9, + 10, + 11, c, - [53, 24], + [39, 5], c, - [113, 7], - 41, + [16, 5], c, - [114, 9], - 59, - 69, - 94, - 123, - 124, + [115, 12], c, - [28, 6], + [28, 16], s, - [30, 8, 1], + [46, 7, 1], c, - [31, 23], + [31, 11], + 7, + s, + [9, 9, 1], + c, + [34, 6], + 50, + 51, + 53, c, [27, 3], - 38, s, - [40, 4, 1], + [64, 4, 1], c, - [102, 5], - s, - [56, 4, 1], - 63, + [197, 3], c, - [28, 4], + [58, 5], c, - [53, 20], - 94, + [52, 15], c, - [22, 23], + [22, 22], c, - [238, 17], + [167, 5], c, - [17, 17], + [17, 29], c, - [106, 9], + [106, 19], c, - [105, 18], + [105, 8], c, - [27, 179], - 52, + [27, 183], + 60, s, - [54, 6, 1], - c, - [29, 5], - 37, - 49, - 51, - 53, - 54, - c, - [115, 87], - 22, + [62, 6, 1], + 73, + 52, + 57, + 59, + 61, + 62, c, - [479, 9], + [115, 82], c, - [10, 24], - 123, - 125, + [17, 6], + 38, c, - [594, 3], + [10, 33], + 4, + 3, + 4, + 44, 1, + 3, c, - [73, 10], + [554, 8], c, - [554, 7], - 59, - 60, - 69, - 72, + [70, 10], c, - [70, 3], + [69, 4], + 76, c, [25, 25], - 65, - 11, - 64, - 65, - 66, - 11, - 61, - 65, - s, - [1, 3], - 8, + 69, + 27, 68, 69, - 71, + 70, + 18, + 27, + 69, + s, + [1, 3], + 24, 72, - 1, - 6, + 73, + 75, + 76, c, - [617, 16], - 1, - 6, + [619, 9], + c, + [617, 9], c, - [16, 14], + [18, 9], + c, + [16, 7], c, [724, 21], - 11, - 29, - 42, + 7, + 27, + 45, c, [610, 59], + 3, + 11, c, - [28, 6], - 41, - c, - [208, 9], + [707, 9], c, [10, 10], c, - [498, 129], - 41, - 41, + [498, 134], + 11, + 11, c, - [185, 34], + [185, 29], c, - [28, 22], - 52, + [28, 27], + 60, c, [528, 3], - 52, - 53, - 54, - 49, - 52, + 60, + 61, + 62, + 57, + 60, c, [3, 4], c, - [444, 26], + [444, 27], c, - [9, 3], + [443, 4], c, - [1037, 5], + [1037, 4], + 4, c, - [1040, 12], - 65, - 11, - 67, + [1040, 10], + 69, + 27, + 71, 1, 1, - 19, - 69, + 35, + 73, 1, - 69, - 72, c, - [3, 4], + [440, 3], + c, + [3, 3], c, [408, 6], c, [391, 16], - 18, - 19, - 25, - 26, - 69, - 123, - 44, - 62, - 62, - 44, - 62, + 3, + 34, + 35, + 41, + 42, + 73, + 6, + 8, + 6, + 6, + 8, c, [309, 91], - 52, - 123, - 125, - 11, - 65, - 11, + 60, + 3, + 4, + 27, + 69, c, - [542, 3], + [542, 4], c, [133, 6], c, [142, 3], c, - [136, 16], + [136, 17], c, - [189, 5], - 1, - 6, - 18, + [189, 4], + c, + [21, 9], + 34, c, - [565, 30], + [565, 23], c, [33, 17], c, - [14, 11], + [15, 6], c, - [574, 3], + [13, 7], + 27, c, [14, 13], + 3, + 4, c, - [81, 5], + [81, 3], 1, + 3, + 4, c, - [85, 19], - 44, - 62, + [52, 17], c, - [107, 5], + [234, 3], c, - [21, 14] + [739, 3], + c, + [90, 15] ]), type: u([ + 2, 0, 0, s, - [2, 9], + [2, 8], 1, + 2, 0, 2, c, @@ -1530,87 +1538,79 @@ table: bt({ c, [19, 7], c, - [14, 13], - s, - [0, 4], - c, - [13, 6], - c, - [7, 3], + [14, 14], c, - [51, 8], + [11, 6], c, [13, 4], c, - [64, 11], - s, - [2, 33], - c, - [44, 4], + [6, 6], c, - [73, 7], + [33, 9], c, - [47, 37], + [32, 11], + s, + [2, 31], c, - [51, 8], + [74, 17], c, - [114, 10], + [55, 39], c, - [75, 11], + [47, 27], c, - [144, 8], + [146, 15], c, - [31, 21], + [64, 24], c, - [62, 7], + [52, 35], c, - [53, 37], + [22, 20], c, - [22, 23], + [17, 34], + s, + [2, 213], c, - [238, 16], + [472, 3], c, - [255, 18], - s, - [2, 217], + [227, 180], c, - [470, 46], + [688, 7], c, - [183, 140], + [616, 5], c, - [616, 9], + [436, 12], c, - [466, 8], + [204, 30], c, - [655, 30], + [504, 17], c, - [724, 19], + [47, 15], c, - [535, 31], + [610, 52], c, - [610, 31], + [307, 171], c, - [297, 168], + [28, 36], c, - [28, 46], + [335, 4], c, - [1000, 5], + [227, 39], c, - [993, 40], + [294, 20], c, - [83, 27], + [19, 9], c, - [408, 7], + [408, 14], c, - [392, 19], + [355, 13], c, - [253, 108], + [243, 107], c, - [204, 24], + [204, 26], c, - [134, 82], + [135, 82], c, - [81, 46] + [81, 44] ]), state: u([ s, @@ -1701,88 +1701,93 @@ table: bt({ ]), mode: u([ s, - [2, 10], + [2, 9], + 1, + 2, s, [1, 9], c, [10, 10], s, - [1, 14], + [1, 13], s, [2, 39], c, - [44, 16], - c, - [56, 28], + [44, 11], c, - [111, 12], + [51, 28], c, - [42, 4], + [103, 7], c, - [44, 7], + [52, 11], c, - [23, 23], + [13, 5], c, - [28, 7], + [23, 24], c, - [86, 9], + [27, 6], c, - [10, 5], + [67, 15], c, - [178, 18], + [72, 11], c, - [192, 24], + [189, 32], c, - [202, 49], + [202, 52], s, [2, 179], c, - [220, 89], + [220, 90], + c, + [89, 20], c, - [88, 20], + [20, 13], c, - [20, 14], + [123, 4], c, - [344, 55], + [126, 51], c, - [482, 6], + [434, 4], c, - [65, 18], + [494, 9], c, - [77, 19], + [567, 30], c, - [454, 21], + [454, 16], c, - [556, 44], + [556, 49], c, - [441, 168], + [441, 158], c, [184, 27], c, - [767, 18], + [767, 30], c, - [219, 53], + [111, 53], c, - [309, 5], + [56, 5], c, - [377, 9], + [94, 10], c, - [362, 23], + [362, 20], c, - [242, 103], + [683, 103], c, - [415, 26], + [436, 8], c, - [130, 61], + [635, 45], c, - [577, 21], + [689, 53], c, - [40, 38] + [211, 23], + c, + [22, 17] ]), goto: u([ s, [6, 9], 8, + 8, 5, 6, 7, @@ -1790,23 +1795,22 @@ table: bt({ 12, 14, 13, - 8, 15, c, [10, 9], - 23, - 25, - 30, + 20, 22, - 28, 24, + 28, + 29, + 30, + 23, + 25, 33, 34, 37, 35, 36, - 29, - 20, 39, 41, s, @@ -1823,61 +1827,60 @@ table: bt({ 44, 48, 50, + 55, + s, + [35, 6], 51, s, - [35, 11], - 55, - 35, - 35, + [35, 7], 7, s, [9, 9], s, [38, 9], + 43, + 56, + 22, + 43, + c, + [94, 4], s, [43, 6], c, - [98, 4], - 43, - c, - [99, 7], + [100, 7], 43, 43, - 29, - 43, - 56, - s, - [40, 6], + 40, + 20, + 22, + 40, c, [23, 4], - 40, + s, + [40, 6], c, [23, 7], 40, 40, - 29, - 40, - 20, - s, - [45, 11], + 45, 61, - 60, - s, - [45, 5], - 64, s, [45, 3], + 60, 62, s, + [45, 15], + 64, + s, [45, 4], c, - [44, 12], - 29, - 20, + [49, 7], + c, + [43, 7], c, - [14, 18], + [14, 14], c, - [13, 8], + [192, 12], c, [12, 12], s, @@ -1905,24 +1908,24 @@ table: bt({ s, [67, 27], s, - [10, 6], + [10, 7], 73, - s, - [10, 3], + 10, + 10, s, [17, 10], s, - [11, 6], + [11, 7], 74, - s, - [11, 3], + 11, + 11, s, [19, 10], 76, 75, - 77, 29, 29, + 77, s, [79, 25], s, @@ -1930,36 +1933,37 @@ table: bt({ 78, 48, 73, - 74, 80, 74, + 74, 1, 2, s, [84, 3], 86, - 85, c, - [567, 14], + [567, 7], + 85, + s, + [35, 7], s, [22, 16], c, [656, 13], - 91, 90, + 91, c, [556, 23], - s, - [44, 11], + 44, 61, - 60, - s, - [44, 5], - 64, s, [44, 3], + 60, 62, s, + [44, 15], + 64, + s, [44, 4], s, [42, 10], @@ -1977,29 +1981,27 @@ table: bt({ [68, 27], 93, 94, - s, - [51, 11], + 51, 61, - 60, - s, - [51, 5], - 64, s, [51, 3], + 60, 62, s, - [51, 4], + [51, 15], + 64, s, - [52, 11], + [51, 4], + 52, 61, - 60, - s, - [52, 5], - 64, s, [52, 3], + 60, 62, s, + [52, 15], + 64, + s, [52, 4], 95, 33, @@ -2037,11 +2039,11 @@ table: bt({ 5, s, [21, 16], + 105, 108, 13, - 105, - 110, 109, + 110, 111, 36, 36, @@ -2070,11 +2072,11 @@ table: bt({ [23, 16], s, [31, 3], - 25, - 25, + s, + [25, 9], 116, s, - [25, 14], + [25, 7], s, [26, 16], s, @@ -2094,9 +2096,9 @@ table: bt({ [28, 17], 37, 37, - 77, 30, 30, + 77, s, [24, 16] ]) @@ -2115,6 +2117,8 @@ defaultActions: { parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); + hash.destroy(); // destroy... well, *almost*! + // assert('recoverable' in hash); } else { throw new this.JisonParserError(str, hash); } @@ -2128,9 +2132,11 @@ parse: function parse(input) { table = this.table, sp = 0; // 'stack pointer': index into the stacks - var recovering = 0; // (only used when the grammar contains error recovery rules) + + var recovering = 0; // (only used when the grammar contains error recovery rules) var TERROR = this.TERROR, - EOF = this.EOF; + EOF = this.EOF, + ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; var NO_ACTION = [0, table.length /* ensures that anyone using this new state will fail dramatically! */]; var args = stack.slice.call(arguments, 1); @@ -2145,7 +2151,14 @@ parse: function parse(input) { } var sharedState = { - yy: {} + yy: { + parseError: null, + quoteName: null, + lexer: null, + parser: null, + pre_parse: null, + post_parse: null + } }; // copy state for (var k in this.yy) { @@ -2184,83 +2197,111 @@ parse: function parse(input) { // Does the shared state override the default `parseError` that already comes with this instance? - if (!this.originalParseError) { - this.originalParseError = this.parseError; - } if (typeof sharedState.yy.parseError === 'function') { this.parseError = sharedState.yy.parseError; + } else { + this.parseError = this.originalParseError; } // Does the shared state override the default `quoteName` that already comes with this instance? - if (!this.originalQuoteName) { - this.originalQuoteName = this.quoteName; - } if (typeof sharedState.yy.quoteName === 'function') { this.quoteName = sharedState.yy.quoteName; + } else { + this.quoteName = this.originalQuoteName; } // set up the cleanup function; make it an API so that external code can re-use this one in case of // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which // case this parse() API method doesn't come with a `finally { ... }` block any more! - if (typeof this.cleanupAfterParse !== 'function') { - this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods) { - var rv; - - if (invoke_post_methods) { - if (sharedState.yy.post_parse) { - rv = sharedState.yy.post_parse.apply(this, [sharedState.yy, resultValue].concat(args)); - if (typeof rv !== 'undefined') resultValue = rv; - } - if (this.post_parse) { - rv = this.post_parse.apply(this, [sharedState.yy, resultValue].concat(args)); - if (typeof rv !== 'undefined') resultValue = rv; - } + // + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `sharedState`, etc. references will be *wrong*! + // + // The function resets itself to the previous set up one to support reentrant parsers. + this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods) { + var rv; + + if (invoke_post_methods) { + if (sharedState.yy.post_parse) { + rv = sharedState.yy.post_parse.apply(this, [sharedState.yy, resultValue].concat(args)); + if (typeof rv !== 'undefined') resultValue = rv; + } + if (this.post_parse) { + rv = this.post_parse.apply(this, [sharedState.yy, resultValue].concat(args)); + if (typeof rv !== 'undefined') resultValue = rv; } + } + + if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. - // prevent lingering circular references from causing memory leaks: + // prevent lingering circular references from causing memory leaks: + if (sharedState.yy) { sharedState.yy.parseError = undefined; - this.parseError = this.originalParseError; sharedState.yy.quoteName = undefined; - this.quoteName = this.originalQuoteName; sharedState.yy.lexer = undefined; sharedState.yy.parser = undefined; if (lexer.yy === sharedState.yy) { lexer.yy = undefined; } - // nuke the vstack[] array at least as that one will still reference obsoleted user values. - // To be safe, we nuke the other internal stack columns as well... - stack.length = 0; // fastest way to nuke an array without overly bothering the GC - sstack.length = 0; + } + sharedState.yy = undefined; + this.parseError = this.originalParseError; + this.quoteName = this.originalQuoteName; - vstack.length = 0; - return resultValue; - }; - } + // nuke the vstack[] array at least as that one will still reference obsoleted user values. + // To be safe, we nuke the other internal stack columns as well... + stack.length = 0; // fastest way to nuke an array without overly bothering the GC + sstack.length = 0; - if (typeof this.constructParseErrorInfo !== 'function') { - this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { - return { - errStr: msg, - exception: ex, - text: lexer.match, - value: lexer.yytext, - token: this.describeSymbol(symbol) || symbol, - token_id: symbol, - line: lexer.yylineno, - loc: lexer.yylloc, - expected: expected, - recoverable: recoverable, - state: state, - action: action, - new_state: newState, - state_stack: stack, - value_stack: vstack, - - yy: sharedState.yy, - lexer: lexer - }; + vstack.length = 0; + stack_pointer = 0; + + return resultValue; + }; + + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `lexer`, `sharedState`, etc. references will be *wrong*! + this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { + return { + errStr: msg, + exception: ex, + text: lexer.match, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, + token_id: symbol, + line: lexer.yylineno, + + expected: expected, + recoverable: recoverable, + state: state, + action: action, + new_state: newState, + symbol_stack: stack, + state_stack: sstack, + value_stack: vstack, + + stack_pointer: sp, + yy: sharedState.yy, + lexer: lexer, + + // and make sure the error info doesn't stay due to potential ref cycle via userland code manipulations (memory leak opportunity!): + destroy: function destructParseErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // info.value = null; + // info.value_stack = null; + // ... + var rec = !!this.recoverable; + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key !== 'function') { + this[key] = undefined; + } + } + this.recoverable = rec; + } }; - } + }; function lex() { @@ -2282,13 +2323,6 @@ parse: function parse(input) { var newState; var retval = false; - if (this.pre_parse) { - this.pre_parse.apply(this, [sharedState.yy].concat(args)); - } - if (sharedState.yy.pre_parse) { - sharedState.yy.pre_parse.apply(this, [sharedState.yy].concat(args)); - } - // Return the rule stack depth where the nearest error rule can be found. // Return -1 when no error recovery rule was found. @@ -2313,6 +2347,15 @@ parse: function parse(input) { } try { + this.__reentrant_call_depth++; + + if (this.pre_parse) { + this.pre_parse.apply(this, [sharedState.yy].concat(args)); + } + if (sharedState.yy.pre_parse) { + sharedState.yy.pre_parse.apply(this, [sharedState.yy].concat(args)); + } + newState = sstack[sp - 1]; for (;;) { // retrieve state number from top of stack @@ -2361,16 +2404,19 @@ parse: function parse(input) { p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0)); r = this.parseError(p.errStr, p); + if (!p.recoverable) { retval = r; break; + } else { + // TODO: allow parseError callback to edit symbol and or state tat the start of the error recovery process... } } // just recovered from another error - if (recovering === 3 && error_rule_depth >= 0) { + if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { // only barf a fatal hairball when we're out of look-ahead symbols and none hit a match; // this DOES discard look-ahead while recovering from an error when said look-ahead doesn't // suit the error recovery rules... The error HAS been reported already so we're fine with @@ -2386,6 +2432,7 @@ parse: function parse(input) { yytext = lexer.yytext; + symbol = lex(); @@ -2401,7 +2448,8 @@ parse: function parse(input) { preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token symbol = TERROR; // insert generic error symbol as new lookahead - recovering = 3; // allow 3 real symbols to be shifted before reporting a new error + // allow N (default: 3) real symbols to be shifted before reporting a new error + recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; newState = sstack[sp - 1]; @@ -2448,10 +2496,19 @@ parse: function parse(input) { } } else { - // error just occurred, resume old lookahead f/ before error + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: symbol = preErrorSymbol; preErrorSymbol = 0; + // read action for current state and first input + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + if (!t[0]) { + // forget about that symbol and move forward: this wasn't an 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + + symbol = 0; + } } continue; @@ -2547,13 +2604,14 @@ parse: function parse(input) { retval = this.parseError(p.errStr, p); } finally { retval = this.cleanupAfterParse(retval, true); + this.__reentrant_call_depth--; } return retval; } }; - - +parser.originalParseError = parser.parseError; +parser.originalQuoteName = parser.quoteName; var XRegExp = require('xregexp'); function encodeRE (s) { @@ -2566,8 +2624,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; - -/* generated by jison-lex 0.3.4-133 */ +/* generated by jison-lex 0.3.4-136 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 @@ -3054,14 +3111,14 @@ options: { ranges: true }, JisonLexerError: JisonLexerError, -performAction: function anonymous(yy, yy_, $avoiding_name_collisions, YY_START) { +performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) { var YYSTATE = YY_START; switch($avoiding_name_collisions) { case 7 : /*! Conditions:: action */ /*! Rule:: \{ */ - yy.depth++; return 123; + yy.depth++; return 3; break; case 8 : /*! Conditions:: action */ @@ -3072,13 +3129,13 @@ case 8 : } else { yy.depth--; } - return 125; + return 4; break; case 10 : /*! Conditions:: conditions */ /*! Rule:: > */ - this.popState(); return 62; + this.popState(); return 6; break; case 13 : /*! Conditions:: rules */ @@ -3098,7 +3155,7 @@ break; case 16 : /*! Conditions:: rules */ /*! Rule:: %% */ - this.begin('code'); return 6; + this.begin('code'); return 22; break; case 17 : /*! Conditions:: rules */ @@ -3106,23 +3163,23 @@ case 17 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 58; + return 66; break; case 20 : /*! Conditions:: options */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 67; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 71; break; case 21 : /*! Conditions:: options */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 67; + yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 71; break; case 23 : /*! Conditions:: options */ /*! Rule:: {BR}+ */ - this.popState(); return 65; + this.popState(); return 69; break; case 24 : /*! Conditions:: options */ @@ -3147,17 +3204,17 @@ break; case 29 : /*! Conditions:: indented */ /*! Rule:: \{ */ - yy.depth = 0; this.begin('action'); return 123; + yy.depth = 0; this.begin('action'); return 3; break; case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 34; break; case 31 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 18; + yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 34; break; case 32 : /*! Conditions:: indented */ @@ -3179,13 +3236,13 @@ case 32 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 69; + return 73; break; case 33 : /*! Conditions:: indented */ /*! Rule:: .* */ - this.popState(); return 18; + this.popState(); return 34; break; case 34 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3200,7 +3257,7 @@ break; case 36 : /*! Conditions:: INITIAL */ /*! Rule:: {ID} */ - this.pushState('macro'); return 11; + this.pushState('macro'); return 27; break; case 37 : /*! Conditions:: macro */ @@ -3213,7 +3270,7 @@ case 38 : // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 58; + return 66; break; case 39 : @@ -3229,57 +3286,57 @@ break; case 41 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 57; + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 65; break; case 42 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 57; + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 65; break; case 43 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ - this.pushState('set'); return 50; + this.pushState('set'); return 58; break; case 56 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: < */ - this.begin('conditions'); return 60; + this.begin('conditions'); return 5; break; case 57 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ - return 35; // treated as `(?!atom)` + return 51; // treated as `(?!atom)` break; case 58 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/ */ - return 47; // treated as `(?=atom)` + return 14; // treated as `(?=atom)` break; case 60 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 55; + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 63; break; case 63 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 59; + this.begin('options'); return 67; break; case 64 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %s\b */ - this.begin('start_condition'); return 13; + this.begin('start_condition'); return 29; break; case 65 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %x\b */ - this.begin('start_condition'); return 15; + this.begin('start_condition'); return 31; break; case 66 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 69; + this.pushState('path'); return 73; break; case 67 : /*! Conditions:: INITIAL rules trail code */ @@ -3287,13 +3344,13 @@ case 67 : /* ignore unrecognized decl */ console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - return 21; + return 37; break; case 68 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %% */ - this.begin('rules'); return 6; + this.begin('rules'); return 22; break; case 74 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3303,12 +3360,12 @@ break; case 78 : /*! Conditions:: set */ /*! Rule:: \] */ - this.popState('set'); return 52; + this.popState('set'); return 60; break; case 80 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 72; // the bit of CODE just before EOF... + return 76; // the bit of CODE just before EOF... break; case 81 : /*! Conditions:: path */ @@ -3318,12 +3375,12 @@ break; case 82 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 70; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; break; case 83 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 70; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; break; case 84 : /*! Conditions:: path */ @@ -3333,7 +3390,7 @@ break; case 85 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 70; + this.popState(); return 74; break; case 86 : /*! Conditions:: * */ @@ -3351,118 +3408,118 @@ simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 28, + 0 : 44, /*! Conditions:: action */ /*! Rule:: \/\/.* */ - 1 : 28, + 1 : 44, /*! Conditions:: action */ /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ - 2 : 28, + 2 : 44, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 28, + 3 : 44, /*! Conditions:: action */ /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 28, + 4 : 44, /*! Conditions:: action */ /*! Rule:: [/"'][^{}/"']+ */ - 5 : 28, + 5 : 44, /*! Conditions:: action */ /*! Rule:: [^{}/"']+ */ - 6 : 28, + 6 : 44, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 9 : 11, + 9 : 27, /*! Conditions:: conditions */ /*! Rule:: , */ - 11 : 44, + 11 : 8, /*! Conditions:: conditions */ /*! Rule:: \* */ - 12 : 42, + 12 : 7, /*! Conditions:: options */ /*! Rule:: {NAME} */ - 18 : 11, + 18 : 27, /*! Conditions:: options */ /*! Rule:: = */ - 19 : 61, + 19 : 18, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 67, + 22 : 71, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 25 : 22, + 25 : 38, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \| */ - 44 : 124, + 44 : 9, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ - 45 : 34, + 45 : 50, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ - 46 : 34, + 46 : 50, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ - 47 : 34, + 47 : 50, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ - 48 : 40, + 48 : 10, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \) */ - 49 : 41, + 49 : 11, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \+ */ - 50 : 43, + 50 : 12, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \* */ - 51 : 42, + 51 : 7, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \? */ - 52 : 63, + 52 : 13, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \^ */ - 53 : 94, + 53 : 16, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: , */ - 54 : 44, + 54 : 8, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: <> */ - 55 : 36, + 55 : 17, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 55, + 59 : 63, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ - 61 : 36, + 61 : 17, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \. */ - 62 : 46, + 62 : 15, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 56, + 69 : 64, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 49, + 70 : 57, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 49, + 71 : 57, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ - 72 : 123, + 72 : 3, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \} */ - 73 : 125, + 73 : 4, /*! Conditions:: * */ /*! Rule:: $ */ 75 : 1, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 76 : 54, + 76 : 62, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 54, + 77 : 62, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 72 + 79 : 76 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, From 1e243527855c373aca72f12115c95706a71714ff Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 23 Jul 2016 17:23:05 +0200 Subject: [PATCH 175/417] `make bump` --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 85004ca..47e67bc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-136", + "version": "0.1.4-137", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 0cbc3f24279bc920576e382322ab8fd527777706 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 16 Aug 2016 21:38:53 +0200 Subject: [PATCH 176/417] XRegExp API change: `isUnicodeSlug` --> `_getUnicodeProperty` (see also discussion at https://github.com/slevithan/xregexp/pull/144); bump build version --- lex-parser.js | 8 ++++---- lex.y | 4 ++-- package.json | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index cc69eb0..5322a95 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-136 */ +/* parser generated by jison 0.4.17-137 */ /* * Returns a Parser object of the following structure: * @@ -1089,10 +1089,10 @@ case 78: case 66: /*! Production:: regex_set_atom : name_expansion */ - if (XRegExp.isUnicodeSlug($$[$0].replace(/[{}]/g, '')) + if (XRegExp._getUnicodeProperty($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0] ) { - // treat this as part of an XRegExp `\p{...}` Unicode slug: + // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories this.$ = $$[$0]; } else { this.$ = $$[$0]; @@ -2624,7 +2624,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-136 */ +/* generated by jison-lex 0.3.4-137 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 diff --git a/lex.y b/lex.y index c3499dd..7d01ce3 100644 --- a/lex.y +++ b/lex.y @@ -319,10 +319,10 @@ regex_set_atom : REGEX_SET | name_expansion { - if (XRegExp.isUnicodeSlug($name_expansion.replace(/[{}]/g, '')) + if (XRegExp._getUnicodeProperty($name_expansion.replace(/[{}]/g, '')) && $name_expansion.toUpperCase() !== $name_expansion ) { - // treat this as part of an XRegExp `\p{...}` Unicode slug: + // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories $$ = $name_expansion; } else { $$ = $name_expansion; diff --git a/package.json b/package.json index 47e67bc..9b57c7b 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-137", + "version": "0.1.4-138", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 4ad9ea1248c46e5e27b0db8d622cd5859df878d7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 16 Aug 2016 21:45:59 +0200 Subject: [PATCH 177/417] regenerated library files --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 5322a95..fb312ad 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-137 */ +/* parser generated by jison 0.4.17-138 */ /* * Returns a Parser object of the following structure: * @@ -2624,7 +2624,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-137 */ +/* generated by jison-lex 0.3.4-138 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From d77b6da87ddc691349a498a9b7ba3533dba035df Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 17 Aug 2016 15:23:59 +0200 Subject: [PATCH 178/417] bumped build version and regenerated library files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9b57c7b..75068f8 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-138", + "version": "0.1.4-139", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From cd893fcb44cf380cd56fe7373bee6510acfaac74 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 17 Aug 2016 15:29:36 +0200 Subject: [PATCH 179/417] regenerate lib files --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index fb312ad..25b2f07 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-138 */ +/* parser generated by jison 0.4.17-139 */ /* * Returns a Parser object of the following structure: * @@ -2624,7 +2624,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-138 */ +/* generated by jison-lex 0.3.4-139 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From cfe56f63c5f34219976a1c44d984e9c18b89deab Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 25 Aug 2016 12:17:21 +0200 Subject: [PATCH 180/417] improve error report on hitting an unknown/unsupported input character by also listing the entire line containing the offending character(s). --- lex-parser.js | 2 +- lex.l | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 25b2f07..4ba2ffd 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3355,7 +3355,7 @@ break; case 74 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: . */ - throw new Error("unsupported input character: " + yy_.yytext + " @ " + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ + throw new Error('unsupported input character: ' + yy_.yytext + ' (line: ' + /* current line content: */ this.pastInput(-1, 1) + this.upcomingInput(-1, 1) + ' @ ' + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ break; case 78 : /*! Conditions:: set */ diff --git a/lex.l b/lex.l index 923428c..8fee2f4 100644 --- a/lex.l +++ b/lex.l @@ -162,7 +162,7 @@ WS [^\S\r\n] "{" return '{'; "}" return '}'; -. throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ +. throw new Error('unsupported input character: ' + yytext + ' (line: ' + /* current line content: */ this.pastInput(-1, 1) + this.upcomingInput(-1, 1) + ' @ ' + JSON.stringify(yylloc)); /* b0rk on bad characters */ <*><> return 'EOF'; From 9320d0e5841fbc4ac07103bf29a60e5904e92fbb Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 9 Sep 2016 16:11:42 +0200 Subject: [PATCH 181/417] - using the new APIs from jison-lex to help improve the error output, showing slightly more context around any failure location in order to aid the user to locate and fix the issue in the source file(s). - bumped build revision --- lex-parser.js | 16 ++++++++++++++-- lex.l | 16 ++++++++++++++-- package.json | 2 +- 3 files changed, 29 insertions(+), 5 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 4ba2ffd..5db44cc 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3355,7 +3355,12 @@ break; case 74 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: . */ - throw new Error('unsupported input character: ' + yy_.yytext + ' (line: ' + /* current line content: */ this.pastInput(-1, 1) + this.upcomingInput(-1, 1) + ' @ ' + JSON.stringify(yy_.yylloc)); /* b0rk on bad characters */ + + var l1 = Math.min(79 - 3 - 6, yy_.yylloc.first_column); + var l2 = Math.min(79 - 3 - 6 - l2, 3); + var errdsc = this.showPosition(l1, l2); + throw new Error('unsupported input character: ' + yy_.yytext + '\n' + indent(errdsc, 6) + '\n @ ' + this.describeYYLLOC(yy_.yylloc)); /* b0rk on bad characters */ + break; case 78 : /*! Conditions:: set */ @@ -3397,7 +3402,9 @@ case 86 : /*! Rule:: . */ /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer input: ', yy_.yytext, ' @ ' + JSON.stringify(yy_.yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + var l1 = Math.min(76 - 4, yy_.yylloc.first_column); + var l2 = Math.min(76 - 4 - l2, 3); + console.warn('ignoring unsupported lexer input: ', yy_.yytext, ' @ ' + this.describeYYLLOC(yy_.yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); break; default: @@ -3933,6 +3940,11 @@ conditions: { } }; +function indent(s, i) { + var a = s.split('\n'); + var pf = (new Array(i + 1)).join(' '); + return pf + a.join('\n' + pf); +}; return lexer; })(); parser.lexer = lexer; diff --git a/lex.l b/lex.l index 8fee2f4..9717ba3 100644 --- a/lex.l +++ b/lex.l @@ -162,7 +162,12 @@ WS [^\S\r\n] "{" return '{'; "}" return '}'; -. throw new Error('unsupported input character: ' + yytext + ' (line: ' + /* current line content: */ this.pastInput(-1, 1) + this.upcomingInput(-1, 1) + ' @ ' + JSON.stringify(yylloc)); /* b0rk on bad characters */ +. %{ + var l1 = Math.min(79 - 3 - 6, yylloc.first_column); + var l2 = Math.min(79 - 3 - 6 - l2, 3); + var errdsc = this.showPosition(l1, l2); + throw new Error('unsupported input character: ' + yytext + '\n' + indent(errdsc, 6) + '\n @ ' + this.describeYYLLOC(yylloc)); /* b0rk on bad characters */ + %} <*><> return 'EOF'; @@ -187,8 +192,15 @@ WS [^\S\r\n] <*>. %{ /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + var l1 = Math.min(76 - 4, yylloc.first_column); + var l2 = Math.min(76 - 4 - l2, 3); + console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + this.describeYYLLOC(yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); %} %% +function indent(s, i) { + var a = s.split('\n'); + var pf = (new Array(i + 1)).join(' '); + return pf + a.join('\n' + pf); +} diff --git a/package.json b/package.json index 75068f8..dbb6946 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-139", + "version": "0.1.4-140", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 0501c651cd5076cb9392dd9e4fd60ed3b6e2436e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 9 Sep 2016 19:56:38 +0200 Subject: [PATCH 182/417] updated packages; regenerated library files --- lex-parser.js | 170 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 124 insertions(+), 46 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 5db44cc..955739c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-139 */ +/* parser generated by jison 0.4.17-140 */ /* * Returns a Parser object of the following structure: * @@ -2132,7 +2132,7 @@ parse: function parse(input) { table = this.table, sp = 0; // 'stack pointer': index into the stacks - + var recovering = 0; // (only used when the grammar contains error recovery rules) var TERROR = this.TERROR, EOF = this.EOF, @@ -2213,10 +2213,10 @@ parse: function parse(input) { // set up the cleanup function; make it an API so that external code can re-use this one in case of // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which // case this parse() API method doesn't come with a `finally { ... }` block any more! - // + // // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, // or else your `sharedState`, etc. references will be *wrong*! - // + // // The function resets itself to the previous set up one to support reentrant parsers. this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods) { var rv; @@ -2392,7 +2392,7 @@ parse: function parse(input) { if (!recovering) { // Report error if (lexer.showPosition) { - errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ':\n' + lexer.showPosition() + '\n'; + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ':\n' + lexer.showPosition(79 - 10, 10) + '\n'; } else { errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; } @@ -2449,7 +2449,7 @@ parse: function parse(input) { preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token symbol = TERROR; // insert generic error symbol as new lookahead // allow N (default: 3) real symbols to be shifted before reporting a new error - recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; + recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; newState = sstack[sp - 1]; @@ -2503,8 +2503,8 @@ parse: function parse(input) { // read action for current state and first input t = (table[newState] && table[newState][symbol]) || NO_ACTION; if (!t[0]) { - // forget about that symbol and move forward: this wasn't an 'forgot to insert' error type where - // (simple) stuff might have been missing before the token which caused the error we're + // forget about that symbol and move forward: this wasn't an 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're // recovering from now... symbol = 0; @@ -2624,7 +2624,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-139 */ +/* generated by jison-lex 0.3.4-140 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 @@ -2687,7 +2687,7 @@ var lexer = { // options: {}, // <-- injected by the code generator // yy: ..., // <-- injected by setInput() - + __currentRuleSet__: null, // <-- internal rule set cache for the current lexer state parseError: function lexer_parseError(str, hash) { @@ -2697,14 +2697,25 @@ var lexer = { throw new this.JisonLexerError(str); } }, - + + // clear the lexer token context; intended for internal use only + clear: function lexer_clear() { + this.yytext = ''; + this.yyleng = 0; + this.match = ''; + this.matches = false; + this._more = false; + this._backtrack = false; + }, + // resets the lexer, sets new input setInput: function lexer_setInput(input, yy) { this.yy = yy || this.yy || {}; this._input = input; - this._more = this._backtrack = this._signaled_error_token = this.done = false; - this.yylineno = this.yyleng = 0; - this.yytext = this.matched = this.match = ''; + this.clear(); + this._signaled_error_token = this.done = false; + this.yylineno = 0; + this.matched = ''; this.conditionStack = ['INITIAL']; this.__currentRuleSet__ = null; this.yylloc = { @@ -2831,48 +2842,124 @@ var lexer = { return this.unput(this.match.slice(n)); }, - // return (part of the) already matched input, i.e. for error messages - pastInput: function lexer_pastInput(maxSize) { - var past = this.matched.substr(0, this.matched.length - this.match.length); + // return (part of the) already matched input, i.e. for error messages. + // Limit the returned string length to `maxSize` (default: 20). + // Limit the returned string to the `maxLines` number of lines of input (default: 1). + // Negative limit values equal *unlimited*. + pastInput: function lexer_pastInput(maxSize, maxLines) { + var past = this.matched.substring(0, this.matched.length - this.match.length); if (maxSize < 0) maxSize = past.length; else if (!maxSize) maxSize = 20; - return (past.length > maxSize ? '...' + past.substr(-maxSize) : past); + if (maxLines < 0) + maxLines = past.length; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + // `substr` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + past = past.substr(-maxSize * 2 - 2); + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = past.replace(/\r\n|\r/g, '\n').split('\n'); + a = a.slice(-maxLines); + past = a.join('\n'); + // When, after limiting to maxLines, we still have to much to return, + // do add an ellipsis prefix... + if (past.length > maxSize) { + past = '...' + past.substr(-maxSize); + } + return past; }, - // return (part of the) upcoming input, i.e. for error messages - upcomingInput: function lexer_upcomingInput(maxSize) { + // return (part of the) upcoming input, i.e. for error messages. + // Limit the returned string length to `maxSize` (default: 20). + // Limit the returned string to the `maxLines` number of lines of input (default: 1). + // Negative limit values equal *unlimited*. + upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { var next = this.match; if (maxSize < 0) maxSize = next.length + this._input.length; else if (!maxSize) maxSize = 20; - if (next.length < maxSize) { - next += this._input.substr(0, maxSize - next.length); + if (maxLines < 0) + maxLines = maxSize; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + // `substring` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + if (next.length < maxSize * 2 + 2) { + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + } + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = next.replace(/\r\n|\r/g, '\n').split('\n'); + a = a.slice(0, maxLines); + next = a.join('\n'); + // When, after limiting to maxLines, we still have to much to return, + // do add an ellipsis postfix... + if (next.length > maxSize) { + next = next.substring(0, maxSize) + '...'; } - return (next.length > maxSize ? next.substr(0, maxSize) + '...' : next); + return next; }, // return a string which displays the character position where the lexing error occurred, i.e. for error messages - showPosition: function lexer_showPosition() { - var pre = this.pastInput().replace(/\s/g, ' '); + showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { + var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); var c = new Array(pre.length + 1).join('-'); - return pre + this.upcomingInput().replace(/\s/g, ' ') + '\n' + c + '^'; + return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; + }, + + // helper function, used to produce a human readable description as a string, given + // the input `yylloc` location object. + // Set `display_range_too` to TRUE to include the string character inex position(s) + // in the description if the `yylloc.range` is available. + describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { + var l1 = yylloc.first_line; + var l2 = yylloc.last_line; + var o1 = yylloc.first_column; + var o2 = yylloc.last_column - 1; + var dl = l2 - l1; + var d_o = (dl === 0 ? o2 - o1 : 1000); + var rv; + if (dl === 0) { + rv = 'line ' + l1 + ', '; + if (d_o === 0) { + rv += 'column ' + o1; + } else { + rv += 'columns ' + o1 + ' .. ' + o2; + } + } else { + rv = 'lines ' + l1 + '(column ' + o1 + ') .. ' + l2 + '(column ' + o2 + ')'; + } + if (yylloc.range && display_range_too) { + var r1 = yylloc.range[0]; + var r2 = yylloc.range[1] - 1; + if (r2 === r1) { + rv += ' {String Offset: ' + r1 + '}'; + } else { + rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; + } + } + return rv; + // return JSON.stringify(yylloc); }, // test the lexed token: return FALSE when not a match, otherwise return token. // - // `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + // `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` // contains the actually matched text string. - // + // // Also move the input cursor forward and update the match collectors: // - yytext // - yyleng // - match // - matches // - yylloc - // - offset + // - offset test_match: function lexer_test_match(match, indexed_rule) { var token, lines, @@ -2926,9 +3013,9 @@ var lexer = { if (this.options.ranges) { this.yylloc.range = [this.offset, this.offset + this.yyleng]; } - // previous lex rules MAY have invoked the `more()` API rather than producing a token: - // those rules will already have moved this `offset` forward matching their match lengths, - // hence we must only add our own match length now: + // previous lex rules MAY have invoked the `more()` API rather than producing a token: + // those rules will already have moved this `offset` forward matching their match lengths, + // hence we must only add our own match length now: this.offset += match_str.length; this._more = false; this._backtrack = false; @@ -2958,17 +3045,8 @@ var lexer = { // return next match in input next: function lexer_next() { - function clear() { - this.yytext = ''; - this.yyleng = 0; - this.match = ''; - this.matches = false; - this._more = false; - this._backtrack = false; - } - if (this.done) { - clear.call(this); + this.clear(); return this.EOF; } if (!this._input) { @@ -2980,7 +3058,7 @@ var lexer = { tempMatch, index; if (!this._more) { - clear.call(this); + this.clear(); } var rules = this.__currentRuleSet__; if (!rules) { @@ -3020,7 +3098,7 @@ var lexer = { return false; } if (this._input === '') { - clear.call(this); + this.clear(); this.done = true; return this.EOF; } else { @@ -3058,8 +3136,8 @@ var lexer = { return r; }, - // backwards compatible alias for `pushState()`; - // the latter is symmetrical with `popState()` and we advise to use + // backwards compatible alias for `pushState()`; + // the latter is symmetrical with `popState()` and we advise to use // those APIs in any modern lexer code, rather than `begin()`. begin: function lexer_begin(condition) { return this.pushState(condition); From fb5839d1debd051756d9534e29729ca72593d755 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 9 Sep 2016 20:32:32 +0200 Subject: [PATCH 183/417] ignore MAC/OSX cruft and copy/paste Travis CI YAML spec file to all sub-repos --- .gitignore | 1 + .travis.yml | 33 +++++++++++++++++++++++++++++++++ package.json | 3 +++ 3 files changed, 37 insertions(+) create mode 100644 .travis.yml diff --git a/.gitignore b/.gitignore index 5415a32..a08585b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +.DS_Store node_modules/ npm-debug.log diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..70987e2 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,33 @@ +language: node_js +node_js: + - 6 + - 6.0 + - 5 + - 5.0 + - 4 + - 4.0 + +# http://stackoverflow.com/questions/15674064/github-submodule-access-rights-travis-ci +# +# This can (thankfully) be easily solved by modifying the .gitmodules file on-the-fly on Travis, +# so that the SSH URL is replaced with the public URL, before initializing submodules. +# To accomplish this, add the following to .travis.yml: + +# Handle git submodules yourself +git: + submodules: false + +# Use sed to replace the SSH URL with the public URL, then initialize submodules +before_install: + - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules + - git submodule update --init --recursive + +# Thanks to Michael Iedema for his gist from which I derived this solution. +# +# If your submodules are private repositories, it should work to include credentials +# in the https URLs, I recommend making a GitHub access token with restricted permissions +# for this purpose: + +# # Replace and with your GitHub username and access token respectively +# - sed -i 's/git@github.com:/https:\/\/:@github.com\//' .gitmodules + diff --git a/package.json b/package.json index dbb6946..9dc2e79 100644 --- a/package.json +++ b/package.json @@ -22,6 +22,9 @@ "jison" ], "license": "MIT", + "engines": { + "node": ">=4.0" + }, "dependencies": { "xregexp": "GerHobbelt/xregexp#master" }, From d3a697a2d25bb4072afd6740bea2a271baceba45 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 9 Sep 2016 20:34:32 +0200 Subject: [PATCH 184/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9dc2e79..2657d3d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-140", + "version": "0.1.4-141", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 5c6e620fb32e7910888f6eedbc9698db68a936a1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 9 Sep 2016 20:40:33 +0200 Subject: [PATCH 185/417] fixed travis CI YAML spec for submodules --- .travis.yml | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/.travis.yml b/.travis.yml index 70987e2..7aa5c55 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,28 +6,3 @@ node_js: - 5.0 - 4 - 4.0 - -# http://stackoverflow.com/questions/15674064/github-submodule-access-rights-travis-ci -# -# This can (thankfully) be easily solved by modifying the .gitmodules file on-the-fly on Travis, -# so that the SSH URL is replaced with the public URL, before initializing submodules. -# To accomplish this, add the following to .travis.yml: - -# Handle git submodules yourself -git: - submodules: false - -# Use sed to replace the SSH URL with the public URL, then initialize submodules -before_install: - - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules - - git submodule update --init --recursive - -# Thanks to Michael Iedema for his gist from which I derived this solution. -# -# If your submodules are private repositories, it should work to include credentials -# in the https URLs, I recommend making a GitHub access token with restricted permissions -# for this purpose: - -# # Replace and with your GitHub username and access token respectively -# - sed -i 's/git@github.com:/https:\/\/:@github.com\//' .gitmodules - From 0ac595120ab851388b1440ebfaf892c020317e46 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 10 Sep 2016 04:24:53 +0200 Subject: [PATCH 186/417] bumped revision number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2657d3d..c74e0b0 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-141", + "version": "0.1.4-142", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From cef08f0426ef558a2b5e884554a9aee21a873ef8 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 10 Sep 2016 04:41:52 +0200 Subject: [PATCH 187/417] point jison npm dependencies inside submodules to our travis-ci branch to prevent npm3 from attempting to installing the (unused) submodules there --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c74e0b0..c3582d9 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "xregexp": "GerHobbelt/xregexp#master" }, "devDependencies": { - "jison": "GerHobbelt/jison#master", + "jison": "GerHobbelt/jison#travis-ci", "test": ">=0.6.0" } } From 903287644ce40f4efb29b9d0e5cf40aff800dc5a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 10 Sep 2016 05:26:58 +0200 Subject: [PATCH 188/417] revert the submodule hacking for travisCI --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index c3582d9..c74e0b0 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "xregexp": "GerHobbelt/xregexp#master" }, "devDependencies": { - "jison": "GerHobbelt/jison#travis-ci", + "jison": "GerHobbelt/jison#master", "test": ">=0.6.0" } } From 189d778ee8765c25df694f239f66041b90706ab9 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 10 Sep 2016 06:00:17 +0200 Subject: [PATCH 189/417] debug issue on Linux: one of the ebnf tests barfs :-S --- lex.y | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lex.y b/lex.y index 7d01ce3..58d373f 100644 --- a/lex.y +++ b/lex.y @@ -235,8 +235,10 @@ regex .replace(/"/g, '.' /* '\\"' */) .replace(/\\c[A-Z]/g, '.') .replace(/\\[^xu0-9]/g, '.'); + console.warn('easy-keyword-rule before test: ', '"' + this.$ + '"'); $$ = JSON.parse('"' + $$ + '"'); + console.warn('easy-keyword-rule after test: ', '"' + this.$ + '"', this.$.match(/\w[\w\d]*$/u)); // a 'keyword' starts with an alphanumeric character, // followed by zero or more alphanumerics or digits: if ($$.match(/\w[\w\d]*$/u)) { From db2e45bb13d3594d13240196f16cdfeb141b710d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 10 Sep 2016 06:25:38 +0200 Subject: [PATCH 190/417] debugging... --- lex-parser.js | 7 +++++-- lex.y | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 955739c..6ab17dc 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-140 */ +/* parser generated by jison 0.4.17-142 */ /* * Returns a Parser object of the following structure: * @@ -989,6 +989,7 @@ case 38: // interested in the trailing boundary and patching that one for // the `easy_keyword_rules` option. this.$ = $$[$0]; + console.warn('easy-keyword-rule active? ', yy.options); if (yy.options.easy_keyword_rules) { try { // We need to 'protect' JSON.parse here as keywords are allowed @@ -1005,8 +1006,10 @@ case 38: .replace(/"/g, '.' /* '\\"' */) .replace(/\\c[A-Z]/g, '.') .replace(/\\[^xu0-9]/g, '.'); + console.warn('easy-keyword-rule before test: ', '"' + this.$ + '"'); this.$ = JSON.parse('"' + this.$ + '"'); + console.warn('easy-keyword-rule after test: ', '"' + this.$ + '"', this.$.match(/\w[\w\d]*$/u)); // a 'keyword' starts with an alphanumeric character, // followed by zero or more alphanumerics or digits: if (this.$.match(/\w[\w\d]*$/u)) { @@ -2624,7 +2627,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-140 */ +/* generated by jison-lex 0.3.4-142 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 diff --git a/lex.y b/lex.y index 58d373f..81009dc 100644 --- a/lex.y +++ b/lex.y @@ -219,6 +219,7 @@ regex // interested in the trailing boundary and patching that one for // the `easy_keyword_rules` option. $$ = $re; + console.warn('easy-keyword-rule active? ', yy.options); if (yy.options.easy_keyword_rules) { try { // We need to 'protect' JSON.parse here as keywords are allowed From 87afdaea44ac92ac63873a5a16d9be7439549362 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 11 Sep 2016 18:33:36 +0200 Subject: [PATCH 191/417] - fix lexer: try/catch in easy-keyword-rule handling was too lenient and hid platform-specific trouble with the regex /u flag (not support in older NodeJS) + fix: use XRegExp in lexer to enable Unicode keyword support on all platforms - replaced `JSON.parse` with `eval` which is safe to use here and supports octal escapes; any eval failures are caught using try/catch and flagged as non-keyword, which is safe behaviour. - bumped build revision --- lex-parser.js | 63 +++++++++++++++++++++------------------- lex.y | 79 ++++++++++++++++++++++++++------------------------- package.json | 2 +- 3 files changed, 75 insertions(+), 69 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 6ab17dc..563780d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -762,7 +762,7 @@ case 1: var asrc = yy.actionInclude.join('\n\n'); // Only a non-empty action code chunk should actually make it through: if (asrc.trim() !== '') { - this.$.actionInclude = asrc; + this.$.actionInclude = asrc; } } delete yy.options; @@ -967,7 +967,7 @@ case 37: case 38: /*! Production:: regex : nonempty_regex_list[re] */ // Detect if the regex ends with a pure (Unicode) word; - // we *do* consider escaped characters which are 'alphanumeric' + // we *do* consider escaped characters which are 'alphanumeric' // to be equivalent to their non-escaped version, hence these are // all valid 'words' for the 'easy keyword rules' option: // @@ -981,7 +981,7 @@ case 38: // 'easy keywords': // // - %options - // - %foo-bar + // - %foo-bar // - +++a:b:c1 // // Note the dash in that last example: there the code will consider @@ -989,35 +989,38 @@ case 38: // interested in the trailing boundary and patching that one for // the `easy_keyword_rules` option. this.$ = $$[$0]; - console.warn('easy-keyword-rule active? ', yy.options); if (yy.options.easy_keyword_rules) { + // We need to 'protect' `eval` here as keywords are allowed + // to contain double-quotes and other leading cruft. + // `eval` *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `eval(str)` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. + this.$ = this.$ + .replace(/\\\\/g, '.') + .replace(/"/g, '.') + .replace(/\\c[A-Z]/g, '.') + .replace(/\\[^xu0-9]/g, '.'); + try { - // We need to 'protect' JSON.parse here as keywords are allowed - // to contain double-quotes and other leading cruft. - // JSON.parse *does* gobble some escapes (such as `\b`) but - // we protect against that through a simple replace regex: - // we're not interested in the special escapes' exact value - // anyway. - // It will also catch escaped escapes (`\\`), which are not - // word characters either, so no need to worry about - // `JSON.parse()` 'correctly' converting convoluted constructs - // like '\\\\\\\\\\b' in here. - this.$ = this.$ - .replace(/"/g, '.' /* '\\"' */) - .replace(/\\c[A-Z]/g, '.') - .replace(/\\[^xu0-9]/g, '.'); - console.warn('easy-keyword-rule before test: ', '"' + this.$ + '"'); + this.$ = eval('"' + this.$ + '"'); + } + catch (ex) { + console.warn('easy-keyword-rule FAIL on eval: ', ex); - this.$ = JSON.parse('"' + this.$ + '"'); - console.warn('easy-keyword-rule after test: ', '"' + this.$ + '"', this.$.match(/\w[\w\d]*$/u)); - // a 'keyword' starts with an alphanumeric character, - // followed by zero or more alphanumerics or digits: - if (this.$.match(/\w[\w\d]*$/u)) { - this.$ = $$[$0] + "\\b"; - } else { - this.$ = $$[$0]; - } - } catch (ex) { + // make the next keyword test fail: + this.$ = '.'; + } + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: + var re = XRegExp('\\w[\\w\\d]*$', 'u'); + if (XRegExp.match(this.$, re)) { + this.$ = $$[$0] + "\\b"; + } else { this.$ = $$[$0]; } } @@ -1092,7 +1095,7 @@ case 78: case 66: /*! Production:: regex_set_atom : name_expansion */ - if (XRegExp._getUnicodeProperty($$[$0].replace(/[{}]/g, '')) + if (XRegExp._getUnicodeProperty($$[$0].replace(/[{}]/g, '')) && $$[$0].toUpperCase() !== $$[$0] ) { // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories diff --git a/lex.y b/lex.y index 81009dc..4f29c3c 100644 --- a/lex.y +++ b/lex.y @@ -25,7 +25,7 @@ lex var asrc = yy.actionInclude.join('\n\n'); // Only a non-empty action code chunk should actually make it through: if (asrc.trim() !== '') { - $$.actionInclude = asrc; + $$.actionInclude = asrc; } } delete yy.options; @@ -34,18 +34,18 @@ lex } ; -/* - * WARNING: when you want to refactor this rule, you'll get into a world of hurt +/* + * WARNING: when you want to refactor this rule, you'll get into a world of hurt * as then the grammar won't be LALR(1) any longer! The shite start to happen * as soon as you take away the EOF in here and move it to the top grammar rule * where it really belongs. Other refactorings of this rule to reduce the code * duplication in these action blocks leads to the same effect, thanks to the * different refactored rules then fighting it out in reduce/reduce conflicts * thanks to the epsilon rules everywhere in there. You have been warned... - */ + */ rules_and_epilogue - : EOF - /* an empty rules set is allowed when you are setting up an `%options custom_lexer` */ + : EOF + /* an empty rules set is allowed when you are setting up an `%options custom_lexer` */ { $$ = { rules: [] }; } @@ -71,7 +71,7 @@ rules_and_epilogue } ; -// because JISON doesn't support mid-rule actions, +// because JISON doesn't support mid-rule actions, // we set up `yy` using this empty rule at the start: init : ε @@ -197,7 +197,7 @@ regex : nonempty_regex_list[re] { // Detect if the regex ends with a pure (Unicode) word; - // we *do* consider escaped characters which are 'alphanumeric' + // we *do* consider escaped characters which are 'alphanumeric' // to be equivalent to their non-escaped version, hence these are // all valid 'words' for the 'easy keyword rules' option: // @@ -211,7 +211,7 @@ regex // 'easy keywords': // // - %options - // - %foo-bar + // - %foo-bar // - +++a:b:c1 // // Note the dash in that last example: there the code will consider @@ -219,35 +219,38 @@ regex // interested in the trailing boundary and patching that one for // the `easy_keyword_rules` option. $$ = $re; - console.warn('easy-keyword-rule active? ', yy.options); if (yy.options.easy_keyword_rules) { + // We need to 'protect' `eval` here as keywords are allowed + // to contain double-quotes and other leading cruft. + // `eval` *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `eval(str)` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. + $$ = $$ + .replace(/\\\\/g, '.') + .replace(/"/g, '.') + .replace(/\\c[A-Z]/g, '.') + .replace(/\\[^xu0-9]/g, '.'); + try { - // We need to 'protect' JSON.parse here as keywords are allowed - // to contain double-quotes and other leading cruft. - // JSON.parse *does* gobble some escapes (such as `\b`) but - // we protect against that through a simple replace regex: - // we're not interested in the special escapes' exact value - // anyway. - // It will also catch escaped escapes (`\\`), which are not - // word characters either, so no need to worry about - // `JSON.parse()` 'correctly' converting convoluted constructs - // like '\\\\\\\\\\b' in here. - $$ = $$ - .replace(/"/g, '.' /* '\\"' */) - .replace(/\\c[A-Z]/g, '.') - .replace(/\\[^xu0-9]/g, '.'); - console.warn('easy-keyword-rule before test: ', '"' + this.$ + '"'); - - $$ = JSON.parse('"' + $$ + '"'); - console.warn('easy-keyword-rule after test: ', '"' + this.$ + '"', this.$.match(/\w[\w\d]*$/u)); - // a 'keyword' starts with an alphanumeric character, - // followed by zero or more alphanumerics or digits: - if ($$.match(/\w[\w\d]*$/u)) { - $$ = $re + "\\b"; - } else { - $$ = $re; - } - } catch (ex) { + $$ = eval('"' + $$ + '"'); + } + catch (ex) { + console.warn('easy-keyword-rule FAIL on eval: ', ex); + + // make the next keyword test fail: + $$ = '.'; + } + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: + var re = XRegExp('\\w[\\w\\d]*$', 'u'); + if (XRegExp.match($$, re)) { + $$ = $re + "\\b"; + } else { $$ = $re; } } @@ -321,8 +324,8 @@ regex_set regex_set_atom : REGEX_SET | name_expansion - { - if (XRegExp._getUnicodeProperty($name_expansion.replace(/[{}]/g, '')) + { + if (XRegExp._getUnicodeProperty($name_expansion.replace(/[{}]/g, '')) && $name_expansion.toUpperCase() !== $name_expansion ) { // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories diff --git a/package.json b/package.json index c74e0b0..679caae 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-142", + "version": "0.1.4-143", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From ec579042fcc5ccecc97d2060b9f6141606afec20 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 11 Sep 2016 18:42:09 +0200 Subject: [PATCH 192/417] regenerated library files --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 563780d..09ce317 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-142 */ +/* parser generated by jison 0.4.17-143 */ /* * Returns a Parser object of the following structure: * @@ -2630,7 +2630,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-142 */ +/* generated by jison-lex 0.3.4-143 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From c6ac818acf404fd563c8df8bd4549f3332d0a23c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Sep 2016 16:17:04 +0200 Subject: [PATCH 193/417] bumped build revision and regenerated library files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 679caae..9562d7e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-143", + "version": "0.1.4-144", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 6cfcf73dc87c1b8bbecf20648ad1dfd859abbf77 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Sep 2016 16:45:03 +0200 Subject: [PATCH 194/417] rebuild --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 09ce317..8a1b366 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-143 */ +/* parser generated by jison 0.4.17-144 */ /* * Returns a Parser object of the following structure: * @@ -2630,7 +2630,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-143 */ +/* generated by jison-lex 0.3.4-144 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From 2dacfe3007c6d1eaf77bd677027262de81f823aa Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Sep 2016 17:35:02 +0200 Subject: [PATCH 195/417] rebuild --- lex-parser.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8a1b366..e08628d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2145,8 +2145,6 @@ parse: function parse(input) { ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; var NO_ACTION = [0, table.length /* ensures that anyone using this new state will fail dramatically! */]; - var args = stack.slice.call(arguments, 1); - //this.reductionCount = this.shiftCount = 0; var lexer; @@ -2229,11 +2227,11 @@ parse: function parse(input) { if (invoke_post_methods) { if (sharedState.yy.post_parse) { - rv = sharedState.yy.post_parse.apply(this, [sharedState.yy, resultValue].concat(args)); + rv = sharedState.yy.post_parse.apply(this, [sharedState.yy, resultValue]); if (typeof rv !== 'undefined') resultValue = rv; } if (this.post_parse) { - rv = this.post_parse.apply(this, [sharedState.yy, resultValue].concat(args)); + rv = this.post_parse.apply(this, [sharedState.yy, resultValue]); if (typeof rv !== 'undefined') resultValue = rv; } } @@ -2356,10 +2354,10 @@ parse: function parse(input) { this.__reentrant_call_depth++; if (this.pre_parse) { - this.pre_parse.apply(this, [sharedState.yy].concat(args)); + this.pre_parse.apply(this, [sharedState.yy]); } if (sharedState.yy.pre_parse) { - sharedState.yy.pre_parse.apply(this, [sharedState.yy].concat(args)); + sharedState.yy.pre_parse.apply(this, [sharedState.yy]); } newState = sstack[sp - 1]; @@ -2549,7 +2547,7 @@ parse: function parse(input) { - r = this.performAction.apply(yyval, [yytext, sharedState.yy, newState, sp - 1, vstack].concat(args)); + r = this.performAction.apply(yyval, [yytext, sharedState.yy, newState, sp - 1, vstack]); if (typeof r !== 'undefined') { retval = r; From d0c541b842245fae5bba3637ada2edf179a1a57f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Sep 2016 17:56:24 +0200 Subject: [PATCH 196/417] rebuild --- lex-parser.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index e08628d..ea9b065 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2227,11 +2227,11 @@ parse: function parse(input) { if (invoke_post_methods) { if (sharedState.yy.post_parse) { - rv = sharedState.yy.post_parse.apply(this, [sharedState.yy, resultValue]); + rv = sharedState.yy.post_parse.call(this, sharedState.yy, resultValue); if (typeof rv !== 'undefined') resultValue = rv; } if (this.post_parse) { - rv = this.post_parse.apply(this, [sharedState.yy, resultValue]); + rv = this.post_parse.call(this, sharedState.yy, resultValue); if (typeof rv !== 'undefined') resultValue = rv; } } @@ -2354,10 +2354,10 @@ parse: function parse(input) { this.__reentrant_call_depth++; if (this.pre_parse) { - this.pre_parse.apply(this, [sharedState.yy]); + this.pre_parse.call(this, sharedState.yy); } if (sharedState.yy.pre_parse) { - sharedState.yy.pre_parse.apply(this, [sharedState.yy]); + sharedState.yy.pre_parse.call(this, sharedState.yy); } newState = sstack[sp - 1]; @@ -2547,7 +2547,7 @@ parse: function parse(input) { - r = this.performAction.apply(yyval, [yytext, sharedState.yy, newState, sp - 1, vstack]); + r = this.performAction.call(yyval, yytext, sharedState.yy, newState, sp - 1, vstack); if (typeof r !== 'undefined') { retval = r; From ec872a98f39c9684b7addc330c68cdf04d08744d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Sep 2016 23:34:33 +0200 Subject: [PATCH 197/417] bump build revision number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9562d7e..9f8837f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-144", + "version": "0.1.4-145", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 860b96429c147eca4a611ae7a7e011673b403246 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 16 Sep 2016 01:05:00 +0200 Subject: [PATCH 198/417] bumped build version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9f8837f..61ecd11 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-145", + "version": "0.1.4-147", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From bd3011def38b53e412097340014d38a4b75bcb54 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 18 Sep 2016 12:09:46 +0200 Subject: [PATCH 199/417] rebuild lib --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index ea9b065..e023d6a 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.17-144 */ +/* parser generated by jison 0.4.18-147 */ /* * Returns a Parser object of the following structure: * @@ -2628,7 +2628,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-144 */ +/* generated by jison-lex 0.3.4-147 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From ed6ffa86de0aad46c3e41e2be8c01b65a0579a1b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 18 Sep 2016 12:11:09 +0200 Subject: [PATCH 200/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 61ecd11..88f1753 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-147", + "version": "0.1.4-148", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 3fc82246dac2564b678f2e382993aad90a0f90a4 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 18 Sep 2016 12:53:40 +0200 Subject: [PATCH 201/417] rebuild lib --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index e023d6a..95a6718 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-147 */ +/* parser generated by jison 0.4.18-148 */ /* * Returns a Parser object of the following structure: * @@ -2628,7 +2628,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-147 */ +/* generated by jison-lex 0.3.4-148 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From bd34266a75523d0578ab329841bba986055c377b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 18 Sep 2016 12:56:00 +0200 Subject: [PATCH 202/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 88f1753..528cf59 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-148", + "version": "0.1.4-149", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 549d84e4254a319703d275163ca81c50010f9441 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 18 Sep 2016 17:47:59 +0200 Subject: [PATCH 203/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 528cf59..7f6b491 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-149", + "version": "0.1.4-150", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 176467ea15165ca6cfb69469a888a722992c7311 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 18 Sep 2016 22:27:47 +0200 Subject: [PATCH 204/417] rebuild lib --- lex-parser.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 95a6718..c613865 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-148 */ +/* parser generated by jison 0.4.18-150 */ /* * Returns a Parser object of the following structure: * @@ -2220,8 +2220,6 @@ parse: function parse(input) { // // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, // or else your `sharedState`, etc. references will be *wrong*! - // - // The function resets itself to the previous set up one to support reentrant parsers. this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods) { var rv; @@ -2628,7 +2626,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-148 */ +/* generated by jison-lex 0.3.4-150 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From 270039393c00b4309f2f52fe83f4cb05a7fd19c5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 18 Sep 2016 22:29:53 +0200 Subject: [PATCH 205/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7f6b491..fad7edd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-150", + "version": "0.1.4-151", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 6489f7ce9cf9fb298384b666a36d2c21ad53c646 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 18 Sep 2016 23:19:54 +0200 Subject: [PATCH 206/417] rebuild lib --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index c613865..3212bb9 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-150 */ +/* parser generated by jison 0.4.18-151 */ /* * Returns a Parser object of the following structure: * @@ -2626,7 +2626,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-150 */ +/* generated by jison-lex 0.3.4-151 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From d9d5e5b4d1cf4d8e7e4bebeded2efa5c95629a9c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 18 Sep 2016 23:33:33 +0200 Subject: [PATCH 207/417] rebuild lib --- lex-parser.js | 120 +++++++++++++++++++++++++------------------------- 1 file changed, 60 insertions(+), 60 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 3212bb9..4b51329 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -40,7 +40,7 @@ * terminal_descriptions_: (if there are any) {associative list: number ==> description}, * productions_: [...], * - * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yy, yystate, $0, $$, _$, yystack, yysstack, ...), + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yy, yystate, $0, yyvstack, yylstack, yystack, yysstack, ...), * where `...` denotes the (optional) additional arguments the user passed to * `parser.parse(str, ...)` * @@ -742,16 +742,16 @@ productions_: bp({ 0 ]) }), -performAction: function parser__PerformAction(yytext, yy, yystate /* action[1] */, $0, $$ /* vstack */) { +performAction: function parser__PerformAction(yytext, yy, yystate /* action[1] */, $0, yyvstack) { /* this == yyval */ switch (yystate) { case 1: /*! Production:: lex : init definitions '%%' rules_and_epilogue */ - this.$ = $$[$0]; - if ($$[$0 - 2][0]) this.$.macros = $$[$0 - 2][0]; - if ($$[$0 - 2][1]) this.$.startConditions = $$[$0 - 2][1]; - if ($$[$0 - 2][2]) this.$.unknownDecls = $$[$0 - 2][2]; + this.$ = yyvstack[$0]; + if (yyvstack[$0 - 2][0]) this.$.macros = yyvstack[$0 - 2][0]; + if (yyvstack[$0 - 2][1]) this.$.startConditions = yyvstack[$0 - 2][1]; + if (yyvstack[$0 - 2][2]) this.$.unknownDecls = yyvstack[$0 - 2][2]; // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { @@ -777,8 +777,8 @@ case 2: case 3: /*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { - this.$ = { rules: [], moduleInclude: $$[$0 - 1] }; + if (yyvstack[$0 - 1] && yyvstack[$0 - 1].trim() !== '') { + this.$ = { rules: [], moduleInclude: yyvstack[$0 - 1] }; } else { this.$ = { rules: [] }; } @@ -786,16 +786,16 @@ case 3: case 4: /*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code EOF */ - if ($$[$0 - 1] && $$[$0 - 1].trim() !== '') { - this.$ = { rules: $$[$0 - 3], moduleInclude: $$[$0 - 1] }; + if (yyvstack[$0 - 1] && yyvstack[$0 - 1].trim() !== '') { + this.$ = { rules: yyvstack[$0 - 3], moduleInclude: yyvstack[$0 - 1] }; } else { - this.$ = { rules: $$[$0 - 3] }; + this.$ = { rules: yyvstack[$0 - 3] }; } break; case 5: /*! Production:: rules_and_epilogue : rules EOF */ - this.$ = { rules: $$[$0 - 1] }; + this.$ = { rules: yyvstack[$0 - 1] }; break; case 6: @@ -806,19 +806,19 @@ case 6: case 7: /*! Production:: definitions : definition definitions */ - this.$ = $$[$0]; - if ($$[$0 - 1] != null) { - if ('length' in $$[$0 - 1]) { + this.$ = yyvstack[$0]; + if (yyvstack[$0 - 1] != null) { + if ('length' in yyvstack[$0 - 1]) { this.$[0] = this.$[0] || {}; - this.$[0][$$[$0 - 1][0]] = $$[$0 - 1][1]; - } else if ($$[$0 - 1].type === 'names') { + this.$[0][yyvstack[$0 - 1][0]] = yyvstack[$0 - 1][1]; + } else if (yyvstack[$0 - 1].type === 'names') { this.$[1] = this.$[1] || {}; - for (var name in $$[$0 - 1].names) { - this.$[1][name] = $$[$0 - 1].names[name]; + for (var name in yyvstack[$0 - 1].names) { + this.$[1][name] = yyvstack[$0 - 1].names[name]; } - } else if ($$[$0 - 1].type === 'unknown') { + } else if (yyvstack[$0 - 1].type === 'unknown') { this.$[2] = this.$[2] || []; - this.$[2].push($$[$0 - 1].body); + this.$[2].push(yyvstack[$0 - 1].body); } } break; @@ -830,7 +830,7 @@ case 8: case 9: /*! Production:: definition : NAME regex */ - this.$ = [$$[$0 - 1], $$[$0]]; + this.$ = [yyvstack[$0 - 1], yyvstack[$0]]; break; case 10: @@ -853,19 +853,19 @@ case 81: /*! Production:: module_code_chunk : CODE */ case 83: /*! Production:: optional_module_code_chunk : module_code_chunk */ - this.$ = $$[$0]; + this.$ = yyvstack[$0]; break; case 12: /*! Production:: definition : '{' action_body '}' */ - yy.actionInclude.push($$[$0 - 1]); this.$ = null; + yy.actionInclude.push(yyvstack[$0 - 1]); this.$ = null; break; case 13: /*! Production:: definition : ACTION */ case 14: /*! Production:: definition : include_macro_code */ - yy.actionInclude.push($$[$0]); this.$ = null; + yy.actionInclude.push(yyvstack[$0]); this.$ = null; break; case 15: @@ -875,61 +875,61 @@ case 15: case 16: /*! Production:: definition : UNKNOWN_DECL */ - this.$ = {type: 'unknown', body: $$[$0]}; + this.$ = {type: 'unknown', body: yyvstack[$0]}; break; case 17: /*! Production:: names_inclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 0; break; case 18: /*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 0; + this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 0; break; case 19: /*! Production:: names_exclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 1; break; case 20: /*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = $$[$0 - 1]; this.$.names[$$[$0]] = 1; + this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 1; break; case 21: /*! Production:: rules : rules rule */ - this.$ = $$[$0 - 1]; this.$.push($$[$0]); + this.$ = yyvstack[$0 - 1]; this.$.push(yyvstack[$0]); break; case 22: /*! Production:: rules : rule */ case 36: /*! Production:: name_list : NAME */ - this.$ = [$$[$0]]; + this.$ = [yyvstack[$0]]; break; case 23: /*! Production:: rule : start_conditions regex action */ - this.$ = $$[$0 - 2] ? [$$[$0 - 2], $$[$0 - 1], $$[$0]] : [$$[$0 - 1], $$[$0]]; + this.$ = yyvstack[$0 - 2] ? [yyvstack[$0 - 2], yyvstack[$0 - 1], yyvstack[$0]] : [yyvstack[$0 - 1], yyvstack[$0]]; break; case 24: /*! Production:: action : '{' action_body '}' */ case 33: /*! Production:: start_conditions : '<' name_list '>' */ - this.$ = $$[$0 - 1]; + this.$ = yyvstack[$0 - 1]; break; case 28: /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ - this.$ = $$[$0 - 1] + '\n' + $$[$0]; + this.$ = yyvstack[$0 - 1] + '\n' + yyvstack[$0]; break; case 30: /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ - this.$ = $$[$0 - 4] + $$[$0 - 3] + $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + this.$ = yyvstack[$0 - 4] + yyvstack[$0 - 3] + yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; break; case 31: @@ -951,7 +951,7 @@ case 63: /*! Production:: regex_set : regex_set_atom regex_set */ case 82: /*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = $$[$0 - 1] + $$[$0]; + this.$ = yyvstack[$0 - 1] + yyvstack[$0]; break; case 34: @@ -961,7 +961,7 @@ case 34: case 37: /*! Production:: name_list : name_list ',' NAME */ - this.$ = $$[$0 - 2]; this.$.push($$[$0]); + this.$ = yyvstack[$0 - 2]; this.$.push(yyvstack[$0]); break; case 38: @@ -988,7 +988,7 @@ case 38: // `bar` to be the keyword, which is fine with us as we're only // interested in the trailing boundary and patching that one for // the `easy_keyword_rules` option. - this.$ = $$[$0]; + this.$ = yyvstack[$0]; if (yy.options.easy_keyword_rules) { // We need to 'protect' `eval` here as keywords are allowed // to contain double-quotes and other leading cruft. @@ -1019,56 +1019,56 @@ case 38: // followed by zero or more alphanumerics or digits: var re = XRegExp('\\w[\\w\\d]*$', 'u'); if (XRegExp.match(this.$, re)) { - this.$ = $$[$0] + "\\b"; + this.$ = yyvstack[$0] + "\\b"; } else { - this.$ = $$[$0]; + this.$ = yyvstack[$0]; } } break; case 41: /*! Production:: nonempty_regex_list : regex_concat '|' regex_list */ - this.$ = $$[$0 - 2] + '|' + $$[$0]; + this.$ = yyvstack[$0 - 2] + '|' + yyvstack[$0]; break; case 42: /*! Production:: nonempty_regex_list : '|' regex_list */ - this.$ = '|' + $$[$0]; + this.$ = '|' + yyvstack[$0]; break; case 46: /*! Production:: regex_base : '(' regex_list ')' */ - this.$ = '(' + $$[$0 - 1] + ')'; + this.$ = '(' + yyvstack[$0 - 1] + ')'; break; case 47: /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + ')'; + this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + ')'; break; case 48: /*! Production:: regex_base : regex_base '+' */ - this.$ = $$[$0 - 1] + '+'; + this.$ = yyvstack[$0 - 1] + '+'; break; case 49: /*! Production:: regex_base : regex_base '*' */ - this.$ = $$[$0 - 1] + '*'; + this.$ = yyvstack[$0 - 1] + '*'; break; case 50: /*! Production:: regex_base : regex_base '?' */ - this.$ = $$[$0 - 1] + '?'; + this.$ = yyvstack[$0 - 1] + '?'; break; case 51: /*! Production:: regex_base : '/' regex_base */ - this.$ = '(?=' + $$[$0] + ')'; + this.$ = '(?=' + yyvstack[$0] + ')'; break; case 52: /*! Production:: regex_base : '/!' regex_base */ - this.$ = '(?!' + $$[$0] + ')'; + this.$ = '(?!' + yyvstack[$0] + ')'; break; case 56: @@ -1090,45 +1090,45 @@ case 62: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ case 78: /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = $$[$0 - 2] + $$[$0 - 1] + $$[$0]; + this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; break; case 66: /*! Production:: regex_set_atom : name_expansion */ - if (XRegExp._getUnicodeProperty($$[$0].replace(/[{}]/g, '')) - && $$[$0].toUpperCase() !== $$[$0] + if (XRegExp._getUnicodeProperty(yyvstack[$0].replace(/[{}]/g, '')) + && yyvstack[$0].toUpperCase() !== yyvstack[$0] ) { // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories - this.$ = $$[$0]; + this.$ = yyvstack[$0]; } else { - this.$ = $$[$0]; + this.$ = yyvstack[$0]; } //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; case 69: /*! Production:: string : STRING_LIT */ - this.$ = prepareString($$[$0].substr(1, $$[$0].length - 2)); + this.$ = prepareString(yyvstack[$0].substr(1, yyvstack[$0].length - 2)); break; case 74: /*! Production:: option : NAME[option] */ - yy.options[$$[$0]] = true; + yy.options[yyvstack[$0]] = true; break; case 75: /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ case 76: /*! Production:: option : NAME[option] '=' NAME[value] */ - yy.options[$$[$0 - 2]] = $$[$0]; + yy.options[yyvstack[$0 - 2]] = yyvstack[$0]; break; case 79: /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); - var fileContent = fs.readFileSync($$[$0], { encoding: 'utf-8' }); + var fileContent = fs.readFileSync(yyvstack[$0], { encoding: 'utf-8' }); // And no, we don't support nested '%include': - this.$ = '\n// Included by Jison: ' + $$[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $$[$0] + '\n\n'; + this.$ = '\n// Included by Jison: ' + yyvstack[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[$0] + '\n\n'; break; case 80: From 86f2be0de37d7e75f38fd89a7e11331f5672b994 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 19 Sep 2016 01:18:37 +0200 Subject: [PATCH 208/417] rebuild lib --- lex-parser.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 4b51329..05c04f1 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2319,7 +2319,10 @@ parse: function parse(input) { var symbol = 0; var preErrorSymbol = 0; var state, action, r, t; - var yyval = {}; + var yyval = { + $: true, + _$: undefined + }; var p, len, this_production; var newState; From a94968570becb2277fc2f0dbe0019facf2300733 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 19 Sep 2016 01:43:16 +0200 Subject: [PATCH 209/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index fad7edd..1c6220a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-151", + "version": "0.1.4-152", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From ec61935083e5efaaaa9d609cf4f20016b89070c4 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 19 Sep 2016 02:01:42 +0200 Subject: [PATCH 210/417] rebuild lib --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 05c04f1..18127c9 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-151 */ +/* parser generated by jison 0.4.18-152 */ /* * Returns a Parser object of the following structure: * @@ -2629,7 +2629,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-151 */ +/* generated by jison-lex 0.3.4-152 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From 04d4ec07292e9334b13f318961d6d032e36dc0dd Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 19 Sep 2016 02:16:01 +0200 Subject: [PATCH 211/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 1c6220a..2b0c81f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-152", + "version": "0.1.4-153", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 78aa5717980c19a57b2da12eac808b66aa867efd Mon Sep 17 00:00:00 2001 From: shanavas Date: Fri, 28 Oct 2016 22:30:57 +0300 Subject: [PATCH 212/417] Fix repository field in package.json --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a95535a..65f2d46 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "repository": { "type": "git", - "repository": "https://github.com/zaach/lex-parser.git" + "url": "https://github.com/zaach/lex-parser.git" }, "keywords": [ "lexical", From bbbf9d9ef2ad2d5d0510b22bccf7882f0fb5fd4e Mon Sep 17 00:00:00 2001 From: Pirate Praveen Arimbrathodiyil Date: Sat, 29 Oct 2016 14:49:13 +0530 Subject: [PATCH 213/417] fix package.json repository url Fix for #10 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a95535a..65f2d46 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ }, "repository": { "type": "git", - "repository": "https://github.com/zaach/lex-parser.git" + "url": "https://github.com/zaach/lex-parser.git" }, "keywords": [ "lexical", From aaf6a25b9298c11e27e5a6b9782c3d04a11147ed Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 9 Nov 2016 17:49:15 +0100 Subject: [PATCH 214/417] regenerated library --- lex-parser.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 18127c9..e2e9a61 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-152 */ +/* parser generated by jison 0.4.18-153 */ /* * Returns a Parser object of the following structure: * @@ -2132,7 +2132,7 @@ parseError: function parseError(str, hash) { parse: function parse(input) { var self = this, stack = new Array(128), // token stack: stores token which leads to state at the same index (column storage) - sstack = new Array(128), // state stack: stores states + sstack = new Array(128), // state stack: stores states (column storage) vstack = new Array(128), // semantic value stack @@ -2629,7 +2629,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-152 */ +/* generated by jison-lex 0.3.4-153 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From dc6d365183cf4b63cb5ff967f9b4cd4e85632b1c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 11 Nov 2016 03:27:48 +0100 Subject: [PATCH 215/417] added `%options XregExp` to include full support for Unicode regexes and regex minification (see the jison and jison-lex repos for the work done on the latter subject) --- lex-parser.js | 5 +++-- lex.l | 10 ++-------- lex.y | 3 ++- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index e2e9a61..2c0acb0 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2617,7 +2617,7 @@ parse: function parse(input) { }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -var XRegExp = require('xregexp'); +var XRegExp = require('xregexp'); // for helping out the `%options xregexp` in the lexer function encodeRE (s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); @@ -3191,7 +3191,8 @@ var lexer = { }, options: { easy_keyword_rules: true, - ranges: true + ranges: true, + xregexp: true }, JisonLexerError: JisonLexerError, performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) { diff --git a/lex.l b/lex.l index 9717ba3..95d1c54 100644 --- a/lex.l +++ b/lex.l @@ -20,16 +20,10 @@ WS [^\S\r\n] %x code start_condition options conditions action path set -// Off Topic -// --------- -// -// Do not specify the xregexp option as we want the XRegExp \p{...} -// regex macros converted to native regexes and used as such: -// -// %options xregexp - %options easy_keyword_rules %options ranges +%options xregexp + %% diff --git a/lex.y b/lex.y index 4f29c3c..36d8bd4 100644 --- a/lex.y +++ b/lex.y @@ -6,6 +6,7 @@ %left '*' '+' '?' RANGE_REGEX + %% lex @@ -408,7 +409,7 @@ optional_module_code_chunk %% -var XRegExp = require('xregexp'); +var XRegExp = require('xregexp'); // for helping out the `%options xregexp` in the lexer function encodeRE (s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); From e02adfd00534bc009219eb03d9784b328930715a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 11 Nov 2016 04:37:41 +0100 Subject: [PATCH 216/417] regenerated library --- lex-parser.js | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 2c0acb0..c990718 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2508,7 +2508,7 @@ parse: function parse(input) { // read action for current state and first input t = (table[newState] && table[newState][symbol]) || NO_ACTION; if (!t[0]) { - // forget about that symbol and move forward: this wasn't an 'forgot to insert' error type where + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where // (simple) stuff might have been missing before the token which caused the error we're // recovering from now... @@ -2617,6 +2617,7 @@ parse: function parse(input) { }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; + var XRegExp = require('xregexp'); // for helping out the `%options xregexp` in the lexer function encodeRE (s) { @@ -3622,26 +3623,26 @@ rules: [ /^(?:[^{}\/"']+)/, /^(?:\{)/, /^(?:\})/, -/^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff](?:[^\u0000-,.\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*[^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff])?))/, +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*[\\p{Alphabetic}\\p{Number}_])?))", ""), /^(?:>)/, /^(?:,)/, /^(?:\*)/, /^(?:(\r\n|\n|\r)+)/, -/^(?:([^\S\r\n])+(\r\n|\n|\r)+)/, -/^(?:([^\S\r\n])+)/, +/^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, +/^(?:([^\S\n\r])+)/, /^(?:%%)/, -/^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+)/, -/^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff](?:[^\u0000-,.\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*[^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff])?))/, +/^(?:[^\s!"$%'-,.\/:-?\[-\^{-}]+)/, +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*[\\p{Alphabetic}\\p{Number}_])?))", ""), /^(?:=)/, /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, -/^(?:[^\s\r\n]+)/, +/^(?:\S+)/, /^(?:(\r\n|\n|\r)+)/, -/^(?:([^\S\r\n])+)/, -/^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff][^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*))/, +/^(?:([^\S\n\r])+)/, +new XRegExp("^(?:([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*))", ""), /^(?:(\r\n|\n|\r)+)/, -/^(?:([^\S\r\n])+)/, -/^(?:([^\S\r\n])*(\r\n|\n|\r)+)/, +/^(?:([^\S\n\r])+)/, +/^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, /^(?:\{)/, /^(?:%\{(.|(\r\n|\n|\r))*?%\})/, /^(?:%\{(.|(\r\n|\n|\r))*?%\})/, @@ -3649,9 +3650,9 @@ rules: [ /^(?:.*)/, /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/[^\r\n]*)/, -/^(?:([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff][^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*))/, +new XRegExp("^(?:([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*))", ""), /^(?:(\r\n|\n|\r)+)/, -/^(?:[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+)/, +/^(?:[^\s!"$%'-,.\/:<-?\[-\^{-}]+)/, /^(?:(\r\n|\n|\r)+)/, /^(?:\s+)/, /^(?:"(\\\\|\\"|[^"])*")/, @@ -3672,7 +3673,7 @@ rules: [ /^(?:<)/, /^(?:\/!)/, /^(?:\/)/, -/^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[0-9A-F]{2}|u[0-9A-Fa-f]{4}))/, +/^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, /^(?:\\.)/, /^(?:\$)/, /^(?:\.)/, @@ -3680,11 +3681,11 @@ rules: [ /^(?:%s\b)/, /^(?:%x\b)/, /^(?:%include\b)/, -/^(?:%([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff](?:[^\u0000-,.\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*[^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff])?)[^\n\r]+)/, +new XRegExp("^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*[\\p{Alphabetic}\\p{Number}_])?)[^\\n\\r]+)", ""), /^(?:%%)/, /^(?:\{\d+(,\s?\d+|,)?\})/, -/^(?:\{([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff][^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*)\})/, -/^(?:\{([^\u0000-@\[-\^`{-©«-´¶-¹»-¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٠-Ù­Û”Û-Û Û©-Û¬Û°-۹۽۾܀-ÜÝ€-݌޲-߉߫-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।-॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤-৯৲-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੯੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤-à­°à­²-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤-ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤-à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෱෴-฀฻-฿็-์๎-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎-໛໠-໿à¼-༿཈཭-཰ྂ-྇྘྽-࿿့္်á€-áá£á¤á©-á­á‚‡-á‚á‚-ႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-á¥á¥®á¥¯á¥µ-᥿᦬-᦯᧊-᧿᨜-᨟᩟᩠᩵-᪦᪨-᫿᬴᭄ᭌ-᭿᮪᮫᮰-᮹᯦᯲-᯿ᰶ-᱌á±-᱙᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â°â²-â¾â‚€-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…-⅟↉-⒵⓪-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆟ㆻ-㇯㈀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜ -꘩꘬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-ê ¿ê¡´-꡿꣄-꣱꣸-꣺꣼ꣾ-꤉꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§-꧟ꧥ꧰-꧹꧿꨷-꨿꩎-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff][^\u0000-\/:-@\[-\^`{-©«-±´¶-¸»¿×÷˂-Ë…Ë’-ËŸË¥-˫˭˯-̈́͆-ͯ͵͸͹;΀-΅·΋Î΢϶҂-Ò‰Ô°Õ—Õ˜Õš-Õ Öˆ-֯־׀׃׆׈-×׫-ׯ׳-ØØ›-؟٘٪-Ù­Û”Û-Û Û©-۬۽۾܀-ÜÝ€-݌޲-Þ¿ß«-߳߶-߹߻-߿࠘࠙࠭-à ¿à¡™-࢟ࢵ-࣢࣪-़࣯à¥à¥‘-॔।॥॰঄à¦à¦Žà¦‘঒঩঱঳-঵঺-়৅৆৉৊à§à§-৖৘-৛৞৤৥৲৳৺-਀਄਋-਎਑਒਩਱਴਷਺-਽੃-੆੉੊à©-à©à©’-੘à©à©Ÿ-੥੶-઀઄઎઒઩઱઴઺-઼૆૊à«-à«à«‘-૟૤૥૰-૸ૺ-଀଄à¬à¬Žà¬‘଒଩଱଴଺-଼୅୆୉୊à­-à­•à­˜-୛୞୤୥୰୸-à®à®„஋-à®à®‘à®–-஘஛à®à® -஢஥-஧஫-஭஺-஽௃-௅௉à¯-à¯à¯‘-௖௘-௥௳-௿ఄà°à°‘à°©à°º-఼౅౉à±-౔౗౛-౟౤౥౰-౷౿ಀ಄à²à²‘಩಴಺-಼೅೉à³-೔೗-à³à³Ÿà³¤à³¥à³°à³³-ഀഄà´à´‘഻഼൅൉àµàµ-ൖ൘-൞൤൥൶-൹඀à¶à¶„à¶—-඙඲඼඾඿෇-à·Žà·•à·—à· -෥෰෱෴-฀฻-฿็-์๎à¹à¹š-຀຃຅ຆຉ຋ຌຎ-ຓຘຠ຤຦ຨຩຬ຺຾຿໅໇-໌໎à»à»šà»›à» -໿à¼-༟༴-༿཈཭-཰ྂ-྇྘྽-࿿့္်áŠ-áá£á¤á©-á­á‚‡-á‚á‚ႚႛ႞႟჆჈-჌჎áƒáƒ»á‰‰á‰Žá‰á‰—቙቞቟኉኎áŠáŠ±áŠ¶áŠ·áŠ¿á‹á‹†á‹‡á‹—጑጖጗á›-ážá -á¨á½-á¿áŽ-᎟á¶á·á¾-á€á™­á™®áš€áš›-᚟᛫-᛭᛹-᛿áœáœ”-ᜟ᜴-᜿á”-áŸá­á±á´-á¿áž´ážµáŸ‰-៖៘-៛áŸ-៟៪-៯៺-á á š-᠟ᡸ-᡿᢫-᢯᣶-᣿᤟᤬-᤯᤹-᥅᥮᥯᥵-᥿᦬-᦯᧊-á§á§›-᧿᨜-᨟᩟᩠᩵-᩿᪊-áªáªš-᪦᪨-᫿᬴᭄ᭌ-á­á­š-᭿᯦᮪᮫᯲-᯿ᰶ-᰿᱊-᱌᱾-᳨᳭᳴᳷-᳿᷀-ᷦ᷵-᷿἖἗἞἟὆὇὎á½á½˜á½šá½œá½žá½¾á½¿á¾µá¾½á¾¿-á¿á¿…á¿-á¿á¿”῕῜-῟῭-῱῵´-â¯â²â³âº-â¾â‚Š-â‚â‚-â„℃-℆℈℉℔№-℘℞-℣℥℧℩℮℺℻⅀-â…„â…Š-â…â…↊-⑟⒜-⒵─-âµâž”-⯿Ⱟⱟ⳥-⳪⳯-⳱⳴-⳼⳾⳿⴦⴨-⴬⴮⴯⵨-⵮⵰-⵿⶗-⶟⶧⶯⶷⶿⷇â·â·—⷟⸀-⸮⸰-〄〈-〠〪-〰〶〷〽-ã€ã‚—-゜゠・㄀-ã„„ã„®-ã„°ã†-㆑㆖-㆟ㆻ-㇯㈀-㈟㈪-㉇ã‰ã‰ -㉿㊊-㊰㋀-ã¿ä¶¶-ä·¿é¿–-é¿¿ê’-ê“꓾꓿ê˜-ê˜ê˜¬-꘿꙯-꙳꙼-꙾꛰-꜖꜠꜡꞉꞊ꞮꞯꞸ-ꟶꠂ꠆ꠋ꠨-꠯꠶-ê ¿ê¡´-꡿꣄-ê£ê£š-꣱꣸-꣺꣼ꣾꣿ꤫-꤯꥓-꥟꥽-꥿꦳꧀-ê§Žê§š-꧟ꧥ꧿꨷-꨿꩎ê©ê©š-꩟꩷-꩹ꩻ-ꩽ꪿ê«ê«ƒ-꫚꫞꫟꫰꫱꫶-꬀꬇꬈ê¬ê¬ê¬—-꬟꬧꬯꭛ꭦ-꭯꯫-꯯꯺-꯿힤-힯퟇-퟊퟼-﩮﩯﫚-﫿﬇-﬒﬘-﬜﬩﬷﬽﬿﭂﭅﮲-﯒﴾-ïµï¶ï¶‘ï·ˆ-﷯﷼-﹯﹵﻽-ï¼ï¼š-ï¼ ï¼»-`{-・﾿-ï¿ï¿ˆï¿‰ï¿ï¿‘￘￙ï¿-\uffff]*)\})/, +new XRegExp("^(?:\\{([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*)\\})", ""), +new XRegExp("^(?:\\{([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*)\\})", ""), /^(?:\{)/, /^(?:\})/, /^(?:.)/, @@ -3697,8 +3698,8 @@ rules: [ /^(?:(\r\n|\n|\r))/, /^(?:'[^\r\n]+')/, /^(?:"[^\r\n]+")/, -/^(?:([^\S\r\n])+)/, -/^(?:[^\s\r\n]+)/, +/^(?:([^\S\n\r])+)/, +/^(?:\S+)/, /^(?:.)/ ], conditions: { From 42cedacc180330fd6f2a5084625f74f2416a7639 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 14 Nov 2016 09:25:17 +0100 Subject: [PATCH 217/417] regenerated library + bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8b23efe..b90e786 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-153", + "version": "0.1.4-154", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From a828f9ed58fd697cc6d779e850ed609523f9ec49 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 14 Nov 2016 11:13:49 +0100 Subject: [PATCH 218/417] regenerated library files --- lex-parser.js | 690 +++++++++++++++++++------------------------------- 1 file changed, 264 insertions(+), 426 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index c990718..af93448 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-153 */ +/* parser generated by jison 0.4.18-154 */ /* * Returns a Parser object of the following structure: * @@ -328,7 +328,17 @@ function bp(s) { return rv; } - +// helper: reconstruct the defaultActions[] table +function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; +} // helper: reconstruct the 'goto' table function bt(s) { @@ -1140,23 +1150,21 @@ case 80: }, table: bt({ len: u([ - 11, + 2, 1, 13, 1, 13, 21, - 2, - 2, - 5, s, - [9, 4], + [2, 3], + s, + [0, 4], 2, 3, 20, - 1, - 9, - 9, + s, + [0, 3], 28, 31, 28, @@ -1165,106 +1173,84 @@ table: bt({ 17, 17, s, - [27, 7], - 29, + [0, 8], 5, s, - [27, 3], - s, - [10, 4], - 2, - 3, - 25, - 25, + [0, 3], + 10, + 0, + 10, + c, + [29, 3], + 0, + 0, 1, 4, - 3, - 1, - 1, + c, + [5, 3], 6, 18, - 16, + 0, 21, 3, 31, 28, - 10, - 10, s, - [27, 5], + [0, 7], 1, 1, 28, 28, 1, 6, + s, + [0, 5], + c, + [68, 4], + 2, + 1, 3, 3, - 10, - 10, - 9, - 5, - 3, - 9, - 1, + 0, + c, + [15, 3], + 6, 2, 1, s, - [3, 3], - 6, - 1, - 16, + [0, 6], + c, + [21, 4], 6, - 2, + 0, 1, + 0, 2, c, - [33, 4], + [81, 4], 1, - s, - [2, 3], c, - [31, 3], - 1, - 16, - 5, - 17, - 16, - 17, + [9, 3], c, - [107, 3], - 4, - 1, - 1, - 2, - 17, - 2, + [18, 4], 3, - 16 + 0 ]), symbol: u([ - 3, 19, 20, + 1, + 3, + 21, 22, + 26, 27, 29, 31, - 34, - 37, + s, + [34, 4, 1], 67, 73, - 1, - 3, - 21, - 22, - 26, - c, - [12, 4], - 35, - 36, - c, - [14, 3], 22, c, [14, 13], @@ -1285,16 +1271,8 @@ table: bt({ 38, 32, 38, - 3, - 4, 33, 43, - 44, - 3, - c, - [67, 8], - c, - [9, 27], 2, 74, 27, @@ -1303,7 +1281,7 @@ table: bt({ 1, 5, c, - [73, 6], + [34, 6], 22, 23, 25, @@ -1312,21 +1290,22 @@ table: bt({ 50, 51, c, - [70, 5], - 22, - c, - [53, 19], + [31, 5], + 3, 9, 10, 11, c, - [39, 5], + [20, 5], c, - [16, 5], + [70, 4], + 37, c, - [115, 12], + [57, 12], + 67, + 73, c, - [28, 16], + [28, 14], s, [46, 7, 1], c, @@ -1344,7 +1323,7 @@ table: bt({ s, [64, 4, 1], c, - [197, 3], + [139, 3], c, [58, 5], c, @@ -1352,46 +1331,26 @@ table: bt({ c, [22, 22], c, - [167, 5], + [148, 5], c, [17, 29], - c, - [106, 19], - c, - [105, 8], - c, - [27, 183], - 60, - s, - [62, 6, 1], - 73, 52, 57, 59, 61, 62, + 3, c, - [115, 82], - c, - [17, 6], + [101, 6], 38, c, - [10, 33], + [121, 3], + c, + [10, 10], 4, 3, 4, 44, - 1, - 3, - c, - [554, 8], - c, - [70, 10], - c, - [69, 4], - 76, - c, - [25, 25], 69, 27, 68, @@ -1400,62 +1359,37 @@ table: bt({ 18, 27, 69, - s, - [1, 3], + 1, 24, 72, 73, 75, 76, c, - [619, 9], - c, - [617, 9], - c, - [18, 9], + [229, 9], c, - [16, 7], + [227, 9], c, - [724, 21], + [279, 21], 7, 27, 45, c, - [610, 59], - 3, - 11, - c, - [707, 9], - c, - [10, 10], - c, - [498, 134], + [223, 59], 11, 11, c, - [185, 29], + [30, 28], c, - [28, 27], + [28, 28], 60, c, - [528, 3], + [204, 3], 60, 61, 62, - 57, - 60, - c, - [3, 4], - c, - [444, 27], - c, - [443, 4], - c, - [1037, 4], - 4, - c, - [1040, 10], - 69, + 33, + 43, 27, 71, 1, @@ -1463,14 +1397,10 @@ table: bt({ 35, 73, 1, + 73, + 76, c, - [440, 3], - c, - [3, 3], - c, - [408, 6], - c, - [391, 16], + [183, 6], 3, 34, 35, @@ -1480,71 +1410,37 @@ table: bt({ 6, 8, 6, - 6, - 8, - c, - [309, 91], - 60, 3, 4, - 27, - 69, - c, - [542, 4], c, - [133, 6], - c, - [142, 3], - c, - [136, 17], - c, - [189, 4], + [200, 7], + 33, + 43, c, - [21, 9], + [203, 9], 34, c, - [565, 23], - c, - [33, 17], - c, - [15, 6], - c, - [13, 7], + [202, 7], 27, + 43, c, - [14, 13], - 3, - 4, - c, - [81, 3], - 1, - 3, - 4, - c, - [52, 17], - c, - [234, 3], - c, - [739, 3], - c, - [90, 15] + [241, 5] ]), type: u([ - 2, 0, 0, - s, - [2, 8], 1, 2, 0, 2, + 0, + s, + [2, 4], + 0, c, - [13, 5], - c, - [19, 7], + [6, 5], c, - [14, 14], + [14, 15], c, [11, 6], c, @@ -1552,19 +1448,19 @@ table: bt({ c, [6, 6], c, - [33, 9], + [33, 7], c, - [32, 11], - s, - [2, 31], + [11, 5], c, - [74, 17], + [35, 17], + s, + [2, 19], c, - [55, 39], + [57, 12], c, - [47, 27], + [28, 17], c, - [146, 15], + [88, 14], c, [64, 24], c, @@ -1572,51 +1468,41 @@ table: bt({ c, [22, 20], c, - [17, 34], - s, - [2, 213], - c, - [472, 3], - c, - [227, 180], - c, - [688, 7], - c, - [616, 5], + [17, 29], c, - [436, 12], + [194, 7], c, - [204, 30], + [119, 27], c, - [504, 17], + [261, 8], c, - [47, 15], + [65, 12], c, - [610, 52], + [51, 14], c, - [307, 171], + [117, 17], c, - [28, 36], + [82, 15], c, - [335, 4], + [223, 52], c, - [227, 39], + [30, 42], c, - [294, 20], + [380, 11], c, - [19, 9], + [402, 10], c, - [408, 14], + [22, 7], c, - [355, 13], + [183, 7], c, - [243, 107], + [154, 11], c, - [204, 26], + [17, 5], c, - [135, 82], + [137, 20], c, - [81, 44] + [19, 6] ]), state: u([ s, @@ -1706,8 +1592,6 @@ table: bt({ 118 ]), mode: u([ - s, - [2, 9], 1, 2, s, @@ -1715,83 +1599,65 @@ table: bt({ c, [10, 10], s, - [1, 13], + [1, 18], s, - [2, 39], + [2, 6], c, - [44, 11], + [7, 7], c, - [51, 28], + [9, 3], c, - [103, 7], + [45, 6], c, - [52, 11], + [13, 8], c, - [13, 5], + [35, 8], c, [23, 24], c, [27, 6], - c, - [67, 15], - c, - [72, 11], - c, - [189, 32], - c, - [202, 52], s, - [2, 179], - c, - [220, 90], - c, - [89, 20], + [2, 14], c, - [20, 13], - c, - [123, 4], - c, - [126, 51], + [16, 5], c, - [434, 4], + [117, 16], c, - [494, 9], + [131, 28], c, - [567, 30], + [141, 16], c, - [454, 16], + [142, 10], c, - [556, 49], + [10, 4], c, - [441, 158], + [22, 4], c, - [184, 27], + [65, 5], c, - [767, 30], + [123, 7], c, - [111, 53], + [35, 14], c, - [56, 5], + [65, 16], c, - [94, 10], + [169, 53], c, - [362, 20], + [29, 25], c, - [683, 103], + [225, 34], c, - [436, 8], + [162, 5], c, - [635, 45], + [135, 11], c, - [689, 53], + [47, 13], c, - [211, 23], + [165, 11], c, - [22, 17] + [5, 3] ]), goto: u([ - s, - [6, 9], 8, 8, 5, @@ -1819,16 +1685,6 @@ table: bt({ 36, 39, 41, - s, - [31, 3], - s, - [13, 9], - s, - [14, 9], - s, - [15, 9], - s, - [16, 9], 45, 44, 48, @@ -1839,21 +1695,16 @@ table: bt({ 51, s, [35, 7], - 7, - s, - [9, 9], - s, - [38, 9], 43, 56, 22, 43, c, - [94, 4], + [36, 4], s, [43, 6], c, - [100, 7], + [42, 7], 43, 43, 40, @@ -1886,80 +1737,46 @@ table: bt({ c, [14, 14], c, - [192, 12], + [134, 12], c, [12, 12], - s, - [53, 27], - s, - [55, 27], - s, - [56, 27], - s, - [57, 27], - s, - [58, 27], - s, - [59, 27], - s, - [60, 27], - s, - [61, 29], 33, 71, s, - [69, 27], - s, - [70, 27], - s, - [67, 27], - s, [10, 7], 73, 10, 10, s, - [17, 10], - s, [11, 7], 74, 11, 11, - s, - [19, 10], 76, 75, 29, 29, 77, - s, - [79, 25], - s, - [80, 25], 78, 48, 73, 80, 74, 74, - 1, - 2, s, [84, 3], 86, c, - [567, 7], + [177, 7], 85, s, [35, 7], - s, - [22, 16], c, - [656, 13], + [211, 13], 90, 91, c, - [556, 23], + [169, 23], 44, 61, s, @@ -1971,20 +1788,6 @@ table: bt({ 64, s, [44, 4], - s, - [42, 10], - s, - [39, 10], - s, - [48, 27], - s, - [49, 27], - s, - [50, 27], - s, - [54, 27], - s, - [68, 27], 93, 94, 51, @@ -2013,23 +1816,6 @@ table: bt({ 33, 64, 71, - s, - [65, 3], - s, - [66, 3], - s, - [18, 10], - s, - [20, 10], - s, - [12, 9], - s, - [31, 3], - s, - [32, 3], - s, - [71, 9], - 72, 99, 98, 100, @@ -2039,87 +1825,139 @@ table: bt({ 83, 102, s, - [81, 3], - s, [84, 3], - 5, - s, - [21, 16], 105, 108, 13, 109, 110, 111, - 36, - 36, - s, - [41, 10], - s, - [46, 27], - s, - [47, 27], - s, - [62, 27], - 63, 76, 112, - 75, - 75, - 76, - 76, - 3, s, [84, 3], - s, - [82, 3], 114, s, - [23, 16], - s, - [31, 3], - s, [25, 9], 116, s, [25, 7], + 117, + 76, + 119, + 30, + 30, + 77 +]) +}), +defaultActions: bda({ + idx: u([ + 0, s, - [26, 16], + [8, 5, 1], + 16, + 17, + 18, + s, + [26, 8, 1], + 35, + 36, + 37, + 39, + 41, + 44, + 45, + 49, + 50, + 53, s, - [27, 17], + [58, 7, 1], + s, + [71, 9, 1], + 84, + 86, + 87, + s, + [91, 6, 1], + 98, + 99, + 100, + 102, + 104, + 105, + 107, + 108, + 109, s, - [33, 13], + [111, 4, 1], + 116, 117, + 119 +]), + goto: u([ + 6, + 31, s, - [34, 13], + [13, 4, 1], + 7, + 9, + 38, + 53, s, - [31, 3], + [55, 7, 1], + 69, + 70, + 67, + 17, + 19, + 79, + 80, + 1, + 2, + 22, + 42, + 39, + 48, + 49, + 50, + 54, + 68, + 65, + 66, + 18, + 20, + 12, + 31, + 32, + 71, + 72, + 81, + 5, + 21, + 36, + 41, + 46, + 47, + 62, + 63, + 75, + 76, + 3, + 82, + 23, + 31, + 26, + 27, + 33, + 34, + 31, 78, 4, - 76, - 119, - s, - [28, 17], - 37, + 28, 37, - 30, - 30, - 77, - s, - [24, 16] + 24 ]) }), -defaultActions: { - 16: 7, - 49: 1, - 50: 2, - 79: 72, - 86: 5, - 96: 63, - 100: 3, - 113: 78, - 114: 4 -}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); @@ -2630,7 +2468,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-153 */ +/* generated by jison-lex 0.3.4-154 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From 0919f9c053e9338b8aafd8835e1aa363def6abde Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 14 Nov 2016 19:51:25 +0100 Subject: [PATCH 219/417] bump revision & regenerate library files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b90e786..8f57ae9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-154", + "version": "0.1.4-155", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 621216b73380d44d00d383dc105ccf8872028089 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 17 Nov 2016 03:26:44 +0100 Subject: [PATCH 220/417] regenerated library --- lex-parser.js | 704 ++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 515 insertions(+), 189 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index af93448..447066f 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-154 */ +/* parser generated by jison 0.4.18-155 */ /* * Returns a Parser object of the following structure: * @@ -40,7 +40,7 @@ * terminal_descriptions_: (if there are any) {associative list: number ==> description}, * productions_: [...], * - * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yy, yystate, $0, yyvstack, yylstack, yystack, yysstack, ...), + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, $0 (yysp), yyvstack, yylstack, yystack, yysstack, ...), * where `...` denotes the (optional) additional arguments the user passed to * `parser.parse(str, ...)` * @@ -86,7 +86,7 @@ * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: * these extra `args...` are passed verbatim to the grammar rules' action code. * - * cleanupAfterParse: function(resultValue, invoke_post_methods), + * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), * Helper function **which will be set up during the first invocation of the `parse()` method**. * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY @@ -174,6 +174,7 @@ * as is also available in the rule actions; this can be used, * for instance, for advanced error analysis and reporting) * lexer: (reference to the current lexer instance used by the parser) + * parser: (reference to the current parser instance) * } * * while `this` will reference the current parser instance. @@ -555,7 +556,8 @@ originalParseError: null, cleanupAfterParse: null, constructParseErrorInfo: null, -__reentrant_call_depth: 0, // INTERNAL USE ONLY +__reentrant_call_depth: 0, // INTERNAL USE ONLY +__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup // APIs which will be set up depending on user action code analysis: //yyErrOk: 0, @@ -752,8 +754,9 @@ productions_: bp({ 0 ]) }), -performAction: function parser__PerformAction(yytext, yy, yystate /* action[1] */, $0, yyvstack) { +performAction: function parser__PerformAction(yytext, yystate /* action[1] */, $0, yyvstack) { /* this == yyval */ +var yy = this.yy; switch (yystate) { case 1: @@ -1150,21 +1153,23 @@ case 80: }, table: bt({ len: u([ - 2, + 11, 1, 13, 1, 13, 21, + 2, + 2, + 5, s, - [2, 3], - s, - [0, 4], + [9, 4], 2, 3, 20, - s, - [0, 3], + 1, + 9, + 9, 28, 31, 28, @@ -1173,84 +1178,106 @@ table: bt({ 17, 17, s, - [0, 8], + [27, 7], + 29, 5, s, - [0, 3], - 10, - 0, - 10, - c, - [29, 3], - 0, - 0, + [27, 3], + s, + [10, 4], + 2, + 3, + 25, + 25, 1, 4, - c, - [5, 3], + 3, + 1, + 1, 6, 18, - 0, + 16, 21, 3, 31, 28, + 10, + 10, s, - [0, 7], + [27, 5], 1, 1, 28, 28, 1, 6, - s, - [0, 5], - c, - [68, 4], - 2, - 1, 3, 3, - 0, - c, - [15, 3], - 6, + 10, + 10, + 9, + 5, + 3, + 9, + 1, 2, 1, s, - [0, 6], - c, - [21, 4], + [3, 3], 6, - 0, 1, - 0, + 16, + 6, + 2, + 1, 2, c, - [81, 4], + [33, 4], 1, + s, + [2, 3], c, - [9, 3], + [31, 3], + 1, + 16, + 5, + 17, + 16, + 17, c, - [18, 4], + [107, 3], + 4, + 1, + 1, + 2, + 17, + 2, 3, - 0 + 16 ]), symbol: u([ + 3, 19, 20, - 1, - 3, - 21, 22, - 26, 27, 29, 31, - s, - [34, 4, 1], + 34, + 37, 67, 73, + 1, + 3, + 21, + 22, + 26, + c, + [12, 4], + 35, + 36, + c, + [14, 3], 22, c, [14, 13], @@ -1271,8 +1298,16 @@ table: bt({ 38, 32, 38, + 3, + 4, 33, 43, + 44, + 3, + c, + [67, 8], + c, + [9, 27], 2, 74, 27, @@ -1281,7 +1316,7 @@ table: bt({ 1, 5, c, - [34, 6], + [73, 6], 22, 23, 25, @@ -1290,22 +1325,21 @@ table: bt({ 50, 51, c, - [31, 5], - 3, + [70, 5], + 22, + c, + [53, 19], 9, 10, 11, c, - [20, 5], + [39, 5], c, - [70, 4], - 37, + [16, 5], c, - [57, 12], - 67, - 73, + [115, 12], c, - [28, 14], + [28, 16], s, [46, 7, 1], c, @@ -1323,7 +1357,7 @@ table: bt({ s, [64, 4, 1], c, - [139, 3], + [197, 3], c, [58, 5], c, @@ -1331,26 +1365,46 @@ table: bt({ c, [22, 22], c, - [148, 5], + [167, 5], c, [17, 29], + c, + [106, 19], + c, + [105, 8], + c, + [27, 183], + 60, + s, + [62, 6, 1], + 73, 52, 57, 59, 61, 62, - 3, c, - [101, 6], - 38, + [115, 82], c, - [121, 3], + [17, 6], + 38, c, - [10, 10], + [10, 33], 4, 3, 4, 44, + 1, + 3, + c, + [554, 8], + c, + [70, 10], + c, + [69, 4], + 76, + c, + [25, 25], 69, 27, 68, @@ -1359,37 +1413,62 @@ table: bt({ 18, 27, 69, - 1, + s, + [1, 3], 24, 72, 73, 75, 76, c, - [229, 9], + [619, 9], + c, + [617, 9], c, - [227, 9], + [18, 9], c, - [279, 21], + [16, 7], + c, + [724, 21], 7, 27, 45, c, - [223, 59], + [610, 59], + 3, + 11, + c, + [707, 9], + c, + [10, 10], + c, + [498, 134], 11, 11, c, - [30, 28], + [185, 29], c, - [28, 28], + [28, 27], 60, c, - [204, 3], + [528, 3], 60, 61, 62, - 33, - 43, + 57, + 60, + c, + [3, 4], + c, + [444, 27], + c, + [443, 4], + c, + [1037, 4], + 4, + c, + [1040, 10], + 69, 27, 71, 1, @@ -1397,10 +1476,14 @@ table: bt({ 35, 73, 1, - 73, - 76, c, - [183, 6], + [440, 3], + c, + [3, 3], + c, + [408, 6], + c, + [391, 16], 3, 34, 35, @@ -1410,37 +1493,71 @@ table: bt({ 6, 8, 6, + 6, + 8, + c, + [309, 91], + 60, 3, 4, + 27, + 69, c, - [200, 7], - 33, - 43, + [542, 4], c, - [203, 9], + [133, 6], + c, + [142, 3], + c, + [136, 17], + c, + [189, 4], + c, + [21, 9], 34, c, - [202, 7], + [565, 23], + c, + [33, 17], + c, + [15, 6], + c, + [13, 7], 27, - 43, c, - [241, 5] + [14, 13], + 3, + 4, + c, + [81, 3], + 1, + 3, + 4, + c, + [52, 17], + c, + [234, 3], + c, + [739, 3], + c, + [90, 15] ]), type: u([ + 2, 0, 0, + s, + [2, 8], 1, 2, 0, 2, - 0, - s, - [2, 4], - 0, c, - [6, 5], + [13, 5], + c, + [19, 7], c, - [14, 15], + [14, 14], c, [11, 6], c, @@ -1448,19 +1565,19 @@ table: bt({ c, [6, 6], c, - [33, 7], - c, - [11, 5], + [33, 9], c, - [35, 17], + [32, 11], s, - [2, 19], + [2, 31], c, - [57, 12], + [74, 17], c, - [28, 17], + [55, 39], + c, + [47, 27], c, - [88, 14], + [146, 15], c, [64, 24], c, @@ -1468,41 +1585,51 @@ table: bt({ c, [22, 20], c, - [17, 29], + [17, 34], + s, + [2, 213], + c, + [472, 3], c, - [194, 7], + [227, 180], c, - [119, 27], + [688, 7], c, - [261, 8], + [616, 5], c, - [65, 12], + [436, 12], c, - [51, 14], + [204, 30], c, - [117, 17], + [504, 17], c, - [82, 15], + [47, 15], c, - [223, 52], + [610, 52], c, - [30, 42], + [307, 171], c, - [380, 11], + [28, 36], c, - [402, 10], + [335, 4], c, - [22, 7], + [227, 39], c, - [183, 7], + [294, 20], c, - [154, 11], + [19, 9], c, - [17, 5], + [408, 14], c, - [137, 20], + [355, 13], c, - [19, 6] + [243, 107], + c, + [204, 26], + c, + [135, 82], + c, + [81, 44] ]), state: u([ s, @@ -1592,6 +1719,8 @@ table: bt({ 118 ]), mode: u([ + s, + [2, 9], 1, 2, s, @@ -1599,65 +1728,83 @@ table: bt({ c, [10, 10], s, - [1, 18], + [1, 13], s, - [2, 6], + [2, 39], c, - [7, 7], + [44, 11], c, - [9, 3], + [51, 28], c, - [45, 6], + [103, 7], c, - [13, 8], + [52, 11], c, - [35, 8], + [13, 5], c, [23, 24], c, [27, 6], + c, + [67, 15], + c, + [72, 11], + c, + [189, 32], + c, + [202, 52], s, - [2, 14], + [2, 179], c, - [16, 5], + [220, 90], c, - [117, 16], + [89, 20], c, - [131, 28], + [20, 13], c, - [141, 16], + [123, 4], c, - [142, 10], + [126, 51], c, - [10, 4], + [434, 4], + c, + [494, 9], + c, + [567, 30], + c, + [454, 16], c, - [22, 4], + [556, 49], c, - [65, 5], + [441, 158], c, - [123, 7], + [184, 27], c, - [35, 14], + [767, 30], c, - [65, 16], + [111, 53], c, - [169, 53], + [56, 5], c, - [29, 25], + [94, 10], c, - [225, 34], + [362, 20], c, - [162, 5], + [683, 103], c, - [135, 11], + [436, 8], c, - [47, 13], + [635, 45], c, - [165, 11], + [689, 53], c, - [5, 3] + [211, 23], + c, + [22, 17] ]), goto: u([ + s, + [6, 9], 8, 8, 5, @@ -1685,6 +1832,16 @@ table: bt({ 36, 39, 41, + s, + [31, 3], + s, + [13, 9], + s, + [14, 9], + s, + [15, 9], + s, + [16, 9], 45, 44, 48, @@ -1695,16 +1852,21 @@ table: bt({ 51, s, [35, 7], + 7, + s, + [9, 9], + s, + [38, 9], 43, 56, 22, 43, c, - [36, 4], + [94, 4], s, [43, 6], c, - [42, 7], + [100, 7], 43, 43, 40, @@ -1737,46 +1899,80 @@ table: bt({ c, [14, 14], c, - [134, 12], + [192, 12], c, [12, 12], + s, + [53, 27], + s, + [55, 27], + s, + [56, 27], + s, + [57, 27], + s, + [58, 27], + s, + [59, 27], + s, + [60, 27], + s, + [61, 29], 33, 71, s, + [69, 27], + s, + [70, 27], + s, + [67, 27], + s, [10, 7], 73, 10, 10, s, + [17, 10], + s, [11, 7], 74, 11, 11, + s, + [19, 10], 76, 75, 29, 29, 77, + s, + [79, 25], + s, + [80, 25], 78, 48, 73, 80, 74, 74, + 1, + 2, s, [84, 3], 86, c, - [177, 7], + [567, 7], 85, s, [35, 7], + s, + [22, 16], c, - [211, 13], + [656, 13], 90, 91, c, - [169, 23], + [556, 23], 44, 61, s, @@ -1788,6 +1984,20 @@ table: bt({ 64, s, [44, 4], + s, + [42, 10], + s, + [39, 10], + s, + [48, 27], + s, + [49, 27], + s, + [50, 27], + s, + [54, 27], + s, + [68, 27], 93, 94, 51, @@ -1816,6 +2026,23 @@ table: bt({ 33, 64, 71, + s, + [65, 3], + s, + [66, 3], + s, + [18, 10], + s, + [20, 10], + s, + [12, 9], + s, + [31, 3], + s, + [32, 3], + s, + [71, 9], + 72, 99, 98, 100, @@ -1825,29 +2052,74 @@ table: bt({ 83, 102, s, + [81, 3], + s, [84, 3], + 5, + s, + [21, 16], 105, 108, 13, 109, 110, 111, + 36, + 36, + s, + [41, 10], + s, + [46, 27], + s, + [47, 27], + s, + [62, 27], + 63, 76, 112, + 75, + 75, + 76, + 76, + 3, s, [84, 3], + s, + [82, 3], 114, s, + [23, 16], + s, + [31, 3], + s, [25, 9], 116, s, [25, 7], + s, + [26, 16], + s, + [27, 17], + s, + [33, 13], 117, + s, + [34, 13], + s, + [31, 3], + 78, + 4, 76, 119, + s, + [28, 17], + 37, + 37, 30, 30, - 77 + 77, + s, + [24, 16] ]) }), defaultActions: bda({ @@ -1962,7 +2234,6 @@ parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); hash.destroy(); // destroy... well, *almost*! - // assert('recoverable' in hash); } else { throw new this.JisonParserError(str, hash); } @@ -1992,32 +2263,30 @@ parse: function parse(input) { lexer = this.__lexer__ = Object.create(this.lexer); } - var sharedState = { - yy: { + var sharedState_yy = { parseError: null, quoteName: null, lexer: null, parser: null, pre_parse: null, post_parse: null - } }; // copy state for (var k in this.yy) { if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState.yy[k] = this.yy[k]; + sharedState_yy[k] = this.yy[k]; } } - sharedState.yy.lexer = lexer; - sharedState.yy.parser = this; + sharedState_yy.lexer = lexer; + sharedState_yy.parser = this; - lexer.setInput(input, sharedState.yy); + lexer.setInput(input, sharedState_yy); @@ -2039,15 +2308,15 @@ parse: function parse(input) { // Does the shared state override the default `parseError` that already comes with this instance? - if (typeof sharedState.yy.parseError === 'function') { - this.parseError = sharedState.yy.parseError; + if (typeof sharedState_yy.parseError === 'function') { + this.parseError = sharedState_yy.parseError; } else { this.parseError = this.originalParseError; } // Does the shared state override the default `quoteName` that already comes with this instance? - if (typeof sharedState.yy.quoteName === 'function') { - this.quoteName = sharedState.yy.quoteName; + if (typeof sharedState_yy.quoteName === 'function') { + this.quoteName = sharedState_yy.quoteName; } else { this.quoteName = this.originalQuoteName; } @@ -2058,16 +2327,16 @@ parse: function parse(input) { // // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, // or else your `sharedState`, etc. references will be *wrong*! - this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods) { + this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) { var rv; if (invoke_post_methods) { - if (sharedState.yy.post_parse) { - rv = sharedState.yy.post_parse.call(this, sharedState.yy, resultValue); + if (sharedState_yy.post_parse) { + rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue); if (typeof rv !== 'undefined') resultValue = rv; } if (this.post_parse) { - rv = this.post_parse.call(this, sharedState.yy, resultValue); + rv = this.post_parse.call(this, sharedState_yy, resultValue); if (typeof rv !== 'undefined') resultValue = rv; } } @@ -2075,16 +2344,16 @@ parse: function parse(input) { if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. // prevent lingering circular references from causing memory leaks: - if (sharedState.yy) { - sharedState.yy.parseError = undefined; - sharedState.yy.quoteName = undefined; - sharedState.yy.lexer = undefined; - sharedState.yy.parser = undefined; - if (lexer.yy === sharedState.yy) { + if (sharedState_yy) { + sharedState_yy.parseError = undefined; + sharedState_yy.quoteName = undefined; + sharedState_yy.lexer = undefined; + sharedState_yy.parser = undefined; + if (lexer.yy === sharedState_yy) { lexer.yy = undefined; } } - sharedState.yy = undefined; + sharedState_yy = undefined; this.parseError = this.originalParseError; this.quoteName = this.originalQuoteName; @@ -2096,13 +2365,26 @@ parse: function parse(input) { vstack.length = 0; stack_pointer = 0; + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_infos.length = 0; + } + return resultValue; }; // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, // or else your `lexer`, `sharedState`, etc. references will be *wrong*! this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { - return { + var pei = { errStr: msg, exception: ex, text: lexer.match, @@ -2121,10 +2403,17 @@ parse: function parse(input) { value_stack: vstack, stack_pointer: sp, - yy: sharedState.yy, + yy: sharedState_yy, lexer: lexer, - - // and make sure the error info doesn't stay due to potential ref cycle via userland code manipulations (memory leak opportunity!): + parser: this, + + // and make sure the error info doesn't stay due to potential + // ref cycle via userland code manipulations. + // These would otherwise all be memory leak opportunities! + // + // Note that only array and object references are nuked as those + // constitute the set of elements which can produce a cyclic ref. + // The rest of the members is kept intact as they are harmless. destroy: function destructParseErrorInfo() { // remove cyclic references added to error info: // info.yy = null; @@ -2134,13 +2423,16 @@ parse: function parse(input) { // ... var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && typeof key !== 'function') { + if (this.hasOwnProperty(key) && typeof key === 'object') { this[key] = undefined; } } this.recoverable = rec; } }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + return pei; }; @@ -2156,10 +2448,12 @@ parse: function parse(input) { var symbol = 0; var preErrorSymbol = 0; + var lastEofErrorStateDepth = 0; var state, action, r, t; var yyval = { $: true, - _$: undefined + _$: undefined, + yy: sharedState_yy }; var p, len, this_production; @@ -2176,11 +2470,38 @@ parse: function parse(input) { // try to recover from error for (;;) { // check for error recovery rule in this state + var t = table[state][TERROR] || NO_ACTION; if (t[0]) { + // We need to make sure we're not cycling forever: + // once we hit EOF, even when we `yyerrok()` an error, we must + // prevent the core from running forever, + // e.g. when parent rules are still expecting certain input to + // follow after this, for example when you handle an error inside a set + // of braces which are matched by a parent rule in your grammar. + // + // Hence we require that every error handling/recovery attempt + // *after we've hit EOF* has a diminishing state stack: this means + // we will ultimately have unwound the state stack entirely and thus + // terminate the parse in a controlled fashion even when we have + // very complex error/recovery code interplay in the core + user + // action code blocks: + + if (symbol === EOF) { + if (!lastEofErrorStateDepth) { + lastEofErrorStateDepth = sp - 1 - depth; + } else if (lastEofErrorStateDepth <= sp - 1 - depth) { + + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + continue; + } + } return depth; } if (state === 0 /* $accept rule */ || stack_probe < 1) { + return -1; // No suitable error recovery rule available. } --stack_probe; // popStack(1): [symbol, action] @@ -2193,10 +2514,10 @@ parse: function parse(input) { this.__reentrant_call_depth++; if (this.pre_parse) { - this.pre_parse.call(this, sharedState.yy); + this.pre_parse.call(this, sharedState_yy); } - if (sharedState.yy.pre_parse) { - sharedState.yy.pre_parse.call(this, sharedState.yy); + if (sharedState_yy.pre_parse) { + sharedState_yy.pre_parse.call(this, sharedState_yy); } newState = sstack[sp - 1]; @@ -2252,7 +2573,7 @@ parse: function parse(input) { retval = r; break; } else { - // TODO: allow parseError callback to edit symbol and or state tat the start of the error recovery process... + // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process... } } @@ -2345,10 +2666,15 @@ parse: function parse(input) { // read action for current state and first input t = (table[newState] && table[newState][symbol]) || NO_ACTION; - if (!t[0]) { + if (!t[0] || symbol === TERROR) { // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where // (simple) stuff might have been missing before the token which caused the error we're // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! symbol = 0; } @@ -2386,7 +2712,7 @@ parse: function parse(input) { - r = this.performAction.call(yyval, yytext, sharedState.yy, newState, sp - 1, vstack); + r = this.performAction.call(yyval, yytext, newState, sp - 1, vstack); if (typeof r !== 'undefined') { retval = r; @@ -2446,7 +2772,7 @@ parse: function parse(input) { p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); retval = this.parseError(p.errStr, p); } finally { - retval = this.cleanupAfterParse(retval, true); + retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; } @@ -2468,7 +2794,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-154 */ +/* generated by jison-lex 0.3.4-155 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From 23ec008b12521d528c68332f3c1c171726d059f0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 17 Nov 2016 03:42:08 +0100 Subject: [PATCH 221/417] regenerated library files --- lex-parser.js | 75 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 73 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 447066f..56b497e 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -40,9 +40,80 @@ * terminal_descriptions_: (if there are any) {associative list: number ==> description}, * productions_: [...], * - * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, $0 (yysp), yyvstack, yylstack, yystack, yysstack, ...), + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack, ...), * where `...` denotes the (optional) additional arguments the user passed to - * `parser.parse(str, ...)` + * `parser.parse(str, ...)` and specified by way of `%parse-param ...` in the grammar file + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) + * to store/reference the rule value `$$` and location info `@$`. + * + * One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets + * to see the same object via the `this` reference, i.e. if you wish to carry custom + * data from one reduce action through to the next within a single parse run, then you + * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. + * + * - `yytext` : reference to the lexer value which belongs to the last lexer token used + * to match this rule. This is *not* the look-ahead token, but the last token + * that's actually part of this rule. + * + * Formulated another way, `yytext` is the value of the token immediately preceeding + * the current look-ahead token. + * Caveats apply for rules which don't require look-ahead, such as epsilon rules. + * + * - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value. + * + * - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value. + * + * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. + * + * - `yystate` : the current parser state number, used internally for dispatching and + * executing the action code chunk matching the rule currently being reduced. + * + * - `yysp` : the current state stack position (a.k.a. 'stack pointer') + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * Also note that you can access this and other stack index values using the new back-quote + * syntax, i.e. ``$ === `0 === yysp`, while ``1` is the stack index for all things + * related to the first rule term, just like you have `$1` and `@1`. + * This is made available to write very advanced grammar action rules, e.g. when you want + * to investigate the parse state stack in your action code, which would, for example, + * be relevant when you wish to implement error diagnostics and reporting schemes similar + * to the work described here: + * + * + Pottier, F., 2016. Reachability and error diagnosis in LR (1) automata. + * In Journées Francophones des Languages Applicatifs. + * + * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. + * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. + * + * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. + * constructs. + * + * - `yylstack`: reference to the parser token location stack. Also accessed via + * the `@1` etc. constructs. + * + * - `yystack` : reference to the parser token id stack. Also accessed via the + * `#1` etc. constructs. + * + * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to + * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might + * want access for your own purposes, such as error analysis as mentioned above! + * + * Note that this stack stores the current stack of *tokens*, that is the sequence of + * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* + * (lexer tokens *shifted* onto the stack until the rule they belong to is found and + * *reduced*. + * + * - `yysstack`: reference to the parser state stack. This one carries the internal parser + * *states* such as the one in `yystate`, which are used to represent + * the parser state machine in the *parse table*. *Very* *internal* stuff, + * what can I say? If you access this one, you're clearly doing wicked things + * + * - `...` : the extra arguments you specified in the `%parse-param` statement in your + * grammar definition file. * * table: [...], * State transition table From 9cc6a83905f04f696fdb9d31300502110150bd57 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 17 Nov 2016 04:18:58 +0100 Subject: [PATCH 222/417] bump revision & regenerated library files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 8f57ae9..76d01f1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-155", + "version": "0.1.4-156", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From b297ffb0aa36d9af3a5f6e2cb0c93254476f4c74 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 17 Nov 2016 04:38:54 +0100 Subject: [PATCH 223/417] regenerated library files --- lex-parser.js | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 56b497e..8c22fc1 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-155 */ +/* parser generated by jison 0.4.18-156 */ /* * Returns a Parser object of the following structure: * @@ -2436,7 +2436,7 @@ parse: function parse(input) { vstack.length = 0; stack_pointer = 0; - // nuke the error hash info instances created during this run. + // nuke the error hash info instances created during this run. // Userland code must COPY any data/references // in the error hash instance(s) it is more permanently interested in. if (!do_not_nuke_errorinfos) { @@ -2478,10 +2478,10 @@ parse: function parse(input) { lexer: lexer, parser: this, - // and make sure the error info doesn't stay due to potential + // and make sure the error info doesn't stay due to potential // ref cycle via userland code manipulations. // These would otherwise all be memory leak opportunities! - // + // // Note that only array and object references are nuked as those // constitute the set of elements which can produce a cyclic ref. // The rest of the members is kept intact as they are harmless. @@ -2544,13 +2544,13 @@ parse: function parse(input) { var t = table[state][TERROR] || NO_ACTION; if (t[0]) { - // We need to make sure we're not cycling forever: + // We need to make sure we're not cycling forever: // once we hit EOF, even when we `yyerrok()` an error, we must - // prevent the core from running forever, - // e.g. when parent rules are still expecting certain input to + // prevent the core from running forever, + // e.g. when parent rules are still expecting certain input to // follow after this, for example when you handle an error inside a set // of braces which are matched by a parent rule in your grammar. - // + // // Hence we require that every error handling/recovery attempt // *after we've hit EOF* has a diminishing state stack: this means // we will ultimately have unwound the state stack entirely and thus @@ -2741,7 +2741,7 @@ parse: function parse(input) { // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where // (simple) stuff might have been missing before the token which caused the error we're // recovering from now... - // + // // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error // recovery, for then this we would we idling (cycling) on the error forever. // Yes, this does not take into account the possibility that the *lexer* may have @@ -2865,7 +2865,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-155 */ +/* generated by jison-lex 0.3.4-156 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From 1e9d0b424dd2ed151a861ec9fad0a573b94c4487 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 17 Nov 2016 10:57:11 +0100 Subject: [PATCH 224/417] bump build revision & rebuild --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 76d01f1..521c163 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-156", + "version": "0.1.4-157", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 749d5a89933a12ee15409c5424d8c295487bc9c1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 17 Nov 2016 11:54:00 +0100 Subject: [PATCH 225/417] BUGFIX: error reporting code for illegal lexer input was b0rked, using an as-yet **uninitialized** `l2`. Refactored the code (removed a near-identical second error input catch rule, which also had the bad habit of *not* reporting such an event as an *error*!) and now all unidentified lexer input is reported as an error, like you'ld expect from a production tool: no 'weird stuff' in your lexer `.l` specification files will silently make it through without triggering an error report and consequential compile failure: garbage in, failure report out, all the time. --- lex-parser.js | 113 ++++++++++++++++++++++---------------------------- lex.l | 20 ++++----- 2 files changed, 56 insertions(+), 77 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8c22fc1..daf33fb 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3672,59 +3672,50 @@ case 68 : /*! Rule:: %% */ this.begin('rules'); return 22; break; -case 74 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: . */ - - var l1 = Math.min(79 - 3 - 6, yy_.yylloc.first_column); - var l2 = Math.min(79 - 3 - 6 - l2, 3); - var errdsc = this.showPosition(l1, l2); - throw new Error('unsupported input character: ' + yy_.yytext + '\n' + indent(errdsc, 6) + '\n @ ' + this.describeYYLLOC(yy_.yylloc)); /* b0rk on bad characters */ - -break; -case 78 : +case 76 : /*! Conditions:: set */ /*! Rule:: \] */ this.popState('set'); return 60; break; -case 80 : +case 78 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ return 76; // the bit of CODE just before EOF... break; -case 81 : +case 79 : /*! Conditions:: path */ /*! Rule:: {BR} */ this.popState(); this.unput(yy_.yytext); break; -case 82 : +case 80 : /*! Conditions:: path */ /*! Rule:: '[^\r\n]+' */ yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; break; -case 83 : +case 81 : /*! Conditions:: path */ /*! Rule:: "[^\r\n]+" */ yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; break; -case 84 : +case 82 : /*! Conditions:: path */ /*! Rule:: {WS}+ */ // skip whitespace in the line break; -case 85 : +case 83 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ this.popState(); return 74; break; -case 86 : +case 84 : /*! Conditions:: * */ /*! Rule:: . */ - /* ignore unrecognized decl */ - var l1 = Math.min(76 - 4, yy_.yylloc.first_column); - var l2 = Math.min(76 - 4 - l2, 3); - console.warn('ignoring unsupported lexer input: ', yy_.yytext, ' @ ' + this.describeYYLLOC(yy_.yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); + /* b0rk on bad characters */ + var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); + var l2 = 3; + var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); + throw new Error('unsupported lexer input: ', yy_.yytext, ' @ ' + this.describeYYLLOC(yy_.yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); break; default: @@ -3835,18 +3826,18 @@ simpleCaseActionClusters: { /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \} */ 73 : 4, - /*! Conditions:: * */ - /*! Rule:: $ */ - 75 : 1, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 76 : 62, + 74 : 62, /*! Conditions:: set */ /*! Rule:: \{ */ - 77 : 62, + 75 : 62, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79 : 76 + 77 : 76, + /*! Conditions:: * */ + /*! Rule:: $ */ + 85 : 1 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, @@ -3923,8 +3914,6 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*)\\})", "") new XRegExp("^(?:\\{([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*)\\})", ""), /^(?:\{)/, /^(?:\})/, -/^(?:.)/, -/^(?:$)/, /^(?:(?:\\\\|\\\]|[^\]{])+)/, /^(?:\{)/, /^(?:\])/, @@ -3935,17 +3924,18 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*)\\})", "") /^(?:"[^\r\n]+")/, /^(?:([^\S\n\r])+)/, /^(?:\S+)/, -/^(?:.)/ +/^(?:.)/, +/^(?:$)/ ], conditions: { "code": { rules: [ 66, 67, - 75, - 79, - 80, - 86 + 77, + 78, + 84, + 85 ], inclusive: false }, @@ -3954,8 +3944,8 @@ conditions: { 25, 26, 27, - 75, - 86 + 84, + 85 ], inclusive: false }, @@ -3969,8 +3959,8 @@ conditions: { 23, 24, 71, - 75, - 86 + 84, + 85 ], inclusive: false }, @@ -3980,8 +3970,8 @@ conditions: { 10, 11, 12, - 75, - 86 + 84, + 85 ], inclusive: false }, @@ -3996,31 +3986,31 @@ conditions: { 6, 7, 8, - 75, - 86 + 84, + 85 ], inclusive: false }, "path": { rules: [ - 75, + 79, + 80, 81, 82, 83, 84, - 85, - 86 + 85 ], inclusive: false }, "set": { rules: [ 71, + 74, 75, 76, - 77, - 78, - 86 + 84, + 85 ], inclusive: false }, @@ -4065,9 +4055,8 @@ conditions: { 70, 72, 73, - 74, - 75, - 86 + 84, + 85 ], inclusive: true }, @@ -4111,9 +4100,8 @@ conditions: { 70, 72, 73, - 74, - 75, - 86 + 84, + 85 ], inclusive: true }, @@ -4160,9 +4148,8 @@ conditions: { 70, 72, 73, - 74, - 75, - 86 + 84, + 85 ], inclusive: true }, @@ -4205,9 +4192,8 @@ conditions: { 70, 72, 73, - 74, - 75, - 86 + 84, + 85 ], inclusive: true }, @@ -4251,9 +4237,8 @@ conditions: { 70, 72, 73, - 74, - 75, - 86 + 84, + 85 ], inclusive: true } diff --git a/lex.l b/lex.l index 95d1c54..c354009 100644 --- a/lex.l +++ b/lex.l @@ -156,15 +156,6 @@ WS [^\S\r\n] "{" return '{'; "}" return '}'; -. %{ - var l1 = Math.min(79 - 3 - 6, yylloc.first_column); - var l2 = Math.min(79 - 3 - 6 - l2, 3); - var errdsc = this.showPosition(l1, l2); - throw new Error('unsupported input character: ' + yytext + '\n' + indent(errdsc, 6) + '\n @ ' + this.describeYYLLOC(yylloc)); /* b0rk on bad characters */ - %} - -<*><> return 'EOF'; - (?:"\\\\"|"\\]"|[^\]{])+ return 'REGEX_SET'; "{" return 'REGEX_SET'; @@ -185,12 +176,15 @@ WS [^\S\r\n] [^\s\r\n]+ this.popState(); return 'PATH'; <*>. %{ - /* ignore unrecognized decl */ - var l1 = Math.min(76 - 4, yylloc.first_column); - var l2 = Math.min(76 - 4 - l2, 3); - console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + this.describeYYLLOC(yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); + /* b0rk on bad characters */ + var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); + var l2 = 3; + var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); + throw new Error('unsupported lexer input: ', yytext, ' @ ' + this.describeYYLLOC(yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); %} +<*><> return 'EOF'; + %% function indent(s, i) { From 9632888cfa3aaa0223fae0d8cd6a7a7dffb2e090 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 17 Nov 2016 12:03:13 +0100 Subject: [PATCH 226/417] typo fix in comment --- lex.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex.y b/lex.y index 36d8bd4..11e9856 100644 --- a/lex.y +++ b/lex.y @@ -37,7 +37,7 @@ lex /* * WARNING: when you want to refactor this rule, you'll get into a world of hurt - * as then the grammar won't be LALR(1) any longer! The shite start to happen + * as then the grammar won't be LALR(1) any longer! The shite starts to happen * as soon as you take away the EOF in here and move it to the top grammar rule * where it really belongs. Other refactorings of this rule to reduce the code * duplication in these action blocks leads to the same effect, thanks to the From 140c183a65846db0428dcab92c7e9035f2fb7d30 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 17 Nov 2016 22:24:24 +0100 Subject: [PATCH 227/417] refactored/simplified the lexer grammar spec a bit; the old comment about trouble ensuing when you refactor that particular bit of rule set is moot for a while as it was due to some oddball quirks of the old jison; with latest jison these troubles are absent, at least in this case. --- lex-parser.js | 1021 +++++++++++++++++++++++-------------------------- lex.y | 33 +- 2 files changed, 490 insertions(+), 564 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index daf33fb..5efa9b9 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -542,7 +542,7 @@ symbols_: { "definitions": 21, "error": 2, "escape_char": 56, - "extra_lexer_module_code": 24, + "extra_lexer_module_code": 25, "include_macro_code": 35, "init": 20, "lex": 19, @@ -564,7 +564,7 @@ symbols_: { "regex_set": 59, "regex_set_atom": 61, "rule": 39, - "rules": 25, + "rules": 24, "rules_and_epilogue": 23, "start_conditions": 40, "string": 55, @@ -708,8 +708,8 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do productions_: bp({ pop: u([ 19, - s, - [23, 4], + 23, + 23, 20, 21, 21, @@ -719,8 +719,8 @@ productions_: bp({ 30, 32, 32, - 25, - 25, + 24, + 24, 39, s, [41, 3], @@ -758,8 +758,8 @@ productions_: bp({ 68, s, [70, 3], - 24, - 24, + 25, + 25, 35, 35, 75, @@ -768,11 +768,9 @@ productions_: bp({ 72 ]), rule: u([ - 4, - 1, + 5, 3, - 4, - 2, + 1, 0, 2, 0, @@ -785,7 +783,7 @@ productions_: bp({ 1, 2, 2, - 1, + 0, 3, c, [12, 4], @@ -804,8 +802,9 @@ productions_: bp({ 3, c, [24, 3], - c, - [23, 3], + 1, + 3, + 3, s, [2, 5], c, @@ -831,11 +830,11 @@ var yy = this.yy; switch (yystate) { case 1: - /*! Production:: lex : init definitions '%%' rules_and_epilogue */ - this.$ = yyvstack[$0]; - if (yyvstack[$0 - 2][0]) this.$.macros = yyvstack[$0 - 2][0]; - if (yyvstack[$0 - 2][1]) this.$.startConditions = yyvstack[$0 - 2][1]; - if (yyvstack[$0 - 2][2]) this.$.unknownDecls = yyvstack[$0 - 2][2]; + /*! Production:: lex : init definitions '%%' rules_and_epilogue EOF */ + this.$ = yyvstack[$0 - 1]; + if (yyvstack[$0 - 3][0]) this.$.macros = yyvstack[$0 - 3][0]; + if (yyvstack[$0 - 3][1]) this.$.startConditions = yyvstack[$0 - 3][1]; + if (yyvstack[$0 - 3][2]) this.$.unknownDecls = yyvstack[$0 - 3][2]; // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { @@ -855,40 +854,26 @@ case 1: break; case 2: - /*! Production:: rules_and_epilogue : EOF */ - this.$ = { rules: [] }; - break; - -case 3: - /*! Production:: rules_and_epilogue : '%%' extra_lexer_module_code EOF */ - if (yyvstack[$0 - 1] && yyvstack[$0 - 1].trim() !== '') { - this.$ = { rules: [], moduleInclude: yyvstack[$0 - 1] }; - } else { - this.$ = { rules: [] }; - } - break; - -case 4: - /*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code EOF */ - if (yyvstack[$0 - 1] && yyvstack[$0 - 1].trim() !== '') { - this.$ = { rules: yyvstack[$0 - 3], moduleInclude: yyvstack[$0 - 1] }; + /*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code */ + if (yyvstack[$0] && yyvstack[$0].trim() !== '') { + this.$ = { rules: yyvstack[$0 - 2], moduleInclude: yyvstack[$0] }; } else { - this.$ = { rules: yyvstack[$0 - 3] }; + this.$ = { rules: yyvstack[$0 - 2] }; } break; -case 5: - /*! Production:: rules_and_epilogue : rules EOF */ - this.$ = { rules: yyvstack[$0 - 1] }; +case 3: + /*! Production:: rules_and_epilogue : rules */ + this.$ = { rules: yyvstack[$0] }; break; -case 6: +case 4: /*! Production:: init : ε */ yy.actionInclude = []; if (!yy.options) yy.options = {}; break; -case 7: +case 5: /*! Production:: definitions : definition definitions */ this.$ = yyvstack[$0]; if (yyvstack[$0 - 1] != null) { @@ -907,148 +892,151 @@ case 7: } break; -case 8: +case 6: /*! Production:: definitions : ε */ this.$ = [null, null]; break; -case 9: +case 7: /*! Production:: definition : NAME regex */ this.$ = [yyvstack[$0 - 1], yyvstack[$0]]; break; -case 10: +case 8: /*! Production:: definition : START_INC names_inclusive */ -case 11: +case 9: /*! Production:: definition : START_EXC names_exclusive */ -case 25: +case 23: /*! Production:: action : unbracketed_action_body */ -case 26: +case 24: /*! Production:: action : include_macro_code */ -case 29: +case 27: /*! Production:: action_body : action_comments_body */ -case 67: +case 65: /*! Production:: escape_char : ESCAPE_CHAR */ -case 68: +case 66: /*! Production:: range_regex : RANGE_REGEX */ -case 77: +case 75: /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 81: +case 79: /*! Production:: module_code_chunk : CODE */ -case 83: +case 81: /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = yyvstack[$0]; break; -case 12: +case 10: /*! Production:: definition : '{' action_body '}' */ yy.actionInclude.push(yyvstack[$0 - 1]); this.$ = null; break; -case 13: +case 11: /*! Production:: definition : ACTION */ -case 14: +case 12: /*! Production:: definition : include_macro_code */ yy.actionInclude.push(yyvstack[$0]); this.$ = null; break; -case 15: +case 13: /*! Production:: definition : options */ this.$ = null; break; -case 16: +case 14: /*! Production:: definition : UNKNOWN_DECL */ this.$ = {type: 'unknown', body: yyvstack[$0]}; break; -case 17: +case 15: /*! Production:: names_inclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 0; break; -case 18: +case 16: /*! Production:: names_inclusive : names_inclusive START_COND */ this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 0; break; -case 19: +case 17: /*! Production:: names_exclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 1; break; -case 20: +case 18: /*! Production:: names_exclusive : names_exclusive START_COND */ this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 1; break; -case 21: +case 19: /*! Production:: rules : rules rule */ this.$ = yyvstack[$0 - 1]; this.$.push(yyvstack[$0]); break; -case 22: - /*! Production:: rules : rule */ -case 36: - /*! Production:: name_list : NAME */ - this.$ = [yyvstack[$0]]; +case 20: + /*! Production:: rules : ε */ + this.$ = []; break; -case 23: +case 21: /*! Production:: rule : start_conditions regex action */ this.$ = yyvstack[$0 - 2] ? [yyvstack[$0 - 2], yyvstack[$0 - 1], yyvstack[$0]] : [yyvstack[$0 - 1], yyvstack[$0]]; break; -case 24: +case 22: /*! Production:: action : '{' action_body '}' */ -case 33: +case 31: /*! Production:: start_conditions : '<' name_list '>' */ this.$ = yyvstack[$0 - 1]; break; -case 28: +case 26: /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ this.$ = yyvstack[$0 - 1] + '\n' + yyvstack[$0]; break; -case 30: +case 28: /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ this.$ = yyvstack[$0 - 4] + yyvstack[$0 - 3] + yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; break; -case 31: +case 29: /*! Production:: action_comments_body : ε */ -case 40: +case 38: /*! Production:: regex_list : ε */ -case 84: +case 82: /*! Production:: optional_module_code_chunk : ε */ this.$ = ''; break; -case 32: +case 30: /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ -case 44: +case 42: /*! Production:: regex_concat : regex_concat regex_base */ -case 54: +case 52: /*! Production:: regex_base : regex_base range_regex */ -case 63: +case 61: /*! Production:: regex_set : regex_set_atom regex_set */ -case 82: +case 80: /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = yyvstack[$0 - 1] + yyvstack[$0]; break; -case 34: +case 32: /*! Production:: start_conditions : '<' '*' '>' */ this.$ = ['*']; break; -case 37: +case 34: + /*! Production:: name_list : NAME */ + this.$ = [yyvstack[$0]]; + break; + +case 35: /*! Production:: name_list : name_list ',' NAME */ this.$ = yyvstack[$0 - 2]; this.$.push(yyvstack[$0]); break; -case 38: +case 36: /*! Production:: regex : nonempty_regex_list[re] */ // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' @@ -1110,74 +1098,74 @@ case 38: } break; -case 41: +case 39: /*! Production:: nonempty_regex_list : regex_concat '|' regex_list */ this.$ = yyvstack[$0 - 2] + '|' + yyvstack[$0]; break; -case 42: +case 40: /*! Production:: nonempty_regex_list : '|' regex_list */ this.$ = '|' + yyvstack[$0]; break; -case 46: +case 44: /*! Production:: regex_base : '(' regex_list ')' */ this.$ = '(' + yyvstack[$0 - 1] + ')'; break; -case 47: +case 45: /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + ')'; break; -case 48: +case 46: /*! Production:: regex_base : regex_base '+' */ this.$ = yyvstack[$0 - 1] + '+'; break; -case 49: +case 47: /*! Production:: regex_base : regex_base '*' */ this.$ = yyvstack[$0 - 1] + '*'; break; -case 50: +case 48: /*! Production:: regex_base : regex_base '?' */ this.$ = yyvstack[$0 - 1] + '?'; break; -case 51: +case 49: /*! Production:: regex_base : '/' regex_base */ this.$ = '(?=' + yyvstack[$0] + ')'; break; -case 52: +case 50: /*! Production:: regex_base : '/!' regex_base */ this.$ = '(?!' + yyvstack[$0] + ')'; break; -case 56: +case 54: /*! Production:: regex_base : '.' */ this.$ = '.'; break; -case 57: +case 55: /*! Production:: regex_base : '^' */ this.$ = '^'; break; -case 58: +case 56: /*! Production:: regex_base : '$' */ this.$ = '$'; break; -case 62: +case 60: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 78: +case 76: /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; break; -case 66: +case 64: /*! Production:: regex_set_atom : name_expansion */ if (XRegExp._getUnicodeProperty(yyvstack[$0].replace(/[{}]/g, '')) && yyvstack[$0].toUpperCase() !== yyvstack[$0] @@ -1190,24 +1178,24 @@ case 66: //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 69: +case 67: /*! Production:: string : STRING_LIT */ this.$ = prepareString(yyvstack[$0].substr(1, yyvstack[$0].length - 2)); break; -case 74: +case 72: /*! Production:: option : NAME[option] */ yy.options[yyvstack[$0]] = true; break; -case 75: +case 73: /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ -case 76: +case 74: /*! Production:: option : NAME[option] '=' NAME[value] */ yy.options[yyvstack[$0 - 2]] = yyvstack[$0]; break; -case 79: +case 77: /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); var fileContent = fs.readFileSync(yyvstack[$0], { encoding: 'utf-8' }); @@ -1215,7 +1203,7 @@ case 79: this.$ = '\n// Included by Jison: ' + yyvstack[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[$0] + '\n\n'; break; -case 80: +case 78: /*! Production:: include_macro_code : INCLUDE error */ console.error("%include MUST be followed by a valid file path"); break; @@ -1237,7 +1225,7 @@ table: bt({ [9, 4], 2, 3, - 20, + 18, 1, 9, 9, @@ -1264,12 +1252,7 @@ table: bt({ 4, 3, 1, - 1, - 6, 18, - 16, - 21, - 3, 31, 28, 10, @@ -1293,37 +1276,37 @@ table: bt({ 1, 2, 1, - s, - [3, 3], 6, - 1, 16, - 6, - 2, - 1, - 2, + 21, + 3, c, - [33, 4], + [27, 4], 1, s, [2, 3], - c, - [31, 3], 1, + s, + [3, 3], + 6, + 2, + 1, + 2, + 4, + 6, + 3, 16, 5, 17, 16, 17, c, - [107, 3], - 4, - 1, + [103, 3], + 3, 1, 2, 17, 2, - 3, 16 ]), symbol: u([ @@ -1390,25 +1373,23 @@ table: bt({ [73, 6], 22, 23, - 25, - 39, - 40, + 24, 50, 51, c, - [70, 5], + [68, 5], 22, c, - [53, 19], + [51, 19], 9, 10, 11, c, - [39, 5], + [37, 5], c, [16, 5], c, - [115, 12], + [113, 12], c, [28, 16], s, @@ -1428,7 +1409,7 @@ table: bt({ s, [64, 4, 1], c, - [197, 3], + [195, 3], c, [58, 5], c, @@ -1436,7 +1417,7 @@ table: bt({ c, [22, 22], c, - [167, 5], + [165, 5], c, [17, 29], c, @@ -1468,7 +1449,7 @@ table: bt({ 1, 3, c, - [554, 8], + [552, 8], c, [70, 10], c, @@ -1484,36 +1465,23 @@ table: bt({ 18, 27, 69, - s, - [1, 3], - 24, - 72, - 73, - 75, - 76, - c, - [619, 9], - c, - [617, 9], - c, - [18, 9], + 1, c, - [16, 7], + [610, 9], + 39, + 40, c, - [724, 21], - 7, - 27, - 45, + [30, 7], c, - [610, 59], + [563, 59], 3, 11, c, - [707, 9], + [660, 9], c, [10, 10], c, - [498, 134], + [451, 134], 11, 11, c, @@ -1522,7 +1490,7 @@ table: bt({ [28, 27], 60, c, - [528, 3], + [481, 3], 60, 61, 62, @@ -1531,30 +1499,49 @@ table: bt({ c, [3, 4], c, - [444, 27], + [397, 27], c, - [443, 4], + [396, 4], c, - [1037, 4], + [988, 4], 4, c, - [1040, 10], + [991, 10], 69, 27, 71, 1, 1, - 35, + 25, + 72, 73, - 1, + 75, + 76, c, - [440, 3], + [359, 9], c, - [3, 3], + [357, 7], + c, + [1056, 21], + 7, + 27, + 45, + c, + [312, 91], + 60, + 3, + 4, + 27, + 69, c, - [408, 6], + [498, 4], + 35, + 73, + 1, c, - [391, 16], + [538, 3], + 73, + 76, 3, 34, 35, @@ -1566,28 +1553,25 @@ table: bt({ 6, 6, 8, - c, - [309, 91], - 60, 3, 4, - 27, - 69, - c, - [542, 4], + 43, + 44, c, - [133, 6], + [169, 7], c, - [142, 3], + [27, 3], c, - [136, 17], + [172, 15], c, - [189, 4], + [215, 5], c, [21, 9], 34, c, - [565, 23], + [22, 7], + c, + [38, 16], c, [33, 17], c, @@ -1597,21 +1581,15 @@ table: bt({ 27, c, [14, 13], - 3, - 4, c, - [81, 3], - 1, - 3, + [691, 5], 4, c, - [52, 17], - c, - [234, 3], - c, - [739, 3], + [50, 17], + 6, + 8, c, - [90, 15] + [85, 16] ]), type: u([ 2, @@ -1642,13 +1620,15 @@ table: bt({ s, [2, 31], c, - [74, 17], + [74, 13], c, - [55, 39], + [53, 41], c, - [47, 27], + [113, 11], c, - [146, 15], + [81, 18], + c, + [144, 13], c, [64, 24], c, @@ -1660,47 +1640,41 @@ table: bt({ s, [2, 213], c, - [472, 3], + [470, 3], c, [227, 180], c, - [688, 7], - c, - [616, 5], + [686, 7], c, - [436, 12], + [610, 32], c, - [204, 30], + [563, 52], c, - [504, 17], - c, - [47, 15], - c, - [610, 52], - c, - [307, 171], + [260, 171], c, [28, 36], c, - [335, 4], + [298, 4], c, [227, 39], c, [294, 20], c, - [19, 9], + [20, 3], + c, + [62, 24], c, - [408, 14], + [349, 17], c, - [355, 13], + [330, 101], c, - [243, 107], + [1184, 13], c, - [204, 26], + [940, 13], c, - [135, 82], + [128, 24], c, - [81, 44] + [737, 121] ]), state: u([ s, @@ -1725,69 +1699,64 @@ table: bt({ 46, 47, 49, + 50, 52, - 53, + c, + [13, 4], 54, - 57, + 53, c, - [15, 4], - 59, + [21, 6], 58, - c, - [23, 6], - 63, - 59, - 65, + 54, + 60, c, [9, 6], - 59, - 66, - c, + 54, + 61, + c, [8, 6], - 67, + 62, c, [5, 4], - 68, + 63, c, [5, 4], - 72, - 69, - 70, - 79, + 67, + 64, + 65, + 74, 47, - 81, - 82, - 83, - 87, + 78, + 79, 54, - 88, + 81, c, - [68, 7], + [42, 7], + 58, + 58, + 67, + 85, + 65, + 86, + 43, 89, - 59, - 92, + 90, + 91, + 93, c, - [54, 7], - 63, - 63, - 72, - 96, - 70, - 97, - 43, - 101, + [82, 7], + 94, + 98, 103, - 82, - 83, - 107, - 104, - 106, - 113, - 82, - 83, - 115, - 43, - 118 + 100, + 102, + 108, + 109, + 90, + 91, + 110, + 43 ]), mode: u([ s, @@ -1803,15 +1772,13 @@ table: bt({ s, [2, 39], c, - [44, 11], - c, - [51, 28], + [42, 39], c, [103, 7], c, - [52, 11], + [52, 9], c, - [13, 5], + [13, 7], c, [23, 24], c, @@ -1839,45 +1806,43 @@ table: bt({ c, [434, 4], c, - [494, 9], - c, - [567, 30], + [638, 5], c, - [454, 16], + [83, 15], c, - [556, 49], + [521, 49], c, - [441, 158], + [406, 158], c, [184, 27], c, - [767, 30], + [732, 30], c, - [111, 53], + [517, 56], c, - [56, 5], + [57, 17], c, - [94, 10], + [772, 107], c, - [362, 20], + [439, 9], c, - [683, 103], + [221, 8], c, - [436, 8], + [113, 11], c, - [635, 45], + [121, 32], c, - [689, 53], + [153, 54], c, - [211, 23], + [319, 18], c, - [22, 17] + [226, 37] ]), goto: u([ s, - [6, 9], - 8, + [4, 9], 8, + 6, 5, 6, 7, @@ -1904,65 +1869,60 @@ table: bt({ 39, 41, s, - [31, 3], + [29, 3], s, - [13, 9], + [11, 9], s, - [14, 9], + [12, 9], s, - [15, 9], + [13, 9], s, - [16, 9], + [14, 9], 45, 44, 48, - 50, - 55, s, - [35, 6], - 51, - s, - [35, 7], - 7, + [20, 16], + 5, s, - [9, 9], + [7, 9], s, - [38, 9], - 43, - 56, + [36, 9], + 41, + 51, 22, - 43, + 41, c, [94, 4], s, - [43, 6], + [41, 6], c, [100, 7], - 43, - 43, - 40, + 41, + 41, + 38, 20, 22, - 40, + 38, c, [23, 4], s, - [40, 6], + [38, 6], c, [23, 7], - 40, - 40, - 45, - 61, + 38, + 38, + 43, + 56, s, - [45, 3], - 60, - 62, + [43, 3], + 55, + 57, s, - [45, 15], - 64, + [43, 15], + 59, s, - [45, 4], + [43, 4], c, [49, 7], c, @@ -1974,8 +1934,12 @@ table: bt({ c, [12, 12], s, + [51, 27], + s, [53, 27], s, + [54, 27], + s, [55, 27], s, [56, 27], @@ -1984,213 +1948,203 @@ table: bt({ s, [58, 27], s, - [59, 27], - s, - [60, 27], - s, - [61, 29], + [59, 29], 33, - 71, + 66, s, - [69, 27], + [67, 27], s, - [70, 27], + [68, 27], s, - [67, 27], + [65, 27], s, - [10, 7], - 73, - 10, - 10, + [8, 7], + 68, + 8, + 8, s, - [17, 10], + [15, 10], s, - [11, 7], - 74, - 11, - 11, + [9, 7], + 69, + 9, + 9, s, - [19, 10], - 76, - 75, - 29, - 29, - 77, + [17, 10], + 71, + 70, + 27, + 27, + 72, s, - [79, 25], + [77, 25], s, - [80, 25], - 78, - 48, + [78, 25], 73, + 48, + 71, + 75, + 72, + 72, + 76, + 3, 80, - 74, - 74, - 1, - 2, s, - [84, 3], - 86, + [33, 6], + 77, + s, + [33, 7], c, - [567, 7], - 85, + [521, 23], + 42, + 56, s, - [35, 7], + [42, 3], + 55, + 57, s, - [22, 16], - c, - [656, 13], - 90, - 91, - c, - [556, 23], - 44, - 61, + [42, 15], + 59, s, - [44, 3], - 60, - 62, + [42, 4], s, - [44, 15], - 64, + [40, 10], s, - [44, 4], + [37, 10], s, - [42, 10], + [46, 27], s, - [39, 10], + [47, 27], s, [48, 27], s, - [49, 27], + [52, 27], s, - [50, 27], + [66, 27], + 82, + 83, + 49, + 56, s, - [54, 27], + [49, 3], + 55, + 57, s, - [68, 27], - 93, - 94, - 51, - 61, + [49, 15], + 59, s, - [51, 3], - 60, - 62, + [49, 4], + 50, + 56, s, - [51, 15], - 64, + [50, 3], + 55, + 57, s, - [51, 4], - 52, - 61, + [50, 15], + 59, s, - [52, 3], - 60, + [50, 4], + 84, + 33, 62, + 66, s, - [52, 15], - 64, + [63, 3], s, - [52, 4], - 95, - 33, - 64, - 71, - s, - [65, 3], + [64, 3], s, - [66, 3], + [16, 10], s, [18, 10], s, - [20, 10], - s, - [12, 9], - s, - [31, 3], - s, - [32, 3], + [10, 9], s, - [71, 9], - 72, - 99, - 98, - 100, - 77, - 13, - 83, - 83, - 102, + [29, 3], s, - [81, 3], + [30, 3], s, - [84, 3], - 5, + [69, 9], + 70, + 88, + 87, + 1, + 82, + 82, + 92, s, - [21, 16], - 105, - 108, - 13, - 109, - 110, - 111, - 36, - 36, + [19, 16], + c, + [974, 13], + 95, + 96, s, - [41, 10], + [39, 10], s, - [46, 27], + [44, 27], s, - [47, 27], + [45, 27], s, - [62, 27], - 63, - 76, - 112, - 75, + [60, 27], + 61, + 71, + 97, + 73, + 73, + 74, + 74, + 2, 75, - 76, - 76, - 3, + 13, + 81, + 81, + 99, s, - [84, 3], + [79, 3], + 101, + 104, + 13, + 105, + 106, + 107, + 34, + 34, s, - [82, 3], - 114, + [29, 3], + c, + [152, 3], s, - [23, 16], + [80, 3], s, - [31, 3], + [21, 16], s, - [25, 9], - 116, + [29, 3], s, - [25, 7], + [23, 9], + 111, s, - [26, 16], + [23, 7], s, - [27, 17], + [24, 16], s, - [33, 13], - 117, + [25, 17], s, - [34, 13], + [31, 13], + 112, s, - [31, 3], - 78, - 4, + [32, 13], + 28, + 28, + 72, 76, - 119, + 71, + 113, s, - [28, 17], - 37, - 37, - 30, - 30, - 77, + [26, 17], + 35, + 35, s, - [24, 16] + [22, 16] ]) }), defaultActions: bda({ @@ -2198,9 +2152,8 @@ defaultActions: bda({ 0, s, [8, 5, 1], - 16, - 17, - 18, + s, + [15, 4, 1], s, [26, 8, 1], 35, @@ -2210,95 +2163,89 @@ defaultActions: bda({ 41, 44, 45, - 49, - 50, - 53, s, - [58, 7, 1], + [53, 7, 1], s, - [71, 9, 1], - 84, - 86, - 87, + [66, 9, 1], + 76, + 78, s, - [91, 6, 1], - 98, + [81, 5, 1], + 87, + 88, + 89, + 92, + 96, + 97, 99, 100, - 102, + 101, + 103, 104, - 105, - 107, - 108, - 109, s, - [111, 4, 1], - 116, - 117, - 119 + [105, 4, 2], + 112, + 113 ]), goto: u([ - 6, - 31, + 4, + 29, s, - [13, 4, 1], + [11, 4, 1], + 20, + 5, 7, - 9, - 38, - 53, + 36, + 51, s, - [55, 7, 1], - 69, - 70, + [53, 7, 1], 67, - 17, - 19, - 79, - 80, - 1, - 2, - 22, - 42, - 39, - 48, - 49, - 50, - 54, 68, 65, + 15, + 17, + 77, + 78, + 40, + 37, + 46, + 47, + 48, + 52, 66, + 63, + 64, + 16, 18, - 20, - 12, + 10, + 29, + 30, + 69, + 70, + 1, + 19, + 39, + 44, + 45, + 60, + 61, + 73, + 74, + 2, + 79, + 34, + 29, + 80, + 21, + 29, + 24, + 25, 31, 32, - 71, - 72, - 81, - 5, - 21, - 36, - 41, - 46, - 47, - 62, - 63, - 75, 76, - 3, - 82, - 23, - 31, 26, - 27, - 33, - 34, - 31, - 78, - 4, - 28, - 37, - 24 + 35, + 22 ]) }), parseError: function parseError(str, hash) { diff --git a/lex.y b/lex.y index 11e9856..0f844a3 100644 --- a/lex.y +++ b/lex.y @@ -10,7 +10,7 @@ %% lex - : init definitions '%%' rules_and_epilogue + : init definitions '%%' rules_and_epilogue EOF { $$ = $rules_and_epilogue; if ($definitions[0]) $$.macros = $definitions[0]; @@ -35,30 +35,8 @@ lex } ; -/* - * WARNING: when you want to refactor this rule, you'll get into a world of hurt - * as then the grammar won't be LALR(1) any longer! The shite starts to happen - * as soon as you take away the EOF in here and move it to the top grammar rule - * where it really belongs. Other refactorings of this rule to reduce the code - * duplication in these action blocks leads to the same effect, thanks to the - * different refactored rules then fighting it out in reduce/reduce conflicts - * thanks to the epsilon rules everywhere in there. You have been warned... - */ rules_and_epilogue - : EOF - /* an empty rules set is allowed when you are setting up an `%options custom_lexer` */ - { - $$ = { rules: [] }; - } - | '%%' extra_lexer_module_code EOF - { - if ($extra_lexer_module_code && $extra_lexer_module_code.trim() !== '') { - $$ = { rules: [], moduleInclude: $extra_lexer_module_code }; - } else { - $$ = { rules: [] }; - } - } - | rules '%%' extra_lexer_module_code EOF + : rules '%%' extra_lexer_module_code { if ($extra_lexer_module_code && $extra_lexer_module_code.trim() !== '') { $$ = { rules: $rules, moduleInclude: $extra_lexer_module_code }; @@ -66,7 +44,8 @@ rules_and_epilogue $$ = { rules: $rules }; } } - | rules EOF + | rules + /* Note: an empty rules set is allowed when you are setting up an `%options custom_lexer` */ { $$ = { rules: $rules }; } @@ -141,8 +120,8 @@ names_exclusive rules : rules rule { $$ = $rules; $$.push($rule); } - | rule - { $$ = [$rule]; } + | ε + { $$ = []; } ; rule From 2b26d629ff6abf3b927332a13680cc788aa9efd3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 18 Nov 2016 03:40:30 +0100 Subject: [PATCH 228/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 521c163..08ac5d7 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-157", + "version": "0.1.4-158", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 7e405c85567dafcb5a55b12e761dd159fd62fa4e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 18 Nov 2016 04:10:17 +0100 Subject: [PATCH 229/417] rebuild library files --- lex-parser.js | 133 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 104 insertions(+), 29 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 5efa9b9..dfbdcd2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-156 */ +/* parser generated by jison 0.4.18-158 */ /* * Returns a Parser object of the following structure: * @@ -386,6 +386,7 @@ JisonParserError.prototype.name = 'JisonParserError'; + // helper: reconstruct the productions[] table function bp(s) { var rv = []; @@ -400,6 +401,8 @@ function bp(s) { return rv; } + + // helper: reconstruct the defaultActions[] table function bda(s) { var rv = {}; @@ -412,6 +415,8 @@ function bda(s) { return rv; } + + // helper: reconstruct the 'goto' table function bt(s) { var rv = []; @@ -450,6 +455,8 @@ function bt(s) { return rv; } + + // helper: runlength encoding with increment step: code, length: step (default step = 0) // `this` references an array function s(c, l, a) { @@ -485,6 +492,7 @@ function u(a) { return rv; } + var parser = { trace: function no_op_trace() { }, JisonParserError: JisonParserError, @@ -2361,6 +2369,11 @@ parse: function parse(input) { if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. + // clean up the lingering lexer structures as well: + if (lexer.cleanupAfterLex) { + lexer.cleanupAfterLex(do_not_nuke_errorinfos); + } + // prevent lingering circular references from causing memory leaks: if (sharedState_yy) { sharedState_yy.parseError = undefined; @@ -2812,7 +2825,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-156 */ +/* generated by jison-lex 0.3.4-158 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 @@ -2857,13 +2870,13 @@ function JisonLexerError(msg, hash) { } } - if (typeof Object.setPrototypeOf === 'function') { - Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); - } else { - JisonLexerError.prototype = Object.create(Error.prototype); - } - JisonLexerError.prototype.constructor = JisonLexerError; - JisonLexerError.prototype.name = 'JisonLexerError'; +if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); +} else { + JisonLexerError.prototype = Object.create(Error.prototype); +} +JisonLexerError.prototype.constructor = JisonLexerError; +JisonLexerError.prototype.name = 'JisonLexerError'; var lexer = { @@ -2878,14 +2891,85 @@ var lexer = { __currentRuleSet__: null, // <-- internal rule set cache for the current lexer state + __error_infos: [], // INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + + // INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + var pei = { + errStr: msg, + recoverable: !!recoverable, + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + token: null, + line: this.yylineno, + loc: this.yylloc, + yy: this.yy, + lexer: this, + + // and make sure the error info doesn't stay due to potential + // ref cycle via userland code manipulations. + // These would otherwise all be memory leak opportunities! + // + // Note that only array and object references are nuked as those + // constitute the set of elements which can produce a cyclic ref. + // The rest of the members is kept intact as they are harmless. + destroy: function destructLexErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // ... + var rec = !!this.recoverable; + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; + } + } + this.recoverable = rec; + } + }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + return pei; + }, + parseError: function lexer_parseError(str, hash) { if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { return this.yy.parser.parseError(str, hash) || this.ERROR; + } else if (typeof this.yy.parseError === 'function') { + return this.yy.parseError.call(this, str, hash) || this.ERROR; } else { throw new this.JisonLexerError(str); } }, + // final cleanup function for when we have completed lexing the input; + // make it an API so that external code can use this one once userland + // code has decided it's time to destroy any lingering lexer error + // hash object instances and the like: this function helps to clean + // up these constructs, which *may* carry cyclic references which would + // otherwise prevent the instances from being properly and timely + // garbage-collected, i.e. this function helps prevent memory leaks! + cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + var rv; + + // prevent lingering circular references from causing memory leaks: + this.setInput('', {}); + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_infos.length = 0; + } + + return this; + }, + // clear the lexer token context; intended for internal use only clear: function lexer_clear() { this.yytext = ''; @@ -2899,9 +2983,11 @@ var lexer = { // resets the lexer, sets new input setInput: function lexer_setInput(input, yy) { this.yy = yy || this.yy || {}; - this._input = input; + + this._input = input || ''; this.clear(); - this._signaled_error_token = this.done = false; + this._signaled_error_token = false; + this.done = false; this.yylineno = 0; this.matched = ''; this.conditionStack = ['INITIAL']; @@ -3014,13 +3100,8 @@ var lexer = { // when the parseError() call returns, we MUST ensure that the error is registered. // We accomplish this by signaling an 'error' token to be produced for the current // .lex() run. - this._signaled_error_token = (this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), { - text: this.match, - token: null, - line: this.yylineno, - loc: this.yylloc, - lexer: this - }) || this.ERROR); + var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), false); + this._signaled_error_token = (this.parseError(p.errStr, p) || this.ERROR); } return this; }, @@ -3053,7 +3134,7 @@ var lexer = { var a = past.replace(/\r\n|\r/g, '\n').split('\n'); a = a.slice(-maxLines); past = a.join('\n'); - // When, after limiting to maxLines, we still have to much to return, + // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis prefix... if (past.length > maxSize) { past = '...' + past.substr(-maxSize); @@ -3086,7 +3167,7 @@ var lexer = { var a = next.replace(/\r\n|\r/g, '\n').split('\n'); a = a.slice(0, maxLines); next = a.join('\n'); - // When, after limiting to maxLines, we still have to much to return, + // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis postfix... if (next.length > maxSize) { next = next.substring(0, maxSize) + '...'; @@ -3103,7 +3184,7 @@ var lexer = { // helper function, used to produce a human readable description as a string, given // the input `yylloc` location object. - // Set `display_range_too` to TRUE to include the string character inex position(s) + // Set `display_range_too` to TRUE to include the string character index position(s) // in the description if the `yylloc.range` is available. describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { var l1 = yylloc.first_line; @@ -3286,17 +3367,11 @@ var lexer = { return false; } if (this._input === '') { - this.clear(); this.done = true; return this.EOF; } else { - token = this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { - text: this.match + this._input, - token: null, - line: this.yylineno, - loc: this.yylloc, - lexer: this - }) || this.ERROR; + var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); + token = (this.parseError(p.errStr, p) || this.ERROR); if (token === this.ERROR) { // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward at least one character at a time: if (!this.match.length) { From 19f79612fe6825e6c4de45dfcc7f6a86da7c7896 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 18 Nov 2016 22:05:20 +0100 Subject: [PATCH 230/417] augmented the comment for one of the lexer rules to better explain *why* we have it do that. Also remove duplicate single quote from lexer rule -- modern jison will optimize it out of the regex anyway, but this is more in line with how the regex should 'read', anyway. --- lex-parser.js | 4 ++-- lex.l | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index dfbdcd2..7d3d7ab 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3753,7 +3753,7 @@ simpleCaseActionClusters: { /*! Rule:: \/\/.* */ 1 : 44, /*! Conditions:: action */ - /*! Rule:: \/[^ /]*?['"{}'][^ ]*?\/ */ + /*! Rule:: \/[^ /]*?['"{}][^ ]*?\/ */ 2 : 44, /*! Conditions:: action */ /*! Rule:: "(\\\\|\\"|[^"])*" */ @@ -3864,7 +3864,7 @@ simpleCaseActionClusters: { rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/.*)/, -/^(?:\/[^ \/]*?["'{}][^ ]*?\/)/, +/^(?:\/[^ \/]*?['"{}][^ ]*?\/)/, /^(?:"(\\\\|\\"|[^"])*")/, /^(?:'(\\\\|\\'|[^'])*')/, /^(?:[\/"'][^{}\/"']+)/, diff --git a/lex.l b/lex.l index c354009..7170445 100644 --- a/lex.l +++ b/lex.l @@ -29,8 +29,8 @@ WS [^\S\r\n] "/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; "//".* return 'ACTION_BODY'; -// regexp with braces or quotes (and no spaces): -"/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; +// regexp with braces or quotes (and no spaces, so we don't mistake a *division operator* `/` for a regex delimiter here in most circumstances): +"/"[^ /]*?['"{}][^ ]*?"/" return 'ACTION_BODY'; \"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; "'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; [/"'][^{}/"']+ return 'ACTION_BODY'; From 3df86025598b2eb3b6ca902fa80ebc208b751e3a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 18 Nov 2016 22:38:05 +0100 Subject: [PATCH 231/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 08ac5d7..46a1c71 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-158", + "version": "0.1.4-159", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 9707b653bcf399e5604d61f263099a89b181173f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 19 Nov 2016 03:05:02 +0100 Subject: [PATCH 232/417] rebuild library files --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 7d3d7ab..afbf47e 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-158 */ +/* parser generated by jison 0.4.18-159 */ /* * Returns a Parser object of the following structure: * @@ -2825,7 +2825,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-158 */ +/* generated by jison-lex 0.3.4-159 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From ec856a0d698b3f41e1595fd975f6a3dd5e668cb6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 3 Dec 2016 01:00:43 +0100 Subject: [PATCH 233/417] rebuild library files --- lex-parser.js | 162 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 151 insertions(+), 11 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index afbf47e..455f25d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2891,7 +2891,26 @@ var lexer = { __currentRuleSet__: null, // <-- internal rule set cache for the current lexer state - __error_infos: [], // INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __error_infos: [], // INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + + __decompressed: false, // INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + + done: false, // INTERNAL USE ONLY + _backtrack: false, // INTERNAL USE ONLY + _input: '', // INTERNAL USE ONLY + _more: false, // INTERNAL USE ONLY + _signaled_error_token: false, // INTERNAL USE ONLY + + conditionStack: [], // INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + + match: '', // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', // ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction // INTERNAL USE: construct a suitable error info hash object instance for `parseError`. constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { @@ -2984,6 +3003,100 @@ var lexer = { setInput: function lexer_setInput(input, yy) { this.yy = yy || this.yy || {}; + // also check if we've fully initialized the lexer instance, + // including expansion work to be done to go from a loaded + // lexer to a usable lexer: + if (!this.__decompressed) { + // step 1: decompress the regex list: + var rules = this.rules; + for (var i = 0, len = rules.length; i < len; i++) { + var rule_re = rules[i]; + + // compression: is the RE an xref to another RE slot in the rules[] table? + if (typeof rule_re === 'number') { + rules[i] = rules[rule_re]; + } + } + + // step 2: unfold the conditions[] set to make these ready for use: + var conditions = this.conditions; + for (var k in conditions) { + var spec = conditions[k]; + + var rule_ids = spec.rules; + + var len = rule_ids.length; + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_new_ids = new Array(len + 1); + + if (this.rules_prefix1) { + var rule_prefixes = new Array(65536); + var first_catch_all_index = 0; + + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; + + var prefix = this.rules_prefix1[idx]; + // compression: is the PREFIX-STRING an xref to another PREFIX-STRING slot in the rules_prefix1[] table? + if (typeof prefix === 'number') { + prefix = this.rules_prefix1[prefix]; + } + // init the prefix lookup table: first come, first serve... + if (!prefix) { + if (!first_catch_all_index) { + first_catch_all_index = i + 1; + } + } else { + for (var j = 0, pfxlen = prefix.length; j < pfxlen; j++) { + var pfxch = prefix.charCodeAt(j); + // first come, first serve: + if (!rule_prefixes[pfxch]) { + rule_prefixes[pfxch] = i + 1; + } + } + } + } + + // if no catch-all prefix has been encountered yet, it means all + // rules have limited prefix sets and it MAY be that particular + // input characters won't be recognized by any rule in this + // condition state. + // + // To speed up their discovery at run-time while keeping the + // remainder of the lexer kernel code very simple (and fast), + // we point these to an 'illegal' rule set index *beyond* + // the end of the rule set. + if (!first_catch_all_index) { + first_catch_all_index = len + 1; + } + + for (var i = 0; i < 65536; i++) { + if (!rule_prefixes[i]) { + rule_prefixes[i] = first_catch_all_index; + } + } + + spec.__dispatch_lut = rule_prefixes; + } else { + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; + } + } + + spec.rules = rule_new_ids; + spec.__rule_regexes = rule_regexes; + spec.__rule_count = len; + } + + this.__decompressed = true; + } + this._input = input || ''; this.clear(); this._signaled_error_token = false; @@ -3290,7 +3403,14 @@ var lexer = { this._backtrack = false; this._input = this._input.slice(match_str.length); this.matched += match_str; - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); + + // calling this method: + // + // function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) {...} + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */); + // otherwise, when the action codes are all simple return token statements: + //token = this.simpleCaseActionClusters[indexed_rule]; + if (this.done && this._input) { this.done = false; } @@ -3329,21 +3449,41 @@ var lexer = { if (!this._more) { this.clear(); } - var rules = this.__currentRuleSet__; - if (!rules) { + var spec = this.__currentRuleSet__; + if (!spec) { // Update the ruleset cache as we apparently encountered a state change or just started lexing. // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps // speed up those activities a tiny bit. - rules = this.__currentRuleSet__ = this._currentRules(); + spec = this.__currentRuleSet__ = this._currentRules(); } - for (var i = 0, len = rules.length; i < len; i++) { - tempMatch = this._input.match(this.rules[rules[i]]); + + var rule_ids = spec.rules; +// var dispatch = spec.__dispatch_lut; + var regexes = spec.__rule_regexes; + var len = spec.__rule_count; + +// var c0 = this._input[0]; + + // Note: the arrays are 1-based, while `len` itself is a valid index, + // hence the non-standard less-or-equal check in the next loop condition! + // + // `dispatch` is a lookup table which lists the *first* rule which matches the 1-char *prefix* of the rule-to-match. + // By using that array as a jumpstart, we can cut down on the otherwise O(n*m) behaviour of this lexer, down to + // O(n) ideally, where: + // + // - N is the number of input particles -- which is not precisely characters + // as we progress on a per-regex-match basis rather than on a per-character basis + // + // - M is the number of rules (regexes) to test in the active condition state. + // + for (var i = 1 /* (dispatch[c0] || 1) */ ; i <= len; i++) { + tempMatch = this._input.match(regexes[i]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rules[i]); + token = this.test_match(tempMatch, rule_ids[i]); if (token !== false) { return token; } else if (this._backtrack) { @@ -3359,7 +3499,7 @@ var lexer = { } } if (match) { - token = this.test_match(match, rules[index]); + token = this.test_match(match, rule_ids[index]); if (token !== false) { return token; } @@ -3437,9 +3577,9 @@ var lexer = { // (internal) determine the lexer rule set which is active for the currently active lexer condition state _currentRules: function lexer__currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; + return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; } else { - return this.conditions['INITIAL'].rules; + return this.conditions['INITIAL']; } }, From 3a7aa5382976827a8f03970cea51d52b408153cd Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Dec 2016 20:24:21 +0100 Subject: [PATCH 234/417] `yytext.length` --> `yyleng` --- README.md | 8 ++++---- tests/lex/lex_grammar.jisonlex | 4 ++-- tests/lex/lex_grammar.lex.json | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 5ee1512..d5b84a3 100644 --- a/README.md +++ b/README.md @@ -94,8 +94,8 @@ WS [^\S\r\n] %} {NAME} return 'NAME'; "=" return '='; -\"("\\\\"|'\"'|[^"])*\" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; -"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; +\"("\\\\"|'\"'|[^"])*\" yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; +"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; [^\s\r\n]+ return 'OPTION_VALUE'; {BR}+ this.popState(); return 'OPTIONS_END'; {WS}+ /* skip whitespace */ @@ -107,8 +107,8 @@ WS [^\S\r\n] {WS}*{BR}+ this.begin('rules'); "{" yy.depth = 0; this.begin('action'); return '{'; -"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; -"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; +"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; +"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; "%include" %{ // This is an include instruction in place of an action: // thanks to the `.+` rule immediately below we need to semi-duplicate diff --git a/tests/lex/lex_grammar.jisonlex b/tests/lex/lex_grammar.jisonlex index 5142b8b..e57ac31 100644 --- a/tests/lex/lex_grammar.jisonlex +++ b/tests/lex/lex_grammar.jisonlex @@ -2,7 +2,7 @@ %% \n+ {yy.freshLine = true;} \s+ {yy.freshLine = false;} -"y{"[^}]*"}" {yytext = yytext.substr(2, yytext.length-3);return 'ACTION';} +"y{"[^}]*"}" {yytext = yytext.substr(2, yyleng-3);return 'ACTION';} [a-zA-Z_][a-zA-Z0-9_]* {return 'NAME';} '"'([^"]|'\"')*'"' {return 'STRING_LIT';} "'"([^']|"\'")*"'" {return 'STRING_LIT';} @@ -23,7 +23,7 @@ "{"\d+(","\s?\d+|",")?"}" {return 'RANGE_REGEX';} /"{" %{if(yy.freshLine){this.input('{');return '{';} else this.unput('y');%} "}" %{return '}';%} -"%{"(.|\n)*?"}%" {yytext = yytext.substr(2, yytext.length-4);return 'ACTION';} +"%{"(.|\n)*?"}%" {yytext = yytext.substr(2, yyleng-4);return 'ACTION';} . {/* ignore bad characters */} <> {return 'EOF';} diff --git a/tests/lex/lex_grammar.lex.json b/tests/lex/lex_grammar.lex.json index e608c0b..6c5ac3e 100644 --- a/tests/lex/lex_grammar.lex.json +++ b/tests/lex/lex_grammar.lex.json @@ -2,7 +2,7 @@ "rules": [ ["\\n+", "yy.freshLine = true;"], ["\\s+", "yy.freshLine = false;"], - ["y\\{[^}]*\\}", "yytext = yytext.substr(2, yytext.length-3);return 'ACTION';"], + ["y\\{[^}]*\\}", "yytext = yytext.substr(2, yyleng-3);return 'ACTION';"], ["[a-zA-Z_][a-zA-Z0-9_]*", "return 'NAME';"], ["\"([^\"]|\\\\\")*\"", "return 'STRING_LIT';"], ["'([^']|\\\\')*'", "return 'STRING_LIT';"], @@ -23,7 +23,7 @@ ["\\{\\d+(,\\s?\\d+|,)?\\}", "return 'RANGE_REGEX';"], ["(?=\\{)", "if(yy.freshLine){this.input('{');return '{';} else this.unput('y');"], ["\\}", "return '}';"], - ["%\\{(.|\\n)*?\\}%", "yytext = yytext.substr(2, yytext.length-4);return 'ACTION';"], + ["%\\{(.|\\n)*?\\}%", "yytext = yytext.substr(2, yyleng-4);return 'ACTION';"], [".", "/* ignore bad characters */"], ["$", "return 'EOF';"] ] From 7774a053ee3bb7b6288987c76d26a18f44993ce1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Dec 2016 20:29:37 +0100 Subject: [PATCH 235/417] - unified lexers `bnf.l`, `ebnf.y` and `lex-parser/lex.l` - `yytext.length` --> `yyleng` - regenerated parsers --- lex-parser.js | 46 +++++++++++++++++++++++----------------------- lex.l | 34 ++++++++++++++++++++++++---------- 2 files changed, 47 insertions(+), 33 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 455f25d..9bea0b4 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3650,13 +3650,13 @@ case 17 : break; case 20 : /*! Conditions:: options */ -/*! Rule:: "(\\\\|\\"|[^"])*" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 71; +/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 71; break; case 21 : /*! Conditions:: options */ -/*! Rule:: '(\\\\|\\'|[^'])*' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yytext.length - 2); return 71; +/*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 71; break; case 23 : /*! Conditions:: options */ @@ -3691,12 +3691,12 @@ break; case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 34; + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 34; break; case 31 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yytext.length - 4); return 34; + yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 34; break; case 32 : /*! Conditions:: indented */ @@ -3767,12 +3767,12 @@ case 40 : break; case 41 : /*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: "(\\\\|\\"|[^"])*" */ +/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 65; break; case 42 : /*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: '(\\\\|\\'|[^'])*' */ +/*! Rule:: '{QUOTED_STRING_CONTENT}' */ yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 65; break; case 43 : @@ -3851,12 +3851,12 @@ case 79 : break; case 80 : /*! Conditions:: path */ -/*! Rule:: '[^\r\n]+' */ +/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; break; case 81 : /*! Conditions:: path */ -/*! Rule:: "[^\r\n]+" */ +/*! Rule:: '{QUOTED_STRING_CONTENT}' */ yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; break; case 82 : @@ -4011,7 +4011,7 @@ rules: [ /^(?:[^{}\/"']+)/, /^(?:\{)/, /^(?:\})/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*[\\p{Alphabetic}\\p{Number}_])?))", ""), +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", ""), /^(?:>)/, /^(?:,)/, /^(?:\*)/, @@ -4020,14 +4020,14 @@ new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*[\\p{Alp /^(?:([^\S\n\r])+)/, /^(?:%%)/, /^(?:[^\s!"$%'-,.\/:-?\[-\^{-}]+)/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*[\\p{Alphabetic}\\p{Number}_])?))", ""), +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", ""), /^(?:=)/, -/^(?:"(\\\\|\\"|[^"])*")/, -/^(?:'(\\\\|\\'|[^'])*')/, +/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, +/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, /^(?:\S+)/, /^(?:(\r\n|\n|\r)+)/, /^(?:([^\S\n\r])+)/, -new XRegExp("^(?:([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*))", ""), +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), /^(?:(\r\n|\n|\r)+)/, /^(?:([^\S\n\r])+)/, /^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, @@ -4038,13 +4038,13 @@ new XRegExp("^(?:([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*))", ""), /^(?:.*)/, /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/[^\r\n]*)/, -new XRegExp("^(?:([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*))", ""), +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), /^(?:(\r\n|\n|\r)+)/, /^(?:[^\s!"$%'-,.\/:<-?\[-\^{-}]+)/, /^(?:(\r\n|\n|\r)+)/, /^(?:\s+)/, -/^(?:"(\\\\|\\"|[^"])*")/, -/^(?:'(\\\\|\\'|[^'])*')/, +/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, +/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, /^(?:\[)/, /^(?:\|)/, /^(?:\(\?:)/, @@ -4069,11 +4069,11 @@ new XRegExp("^(?:([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*))", ""), /^(?:%s\b)/, /^(?:%x\b)/, /^(?:%include\b)/, -new XRegExp("^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*[\\p{Alphabetic}\\p{Number}_])?)[^\\n\\r]+)", ""), +new XRegExp("^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)[^\\n\\r]+)", ""), /^(?:%%)/, /^(?:\{\d+(,\s?\d+|,)?\})/, -new XRegExp("^(?:\\{([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*)\\})", ""), -new XRegExp("^(?:\\{([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*)\\})", ""), +new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", ""), +new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", ""), /^(?:\{)/, /^(?:\})/, /^(?:(?:\\\\|\\\]|[^\]{])+)/, @@ -4082,8 +4082,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_][\\p{Alphabetic}\\p{Number}_]*)\\})", "") /^(?:[^\r\n]*(\r|\n)+)/, /^(?:[^\r\n]+)/, /^(?:(\r\n|\n|\r))/, -/^(?:'[^\r\n]+')/, -/^(?:"[^\r\n]+")/, +/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, +/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, /^(?:([^\S\n\r])+)/, /^(?:\S+)/, /^(?:.)/, diff --git a/lex.l b/lex.l index 7170445..324fcf6 100644 --- a/lex.l +++ b/lex.l @@ -7,14 +7,21 @@ UNICODE_LETTER [\p{Alphabetic}] ALPHA [{UNICODE_LETTER}_] DIGIT [\p{Number}] WHITESPACE [\s\r\n\p{Separator}] +ALNUM [{ALPHA}{DIGIT}] -NAME [{ALPHA}](?:[{ALPHA}{DIGIT}-]*[{ALPHA}{DIGIT}])? -ID [{ALPHA}][{ALPHA}{DIGIT}]* +NAME [{ALPHA}](?:[{ALNUM}-]*{ALNUM})? +ID [{ALPHA}]{ALNUM}* +DECIMAL_NUMBER [1-9][0-9]* +HEX_NUMBER "0"[xX][0-9a-fA-F]+ BR \r\n|\n|\r // WhiteSpace MUST NOT match CR/LF and the regex `\s` DOES, so we cannot use // that one directly. Instead we define the {WS} macro here: WS [^\S\r\n] +// Quoted string content: support *escaped* quotes inside strings: +QUOTED_STRING_CONTENT (?:\\\'|\\[^\']|[^\\\'])* +DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* + %s indented trail rules macro %x code start_condition options conditions action path set @@ -25,6 +32,7 @@ WS [^\S\r\n] %options xregexp + %% "/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; @@ -62,8 +70,10 @@ WS [^\S\r\n] %} {NAME} return 'NAME'; "=" return '='; -\"("\\\\"|'\"'|[^"])*\" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; -"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.substr(1, yytext.length - 2); return 'OPTION_VALUE'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" + yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; +\'{QUOTED_STRING_CONTENT}\' + yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; [^\s\r\n]+ return 'OPTION_VALUE'; {BR}+ this.popState(); return 'OPTIONS_END'; {WS}+ /* skip whitespace */ @@ -75,8 +85,8 @@ WS [^\S\r\n] {WS}*{BR}+ this.begin('rules'); "{" yy.depth = 0; this.begin('action'); return '{'; -"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; -"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yytext.length - 4); return 'ACTION'; +"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; +"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; "%include" %{ // This is an include instruction in place of an action: // thanks to the `.+` rule immediately below we need to semi-duplicate @@ -116,8 +126,10 @@ WS [^\S\r\n] {BR}+ /* empty */ \s+ /* empty */ -\"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; -"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" + yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; +\'{QUOTED_STRING_CONTENT}\' + yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; "[" this.pushState('set'); return 'REGEX_SET_START'; "|" return '|'; "(?:" return 'SPECIAL_GROUP'; @@ -170,8 +182,10 @@ WS [^\S\r\n] {BR} this.popState(); this.unput(yytext); -"'"[^\r\n]+"'" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; -'"'[^\r\n]+'"' yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" + yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +\'{QUOTED_STRING_CONTENT}\' + yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; {WS}+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; From 69b24ab8f1faa408c2024a95019d9f6d5401ac10 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Dec 2016 23:08:28 +0100 Subject: [PATCH 236/417] bumped revision and rebuilt --- README.md | 86 ++++++++++++++++++++++++++++++++++++--------------- lex-parser.js | 2 +- lex.l | 3 +- package.json | 2 +- 4 files changed, 65 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index d5b84a3..46334d0 100644 --- a/README.md +++ b/README.md @@ -36,19 +36,28 @@ The parser can parse its own lexical grammar, shown below: ``` ASCII_LETTER [a-zA-z] -// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge with {UNICODE_LETTER}: +// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge +// with {UNICODE_LETTER} (though jison has code to optimize if you *did* +// include the `[a-zA-Z]` anyway): UNICODE_LETTER [\p{Alphabetic}] ALPHA [{UNICODE_LETTER}_] DIGIT [\p{Number}] WHITESPACE [\s\r\n\p{Separator}] +ALNUM [{ALPHA}{DIGIT}] -NAME [{ALPHA}](?:[{ALPHA}{DIGIT}-]*[{ALPHA}{DIGIT}])? -ID [{ALPHA}][{ALPHA}{DIGIT}]* +NAME [{ALPHA}](?:[{ALNUM}-]*{ALNUM})? +ID [{ALPHA}]{ALNUM}* +DECIMAL_NUMBER [1-9][0-9]* +HEX_NUMBER "0"[xX][0-9a-fA-F]+ BR \r\n|\n|\r -// WhiteSpace MUST NOT match CR/LF and the regex `\s` DOES, so we cannot use that one directly. -// Instead we define the {WS} macro here: +// WhiteSpace MUST NOT match CR/LF and the regex `\s` DOES, so we cannot use +// that one directly. Instead we define the {WS} macro here: WS [^\S\r\n] +// Quoted string content: support *escaped* quotes inside strings: +QUOTED_STRING_CONTENT (?:\\\'|\\[^\']|[^\\\'])* +DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* + %s indented trail rules macro %x code start_condition options conditions action path set @@ -64,18 +73,30 @@ WS [^\S\r\n] %options easy_keyword_rules %options ranges +%options xregexp + + %% "/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; "//".* return 'ACTION_BODY'; -"/"[^ /]*?['"{}'][^ ]*?"/" return 'ACTION_BODY'; // regexp with braces or quotes (and no spaces) +// regexp with braces or quotes (and no spaces, so we don't mistake +// a *division operator* `/` for a regex delimiter here in most circumstances): +"/"[^ /]*?['"{}][^ ]*?"/" return 'ACTION_BODY'; \"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; "'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; [/"'][^{}/"']+ return 'ACTION_BODY'; [^{}/"']+ return 'ACTION_BODY'; "{" yy.depth++; return '{'; -"}" if (yy.depth == 0) { this.begin('trail'); } else { yy.depth--; } return '}'; +"}" %{ + if (yy.depth == 0) { + this.begin('trail'); + } else { + yy.depth--; + } + return '}'; + %} {NAME} return 'NAME'; ">" this.popState(); return '>'; @@ -84,7 +105,7 @@ WS [^\S\r\n] {BR}+ /* empty */ {WS}+{BR}+ /* empty */ -\s+ this.begin('indented'); +{WS}+ this.begin('indented'); "%%" this.begin('code'); return '%%'; [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ %{ @@ -94,8 +115,10 @@ WS [^\S\r\n] %} {NAME} return 'NAME'; "=" return '='; -\"("\\\\"|'\"'|[^"])*\" yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; -"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" + yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; +\'{QUOTED_STRING_CONTENT}\' + yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; [^\s\r\n]+ return 'OPTION_VALUE'; {BR}+ this.popState(); return 'OPTIONS_END'; {WS}+ /* skip whitespace */ @@ -128,15 +151,16 @@ WS [^\S\r\n] this.pushState('path'); return 'INCLUDE'; %} -.+ this.begin('rules'); return 'ACTION'; +.* this.popState(); return 'ACTION'; "/*"(.|\n|\r)*?"*/" /* ignore */ -"//".* /* ignore */ +"//"[^\r\n]* /* ignore */ {ID} this.pushState('macro'); return 'NAME'; {BR}+ this.popState('macro'); -// Accept any non-regex-special character as a direct literal without the need to put quotes around it: +// Accept any non-regex-special character as a direct literal without +// the need to put quotes around it: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ %{ // accept any non-regex, non-lex, non-string-delim, @@ -147,8 +171,10 @@ WS [^\S\r\n] {BR}+ /* empty */ \s+ /* empty */ -\"("\\\\"|'\"'|[^"])*\" yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; -"'"("\\\\"|"\'"|[^'])*"'" yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" + yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; +\'{QUOTED_STRING_CONTENT}\' + yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; "[" this.pushState('set'); return 'REGEX_SET_START'; "|" return '|'; "(?:" return 'SPECIAL_GROUP'; @@ -187,34 +213,44 @@ WS [^\S\r\n] "{" return '{'; "}" return '}'; -. throw new Error("unsupported input character: " + yytext + " @ " + JSON.stringify(yylloc)); /* b0rk on bad characters */ - -<*><> return 'EOF'; - (?:"\\\\"|"\\]"|[^\]{])+ return 'REGEX_SET'; "{" return 'REGEX_SET'; "]" this.popState('set'); return 'REGEX_SET_END'; -// in the trailing CODE block, only accept these `%include` macros when they appear at the start of a line -// and make sure the rest of lexer regexes account for this one so it'll match that way only: +// in the trailing CODE block, only accept these `%include` macros when +// they appear at the start of a line and make sure the rest of lexer +// regexes account for this one so it'll match that way only: [^\r\n]*(\r|\n)+ return 'CODE'; [^\r\n]+ return 'CODE'; // the bit of CODE just before EOF... {BR} this.popState(); this.unput(yytext); -"'"[^\r\n]+"'" yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; -'"'[^\r\n]+'"' yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" + yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; +\'{QUOTED_STRING_CONTENT}\' + yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; {WS}+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; <*>. %{ - /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer input: ', yytext, ' @ ' + JSON.stringify(yylloc) + 'while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + /* b0rk on bad characters */ + var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); + var l2 = 3; + var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); + throw new Error('unsupported lexer input: ', yytext, ' @ ' + this.describeYYLLOC(yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); %} +<*><> return 'EOF'; + %% + +function indent(s, i) { + var a = s.split('\n'); + var pf = (new Array(i + 1)).join(' '); + return pf + a.join('\n' + pf); +} ``` diff --git a/lex-parser.js b/lex-parser.js index 9bea0b4..194bba2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2825,7 +2825,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-159 */ +/* generated by jison-lex 0.3.4-160 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 diff --git a/lex.l b/lex.l index 324fcf6..e719f73 100644 --- a/lex.l +++ b/lex.l @@ -37,7 +37,8 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* "/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; "//".* return 'ACTION_BODY'; -// regexp with braces or quotes (and no spaces, so we don't mistake a *division operator* `/` for a regex delimiter here in most circumstances): +// regexp with braces or quotes (and no spaces, so we don't mistake +// a *division operator* `/` for a regex delimiter here in most circumstances): "/"[^ /]*?['"{}][^ ]*?"/" return 'ACTION_BODY'; \"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; "'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; diff --git a/package.json b/package.json index 46a1c71..d22611c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-159", + "version": "0.1.4-160", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 8b8570b9e29769c0b241c81f7f731e3a04c0f112 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Dec 2016 23:15:50 +0100 Subject: [PATCH 237/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d22611c..12b3481 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-160", + "version": "0.1.4-161", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From fbb3cfd49465b16e00f9e8b1636f494615be755d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 15 Dec 2016 23:29:43 +0100 Subject: [PATCH 238/417] updated npm packages, tagged and bumped build revision and rebuilt --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 194bba2..de8987f 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-159 */ +/* parser generated by jison 0.4.18-161 */ /* * Returns a Parser object of the following structure: * @@ -2825,7 +2825,7 @@ function prepareString (s) { s = encodeRE(s); return s; }; -/* generated by jison-lex 0.3.4-160 */ +/* generated by jison-lex 0.3.4-161 */ var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 From f89d1d53cfb84c9677e166762c7816d193ec7062 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Mon, 19 Dec 2016 22:31:27 -0500 Subject: [PATCH 239/417] Build with strict-mode-compliant Jison --- lex-parser.js | 20 +++++++++++--------- package.json | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index f32143e..599b2b7 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.15 */ +/* parser generated by jison 0.4.17 */ /* Returns a Parser object of the following structure: @@ -71,7 +71,7 @@ recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) } */ -var parser = (function(){ +var lex = (function(){ var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[2,7],$V1=[1,4],$V2=[1,5],$V3=[1,6],$V4=[1,7],$V5=[1,8],$V6=[2,36],$V7=[1,16],$V8=[1,17],$V9=[1,18],$Va=[1,19],$Vb=[1,22],$Vc=[1,23],$Vd=[1,24],$Ve=[1,27],$Vf=[1,28],$Vg=[1,31],$Vh=[1,29],$Vi=[1,30],$Vj=[5,11,12,14,16,18],$Vk=[11,23,34,37,39,42,43,47,48,49,52,53,54,56,57],$Vl=[2,29],$Vm=[1,39],$Vn=[1,40],$Vo=[5,11,12,14,16,18,23,34,38],$Vp=[5,11,12,14,16,18,23,34,37,38,39,42,43,47,48,49,52,53,54,56,57],$Vq=[1,43],$Vr=[1,42],$Vs=[1,44],$Vt=[1,46],$Vu=[34,38],$Vv=[5,11,12,14,16,18,23,31,34,37,38,39,40,41,42,43,47,48,49,52,53,54,55,56,57],$Vw=[5,11,12,14,16,18,19],$Vx=[5,8,11,23,28,34,37,39,42,43,47,48,49,52,53,54,56,57],$Vy=[30,32],$Vz=[23,25],$VA=[2,21],$VB=[1,75],$VC=[1,78],$VD=[1,79],$VE=[23,25,27]; var parser = {trace: function trace() { }, yy: {}, @@ -244,7 +244,9 @@ parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); } else { - throw new Error(str); + var error = new Error(str); + error.hash = hash; + throw error; } }, parse: function parse(input) { @@ -277,14 +279,14 @@ parse: function parse(input) { lstack.length = lstack.length - n; } _token_stack: - function lex() { + var lex = function () { var token; token = lexer.lex() || EOF; if (typeof token !== 'number') { token = self.symbols_[token] || token; } return token; - } + }; var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; while (true) { state = stack[stack.length - 1]; @@ -866,7 +868,7 @@ case 69:return 9; break; } }, -rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ /]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[/"'][^{}/"']+)/,/^(?:[^{}/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:.*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:%[a-zA-Z]+[^\r\n]*)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], +rules: [/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:\/[^ \/]*?['"{}'][^ ]*?\/)/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:[\/"'][^{}\/"']+)/,/^(?:[^{}\/"']+)/,/^(?:\{)/,/^(?:\})/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:>)/,/^(?:,)/,/^(?:\*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:%%)/,/^(?:[a-zA-Z0-9_]+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:.*(\r\n|\n|\r)+)/,/^(?:\{)/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:%\{(.|(\r\n|\n|\r))*?%\})/,/^(?:.+)/,/^(?:\/\*(.|\n|\r)*?\*\/)/,/^(?:\/\/.*)/,/^(?:(\r\n|\n|\r)+)/,/^(?:\s+)/,/^(?:([a-zA-Z_][a-zA-Z0-9_-]*))/,/^(?:"(\\\\|\\"|[^"])*")/,/^(?:'(\\\\|\\'|[^'])*')/,/^(?:\|)/,/^(?:\[(\\\\|\\\]|[^\]])*\])/,/^(?:\(\?:)/,/^(?:\(\?=)/,/^(?:\(\?!)/,/^(?:\()/,/^(?:\))/,/^(?:\+)/,/^(?:\*)/,/^(?:\?)/,/^(?:\^)/,/^(?:,)/,/^(?:<>)/,/^(?:<)/,/^(?:\/!)/,/^(?:\/)/,/^(?:\\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}))/,/^(?:\\.)/,/^(?:\$)/,/^(?:\.)/,/^(?:%options\b)/,/^(?:%s\b)/,/^(?:%x\b)/,/^(?:%%)/,/^(?:%[a-zA-Z]+[^\r\n]*)/,/^(?:\{\d+(,\s?\d+|,)?\})/,/^(?:\{([a-zA-Z_][a-zA-Z0-9_-]*)\})/,/^(?:\{)/,/^(?:\})/,/^(?:.)/,/^(?:$)/,/^(?:(.|(\r\n|\n|\r))+)/], conditions: {"code":{"rules":[68,69],"inclusive":false},"start_condition":{"rules":[22,23,24,25,68],"inclusive":false},"options":{"rules":[18,19,20,21,68],"inclusive":false},"conditions":{"rules":[9,10,11,12,68],"inclusive":false},"action":{"rules":[0,1,2,3,4,5,6,7,8,68],"inclusive":false},"indented":{"rules":[27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],"inclusive":true},"trail":{"rules":[26,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],"inclusive":true},"rules":{"rules":[13,14,15,16,17,29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],"inclusive":true},"INITIAL":{"rules":[29,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68],"inclusive":true}} }); return lexer; @@ -881,9 +883,9 @@ return new Parser; if (typeof require !== 'undefined' && typeof exports !== 'undefined') { -exports.parser = parser; -exports.Parser = parser.Parser; -exports.parse = function () { return parser.parse.apply(parser, arguments); }; +exports.parser = lex; +exports.Parser = lex.Parser; +exports.parse = function () { return lex.parse.apply(lex, arguments); }; exports.main = function commonjsMain(args) { if (!args[1]) { console.log('Usage: '+args[0]+' FILE'); diff --git a/package.json b/package.json index a95535a..3a5ce14 100644 --- a/package.json +++ b/package.json @@ -19,7 +19,7 @@ "author": "Zach Carter", "license": "MIT", "devDependencies": { - "jison": "0.4.x", + "jison": "zaach/jison", "test": "*" } } From 47f9184441076c7222fe535e7450a2993ab6f6a0 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Tue, 17 Jan 2017 17:23:32 -0500 Subject: [PATCH 240/417] Support no-rule lex definitions --- lex.y | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/lex.y b/lex.y index 006b1ac..25307bb 100644 --- a/lex.y +++ b/lex.y @@ -6,20 +6,32 @@ %left '*' '+' '?' RANGE_REGEX +%{ +function extendLexerDefinitions(base, $definitions, $epilogue, yy) { + if ($definitions[0]) base.macros = $definitions[0]; + if ($definitions[1]) base.startConditions = $definitions[1]; + if ($definitions[2]) base.unknownDecls = $definitions[2]; + if ($epilogue) base.moduleInclude = $epilogue; + if (yy.options) base.options = yy.options; + if (yy.actionInclude) base.actionInclude = yy.actionInclude; + delete yy.options; + delete yy.actionInclude; +} +%} + %% lex - : definitions '%%' rules epilogue + : definitions EOF + { + $$ = { rules: [] }; + extendLexerDefinitions($$, $definitions, null, yy); + return $$; + } + | definitions '%%' rules epilogue { $$ = { rules: $rules }; - if ($definitions[0]) $$.macros = $definitions[0]; - if ($definitions[1]) $$.startConditions = $definitions[1]; - if ($definitions[2]) $$.unknownDecls = $definitions[2]; - if ($epilogue) $$.moduleInclude = $epilogue; - if (yy.options) $$.options = yy.options; - if (yy.actionInclude) $$.actionInclude = yy.actionInclude; - delete yy.options; - delete yy.actionInclude; + extendLexerDefinitions($$, $definitions, $epilogue, yy); return $$; } ; From f9bc6495d1bd2028b5d44a9970b19ef128f987dc Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Tue, 17 Jan 2017 17:24:08 -0500 Subject: [PATCH 241/417] Build with no-rules branch --- lex-parser.js | 125 +++++++++++++++++++++++++++----------------------- 1 file changed, 68 insertions(+), 57 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 599b2b7..238d75d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -72,12 +72,12 @@ } */ var lex = (function(){ -var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[2,7],$V1=[1,4],$V2=[1,5],$V3=[1,6],$V4=[1,7],$V5=[1,8],$V6=[2,36],$V7=[1,16],$V8=[1,17],$V9=[1,18],$Va=[1,19],$Vb=[1,22],$Vc=[1,23],$Vd=[1,24],$Ve=[1,27],$Vf=[1,28],$Vg=[1,31],$Vh=[1,29],$Vi=[1,30],$Vj=[5,11,12,14,16,18],$Vk=[11,23,34,37,39,42,43,47,48,49,52,53,54,56,57],$Vl=[2,29],$Vm=[1,39],$Vn=[1,40],$Vo=[5,11,12,14,16,18,23,34,38],$Vp=[5,11,12,14,16,18,23,34,37,38,39,42,43,47,48,49,52,53,54,56,57],$Vq=[1,43],$Vr=[1,42],$Vs=[1,44],$Vt=[1,46],$Vu=[34,38],$Vv=[5,11,12,14,16,18,23,31,34,37,38,39,40,41,42,43,47,48,49,52,53,54,55,56,57],$Vw=[5,11,12,14,16,18,19],$Vx=[5,8,11,23,28,34,37,39,42,43,47,48,49,52,53,54,56,57],$Vy=[30,32],$Vz=[23,25],$VA=[2,21],$VB=[1,75],$VC=[1,78],$VD=[1,79],$VE=[23,25,27]; +var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[5,6],$V1=[2,8],$V2=[1,4],$V3=[1,5],$V4=[1,6],$V5=[1,7],$V6=[1,8],$V7=[2,37],$V8=[1,17],$V9=[1,18],$Va=[1,19],$Vb=[1,20],$Vc=[1,23],$Vd=[1,24],$Ve=[1,25],$Vf=[1,28],$Vg=[1,29],$Vh=[1,32],$Vi=[1,30],$Vj=[1,31],$Vk=[5,6,11,12,14,16,18],$Vl=[11,23,34,37,39,42,43,47,48,49,52,53,54,56,57],$Vm=[2,30],$Vn=[1,40],$Vo=[1,41],$Vp=[5,6,11,12,14,16,18,23,34,38],$Vq=[5,6,11,12,14,16,18,23,34,37,38,39,42,43,47,48,49,52,53,54,56,57],$Vr=[1,44],$Vs=[1,43],$Vt=[1,45],$Vu=[1,47],$Vv=[34,38],$Vw=[5,6,11,12,14,16,18,23,31,34,37,38,39,40,41,42,43,47,48,49,52,53,54,55,56,57],$Vx=[5,6,11,12,14,16,18,19],$Vy=[5,6,11,23,28,34,37,39,42,43,47,48,49,52,53,54,56,57],$Vz=[30,32],$VA=[23,25],$VB=[2,22],$VC=[1,76],$VD=[1,79],$VE=[1,80],$VF=[23,25,27]; var parser = {trace: function trace() { }, yy: {}, -symbols_: {"error":2,"lex":3,"definitions":4,"%%":5,"rules":6,"epilogue":7,"EOF":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"UNKNOWN_DECL":18,"START_COND":19,"rule":20,"start_conditions":21,"action":22,"{":23,"action_body":24,"}":25,"action_comments_body":26,"ACTION_BODY":27,"<":28,"name_list":29,">":30,"*":31,",":32,"regex_list":33,"|":34,"regex_concat":35,"regex_base":36,"(":37,")":38,"SPECIAL_GROUP":39,"+":40,"?":41,"/":42,"/!":43,"name_expansion":44,"range_regex":45,"any_group_regex":46,".":47,"^":48,"$":49,"string":50,"escape_char":51,"NAME_BRACE":52,"ANY_GROUP_REGEX":53,"ESCAPE_CHAR":54,"RANGE_REGEX":55,"STRING_LIT":56,"CHARACTER_LIT":57,"$accept":0,"$end":1}, -terminals_: {2:"error",5:"%%",8:"EOF",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"UNKNOWN_DECL",19:"START_COND",23:"{",25:"}",27:"ACTION_BODY",28:"<",30:">",31:"*",32:",",34:"|",37:"(",38:")",39:"SPECIAL_GROUP",40:"+",41:"?",42:"/",43:"/!",47:".",48:"^",49:"$",52:"NAME_BRACE",53:"ANY_GROUP_REGEX",54:"ESCAPE_CHAR",55:"RANGE_REGEX",56:"STRING_LIT",57:"CHARACTER_LIT"}, -productions_: [0,[3,4],[7,1],[7,2],[7,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[10,1],[15,1],[15,2],[17,1],[17,2],[6,2],[6,1],[20,3],[22,3],[22,1],[24,0],[24,1],[24,5],[24,4],[26,1],[26,2],[21,3],[21,3],[21,0],[29,1],[29,3],[13,1],[33,3],[33,2],[33,1],[33,0],[35,2],[35,1],[36,3],[36,3],[36,2],[36,2],[36,2],[36,2],[36,2],[36,1],[36,2],[36,1],[36,1],[36,1],[36,1],[36,1],[36,1],[44,1],[46,1],[51,1],[45,1],[50,1],[50,1]], +symbols_: {"error":2,"lex":3,"definitions":4,"EOF":5,"%%":6,"rules":7,"epilogue":8,"CODE":9,"definition":10,"ACTION":11,"NAME":12,"regex":13,"START_INC":14,"names_inclusive":15,"START_EXC":16,"names_exclusive":17,"UNKNOWN_DECL":18,"START_COND":19,"rule":20,"start_conditions":21,"action":22,"{":23,"action_body":24,"}":25,"action_comments_body":26,"ACTION_BODY":27,"<":28,"name_list":29,">":30,"*":31,",":32,"regex_list":33,"|":34,"regex_concat":35,"regex_base":36,"(":37,")":38,"SPECIAL_GROUP":39,"+":40,"?":41,"/":42,"/!":43,"name_expansion":44,"range_regex":45,"any_group_regex":46,".":47,"^":48,"$":49,"string":50,"escape_char":51,"NAME_BRACE":52,"ANY_GROUP_REGEX":53,"ESCAPE_CHAR":54,"RANGE_REGEX":55,"STRING_LIT":56,"CHARACTER_LIT":57,"$accept":0,"$end":1}, +terminals_: {2:"error",5:"EOF",6:"%%",9:"CODE",11:"ACTION",12:"NAME",14:"START_INC",16:"START_EXC",18:"UNKNOWN_DECL",19:"START_COND",23:"{",25:"}",27:"ACTION_BODY",28:"<",30:">",31:"*",32:",",34:"|",37:"(",38:")",39:"SPECIAL_GROUP",40:"+",41:"?",42:"/",43:"/!",47:".",48:"^",49:"$",52:"NAME_BRACE",53:"ANY_GROUP_REGEX",54:"ESCAPE_CHAR",55:"RANGE_REGEX",56:"STRING_LIT",57:"CHARACTER_LIT"}, +productions_: [0,[3,2],[3,4],[8,1],[8,2],[8,3],[4,2],[4,2],[4,0],[10,2],[10,2],[10,2],[10,1],[15,1],[15,2],[17,1],[17,2],[7,2],[7,1],[20,3],[22,3],[22,1],[24,0],[24,1],[24,5],[24,4],[26,1],[26,2],[21,3],[21,3],[21,0],[29,1],[29,3],[13,1],[33,3],[33,2],[33,1],[33,0],[35,2],[35,1],[36,3],[36,3],[36,2],[36,2],[36,2],[36,2],[36,2],[36,1],[36,2],[36,1],[36,1],[36,1],[36,1],[36,1],[36,1],[44,1],[46,1],[51,1],[45,1],[50,1],[50,1]], performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { /* this == yyval */ @@ -85,25 +85,25 @@ var $0 = $$.length - 1; switch (yystate) { case 1: + this.$ = { rules: [] }; + extendLexerDefinitions(this.$, $$[$0-1], null, yy); + return this.$; + +break; +case 2: + this.$ = { rules: $$[$0-1] }; - if ($$[$0-3][0]) this.$.macros = $$[$0-3][0]; - if ($$[$0-3][1]) this.$.startConditions = $$[$0-3][1]; - if ($$[$0-3][2]) this.$.unknownDecls = $$[$0-3][2]; - if ($$[$0]) this.$.moduleInclude = $$[$0]; - if (yy.options) this.$.options = yy.options; - if (yy.actionInclude) this.$.actionInclude = yy.actionInclude; - delete yy.options; - delete yy.actionInclude; + extendLexerDefinitions(this.$, $$[$0-3], $$[$0], yy); return this.$; break; -case 2: case 3: +case 3: case 4: this.$ = null; break; -case 4: case 27: +case 5: case 28: this.$ = $$[$0-1]; break; -case 5: +case 6: this.$ = $$[$0]; if ('length' in $$[$0-1]) { @@ -120,70 +120,70 @@ case 5: } break; -case 6: +case 7: yy.actionInclude += $$[$0-1]; this.$ = $$[$0]; break; -case 7: +case 8: yy.actionInclude = ''; this.$ = [null,null]; break; -case 8: +case 9: this.$ = [$$[$0-1], $$[$0]]; break; -case 9: case 10: +case 10: case 11: this.$ = $$[$0]; break; -case 11: +case 12: this.$ = {type: 'unknown', body: $$[$0]}; break; -case 12: +case 13: this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 0; break; -case 13: +case 14: this.$ = $$[$0-1]; this.$.names[$$[$0]] = 0; break; -case 14: +case 15: this.$ = {type: 'names', names: {}}; this.$.names[$$[$0]] = 1; break; -case 15: +case 16: this.$ = $$[$0-1]; this.$.names[$$[$0]] = 1; break; -case 16: +case 17: this.$ = $$[$0-1]; this.$.push($$[$0]); break; -case 17: case 30: +case 18: case 31: this.$ = [$$[$0]]; break; -case 18: +case 19: this.$ = $$[$0-2] ? [$$[$0-2], $$[$0-1], $$[$0]] : [$$[$0-1],$$[$0]]; break; -case 19: +case 20: this.$ = $$[$0-1]; break; -case 20: case 22: +case 21: case 23: this.$ = $$[$0]; break; -case 21: +case 22: this.$ = ''; break; -case 23: +case 24: this.$ = $$[$0-4]+$$[$0-3]+$$[$0-2]+$$[$0-1]+$$[$0]; break; -case 24: +case 25: this.$ = $$[$0-3] + $$[$0-2] + $$[$0-1] + $$[$0]; break; -case 25: case 55: case 56: case 57: +case 26: case 56: case 57: case 58: this.$ = yytext; break; -case 26: +case 27: this.$ = $$[$0-1]+$$[$0]; break; -case 28: +case 29: this.$ = ['*']; break; -case 31: +case 32: this.$ = $$[$0-2]; this.$.push($$[$0]); break; -case 32: +case 33: this.$ = $$[$0]; if (!(yy.options && yy.options.flex) && this.$.match(/[\w\d]$/) && !this.$.match(/\\(r|f|n|t|v|s|b|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}|[0-7]{1,3})$/)) { @@ -191,55 +191,55 @@ case 32: } break; -case 33: +case 34: this.$ = $$[$0-2] + '|' + $$[$0]; break; -case 34: +case 35: this.$ = $$[$0-1] + '|'; break; -case 36: +case 37: this.$ = '' break; -case 37: case 47: +case 38: case 48: this.$ = $$[$0-1] + $$[$0]; break; -case 39: +case 40: this.$ = '(' + $$[$0-1] + ')'; break; -case 40: +case 41: this.$ = $$[$0-2] + $$[$0-1] + ')'; break; -case 41: +case 42: this.$ = $$[$0-1] + '+'; break; -case 42: +case 43: this.$ = $$[$0-1] + '*'; break; -case 43: +case 44: this.$ = $$[$0-1] + '?'; break; -case 44: +case 45: this.$ = '(?=' + $$[$0] + ')'; break; -case 45: +case 46: this.$ = '(?!' + $$[$0] + ')'; break; -case 49: +case 50: this.$ = '.'; break; -case 50: +case 51: this.$ = '^'; break; -case 51: +case 52: this.$ = '$'; break; -case 58: +case 59: this.$ = prepareString(yytext.substr(1, yytext.length - 2)); break; } }, -table: [{3:1,4:2,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4,18:$V5},{1:[3]},{5:[1,9]},{4:10,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4,18:$V5},{4:11,5:$V0,10:3,11:$V1,12:$V2,14:$V3,16:$V4,18:$V5},o([5,11,12,14,16,18,34],$V6,{13:12,33:13,35:14,36:15,44:20,46:21,50:25,51:26,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),{15:32,19:[1,33]},{17:34,19:[1,35]},o($Vj,[2,11]),o($Vk,$Vl,{6:36,20:37,21:38,28:$Vm}),{5:[2,5]},{5:[2,6]},o($Vj,[2,8]),o([5,11,12,14,16,18,23],[2,32],{34:$Vn}),o($Vo,[2,35],{44:20,46:21,50:25,51:26,36:41,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),o($Vp,[2,38],{45:45,31:$Vq,40:$Vr,41:$Vs,55:$Vt}),o($Vu,$V6,{35:14,36:15,44:20,46:21,50:25,51:26,33:47,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),o($Vu,$V6,{35:14,36:15,44:20,46:21,50:25,51:26,33:48,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),{36:49,37:$V7,39:$V8,42:$V9,43:$Va,44:20,46:21,47:$Vb,48:$Vc,49:$Vd,50:25,51:26,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi},{36:50,37:$V7,39:$V8,42:$V9,43:$Va,44:20,46:21,47:$Vb,48:$Vc,49:$Vd,50:25,51:26,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi},o($Vv,[2,46]),o($Vv,[2,48]),o($Vv,[2,49]),o($Vv,[2,50]),o($Vv,[2,51]),o($Vv,[2,52]),o($Vv,[2,53]),o($Vv,[2,54]),o($Vv,[2,55]),o($Vv,[2,58]),o($Vv,[2,59]),o($Vv,[2,56]),o($Vj,[2,9],{19:[1,51]}),o($Vw,[2,12]),o($Vj,[2,10],{19:[1,52]}),o($Vw,[2,14]),o($Vk,$Vl,{21:38,7:53,20:54,5:[1,56],8:[1,55],28:$Vm}),o($Vx,[2,17]),o([11,23,34],$V6,{33:13,35:14,36:15,44:20,46:21,50:25,51:26,13:57,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),{12:[1,60],29:58,31:[1,59]},o($Vo,[2,34],{36:15,44:20,46:21,50:25,51:26,35:61,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),o($Vp,[2,37],{45:45,31:$Vq,40:$Vr,41:$Vs,55:$Vt}),o($Vv,[2,41]),o($Vv,[2,42]),o($Vv,[2,43]),o($Vv,[2,47]),o($Vv,[2,57]),{34:$Vn,38:[1,62]},{34:$Vn,38:[1,63]},o($Vp,[2,44],{45:45,31:$Vq,40:$Vr,41:$Vs,55:$Vt}),o($Vp,[2,45],{45:45,31:$Vq,40:$Vr,41:$Vs,55:$Vt}),o($Vw,[2,13]),o($Vw,[2,15]),{1:[2,1]},o($Vx,[2,16]),{1:[2,2]},{8:[1,64],9:[1,65]},{11:[1,68],22:66,23:[1,67]},{30:[1,69],32:[1,70]},{30:[1,71]},o($Vy,[2,30]),o($Vo,[2,33],{44:20,46:21,50:25,51:26,36:41,37:$V7,39:$V8,42:$V9,43:$Va,47:$Vb,48:$Vc,49:$Vd,52:$Ve,53:$Vf,54:$Vg,56:$Vh,57:$Vi}),o($Vv,[2,39]),o($Vv,[2,40]),{1:[2,3]},{8:[1,72]},o($Vx,[2,18]),o($Vz,$VA,{24:73,26:74,27:$VB}),o($Vx,[2,20]),o($Vk,[2,27]),{12:[1,76]},o($Vk,[2,28]),{1:[2,4]},{23:$VC,25:[1,77]},o($Vz,[2,22],{27:$VD}),o($VE,[2,25]),o($Vy,[2,31]),o($Vx,[2,19]),o($Vz,$VA,{26:74,24:80,27:$VB}),o($VE,[2,26]),{23:$VC,25:[1,81]},o($Vz,[2,24],{26:82,27:$VB}),o($Vz,[2,23],{27:$VD})], -defaultActions: {10:[2,5],11:[2,6],53:[2,1],55:[2,2],64:[2,3],72:[2,4]}, +table: [o($V0,$V1,{3:1,4:2,10:3,11:$V2,12:$V3,14:$V4,16:$V5,18:$V6}),{1:[3]},{5:[1,9],6:[1,10]},o($V0,$V1,{10:3,4:11,11:$V2,12:$V3,14:$V4,16:$V5,18:$V6}),o($V0,$V1,{10:3,4:12,11:$V2,12:$V3,14:$V4,16:$V5,18:$V6}),o([5,6,11,12,14,16,18,34],$V7,{13:13,33:14,35:15,36:16,44:21,46:22,50:26,51:27,37:$V8,39:$V9,42:$Va,43:$Vb,47:$Vc,48:$Vd,49:$Ve,52:$Vf,53:$Vg,54:$Vh,56:$Vi,57:$Vj}),{15:33,19:[1,34]},{17:35,19:[1,36]},o($Vk,[2,12]),{1:[2,1]},o($Vl,$Vm,{7:37,20:38,21:39,28:$Vn}),o($V0,[2,6]),o($V0,[2,7]),o($Vk,[2,9]),o([5,6,11,12,14,16,18,23],[2,33],{34:$Vo}),o($Vp,[2,36],{44:21,46:22,50:26,51:27,36:42,37:$V8,39:$V9,42:$Va,43:$Vb,47:$Vc,48:$Vd,49:$Ve,52:$Vf,53:$Vg,54:$Vh,56:$Vi,57:$Vj}),o($Vq,[2,39],{45:46,31:$Vr,40:$Vs,41:$Vt,55:$Vu}),o($Vv,$V7,{35:15,36:16,44:21,46:22,50:26,51:27,33:48,37:$V8,39:$V9,42:$Va,43:$Vb,47:$Vc,48:$Vd,49:$Ve,52:$Vf,53:$Vg,54:$Vh,56:$Vi,57:$Vj}),o($Vv,$V7,{35:15,36:16,44:21,46:22,50:26,51:27,33:49,37:$V8,39:$V9,42:$Va,43:$Vb,47:$Vc,48:$Vd,49:$Ve,52:$Vf,53:$Vg,54:$Vh,56:$Vi,57:$Vj}),{36:50,37:$V8,39:$V9,42:$Va,43:$Vb,44:21,46:22,47:$Vc,48:$Vd,49:$Ve,50:26,51:27,52:$Vf,53:$Vg,54:$Vh,56:$Vi,57:$Vj},{36:51,37:$V8,39:$V9,42:$Va,43:$Vb,44:21,46:22,47:$Vc,48:$Vd,49:$Ve,50:26,51:27,52:$Vf,53:$Vg,54:$Vh,56:$Vi,57:$Vj},o($Vw,[2,47]),o($Vw,[2,49]),o($Vw,[2,50]),o($Vw,[2,51]),o($Vw,[2,52]),o($Vw,[2,53]),o($Vw,[2,54]),o($Vw,[2,55]),o($Vw,[2,56]),o($Vw,[2,59]),o($Vw,[2,60]),o($Vw,[2,57]),o($Vk,[2,10],{19:[1,52]}),o($Vx,[2,13]),o($Vk,[2,11],{19:[1,53]}),o($Vx,[2,15]),o($Vl,$Vm,{21:39,8:54,20:55,5:[1,56],6:[1,57],28:$Vn}),o($Vy,[2,18]),o([11,23,34],$V7,{33:14,35:15,36:16,44:21,46:22,50:26,51:27,13:58,37:$V8,39:$V9,42:$Va,43:$Vb,47:$Vc,48:$Vd,49:$Ve,52:$Vf,53:$Vg,54:$Vh,56:$Vi,57:$Vj}),{12:[1,61],29:59,31:[1,60]},o($Vp,[2,35],{36:16,44:21,46:22,50:26,51:27,35:62,37:$V8,39:$V9,42:$Va,43:$Vb,47:$Vc,48:$Vd,49:$Ve,52:$Vf,53:$Vg,54:$Vh,56:$Vi,57:$Vj}),o($Vq,[2,38],{45:46,31:$Vr,40:$Vs,41:$Vt,55:$Vu}),o($Vw,[2,42]),o($Vw,[2,43]),o($Vw,[2,44]),o($Vw,[2,48]),o($Vw,[2,58]),{34:$Vo,38:[1,63]},{34:$Vo,38:[1,64]},o($Vq,[2,45],{45:46,31:$Vr,40:$Vs,41:$Vt,55:$Vu}),o($Vq,[2,46],{45:46,31:$Vr,40:$Vs,41:$Vt,55:$Vu}),o($Vx,[2,14]),o($Vx,[2,16]),{1:[2,2]},o($Vy,[2,17]),{1:[2,3]},{5:[1,65],9:[1,66]},{11:[1,69],22:67,23:[1,68]},{30:[1,70],32:[1,71]},{30:[1,72]},o($Vz,[2,31]),o($Vp,[2,34],{44:21,46:22,50:26,51:27,36:42,37:$V8,39:$V9,42:$Va,43:$Vb,47:$Vc,48:$Vd,49:$Ve,52:$Vf,53:$Vg,54:$Vh,56:$Vi,57:$Vj}),o($Vw,[2,40]),o($Vw,[2,41]),{1:[2,4]},{5:[1,73]},o($Vy,[2,19]),o($VA,$VB,{24:74,26:75,27:$VC}),o($Vy,[2,21]),o($Vl,[2,28]),{12:[1,77]},o($Vl,[2,29]),{1:[2,5]},{23:$VD,25:[1,78]},o($VA,[2,23],{27:$VE}),o($VF,[2,26]),o($Vz,[2,32]),o($Vy,[2,20]),o($VA,$VB,{26:75,24:81,27:$VC}),o($VF,[2,27]),{23:$VD,25:[1,82]},o($VA,[2,25],{26:83,27:$VC}),o($VA,[2,24],{27:$VE})], +defaultActions: {9:[2,1],54:[2,2],56:[2,3],65:[2,4],73:[2,5]}, parseError: function parseError(str, hash) { if (hash.recoverable) { this.trace(str); @@ -387,6 +387,17 @@ parse: function parse(input) { return true; }}; +function extendLexerDefinitions(base, $definitions, $epilogue, yy) { + if ($definitions[0]) base.macros = $definitions[0]; + if ($definitions[1]) base.startConditions = $definitions[1]; + if ($definitions[2]) base.unknownDecls = $definitions[2]; + if ($epilogue) base.moduleInclude = $epilogue; + if (yy.options) base.options = yy.options; + if (yy.actionInclude) base.actionInclude = yy.actionInclude; + delete yy.options; + delete yy.actionInclude; +} + function encodeRE (s) { return s.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g,'\\u$1'); @@ -758,7 +769,7 @@ case 14:/* */ break; case 15:this.begin('indented') break; -case 16:this.begin('code'); return 5 +case 16:this.begin('code'); return 6 break; case 17:return 57 break; @@ -848,7 +859,7 @@ case 59:this.begin('start_condition'); return 14; break; case 60:this.begin('start_condition'); return 16; break; -case 61:this.begin('rules'); return 5; +case 61:this.begin('rules'); return 6; break; case 62:return 18; break; @@ -862,7 +873,7 @@ case 66:return 25; break; case 67:/* ignore bad characters */ break; -case 68:return 8; +case 68:return 5; break; case 69:return 9; break; From 0218438feed0511653a57e95cf4a3b1a874e7c97 Mon Sep 17 00:00:00 2001 From: Dan Freeman Date: Tue, 17 Jan 2017 17:57:25 -0500 Subject: [PATCH 242/417] Version tag to make Yarn pickier --- package.json | 2 +- tests/all-tests.js | 10 +++++ yarn.lock | 109 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 120 insertions(+), 1 deletion(-) create mode 100644 yarn.lock diff --git a/package.json b/package.json index 3a5ce14..40ae8f5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "lex-parser", - "version": "0.1.4", + "version": "0.1.4-dfreeman", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { diff --git a/tests/all-tests.js b/tests/all-tests.js index bc8a6bb..97e22f8 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -20,6 +20,16 @@ exports["test lex grammar with macros"] = function () { assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; +exports["test rule-less grammar"] = function () { + var lexgrammar = '%export { D }\nD [0-9]'; + var expected = { + macros: { D: '[0-9]' }, + unknownDecls: ['%export { D }'], + rules: [] + }; + assert.deepEqual(lex.parse(lexgrammar), expected, 'grammar should be parsed correctly'); +}; + exports["test escaped chars"] = function () { var lexgrammar = '%%\n"\\n"+ {return \'NL\';}\n\\n+ {return \'NL2\';}\n\\s+ {/* skip */}'; var expected = { diff --git a/yarn.lock b/yarn.lock new file mode 100644 index 0000000..33e0972 --- /dev/null +++ b/yarn.lock @@ -0,0 +1,109 @@ +# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. +# yarn lockfile v1 + + +JSONSelect@0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/JSONSelect/-/JSONSelect-0.4.0.tgz#a08edcc67eb3fcbe99ed630855344a0cf282bb8d" + +"JSV@>= 4.0.x": + version "4.0.2" + resolved "https://registry.yarnpkg.com/JSV/-/JSV-4.0.2.tgz#d077f6825571f82132f9dffaed587b4029feff57" + +amdefine@>=0.0.4: + version "1.0.1" + resolved "https://registry.yarnpkg.com/amdefine/-/amdefine-1.0.1.tgz#4a5282ac164729e93619bcfd3ad151f817ce91f5" + +ansi-font@0.0.2: + version "0.0.2" + resolved "https://registry.yarnpkg.com/ansi-font/-/ansi-font-0.0.2.tgz#890301bd5841462fd39c0b7709afd1f525143331" + +cjson@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/cjson/-/cjson-0.3.0.tgz#e6439b90703d312ff6e2224097bea92ce3d02a14" + dependencies: + jsonlint "1.6.0" + +colors@0.5.x: + version "0.5.1" + resolved "https://registry.yarnpkg.com/colors/-/colors-0.5.1.tgz#7d0023eaeb154e8ee9fce75dcb923d0ed1667774" + +ebnf-parser@0.1.10: + version "0.1.10" + resolved "https://registry.yarnpkg.com/ebnf-parser/-/ebnf-parser-0.1.10.tgz#cd1f6ba477c5638c40c97ed9b572db5bab5d8331" + +escodegen@1.3.x: + version "1.3.3" + resolved "https://registry.yarnpkg.com/escodegen/-/escodegen-1.3.3.tgz#f024016f5a88e046fd12005055e939802e6c5f23" + dependencies: + esprima "~1.1.1" + estraverse "~1.5.0" + esutils "~1.0.0" + optionalDependencies: + source-map "~0.1.33" + +esprima@1.1.x, esprima@~1.1.1: + version "1.1.1" + resolved "https://registry.yarnpkg.com/esprima/-/esprima-1.1.1.tgz#5b6f1547f4d102e670e140c509be6771d6aeb549" + +estraverse@~1.5.0: + version "1.5.1" + resolved "https://registry.yarnpkg.com/estraverse/-/estraverse-1.5.1.tgz#867a3e8e58a9f84618afb6c2ddbcd916b7cbaf71" + +esutils@~1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/esutils/-/esutils-1.0.0.tgz#8151d358e20c8acc7fb745e7472c0025fe496570" + +jison-lex@0.3.x: + version "0.3.4" + resolved "https://registry.yarnpkg.com/jison-lex/-/jison-lex-0.3.4.tgz#81ca28d84f84499dfa8c594dcde3d8a3f26ec7a5" + dependencies: + lex-parser "0.1.x" + nomnom "1.5.2" + +jison@zaach/jison: + version "0.4.17" + resolved "https://codeload.github.com/zaach/jison/tar.gz/7653842e5120510b0b77484ac90d6c569cf146fd" + dependencies: + JSONSelect "0.4.0" + cjson "0.3.0" + ebnf-parser "0.1.10" + escodegen "1.3.x" + esprima "1.1.x" + jison-lex "0.3.x" + lex-parser "~0.1.3" + nomnom "1.5.2" + +jsonlint@1.6.0: + version "1.6.0" + resolved "https://registry.yarnpkg.com/jsonlint/-/jsonlint-1.6.0.tgz#88aa46bc289a7ac93bb46cae2d58a187a9bb494a" + dependencies: + JSV ">= 4.0.x" + nomnom ">= 1.5.x" + +lex-parser@0.1.x, lex-parser@~0.1.3: + version "0.1.4" + resolved "https://registry.yarnpkg.com/lex-parser/-/lex-parser-0.1.4.tgz#64c4f025f17fd53bfb45763faeb16f015a747550" + +nomnom@1.5.2, "nomnom@>= 1.5.x": + version "1.5.2" + resolved "https://registry.yarnpkg.com/nomnom/-/nomnom-1.5.2.tgz#f4345448a853cfbd5c0d26320f2477ab0526fe2f" + dependencies: + colors "0.5.x" + underscore "1.1.x" + +source-map@~0.1.33: + version "0.1.43" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.1.43.tgz#c24bc146ca517c1471f5dacbe2571b2b7f9e3346" + dependencies: + amdefine ">=0.0.4" + +test@*: + version "0.6.0" + resolved "https://registry.yarnpkg.com/test/-/test-0.6.0.tgz#5986ac445ec17754322512d104ba32c8a63e938e" + dependencies: + ansi-font "0.0.2" + +underscore@1.1.x: + version "1.1.7" + resolved "https://registry.yarnpkg.com/underscore/-/underscore-1.1.7.tgz#40bab84bad19d230096e8d6ef628bff055d83db0" From eb15cf19021ae68f6996f93a0f859adf0a9ad9be Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 25 Jan 2017 11:52:53 +0100 Subject: [PATCH 243/417] bump build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 12b3481..b98e3ed 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-161", + "version": "0.1.4-162", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 5c56c25ca970280a1d158ff0cfcec3e3a1544376 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 25 Jan 2017 11:57:43 +0100 Subject: [PATCH 244/417] re-tagged and bumped build revision again after mismanagement of build 161 (hadn't run the proper `make git-tag` + `make bump` commands!) --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b98e3ed..4bf55b6 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-162", + "version": "0.1.4-163", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 92e2c136b7053cbd187a6132aee5082b004b7d47 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 28 Jan 2017 01:06:00 +0100 Subject: [PATCH 245/417] bumped build number --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4bf55b6..a2e1424 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-163", + "version": "0.1.4-164", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 1af9bf33f050c85e107313b8f04f7382aff4860d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Jan 2017 20:49:07 +0100 Subject: [PATCH 246/417] rebuilt library files --- lex-parser.js | 4438 ------------------------------------------------- 1 file changed, 4438 deletions(-) delete mode 100644 lex-parser.js diff --git a/lex-parser.js b/lex-parser.js deleted file mode 100644 index de8987f..0000000 --- a/lex-parser.js +++ /dev/null @@ -1,4438 +0,0 @@ -/* parser generated by jison 0.4.18-161 */ -/* - * Returns a Parser object of the following structure: - * - * Parser: { - * yy: {} The so-called "shared state" or rather the *source* of it; - * the real "shared state" `yy` passed around to - * the rule actions, etc. is a derivative/copy of this one, - * not a direct reference! - * } - * - * Parser.prototype: { - * yy: {}, - * EOF: 1, - * TERROR: 2, - * - * trace: function(errorMessage, ...), - * - * JisonParserError: function(msg, hash), - * - * quoteName: function(name), - * Helper function which can be overridden by user code later on: put suitable - * quotes around literal IDs in a description string. - * - * originalQuoteName: function(name), - * The basic quoteName handler provided by JISON. - * `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function - * at the end of the `parse()`. - * - * describeSymbol: function(symbol), - * Return a more-or-less human-readable description of the given symbol, when - * available, or the symbol itself, serving as its own 'description' for lack - * of something better to serve up. - * - * Return NULL when the symbol is unknown to the parser. - * - * symbols_: {associative list: name ==> number}, - * terminals_: {associative list: number ==> name}, - * nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}}, - * terminal_descriptions_: (if there are any) {associative list: number ==> description}, - * productions_: [...], - * - * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack, ...), - * where `...` denotes the (optional) additional arguments the user passed to - * `parser.parse(str, ...)` and specified by way of `%parse-param ...` in the grammar file - * - * The function parameters and `this` have the following value/meaning: - * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) - * to store/reference the rule value `$$` and location info `@$`. - * - * One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets - * to see the same object via the `this` reference, i.e. if you wish to carry custom - * data from one reduce action through to the next within a single parse run, then you - * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. - * - * - `yytext` : reference to the lexer value which belongs to the last lexer token used - * to match this rule. This is *not* the look-ahead token, but the last token - * that's actually part of this rule. - * - * Formulated another way, `yytext` is the value of the token immediately preceeding - * the current look-ahead token. - * Caveats apply for rules which don't require look-ahead, such as epsilon rules. - * - * - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value. - * - * - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value. - * - * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. - * - * - `yystate` : the current parser state number, used internally for dispatching and - * executing the action code chunk matching the rule currently being reduced. - * - * - `yysp` : the current state stack position (a.k.a. 'stack pointer') - * - * This one comes in handy when you are going to do advanced things to the parser - * stacks, all of which are accessible from your action code (see the next entries below). - * - * Also note that you can access this and other stack index values using the new back-quote - * syntax, i.e. ``$ === `0 === yysp`, while ``1` is the stack index for all things - * related to the first rule term, just like you have `$1` and `@1`. - * This is made available to write very advanced grammar action rules, e.g. when you want - * to investigate the parse state stack in your action code, which would, for example, - * be relevant when you wish to implement error diagnostics and reporting schemes similar - * to the work described here: - * - * + Pottier, F., 2016. Reachability and error diagnosis in LR (1) automata. - * In Journées Francophones des Languages Applicatifs. - * - * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. - * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. - * - * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. - * constructs. - * - * - `yylstack`: reference to the parser token location stack. Also accessed via - * the `@1` etc. constructs. - * - * - `yystack` : reference to the parser token id stack. Also accessed via the - * `#1` etc. constructs. - * - * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to - * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might - * want access for your own purposes, such as error analysis as mentioned above! - * - * Note that this stack stores the current stack of *tokens*, that is the sequence of - * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* - * (lexer tokens *shifted* onto the stack until the rule they belong to is found and - * *reduced*. - * - * - `yysstack`: reference to the parser state stack. This one carries the internal parser - * *states* such as the one in `yystate`, which are used to represent - * the parser state machine in the *parse table*. *Very* *internal* stuff, - * what can I say? If you access this one, you're clearly doing wicked things - * - * - `...` : the extra arguments you specified in the `%parse-param` statement in your - * grammar definition file. - * - * table: [...], - * State transition table - * ---------------------- - * - * index levels are: - * - `state` --> hash table - * - `symbol` --> action (number or array) - * - * If the `action` is an array, these are the elements' meaning: - * - index [0]: 1 = shift, 2 = reduce, 3 = accept - * - index [1]: GOTO `state` - * - * If the `action` is a number, it is the GOTO `state` - * - * defaultActions: {...}, - * - * parseError: function(str, hash), - * yyErrOk: function(), - * yyClearIn: function(), - * - * constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable), - * Helper function **which will be set up during the first invocation of the `parse()` method**. - * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. - * See it's use in this parser kernel in many places; example usage: - * - * var infoObj = parser.constructParseErrorInfo('fail!', null, - * parser.collect_expected_token_set(state), true); - * var retVal = parser.parseError(infoObj.errStr, infoObj); - * - * originalParseError: function(str, hash), - * The basic parseError handler provided by JISON. - * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function - * at the end of the `parse()`. - * - * options: { ... parser %options ... }, - * - * parse: function(input[, args...]), - * Parse the given `input` and return the parsed value (or `true` when none was provided by - * the root action, in which case the parser is acting as a *matcher*). - * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: - * these extra `args...` are passed verbatim to the grammar rules' action code. - * - * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), - * Helper function **which will be set up during the first invocation of the `parse()` method**. - * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown - * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY - * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and - * the internal parser gets properly garbage collected under these particular circumstances. - * - * lexer: { - * yy: {...}, A reference to the so-called "shared state" `yy` once - * received via a call to the `.setInput(input, yy)` lexer API. - * EOF: 1, - * ERROR: 2, - * JisonLexerError: function(msg, hash), - * parseError: function(str, hash), - * setInput: function(input, [yy]), - * input: function(), - * unput: function(str), - * more: function(), - * reject: function(), - * less: function(n), - * pastInput: function(n), - * upcomingInput: function(n), - * showPosition: function(), - * test_match: function(regex_match_array, rule_index), - * next: function(), - * lex: function(), - * begin: function(condition), - * pushState: function(condition), - * popState: function(), - * topState: function(), - * _currentRules: function(), - * stateStackSize: function(), - * - * options: { ... lexer %options ... }, - * - * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), - * rules: [...], - * conditions: {associative list: name ==> set}, - * } - * } - * - * - * token location info (@$, _$, etc.): { - * first_line: n, - * last_line: n, - * first_column: n, - * last_column: n, - * range: [start_number, end_number] - * (where the numbers are indexes into the input string, zero-based) - * } - * - * --- - * - * The parseError function receives a 'hash' object with these members for lexer and - * parser errors: - * - * { - * text: (matched text) - * token: (the produced terminal token, if any) - * token_id: (the produced terminal token numeric ID, if any) - * line: (yylineno) - * loc: (yylloc) - * } - * - * parser (grammar) errors will also provide these additional members: - * - * { - * expected: (array describing the set of expected tokens; - * may be UNDEFINED when we cannot easily produce such a set) - * state: (integer (or array when the table includes grammar collisions); - * represents the current internal state of the parser kernel. - * can, for example, be used to pass to the `collect_expected_token_set()` - * API to obtain the expected token set) - * action: (integer; represents the current internal action which will be executed) - * new_state: (integer; represents the next/planned internal state, once the current - * action has executed) - * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule - * available for this particular error) - * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, - * for instance, for advanced error analysis and reporting) - * value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used, - * for instance, for advanced error analysis and reporting) - * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, - * for instance, for advanced error analysis and reporting) - * yy: (object: the current parser internal "shared state" `yy` - * as is also available in the rule actions; this can be used, - * for instance, for advanced error analysis and reporting) - * lexer: (reference to the current lexer instance used by the parser) - * parser: (reference to the current parser instance) - * } - * - * while `this` will reference the current parser instance. - * - * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* - * instance, while these additional `hash` fields will also be provided: - * - * { - * lexer: (reference to the current lexer instance which reported the error) - * } - * - * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired - * from either the parser or lexer, `this` will still reference the related *parser* - * instance, while these additional `hash` fields will also be provided: - * - * { - * exception: (reference to the exception thrown) - * } - * - * Please do note that in the latter situation, the `expected` field will be omitted as - * type of failure is assumed not to be due to *parse errors* but rather due to user - * action code in either parser or lexer failing unexpectedly. - * - * --- - * - * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. - * These options are available: - * - * ### options which are global for all parser instances - * - * Parser.pre_parse: function(yy [, optional parse() args]) - * optional: you can specify a pre_parse() function in the chunk following - * the grammar, i.e. after the last `%%`. - * Parser.post_parse: function(yy, retval [, optional parse() args]) { return retval; } - * optional: you can specify a post_parse() function in the chunk following - * the grammar, i.e. after the last `%%`. When it does not return any value, - * the parser will return the original `retval`. - * - * ### options which can be set up per parser instance - * - * yy: { - * pre_parse: function(yy [, optional parse() args]) - * optional: is invoked before the parse cycle starts (and before the first - * invocation of `lex()`) but immediately after the invocation of - * `parser.pre_parse()`). - * post_parse: function(yy, retval [, optional parse() args]) { return retval; } - * optional: is invoked when the parse terminates due to success ('accept') - * or failure (even when exceptions are thrown). - * `retval` contains the return value to be produced by `Parser.parse()`; - * this function can override the return value by returning another. - * When it does not return any value, the parser will return the original - * `retval`. - * This function is invoked immediately before `Parser.post_parse()`. - * - * parseError: function(str, hash) - * optional: overrides the default `parseError` function. - * quoteName: function(name), - * optional: overrides the default `quoteName` function. - * } - * - * parser.lexer.options: { - * pre_lex: function() - * optional: is invoked before the lexer is invoked to produce another token. - * `this` refers to the Lexer object. - * post_lex: function(token) { return token; } - * optional: is invoked when the lexer has produced a token `token`; - * this function can override the returned token value by returning another. - * When it does not return any (truthy) value, the lexer will return - * the original `token`. - * `this` refers to the Lexer object. - * - * ranges: boolean - * optional: `true` ==> token location info will include a .range[] member. - * flex: boolean - * optional: `true` ==> flex-like lexing behaviour where the rules are tested - * exhaustively to find the longest match. - * backtrack_lexer: boolean - * optional: `true` ==> lexer regexes are tested in order and for invoked; - * the lexer terminates the scan when a token is returned by the action code. - * xregexp: boolean - * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the - * `XRegExp` library. When this %option has not been specified at compile time, all lexer - * rule regexes have been written as standard JavaScript RegExp expressions. - * } - */ -var lexParser = (function () { - -// See also: -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 -// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility -// with userland code which might access the derived class in a 'classic' way. -function JisonParserError(msg, hash) { - Object.defineProperty(this, 'name', { - enumerable: false, - writable: false, - value: 'JisonParserError' - }); - - if (msg == null) msg = '???'; - - Object.defineProperty(this, 'message', { - enumerable: false, - writable: true, - value: msg - }); - - this.hash = hash; - - var stacktrace; - if (hash && hash.exception instanceof Error) { - var ex2 = hash.exception; - this.message = ex2.message || msg; - stacktrace = ex2.stack; - } - if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { // V8 - Error.captureStackTrace(this, this.constructor); - } else { - stacktrace = (new Error(msg)).stack; - } - } - if (stacktrace) { - Object.defineProperty(this, 'stack', { - enumerable: false, - writable: false, - value: stacktrace - }); - } -} - -if (typeof Object.setPrototypeOf === 'function') { - Object.setPrototypeOf(JisonParserError.prototype, Error.prototype); -} else { - JisonParserError.prototype = Object.create(Error.prototype); -} -JisonParserError.prototype.constructor = JisonParserError; -JisonParserError.prototype.name = 'JisonParserError'; - - - - -// helper: reconstruct the productions[] table -function bp(s) { - var rv = []; - var p = s.pop; - var r = s.rule; - for (var i = 0, l = p.length; i < l; i++) { - rv.push([ - p[i], - r[i] - ]); - } - return rv; -} - - - -// helper: reconstruct the defaultActions[] table -function bda(s) { - var rv = {}; - var d = s.idx; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var j = d[i]; - rv[j] = g[i]; - } - return rv; -} - - - -// helper: reconstruct the 'goto' table -function bt(s) { - var rv = []; - var d = s.len; - var y = s.symbol; - var t = s.type; - var a = s.state; - var m = s.mode; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var n = d[i]; - var q = {}; - for (var j = 0; j < n; j++) { - var z = y.shift(); - switch (t.shift()) { - case 2: - q[z] = [ - m.shift(), - g.shift() - ]; - break; - - case 0: - q[z] = a.shift(); - break; - - default: - // type === 1: accept - q[z] = [ - 3 - ]; - } - } - rv.push(q); - } - return rv; -} - - - -// helper: runlength encoding with increment step: code, length: step (default step = 0) -// `this` references an array -function s(c, l, a) { - a = a || 0; - for (var i = 0; i < l; i++) { - this.push(c); - c += a; - } -} - -// helper: duplicate sequence from *relative* offset and length. -// `this` references an array -function c(i, l) { - i = this.length - i; - for (l += i; i < l; i++) { - this.push(this[i]); - } -} - -// helper: unpack an array using helpers and data, all passed in an array argument 'a'. -function u(a) { - var rv = []; - for (var i = 0, l = a.length; i < l; i++) { - var e = a[i]; - // Is this entry a helper function? - if (typeof e === 'function') { - i++; - e.apply(rv, a[i]); - } else { - rv.push(e); - } - } - return rv; -} - - -var parser = { -trace: function no_op_trace() { }, -JisonParserError: JisonParserError, -yy: {}, -options: { - type: "lalr", - errorRecoveryTokenDiscardCount: 3 -}, -symbols_: { - "$": 17, - "$accept": 0, - "$end": 1, - "%%": 22, - "(": 10, - ")": 11, - "*": 7, - "+": 12, - ",": 8, - ".": 15, - "/": 14, - "/!": 51, - "<": 5, - "=": 18, - ">": 6, - "?": 13, - "ACTION": 34, - "ACTION_BODY": 44, - "CHARACTER_LIT": 66, - "CODE": 76, - "EOF": 1, - "ESCAPE_CHAR": 63, - "INCLUDE": 73, - "NAME": 27, - "NAME_BRACE": 57, - "OPTIONS": 67, - "OPTIONS_END": 69, - "OPTION_VALUE": 71, - "PATH": 74, - "RANGE_REGEX": 64, - "REGEX_SET": 62, - "REGEX_SET_END": 60, - "REGEX_SET_START": 58, - "SPECIAL_GROUP": 50, - "START_COND": 38, - "START_EXC": 31, - "START_INC": 29, - "STRING_LIT": 65, - "UNKNOWN_DECL": 37, - "^": 16, - "action": 41, - "action_body": 33, - "action_comments_body": 43, - "any_group_regex": 54, - "definition": 26, - "definitions": 21, - "error": 2, - "escape_char": 56, - "extra_lexer_module_code": 25, - "include_macro_code": 35, - "init": 20, - "lex": 19, - "module_code_chunk": 75, - "name_expansion": 52, - "name_list": 45, - "names_exclusive": 32, - "names_inclusive": 30, - "nonempty_regex_list": 46, - "option": 70, - "option_list": 68, - "optional_module_code_chunk": 72, - "options": 36, - "range_regex": 53, - "regex": 28, - "regex_base": 49, - "regex_concat": 48, - "regex_list": 47, - "regex_set": 59, - "regex_set_atom": 61, - "rule": 39, - "rules": 24, - "rules_and_epilogue": 23, - "start_conditions": 40, - "string": 55, - "unbracketed_action_body": 42, - "{": 3, - "|": 9, - "}": 4 -}, -terminals_: { - 1: "EOF", - 2: "error", - 3: "{", - 4: "}", - 5: "<", - 6: ">", - 7: "*", - 8: ",", - 9: "|", - 10: "(", - 11: ")", - 12: "+", - 13: "?", - 14: "/", - 15: ".", - 16: "^", - 17: "$", - 18: "=", - 22: "%%", - 27: "NAME", - 29: "START_INC", - 31: "START_EXC", - 34: "ACTION", - 37: "UNKNOWN_DECL", - 38: "START_COND", - 44: "ACTION_BODY", - 50: "SPECIAL_GROUP", - 51: "/!", - 57: "NAME_BRACE", - 58: "REGEX_SET_START", - 60: "REGEX_SET_END", - 62: "REGEX_SET", - 63: "ESCAPE_CHAR", - 64: "RANGE_REGEX", - 65: "STRING_LIT", - 66: "CHARACTER_LIT", - 67: "OPTIONS", - 69: "OPTIONS_END", - 71: "OPTION_VALUE", - 73: "INCLUDE", - 74: "PATH", - 76: "CODE" -}, -TERROR: 2, -EOF: 1, - -// internals: defined here so the object *structure* doesn't get modified by parse() et al, -// thus helping JIT compilers like Chrome V8. -originalQuoteName: null, -originalParseError: null, -cleanupAfterParse: null, -constructParseErrorInfo: null, - -__reentrant_call_depth: 0, // INTERNAL USE ONLY -__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup - -// APIs which will be set up depending on user action code analysis: -//yyErrOk: 0, -//yyClearIn: 0, - -// Helper APIs -// ----------- - -// Helper function which can be overridden by user code later on: put suitable quotes around -// literal IDs in a description string. -quoteName: function parser_quoteName(id_str) { - return '"' + id_str + '"'; -}, - -// Return a more-or-less human-readable description of the given symbol, when available, -// or the symbol itself, serving as its own 'description' for lack of something better to serve up. -// -// Return NULL when the symbol is unknown to the parser. -describeSymbol: function parser_describeSymbol(symbol) { - if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { - return this.terminal_descriptions_[symbol]; - } - else if (symbol === this.EOF) { - return 'end of input'; - } - else if (this.terminals_[symbol]) { - return this.quoteName(this.terminals_[symbol]); - } - // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. - // - // An example of this may be where a rule's action code contains a call like this: - // - // parser.describeSymbol(#$) - // - // to obtain a human-readable description or name of the current grammar rule. This comes handy in - // error handling action code blocks, for example. - var s = this.symbols_; - for (var key in s) { - if (s[key] === symbol) { - return key; - } - } - return null; -}, - -// Produce a (more or less) human-readable list of expected tokens at the point of failure. -// -// The produced list may contain token or token set descriptions instead of the tokens -// themselves to help turning this output into something that easier to read by humans -// unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*, -// expected terminals and nonterminals is produced. -// -// The returned list (array) will not contain any duplicate entries. -collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) { - var TERROR = this.TERROR; - var tokenset = []; - var check = {}; - // Has this (error?) state been outfitted with a custom expectations description text for human consumption? - // If so, use that one instead of the less palatable token set. - if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { - return [ - this.state_descriptions_[state] - ]; - } - for (var p in this.table[state]) { - p = +p; - if (p !== TERROR) { - var d = do_not_describe ? p : this.describeSymbol(p); - if (d && !check[d]) { - tokenset.push(d); - check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. - } - } - } - return tokenset; -}, -productions_: bp({ - pop: u([ - 19, - 23, - 23, - 20, - 21, - 21, - s, - [26, 8], - 30, - 30, - 32, - 32, - 24, - 24, - 39, - s, - [41, 3], - 42, - 42, - 33, - 33, - 43, - 43, - s, - [40, 3], - 45, - 45, - 28, - 47, - 47, - s, - [46, 3], - 48, - 48, - s, - [49, 15], - 52, - 54, - 59, - 59, - 61, - 61, - 56, - 53, - 55, - 55, - 36, - 68, - 68, - s, - [70, 3], - 25, - 25, - 35, - 35, - 75, - 75, - 72, - 72 -]), - rule: u([ - 5, - 3, - 1, - 0, - 2, - 0, - s, - [2, 3], - 3, - s, - [1, 5], - 2, - 1, - 2, - 2, - 0, - 3, - c, - [12, 4], - 2, - 1, - 5, - 0, - 2, - 3, - 3, - 0, - 1, - c, - [13, 3], - 0, - 3, - c, - [24, 3], - 1, - 3, - 3, - s, - [2, 5], - c, - [10, 3], - s, - [1, 6], - c, - [21, 3], - c, - [9, 10], - c, - [52, 3], - c, - [31, 3], - c, - [28, 3], - 0 -]) -}), -performAction: function parser__PerformAction(yytext, yystate /* action[1] */, $0, yyvstack) { -/* this == yyval */ -var yy = this.yy; - -switch (yystate) { -case 1: - /*! Production:: lex : init definitions '%%' rules_and_epilogue EOF */ - this.$ = yyvstack[$0 - 1]; - if (yyvstack[$0 - 3][0]) this.$.macros = yyvstack[$0 - 3][0]; - if (yyvstack[$0 - 3][1]) this.$.startConditions = yyvstack[$0 - 3][1]; - if (yyvstack[$0 - 3][2]) this.$.unknownDecls = yyvstack[$0 - 3][2]; - // if there are any options, add them all, otherwise set options to NULL: - // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: - for (var k in yy.options) { - this.$.options = yy.options; - break; - } - if (yy.actionInclude) { - var asrc = yy.actionInclude.join('\n\n'); - // Only a non-empty action code chunk should actually make it through: - if (asrc.trim() !== '') { - this.$.actionInclude = asrc; - } - } - delete yy.options; - delete yy.actionInclude; - return this.$; - break; - -case 2: - /*! Production:: rules_and_epilogue : rules '%%' extra_lexer_module_code */ - if (yyvstack[$0] && yyvstack[$0].trim() !== '') { - this.$ = { rules: yyvstack[$0 - 2], moduleInclude: yyvstack[$0] }; - } else { - this.$ = { rules: yyvstack[$0 - 2] }; - } - break; - -case 3: - /*! Production:: rules_and_epilogue : rules */ - this.$ = { rules: yyvstack[$0] }; - break; - -case 4: - /*! Production:: init : ε */ - yy.actionInclude = []; - if (!yy.options) yy.options = {}; - break; - -case 5: - /*! Production:: definitions : definition definitions */ - this.$ = yyvstack[$0]; - if (yyvstack[$0 - 1] != null) { - if ('length' in yyvstack[$0 - 1]) { - this.$[0] = this.$[0] || {}; - this.$[0][yyvstack[$0 - 1][0]] = yyvstack[$0 - 1][1]; - } else if (yyvstack[$0 - 1].type === 'names') { - this.$[1] = this.$[1] || {}; - for (var name in yyvstack[$0 - 1].names) { - this.$[1][name] = yyvstack[$0 - 1].names[name]; - } - } else if (yyvstack[$0 - 1].type === 'unknown') { - this.$[2] = this.$[2] || []; - this.$[2].push(yyvstack[$0 - 1].body); - } - } - break; - -case 6: - /*! Production:: definitions : ε */ - this.$ = [null, null]; - break; - -case 7: - /*! Production:: definition : NAME regex */ - this.$ = [yyvstack[$0 - 1], yyvstack[$0]]; - break; - -case 8: - /*! Production:: definition : START_INC names_inclusive */ -case 9: - /*! Production:: definition : START_EXC names_exclusive */ -case 23: - /*! Production:: action : unbracketed_action_body */ -case 24: - /*! Production:: action : include_macro_code */ -case 27: - /*! Production:: action_body : action_comments_body */ -case 65: - /*! Production:: escape_char : ESCAPE_CHAR */ -case 66: - /*! Production:: range_regex : RANGE_REGEX */ -case 75: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 79: - /*! Production:: module_code_chunk : CODE */ -case 81: - /*! Production:: optional_module_code_chunk : module_code_chunk */ - this.$ = yyvstack[$0]; - break; - -case 10: - /*! Production:: definition : '{' action_body '}' */ - yy.actionInclude.push(yyvstack[$0 - 1]); this.$ = null; - break; - -case 11: - /*! Production:: definition : ACTION */ -case 12: - /*! Production:: definition : include_macro_code */ - yy.actionInclude.push(yyvstack[$0]); this.$ = null; - break; - -case 13: - /*! Production:: definition : options */ - this.$ = null; - break; - -case 14: - /*! Production:: definition : UNKNOWN_DECL */ - this.$ = {type: 'unknown', body: yyvstack[$0]}; - break; - -case 15: - /*! Production:: names_inclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 0; - break; - -case 16: - /*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 0; - break; - -case 17: - /*! Production:: names_exclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 1; - break; - -case 18: - /*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 1; - break; - -case 19: - /*! Production:: rules : rules rule */ - this.$ = yyvstack[$0 - 1]; this.$.push(yyvstack[$0]); - break; - -case 20: - /*! Production:: rules : ε */ - this.$ = []; - break; - -case 21: - /*! Production:: rule : start_conditions regex action */ - this.$ = yyvstack[$0 - 2] ? [yyvstack[$0 - 2], yyvstack[$0 - 1], yyvstack[$0]] : [yyvstack[$0 - 1], yyvstack[$0]]; - break; - -case 22: - /*! Production:: action : '{' action_body '}' */ -case 31: - /*! Production:: start_conditions : '<' name_list '>' */ - this.$ = yyvstack[$0 - 1]; - break; - -case 26: - /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ - this.$ = yyvstack[$0 - 1] + '\n' + yyvstack[$0]; - break; - -case 28: - /*! Production:: action_body : action_body '{' action_body '}' action_comments_body */ - this.$ = yyvstack[$0 - 4] + yyvstack[$0 - 3] + yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; - break; - -case 29: - /*! Production:: action_comments_body : ε */ -case 38: - /*! Production:: regex_list : ε */ -case 82: - /*! Production:: optional_module_code_chunk : ε */ - this.$ = ''; - break; - -case 30: - /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ -case 42: - /*! Production:: regex_concat : regex_concat regex_base */ -case 52: - /*! Production:: regex_base : regex_base range_regex */ -case 61: - /*! Production:: regex_set : regex_set_atom regex_set */ -case 80: - /*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = yyvstack[$0 - 1] + yyvstack[$0]; - break; - -case 32: - /*! Production:: start_conditions : '<' '*' '>' */ - this.$ = ['*']; - break; - -case 34: - /*! Production:: name_list : NAME */ - this.$ = [yyvstack[$0]]; - break; - -case 35: - /*! Production:: name_list : name_list ',' NAME */ - this.$ = yyvstack[$0 - 2]; this.$.push(yyvstack[$0]); - break; - -case 36: - /*! Production:: regex : nonempty_regex_list[re] */ - // Detect if the regex ends with a pure (Unicode) word; - // we *do* consider escaped characters which are 'alphanumeric' - // to be equivalent to their non-escaped version, hence these are - // all valid 'words' for the 'easy keyword rules' option: - // - // - hello_kitty - // - γεια_σου_γατοÏλα - // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 - // - // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 - // - // As we only check the *tail*, we also accept these as - // 'easy keywords': - // - // - %options - // - %foo-bar - // - +++a:b:c1 - // - // Note the dash in that last example: there the code will consider - // `bar` to be the keyword, which is fine with us as we're only - // interested in the trailing boundary and patching that one for - // the `easy_keyword_rules` option. - this.$ = yyvstack[$0]; - if (yy.options.easy_keyword_rules) { - // We need to 'protect' `eval` here as keywords are allowed - // to contain double-quotes and other leading cruft. - // `eval` *does* gobble some escapes (such as `\b`) but - // we protect against that through a simple replace regex: - // we're not interested in the special escapes' exact value - // anyway. - // It will also catch escaped escapes (`\\`), which are not - // word characters either, so no need to worry about - // `eval(str)` 'correctly' converting convoluted constructs - // like '\\\\\\\\\\b' in here. - this.$ = this.$ - .replace(/\\\\/g, '.') - .replace(/"/g, '.') - .replace(/\\c[A-Z]/g, '.') - .replace(/\\[^xu0-9]/g, '.'); - - try { - this.$ = eval('"' + this.$ + '"'); - } - catch (ex) { - console.warn('easy-keyword-rule FAIL on eval: ', ex); - - // make the next keyword test fail: - this.$ = '.'; - } - // a 'keyword' starts with an alphanumeric character, - // followed by zero or more alphanumerics or digits: - var re = XRegExp('\\w[\\w\\d]*$', 'u'); - if (XRegExp.match(this.$, re)) { - this.$ = yyvstack[$0] + "\\b"; - } else { - this.$ = yyvstack[$0]; - } - } - break; - -case 39: - /*! Production:: nonempty_regex_list : regex_concat '|' regex_list */ - this.$ = yyvstack[$0 - 2] + '|' + yyvstack[$0]; - break; - -case 40: - /*! Production:: nonempty_regex_list : '|' regex_list */ - this.$ = '|' + yyvstack[$0]; - break; - -case 44: - /*! Production:: regex_base : '(' regex_list ')' */ - this.$ = '(' + yyvstack[$0 - 1] + ')'; - break; - -case 45: - /*! Production:: regex_base : SPECIAL_GROUP regex_list ')' */ - this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + ')'; - break; - -case 46: - /*! Production:: regex_base : regex_base '+' */ - this.$ = yyvstack[$0 - 1] + '+'; - break; - -case 47: - /*! Production:: regex_base : regex_base '*' */ - this.$ = yyvstack[$0 - 1] + '*'; - break; - -case 48: - /*! Production:: regex_base : regex_base '?' */ - this.$ = yyvstack[$0 - 1] + '?'; - break; - -case 49: - /*! Production:: regex_base : '/' regex_base */ - this.$ = '(?=' + yyvstack[$0] + ')'; - break; - -case 50: - /*! Production:: regex_base : '/!' regex_base */ - this.$ = '(?!' + yyvstack[$0] + ')'; - break; - -case 54: - /*! Production:: regex_base : '.' */ - this.$ = '.'; - break; - -case 55: - /*! Production:: regex_base : '^' */ - this.$ = '^'; - break; - -case 56: - /*! Production:: regex_base : '$' */ - this.$ = '$'; - break; - -case 60: - /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 76: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; - break; - -case 64: - /*! Production:: regex_set_atom : name_expansion */ - if (XRegExp._getUnicodeProperty(yyvstack[$0].replace(/[{}]/g, '')) - && yyvstack[$0].toUpperCase() !== yyvstack[$0] - ) { - // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories - this.$ = yyvstack[$0]; - } else { - this.$ = yyvstack[$0]; - } - //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); - break; - -case 67: - /*! Production:: string : STRING_LIT */ - this.$ = prepareString(yyvstack[$0].substr(1, yyvstack[$0].length - 2)); - break; - -case 72: - /*! Production:: option : NAME[option] */ - yy.options[yyvstack[$0]] = true; - break; - -case 73: - /*! Production:: option : NAME[option] '=' OPTION_VALUE[value] */ -case 74: - /*! Production:: option : NAME[option] '=' NAME[value] */ - yy.options[yyvstack[$0 - 2]] = yyvstack[$0]; - break; - -case 77: - /*! Production:: include_macro_code : INCLUDE PATH */ - var fs = require('fs'); - var fileContent = fs.readFileSync(yyvstack[$0], { encoding: 'utf-8' }); - // And no, we don't support nested '%include': - this.$ = '\n// Included by Jison: ' + yyvstack[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[$0] + '\n\n'; - break; - -case 78: - /*! Production:: include_macro_code : INCLUDE error */ - console.error("%include MUST be followed by a valid file path"); - break; - -} -}, -table: bt({ - len: u([ - 11, - 1, - 13, - 1, - 13, - 21, - 2, - 2, - 5, - s, - [9, 4], - 2, - 3, - 18, - 1, - 9, - 9, - 28, - 31, - 28, - 22, - 22, - 17, - 17, - s, - [27, 7], - 29, - 5, - s, - [27, 3], - s, - [10, 4], - 2, - 3, - 25, - 25, - 1, - 4, - 3, - 1, - 18, - 31, - 28, - 10, - 10, - s, - [27, 5], - 1, - 1, - 28, - 28, - 1, - 6, - 3, - 3, - 10, - 10, - 9, - 5, - 3, - 9, - 1, - 2, - 1, - 6, - 16, - 21, - 3, - c, - [27, 4], - 1, - s, - [2, 3], - 1, - s, - [3, 3], - 6, - 2, - 1, - 2, - 4, - 6, - 3, - 16, - 5, - 17, - 16, - 17, - c, - [103, 3], - 3, - 1, - 2, - 17, - 2, - 16 -]), - symbol: u([ - 3, - 19, - 20, - 22, - 27, - 29, - 31, - 34, - 37, - 67, - 73, - 1, - 3, - 21, - 22, - 26, - c, - [12, 4], - 35, - 36, - c, - [14, 3], - 22, - c, - [14, 13], - 9, - 10, - s, - [14, 4, 1], - 28, - 46, - s, - [48, 5, 1], - s, - [54, 5, 1], - 63, - 65, - 66, - 30, - 38, - 32, - 38, - 3, - 4, - 33, - 43, - 44, - 3, - c, - [67, 8], - c, - [9, 27], - 2, - 74, - 27, - 68, - 70, - 1, - 5, - c, - [73, 6], - 22, - 23, - 24, - 50, - 51, - c, - [68, 5], - 22, - c, - [51, 19], - 9, - 10, - 11, - c, - [37, 5], - c, - [16, 5], - c, - [113, 12], - c, - [28, 16], - s, - [46, 7, 1], - c, - [31, 11], - 7, - s, - [9, 9, 1], - c, - [34, 6], - 50, - 51, - 53, - c, - [27, 3], - s, - [64, 4, 1], - c, - [195, 3], - c, - [58, 5], - c, - [52, 15], - c, - [22, 22], - c, - [165, 5], - c, - [17, 29], - c, - [106, 19], - c, - [105, 8], - c, - [27, 183], - 60, - s, - [62, 6, 1], - 73, - 52, - 57, - 59, - 61, - 62, - c, - [115, 82], - c, - [17, 6], - 38, - c, - [10, 33], - 4, - 3, - 4, - 44, - 1, - 3, - c, - [552, 8], - c, - [70, 10], - c, - [69, 4], - 76, - c, - [25, 25], - 69, - 27, - 68, - 69, - 70, - 18, - 27, - 69, - 1, - c, - [610, 9], - 39, - 40, - c, - [30, 7], - c, - [563, 59], - 3, - 11, - c, - [660, 9], - c, - [10, 10], - c, - [451, 134], - 11, - 11, - c, - [185, 29], - c, - [28, 27], - 60, - c, - [481, 3], - 60, - 61, - 62, - 57, - 60, - c, - [3, 4], - c, - [397, 27], - c, - [396, 4], - c, - [988, 4], - 4, - c, - [991, 10], - 69, - 27, - 71, - 1, - 1, - 25, - 72, - 73, - 75, - 76, - c, - [359, 9], - c, - [357, 7], - c, - [1056, 21], - 7, - 27, - 45, - c, - [312, 91], - 60, - 3, - 4, - 27, - 69, - c, - [498, 4], - 35, - 73, - 1, - c, - [538, 3], - 73, - 76, - 3, - 34, - 35, - 41, - 42, - 73, - 6, - 8, - 6, - 6, - 8, - 3, - 4, - 43, - 44, - c, - [169, 7], - c, - [27, 3], - c, - [172, 15], - c, - [215, 5], - c, - [21, 9], - 34, - c, - [22, 7], - c, - [38, 16], - c, - [33, 17], - c, - [15, 6], - c, - [13, 7], - 27, - c, - [14, 13], - c, - [691, 5], - 4, - c, - [50, 17], - 6, - 8, - c, - [85, 16] -]), - type: u([ - 2, - 0, - 0, - s, - [2, 8], - 1, - 2, - 0, - 2, - c, - [13, 5], - c, - [19, 7], - c, - [14, 14], - c, - [11, 6], - c, - [13, 4], - c, - [6, 6], - c, - [33, 9], - c, - [32, 11], - s, - [2, 31], - c, - [74, 13], - c, - [53, 41], - c, - [113, 11], - c, - [81, 18], - c, - [144, 13], - c, - [64, 24], - c, - [52, 35], - c, - [22, 20], - c, - [17, 34], - s, - [2, 213], - c, - [470, 3], - c, - [227, 180], - c, - [686, 7], - c, - [610, 32], - c, - [563, 52], - c, - [260, 171], - c, - [28, 36], - c, - [298, 4], - c, - [227, 39], - c, - [294, 20], - c, - [20, 3], - c, - [62, 24], - c, - [349, 17], - c, - [330, 101], - c, - [1184, 13], - c, - [940, 13], - c, - [128, 24], - c, - [737, 121] -]), - state: u([ - s, - [1, 4, 1], - 10, - 11, - 16, - c, - [4, 3], - 17, - 18, - 19, - 21, - 26, - 27, - 31, - 32, - 38, - 40, - 42, - 43, - 46, - 47, - 49, - 50, - 52, - c, - [13, 4], - 54, - 53, - c, - [21, 6], - 58, - 54, - 60, - c, - [9, 6], - 54, - 61, - c, - [8, 6], - 62, - c, - [5, 4], - 63, - c, - [5, 4], - 67, - 64, - 65, - 74, - 47, - 78, - 79, - 54, - 81, - c, - [42, 7], - 58, - 58, - 67, - 85, - 65, - 86, - 43, - 89, - 90, - 91, - 93, - c, - [82, 7], - 94, - 98, - 103, - 100, - 102, - 108, - 109, - 90, - 91, - 110, - 43 -]), - mode: u([ - s, - [2, 9], - 1, - 2, - s, - [1, 9], - c, - [10, 10], - s, - [1, 13], - s, - [2, 39], - c, - [42, 39], - c, - [103, 7], - c, - [52, 9], - c, - [13, 7], - c, - [23, 24], - c, - [27, 6], - c, - [67, 15], - c, - [72, 11], - c, - [189, 32], - c, - [202, 52], - s, - [2, 179], - c, - [220, 90], - c, - [89, 20], - c, - [20, 13], - c, - [123, 4], - c, - [126, 51], - c, - [434, 4], - c, - [638, 5], - c, - [83, 15], - c, - [521, 49], - c, - [406, 158], - c, - [184, 27], - c, - [732, 30], - c, - [517, 56], - c, - [57, 17], - c, - [772, 107], - c, - [439, 9], - c, - [221, 8], - c, - [113, 11], - c, - [121, 32], - c, - [153, 54], - c, - [319, 18], - c, - [226, 37] -]), - goto: u([ - s, - [4, 9], - 8, - 6, - 5, - 6, - 7, - 9, - 12, - 14, - 13, - 15, - c, - [10, 9], - 20, - 22, - 24, - 28, - 29, - 30, - 23, - 25, - 33, - 34, - 37, - 35, - 36, - 39, - 41, - s, - [29, 3], - s, - [11, 9], - s, - [12, 9], - s, - [13, 9], - s, - [14, 9], - 45, - 44, - 48, - s, - [20, 16], - 5, - s, - [7, 9], - s, - [36, 9], - 41, - 51, - 22, - 41, - c, - [94, 4], - s, - [41, 6], - c, - [100, 7], - 41, - 41, - 38, - 20, - 22, - 38, - c, - [23, 4], - s, - [38, 6], - c, - [23, 7], - 38, - 38, - 43, - 56, - s, - [43, 3], - 55, - 57, - s, - [43, 15], - 59, - s, - [43, 4], - c, - [49, 7], - c, - [43, 7], - c, - [14, 14], - c, - [192, 12], - c, - [12, 12], - s, - [51, 27], - s, - [53, 27], - s, - [54, 27], - s, - [55, 27], - s, - [56, 27], - s, - [57, 27], - s, - [58, 27], - s, - [59, 29], - 33, - 66, - s, - [67, 27], - s, - [68, 27], - s, - [65, 27], - s, - [8, 7], - 68, - 8, - 8, - s, - [15, 10], - s, - [9, 7], - 69, - 9, - 9, - s, - [17, 10], - 71, - 70, - 27, - 27, - 72, - s, - [77, 25], - s, - [78, 25], - 73, - 48, - 71, - 75, - 72, - 72, - 76, - 3, - 80, - s, - [33, 6], - 77, - s, - [33, 7], - c, - [521, 23], - 42, - 56, - s, - [42, 3], - 55, - 57, - s, - [42, 15], - 59, - s, - [42, 4], - s, - [40, 10], - s, - [37, 10], - s, - [46, 27], - s, - [47, 27], - s, - [48, 27], - s, - [52, 27], - s, - [66, 27], - 82, - 83, - 49, - 56, - s, - [49, 3], - 55, - 57, - s, - [49, 15], - 59, - s, - [49, 4], - 50, - 56, - s, - [50, 3], - 55, - 57, - s, - [50, 15], - 59, - s, - [50, 4], - 84, - 33, - 62, - 66, - s, - [63, 3], - s, - [64, 3], - s, - [16, 10], - s, - [18, 10], - s, - [10, 9], - s, - [29, 3], - s, - [30, 3], - s, - [69, 9], - 70, - 88, - 87, - 1, - 82, - 82, - 92, - s, - [19, 16], - c, - [974, 13], - 95, - 96, - s, - [39, 10], - s, - [44, 27], - s, - [45, 27], - s, - [60, 27], - 61, - 71, - 97, - 73, - 73, - 74, - 74, - 2, - 75, - 13, - 81, - 81, - 99, - s, - [79, 3], - 101, - 104, - 13, - 105, - 106, - 107, - 34, - 34, - s, - [29, 3], - c, - [152, 3], - s, - [80, 3], - s, - [21, 16], - s, - [29, 3], - s, - [23, 9], - 111, - s, - [23, 7], - s, - [24, 16], - s, - [25, 17], - s, - [31, 13], - 112, - s, - [32, 13], - 28, - 28, - 72, - 76, - 71, - 113, - s, - [26, 17], - 35, - 35, - s, - [22, 16] -]) -}), -defaultActions: bda({ - idx: u([ - 0, - s, - [8, 5, 1], - s, - [15, 4, 1], - s, - [26, 8, 1], - 35, - 36, - 37, - 39, - 41, - 44, - 45, - s, - [53, 7, 1], - s, - [66, 9, 1], - 76, - 78, - s, - [81, 5, 1], - 87, - 88, - 89, - 92, - 96, - 97, - 99, - 100, - 101, - 103, - 104, - s, - [105, 4, 2], - 112, - 113 -]), - goto: u([ - 4, - 29, - s, - [11, 4, 1], - 20, - 5, - 7, - 36, - 51, - s, - [53, 7, 1], - 67, - 68, - 65, - 15, - 17, - 77, - 78, - 40, - 37, - 46, - 47, - 48, - 52, - 66, - 63, - 64, - 16, - 18, - 10, - 29, - 30, - 69, - 70, - 1, - 19, - 39, - 44, - 45, - 60, - 61, - 73, - 74, - 2, - 79, - 34, - 29, - 80, - 21, - 29, - 24, - 25, - 31, - 32, - 76, - 26, - 35, - 22 -]) -}), -parseError: function parseError(str, hash) { - if (hash.recoverable) { - this.trace(str); - hash.destroy(); // destroy... well, *almost*! - } else { - throw new this.JisonParserError(str, hash); - } -}, -parse: function parse(input) { - var self = this, - stack = new Array(128), // token stack: stores token which leads to state at the same index (column storage) - sstack = new Array(128), // state stack: stores states (column storage) - - vstack = new Array(128), // semantic value stack - - table = this.table, - sp = 0; // 'stack pointer': index into the stacks - - var recovering = 0; // (only used when the grammar contains error recovery rules) - var TERROR = this.TERROR, - EOF = this.EOF, - ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; - var NO_ACTION = [0, table.length /* ensures that anyone using this new state will fail dramatically! */]; - - //this.reductionCount = this.shiftCount = 0; - - var lexer; - if (this.__lexer__) { - lexer = this.__lexer__; - } else { - lexer = this.__lexer__ = Object.create(this.lexer); - } - - var sharedState_yy = { - parseError: null, - quoteName: null, - lexer: null, - parser: null, - pre_parse: null, - post_parse: null - }; - // copy state - for (var k in this.yy) { - if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState_yy[k] = this.yy[k]; - } - } - - sharedState_yy.lexer = lexer; - sharedState_yy.parser = this; - - - - - - - lexer.setInput(input, sharedState_yy); - - - - - - - vstack[sp] = null; - sstack[sp] = 0; - stack[sp] = 0; - ++sp; - - if (typeof lexer.yytext === 'undefined') { - lexer.yytext = ''; - } - var yytext = lexer.yytext; - if (typeof lexer.yylineno === 'undefined') { - lexer.yylineno = 0; - } - - - // Does the shared state override the default `parseError` that already comes with this instance? - if (typeof sharedState_yy.parseError === 'function') { - this.parseError = sharedState_yy.parseError; - } else { - this.parseError = this.originalParseError; - } - - // Does the shared state override the default `quoteName` that already comes with this instance? - if (typeof sharedState_yy.quoteName === 'function') { - this.quoteName = sharedState_yy.quoteName; - } else { - this.quoteName = this.originalQuoteName; - } - - // set up the cleanup function; make it an API so that external code can re-use this one in case of - // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which - // case this parse() API method doesn't come with a `finally { ... }` block any more! - // - // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, - // or else your `sharedState`, etc. references will be *wrong*! - this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) { - var rv; - - if (invoke_post_methods) { - if (sharedState_yy.post_parse) { - rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue); - if (typeof rv !== 'undefined') resultValue = rv; - } - if (this.post_parse) { - rv = this.post_parse.call(this, sharedState_yy, resultValue); - if (typeof rv !== 'undefined') resultValue = rv; - } - } - - if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. - - // clean up the lingering lexer structures as well: - if (lexer.cleanupAfterLex) { - lexer.cleanupAfterLex(do_not_nuke_errorinfos); - } - - // prevent lingering circular references from causing memory leaks: - if (sharedState_yy) { - sharedState_yy.parseError = undefined; - sharedState_yy.quoteName = undefined; - sharedState_yy.lexer = undefined; - sharedState_yy.parser = undefined; - if (lexer.yy === sharedState_yy) { - lexer.yy = undefined; - } - } - sharedState_yy = undefined; - this.parseError = this.originalParseError; - this.quoteName = this.originalQuoteName; - - // nuke the vstack[] array at least as that one will still reference obsoleted user values. - // To be safe, we nuke the other internal stack columns as well... - stack.length = 0; // fastest way to nuke an array without overly bothering the GC - sstack.length = 0; - - vstack.length = 0; - stack_pointer = 0; - - // nuke the error hash info instances created during this run. - // Userland code must COPY any data/references - // in the error hash instance(s) it is more permanently interested in. - if (!do_not_nuke_errorinfos) { - for (var i = this.__error_infos.length - 1; i >= 0; i--) { - var el = this.__error_infos[i]; - if (el && typeof el.destroy === 'function') { - el.destroy(); - } - } - this.__error_infos.length = 0; - } - - return resultValue; - }; - - // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, - // or else your `lexer`, `sharedState`, etc. references will be *wrong*! - this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { - var pei = { - errStr: msg, - exception: ex, - text: lexer.match, - value: lexer.yytext, - token: this.describeSymbol(symbol) || symbol, - token_id: symbol, - line: lexer.yylineno, - - expected: expected, - recoverable: recoverable, - state: state, - action: action, - new_state: newState, - symbol_stack: stack, - state_stack: sstack, - value_stack: vstack, - - stack_pointer: sp, - yy: sharedState_yy, - lexer: lexer, - parser: this, - - // and make sure the error info doesn't stay due to potential - // ref cycle via userland code manipulations. - // These would otherwise all be memory leak opportunities! - // - // Note that only array and object references are nuked as those - // constitute the set of elements which can produce a cyclic ref. - // The rest of the members is kept intact as they are harmless. - destroy: function destructParseErrorInfo() { - // remove cyclic references added to error info: - // info.yy = null; - // info.lexer = null; - // info.value = null; - // info.value_stack = null; - // ... - var rec = !!this.recoverable; - for (var key in this) { - if (this.hasOwnProperty(key) && typeof key === 'object') { - this[key] = undefined; - } - } - this.recoverable = rec; - } - }; - // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! - this.__error_infos.push(pei); - return pei; - }; - - - function lex() { - var token = lexer.lex(); - // if token isn't its numeric value, convert - if (typeof token !== 'number') { - token = self.symbols_[token] || token; - } - return token || EOF; - } - - - var symbol = 0; - var preErrorSymbol = 0; - var lastEofErrorStateDepth = 0; - var state, action, r, t; - var yyval = { - $: true, - _$: undefined, - yy: sharedState_yy - }; - var p, len, this_production; - - var newState; - var retval = false; - - - // Return the rule stack depth where the nearest error rule can be found. - // Return -1 when no error recovery rule was found. - function locateNearestErrorRecoveryRule(state) { - var stack_probe = sp - 1; - var depth = 0; - - // try to recover from error - for (;;) { - // check for error recovery rule in this state - - var t = table[state][TERROR] || NO_ACTION; - if (t[0]) { - // We need to make sure we're not cycling forever: - // once we hit EOF, even when we `yyerrok()` an error, we must - // prevent the core from running forever, - // e.g. when parent rules are still expecting certain input to - // follow after this, for example when you handle an error inside a set - // of braces which are matched by a parent rule in your grammar. - // - // Hence we require that every error handling/recovery attempt - // *after we've hit EOF* has a diminishing state stack: this means - // we will ultimately have unwound the state stack entirely and thus - // terminate the parse in a controlled fashion even when we have - // very complex error/recovery code interplay in the core + user - // action code blocks: - - if (symbol === EOF) { - if (!lastEofErrorStateDepth) { - lastEofErrorStateDepth = sp - 1 - depth; - } else if (lastEofErrorStateDepth <= sp - 1 - depth) { - - --stack_probe; // popStack(1): [symbol, action] - state = sstack[stack_probe]; - ++depth; - continue; - } - } - return depth; - } - if (state === 0 /* $accept rule */ || stack_probe < 1) { - - return -1; // No suitable error recovery rule available. - } - --stack_probe; // popStack(1): [symbol, action] - state = sstack[stack_probe]; - ++depth; - } - } - - try { - this.__reentrant_call_depth++; - - if (this.pre_parse) { - this.pre_parse.call(this, sharedState_yy); - } - if (sharedState_yy.pre_parse) { - sharedState_yy.pre_parse.call(this, sharedState_yy); - } - - newState = sstack[sp - 1]; - for (;;) { - // retrieve state number from top of stack - state = newState; // sstack[sp - 1]; - - // use default actions if available - if (this.defaultActions[state]) { - action = 2; - newState = this.defaultActions[state]; - } else { - // The single `==` condition below covers both these `===` comparisons in a single - // operation: - // - // if (symbol === null || typeof symbol === 'undefined') ... - if (!symbol) { - symbol = lex(); - } - // read action for current state and first input - t = (table[state] && table[state][symbol]) || NO_ACTION; - newState = t[1]; - action = t[0]; - - - - - // handle parse error - if (!action) { - // first see if there's any chance at hitting an error recovery rule: - var error_rule_depth = locateNearestErrorRecoveryRule(state); - var errStr = null; - var errSymbolDescr = (this.describeSymbol(symbol) || symbol); - var expected = this.collect_expected_token_set(state); - - if (!recovering) { - // Report error - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ':\n' + lexer.showPosition(79 - 10, 10) + '\n'; - } else { - errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; - } - if (expected.length) { - errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; - } else { - errStr += 'Unexpected ' + errSymbolDescr; - } - p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0)); - r = this.parseError(p.errStr, p); - - - if (!p.recoverable) { - retval = r; - break; - } else { - // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process... - } - } - - - - // just recovered from another error - if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { - // only barf a fatal hairball when we're out of look-ahead symbols and none hit a match; - // this DOES discard look-ahead while recovering from an error when said look-ahead doesn't - // suit the error recovery rules... The error HAS been reported already so we're fine with - // throwing away a few items if that is what it takes to match the nearest recovery rule! - if (symbol === EOF || preErrorSymbol === EOF) { - p = this.constructParseErrorInfo((errStr || 'Parsing halted while starting to recover from another error.'), null, expected, false); - retval = this.parseError(p.errStr, p); - break; - } - - // discard current lookahead and grab another - - yytext = lexer.yytext; - - - - symbol = lex(); - - - } - - // try to recover from error - if (error_rule_depth < 0) { - p = this.constructParseErrorInfo((errStr || 'Parsing halted. No suitable error recovery rule available.'), null, expected, false); - retval = this.parseError(p.errStr, p); - break; - } - sp -= error_rule_depth; - - preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token - symbol = TERROR; // insert generic error symbol as new lookahead - // allow N (default: 3) real symbols to be shifted before reporting a new error - recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; - - newState = sstack[sp - 1]; - - - - continue; - } - } - - - switch (action) { - // catch misc. parse failures: - default: - // this shouldn't happen, unless resolve defaults are off - if (action instanceof Array) { - p = this.constructParseErrorInfo(('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol), null, null, false); - retval = this.parseError(p.errStr, p); - break; - } - // Another case of better safe than sorry: in case state transitions come out of another error recovery process - // or a buggy LUT (LookUp Table): - p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); - retval = this.parseError(p.errStr, p); - break; - - // shift: - case 1: - //this.shiftCount++; - stack[sp] = symbol; - vstack[sp] = lexer.yytext; - - sstack[sp] = newState; // push state - ++sp; - symbol = 0; - if (!preErrorSymbol) { // normal execution / no error - // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: - - yytext = lexer.yytext; - - - - if (recovering > 0) { - recovering--; - - } - } else { - // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: - symbol = preErrorSymbol; - preErrorSymbol = 0; - - // read action for current state and first input - t = (table[newState] && table[newState][symbol]) || NO_ACTION; - if (!t[0] || symbol === TERROR) { - // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where - // (simple) stuff might have been missing before the token which caused the error we're - // recovering from now... - // - // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error - // recovery, for then this we would we idling (cycling) on the error forever. - // Yes, this does not take into account the possibility that the *lexer* may have - // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! - - symbol = 0; - } - } - - continue; - - // reduce: - case 2: - //this.reductionCount++; - this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... - len = this_production[1]; - - - - - - - // Make sure subsequent `$$ = $1` default action doesn't fail - // for rules where len==0 as then there's no $1 (you're reducing an epsilon rule then!) - // - // Also do this to prevent nasty action block codes to *read* `$0` or `$$` - // and *not* get `undefined` as a result for their efforts! - vstack[sp] = undefined; - - // perform semantic action - yyval.$ = vstack[sp - len]; // default to $$ = $1; result must produce `undefined` when len == 0, as then there's no $1 - - - - - - - - - - - r = this.performAction.call(yyval, yytext, newState, sp - 1, vstack); - - if (typeof r !== 'undefined') { - retval = r; - break; - } - - // pop off stack - sp -= len; - - // don't overwrite the `symbol` variable: use a local var to speed things up: - var ntsymbol = this_production[0]; // push nonterminal (reduce) - stack[sp] = ntsymbol; - vstack[sp] = yyval.$; - - // goto new state = table[STATE][NONTERMINAL] - newState = table[sstack[sp - 1]][ntsymbol]; - sstack[sp] = newState; - ++sp; - - continue; - - // accept: - case 3: - retval = true; - // Return the `$accept` rule's `$$` result, if available. - // - // Also note that JISON always adds this top-most `$accept` rule (with implicit, - // default, action): - // - // $accept: $end - // %{ $$ = $1; @$ = @1; %} - // - // which, combined with the parse kernel's `$accept` state behaviour coded below, - // will produce the `$$` value output of the rule as the parse result, - // IFF that result is *not* `undefined`. (See also the parser kernel code.) - // - // In code: - // - // %{ - // @$ = @1; // if location tracking support is included - // if (typeof $1 !== 'undefined') - // return $1; - // else - // return true; // the default parse result if the rule actions don't produce anything - // %} - if (typeof yyval.$ !== 'undefined') { - retval = yyval.$; - } - break; - } - - // break out of loop: we accept or fail with error - break; - } - } catch (ex) { - // report exceptions through the parseError callback too: - p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); - retval = this.parseError(p.errStr, p); - } finally { - retval = this.cleanupAfterParse(retval, true, true); - this.__reentrant_call_depth--; - } - - return retval; -} -}; -parser.originalParseError = parser.parseError; -parser.originalQuoteName = parser.quoteName; - -var XRegExp = require('xregexp'); // for helping out the `%options xregexp` in the lexer - -function encodeRE (s) { - return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); -} - -function prepareString (s) { - // unescape slashes - s = s.replace(/\\\\/g, "\\"); - s = encodeRE(s); - return s; -}; -/* generated by jison-lex 0.3.4-161 */ -var lexer = (function () { -// See also: -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 -// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility -// with userland code which might access the derived class in a 'classic' way. -function JisonLexerError(msg, hash) { - Object.defineProperty(this, 'name', { - enumerable: false, - writable: false, - value: 'JisonLexerError' - }); - - if (msg == null) msg = '???'; - - Object.defineProperty(this, 'message', { - enumerable: false, - writable: true, - value: msg - }); - - this.hash = hash; - - var stacktrace; - if (hash && hash.exception instanceof Error) { - var ex2 = hash.exception; - this.message = ex2.message || msg; - stacktrace = ex2.stack; - } - if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { // V8 - Error.captureStackTrace(this, this.constructor); - } else { - stacktrace = (new Error(msg)).stack; - } - } - if (stacktrace) { - Object.defineProperty(this, 'stack', { - enumerable: false, - writable: false, - value: stacktrace - }); - } -} - -if (typeof Object.setPrototypeOf === 'function') { - Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); -} else { - JisonLexerError.prototype = Object.create(Error.prototype); -} -JisonLexerError.prototype.constructor = JisonLexerError; -JisonLexerError.prototype.name = 'JisonLexerError'; - - -var lexer = { - EOF: 1, - ERROR: 2, - - // JisonLexerError: JisonLexerError, // <-- injected by the code generator - - // options: {}, // <-- injected by the code generator - - // yy: ..., // <-- injected by setInput() - - __currentRuleSet__: null, // <-- internal rule set cache for the current lexer state - - __error_infos: [], // INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - - __decompressed: false, // INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - - done: false, // INTERNAL USE ONLY - _backtrack: false, // INTERNAL USE ONLY - _input: '', // INTERNAL USE ONLY - _more: false, // INTERNAL USE ONLY - _signaled_error_token: false, // INTERNAL USE ONLY - - conditionStack: [], // INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - - match: '', // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', // ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction - - // INTERNAL USE: construct a suitable error info hash object instance for `parseError`. - constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { - var pei = { - errStr: msg, - recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... - token: null, - line: this.yylineno, - loc: this.yylloc, - yy: this.yy, - lexer: this, - - // and make sure the error info doesn't stay due to potential - // ref cycle via userland code manipulations. - // These would otherwise all be memory leak opportunities! - // - // Note that only array and object references are nuked as those - // constitute the set of elements which can produce a cyclic ref. - // The rest of the members is kept intact as they are harmless. - destroy: function destructLexErrorInfo() { - // remove cyclic references added to error info: - // info.yy = null; - // info.lexer = null; - // ... - var rec = !!this.recoverable; - for (var key in this) { - if (this.hasOwnProperty(key) && typeof key === 'object') { - this[key] = undefined; - } - } - this.recoverable = rec; - } - }; - // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! - this.__error_infos.push(pei); - return pei; - }, - - parseError: function lexer_parseError(str, hash) { - if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { - return this.yy.parser.parseError(str, hash) || this.ERROR; - } else if (typeof this.yy.parseError === 'function') { - return this.yy.parseError.call(this, str, hash) || this.ERROR; - } else { - throw new this.JisonLexerError(str); - } - }, - - // final cleanup function for when we have completed lexing the input; - // make it an API so that external code can use this one once userland - // code has decided it's time to destroy any lingering lexer error - // hash object instances and the like: this function helps to clean - // up these constructs, which *may* carry cyclic references which would - // otherwise prevent the instances from being properly and timely - // garbage-collected, i.e. this function helps prevent memory leaks! - cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { - var rv; - - // prevent lingering circular references from causing memory leaks: - this.setInput('', {}); - - // nuke the error hash info instances created during this run. - // Userland code must COPY any data/references - // in the error hash instance(s) it is more permanently interested in. - if (!do_not_nuke_errorinfos) { - for (var i = this.__error_infos.length - 1; i >= 0; i--) { - var el = this.__error_infos[i]; - if (el && typeof el.destroy === 'function') { - el.destroy(); - } - } - this.__error_infos.length = 0; - } - - return this; - }, - - // clear the lexer token context; intended for internal use only - clear: function lexer_clear() { - this.yytext = ''; - this.yyleng = 0; - this.match = ''; - this.matches = false; - this._more = false; - this._backtrack = false; - }, - - // resets the lexer, sets new input - setInput: function lexer_setInput(input, yy) { - this.yy = yy || this.yy || {}; - - // also check if we've fully initialized the lexer instance, - // including expansion work to be done to go from a loaded - // lexer to a usable lexer: - if (!this.__decompressed) { - // step 1: decompress the regex list: - var rules = this.rules; - for (var i = 0, len = rules.length; i < len; i++) { - var rule_re = rules[i]; - - // compression: is the RE an xref to another RE slot in the rules[] table? - if (typeof rule_re === 'number') { - rules[i] = rules[rule_re]; - } - } - - // step 2: unfold the conditions[] set to make these ready for use: - var conditions = this.conditions; - for (var k in conditions) { - var spec = conditions[k]; - - var rule_ids = spec.rules; - - var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! - var rule_new_ids = new Array(len + 1); - - if (this.rules_prefix1) { - var rule_prefixes = new Array(65536); - var first_catch_all_index = 0; - - for (var i = 0; i < len; i++) { - var idx = rule_ids[i]; - var rule_re = rules[idx]; - rule_regexes[i + 1] = rule_re; - rule_new_ids[i + 1] = idx; - - var prefix = this.rules_prefix1[idx]; - // compression: is the PREFIX-STRING an xref to another PREFIX-STRING slot in the rules_prefix1[] table? - if (typeof prefix === 'number') { - prefix = this.rules_prefix1[prefix]; - } - // init the prefix lookup table: first come, first serve... - if (!prefix) { - if (!first_catch_all_index) { - first_catch_all_index = i + 1; - } - } else { - for (var j = 0, pfxlen = prefix.length; j < pfxlen; j++) { - var pfxch = prefix.charCodeAt(j); - // first come, first serve: - if (!rule_prefixes[pfxch]) { - rule_prefixes[pfxch] = i + 1; - } - } - } - } - - // if no catch-all prefix has been encountered yet, it means all - // rules have limited prefix sets and it MAY be that particular - // input characters won't be recognized by any rule in this - // condition state. - // - // To speed up their discovery at run-time while keeping the - // remainder of the lexer kernel code very simple (and fast), - // we point these to an 'illegal' rule set index *beyond* - // the end of the rule set. - if (!first_catch_all_index) { - first_catch_all_index = len + 1; - } - - for (var i = 0; i < 65536; i++) { - if (!rule_prefixes[i]) { - rule_prefixes[i] = first_catch_all_index; - } - } - - spec.__dispatch_lut = rule_prefixes; - } else { - for (var i = 0; i < len; i++) { - var idx = rule_ids[i]; - var rule_re = rules[idx]; - rule_regexes[i + 1] = rule_re; - rule_new_ids[i + 1] = idx; - } - } - - spec.rules = rule_new_ids; - spec.__rule_regexes = rule_regexes; - spec.__rule_count = len; - } - - this.__decompressed = true; - } - - this._input = input || ''; - this.clear(); - this._signaled_error_token = false; - this.done = false; - this.yylineno = 0; - this.matched = ''; - this.conditionStack = ['INITIAL']; - this.__currentRuleSet__ = null; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0 - }; - if (this.options.ranges) { - this.yylloc.range = [0, 0]; - } - this.offset = 0; - return this; - }, - - // consumes and returns one char from the input - input: function lexer_input() { - if (!this._input) { - this.done = true; - return null; - } - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - // Count the linenumber up when we hit the LF (or a stand-alone CR). - // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo - // and we advance immediately past the LF as well, returning both together as if - // it was all a single 'character' only. - var slice_len = 1; - var lines = false; - if (ch === '\n') { - lines = true; - } else if (ch === '\r') { - lines = true; - var ch2 = this._input[1]; - if (ch2 === '\n') { - slice_len++; - ch += ch2; - this.yytext += ch2; - this.yyleng++; - this.offset++; - this.match += ch2; - this.matched += ch2; - if (this.options.ranges) { - this.yylloc.range[1]++; - } - } - } - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) { - this.yylloc.range[1]++; - } - - this._input = this._input.slice(slice_len); - return ch; - }, - - // unshifts one char (or a string) into the input - unput: function lexer_unput(ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len); - //this.yyleng -= len; - this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); - this.match = this.match.substr(0, this.match.length - len); - this.matched = this.matched.substr(0, this.matched.length - len); - - if (lines.length - 1) { - this.yylineno -= lines.length - 1; - } - - this.yylloc.last_line = this.yylineno + 1; - this.yylloc.last_column = (lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len); - - if (this.options.ranges) { - this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng - len; - } - this.yyleng = this.yytext.length; - this.done = false; - return this; - }, - - // When called from action, caches matched text and appends it on next action - more: function lexer_more() { - this._more = true; - return this; - }, - - // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. - reject: function lexer_reject() { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - // when the parseError() call returns, we MUST ensure that the error is registered. - // We accomplish this by signaling an 'error' token to be produced for the current - // .lex() run. - var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), false); - this._signaled_error_token = (this.parseError(p.errStr, p) || this.ERROR); - } - return this; - }, - - // retain first n characters of the match - less: function lexer_less(n) { - return this.unput(this.match.slice(n)); - }, - - // return (part of the) already matched input, i.e. for error messages. - // Limit the returned string length to `maxSize` (default: 20). - // Limit the returned string to the `maxLines` number of lines of input (default: 1). - // Negative limit values equal *unlimited*. - pastInput: function lexer_pastInput(maxSize, maxLines) { - var past = this.matched.substring(0, this.matched.length - this.match.length); - if (maxSize < 0) - maxSize = past.length; - else if (!maxSize) - maxSize = 20; - if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! - else if (!maxLines) - maxLines = 1; - // `substr` anticipation: treat \r\n as a single character and take a little - // more than necessary so that we can still properly check against maxSize - // after we've transformed and limited the newLines in here: - past = past.substr(-maxSize * 2 - 2); - // now that we have a significantly reduced string to process, transform the newlines - // and chop them, then limit them: - var a = past.replace(/\r\n|\r/g, '\n').split('\n'); - a = a.slice(-maxLines); - past = a.join('\n'); - // When, after limiting to maxLines, we still have too much to return, - // do add an ellipsis prefix... - if (past.length > maxSize) { - past = '...' + past.substr(-maxSize); - } - return past; - }, - - // return (part of the) upcoming input, i.e. for error messages. - // Limit the returned string length to `maxSize` (default: 20). - // Limit the returned string to the `maxLines` number of lines of input (default: 1). - // Negative limit values equal *unlimited*. - upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { - var next = this.match; - if (maxSize < 0) - maxSize = next.length + this._input.length; - else if (!maxSize) - maxSize = 20; - if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! - else if (!maxLines) - maxLines = 1; - // `substring` anticipation: treat \r\n as a single character and take a little - // more than necessary so that we can still properly check against maxSize - // after we've transformed and limited the newLines in here: - if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 - } - // now that we have a significantly reduced string to process, transform the newlines - // and chop them, then limit them: - var a = next.replace(/\r\n|\r/g, '\n').split('\n'); - a = a.slice(0, maxLines); - next = a.join('\n'); - // When, after limiting to maxLines, we still have too much to return, - // do add an ellipsis postfix... - if (next.length > maxSize) { - next = next.substring(0, maxSize) + '...'; - } - return next; - }, - - // return a string which displays the character position where the lexing error occurred, i.e. for error messages - showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { - var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); - var c = new Array(pre.length + 1).join('-'); - return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; - }, - - // helper function, used to produce a human readable description as a string, given - // the input `yylloc` location object. - // Set `display_range_too` to TRUE to include the string character index position(s) - // in the description if the `yylloc.range` is available. - describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { - var l1 = yylloc.first_line; - var l2 = yylloc.last_line; - var o1 = yylloc.first_column; - var o2 = yylloc.last_column - 1; - var dl = l2 - l1; - var d_o = (dl === 0 ? o2 - o1 : 1000); - var rv; - if (dl === 0) { - rv = 'line ' + l1 + ', '; - if (d_o === 0) { - rv += 'column ' + o1; - } else { - rv += 'columns ' + o1 + ' .. ' + o2; - } - } else { - rv = 'lines ' + l1 + '(column ' + o1 + ') .. ' + l2 + '(column ' + o2 + ')'; - } - if (yylloc.range && display_range_too) { - var r1 = yylloc.range[0]; - var r2 = yylloc.range[1] - 1; - if (r2 === r1) { - rv += ' {String Offset: ' + r1 + '}'; - } else { - rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; - } - } - return rv; - // return JSON.stringify(yylloc); - }, - - // test the lexed token: return FALSE when not a match, otherwise return token. - // - // `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` - // contains the actually matched text string. - // - // Also move the input cursor forward and update the match collectors: - // - yytext - // - yyleng - // - match - // - matches - // - yylloc - // - offset - test_match: function lexer_test_match(match, indexed_rule) { - var token, - lines, - backup, - match_str; - - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } - } - - match_str = match[0]; - lines = match_str.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; - } - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : - this.yylloc.last_column + match_str.length - }; - this.yytext += match_str; - this.match += match_str; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset + this.yyleng]; - } - // previous lex rules MAY have invoked the `more()` API rather than producing a token: - // those rules will already have moved this `offset` forward matching their match lengths, - // hence we must only add our own match length now: - this.offset += match_str.length; - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match_str.length); - this.matched += match_str; - - // calling this method: - // - // function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) {...} - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */); - // otherwise, when the action codes are all simple return token statements: - //token = this.simpleCaseActionClusters[indexed_rule]; - - if (this.done && this._input) { - this.done = false; - } - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - this.__currentRuleSet__ = null; - return false; // rule action called reject() implying the next rule should be tested instead. - } else if (this._signaled_error_token) { - // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! - token = this._signaled_error_token; - this._signaled_error_token = false; - return token; - } - return false; - }, - - // return next match in input - next: function lexer_next() { - if (this.done) { - this.clear(); - return this.EOF; - } - if (!this._input) { - this.done = true; - } - - var token, - match, - tempMatch, - index; - if (!this._more) { - this.clear(); - } - var spec = this.__currentRuleSet__; - if (!spec) { - // Update the ruleset cache as we apparently encountered a state change or just started lexing. - // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will - // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps - // speed up those activities a tiny bit. - spec = this.__currentRuleSet__ = this._currentRules(); - } - - var rule_ids = spec.rules; -// var dispatch = spec.__dispatch_lut; - var regexes = spec.__rule_regexes; - var len = spec.__rule_count; - -// var c0 = this._input[0]; - - // Note: the arrays are 1-based, while `len` itself is a valid index, - // hence the non-standard less-or-equal check in the next loop condition! - // - // `dispatch` is a lookup table which lists the *first* rule which matches the 1-char *prefix* of the rule-to-match. - // By using that array as a jumpstart, we can cut down on the otherwise O(n*m) behaviour of this lexer, down to - // O(n) ideally, where: - // - // - N is the number of input particles -- which is not precisely characters - // as we progress on a per-regex-match basis rather than on a per-character basis - // - // - M is the number of rules (regexes) to test in the active condition state. - // - for (var i = 1 /* (dispatch[c0] || 1) */ ; i <= len; i++) { - tempMatch = this._input.match(regexes[i]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rule_ids[i]); - if (token !== false) { - return token; - } else if (this._backtrack) { - match = undefined; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } - } - if (match) { - token = this.test_match(match, rule_ids[index]); - if (token !== false) { - return token; - } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - if (this._input === '') { - this.done = true; - return this.EOF; - } else { - var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); - token = (this.parseError(p.errStr, p) || this.ERROR); - if (token === this.ERROR) { - // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward at least one character at a time: - if (!this.match.length) { - this.input(); - } - } - return token; - } - }, - - // return next match that has a token - lex: function lexer_lex() { - var r; - // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: - if (typeof this.options.pre_lex === 'function') { - r = this.options.pre_lex.call(this); - } - while (!r) { - r = this.next(); - } - if (typeof this.options.post_lex === 'function') { - // (also account for a userdef function which does not return any value: keep the token as is) - r = this.options.post_lex.call(this, r) || r; - } - return r; - }, - - // backwards compatible alias for `pushState()`; - // the latter is symmetrical with `popState()` and we advise to use - // those APIs in any modern lexer code, rather than `begin()`. - begin: function lexer_begin(condition) { - return this.pushState(condition); - }, - - // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) - pushState: function lexer_pushState(condition) { - this.conditionStack.push(condition); - this.__currentRuleSet__ = null; - return this; - }, - - // pop the previously active lexer condition state off the condition stack - popState: function lexer_popState() { - var n = this.conditionStack.length - 1; - if (n > 0) { - this.__currentRuleSet__ = null; - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } - }, - - // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available - topState: function lexer_topState(n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { - return this.conditionStack[n]; - } else { - return 'INITIAL'; - } - }, - - // (internal) determine the lexer rule set which is active for the currently active lexer condition state - _currentRules: function lexer__currentRules() { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; - } else { - return this.conditions['INITIAL']; - } - }, - - // return the number of states currently on the stack - stateStackSize: function lexer_stateStackSize() { - return this.conditionStack.length; - }, -options: { - easy_keyword_rules: true, - ranges: true, - xregexp: true -}, -JisonLexerError: JisonLexerError, -performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) { - -var YYSTATE = YY_START; -switch($avoiding_name_collisions) { -case 7 : -/*! Conditions:: action */ -/*! Rule:: \{ */ - yy.depth++; return 3; -break; -case 8 : -/*! Conditions:: action */ -/*! Rule:: \} */ - - if (yy.depth == 0) { - this.begin('trail'); - } else { - yy.depth--; - } - return 4; - -break; -case 10 : -/*! Conditions:: conditions */ -/*! Rule:: > */ - this.popState(); return 6; -break; -case 13 : -/*! Conditions:: rules */ -/*! Rule:: {BR}+ */ - /* empty */ -break; -case 14 : -/*! Conditions:: rules */ -/*! Rule:: {WS}+{BR}+ */ - /* empty */ -break; -case 15 : -/*! Conditions:: rules */ -/*! Rule:: {WS}+ */ - this.begin('indented'); -break; -case 16 : -/*! Conditions:: rules */ -/*! Rule:: %% */ - this.begin('code'); return 22; -break; -case 17 : -/*! Conditions:: rules */ -/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ */ - - // accept any non-regex, non-lex, non-string-delim, - // non-escape-starter, non-space character as-is - return 66; - -break; -case 20 : -/*! Conditions:: options */ -/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 71; -break; -case 21 : -/*! Conditions:: options */ -/*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 71; -break; -case 23 : -/*! Conditions:: options */ -/*! Rule:: {BR}+ */ - this.popState(); return 69; -break; -case 24 : -/*! Conditions:: options */ -/*! Rule:: {WS}+ */ - /* skip whitespace */ -break; -case 26 : -/*! Conditions:: start_condition */ -/*! Rule:: {BR}+ */ - this.popState(); -break; -case 27 : -/*! Conditions:: start_condition */ -/*! Rule:: {WS}+ */ - /* empty */ -break; -case 28 : -/*! Conditions:: trail */ -/*! Rule:: {WS}*{BR}+ */ - this.begin('rules'); -break; -case 29 : -/*! Conditions:: indented */ -/*! Rule:: \{ */ - yy.depth = 0; this.begin('action'); return 3; -break; -case 30 : -/*! Conditions:: indented */ -/*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 34; -break; -case 31 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %\{(.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 34; -break; -case 32 : -/*! Conditions:: indented */ -/*! Rule:: %include\b */ - - // This is an include instruction in place of an action: - // thanks to the `.+` rule immediately below we need to semi-duplicate - // the `%include` token recognition here vs. the almost-identical rule for the same - // further below. - // There's no real harm as we need to do something special in this case anyway: - // push 2 (two!) conditions. - // - // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar - // parse correctly took several hours as the debug facilities were - and are - too meager to - // quickly diagnose the problem while we hadn't. So the code got littered with debug prints - // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) - - // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... - this.pushState('trail'); - // then push the immediate need: the 'path' condition. - this.pushState('path'); - return 73; - -break; -case 33 : -/*! Conditions:: indented */ -/*! Rule:: .* */ - this.popState(); return 34; -break; -case 34 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - /* ignore */ -break; -case 35 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \/\/[^\r\n]* */ - /* ignore */ -break; -case 36 : -/*! Conditions:: INITIAL */ -/*! Rule:: {ID} */ - this.pushState('macro'); return 27; -break; -case 37 : -/*! Conditions:: macro */ -/*! Rule:: {BR}+ */ - this.popState('macro'); -break; -case 38 : -/*! Conditions:: macro */ -/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ */ - - // accept any non-regex, non-lex, non-string-delim, - // non-escape-starter, non-space character as-is - return 66; - -break; -case 39 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: {BR}+ */ - /* empty */ -break; -case 40 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 41 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 65; -break; -case 42 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 65; -break; -case 43 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \[ */ - this.pushState('set'); return 58; -break; -case 56 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: < */ - this.begin('conditions'); return 5; -break; -case 57 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \/! */ - return 51; // treated as `(?!atom)` -break; -case 58 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \/ */ - return 14; // treated as `(?=atom)` -break; -case 60 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 63; -break; -case 63 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %options\b */ - this.begin('options'); return 67; -break; -case 64 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %s\b */ - this.begin('start_condition'); return 29; -break; -case 65 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %x\b */ - this.begin('start_condition'); return 31; -break; -case 66 : -/*! Conditions:: INITIAL trail code */ -/*! Rule:: %include\b */ - this.pushState('path'); return 73; -break; -case 67 : -/*! Conditions:: INITIAL rules trail code */ -/*! Rule:: %{NAME}[^\r\n]+ */ - - /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - return 37; - -break; -case 68 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %% */ - this.begin('rules'); return 22; -break; -case 76 : -/*! Conditions:: set */ -/*! Rule:: \] */ - this.popState('set'); return 60; -break; -case 78 : -/*! Conditions:: code */ -/*! Rule:: [^\r\n]+ */ - return 76; // the bit of CODE just before EOF... -break; -case 79 : -/*! Conditions:: path */ -/*! Rule:: {BR} */ - this.popState(); this.unput(yy_.yytext); -break; -case 80 : -/*! Conditions:: path */ -/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; -break; -case 81 : -/*! Conditions:: path */ -/*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 74; -break; -case 82 : -/*! Conditions:: path */ -/*! Rule:: {WS}+ */ - // skip whitespace in the line -break; -case 83 : -/*! Conditions:: path */ -/*! Rule:: [^\s\r\n]+ */ - this.popState(); return 74; -break; -case 84 : -/*! Conditions:: * */ -/*! Rule:: . */ - - /* b0rk on bad characters */ - var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); - var l2 = 3; - var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); - throw new Error('unsupported lexer input: ', yy_.yytext, ' @ ' + this.describeYYLLOC(yy_.yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); - -break; -default: - return this.simpleCaseActionClusters[$avoiding_name_collisions]; -} -}, -simpleCaseActionClusters: { - - /*! Conditions:: action */ - /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 44, - /*! Conditions:: action */ - /*! Rule:: \/\/.* */ - 1 : 44, - /*! Conditions:: action */ - /*! Rule:: \/[^ /]*?['"{}][^ ]*?\/ */ - 2 : 44, - /*! Conditions:: action */ - /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 44, - /*! Conditions:: action */ - /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 44, - /*! Conditions:: action */ - /*! Rule:: [/"'][^{}/"']+ */ - 5 : 44, - /*! Conditions:: action */ - /*! Rule:: [^{}/"']+ */ - 6 : 44, - /*! Conditions:: conditions */ - /*! Rule:: {NAME} */ - 9 : 27, - /*! Conditions:: conditions */ - /*! Rule:: , */ - 11 : 8, - /*! Conditions:: conditions */ - /*! Rule:: \* */ - 12 : 7, - /*! Conditions:: options */ - /*! Rule:: {NAME} */ - 18 : 27, - /*! Conditions:: options */ - /*! Rule:: = */ - 19 : 18, - /*! Conditions:: options */ - /*! Rule:: [^\s\r\n]+ */ - 22 : 71, - /*! Conditions:: start_condition */ - /*! Rule:: {ID} */ - 25 : 38, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \| */ - 44 : 9, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \(\?: */ - 45 : 50, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \(\?= */ - 46 : 50, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \(\?! */ - 47 : 50, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \( */ - 48 : 10, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \) */ - 49 : 11, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \+ */ - 50 : 12, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \* */ - 51 : 7, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \? */ - 52 : 13, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \^ */ - 53 : 16, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: , */ - 54 : 8, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: <> */ - 55 : 17, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 63, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \$ */ - 61 : 17, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \. */ - 62 : 15, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 64, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \{{ID}\} */ - 70 : 57, - /*! Conditions:: set options */ - /*! Rule:: \{{ID}\} */ - 71 : 57, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \{ */ - 72 : 3, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \} */ - 73 : 4, - /*! Conditions:: set */ - /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 74 : 62, - /*! Conditions:: set */ - /*! Rule:: \{ */ - 75 : 62, - /*! Conditions:: code */ - /*! Rule:: [^\r\n]*(\r|\n)+ */ - 77 : 76, - /*! Conditions:: * */ - /*! Rule:: $ */ - 85 : 1 -}, -rules: [ -/^(?:\/\*(.|\n|\r)*?\*\/)/, -/^(?:\/\/.*)/, -/^(?:\/[^ \/]*?['"{}][^ ]*?\/)/, -/^(?:"(\\\\|\\"|[^"])*")/, -/^(?:'(\\\\|\\'|[^'])*')/, -/^(?:[\/"'][^{}\/"']+)/, -/^(?:[^{}\/"']+)/, -/^(?:\{)/, -/^(?:\})/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", ""), -/^(?:>)/, -/^(?:,)/, -/^(?:\*)/, -/^(?:(\r\n|\n|\r)+)/, -/^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, -/^(?:([^\S\n\r])+)/, -/^(?:%%)/, -/^(?:[^\s!"$%'-,.\/:-?\[-\^{-}]+)/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", ""), -/^(?:=)/, -/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, -/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, -/^(?:\S+)/, -/^(?:(\r\n|\n|\r)+)/, -/^(?:([^\S\n\r])+)/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), -/^(?:(\r\n|\n|\r)+)/, -/^(?:([^\S\n\r])+)/, -/^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, -/^(?:\{)/, -/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, -/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, -/^(?:%include\b)/, -/^(?:.*)/, -/^(?:\/\*(.|\n|\r)*?\*\/)/, -/^(?:\/\/[^\r\n]*)/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), -/^(?:(\r\n|\n|\r)+)/, -/^(?:[^\s!"$%'-,.\/:<-?\[-\^{-}]+)/, -/^(?:(\r\n|\n|\r)+)/, -/^(?:\s+)/, -/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, -/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, -/^(?:\[)/, -/^(?:\|)/, -/^(?:\(\?:)/, -/^(?:\(\?=)/, -/^(?:\(\?!)/, -/^(?:\()/, -/^(?:\))/, -/^(?:\+)/, -/^(?:\*)/, -/^(?:\?)/, -/^(?:\^)/, -/^(?:,)/, -/^(?:<>)/, -/^(?:<)/, -/^(?:\/!)/, -/^(?:\/)/, -/^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, -/^(?:\\.)/, -/^(?:\$)/, -/^(?:\.)/, -/^(?:%options\b)/, -/^(?:%s\b)/, -/^(?:%x\b)/, -/^(?:%include\b)/, -new XRegExp("^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)[^\\n\\r]+)", ""), -/^(?:%%)/, -/^(?:\{\d+(,\s?\d+|,)?\})/, -new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", ""), -new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", ""), -/^(?:\{)/, -/^(?:\})/, -/^(?:(?:\\\\|\\\]|[^\]{])+)/, -/^(?:\{)/, -/^(?:\])/, -/^(?:[^\r\n]*(\r|\n)+)/, -/^(?:[^\r\n]+)/, -/^(?:(\r\n|\n|\r))/, -/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, -/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, -/^(?:([^\S\n\r])+)/, -/^(?:\S+)/, -/^(?:.)/, -/^(?:$)/ -], -conditions: { - "code": { - rules: [ - 66, - 67, - 77, - 78, - 84, - 85 - ], - inclusive: false - }, - "start_condition": { - rules: [ - 25, - 26, - 27, - 84, - 85 - ], - inclusive: false - }, - "options": { - rules: [ - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 71, - 84, - 85 - ], - inclusive: false - }, - "conditions": { - rules: [ - 9, - 10, - 11, - 12, - 84, - 85 - ], - inclusive: false - }, - "action": { - rules: [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 84, - 85 - ], - inclusive: false - }, - "path": { - rules: [ - 79, - 80, - 81, - 82, - 83, - 84, - 85 - ], - inclusive: false - }, - "set": { - rules: [ - 71, - 74, - 75, - 76, - 84, - 85 - ], - inclusive: false - }, - "indented": { - rules: [ - 29, - 30, - 31, - 32, - 33, - 34, - 35, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 68, - 69, - 70, - 72, - 73, - 84, - 85 - ], - inclusive: true - }, - "trail": { - rules: [ - 28, - 31, - 34, - 35, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 72, - 73, - 84, - 85 - ], - inclusive: true - }, - "rules": { - rules: [ - 13, - 14, - 15, - 16, - 17, - 31, - 34, - 35, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 67, - 68, - 69, - 70, - 72, - 73, - 84, - 85 - ], - inclusive: true - }, - "macro": { - rules: [ - 31, - 34, - 35, - 37, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 68, - 69, - 70, - 72, - 73, - 84, - 85 - ], - inclusive: true - }, - "INITIAL": { - rules: [ - 31, - 34, - 35, - 36, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 72, - 73, - 84, - 85 - ], - inclusive: true - } -} -}; - -function indent(s, i) { - var a = s.split('\n'); - var pf = (new Array(i + 1)).join(' '); - return pf + a.join('\n' + pf); -}; -return lexer; -})(); -parser.lexer = lexer; - -function Parser() { - this.yy = {}; -} -Parser.prototype = parser; -parser.Parser = Parser; - -return new Parser(); -})(); - - - - -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { - exports.parser = lexParser; - exports.Parser = lexParser.Parser; - exports.parse = function () { - return lexParser.parse.apply(lexParser, arguments); - }; - -} From 920729b65e4552623aea3d436f7433a5aa504c83 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Jan 2017 20:49:25 +0100 Subject: [PATCH 247/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a2e1424..829b6d3 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-164", + "version": "0.1.4-165", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 0c8a8d643072115eb039e810f6947b04e9eedb21 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 30 Jan 2017 21:24:22 +0100 Subject: [PATCH 248/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 829b6d3..a734c36 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-165", + "version": "0.1.4-166", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From d551b33419a72622f952b29d12d062dc37f89f5a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 31 Jan 2017 11:40:21 +0100 Subject: [PATCH 249/417] fix SHA-1: 1af9bf33f050c85e107313b8f04f7382aff4860d * rebuilt library files --- lex-parser.js | 4405 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 4405 insertions(+) create mode 100644 lex-parser.js diff --git a/lex-parser.js b/lex-parser.js new file mode 100644 index 0000000..1849de9 --- /dev/null +++ b/lex-parser.js @@ -0,0 +1,4405 @@ +/* parser generated by jison 0.4.18-166 */ +/* + * Returns a Parser object of the following structure: + * + * Parser: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a derivative/copy of this one, + * not a direct reference! + * } + * + * Parser.prototype: { + * yy: {}, + * EOF: 1, + * TERROR: 2, + * + * trace: function(errorMessage, ...), + * + * JisonParserError: function(msg, hash), + * + * quoteName: function(name), + * Helper function which can be overridden by user code later on: put suitable + * quotes around literal IDs in a description string. + * + * originalQuoteName: function(name), + * The basic quoteName handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function + * at the end of the `parse()`. + * + * describeSymbol: function(symbol), + * Return a more-or-less human-readable description of the given symbol, when + * available, or the symbol itself, serving as its own 'description' for lack + * of something better to serve up. + * + * Return NULL when the symbol is unknown to the parser. + * + * symbols_: {associative list: name ==> number}, + * terminals_: {associative list: number ==> name}, + * nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}}, + * terminal_descriptions_: (if there are any) {associative list: number ==> description}, + * productions_: [...], + * + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack, ...), + * where `...` denotes the (optional) additional arguments the user passed to + * `parser.parse(str, ...)` and specified by way of `%parse-param ...` in the grammar file + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) + * to store/reference the rule value `$$` and location info `@$`. + * + * One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets + * to see the same object via the `this` reference, i.e. if you wish to carry custom + * data from one reduce action through to the next within a single parse run, then you + * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. + * + * - `yytext` : reference to the lexer value which belongs to the last lexer token used + * to match this rule. This is *not* the look-ahead token, but the last token + * that's actually part of this rule. + * + * Formulated another way, `yytext` is the value of the token immediately preceeding + * the current look-ahead token. + * Caveats apply for rules which don't require look-ahead, such as epsilon rules. + * + * - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value. + * + * - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value. + * + * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. + * + * - `yystate` : the current parser state number, used internally for dispatching and + * executing the action code chunk matching the rule currently being reduced. + * + * - `yysp` : the current state stack position (a.k.a. 'stack pointer') + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * Also note that you can access this and other stack index values using the new double-hash + * syntax, i.e. `##$ === ##0 === yysp`, while `##1` is the stack index for all things + * related to the first rule term, just like you have `$1`, `@1` and `#1`. + * This is made available to write very advanced grammar action rules, e.g. when you want + * to investigate the parse state stack in your action code, which would, for example, + * be relevant when you wish to implement error diagnostics and reporting schemes similar + * to the work described here: + * + * + Pottier, F., 2016. Reachability and error diagnosis in LR(1) automata. + * In Journées Francophones des Languages Applicatifs. + * + * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. + * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. + * + * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. + * constructs. + * + * - `yylstack`: reference to the parser token location stack. Also accessed via + * the `@1` etc. constructs. + * + * - `yystack` : reference to the parser token id stack. Also accessed via the + * `#1` etc. constructs. + * + * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to + * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might + * want access for your own purposes, such as error analysis as mentioned above! + * + * Note that this stack stores the current stack of *tokens*, that is the sequence of + * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* + * (lexer tokens *shifted* onto the stack until the rule they belong to is found and + * *reduced*. + * + * - `yysstack`: reference to the parser state stack. This one carries the internal parser + * *states* such as the one in `yystate`, which are used to represent + * the parser state machine in the *parse table*. *Very* *internal* stuff, + * what can I say? If you access this one, you're clearly doing wicked things + * + * - `...` : the extra arguments you specified in the `%parse-param` statement in your + * grammar definition file. + * + * table: [...], + * State transition table + * ---------------------- + * + * index levels are: + * - `state` --> hash table + * - `symbol` --> action (number or array) + * + * If the `action` is an array, these are the elements' meaning: + * - index [0]: 1 = shift, 2 = reduce, 3 = accept + * - index [1]: GOTO `state` + * + * If the `action` is a number, it is the GOTO `state` + * + * defaultActions: {...}, + * + * parseError: function(str, hash), + * yyErrOk: function(), + * yyClearIn: function(), + * + * constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this parser kernel in many places; example usage: + * + * var infoObj = parser.constructParseErrorInfo('fail!', null, + * parser.collect_expected_token_set(state), true); + * var retVal = parser.parseError(infoObj.errStr, infoObj); + * + * originalParseError: function(str, hash), + * The basic parseError handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function + * at the end of the `parse()`. + * + * options: { ... parser %options ... }, + * + * parse: function(input[, args...]), + * Parse the given `input` and return the parsed value (or `true` when none was provided by + * the root action, in which case the parser is acting as a *matcher*). + * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: + * these extra `args...` are passed verbatim to the grammar rules' action code. + * + * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown + * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY + * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and + * the internal parser gets properly garbage collected under these particular circumstances. + * + * lexer: { + * yy: {...}, A reference to the so-called "shared state" `yy` once + * received via a call to the `.setInput(input, yy)` lexer API. + * EOF: 1, + * ERROR: 2, + * JisonLexerError: function(msg, hash), + * parseError: function(str, hash), + * setInput: function(input, [yy]), + * input: function(), + * unput: function(str), + * more: function(), + * reject: function(), + * less: function(n), + * pastInput: function(n), + * upcomingInput: function(n), + * showPosition: function(), + * test_match: function(regex_match_array, rule_index), + * next: function(), + * lex: function(), + * begin: function(condition), + * pushState: function(condition), + * popState: function(), + * topState: function(), + * _currentRules: function(), + * stateStackSize: function(), + * + * options: { ... lexer %options ... }, + * + * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + * rules: [...], + * conditions: {associative list: name ==> set}, + * } + * } + * + * + * token location info (@$, _$, etc.): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The parseError function receives a 'hash' object with these members for lexer and + * parser errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * } + * + * parser (grammar) errors will also provide these additional members: + * + * { + * expected: (array describing the set of expected tokens; + * may be UNDEFINED when we cannot easily produce such a set) + * state: (integer (or array when the table includes grammar collisions); + * represents the current internal state of the parser kernel. + * can, for example, be used to pass to the `collect_expected_token_set()` + * API to obtain the expected token set) + * action: (integer; represents the current internal action which will be executed) + * new_state: (integer; represents the next/planned internal state, once the current + * action has executed) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, + * for instance, for advanced error analysis and reporting) + * value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used, + * for instance, for advanced error analysis and reporting) + * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, + * for instance, for advanced error analysis and reporting) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * parser: (reference to the current parser instance) + * } + * + * while `this` will reference the current parser instance. + * + * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * lexer: (reference to the current lexer instance which reported the error) + * } + * + * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired + * from either the parser or lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * exception: (reference to the exception thrown) + * } + * + * Please do note that in the latter situation, the `expected` field will be omitted as + * type of failure is assumed not to be due to *parse errors* but rather due to user + * action code in either parser or lexer failing unexpectedly. + * + * --- + * + * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + * These options are available: + * + * ### options which are global for all parser instances + * + * Parser.pre_parse: function(yy [, optional parse() args]) + * optional: you can specify a pre_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. + * Parser.post_parse: function(yy, retval [, optional parse() args]) { return retval; } + * optional: you can specify a post_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. When it does not return any value, + * the parser will return the original `retval`. + * + * ### options which can be set up per parser instance + * + * yy: { + * pre_parse: function(yy [, optional parse() args]) + * optional: is invoked before the parse cycle starts (and before the first + * invocation of `lex()`) but immediately after the invocation of + * `parser.pre_parse()`). + * post_parse: function(yy, retval [, optional parse() args]) { return retval; } + * optional: is invoked when the parse terminates due to success ('accept') + * or failure (even when exceptions are thrown). + * `retval` contains the return value to be produced by `Parser.parse()`; + * this function can override the return value by returning another. + * When it does not return any value, the parser will return the original + * `retval`. + * This function is invoked immediately before `Parser.post_parse()`. + * + * parseError: function(str, hash) + * optional: overrides the default `parseError` function. + * quoteName: function(name), + * optional: overrides the default `quoteName` function. + * } + * + * parser.lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ +var lexParser = (function () { + +// See also: +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 +// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility +// with userland code which might access the derived class in a 'classic' way. +function JisonParserError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonParserError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + + var stacktrace; + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = (new Error(msg)).stack; + } + } + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } +} + +if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonParserError.prototype, Error.prototype); +} else { + JisonParserError.prototype = Object.create(Error.prototype); +} +JisonParserError.prototype.constructor = JisonParserError; +JisonParserError.prototype.name = 'JisonParserError'; + + + + +// helper: reconstruct the productions[] table +function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); + } + return rv; +} + + + +// helper: reconstruct the defaultActions[] table +function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; +} + + + +// helper: reconstruct the 'goto' table +function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; + + case 0: + q[z] = a.shift(); + break; + + default: + // type === 1: accept + q[z] = [ + 3 + ]; + } + } + rv.push(q); + } + return rv; +} + + + +// helper: runlength encoding with increment step: code, length: step (default step = 0) +// `this` references an array +function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } +} + +// helper: duplicate sequence from *relative* offset and length. +// `this` references an array +function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } +} + +// helper: unpack an array using helpers and data, all passed in an array argument 'a'. +function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; +} + + +var parser = { +trace: function no_op_trace() { }, +JisonParserError: JisonParserError, +yy: {}, +options: { + type: "lalr", + errorRecoveryTokenDiscardCount: 3 +}, +symbols_: { + "$": 17, + "$accept": 0, + "$end": 1, + "%%": 19, + "(": 10, + ")": 11, + "*": 7, + "+": 12, + ",": 8, + ".": 15, + "/": 14, + "/!": 28, + "<": 5, + "=": 18, + ">": 6, + "?": 13, + "ACTION": 23, + "ACTION_BODY": 26, + "CHARACTER_LIT": 36, + "CODE": 42, + "EOF": 1, + "ESCAPE_CHAR": 33, + "INCLUDE": 40, + "NAME": 20, + "NAME_BRACE": 29, + "OPTIONS": 37, + "OPTIONS_END": 38, + "OPTION_VALUE": 39, + "PATH": 41, + "RANGE_REGEX": 34, + "REGEX_SET": 32, + "REGEX_SET_END": 31, + "REGEX_SET_START": 30, + "SPECIAL_GROUP": 27, + "START_COND": 25, + "START_EXC": 22, + "START_INC": 21, + "STRING_LIT": 35, + "UNKNOWN_DECL": 24, + "^": 16, + "action": 52, + "action_body": 54, + "action_comments_body": 55, + "any_group_regex": 64, + "definition": 47, + "definitions": 46, + "error": 2, + "escape_char": 67, + "extra_lexer_module_code": 73, + "include_macro_code": 74, + "init": 45, + "lex": 43, + "module_code_chunk": 75, + "name_expansion": 63, + "name_list": 57, + "names_exclusive": 49, + "names_inclusive": 48, + "nonempty_regex_list": 60, + "option": 72, + "option_list": 71, + "optional_module_code_chunk": 76, + "options": 70, + "range_regex": 68, + "regex": 58, + "regex_base": 62, + "regex_concat": 61, + "regex_list": 59, + "regex_set": 65, + "regex_set_atom": 66, + "rule": 51, + "rules": 50, + "rules_and_epilogue": 44, + "start_conditions": 56, + "string": 69, + "unbracketed_action_body": 53, + "{": 3, + "|": 9, + "}": 4 +}, +terminals_: { + 1: "EOF", + 2: "error", + 3: "{", + 4: "}", + 5: "<", + 6: ">", + 7: "*", + 8: ",", + 9: "|", + 10: "(", + 11: ")", + 12: "+", + 13: "?", + 14: "/", + 15: ".", + 16: "^", + 17: "$", + 18: "=", + 19: "%%", + 20: "NAME", + 21: "START_INC", + 22: "START_EXC", + 23: "ACTION", + 24: "UNKNOWN_DECL", + 25: "START_COND", + 26: "ACTION_BODY", + 27: "SPECIAL_GROUP", + 28: "/!", + 29: "NAME_BRACE", + 30: "REGEX_SET_START", + 31: "REGEX_SET_END", + 32: "REGEX_SET", + 33: "ESCAPE_CHAR", + 34: "RANGE_REGEX", + 35: "STRING_LIT", + 36: "CHARACTER_LIT", + 37: "OPTIONS", + 38: "OPTIONS_END", + 39: "OPTION_VALUE", + 40: "INCLUDE", + 41: "PATH", + 42: "CODE" +}, +TERROR: 2, +EOF: 1, + +// internals: defined here so the object *structure* doesn't get modified by parse() et al, +// thus helping JIT compilers like Chrome V8. +originalQuoteName: null, +originalParseError: null, +cleanupAfterParse: null, +constructParseErrorInfo: null, + +__reentrant_call_depth: 0, // INTERNAL USE ONLY +__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup + +// APIs which will be set up depending on user action code analysis: +//yyErrOk: 0, +//yyClearIn: 0, + +// Helper APIs +// ----------- + +// Helper function which can be overridden by user code later on: put suitable quotes around +// literal IDs in a description string. +quoteName: function parser_quoteName(id_str) { + return '"' + id_str + '"'; +}, + +// Return a more-or-less human-readable description of the given symbol, when available, +// or the symbol itself, serving as its own 'description' for lack of something better to serve up. +// +// Return NULL when the symbol is unknown to the parser. +describeSymbol: function parser_describeSymbol(symbol) { + if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { + return this.terminal_descriptions_[symbol]; + } + else if (symbol === this.EOF) { + return 'end of input'; + } + else if (this.terminals_[symbol]) { + return this.quoteName(this.terminals_[symbol]); + } + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. + // + // An example of this may be where a rule's action code contains a call like this: + // + // parser.describeSymbol(#$) + // + // to obtain a human-readable description or name of the current grammar rule. This comes handy in + // error handling action code blocks, for example. + var s = this.symbols_; + for (var key in s) { + if (s[key] === symbol) { + return key; + } + } + return null; +}, + +// Produce a (more or less) human-readable list of expected tokens at the point of failure. +// +// The produced list may contain token or token set descriptions instead of the tokens +// themselves to help turning this output into something that easier to read by humans +// unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*, +// expected terminals and nonterminals is produced. +// +// The returned list (array) will not contain any duplicate entries. +collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) { + var TERROR = this.TERROR; + var tokenset = []; + var check = {}; + // Has this (error?) state been outfitted with a custom expectations description text for human consumption? + // If so, use that one instead of the less palatable token set. + if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { + return [ + this.state_descriptions_[state] + ]; + } + for (var p in this.table[state]) { + p = +p; + if (p !== TERROR) { + var d = do_not_describe ? p : this.describeSymbol(p); + if (d && !check[d]) { + tokenset.push(d); + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + } + } + } + return tokenset; +}, +productions_: bp({ + pop: u([ + 43, + 44, + 44, + 45, + 46, + 46, + s, + [47, 8], + 48, + 48, + 49, + 49, + 50, + 50, + 51, + s, + [52, 3], + 53, + 53, + 54, + 54, + 55, + 55, + s, + [56, 3], + 57, + 57, + 58, + 59, + 59, + s, + [60, 3], + 61, + 61, + s, + [62, 15], + 63, + 64, + 65, + 65, + 66, + s, + [66, 4, 1], + 69, + 70, + 71, + 71, + s, + [72, 3], + 73, + 73, + 74, + 74, + 75, + 75, + 76, + 76 +]), + rule: u([ + 5, + 3, + 1, + 0, + 2, + 0, + s, + [2, 3], + 3, + s, + [1, 5], + 2, + 1, + 2, + 2, + 0, + 3, + c, + [12, 4], + 2, + 1, + 5, + 0, + 2, + 3, + 3, + 0, + 1, + c, + [13, 3], + 0, + 3, + c, + [24, 3], + 1, + 3, + 3, + s, + [2, 5], + c, + [10, 3], + s, + [1, 6], + c, + [21, 3], + c, + [9, 10], + c, + [52, 3], + c, + [31, 3], + c, + [28, 3], + 0 +]) +}), +performAction: function parser__PerformAction(yytext, yystate /* action[1] */, $0, yyvstack) { +/* this == yyval */ +var yy = this.yy; + +switch (yystate) { +case 1: + /*! Production:: lex : init definitions "%%" rules_and_epilogue EOF */ + this.$ = yyvstack[$0 - 1]; + if (yyvstack[$0 - 3][0]) this.$.macros = yyvstack[$0 - 3][0]; + if (yyvstack[$0 - 3][1]) this.$.startConditions = yyvstack[$0 - 3][1]; + if (yyvstack[$0 - 3][2]) this.$.unknownDecls = yyvstack[$0 - 3][2]; + // if there are any options, add them all, otherwise set options to NULL: + // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: + for (var k in yy.options) { + this.$.options = yy.options; + break; + } + if (yy.actionInclude) { + var asrc = yy.actionInclude.join('\n\n'); + // Only a non-empty action code chunk should actually make it through: + if (asrc.trim() !== '') { + this.$.actionInclude = asrc; + } + } + delete yy.options; + delete yy.actionInclude; + return this.$; + break; + +case 2: + /*! Production:: rules_and_epilogue : rules "%%" extra_lexer_module_code */ + if (yyvstack[$0] && yyvstack[$0].trim() !== '') { + this.$ = { rules: yyvstack[$0 - 2], moduleInclude: yyvstack[$0] }; + } else { + this.$ = { rules: yyvstack[$0 - 2] }; + } + break; + +case 3: + /*! Production:: rules_and_epilogue : rules */ + this.$ = { rules: yyvstack[$0] }; + break; + +case 4: + /*! Production:: init : ε */ + yy.actionInclude = []; + if (!yy.options) yy.options = {}; + break; + +case 5: + /*! Production:: definitions : definition definitions */ + this.$ = yyvstack[$0]; + if (yyvstack[$0 - 1] != null) { + if ('length' in yyvstack[$0 - 1]) { + this.$[0] = this.$[0] || {}; + this.$[0][yyvstack[$0 - 1][0]] = yyvstack[$0 - 1][1]; + } else if (yyvstack[$0 - 1].type === 'names') { + this.$[1] = this.$[1] || {}; + for (var name in yyvstack[$0 - 1].names) { + this.$[1][name] = yyvstack[$0 - 1].names[name]; + } + } else if (yyvstack[$0 - 1].type === 'unknown') { + this.$[2] = this.$[2] || []; + this.$[2].push(yyvstack[$0 - 1].body); + } + } + break; + +case 6: + /*! Production:: definitions : ε */ + this.$ = [null, null]; + break; + +case 7: + /*! Production:: definition : NAME regex */ + this.$ = [yyvstack[$0 - 1], yyvstack[$0]]; + break; + +case 8: + /*! Production:: definition : START_INC names_inclusive */ +case 9: + /*! Production:: definition : START_EXC names_exclusive */ +case 23: + /*! Production:: action : unbracketed_action_body */ +case 24: + /*! Production:: action : include_macro_code */ +case 27: + /*! Production:: action_body : action_comments_body */ +case 65: + /*! Production:: escape_char : ESCAPE_CHAR */ +case 66: + /*! Production:: range_regex : RANGE_REGEX */ +case 75: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ +case 79: + /*! Production:: module_code_chunk : CODE */ +case 81: + /*! Production:: optional_module_code_chunk : module_code_chunk */ + this.$ = yyvstack[$0]; + break; + +case 10: + /*! Production:: definition : "{" action_body "}" */ + yy.actionInclude.push(yyvstack[$0 - 1]); this.$ = null; + break; + +case 11: + /*! Production:: definition : ACTION */ +case 12: + /*! Production:: definition : include_macro_code */ + yy.actionInclude.push(yyvstack[$0]); this.$ = null; + break; + +case 13: + /*! Production:: definition : options */ + this.$ = null; + break; + +case 14: + /*! Production:: definition : UNKNOWN_DECL */ + this.$ = {type: 'unknown', body: yyvstack[$0]}; + break; + +case 15: + /*! Production:: names_inclusive : START_COND */ + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 0; + break; + +case 16: + /*! Production:: names_inclusive : names_inclusive START_COND */ + this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 0; + break; + +case 17: + /*! Production:: names_exclusive : START_COND */ + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 1; + break; + +case 18: + /*! Production:: names_exclusive : names_exclusive START_COND */ + this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 1; + break; + +case 19: + /*! Production:: rules : rules rule */ + this.$ = yyvstack[$0 - 1]; this.$.push(yyvstack[$0]); + break; + +case 20: + /*! Production:: rules : ε */ + this.$ = []; + break; + +case 21: + /*! Production:: rule : start_conditions regex action */ + this.$ = yyvstack[$0 - 2] ? [yyvstack[$0 - 2], yyvstack[$0 - 1], yyvstack[$0]] : [yyvstack[$0 - 1], yyvstack[$0]]; + break; + +case 22: + /*! Production:: action : "{" action_body "}" */ +case 31: + /*! Production:: start_conditions : "<" name_list ">" */ + this.$ = yyvstack[$0 - 1]; + break; + +case 26: + /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ + this.$ = yyvstack[$0 - 1] + '\n' + yyvstack[$0]; + break; + +case 28: + /*! Production:: action_body : action_body "{" action_body "}" action_comments_body */ + this.$ = yyvstack[$0 - 4] + yyvstack[$0 - 3] + yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; + break; + +case 29: + /*! Production:: action_comments_body : ε */ +case 38: + /*! Production:: regex_list : ε */ +case 82: + /*! Production:: optional_module_code_chunk : ε */ + this.$ = ''; + break; + +case 30: + /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ +case 42: + /*! Production:: regex_concat : regex_concat regex_base */ +case 52: + /*! Production:: regex_base : regex_base range_regex */ +case 61: + /*! Production:: regex_set : regex_set_atom regex_set */ +case 80: + /*! Production:: module_code_chunk : module_code_chunk CODE */ + this.$ = yyvstack[$0 - 1] + yyvstack[$0]; + break; + +case 32: + /*! Production:: start_conditions : "<" "*" ">" */ + this.$ = ['*']; + break; + +case 34: + /*! Production:: name_list : NAME */ + this.$ = [yyvstack[$0]]; + break; + +case 35: + /*! Production:: name_list : name_list "," NAME */ + this.$ = yyvstack[$0 - 2]; this.$.push(yyvstack[$0]); + break; + +case 36: + /*! Production:: regex : nonempty_regex_list */ + // Detect if the regex ends with a pure (Unicode) word; + // we *do* consider escaped characters which are 'alphanumeric' + // to be equivalent to their non-escaped version, hence these are + // all valid 'words' for the 'easy keyword rules' option: + // + // - hello_kitty + // - γεια_σου_γατοÏλα + // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 + // + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // + // As we only check the *tail*, we also accept these as + // 'easy keywords': + // + // - %options + // - %foo-bar + // - +++a:b:c1 + // + // Note the dash in that last example: there the code will consider + // `bar` to be the keyword, which is fine with us as we're only + // interested in the trailing boundary and patching that one for + // the `easy_keyword_rules` option. + this.$ = yyvstack[$0]; + if (yy.options.easy_keyword_rules) { + // We need to 'protect' `eval` here as keywords are allowed + // to contain double-quotes and other leading cruft. + // `eval` *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `eval(str)` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. + this.$ = this.$ + .replace(/\\\\/g, '.') + .replace(/"/g, '.') + .replace(/\\c[A-Z]/g, '.') + .replace(/\\[^xu0-9]/g, '.'); + + try { + this.$ = eval('"' + this.$ + '"'); + } + catch (ex) { + console.warn('easy-keyword-rule FAIL on eval: ', ex); + + // make the next keyword test fail: + this.$ = '.'; + } + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: + var re = XRegExp('\\w[\\w\\d]*$', 'u'); + if (XRegExp.match(this.$, re)) { + this.$ = yyvstack[$0] + "\\b"; + } else { + this.$ = yyvstack[$0]; + } + } + break; + +case 39: + /*! Production:: nonempty_regex_list : regex_concat "|" regex_list */ + this.$ = yyvstack[$0 - 2] + '|' + yyvstack[$0]; + break; + +case 40: + /*! Production:: nonempty_regex_list : "|" regex_list */ + this.$ = '|' + yyvstack[$0]; + break; + +case 44: + /*! Production:: regex_base : "(" regex_list ")" */ + this.$ = '(' + yyvstack[$0 - 1] + ')'; + break; + +case 45: + /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ + this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + ')'; + break; + +case 46: + /*! Production:: regex_base : regex_base "+" */ + this.$ = yyvstack[$0 - 1] + '+'; + break; + +case 47: + /*! Production:: regex_base : regex_base "*" */ + this.$ = yyvstack[$0 - 1] + '*'; + break; + +case 48: + /*! Production:: regex_base : regex_base "?" */ + this.$ = yyvstack[$0 - 1] + '?'; + break; + +case 49: + /*! Production:: regex_base : "/" regex_base */ + this.$ = '(?=' + yyvstack[$0] + ')'; + break; + +case 50: + /*! Production:: regex_base : "/!" regex_base */ + this.$ = '(?!' + yyvstack[$0] + ')'; + break; + +case 54: + /*! Production:: regex_base : "." */ + this.$ = '.'; + break; + +case 55: + /*! Production:: regex_base : "^" */ + this.$ = '^'; + break; + +case 56: + /*! Production:: regex_base : "$" */ + this.$ = '$'; + break; + +case 60: + /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ +case 76: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ + this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; + break; + +case 64: + /*! Production:: regex_set_atom : name_expansion */ + if (XRegExp._getUnicodeProperty(yyvstack[$0].replace(/[{}]/g, '')) + && yyvstack[$0].toUpperCase() !== yyvstack[$0] + ) { + // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories + this.$ = yyvstack[$0]; + } else { + this.$ = yyvstack[$0]; + } + //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + break; + +case 67: + /*! Production:: string : STRING_LIT */ + this.$ = prepareString(yyvstack[$0].substr(1, yyvstack[$0].length - 2)); + break; + +case 72: + /*! Production:: option : NAME */ + yy.options[yyvstack[$0]] = true; + break; + +case 73: + /*! Production:: option : NAME "=" OPTION_VALUE */ +case 74: + /*! Production:: option : NAME "=" NAME */ + yy.options[yyvstack[$0 - 2]] = yyvstack[$0]; + break; + +case 77: + /*! Production:: include_macro_code : INCLUDE PATH */ + var fs = require('fs'); + var fileContent = fs.readFileSync(yyvstack[$0], { encoding: 'utf-8' }); + // And no, we don't support nested '%include': + this.$ = '\n// Included by Jison: ' + yyvstack[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[$0] + '\n\n'; + break; + +case 78: + /*! Production:: include_macro_code : INCLUDE error */ + console.error("%include MUST be followed by a valid file path"); + break; + +} +}, +table: bt({ + len: u([ + 11, + 1, + 13, + 1, + 13, + 21, + 2, + 2, + 5, + s, + [9, 4], + 2, + 3, + 18, + 1, + 9, + 9, + 28, + 31, + 28, + 22, + 22, + 17, + 17, + s, + [27, 7], + 29, + 5, + s, + [27, 3], + s, + [10, 4], + 2, + 3, + 25, + 25, + 1, + 4, + 3, + 1, + 18, + 31, + 28, + 10, + 10, + s, + [27, 5], + 1, + 1, + 28, + 28, + 1, + 6, + 3, + 3, + 10, + 10, + 9, + 5, + 3, + 9, + 1, + 2, + 1, + 6, + 16, + 21, + 3, + c, + [27, 4], + 1, + s, + [2, 3], + 1, + s, + [3, 3], + 6, + 2, + 1, + 2, + 4, + 6, + 3, + 16, + 5, + 17, + 16, + 17, + c, + [103, 3], + 3, + 1, + 2, + 17, + 2, + 16 +]), + symbol: u([ + 3, + s, + [19, 6, 1], + 37, + 40, + 43, + 45, + 1, + c, + [12, 9], + 46, + 47, + 70, + 74, + 19, + c, + [14, 13], + 9, + 10, + s, + [14, 4, 1], + s, + [27, 4, 1], + 33, + 35, + 36, + 58, + s, + [60, 5, 1], + 67, + 69, + 25, + 48, + 25, + 49, + 3, + 4, + 26, + 54, + 55, + c, + [43, 9], + c, + [9, 27], + 2, + 41, + 20, + 71, + 72, + 1, + 5, + c, + [73, 6], + 19, + c, + [74, 7], + 44, + 50, + c, + [103, 10], + c, + [9, 10], + 9, + 10, + 11, + c, + [37, 5], + c, + [16, 5], + c, + [42, 7], + 37, + 40, + c, + [115, 5], + c, + [28, 23], + s, + [59, 6, 1], + c, + [31, 3], + 7, + s, + [9, 9, 1], + c, + [34, 11], + s, + [34, 4, 1], + 40, + 68, + c, + [58, 7], + c, + [52, 7], + c, + [50, 8], + c, + [22, 22], + c, + [238, 12], + c, + [17, 22], + c, + [106, 27], + c, + [27, 183], + s, + [31, 7, 1], + 40, + 29, + 32, + 63, + 65, + 66, + c, + [115, 82], + s, + [19, 7, 1], + c, + [10, 33], + 4, + c, + [594, 3], + 1, + 3, + c, + [552, 8], + c, + [487, 14], + 42, + c, + [25, 25], + 38, + 20, + 38, + 71, + 72, + 18, + 20, + 38, + 1, + c, + [610, 16], + 51, + 56, + c, + [563, 59], + 3, + 11, + c, + [660, 9], + c, + [10, 10], + c, + [451, 134], + 11, + 11, + c, + [185, 29], + c, + [28, 27], + 31, + 29, + 31, + c, + [482, 4], + c, + [6, 3], + c, + [3, 3], + c, + [397, 27], + c, + [396, 4], + c, + [988, 4], + 4, + 26, + c, + [17, 9], + 38, + 20, + 39, + 1, + 1, + 40, + 42, + 73, + 75, + 76, + c, + [359, 16], + c, + [1056, 21], + 7, + 20, + 57, + c, + [312, 91], + 31, + 3, + 4, + 20, + c, + [503, 3], + c, + [145, 3], + 74, + c, + [148, 3], + c, + [3, 3], + 3, + 23, + 40, + 52, + 53, + 74, + 6, + 8, + 6, + 6, + 8, + c, + [181, 3], + 55, + c, + [169, 7], + c, + [27, 3], + c, + [172, 15], + c, + [215, 5], + c, + [21, 9], + 23, + c, + [22, 7], + c, + [38, 16], + c, + [33, 17], + c, + [227, 13], + 20, + c, + [14, 13], + c, + [691, 5], + 4, + c, + [50, 17], + 6, + 8, + c, + [85, 16] +]), + type: u([ + s, + [2, 9], + 0, + 0, + 1, + c, + [12, 11], + 0, + 0, + s, + [2, 10], + c, + [14, 14], + c, + [17, 7], + c, + [21, 5], + 0, + 2, + c, + [25, 4], + c, + [30, 15], + s, + [2, 26], + c, + [41, 18], + c, + [59, 41], + c, + [118, 8], + c, + [28, 28], + c, + [31, 26], + c, + [35, 5], + c, + [50, 36], + c, + [22, 20], + c, + [17, 34], + s, + [2, 208], + c, + [223, 182], + c, + [181, 22], + c, + [563, 75], + c, + [267, 171], + c, + [28, 32], + c, + [482, 41], + c, + [40, 21], + c, + [62, 32], + c, + [347, 10], + c, + [322, 102], + c, + [102, 10], + c, + [154, 11], + c, + [1178, 6], + c, + [129, 23], + c, + [737, 120] +]), + state: u([ + s, + [1, 4, 1], + 11, + 10, + 16, + c, + [4, 3], + 17, + 18, + 19, + 21, + 26, + 27, + 32, + 31, + 38, + 40, + 42, + 43, + 46, + 47, + 49, + 50, + 52, + c, + [13, 4], + 53, + 54, + c, + [21, 6], + 58, + 60, + c, + [9, 7], + 61, + c, + [8, 7], + 62, + c, + [5, 4], + 63, + c, + [5, 4], + 67, + 64, + 65, + 74, + 47, + 78, + 79, + 81, + c, + [42, 8], + 58, + 58, + 67, + 85, + 65, + 86, + 43, + 89, + 91, + 90, + 93, + c, + [82, 7], + 94, + 98, + 100, + 102, + 103, + 108, + 109, + 91, + 90, + 110, + 43 +]), + mode: u([ + s, + [2, 9], + 1, + 2, + s, + [1, 9], + c, + [10, 10], + s, + [1, 13], + s, + [2, 39], + c, + [42, 39], + c, + [103, 7], + c, + [52, 9], + c, + [13, 7], + c, + [23, 24], + c, + [27, 6], + c, + [67, 15], + c, + [72, 11], + c, + [189, 32], + c, + [202, 52], + s, + [2, 179], + c, + [220, 90], + c, + [89, 20], + c, + [20, 13], + c, + [123, 4], + c, + [126, 51], + c, + [434, 4], + c, + [638, 5], + c, + [83, 15], + c, + [521, 49], + c, + [406, 158], + c, + [184, 27], + c, + [732, 30], + c, + [517, 56], + c, + [57, 17], + c, + [772, 107], + c, + [439, 9], + c, + [221, 8], + c, + [113, 11], + c, + [121, 32], + c, + [153, 54], + c, + [319, 18], + c, + [226, 37] +]), + goto: u([ + s, + [4, 9], + 8, + 6, + 5, + 6, + 7, + 9, + 12, + 14, + 13, + 15, + c, + [10, 9], + 20, + 22, + 24, + 28, + 29, + 30, + 23, + 25, + 33, + 34, + 37, + 35, + 36, + 39, + 41, + s, + [29, 3], + s, + [11, 9], + s, + [12, 9], + s, + [13, 9], + s, + [14, 9], + 45, + 44, + 48, + s, + [20, 16], + 5, + s, + [7, 9], + s, + [36, 9], + 41, + 51, + 22, + 41, + c, + [94, 4], + s, + [41, 6], + c, + [100, 7], + 41, + 41, + 38, + 20, + 22, + 38, + c, + [23, 4], + s, + [38, 6], + c, + [23, 7], + 38, + 38, + 43, + 56, + s, + [43, 3], + 55, + 57, + s, + [43, 15], + 59, + s, + [43, 4], + c, + [49, 7], + c, + [43, 7], + c, + [14, 14], + c, + [192, 12], + c, + [12, 12], + s, + [51, 27], + s, + [53, 27], + s, + [54, 27], + s, + [55, 27], + s, + [56, 27], + s, + [57, 27], + s, + [58, 27], + s, + [59, 29], + 33, + 66, + s, + [67, 27], + s, + [68, 27], + s, + [65, 27], + s, + [8, 7], + 68, + 8, + 8, + s, + [15, 10], + s, + [9, 7], + 69, + 9, + 9, + s, + [17, 10], + 71, + 70, + 27, + 27, + 72, + s, + [77, 25], + s, + [78, 25], + 73, + 48, + 71, + 75, + 72, + 72, + 76, + 3, + 80, + s, + [33, 6], + 77, + s, + [33, 7], + c, + [521, 23], + 42, + 56, + s, + [42, 3], + 55, + 57, + s, + [42, 15], + 59, + s, + [42, 4], + s, + [40, 10], + s, + [37, 10], + s, + [46, 27], + s, + [47, 27], + s, + [48, 27], + s, + [52, 27], + s, + [66, 27], + 82, + 83, + 49, + 56, + s, + [49, 3], + 55, + 57, + s, + [49, 15], + 59, + s, + [49, 4], + 50, + 56, + s, + [50, 3], + 55, + 57, + s, + [50, 15], + 59, + s, + [50, 4], + 84, + 33, + 62, + 66, + s, + [63, 3], + s, + [64, 3], + s, + [16, 10], + s, + [18, 10], + s, + [10, 9], + s, + [29, 3], + s, + [30, 3], + s, + [69, 9], + 70, + 88, + 87, + 1, + 82, + 82, + 92, + s, + [19, 16], + c, + [974, 13], + 95, + 96, + s, + [39, 10], + s, + [44, 27], + s, + [45, 27], + s, + [60, 27], + 61, + 71, + 97, + 73, + 73, + 74, + 74, + 2, + 75, + 13, + 81, + 81, + 99, + s, + [79, 3], + 101, + 104, + 13, + 105, + 106, + 107, + 34, + 34, + s, + [29, 3], + c, + [152, 3], + s, + [80, 3], + s, + [21, 16], + s, + [29, 3], + s, + [23, 9], + 111, + s, + [23, 7], + s, + [24, 16], + s, + [25, 17], + s, + [31, 13], + 112, + s, + [32, 13], + 28, + 28, + 72, + 76, + 71, + 113, + s, + [26, 17], + 35, + 35, + s, + [22, 16] +]) +}), +defaultActions: bda({ + idx: u([ + 0, + s, + [8, 5, 1], + s, + [15, 4, 1], + s, + [26, 8, 1], + 35, + 36, + 37, + 39, + 41, + 44, + 45, + s, + [53, 7, 1], + s, + [66, 9, 1], + 76, + 78, + s, + [81, 5, 1], + 87, + 88, + 89, + 92, + 96, + 97, + 99, + 100, + 101, + 103, + 104, + s, + [105, 4, 2], + 112, + 113 +]), + goto: u([ + 4, + 29, + s, + [11, 4, 1], + 20, + 5, + 7, + 36, + 51, + s, + [53, 7, 1], + 67, + 68, + 65, + 15, + 17, + 77, + 78, + 40, + 37, + 46, + 47, + 48, + 52, + 66, + 63, + 64, + 16, + 18, + 10, + 29, + 30, + 69, + 70, + 1, + 19, + 39, + 44, + 45, + 60, + 61, + 73, + 74, + 2, + 79, + 34, + 29, + 80, + 21, + 29, + 24, + 25, + 31, + 32, + 76, + 26, + 35, + 22 +]) +}), +parseError: function parseError(str, hash) { + if (hash.recoverable) { + this.trace(str); + hash.destroy(); // destroy... well, *almost*! + } else { + throw new this.JisonParserError(str, hash); + } +}, +parse: function parse(input) { + var self = this, + stack = new Array(128), // token stack: stores token which leads to state at the same index (column storage) + sstack = new Array(128), // state stack: stores states (column storage) + + vstack = new Array(128), // semantic value stack + + table = this.table, + sp = 0; // 'stack pointer': index into the stacks + + var recovering = 0; // (only used when the grammar contains error recovery rules) + var TERROR = this.TERROR, + EOF = this.EOF, + ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; + var NO_ACTION = [0, table.length /* ensures that anyone using this new state will fail dramatically! */]; + + //this.reductionCount = this.shiftCount = 0; + + var lexer; + if (this.__lexer__) { + lexer = this.__lexer__; + } else { + lexer = this.__lexer__ = Object.create(this.lexer); + } + + var sharedState_yy = { + parseError: null, + quoteName: null, + lexer: null, + parser: null, + pre_parse: null, + post_parse: null + }; + // copy state + for (var k in this.yy) { + if (Object.prototype.hasOwnProperty.call(this.yy, k)) { + sharedState_yy[k] = this.yy[k]; + } + } + + sharedState_yy.lexer = lexer; + sharedState_yy.parser = this; + + + + + + + lexer.setInput(input, sharedState_yy); + + + + + + + vstack[sp] = null; + sstack[sp] = 0; + stack[sp] = 0; + ++sp; + + if (typeof lexer.yytext === 'undefined') { + lexer.yytext = ''; + } + var yytext = lexer.yytext; + if (typeof lexer.yylineno === 'undefined') { + lexer.yylineno = 0; + } + + + // Does the shared state override the default `parseError` that already comes with this instance? + if (typeof sharedState_yy.parseError === 'function') { + this.parseError = sharedState_yy.parseError; + } else { + this.parseError = this.originalParseError; + } + + // Does the shared state override the default `quoteName` that already comes with this instance? + if (typeof sharedState_yy.quoteName === 'function') { + this.quoteName = sharedState_yy.quoteName; + } else { + this.quoteName = this.originalQuoteName; + } + + // set up the cleanup function; make it an API so that external code can re-use this one in case of + // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which + // case this parse() API method doesn't come with a `finally { ... }` block any more! + // + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `sharedState`, etc. references will be *wrong*! + this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) { + var rv; + + if (invoke_post_methods) { + if (sharedState_yy.post_parse) { + rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue); + if (typeof rv !== 'undefined') resultValue = rv; + } + if (this.post_parse) { + rv = this.post_parse.call(this, sharedState_yy, resultValue); + if (typeof rv !== 'undefined') resultValue = rv; + } + } + + if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. + + // clean up the lingering lexer structures as well: + if (lexer.cleanupAfterLex) { + lexer.cleanupAfterLex(do_not_nuke_errorinfos); + } + + // prevent lingering circular references from causing memory leaks: + if (sharedState_yy) { + sharedState_yy.parseError = undefined; + sharedState_yy.quoteName = undefined; + sharedState_yy.lexer = undefined; + sharedState_yy.parser = undefined; + if (lexer.yy === sharedState_yy) { + lexer.yy = undefined; + } + } + sharedState_yy = undefined; + this.parseError = this.originalParseError; + this.quoteName = this.originalQuoteName; + + // nuke the vstack[] array at least as that one will still reference obsoleted user values. + // To be safe, we nuke the other internal stack columns as well... + stack.length = 0; // fastest way to nuke an array without overly bothering the GC + sstack.length = 0; + + vstack.length = 0; + stack_pointer = 0; + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_infos.length = 0; + } + + return resultValue; + }; + + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `lexer`, `sharedState`, etc. references will be *wrong*! + this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { + var pei = { + errStr: msg, + exception: ex, + text: lexer.match, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, + token_id: symbol, + line: lexer.yylineno, + + expected: expected, + recoverable: recoverable, + state: state, + action: action, + new_state: newState, + symbol_stack: stack, + state_stack: sstack, + value_stack: vstack, + + stack_pointer: sp, + yy: sharedState_yy, + lexer: lexer, + parser: this, + + // and make sure the error info doesn't stay due to potential + // ref cycle via userland code manipulations. + // These would otherwise all be memory leak opportunities! + // + // Note that only array and object references are nuked as those + // constitute the set of elements which can produce a cyclic ref. + // The rest of the members is kept intact as they are harmless. + destroy: function destructParseErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // info.value = null; + // info.value_stack = null; + // ... + var rec = !!this.recoverable; + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; + } + } + this.recoverable = rec; + } + }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + return pei; + }; + + + function lex() { + var token = lexer.lex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + return token || EOF; + } + + + var symbol = 0; + var preErrorSymbol = 0; + var lastEofErrorStateDepth = 0; + var state, action, r, t; + var yyval = { + $: true, + _$: undefined, + yy: sharedState_yy + }; + var p, len, this_production; + + var newState; + var retval = false; + + + // Return the rule stack depth where the nearest error rule can be found. + // Return -1 when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = sp - 1; + var depth = 0; + + // try to recover from error + for (;;) { + // check for error recovery rule in this state + + var t = table[state][TERROR] || NO_ACTION; + if (t[0]) { + // We need to make sure we're not cycling forever: + // once we hit EOF, even when we `yyerrok()` an error, we must + // prevent the core from running forever, + // e.g. when parent rules are still expecting certain input to + // follow after this, for example when you handle an error inside a set + // of braces which are matched by a parent rule in your grammar. + // + // Hence we require that every error handling/recovery attempt + // *after we've hit EOF* has a diminishing state stack: this means + // we will ultimately have unwound the state stack entirely and thus + // terminate the parse in a controlled fashion even when we have + // very complex error/recovery code interplay in the core + user + // action code blocks: + + if (symbol === EOF) { + if (!lastEofErrorStateDepth) { + lastEofErrorStateDepth = sp - 1 - depth; + } else if (lastEofErrorStateDepth <= sp - 1 - depth) { + + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + continue; + } + } + return depth; + } + if (state === 0 /* $accept rule */ || stack_probe < 1) { + + return -1; // No suitable error recovery rule available. + } + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + } + } + + + try { + this.__reentrant_call_depth++; + + if (this.pre_parse) { + this.pre_parse.call(this, sharedState_yy); + } + if (sharedState_yy.pre_parse) { + sharedState_yy.pre_parse.call(this, sharedState_yy); + } + + newState = sstack[sp - 1]; + for (;;) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // The single `==` condition below covers both these `===` comparisons in a single + // operation: + // + // if (symbol === null || typeof symbol === 'undefined') ... + if (!symbol) { + symbol = lex(); + } + // read action for current state and first input + t = (table[state] && table[state][symbol]) || NO_ACTION; + newState = t[1]; + action = t[0]; + + + + + // handle parse error + if (!action) { + // first see if there's any chance at hitting an error recovery rule: + var error_rule_depth = locateNearestErrorRecoveryRule(state); + var errStr = null; + var errSymbolDescr = (this.describeSymbol(symbol) || symbol); + var expected = this.collect_expected_token_set(state); + + if (!recovering) { + // Report error + if (lexer.showPosition) { + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ':\n' + lexer.showPosition(79 - 10, 10) + '\n'; + } else { + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; + } + if (expected.length) { + errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; + } else { + errStr += 'Unexpected ' + errSymbolDescr; + } + p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0)); + r = this.parseError(p.errStr, p); + + + if (!p.recoverable) { + retval = r; + break; + } else { + // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process... + } + } + + + + // just recovered from another error + if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { + // only barf a fatal hairball when we're out of look-ahead symbols and none hit a match; + // this DOES discard look-ahead while recovering from an error when said look-ahead doesn't + // suit the error recovery rules... The error HAS been reported already so we're fine with + // throwing away a few items if that is what it takes to match the nearest recovery rule! + if (symbol === EOF || preErrorSymbol === EOF) { + p = this.constructParseErrorInfo((errStr || 'Parsing halted while starting to recover from another error.'), null, expected, false); + retval = this.parseError(p.errStr, p); + break; + } + + // discard current lookahead and grab another + + yytext = lexer.yytext; + + + + symbol = lex(); + + + } + + // try to recover from error + if (error_rule_depth < 0) { + p = this.constructParseErrorInfo((errStr || 'Parsing halted. No suitable error recovery rule available.'), null, expected, false); + retval = this.parseError(p.errStr, p); + break; + } + sp -= error_rule_depth; + + preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + // allow N (default: 3) real symbols to be shifted before reporting a new error + recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; + + newState = sstack[sp - 1]; + + + + continue; + } + + + } + + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo(('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol), null, null, false); + retval = this.parseError(p.errStr, p); + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p); + break; + + // shift: + case 1: + //this.shiftCount++; + stack[sp] = symbol; + vstack[sp] = lexer.yytext; + + sstack[sp] = newState; // push state + ++sp; + symbol = 0; + if (!preErrorSymbol) { // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + yytext = lexer.yytext; + + + + if (recovering > 0) { + recovering--; + + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + // read action for current state and first input + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + symbol = 0; + } + } + + continue; + + // reduce: + case 2: + //this.reductionCount++; + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + len = this_production[1]; + + + + + + + // Make sure subsequent `$$ = $1` default action doesn't fail + // for rules where len==0 as then there's no $1 (you're reducing an epsilon rule then!) + // + // Also do this to prevent nasty action block codes to *read* `$0` or `$$` + // and *not* get `undefined` as a result for their efforts! + vstack[sp] = undefined; + + // perform semantic action + yyval.$ = vstack[sp - len]; // default to $$ = $1; result must produce `undefined` when len == 0, as then there's no $1 + + + + + + + + + + + r = this.performAction.call(yyval, yytext, newState, sp - 1, vstack); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= len; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + if (typeof yyval.$ !== 'undefined') { + retval = yyval.$; + } + break; + } + + // break out of loop: we accept or fail with error + break; + } + } catch (ex) { + // report exceptions through the parseError callback too: + p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); + retval = this.parseError(p.errStr, p); + } finally { + retval = this.cleanupAfterParse(retval, true, true); + this.__reentrant_call_depth--; + } + + return retval; +} +}; +parser.originalParseError = parser.parseError; +parser.originalQuoteName = parser.quoteName; + +var XRegExp = require('xregexp'); // for helping out the `%options xregexp` in the lexer + +function encodeRE (s) { + return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); +} + +function prepareString (s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; +}; +/* generated by jison-lex 0.3.4-166 */ +var lexer = (function () { +// See also: +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 +// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility +// with userland code which might access the derived class in a 'classic' way. +function JisonLexerError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonLexerError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + + var stacktrace; + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = (new Error(msg)).stack; + } + } + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } +} + +if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); +} else { + JisonLexerError.prototype = Object.create(Error.prototype); +} +JisonLexerError.prototype.constructor = JisonLexerError; +JisonLexerError.prototype.name = 'JisonLexerError'; + + +var lexer = { + EOF: 1, + ERROR: 2, + + // JisonLexerError: JisonLexerError, // <-- injected by the code generator + + // options: {}, // <-- injected by the code generator + + // yy: ..., // <-- injected by setInput() + + __currentRuleSet__: null, // <-- internal rule set cache for the current lexer state + + __error_infos: [], // INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + + __decompressed: false, // INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + + done: false, // INTERNAL USE ONLY + _backtrack: false, // INTERNAL USE ONLY + _input: '', // INTERNAL USE ONLY + _more: false, // INTERNAL USE ONLY + _signaled_error_token: false, // INTERNAL USE ONLY + + conditionStack: [], // INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + + match: '', // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', // ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + + // INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + var pei = { + errStr: msg, + recoverable: !!recoverable, + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + token: null, + line: this.yylineno, + loc: this.yylloc, + yy: this.yy, + lexer: this, + + // and make sure the error info doesn't stay due to potential + // ref cycle via userland code manipulations. + // These would otherwise all be memory leak opportunities! + // + // Note that only array and object references are nuked as those + // constitute the set of elements which can produce a cyclic ref. + // The rest of the members is kept intact as they are harmless. + destroy: function destructLexErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // ... + var rec = !!this.recoverable; + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; + } + } + this.recoverable = rec; + } + }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + return pei; + }, + + parseError: function lexer_parseError(str, hash) { + if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { + return this.yy.parser.parseError(str, hash) || this.ERROR; + } else if (typeof this.yy.parseError === 'function') { + return this.yy.parseError.call(this, str, hash) || this.ERROR; + } else { + throw new this.JisonLexerError(str); + } + }, + + // final cleanup function for when we have completed lexing the input; + // make it an API so that external code can use this one once userland + // code has decided it's time to destroy any lingering lexer error + // hash object instances and the like: this function helps to clean + // up these constructs, which *may* carry cyclic references which would + // otherwise prevent the instances from being properly and timely + // garbage-collected, i.e. this function helps prevent memory leaks! + cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + var rv; + + // prevent lingering circular references from causing memory leaks: + this.setInput('', {}); + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_infos.length = 0; + } + + return this; + }, + + // clear the lexer token context; intended for internal use only + clear: function lexer_clear() { + this.yytext = ''; + this.yyleng = 0; + this.match = ''; + this.matches = false; + this._more = false; + this._backtrack = false; + }, + + // resets the lexer, sets new input + setInput: function lexer_setInput(input, yy) { + this.yy = yy || this.yy || {}; + + // also check if we've fully initialized the lexer instance, + // including expansion work to be done to go from a loaded + // lexer to a usable lexer: + if (!this.__decompressed) { + // step 1: decompress the regex list: + var rules = this.rules; + for (var i = 0, len = rules.length; i < len; i++) { + var rule_re = rules[i]; + + // compression: is the RE an xref to another RE slot in the rules[] table? + if (typeof rule_re === 'number') { + rules[i] = rules[rule_re]; + } + } + + // step 2: unfold the conditions[] set to make these ready for use: + var conditions = this.conditions; + for (var k in conditions) { + var spec = conditions[k]; + + var rule_ids = spec.rules; + + var len = rule_ids.length; + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_new_ids = new Array(len + 1); + + if (this.rules_prefix1) { + var rule_prefixes = new Array(65536); + var first_catch_all_index = 0; + + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; + + var prefix = this.rules_prefix1[idx]; + // compression: is the PREFIX-STRING an xref to another PREFIX-STRING slot in the rules_prefix1[] table? + if (typeof prefix === 'number') { + prefix = this.rules_prefix1[prefix]; + } + // init the prefix lookup table: first come, first serve... + if (!prefix) { + if (!first_catch_all_index) { + first_catch_all_index = i + 1; + } + } else { + for (var j = 0, pfxlen = prefix.length; j < pfxlen; j++) { + var pfxch = prefix.charCodeAt(j); + // first come, first serve: + if (!rule_prefixes[pfxch]) { + rule_prefixes[pfxch] = i + 1; + } + } + } + } + + // if no catch-all prefix has been encountered yet, it means all + // rules have limited prefix sets and it MAY be that particular + // input characters won't be recognized by any rule in this + // condition state. + // + // To speed up their discovery at run-time while keeping the + // remainder of the lexer kernel code very simple (and fast), + // we point these to an 'illegal' rule set index *beyond* + // the end of the rule set. + if (!first_catch_all_index) { + first_catch_all_index = len + 1; + } + + for (var i = 0; i < 65536; i++) { + if (!rule_prefixes[i]) { + rule_prefixes[i] = first_catch_all_index; + } + } + + spec.__dispatch_lut = rule_prefixes; + } else { + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; + } + } + + spec.rules = rule_new_ids; + spec.__rule_regexes = rule_regexes; + spec.__rule_count = len; + } + + this.__decompressed = true; + } + + this._input = input || ''; + this.clear(); + this._signaled_error_token = false; + this.done = false; + this.yylineno = 0; + this.matched = ''; + this.conditionStack = ['INITIAL']; + this.__currentRuleSet__ = null; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0 + }; + if (this.options.ranges) { + this.yylloc.range = [0, 0]; + } + this.offset = 0; + return this; + }, + + // consumes and returns one char from the input + input: function lexer_input() { + if (!this._input) { + //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) + return null; + } + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + // Count the linenumber up when we hit the LF (or a stand-alone CR). + // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo + // and we advance immediately past the LF as well, returning both together as if + // it was all a single 'character' only. + var slice_len = 1; + var lines = false; + if (ch === '\n') { + lines = true; + } else if (ch === '\r') { + lines = true; + var ch2 = this._input[1]; + if (ch2 === '\n') { + slice_len++; + ch += ch2; + this.yytext += ch2; + this.yyleng++; + this.offset++; + this.match += ch2; + this.matched += ch2; + if (this.options.ranges) { + this.yylloc.range[1]++; + } + } + } + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + } else { + this.yylloc.last_column++; + } + if (this.options.ranges) { + this.yylloc.range[1]++; + } + + this._input = this._input.slice(slice_len); + return ch; + }, + + // unshifts one char (or a string) into the input + unput: function lexer_unput(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + //this.yyleng -= len; + this.offset -= len; + var oldLines = this.match.split(/(?:\r\n?|\n)/g); + this.match = this.match.substr(0, this.match.length - len); + this.matched = this.matched.substr(0, this.matched.length - len); + + if (lines.length - 1) { + this.yylineno -= lines.length - 1; + } + + this.yylloc.last_line = this.yylineno + 1; + this.yylloc.last_column = (lines ? + (lines.length === oldLines.length ? this.yylloc.first_column : 0) + + oldLines[oldLines.length - lines.length].length - lines[0].length : + this.yylloc.first_column - len); + + if (this.options.ranges) { + this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng - len; + } + this.yyleng = this.yytext.length; + this.done = false; + return this; + }, + + // When called from action, caches matched text and appends it on next action + more: function lexer_more() { + this._more = true; + return this; + }, + + // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + reject: function lexer_reject() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + // when the parseError() call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // .lex() run. + var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), false); + this._signaled_error_token = (this.parseError(p.errStr, p) || this.ERROR); + } + return this; + }, + + // retain first n characters of the match + less: function lexer_less(n) { + return this.unput(this.match.slice(n)); + }, + + // return (part of the) already matched input, i.e. for error messages. + // Limit the returned string length to `maxSize` (default: 20). + // Limit the returned string to the `maxLines` number of lines of input (default: 1). + // Negative limit values equal *unlimited*. + pastInput: function lexer_pastInput(maxSize, maxLines) { + var past = this.matched.substring(0, this.matched.length - this.match.length); + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + if (maxLines < 0) + maxLines = past.length; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + // `substr` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + past = past.substr(-maxSize * 2 - 2); + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = past.replace(/\r\n|\r/g, '\n').split('\n'); + a = a.slice(-maxLines); + past = a.join('\n'); + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis prefix... + if (past.length > maxSize) { + past = '...' + past.substr(-maxSize); + } + return past; + }, + + // return (part of the) upcoming input, i.e. for error messages. + // Limit the returned string length to `maxSize` (default: 20). + // Limit the returned string to the `maxLines` number of lines of input (default: 1). + // Negative limit values equal *unlimited*. + upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { + var next = this.match; + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + if (maxLines < 0) + maxLines = maxSize; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + // `substring` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + if (next.length < maxSize * 2 + 2) { + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + } + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = next.replace(/\r\n|\r/g, '\n').split('\n'); + a = a.slice(0, maxLines); + next = a.join('\n'); + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis postfix... + if (next.length > maxSize) { + next = next.substring(0, maxSize) + '...'; + } + return next; + }, + + // return a string which displays the character position where the lexing error occurred, i.e. for error messages + showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { + var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; + }, + + // helper function, used to produce a human readable description as a string, given + // the input `yylloc` location object. + // Set `display_range_too` to TRUE to include the string character index position(s) + // in the description if the `yylloc.range` is available. + describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { + var l1 = yylloc.first_line; + var l2 = yylloc.last_line; + var o1 = yylloc.first_column; + var o2 = yylloc.last_column - 1; + var dl = l2 - l1; + var d_o = (dl === 0 ? o2 - o1 : 1000); + var rv; + if (dl === 0) { + rv = 'line ' + l1 + ', '; + if (d_o === 0) { + rv += 'column ' + o1; + } else { + rv += 'columns ' + o1 + ' .. ' + o2; + } + } else { + rv = 'lines ' + l1 + '(column ' + o1 + ') .. ' + l2 + '(column ' + o2 + ')'; + } + if (yylloc.range && display_range_too) { + var r1 = yylloc.range[0]; + var r2 = yylloc.range[1] - 1; + if (r2 === r1) { + rv += ' {String Offset: ' + r1 + '}'; + } else { + rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; + } + } + return rv; + // return JSON.stringify(yylloc); + }, + + // test the lexed token: return FALSE when not a match, otherwise return token. + // + // `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + // contains the actually matched text string. + // + // Also move the input cursor forward and update the match collectors: + // - yytext + // - yyleng + // - match + // - matches + // - yylloc + // - offset + test_match: function lexer_test_match(match, indexed_rule) { + var token, + lines, + backup, + match_str; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column + }, + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + yy: this.yy, + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + if (this.options.ranges) { + backup.yylloc.range = this.yylloc.range.slice(0); + } + } + + match_str = match[0]; + lines = match_str.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + this.yylloc = { + first_line: this.yylloc.last_line, + last_line: this.yylineno + 1, + first_column: this.yylloc.last_column, + last_column: lines ? + lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + this.yylloc.last_column + match_str.length + }; + this.yytext += match_str; + this.match += match_str; + this.matches = match; + this.yyleng = this.yytext.length; + if (this.options.ranges) { + this.yylloc.range = [this.offset, this.offset + this.yyleng]; + } + // previous lex rules MAY have invoked the `more()` API rather than producing a token: + // those rules will already have moved this `offset` forward matching their match lengths, + // hence we must only add our own match length now: + this.offset += match_str.length; + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match_str.length); + this.matched += match_str; + + // calling this method: + // + // function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) {...} + token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */); + // otherwise, when the action codes are all simple return token statements: + //token = this.simpleCaseActionClusters[indexed_rule]; + + if (this.done && this._input) { + this.done = false; + } + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + this.__currentRuleSet__ = null; + return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + this._signaled_error_token = false; + return token; + } + return false; + }, + + // return next match in input + next: function lexer_next() { + if (this.done) { + this.clear(); + return this.EOF; + } + if (!this._input) { + this.done = true; + } + + var token, + match, + tempMatch, + index; + if (!this._more) { + this.clear(); + } + var spec = this.__currentRuleSet__; + if (!spec) { + // Update the ruleset cache as we apparently encountered a state change or just started lexing. + // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will + // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps + // speed up those activities a tiny bit. + spec = this.__currentRuleSet__ = this._currentRules(); + } + + var rule_ids = spec.rules; +// var dispatch = spec.__dispatch_lut; + var regexes = spec.__rule_regexes; + var len = spec.__rule_count; + +// var c0 = this._input[0]; + + // Note: the arrays are 1-based, while `len` itself is a valid index, + // hence the non-standard less-or-equal check in the next loop condition! + // + // `dispatch` is a lookup table which lists the *first* rule which matches the 1-char *prefix* of the rule-to-match. + // By using that array as a jumpstart, we can cut down on the otherwise O(n*m) behaviour of this lexer, down to + // O(n) ideally, where: + // + // - N is the number of input particles -- which is not precisely characters + // as we progress on a per-regex-match basis rather than on a per-character basis + // + // - M is the number of rules (regexes) to test in the active condition state. + // + for (var i = 1 /* (dispatch[c0] || 1) */ ; i <= len; i++) { + tempMatch = this._input.match(regexes[i]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rule_ids[i]); + if (token !== false) { + return token; + } else if (this._backtrack) { + match = undefined; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + if (match) { + token = this.test_match(match, rule_ids[index]); + if (token !== false) { + return token; + } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + if (this._input === '') { + this.done = true; + return this.EOF; + } else { + var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); + token = (this.parseError(p.errStr, p) || this.ERROR); + if (token === this.ERROR) { + // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward at least one character at a time: + if (!this.match.length) { + this.input(); + } + } + return token; + } + }, + + // return next match that has a token + lex: function lexer_lex() { + var r; + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + while (!r) { + r = this.next(); + } + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + return r; + }, + + // backwards compatible alias for `pushState()`; + // the latter is symmetrical with `popState()` and we advise to use + // those APIs in any modern lexer code, rather than `begin()`. + begin: function lexer_begin(condition) { + return this.pushState(condition); + }, + + // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + pushState: function lexer_pushState(condition) { + this.conditionStack.push(condition); + this.__currentRuleSet__ = null; + return this; + }, + + // pop the previously active lexer condition state off the condition stack + popState: function lexer_popState() { + var n = this.conditionStack.length - 1; + if (n > 0) { + this.__currentRuleSet__ = null; + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + + // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + topState: function lexer_topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { + return this.conditionStack[n]; + } else { + return 'INITIAL'; + } + }, + + // (internal) determine the lexer rule set which is active for the currently active lexer condition state + _currentRules: function lexer__currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; + } else { + return this.conditions['INITIAL']; + } + }, + + // return the number of states currently on the stack + stateStackSize: function lexer_stateStackSize() { + return this.conditionStack.length; + }, +options: { + easy_keyword_rules: true, + ranges: true, + xregexp: true +}, +JisonLexerError: JisonLexerError, +performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) { + +var YYSTATE = YY_START; +switch($avoiding_name_collisions) { +case 7 : +/*! Conditions:: action */ +/*! Rule:: \{ */ + yy.depth++; return 3; +break; +case 8 : +/*! Conditions:: action */ +/*! Rule:: \} */ + + if (yy.depth == 0) { + this.begin('trail'); + } else { + yy.depth--; + } + return 4; + +break; +case 10 : +/*! Conditions:: conditions */ +/*! Rule:: > */ + this.popState(); return 6; +break; +case 13 : +/*! Conditions:: rules */ +/*! Rule:: {BR}+ */ + /* empty */ +break; +case 14 : +/*! Conditions:: rules */ +/*! Rule:: {WS}+{BR}+ */ + /* empty */ +break; +case 15 : +/*! Conditions:: rules */ +/*! Rule:: {WS}+ */ + this.begin('indented'); +break; +case 16 : +/*! Conditions:: rules */ +/*! Rule:: %% */ + this.begin('code'); return 19; +break; +case 17 : +/*! Conditions:: rules */ +/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ */ + + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 36; + +break; +case 20 : +/*! Conditions:: options */ +/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 39; +break; +case 21 : +/*! Conditions:: options */ +/*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 39; +break; +case 23 : +/*! Conditions:: options */ +/*! Rule:: {BR}+ */ + this.popState(); return 38; +break; +case 24 : +/*! Conditions:: options */ +/*! Rule:: {WS}+ */ + /* skip whitespace */ +break; +case 26 : +/*! Conditions:: start_condition */ +/*! Rule:: {BR}+ */ + this.popState(); +break; +case 27 : +/*! Conditions:: start_condition */ +/*! Rule:: {WS}+ */ + /* empty */ +break; +case 28 : +/*! Conditions:: trail */ +/*! Rule:: {WS}*{BR}+ */ + this.begin('rules'); +break; +case 29 : +/*! Conditions:: indented */ +/*! Rule:: \{ */ + yy.depth = 0; this.begin('action'); return 3; +break; +case 30 : +/*! Conditions:: indented */ +/*! Rule:: %\{(.|{BR})*?%\} */ + this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; +break; +case 31 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: %\{(.|{BR})*?%\} */ + yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; +break; +case 32 : +/*! Conditions:: indented */ +/*! Rule:: %include\b */ + + // This is an include instruction in place of an action: + // thanks to the `.+` rule immediately below we need to semi-duplicate + // the `%include` token recognition here vs. the almost-identical rule for the same + // further below. + // There's no real harm as we need to do something special in this case anyway: + // push 2 (two!) conditions. + // + // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar + // parse correctly took several hours as the debug facilities were - and are - too meager to + // quickly diagnose the problem while we hadn't. So the code got littered with debug prints + // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) + + // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... + this.pushState('trail'); + // then push the immediate need: the 'path' condition. + this.pushState('path'); + return 40; + +break; +case 33 : +/*! Conditions:: indented */ +/*! Rule:: .* */ + this.popState(); return 23; +break; +case 34 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /* ignore */ +break; +case 35 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: \/\/[^\r\n]* */ + /* ignore */ +break; +case 36 : +/*! Conditions:: INITIAL */ +/*! Rule:: {ID} */ + this.pushState('macro'); return 20; +break; +case 37 : +/*! Conditions:: macro */ +/*! Rule:: {BR}+ */ + this.popState('macro'); +break; +case 38 : +/*! Conditions:: macro */ +/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ */ + + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 36; + +break; +case 39 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: {BR}+ */ + /* empty */ +break; +case 40 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: \s+ */ + /* empty */ +break; +case 41 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 35; +break; +case 42 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 35; +break; +case 43 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: \[ */ + this.pushState('set'); return 30; +break; +case 56 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: < */ + this.begin('conditions'); return 5; +break; +case 57 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: \/! */ + return 28; // treated as `(?!atom)` +break; +case 58 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: \/ */ + return 14; // treated as `(?=atom)` +break; +case 60 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 33; +break; +case 63 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: %options\b */ + this.begin('options'); return 37; +break; +case 64 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: %s\b */ + this.begin('start_condition'); return 21; +break; +case 65 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: %x\b */ + this.begin('start_condition'); return 22; +break; +case 66 : +/*! Conditions:: INITIAL trail code */ +/*! Rule:: %include\b */ + this.pushState('path'); return 40; +break; +case 67 : +/*! Conditions:: INITIAL rules trail code */ +/*! Rule:: %{NAME}[^\r\n]+ */ + + /* ignore unrecognized decl */ + console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + return 24; + +break; +case 68 : +/*! Conditions:: indented trail rules macro INITIAL */ +/*! Rule:: %% */ + this.begin('rules'); return 19; +break; +case 76 : +/*! Conditions:: set */ +/*! Rule:: \] */ + this.popState('set'); return 31; +break; +case 78 : +/*! Conditions:: code */ +/*! Rule:: [^\r\n]+ */ + return 42; // the bit of CODE just before EOF... +break; +case 79 : +/*! Conditions:: path */ +/*! Rule:: {BR} */ + this.popState(); this.unput(yy_.yytext); +break; +case 80 : +/*! Conditions:: path */ +/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 41; +break; +case 81 : +/*! Conditions:: path */ +/*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 41; +break; +case 82 : +/*! Conditions:: path */ +/*! Rule:: {WS}+ */ + // skip whitespace in the line +break; +case 83 : +/*! Conditions:: path */ +/*! Rule:: [^\s\r\n]+ */ + this.popState(); return 41; +break; +case 84 : +/*! Conditions:: * */ +/*! Rule:: . */ + + /* b0rk on bad characters */ + var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); + var l2 = 3; + var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); + throw new Error('unsupported lexer input: ', yy_.yytext, ' @ ' + this.describeYYLLOC(yy_.yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); + +break; +default: + return this.simpleCaseActionClusters[$avoiding_name_collisions]; +} +}, +simpleCaseActionClusters: { + + /*! Conditions:: action */ + /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + 0 : 26, + /*! Conditions:: action */ + /*! Rule:: \/\/.* */ + 1 : 26, + /*! Conditions:: action */ + /*! Rule:: \/[^ /]*?['"{}][^ ]*?\/ */ + 2 : 26, + /*! Conditions:: action */ + /*! Rule:: "(\\\\|\\"|[^"])*" */ + 3 : 26, + /*! Conditions:: action */ + /*! Rule:: '(\\\\|\\'|[^'])*' */ + 4 : 26, + /*! Conditions:: action */ + /*! Rule:: [/"'][^{}/"']+ */ + 5 : 26, + /*! Conditions:: action */ + /*! Rule:: [^{}/"']+ */ + 6 : 26, + /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ + 9 : 20, + /*! Conditions:: conditions */ + /*! Rule:: , */ + 11 : 8, + /*! Conditions:: conditions */ + /*! Rule:: \* */ + 12 : 7, + /*! Conditions:: options */ + /*! Rule:: {NAME} */ + 18 : 20, + /*! Conditions:: options */ + /*! Rule:: = */ + 19 : 18, + /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ + 22 : 39, + /*! Conditions:: start_condition */ + /*! Rule:: {ID} */ + 25 : 25, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \| */ + 44 : 9, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \(\?: */ + 45 : 27, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \(\?= */ + 46 : 27, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \(\?! */ + 47 : 27, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \( */ + 48 : 10, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \) */ + 49 : 11, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \+ */ + 50 : 12, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \* */ + 51 : 7, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \? */ + 52 : 13, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \^ */ + 53 : 16, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: , */ + 54 : 8, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: <> */ + 55 : 17, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + 59 : 33, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \$ */ + 61 : 17, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \. */ + 62 : 15, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \{\d+(,\s?\d+|,)?\} */ + 69 : 34, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \{{ID}\} */ + 70 : 29, + /*! Conditions:: set options */ + /*! Rule:: \{{ID}\} */ + 71 : 29, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \{ */ + 72 : 3, + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \} */ + 73 : 4, + /*! Conditions:: set */ + /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ + 74 : 32, + /*! Conditions:: set */ + /*! Rule:: \{ */ + 75 : 32, + /*! Conditions:: code */ + /*! Rule:: [^\r\n]*(\r|\n)+ */ + 77 : 42, + /*! Conditions:: * */ + /*! Rule:: $ */ + 85 : 1 +}, +rules: [ +/^(?:\/\*(.|\n|\r)*?\*\/)/, +/^(?:\/\/.*)/, +/^(?:\/[^ \/]*?['"{}][^ ]*?\/)/, +/^(?:"(\\\\|\\"|[^"])*")/, +/^(?:'(\\\\|\\'|[^'])*')/, +/^(?:[\/"'][^{}\/"']+)/, +/^(?:[^{}\/"']+)/, +/^(?:\{)/, +/^(?:\})/, +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", ""), +/^(?:>)/, +/^(?:,)/, +/^(?:\*)/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, +/^(?:([^\S\n\r])+)/, +/^(?:%%)/, +/^(?:[^\s!"$%'-,.\/:-?\[-\^{-}]+)/, +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", ""), +/^(?:=)/, +/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, +/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, +/^(?:\S+)/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:([^\S\n\r])+)/, +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), +/^(?:(\r\n|\n|\r)+)/, +/^(?:([^\S\n\r])+)/, +/^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, +/^(?:\{)/, +/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, +/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, +/^(?:%include\b)/, +/^(?:.*)/, +/^(?:\/\*(.|\n|\r)*?\*\/)/, +/^(?:\/\/[^\r\n]*)/, +new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), +/^(?:(\r\n|\n|\r)+)/, +/^(?:[^\s!"$%'-,.\/:<-?\[-\^{-}]+)/, +/^(?:(\r\n|\n|\r)+)/, +/^(?:\s+)/, +/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, +/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, +/^(?:\[)/, +/^(?:\|)/, +/^(?:\(\?:)/, +/^(?:\(\?=)/, +/^(?:\(\?!)/, +/^(?:\()/, +/^(?:\))/, +/^(?:\+)/, +/^(?:\*)/, +/^(?:\?)/, +/^(?:\^)/, +/^(?:,)/, +/^(?:<>)/, +/^(?:<)/, +/^(?:\/!)/, +/^(?:\/)/, +/^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, +/^(?:\\.)/, +/^(?:\$)/, +/^(?:\.)/, +/^(?:%options\b)/, +/^(?:%s\b)/, +/^(?:%x\b)/, +/^(?:%include\b)/, +new XRegExp("^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)[^\\n\\r]+)", ""), +/^(?:%%)/, +/^(?:\{\d+(,\s?\d+|,)?\})/, +new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", ""), +new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", ""), +/^(?:\{)/, +/^(?:\})/, +/^(?:(?:\\\\|\\\]|[^\]{])+)/, +/^(?:\{)/, +/^(?:\])/, +/^(?:[^\r\n]*(\r|\n)+)/, +/^(?:[^\r\n]+)/, +/^(?:(\r\n|\n|\r))/, +/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, +/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, +/^(?:([^\S\n\r])+)/, +/^(?:\S+)/, +/^(?:.)/, +/^(?:$)/ +], +conditions: { + "code": { + rules: [ + 66, + 67, + 77, + 78, + 84, + 85 + ], + inclusive: false + }, + "start_condition": { + rules: [ + 25, + 26, + 27, + 84, + 85 + ], + inclusive: false + }, + "options": { + rules: [ + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 71, + 84, + 85 + ], + inclusive: false + }, + "conditions": { + rules: [ + 9, + 10, + 11, + 12, + 84, + 85 + ], + inclusive: false + }, + "action": { + rules: [ + 0, + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 84, + 85 + ], + inclusive: false + }, + "path": { + rules: [ + 79, + 80, + 81, + 82, + 83, + 84, + 85 + ], + inclusive: false + }, + "set": { + rules: [ + 71, + 74, + 75, + 76, + 84, + 85 + ], + inclusive: false + }, + "indented": { + rules: [ + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 68, + 69, + 70, + 72, + 73, + 84, + 85 + ], + inclusive: true + }, + "trail": { + rules: [ + 28, + 31, + 34, + 35, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 72, + 73, + 84, + 85 + ], + inclusive: true + }, + "rules": { + rules: [ + 13, + 14, + 15, + 16, + 17, + 31, + 34, + 35, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 67, + 68, + 69, + 70, + 72, + 73, + 84, + 85 + ], + inclusive: true + }, + "macro": { + rules: [ + 31, + 34, + 35, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 68, + 69, + 70, + 72, + 73, + 84, + 85 + ], + inclusive: true + }, + "INITIAL": { + rules: [ + 31, + 34, + 35, + 36, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 72, + 73, + 84, + 85 + ], + inclusive: true + } +} +}; + +function indent(s, i) { + var a = s.split('\n'); + var pf = (new Array(i + 1)).join(' '); + return pf + a.join('\n' + pf); +}; +return lexer; +})(); +parser.lexer = lexer; + +function Parser() { + this.yy = {}; +} +Parser.prototype = parser; +parser.Parser = Parser; + +return new Parser(); +})(); + + + + +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { + exports.parser = lexParser; + exports.Parser = lexParser.Parser; + exports.parse = function () { + return lexParser.parse.apply(lexParser, arguments); + }; + +} From c666ba9cdd0458ca539e5b946976368003ac5d8d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 31 Jan 2017 11:41:01 +0100 Subject: [PATCH 250/417] npm: use the new name `jison-gho`; bump build number --- Makefile | 1 + package.json | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3fc32df..922c793 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ prep: npm-install npm-install: npm install + npm install --only=dev build: lex-parser.js diff --git a/package.json b/package.json index a734c36..4f66cb2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-166", + "version": "0.1.4-167", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { @@ -26,10 +26,10 @@ "node": ">=4.0" }, "dependencies": { - "xregexp": "GerHobbelt/xregexp#master" + "xregexp": "github:GerHobbelt/xregexp#master" }, "devDependencies": { - "jison": "GerHobbelt/jison#master", - "test": ">=0.6.0" + "jison-gho": "github:GerHobbelt/jison#master", + "test": "0.6.0" } } From 25fac630182518a4d8d67734ff21ae73415edb03 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 31 Jan 2017 12:15:18 +0100 Subject: [PATCH 251/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 1849de9..8cff567 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-166 */ +/* parser generated by jison 0.4.18-167 */ /* * Returns a Parser object of the following structure: * From dad6665518fb639e06f55391afa7e69bef3caf26 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 31 Jan 2017 12:24:05 +0100 Subject: [PATCH 252/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4f66cb2..ec1537f 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-167", + "version": "0.1.4-168", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 892e53c6905d0f2a477397e76e987fbbd77cd9d3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 31 Jan 2017 12:34:04 +0100 Subject: [PATCH 253/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 8cff567..a90acdd 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-167 */ +/* parser generated by jison 0.4.18-168 */ /* * Returns a Parser object of the following structure: * From 068850675224631e12af9ed72c70416b3dafb4a6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 31 Jan 2017 22:27:17 +0100 Subject: [PATCH 254/417] - augment the jison parser and lexer to collect unknown `%xyz` declarations as name+value pairs. Adjusted the relevant unit tests accordingly. - lexer: replace old `lexer.begin(condition_name)` API calls with the more appropriate modern `lexer.pushState(condition_name)` API calls -- these, after all, properly mirror the counterparts used in the lexer in API naming at least: `lexer.popState()` --- README.md | 33 +++++++++++++++++++-------------- lex-parser.js | 33 +++++++++++++++++++-------------- lex.l | 31 ++++++++++++++++++------------- tests/all-tests.js | 8 ++++---- 4 files changed, 60 insertions(+), 45 deletions(-) diff --git a/README.md b/README.md index 46334d0..30834c6 100644 --- a/README.md +++ b/README.md @@ -66,7 +66,7 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* // Off Topic // --------- // -// Do not specify the xregexp option as we want the XRegExp \p{...} regex macros converted to +// Do NOT specify the xregexp option as we want the XRegExp \p{...} regex macros converted to // native regexes and used as such: // // %options xregexp @@ -91,7 +91,7 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* "{" yy.depth++; return '{'; "}" %{ if (yy.depth == 0) { - this.begin('trail'); + this.pushState('trail'); } else { yy.depth--; } @@ -105,8 +105,8 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* {BR}+ /* empty */ {WS}+{BR}+ /* empty */ -{WS}+ this.begin('indented'); -"%%" this.begin('code'); return '%%'; +{WS}+ this.pushState('indented'); +"%%" this.pushState('code'); return '%%'; [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ %{ // accept any non-regex, non-lex, non-string-delim, @@ -127,10 +127,10 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* {BR}+ this.popState(); {WS}+ /* empty */ -{WS}*{BR}+ this.begin('rules'); +{WS}*{BR}+ this.pushState('rules'); -"{" yy.depth = 0; this.begin('action'); return '{'; -"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; +"{" yy.depth = 0; this.pushState('action'); return '{'; +"%{"(.|{BR})*?"%}" this.pushState('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; "%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; "%include" %{ // This is an include instruction in place of an action: @@ -188,7 +188,7 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* "^" return '^'; "," return ','; "<>" return '$'; -"<" this.begin('conditions'); return '<'; +"<" this.pushState('conditions'); return '<'; "/!" return '/!'; // treated as `(?!atom)` "/" return '/'; // treated as `(?=atom)` "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) @@ -196,17 +196,22 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* "\\". yytext = yytext.replace(/^\\/g, ''); return 'ESCAPE_CHAR'; "$" return '$'; "." return '.'; -"%options" this.begin('options'); return 'OPTIONS'; -"%s" this.begin('start_condition'); return 'START_INC'; -"%x" this.begin('start_condition'); return 'START_EXC'; +"%options" this.pushState('options'); return 'OPTIONS'; +"%s" this.pushState('start_condition'); return 'START_INC'; +"%x" this.pushState('start_condition'); return 'START_EXC'; "%include" this.pushState('path'); return 'INCLUDE'; -"%"{NAME}[^\r\n]+ +"%"{NAME}([^\r\n]*) %{ /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + console.warn('LEX: ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + // this.pushState('options'); + yytext = [ + this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; return 'UNKNOWN_DECL'; %} -"%%" this.begin('rules'); return '%%'; +"%%" this.pushState('rules'); return '%%'; "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; "{"{ID}"}" return 'NAME_BRACE'; "{"{ID}"}" return 'NAME_BRACE'; diff --git a/lex-parser.js b/lex-parser.js index c6a0620..f8a1d79 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3596,7 +3596,7 @@ case 8 : /*! Rule:: \} */ if (yy.depth == 0) { - this.begin('trail'); + this.pushState('trail'); } else { yy.depth--; } @@ -3621,12 +3621,12 @@ break; case 15 : /*! Conditions:: rules */ /*! Rule:: {WS}+ */ - this.begin('indented'); + this.pushState('indented'); break; case 16 : /*! Conditions:: rules */ /*! Rule:: %% */ - this.begin('code'); return 19; + this.pushState('code'); return 19; break; case 17 : /*! Conditions:: rules */ @@ -3670,17 +3670,17 @@ break; case 28 : /*! Conditions:: trail */ /*! Rule:: {WS}*{BR}+ */ - this.begin('rules'); + this.pushState('rules'); break; case 29 : /*! Conditions:: indented */ /*! Rule:: \{ */ - yy.depth = 0; this.begin('action'); return 3; + yy.depth = 0; this.pushState('action'); return 3; break; case 30 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ - this.begin('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; + this.pushState('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; break; case 31 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3772,7 +3772,7 @@ break; case 56 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: < */ - this.begin('conditions'); return 5; + this.pushState('conditions'); return 5; break; case 57 : /*! Conditions:: indented trail rules macro INITIAL */ @@ -3792,17 +3792,17 @@ break; case 63 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ - this.begin('options'); return 37; + this.pushState('options'); return 37; break; case 64 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %s\b */ - this.begin('start_condition'); return 21; + this.pushState('start_condition'); return 21; break; case 65 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %x\b */ - this.begin('start_condition'); return 22; + this.pushState('start_condition'); return 22; break; case 66 : /*! Conditions:: INITIAL trail code */ @@ -3811,17 +3811,22 @@ case 66 : break; case 67 : /*! Conditions:: INITIAL rules trail code */ -/*! Rule:: %{NAME}[^\r\n]+ */ +/*! Rule:: %{NAME}([^\r\n]*) */ /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + console.warn('LEX: ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + // this.pushState('options'); + yy_.yytext = [ + this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; return 24; break; case 68 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %% */ - this.begin('rules'); return 19; + this.pushState('rules'); return 19; break; case 76 : /*! Conditions:: set */ @@ -4058,7 +4063,7 @@ new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), /^(?:%s\b)/, /^(?:%x\b)/, /^(?:%include\b)/, -new XRegExp("^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)[^\\n\\r]+)", ""), +new XRegExp("^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))", ""), /^(?:%%)/, /^(?:\{\d+(,\s?\d+|,)?\})/, new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", ""), diff --git a/lex.l b/lex.l index e719f73..d00bf63 100644 --- a/lex.l +++ b/lex.l @@ -47,7 +47,7 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* "{" yy.depth++; return '{'; "}" %{ if (yy.depth == 0) { - this.begin('trail'); + this.pushState('trail'); } else { yy.depth--; } @@ -61,8 +61,8 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* {BR}+ /* empty */ {WS}+{BR}+ /* empty */ -{WS}+ this.begin('indented'); -"%%" this.begin('code'); return '%%'; +{WS}+ this.pushState('indented'); +"%%" this.pushState('code'); return '%%'; [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ %{ // accept any non-regex, non-lex, non-string-delim, @@ -83,10 +83,10 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* {BR}+ this.popState(); {WS}+ /* empty */ -{WS}*{BR}+ this.begin('rules'); +{WS}*{BR}+ this.pushState('rules'); -"{" yy.depth = 0; this.begin('action'); return '{'; -"%{"(.|{BR})*?"%}" this.begin('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; +"{" yy.depth = 0; this.pushState('action'); return '{'; +"%{"(.|{BR})*?"%}" this.pushState('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; "%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; "%include" %{ // This is an include instruction in place of an action: @@ -144,7 +144,7 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* "^" return '^'; "," return ','; "<>" return '$'; -"<" this.begin('conditions'); return '<'; +"<" this.pushState('conditions'); return '<'; "/!" return '/!'; // treated as `(?!atom)` "/" return '/'; // treated as `(?=atom)` "\\"([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|"c"[A-Z]|"x"[0-9A-F]{2}|"u"[a-fA-F0-9]{4}) @@ -152,17 +152,22 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* "\\". yytext = yytext.replace(/^\\/g, ''); return 'ESCAPE_CHAR'; "$" return '$'; "." return '.'; -"%options" this.begin('options'); return 'OPTIONS'; -"%s" this.begin('start_condition'); return 'START_INC'; -"%x" this.begin('start_condition'); return 'START_EXC'; +"%options" this.pushState('options'); return 'OPTIONS'; +"%s" this.pushState('start_condition'); return 'START_INC'; +"%x" this.pushState('start_condition'); return 'START_EXC'; "%include" this.pushState('path'); return 'INCLUDE'; -"%"{NAME}[^\r\n]+ +"%"{NAME}([^\r\n]*) %{ /* ignore unrecognized decl */ - console.warn('ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + console.warn('LEX: ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + // this.pushState('options'); + yytext = [ + this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; return 'UNKNOWN_DECL'; %} -"%%" this.begin('rules'); return '%%'; +"%%" this.pushState('rules'); return '%%'; "{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; "{"{ID}"}" return 'NAME_BRACE'; "{"{ID}"}" return 'NAME_BRACE'; diff --git a/tests/all-tests.js b/tests/all-tests.js index dfc84e2..e930901 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -60,7 +60,7 @@ exports["test rule-less grammar"] = function () { var lexgrammar = '%export { D }\nD [0-9]'; var expected = { macros: { D: '[0-9]' }, - unknownDecls: ['%export { D }'], + unknownDecls: [['export', '{ D }']], rules: [] }; assert.deepEqual(lex.parse(lexgrammar), expected, 'grammar should be parsed correctly'); @@ -270,9 +270,9 @@ exports["test unknown declarations"] = function () { var lexgrammar = '%a b c\n%foo[bar] baz qux\n%a b c\n%%\n. //'; var expected = { unknownDecls: [ - '%a b c', - '%foo[bar] baz qux', - '%a b c' + ['a', 'b c'], + ['foo', '[bar] baz qux'], + ['a', 'b c'] ], rules: [ ['.', '//'] From 89bf2a79a8123534f947f3791b6f868922d2a908 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Feb 2017 03:34:26 +0100 Subject: [PATCH 255/417] sync TravisCI and npm package ignore settings --- .npmignore | 15 +++++++++++++++ .travis.yml | 3 +++ 2 files changed, 18 insertions(+) diff --git a/.npmignore b/.npmignore index 7a48940..5407458 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,17 @@ +.DS_Store +node_modules/ +npm-debug.log + +# Editor backup files +*.bak +*~ + +# scratch space +/tmp/ + +# Ignore build/publish scripts, etc. +Makefile + +# Sources which are compiled through jison lex.y lex.l diff --git a/.travis.yml b/.travis.yml index 7aa5c55..e6a41f3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,3 +1,4 @@ +sudo: false language: node_js node_js: - 6 @@ -6,3 +7,5 @@ node_js: - 5.0 - 4 - 4.0 + - stable + From 9f90434ce1399a2b1711d3bc12e8db7bddeb945f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Feb 2017 05:13:22 +0100 Subject: [PATCH 256/417] cherrypicked from ebnf-parser: config fix to make TravisCI deliver! --- .travis.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.travis.yml b/.travis.yml index e6a41f3..800d5f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -9,3 +9,18 @@ node_js: - 4.0 - stable +# http://stackoverflow.com/questions/15674064/github-submodule-access-rights-travis-ci +# +# This can (thankfully) be easily solved by modifying the .gitmodules file on-the-fly on Travis, +# so that the SSH URL is replaced with the public URL, before initializing submodules. +# To accomplish this, add the following to .travis.yml: + +# Handle git submodules yourself +git: + submodules: false + +# Use sed to replace the jison package +before_install: + - sed -i 's/github:GerHobbelt\/jison#master/latest/' package.json + - cat package.json + From b50973f17de7e6fb9a1b31db519a8aaf8c389f5a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Feb 2017 05:14:29 +0100 Subject: [PATCH 257/417] fix for TravisCI-found bug: NodeJS 5.x would fail the test suite as there the regex 'u' Unicode Support flag is not yet natively defined. XRegExp doesn't shim this AFAICT. --- lex.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex.y b/lex.y index 5a56311..79dc47a 100644 --- a/lex.y +++ b/lex.y @@ -232,7 +232,7 @@ regex } // a 'keyword' starts with an alphanumeric character, // followed by zero or more alphanumerics or digits: - var re = XRegExp('\\w[\\w\\d]*$', 'u'); + var re = new XRegExp('\\w[\\w\\d]*$', XRegExp._registeredFlags()['u'] ? 'u' : ''); if (XRegExp.match($$, re)) { $$ = $re + "\\b"; } else { From 2be43346db4fb503ef34fcd1b5eb3c80c2f55d27 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Feb 2017 05:16:57 +0100 Subject: [PATCH 258/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index f8a1d79..2043c84 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1101,7 +1101,7 @@ case 37: } // a 'keyword' starts with an alphanumeric character, // followed by zero or more alphanumerics or digits: - var re = XRegExp('\\w[\\w\\d]*$', 'u'); + var re = new XRegExp('\\w[\\w\\d]*$', XRegExp._registeredFlags()['u'] ? 'u' : ''); if (XRegExp.match(this.$, re)) { this.$ = yyvstack[$0] + "\\b"; } else { From cdad52a218f7e5a2211771b46e8769f9cd3328ac Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Feb 2017 05:46:21 +0100 Subject: [PATCH 259/417] update all TravisCI build badges in the README's --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 30834c6..79354a1 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,9 @@ # lex-parser + +[![build status](https://secure.travis-ci.org/GerHobbelt/lex-parser.png)](http://travis-ci.org/GerHobbelt/lex-parser) + + A parser for lexical grammars used by [jison](http://jison.org) and jison-lex. ## install From 21d9fe6c462e7e9c2f1f2fc41c7664dce579a7c1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Feb 2017 05:55:40 +0100 Subject: [PATCH 260/417] rebuilt library files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ec1537f..6ad5da8 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-168", + "version": "0.1.4-170", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 884b49de49173f8cb48d97b32149c3aacb5d8764 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Feb 2017 06:04:51 +0100 Subject: [PATCH 261/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 2043c84..c420bda 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-168 */ +/* parser generated by jison 0.4.18-170 */ /* * Returns a Parser object of the following structure: * From e2103614d04470d06a6ff573c3bb4d1fe02990de Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Feb 2017 06:05:25 +0100 Subject: [PATCH 262/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 6ad5da8..5e2f6a1 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-170", + "version": "0.1.4-171", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 2b3dd3d9e984c9f45574e0fafc68c10f63614959 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 1 Feb 2017 06:12:58 +0100 Subject: [PATCH 263/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index c420bda..8db83d0 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-170 */ +/* parser generated by jison 0.4.18-171 */ /* * Returns a Parser object of the following structure: * From 7f7e848e65071da829e75ee118a7ac48ba2a34f4 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 2 Feb 2017 21:15:23 +0100 Subject: [PATCH 264/417] correct fix instead of the quick hack commit SHA-1: b50973f17de7e6fb9a1b31db519a8aaf8c389f5a (fix for TravisCI-found bug: NodeJS 5.x would fail the test suite as there the regex 'u' Unicode Support flag is not yet natively defined): we don't support astral Unicode characters anyway, so we would behave unpredictably anyway if we used the new 'u' behaviour in one spot only, so we discard it. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp#Parameters) --- lex-parser.js | 2 +- lex.y | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8db83d0..f6bb7c1 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1101,7 +1101,7 @@ case 37: } // a 'keyword' starts with an alphanumeric character, // followed by zero or more alphanumerics or digits: - var re = new XRegExp('\\w[\\w\\d]*$', XRegExp._registeredFlags()['u'] ? 'u' : ''); + var re = new XRegExp('\\w[\\w\\d]*$'); if (XRegExp.match(this.$, re)) { this.$ = yyvstack[$0] + "\\b"; } else { diff --git a/lex.y b/lex.y index 79dc47a..b0bb148 100644 --- a/lex.y +++ b/lex.y @@ -232,7 +232,7 @@ regex } // a 'keyword' starts with an alphanumeric character, // followed by zero or more alphanumerics or digits: - var re = new XRegExp('\\w[\\w\\d]*$', XRegExp._registeredFlags()['u'] ? 'u' : ''); + var re = new XRegExp('\\w[\\w\\d]*$'); if (XRegExp.match($$, re)) { $$ = $re + "\\b"; } else { From 6766ca91fc823a6774431fa1e45d92a484a0962c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 2 Feb 2017 21:41:31 +0100 Subject: [PATCH 265/417] =?UTF-8?q?cosmetic=20fix:=20make=20sure=20all=20e?= =?UTF-8?q?psilon=20rules=20are=20easily=20recognized=20as=20such=20(`?= =?UTF-8?q?=CE=B5`)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lex.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex.y b/lex.y index b0bb148..1390af4 100644 --- a/lex.y +++ b/lex.y @@ -168,7 +168,7 @@ start_conditions { $$ = $name_list; } | '<' '*' '>' { $$ = ['*']; } - | + | ε ; name_list From 06cfb337bfb268b4641e00ea7c1ed46479fb711d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 3 Feb 2017 00:08:06 +0100 Subject: [PATCH 266/417] cleanup the lexer rules regarding literal lexer rule elements recognition: use a macro to encode this in a single spot. ("Accept any non-regex-special character as a direct literal without the need to put quotes around it") --- lex.l | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lex.l b/lex.l index d00bf63..99f2795 100644 --- a/lex.l +++ b/lex.l @@ -22,6 +22,10 @@ WS [^\S\r\n] QUOTED_STRING_CONTENT (?:\\\'|\\[^\']|[^\\\'])* DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* +// Accept any non-regex-special character as a direct literal without +// the need to put quotes around it: +ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] + %s indented trail rules macro %x code start_condition options conditions action path set @@ -63,7 +67,9 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* {WS}+{BR}+ /* empty */ {WS}+ this.pushState('indented'); "%%" this.pushState('code'); return '%%'; -[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ +// Accept any non-regex-special character as a direct literal without +// the need to put quotes around it: +{ANY_LITERAL_CHAR}+ %{ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is @@ -117,7 +123,7 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* // Accept any non-regex-special character as a direct literal without // the need to put quotes around it: -[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ +{ANY_LITERAL_CHAR}+ %{ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is From 6d91e2ba5972477d8ba285a4babc7ac36b39354f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 3 Feb 2017 00:10:18 +0100 Subject: [PATCH 267/417] fix failing jison system test, following the preliminary grouped lexer rules merge: a lexer rule set may be EMPTY (indicating we're going to use a custom lexer of one type of another) --- lex.y | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex.y b/lex.y index f58d959..241b473 100644 --- a/lex.y +++ b/lex.y @@ -125,8 +125,8 @@ names_exclusive rules : rules rules_collective { $$ = $rules.concat($rules_collective); } - | rules_collective - { $$ = $rules_collective; } + | ε + { $$ = []; } ; rules_collective From a24fb315e99953ff37bee7a05044f539c92d6ada Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 3 Feb 2017 00:13:12 +0100 Subject: [PATCH 268/417] make the lexer parser action code a bit more legible. This also makes the lexer output a little different: now you'll ALWAYS see a `macros` set + `startConditions` set + `unknownDecls` array as part of the lexer parse output. Any of these MAY be empty. Tests have been adjusted accordingly. --- lex.y | 23 ++-- tests/all-tests.js | 193 ++++++++++++++++++++++++++------- tests/lex/bnf.lex.json | 5 +- tests/lex/lex_grammar.lex.json | 5 +- 4 files changed, 172 insertions(+), 54 deletions(-) diff --git a/lex.y b/lex.y index 241b473..9e5fceb 100644 --- a/lex.y +++ b/lex.y @@ -13,9 +13,9 @@ lex : init definitions rules_and_epilogue EOF { $$ = $rules_and_epilogue; - if ($definitions[0]) $$.macros = $definitions[0]; - if ($definitions[1]) $$.startConditions = $definitions[1]; - if ($definitions[2]) $$.unknownDecls = $definitions[2]; + $$.macros = $definitions.macros; + $$.startConditions = $definitions.startConditions; + $$.unknownDecls = $definitions.unknownDecls; // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { @@ -72,21 +72,24 @@ definitions $$ = $definitions; if ($definition != null) { if ('length' in $definition) { - $$[0] = $$[0] || {}; - $$[0][$definition[0]] = $definition[1]; + $$.macros[$definition[0]] = $definition[1]; } else if ($definition.type === 'names') { - $$[1] = $$[1] || {}; for (var name in $definition.names) { - $$[1][name] = $definition.names[name]; + $$.startConditions[name] = $definition.names[name]; } } else if ($definition.type === 'unknown') { - $$[2] = $$[2] || []; - $$[2].push($definition.body); + $$.unknownDecls.push($definition.body); } } } | ε - { $$ = [null, null]; } + { + $$ = { + macros: {}, // { hash table } + startConditions: {}, // { hash table } + unknownDecls: [] // [ array of [key,value] pairs } + }; + } ; definition diff --git a/tests/all-tests.js b/tests/all-tests.js index e930901..414bb07 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -31,7 +31,9 @@ exports["test lex grammar with macros"] = function () { rules: [ ["{D}ohhai", "print(9);"], ["\\{", "return '{';"] - ] + ], + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -49,7 +51,9 @@ exports["test lex grammar with macros in regex sets"] = function () { rules: [ ["[{D}]ohhai", "print(9);"], ["\\{", "return '{';"] - ] + ], + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -61,7 +65,8 @@ exports["test rule-less grammar"] = function () { var expected = { macros: { D: '[0-9]' }, unknownDecls: [['export', '{ D }']], - rules: [] + rules: [], + startConditions: {}, }; assert.deepEqual(lex.parse(lexgrammar), expected, 'grammar should be parsed correctly'); }; @@ -73,7 +78,10 @@ exports["test escaped chars"] = function () { ["\\\\n+", "return 'NL';"], ["\\n+", "return 'NL2';"], ["\\s+", "/* skip */"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -88,7 +96,10 @@ exports["test advanced"] = function () { [".", "/* skip */"], ["stuff*(?=(\\{|;))", "/* ok */"], ["(.+)[a-z]{1,2}hi*?", "/* skip */"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -102,7 +113,10 @@ exports["test [^\\]]"] = function () { ["\\[[^\\]]\\]", "return true;"], ["f\"oo'bar", "return 'baz2';"], ['fo"obar', "return 'baz';"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -114,7 +128,10 @@ exports["test multiline action"] = function () { var expected = { rules: [ ["\\[[^\\]]\\]", "\nreturn true;\n"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -126,7 +143,10 @@ exports["test multiline action with single braces"] = function () { var expected = { rules: [ ["\\[[^\\]]\\]", "\nvar b={};return true;\n"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -138,7 +158,10 @@ exports["test multiline action with brace in a multi-line-comment"] = function ( var expected = { rules: [ ["\\[[^\\]]\\]", "\nvar b={}; /* { */ return true;\n"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -150,7 +173,10 @@ exports["test multiline action with brace in a single-line-comment"] = function var expected = { rules: [ ["\\[[^\\]]\\]", "\nvar b={}; // { \nreturn 2 / 3;\n"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -162,7 +188,10 @@ exports["test multiline action with braces in strings"] = function () { var expected = { rules: [ ["\\[[^\\]]\\]", "\nvar b='{' + \"{\"; // { \nreturn 2 / 3;\n"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -174,7 +203,10 @@ exports["test multiline action with braces in regexp"] = function () { var expected = { rules: [ ["\\[[^\\]]\\]", "\nvar b=/{/; // { \nreturn 2 / 3;\n"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -186,7 +218,10 @@ exports["test multiline (indented) action without braces"] = function () { var expected = { rules: [ ["\\[[^\\]]\\]", "var b=/{/;\n// { \nreturn 2 / 3;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -200,7 +235,9 @@ exports["test include"] = function () { actionInclude: "\n hi \n", rules: [ ["\\[[^\\]]\\]", "\nreturn true;\n"] - ] + ], + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -235,7 +272,10 @@ exports["test advanced"] = function () { var expected = { rules: [ ["stuff*(?!(\\{|;))", "/* ok */"], - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -259,7 +299,9 @@ exports["test start conditions"] = function () { [["TEST","EAT"], "x", "return 'T';" ], [["*"], "z", "return 'Z';" ], [["TEST"], "y", "this.begin('INITIAL'); return 'TY';" ] - ] + ], + macros: {}, + unknownDecls: [] }; lexer_reset(); @@ -276,7 +318,9 @@ exports["test unknown declarations"] = function () { ], rules: [ ['.', '//'] - ] + ], + macros: {}, + startConditions: {} }; assert.deepEqual(lex.parse(lexgrammar), expected, "unknown declarations should be parsed correctly"); @@ -288,7 +332,10 @@ exports["test no brace action"] = function () { rules: [ ["\\[[^\\]]\\]", "return true;"], ["x", "return 1;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -300,7 +347,10 @@ exports["test quote escape"] = function () { var expected = { rules: [ ["\"'x", "return 1;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -316,7 +366,10 @@ exports["test escape things"] = function () { ["\\cA", ""], ["\\012", ""], ["\\xFF", ""] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -328,7 +381,10 @@ exports["test unicode encoding"] = function () { var expected = { rules: [ ["\\u03c0", "return 1;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -340,7 +396,10 @@ exports["test unicode"] = function () { var expected = { rules: [ ["Ï€", "return 1;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -353,7 +412,10 @@ exports["test unquoted lexer rule literals"] = function () { rules: [ ["Ï€", "return 1;"], ["-abc", "return 2;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -365,7 +427,10 @@ exports["test bugs"] = function () { var expected = { rules: [ ["'([^\\\\']+|\\\\(\\n|.))*?'", "return 1;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -377,7 +442,10 @@ exports["test special groupings"] = function () { var expected = { rules: [ ["(?:foo|bar)\\(\\)", "return 1;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -390,7 +458,10 @@ exports["test trailing code include"] = function () { rules: [ ['foo', "return bar;"] ], - moduleInclude: " var bar = 1;" + moduleInclude: " var bar = 1;", + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -402,7 +473,10 @@ exports["test empty or regex"] = function () { var expected = { rules: [ ["(|bar)(foo|)(|)", "return 1;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -415,7 +489,10 @@ exports["test options"] = function () { rules: [ ["foo", "return 1;"] ], - options: {flex: true} + options: {flex: true}, + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -428,7 +505,10 @@ exports["test if %options names with a hyphen are correctly recognized"] = funct rules: [ ["foo", "return 1;"] ], - options: {"token-stack": true} + options: {"token-stack": true}, + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -448,7 +528,10 @@ exports["test options with values"] = function () { s1: "s1value", s2: "s2value", "a-b-c": "d" // `%options camel-casing` is done very late in the game: see Jison.Generator source code. - } + }, + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -464,7 +547,10 @@ exports["test options with string values which have embedded quotes"] = function options: { s1: "s1\\\"val'ue", s2: "s2\\\\x\\'val\"ue" - } + }, + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -476,7 +562,10 @@ exports["test unquoted string rules"] = function () { var expected = { rules: [ ["foo*", "return 1"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -490,7 +579,10 @@ exports["test [^\\\\]"] = function () { ["\\[[^\\\\]\\]", "return true;"], ["f\"oo'bar", "return 'baz2';"], ['fo"obar', "return 'baz';"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -502,7 +594,10 @@ exports["test comments"] = function () { var expected = { rules: [ ["foo*", "return 1"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -514,7 +609,10 @@ exports["test rules with trailing escapes"] = function () { var expected = { rules: [ ["#[^\\n]*\\n", "/* ok */"], - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -527,22 +625,25 @@ exports["test no brace action with surplus whitespace between rules"] = function rules: [ ["a", "return true;"], ["b", "return 1;"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }; -`BR \r\n|\n|\r` - exports["test macro for commit SHA-1: 1246dbb75472cee8e4e91318cc5a0d4739a8fe12"] = function () { var lexgrammar = 'BR \\r\\n|\\n|\\r\n%%\r\n{BR} %{\r\nreturn true;\r\n%}\r\n'; var expected = { macros: {"BR": "\\r\\n|\\n|\\r"}, rules: [ ["{BR}", "\r\nreturn true;\r\n"] - ] + ], + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -554,7 +655,10 @@ exports["test windows line endings"] = function () { var expected = { rules: [ ["\\[[^\\]]\\]", "\r\nreturn true;\r\n"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -567,7 +671,10 @@ exports["test braced action with surplus whitespace between rules"] = function ( rules: [ ["a", " \nreturn true;\n"], ["b", " return 1;\n"] - ] + ], + macros: {}, + startConditions: {}, + unknownDecls: [] }; lexer_reset(); @@ -609,7 +716,9 @@ exports["test %options easy_keyword_rules"] = function () { ], options: { "easy_keyword_rules": true - } + }, + macros: {}, + unknownDecls: [] }; lexer_reset(); diff --git a/tests/lex/bnf.lex.json b/tests/lex/bnf.lex.json index be27992..1868212 100644 --- a/tests/lex/bnf.lex.json +++ b/tests/lex/bnf.lex.json @@ -20,5 +20,8 @@ ["<[^>]*>", "yytext = yytext.substr(1, yyleng-2); return 'ACTION';"], [".", "/* ignore bad characters */"], ["$", "return 'EOF';"] - ] + ], + "macros": {}, + "startConditions": {}, + "unknownDecls": [] } diff --git a/tests/lex/lex_grammar.lex.json b/tests/lex/lex_grammar.lex.json index 6c5ac3e..810f2e8 100644 --- a/tests/lex/lex_grammar.lex.json +++ b/tests/lex/lex_grammar.lex.json @@ -26,5 +26,8 @@ ["%\\{(.|\\n)*?\\}%", "yytext = yytext.substr(2, yyleng-4);return 'ACTION';"], [".", "/* ignore bad characters */"], ["$", "return 'EOF';"] - ] + ], + "macros": {}, + "startConditions": {}, + "unknownDecls": [] } From c64c9ee5779032ed2cb23ec7e275a46f63cb8da3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 3 Feb 2017 00:13:25 +0100 Subject: [PATCH 269/417] rebuild library files. --- lex-parser.js | 602 ++++++++++++++++++++++++-------------------------- 1 file changed, 294 insertions(+), 308 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index aa0bdc0..7b6caea 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -796,7 +796,7 @@ productions_: bp({ 1, 2, c, - [3, 3], + [14, 3], c, [21, 3], c, @@ -814,7 +814,7 @@ productions_: bp({ 0, 3, c, - [25, 3], + [28, 3], 1, 3, 3, @@ -845,9 +845,9 @@ switch (yystate) { case 1: /*! Production:: lex : init definitions rules_and_epilogue EOF */ this.$ = yyvstack[$0 - 1]; - if (yyvstack[$0 - 2][0]) this.$.macros = yyvstack[$0 - 2][0]; - if (yyvstack[$0 - 2][1]) this.$.startConditions = yyvstack[$0 - 2][1]; - if (yyvstack[$0 - 2][2]) this.$.unknownDecls = yyvstack[$0 - 2][2]; + this.$.macros = yyvstack[$0 - 2].macros; + this.$.startConditions = yyvstack[$0 - 2].startConditions; + this.$.unknownDecls = yyvstack[$0 - 2].unknownDecls; // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { @@ -896,23 +896,24 @@ case 6: this.$ = yyvstack[$0]; if (yyvstack[$0 - 1] != null) { if ('length' in yyvstack[$0 - 1]) { - this.$[0] = this.$[0] || {}; - this.$[0][yyvstack[$0 - 1][0]] = yyvstack[$0 - 1][1]; + this.$.macros[yyvstack[$0 - 1][0]] = yyvstack[$0 - 1][1]; } else if (yyvstack[$0 - 1].type === 'names') { - this.$[1] = this.$[1] || {}; for (var name in yyvstack[$0 - 1].names) { - this.$[1][name] = yyvstack[$0 - 1].names[name]; + this.$.startConditions[name] = yyvstack[$0 - 1].names[name]; } } else if (yyvstack[$0 - 1].type === 'unknown') { - this.$[2] = this.$[2] || []; - this.$[2].push(yyvstack[$0 - 1].body); + this.$.unknownDecls.push(yyvstack[$0 - 1].body); } } break; case 7: /*! Production:: definitions : ε */ - this.$ = [null, null]; + this.$ = { + macros: {}, // { hash table } + startConditions: {}, // { hash table } + unknownDecls: [] // [ array of [key,value] pairs } + }; break; case 8: @@ -926,8 +927,6 @@ case 9: /*! Production:: definition : START_INC names_inclusive */ case 10: /*! Production:: definition : START_EXC names_exclusive */ -case 21: - /*! Production:: rules : rules_collective */ case 28: /*! Production:: action : unbracketed_action_body */ case 29: @@ -994,6 +993,13 @@ case 20: this.$ = yyvstack[$0 - 1].concat(yyvstack[$0]); break; +case 21: + /*! Production:: rules : ε */ +case 25: + /*! Production:: rule_block : ε */ + this.$ = []; + break; + case 22: /*! Production:: rules_collective : start_conditions rule */ if (yyvstack[$0 - 1]) { @@ -1017,11 +1023,6 @@ case 24: this.$ = $rules; this.$.push(yyvstack[$0]); break; -case 25: - /*! Production:: rule_block : ε */ - this.$ = []; - break; - case 27: /*! Production:: action : "{" action_body "}" */ case 36: @@ -1294,9 +1295,6 @@ table: bt({ 3, 1, 19, - 17, - 23, - 3, 32, 29, 11, @@ -1321,20 +1319,25 @@ table: bt({ 2, 6, 17, - 17, - 15, - 6, - 2, - 1, - 2, + 23, + 3, c, - [30, 4], + [26, 4], 1, s, [2, 3], 1, s, [3, 3], + 17, + 15, + 6, + 2, + 1, + 2, + 4, + 6, + 3, 23, 18, 5, @@ -1342,17 +1345,15 @@ table: bt({ 18, 19, 14, + c, + [108, 3], 1, - 14, - 4, - 6, - 3, 17, 14, 2, 19, - c, - [103, 4] + 2, + 18 ]), symbol: u([ 1, @@ -1407,14 +1408,15 @@ table: bt({ 20, 73, 74, - 1, - 3, + c, + [107, 3], 5, c, - [78, 13], + [79, 6], + 19, + c, + [80, 7], 50, - 51, - 58, 1, 19, c, @@ -1423,11 +1425,11 @@ table: bt({ 10, 11, c, - [41, 4], + [40, 5], c, - [17, 6], + [17, 5], c, - [47, 7], + [45, 7], 37, 40, c, @@ -1456,7 +1458,7 @@ table: bt({ c, [22, 22], c, - [171, 12], + [249, 12], c, [17, 22], c, @@ -1485,9 +1487,9 @@ table: bt({ 3, 4, c, - [574, 7], + [573, 8], c, - [504, 15], + [504, 14], 42, c, [26, 26], @@ -1500,36 +1502,20 @@ table: bt({ 20, 38, c, - [740, 3], - c, - [34, 8], - c, - [29, 7], - c, - [634, 3], - c, - [19, 16], - c, - [599, 3], - c, - [480, 11], - 53, - c, - [747, 8], - 7, - 20, - 59, + [633, 18], + 51, + 58, c, - [626, 61], + [583, 61], 1, 3, 11, c, - [727, 10], + [684, 10], c, [11, 11], c, - [514, 138], + [471, 138], 11, 11, c, @@ -1540,19 +1526,19 @@ table: bt({ 29, 31, c, - [546, 4], + [503, 4], c, [6, 3], c, [3, 3], c, - [457, 30], + [414, 30], c, - [456, 4], + [413, 4], c, - [1074, 3], + [1031, 3], c, - [459, 5], + [416, 5], c, [18, 8], 38, @@ -1565,12 +1551,38 @@ table: bt({ 77, 78, c, - [398, 17], + [374, 17], + c, + [371, 3], c, - [17, 17], + [835, 11], + 53, + c, + [1102, 8], + 7, + 20, + 59, + c, + [326, 95], + 31, + 3, + 4, + 20, + c, + [525, 3], + 1, + 1, + 40, + 76, + c, + [155, 3], + c, + [3, 4], + c, + [155, 16], 4, c, - [415, 13], + [155, 13], 52, 3, 23, @@ -1584,64 +1596,48 @@ table: bt({ 6, 8, c, - [343, 95], - 31, - 3, - 4, - 20, + [220, 3], + 57, c, - [585, 3], - 1, - 1, + [208, 7], 40, - 76, - c, - [172, 3], - c, - [3, 3], + 42, c, - [138, 14], + [39, 14], c, - [553, 9], + [194, 9], c, - [647, 11], + [643, 11], c, - [594, 8], + [235, 8], c, - [1314, 6], + [1310, 6], c, [23, 9], 23, c, - [220, 9], + [24, 7], c, - [42, 16], + [42, 18], c, [37, 19], c, - [655, 14], + [296, 14], 20, c, [15, 14], c, - [90, 3], - 57, - c, - [313, 7], + [364, 4], c, - [768, 4], - c, - [299, 29], + [191, 31], 3, 4, c, - [94, 19], + [85, 19], 6, 8, c, - [392, 4], - c, - [137, 18] + [124, 18] ]), type: u([ s, @@ -1670,19 +1666,19 @@ table: bt({ s, [2, 30], c, - [45, 18], + [45, 20], c, - [94, 16], + [64, 44], c, - [67, 35], + [127, 8], c, - [51, 27], + [29, 29], c, - [156, 9], + [32, 27], c, - [65, 28], + [112, 19], c, - [51, 36], + [51, 22], c, [22, 20], c, @@ -1694,37 +1690,35 @@ table: bt({ c, [190, 23], c, - [213, 33], - s, - [0, 9], - c, - [565, 17], + [583, 77], c, - [626, 61], - c, - [321, 179], + [278, 179], c, [29, 33], c, - [546, 44], + [503, 44], c, [43, 21], c, - [611, 51], + [65, 34], + s, + [0, 9], c, - [1150, 6], + [337, 108], c, - [349, 111], + [106, 38], c, - [111, 21], + [1245, 6], c, - [553, 11], + [44, 9], c, - [616, 52], + [15, 15], c, - [141, 61], + [194, 20], c, - [258, 82] + [612, 45], + s, + [2, 137] ]), state: u([ s, @@ -1750,67 +1744,65 @@ table: bt({ 47, 48, 51, - 52, 53, - 56, c, - [14, 4], - 57, - 58, + [12, 4], + 54, + 55, c, - [22, 6], - 62, - 64, + [20, 6], + 59, + 61, c, [9, 7], - 65, + 62, c, [8, 7], - 66, + 63, c, [5, 4], - 67, + 64, c, [5, 4], - 71, 68, - 69, - 78, + 65, + 66, + 75, 48, + 78, + 79, 81, - 53, - 82, - 84, c, - [65, 7], + [42, 8], + 59, + 59, + 68, 85, - 88, - c, - [52, 8], - 62, - 62, - 71, - 92, - 69, - 93, + 66, + 86, 44, + 89, + 91, + 90, + 93, + 95, + c, + [82, 7], 96, - 98, - 97, 100, - 101, + 102, 103, - 104, - 110, - 113, - c, - [34, 8], + 105, + 106, + 111, + 112, + 91, + 90, 114, - 44, - 117, - 118, - 98, - 97 + c, + [19, 8], + 115, + 44 ]), mode: u([ s, @@ -1828,15 +1820,13 @@ table: bt({ s, [2, 43], c, - [74, 7], - c, - [43, 38], + [47, 45], c, - [46, 6], + [117, 4], c, - [56, 9], + [48, 9], c, - [13, 7], + [108, 11], c, [24, 25], c, @@ -1846,7 +1836,7 @@ table: bt({ c, [50, 11], c, - [176, 10], + [178, 10], s, [1, 35], s, @@ -1862,43 +1852,43 @@ table: bt({ c, [133, 53], c, - [580, 9], + [656, 5], c, - [518, 8], + [80, 11], c, - [623, 28], + [69, 10], c, - [470, 14], + [541, 50], c, - [574, 50], - c, - [458, 166], + [425, 166], c, [192, 28], c, - [794, 30], + [761, 30], c, [117, 63], c, - [53, 47], + [961, 18], + c, + [806, 108], c, - [860, 102], + [458, 9], c, - [481, 9], + [429, 37], c, - [253, 8], + [148, 13], c, - [987, 44], + [278, 6], c, - [160, 59], + [173, 44], c, - [59, 20], + [206, 59], c, - [79, 35], + [59, 17], c, - [148, 25], + [109, 34], c, - [24, 20] + [110, 40] ]), goto: u([ s, @@ -1946,10 +1936,8 @@ table: bt({ 45, 49, 50, - 38, - 54, s, - [38, 13], + [21, 17], 6, 6, s, @@ -1958,15 +1946,15 @@ table: bt({ [41, 10], 46, 46, - 55, + 52, 23, 46, c, - [102, 4], + [104, 4], s, [46, 6], c, - [108, 7], + [110, 7], 46, 46, 43, @@ -1984,14 +1972,14 @@ table: bt({ 43, 48, 48, - 60, + 57, s, [48, 3], - 59, - 61, + 56, + 58, s, [48, 15], - 63, + 60, s, [48, 4], c, @@ -2001,7 +1989,7 @@ table: bt({ c, [14, 14], c, - [202, 12], + [204, 12], c, [12, 12], s, @@ -2021,7 +2009,7 @@ table: bt({ s, [64, 30], 34, - 70, + 67, s, [72, 28], s, @@ -2030,59 +2018,54 @@ table: bt({ [70, 28], s, [9, 8], - 72, + 69, 9, 9, s, [16, 11], s, [10, 8], - 73, + 70, 10, 10, s, [18, 11], - 75, - 74, + 72, + 71, 32, 32, - 76, + 73, s, [82, 26], s, [83, 26], - 77, + 74, 49, 76, - 79, + 76, 77, 77, 1, 3, - c, - [586, 8], + 38, 80, s, - [38, 7], + [38, 6], + 77, s, - [21, 17], - 83, - c, - [682, 13], - 86, - 87, + [38, 7], c, - [574, 24], + [541, 24], 47, 47, - 60, + 57, s, [47, 3], - 59, - 61, + 56, + 58, s, [47, 15], - 63, + 60, s, [47, 4], s, @@ -2099,36 +2082,36 @@ table: bt({ [57, 28], s, [71, 28], - 89, - 90, + 82, + 83, 54, 54, - 60, + 57, s, [54, 3], - 59, - 61, + 56, + 58, s, [54, 15], - 63, + 60, s, [54, 4], 55, 55, - 60, + 57, s, [55, 3], - 59, - 61, + 56, + 58, s, [55, 15], - 63, + 60, s, [55, 4], - 91, + 84, 34, 67, - 70, + 67, s, [68, 3], s, @@ -2146,25 +2129,17 @@ table: bt({ s, [74, 10], 75, - 95, - 94, - 87, - 87, - 99, - s, - [20, 17], + 88, s, - [22, 17], + [87, 3], + 92, s, - [25, 14], - 102, - 105, - 13, - 106, - 107, - 108, - 39, - 39, + [20, 17], + 94, + c, + [1020, 13], + 97, + 98, s, [44, 11], s, @@ -2174,8 +2149,8 @@ table: bt({ s, [65, 28], 66, - 75, - 109, + 72, + 99, 78, 78, 79, @@ -2185,19 +2160,37 @@ table: bt({ 13, 86, 86, - 111, + 101, s, [84, 3], - 112, + s, + [22, 17], + s, + [25, 14], + 104, + 107, + 13, + 108, + 109, + 110, + 39, + 39, + s, + [34, 3], c, - [519, 13], + [189, 3], + s, + [85, 3], + 113, + c, + [175, 13], s, [26, 18], s, [34, 3], s, [28, 11], - 115, + 116, s, [28, 7], s, @@ -2206,29 +2199,23 @@ table: bt({ [30, 19], s, [36, 14], - 116, + 117, s, [37, 14], - s, - [34, 3], - c, - [293, 3], - s, - [85, 3], + 33, + 33, + 73, + 81, s, [23, 17], s, [24, 14], - 75, - 119, + 72, + 118, s, [31, 19], 40, 40, - 33, - 33, - 76, - 81, s, [27, 18] ]) @@ -2238,9 +2225,8 @@ defaultActions: bda({ 0, s, [8, 5, 1], - 17, - 18, - 19, + s, + [16, 4, 1], s, [27, 8, 1], 36, @@ -2251,40 +2237,41 @@ defaultActions: bda({ 45, 46, 50, - 52, s, - [57, 7, 1], + [54, 7, 1], s, - [70, 9, 1], - 81, - 82, - 83, + [67, 9, 1], + 78, s, - [87, 6, 1], + [81, 5, 1], + 87, + 88, + 89, + 92, + 93, 94, - 95, - 96, + 98, 99, 101, - 102, + 103, 104, - 105, 106, + 107, 108, - 109, - 111, + 110, 112, 113, - 115, + 114, 116, - 118, - 119 + 117, + 118 ]), goto: u([ 5, 34, s, [12, 4, 1], + 21, 6, 8, 41, @@ -2299,7 +2286,6 @@ defaultActions: bda({ 82, 83, 1, - 21, 45, 42, 51, @@ -2317,9 +2303,6 @@ defaultActions: bda({ 74, 75, 20, - 22, - 25, - 39, 44, 49, 50, @@ -2329,19 +2312,22 @@ defaultActions: bda({ 79, 2, 84, + 22, + 25, + 39, + 34, + 85, 26, 34, 29, 30, 36, 37, - 34, - 85, + 81, 23, 24, 31, 40, - 81, 27 ]) }), @@ -3733,7 +3719,7 @@ case 16 : break; case 17 : /*! Conditions:: rules */ -/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ */ +/*! Rule:: {ANY_LITERAL_CHAR}+ */ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is @@ -3840,7 +3826,7 @@ case 37 : break; case 38 : /*! Conditions:: macro */ -/*! Rule:: [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ */ +/*! Rule:: {ANY_LITERAL_CHAR}+ */ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is @@ -4116,7 +4102,7 @@ new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, /^(?:([^\S\n\r])+)/, /^(?:%%)/, -/^(?:[^\s!"$%'-,.\/:-?\[-\^{-}]+)/, +/^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", ""), /^(?:=)/, /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, @@ -4137,7 +4123,7 @@ new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), /^(?:\/\/[^\r\n]*)/, new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), /^(?:(\r\n|\n|\r)+)/, -/^(?:[^\s!"$%'-,.\/:<-?\[-\^{-}]+)/, +/^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, /^(?:(\r\n|\n|\r)+)/, /^(?:\s+)/, /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, From da528cf966987569077e3c153017c6aeb42f20af Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 19 Feb 2017 15:14:54 +0100 Subject: [PATCH 270/417] synced README with latest lexer spec --- README.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 79354a1..5217112 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,12 @@ A parser for lexical grammars used by [jison](http://jison.org) and jison-lex. + ## install npm install lex-parser + ## build To build the parser yourself, clone the git repo then run: @@ -62,6 +64,10 @@ WS [^\S\r\n] QUOTED_STRING_CONTENT (?:\\\'|\\[^\']|[^\\\'])* DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* +// Accept any non-regex-special character as a direct literal without +// the need to put quotes around it: +ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] + %s indented trail rules macro %x code start_condition options conditions action path set @@ -111,7 +117,9 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* {WS}+{BR}+ /* empty */ {WS}+ this.pushState('indented'); "%%" this.pushState('code'); return '%%'; -[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";]+ +// Accept any non-regex-special character as a direct literal without +// the need to put quotes around it: +{ANY_LITERAL_CHAR}+ %{ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is @@ -165,7 +173,7 @@ DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* // Accept any non-regex-special character as a direct literal without // the need to put quotes around it: -[^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,'""]+ +{ANY_LITERAL_CHAR}+ %{ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is From 850ba1899aa25acbf89d1e2dae1f2e4e48ec7948 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 19 Feb 2017 15:21:22 +0100 Subject: [PATCH 271/417] migrated all tests to mocha+chai (in-browser test mode via tests/index.html is not working yet, but that wasn't available before either, so nothing is lost. All tests pass in node via `make` or `make test`) --- Makefile | 2 +- package.json | 3 +- tests/all-tests.js | 185 ++++++++++++++++++++++----------------------- tests/index.html | 25 ++++++ 4 files changed, 120 insertions(+), 95 deletions(-) create mode 100644 tests/index.html diff --git a/Makefile b/Makefile index 922c793..44c2ff1 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ lex-parser.js: lex.y lex.l sh node_modules/.bin/jison -o lex-parser.js lex.y lex.l test: - node tests/all-tests.js + node_modules/.bin/mocha tests/ # increment the XXX number in the package.json file: version ..- diff --git a/package.json b/package.json index 5e2f6a1..2233411 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,8 @@ "xregexp": "github:GerHobbelt/xregexp#master" }, "devDependencies": { + "chai": "3.5.0", "jison-gho": "github:GerHobbelt/jison#master", - "test": "0.6.0" + "mocha": "3.2.0" } } diff --git a/tests/all-tests.js b/tests/all-tests.js index 414bb07..ff9e137 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -1,7 +1,7 @@ -var assert = require("assert"), - lex = require("../lex-parser"), - fs = require('fs'), - path = require('path'); +var assert = require("chai").assert; +var lex = require("../lex-parser"); +var fs = require('fs'); +var path = require('path'); function read (p, file) { return fs.readFileSync(path.join(__dirname, p, file), "utf8"); @@ -21,7 +21,8 @@ function lexer_reset() { lex.parser.yy = {}; } -exports["test lex grammar with macros"] = function () { +describe("LEX Parser", function () { + it("test lex grammar with macros", function () { var lexgrammar = 'D [0-9]\nID [a-zA-Z_][a-zA-Z0-9_]+\n%%\n\n{D}"ohhai" {print(9);}\n"{" return \'{\';'; var expected = { macros: { @@ -38,9 +39,9 @@ exports["test lex grammar with macros"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test lex grammar with macros in regex sets"] = function () { + it("test lex grammar with macros in regex sets", function () { var lexgrammar = 'D [0-9]\nL [a-zA-Z]\nID [{L}_][{L}{D}_]+\n%%\n\n[{D}]"ohhai" {print(9);}\n"{" return \'{\';'; var expected = { macros: { @@ -58,9 +59,9 @@ exports["test lex grammar with macros in regex sets"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test rule-less grammar"] = function () { + it("test rule-less grammar", function () { var lexgrammar = '%export { D }\nD [0-9]'; var expected = { macros: { D: '[0-9]' }, @@ -69,9 +70,9 @@ exports["test rule-less grammar"] = function () { startConditions: {}, }; assert.deepEqual(lex.parse(lexgrammar), expected, 'grammar should be parsed correctly'); -}; + }); -exports["test escaped chars"] = function () { + it("test escaped chars", function () { var lexgrammar = '%%\n"\\n"+ {return \'NL\';}\n\\n+ {return \'NL2\';}\n\\s+ {/* skip */}'; var expected = { rules: [ @@ -86,9 +87,9 @@ exports["test escaped chars"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test advanced"] = function () { + it("test advanced", function () { var lexgrammar = '%%\n$ {return \'EOF\';}\n. {/* skip */}\n"stuff"*/("{"|";") {/* ok */}\n(.+)[a-z]{1,2}"hi"*? {/* skip */}\n'; var expected = { rules: [ @@ -104,9 +105,9 @@ exports["test advanced"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test [^\\]]"] = function () { + it("test [^\\]]", function () { var lexgrammar = '%%\n"["[^\\]]"]" {return true;}\n\'f"oo\\\'bar\' {return \'baz2\';}\n"fo\\"obar" {return \'baz\';}\n'; var expected = { rules: [ @@ -121,9 +122,9 @@ exports["test [^\\]]"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test multiline action"] = function () { + it("test multiline action", function () { var lexgrammar = '%%\n"["[^\\]]"]" %{\nreturn true;\n%}\n'; var expected = { rules: [ @@ -136,9 +137,9 @@ exports["test multiline action"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test multiline action with single braces"] = function () { + it("test multiline action with single braces", function () { var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b={};return true;\n}\n'; var expected = { rules: [ @@ -151,9 +152,9 @@ exports["test multiline action with single braces"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test multiline action with brace in a multi-line-comment"] = function () { + it("test multiline action with brace in a multi-line-comment", function () { var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b={}; /* { */ return true;\n}\n'; var expected = { rules: [ @@ -166,9 +167,9 @@ exports["test multiline action with brace in a multi-line-comment"] = function ( lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test multiline action with brace in a single-line-comment"] = function () { + it("test multiline action with brace in a single-line-comment", function () { var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b={}; // { \nreturn 2 / 3;\n}\n'; var expected = { rules: [ @@ -181,9 +182,9 @@ exports["test multiline action with brace in a single-line-comment"] = function lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test multiline action with braces in strings"] = function () { + it("test multiline action with braces in strings", function () { var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b=\'{\' + "{"; // { \nreturn 2 / 3;\n}\n'; var expected = { rules: [ @@ -196,9 +197,9 @@ exports["test multiline action with braces in strings"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test multiline action with braces in regexp"] = function () { + it("test multiline action with braces in regexp", function () { var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b=/{/; // { \nreturn 2 / 3;\n}\n'; var expected = { rules: [ @@ -211,9 +212,9 @@ exports["test multiline action with braces in regexp"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test multiline (indented) action without braces"] = function () { + it("test multiline (indented) action without braces", function () { var lexgrammar = '%%\n"["[^\\]]"]"\n var b=/{/;\n // { \n return 2 / 3;\n'; var expected = { rules: [ @@ -226,9 +227,9 @@ exports["test multiline (indented) action without braces"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test include"] = function () { + it("test include", function () { var lexgrammar = '\nRULE [0-9]\n\n%{\n hi \n%}\n%%\n"["[^\\]]"]" %{\nreturn true;\n%}\n'; var expected = { macros: {"RULE": "[0-9]"}, @@ -242,32 +243,32 @@ exports["test include"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test bnf lex grammar"] = function () { + it("test bnf lex grammar", function () { var lexgrammar = lex.parse(read('lex', 'bnf.jisonlex')); var expected = JSON.parse(read('lex', 'bnf.lex.json')); lexer_reset(); assert.deepEqual(lexgrammar, expected, "grammar should be parsed correctly"); -}; + }); -exports["test lex grammar bootstrap"] = function () { + it("test lex grammar bootstrap", function () { var lexgrammar = lex.parse(read('lex', 'lex_grammar.jisonlex')); var expected = JSON.parse(read('lex', 'lex_grammar.lex.json')); lexer_reset(); assert.deepEqual(lexgrammar, expected, "grammar should be parsed correctly"); -}; + }); -exports["test ANSI C lexical grammar"] = function () { + it("test ANSI C lexical grammar", function () { var lexgrammar = lex.parse(read('lex','ansic.jisonlex')); lexer_reset(); assert.ok(lexgrammar, "grammar should be parsed correctly"); -}; + }); -exports["test advanced"] = function () { + it("test advanced", function () { var lexgrammar = '%%\n"stuff"*/!("{"|";") {/* ok */}\n'; var expected = { rules: [ @@ -280,9 +281,9 @@ exports["test advanced"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test start conditions"] = function () { + it("test start conditions", function () { var lexgrammar = '%s TEST TEST2\n%x EAT\n%%\n'+ '"enter-test" {this.begin(\'TEST\');}\n'+ '"x" {return \'T\';}\n'+ @@ -306,9 +307,9 @@ exports["test start conditions"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test unknown declarations"] = function () { + it("test unknown declarations", function () { var lexgrammar = '%a b c\n%foo[bar] baz qux\n%a b c\n%%\n. //'; var expected = { unknownDecls: [ @@ -324,9 +325,9 @@ exports["test unknown declarations"] = function () { }; assert.deepEqual(lex.parse(lexgrammar), expected, "unknown declarations should be parsed correctly"); -}; + }); -exports["test no brace action"] = function () { + it("test no brace action", function () { var lexgrammar = '%%\n"["[^\\]]"]" return true;\n"x" return 1;'; var expected = { rules: [ @@ -340,9 +341,9 @@ exports["test no brace action"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test quote escape"] = function () { + it("test quote escape", function () { var lexgrammar = '%%\n\\"\\\'"x" return 1;'; var expected = { rules: [ @@ -355,9 +356,9 @@ exports["test quote escape"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test escape things"] = function () { + it("test escape things", function () { var lexgrammar = '%%\n\\"\\\'\\\\\\*\\i return 1;\n"a"\\b return 2;\n\\cA {}\n\\012 {}\n\\xFF {}'; var expected = { rules: [ @@ -374,9 +375,9 @@ exports["test escape things"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test unicode encoding"] = function () { + it("test unicode encoding", function () { var lexgrammar = '%%\n"\\u03c0" return 1;'; var expected = { rules: [ @@ -389,9 +390,9 @@ exports["test unicode encoding"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test unicode"] = function () { + it("test unicode", function () { var lexgrammar = '%%\n"Ï€" return 1;'; var expected = { rules: [ @@ -404,9 +405,9 @@ exports["test unicode"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test unquoted lexer rule literals"] = function () { + it("test unquoted lexer rule literals", function () { var lexgrammar = '%%\nÏ€ return 1;\n-abc return 2;'; var expected = { rules: [ @@ -420,9 +421,9 @@ exports["test unquoted lexer rule literals"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test bugs"] = function () { + it("test bugs", function () { var lexgrammar = '%%\n\\\'([^\\\\\']+|\\\\(\\n|.))*?\\\' return 1;'; var expected = { rules: [ @@ -435,9 +436,9 @@ exports["test bugs"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test special groupings"] = function () { + it("test special groupings", function () { var lexgrammar = '%%\n(?:"foo"|"bar")\\(\\) return 1;'; var expected = { rules: [ @@ -450,9 +451,9 @@ exports["test special groupings"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test trailing code include"] = function () { + it("test trailing code include", function () { var lexgrammar = '%%"foo" {return bar;}\n%% var bar = 1;'; var expected = { rules: [ @@ -466,9 +467,9 @@ exports["test trailing code include"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test empty or regex"] = function () { + it("test empty or regex", function () { var lexgrammar = '%%\n(|"bar")("foo"|)(|) return 1;'; var expected = { rules: [ @@ -481,9 +482,9 @@ exports["test empty or regex"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test options"] = function () { + it("test options", function () { var lexgrammar = '%options flex\n%%\n"foo" return 1;'; var expected = { rules: [ @@ -497,9 +498,9 @@ exports["test options"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test if %options names with a hyphen are correctly recognized"] = function () { + it("test if %options names with a hyphen are correctly recognized", function () { var lexgrammar = '%options token-stack\n%%\n"foo" return 1;'; var expected = { rules: [ @@ -513,9 +514,9 @@ exports["test if %options names with a hyphen are correctly recognized"] = funct lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test options with values"] = function () { + it("test options with values", function () { var lexgrammar = '%options ping=666 bla=blub bool1 s1="s1value" s2=\'s2value\' a-b-c="d"\n%%\n"foo" return 1;'; var expected = { rules: [ @@ -536,9 +537,9 @@ exports["test options with values"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test options with string values which have embedded quotes"] = function () { + it("test options with string values which have embedded quotes", function () { var lexgrammar = '%options s1="s1\\"val\'ue" s2=\'s2\\\\x\\\'val\"ue\'\n%%\n"foo" return 1;'; var expected = { rules: [ @@ -555,9 +556,9 @@ exports["test options with string values which have embedded quotes"] = function lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test unquoted string rules"] = function () { + it("test unquoted string rules", function () { var lexgrammar = "%%\nfoo* return 1"; var expected = { rules: [ @@ -570,9 +571,9 @@ exports["test unquoted string rules"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test [^\\\\]"] = function () { + it("test [^\\\\]", function () { var lexgrammar = '%%\n"["[^\\\\]"]" {return true;}\n\'f"oo\\\'bar\' {return \'baz2\';}\n"fo\\"obar" {return \'baz\';}\n'; var expected = { rules: [ @@ -587,9 +588,9 @@ exports["test [^\\\\]"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test comments"] = function () { + it("test comments", function () { var lexgrammar = "/* */ // foo\n%%\nfoo* return 1"; var expected = { rules: [ @@ -602,9 +603,9 @@ exports["test comments"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test rules with trailing escapes"] = function () { + it("test rules with trailing escapes", function () { var lexgrammar = '%%\n\\#[^\\n]*\\n {/* ok */}\n'; var expected = { rules: [ @@ -617,9 +618,9 @@ exports["test rules with trailing escapes"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test no brace action with surplus whitespace between rules"] = function () { + it("test no brace action with surplus whitespace between rules", function () { var lexgrammar = '%%\n"a" return true;\n \n"b" return 1;\n \n'; var expected = { rules: [ @@ -633,9 +634,9 @@ exports["test no brace action with surplus whitespace between rules"] = function lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test macro for commit SHA-1: 1246dbb75472cee8e4e91318cc5a0d4739a8fe12"] = function () { + it("test macro for commit SHA-1: 1246dbb75472cee8e4e91318cc5a0d4739a8fe12", function () { var lexgrammar = 'BR \\r\\n|\\n|\\r\n%%\r\n{BR} %{\r\nreturn true;\r\n%}\r\n'; var expected = { macros: {"BR": "\\r\\n|\\n|\\r"}, @@ -648,9 +649,9 @@ exports["test macro for commit SHA-1: 1246dbb75472cee8e4e91318cc5a0d4739a8fe12"] lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test windows line endings"] = function () { + it("test windows line endings", function () { var lexgrammar = '%%\r\n"["[^\\]]"]" %{\r\nreturn true;\r\n%}\r\n'; var expected = { rules: [ @@ -663,9 +664,9 @@ exports["test windows line endings"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test braced action with surplus whitespace between rules"] = function () { + it("test braced action with surplus whitespace between rules", function () { var lexgrammar = '%%\n"a" %{ \nreturn true;\n%} \n \n"b" %{ return 1;\n%} \n \n'; var expected = { rules: [ @@ -679,9 +680,9 @@ exports["test braced action with surplus whitespace between rules"] = function ( lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); -exports["test %options easy_keyword_rules"] = function () { + it("test %options easy_keyword_rules", function () { var lexgrammar = '%options easy_keyword_rules\n'+ '%s TEST TEST2\n%x EAT\n%%\n'+ '"enter-test" {this.begin(\'TEST\');}\n'+ @@ -723,8 +724,6 @@ exports["test %options easy_keyword_rules"] = function () { lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); -}; + }); +}); - -if (require.main === module) - require("test").run(exports); diff --git a/tests/index.html b/tests/index.html new file mode 100644 index 0000000..7c1eb0e --- /dev/null +++ b/tests/index.html @@ -0,0 +1,25 @@ + + + + LEX Parser Tests + + + + + +
+ + + + + + + + + + + From 4e5857374f2753cd5b877687816df56c922c3882 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 19 Feb 2017 17:06:53 +0100 Subject: [PATCH 272/417] regenerated library files --- lex-parser.js | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 7b6caea..a842094 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -180,19 +180,20 @@ * pastInput: function(n), * upcomingInput: function(n), * showPosition: function(), - * test_match: function(regex_match_array, rule_index), - * next: function(), - * lex: function(), + * test_match: function(regex_match_array, rule_index, ...), + * next: function(...), + * lex: function(...), * begin: function(condition), * pushState: function(condition), * popState: function(), * topState: function(), * _currentRules: function(), * stateStackSize: function(), + * cleanupAfterLex: function() * * options: { ... lexer %options ... }, * - * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), + * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...), * rules: [...], * conditions: {associative list: name ==> set}, * } @@ -250,24 +251,24 @@ * * while `this` will reference the current parser instance. * - * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* - * instance, while these additional `hash` fields will also be provided: + * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: * * { * lexer: (reference to the current lexer instance which reported the error) * } * - * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired - * from either the parser or lexer, `this` will still reference the related *parser* - * instance, while these additional `hash` fields will also be provided: + * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired + * from either the parser or lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: * * { * exception: (reference to the exception thrown) * } * - * Please do note that in the latter situation, the `expected` field will be omitted as - * type of failure is assumed not to be due to *parse errors* but rather due to user - * action code in either parser or lexer failing unexpectedly. + * Please do note that in the latter situation, the `expected` field will be omitted as + * type of failure is assumed not to be due to *parse errors* but rather due to user + * action code in either parser or lexer failing unexpectedly. * * --- * @@ -837,7 +838,7 @@ productions_: bp({ 0 ]) }), -performAction: function parser__PerformAction(yytext, yystate /* action[1] */, $0, yyvstack) { +performAction: function parser__PerformAction(yystate /* action[1] */, $0, yyvstack) { /* this == yyval */ var yy = this.yy; @@ -2402,7 +2403,7 @@ parse: function parse(input) { if (typeof lexer.yytext === 'undefined') { lexer.yytext = ''; } - var yytext = lexer.yytext; + if (typeof lexer.yylineno === 'undefined') { lexer.yylineno = 0; } @@ -2700,7 +2701,7 @@ parse: function parse(input) { // discard current lookahead and grab another - yytext = lexer.yytext; + @@ -2760,7 +2761,7 @@ parse: function parse(input) { if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: - yytext = lexer.yytext; + @@ -2821,7 +2822,7 @@ parse: function parse(input) { - r = this.performAction.call(yyval, yytext, newState, sp - 1, vstack); + r = this.performAction.call(yyval, newState, sp - 1, vstack); if (typeof r !== 'undefined') { retval = r; From d1f7ec63efa0f5d202a0d59ad8d284a564d9c6ab Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 20 Feb 2017 21:09:55 +0100 Subject: [PATCH 273/417] feature: allow `%options` to spread across multiple lines, as long as they're indented and no empty lines in between. Also allow option values to be boolean `false`, `true` or any *finite* numeric value, e.g. `%options debug=3` --- lex-parser.js | 777 ++++++++++++++++++++++++--------------------- lex.l | 17 +- lex.y | 28 +- tests/all-tests.js | 31 +- 4 files changed, 476 insertions(+), 377 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index a842094..1131692 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -522,16 +522,17 @@ symbols_: { "ACTION": 23, "ACTION_BODY": 26, "CHARACTER_LIT": 36, - "CODE": 42, + "CODE": 43, "EOF": 1, "ESCAPE_CHAR": 33, - "INCLUDE": 40, + "INCLUDE": 41, "NAME": 20, "NAME_BRACE": 29, "OPTIONS": 37, "OPTIONS_END": 38, - "OPTION_VALUE": 39, - "PATH": 41, + "OPTION_STRING_VALUE": 39, + "OPTION_VALUE": 40, + "PATH": 42, "RANGE_REGEX": 34, "REGEX_SET": 32, "REGEX_SET_END": 31, @@ -543,43 +544,43 @@ symbols_: { "STRING_LIT": 35, "UNKNOWN_DECL": 24, "^": 16, - "action": 54, - "action_body": 56, - "action_comments_body": 57, - "any_group_regex": 66, - "definition": 47, - "definitions": 46, + "action": 55, + "action_body": 57, + "action_comments_body": 58, + "any_group_regex": 67, + "definition": 48, + "definitions": 47, "error": 2, - "escape_char": 69, - "extra_lexer_module_code": 75, - "include_macro_code": 76, - "init": 45, - "lex": 43, - "module_code_chunk": 77, - "name_expansion": 65, - "name_list": 59, - "names_exclusive": 49, - "names_inclusive": 48, - "nonempty_regex_list": 62, - "option": 74, - "option_list": 73, - "optional_module_code_chunk": 78, - "options": 72, - "range_regex": 70, - "regex": 60, - "regex_base": 64, - "regex_concat": 63, - "regex_list": 61, - "regex_set": 67, - "regex_set_atom": 68, - "rule": 53, - "rule_block": 52, - "rules": 50, - "rules_and_epilogue": 44, - "rules_collective": 51, - "start_conditions": 58, - "string": 71, - "unbracketed_action_body": 55, + "escape_char": 70, + "extra_lexer_module_code": 76, + "include_macro_code": 77, + "init": 46, + "lex": 44, + "module_code_chunk": 78, + "name_expansion": 66, + "name_list": 60, + "names_exclusive": 50, + "names_inclusive": 49, + "nonempty_regex_list": 63, + "option": 75, + "option_list": 74, + "optional_module_code_chunk": 79, + "options": 73, + "range_regex": 71, + "regex": 61, + "regex_base": 65, + "regex_concat": 64, + "regex_list": 62, + "regex_set": 68, + "regex_set_atom": 69, + "rule": 54, + "rule_block": 53, + "rules": 51, + "rules_and_epilogue": 45, + "rules_collective": 52, + "start_conditions": 59, + "string": 72, + "unbracketed_action_body": 56, "{": 3, "|": 9, "}": 4 @@ -623,10 +624,11 @@ terminals_: { 36: "CHARACTER_LIT", 37: "OPTIONS", 38: "OPTIONS_END", - 39: "OPTION_VALUE", - 40: "INCLUDE", - 41: "PATH", - 42: "CODE" + 39: "OPTION_STRING_VALUE", + 40: "OPTION_VALUE", + 41: "INCLUDE", + 42: "PATH", + 43: "CODE" }, TERROR: 2, EOF: 1, @@ -718,16 +720,14 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do }, productions_: bp({ pop: u([ - 43, + 44, s, - [44, 3], - 45, - 46, + [45, 3], 46, + 47, + 47, s, - [47, 8], - 48, - 48, + [48, 8], 49, 49, 50, @@ -737,48 +737,50 @@ productions_: bp({ 52, 52, 53, + 53, + 54, s, - [54, 3], - 55, - 55, + [55, 3], 56, 56, 57, 57, + 58, + 58, s, - [58, 3], - 59, - 59, + [59, 3], + 60, 60, 61, - 61, + 62, + 62, s, - [62, 3], - 63, - 63, + [63, 3], + 64, + 64, s, - [64, 15], - 65, + [65, 15], 66, 67, - 67, 68, + 68, + 69, s, - [68, 4, 1], - 71, + [69, 4, 1], 72, 73, - 73, + 74, + 74, s, - [74, 3], - 75, - 75, + [75, 4], 76, 76, 77, 77, 78, - 78 + 78, + 79, + 79 ]), rule: u([ 4, @@ -829,12 +831,12 @@ productions_: bp({ [21, 3], c, [9, 10], - 3, - 3, + s, + [3, 3], c, - [7, 3], + [8, 3], c, - [28, 4], + [29, 4], 0 ]) }), @@ -938,11 +940,11 @@ case 70: /*! Production:: escape_char : ESCAPE_CHAR */ case 71: /*! Production:: range_regex : RANGE_REGEX */ -case 80: +case 81: /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 84: +case 85: /*! Production:: module_code_chunk : CODE */ -case 86: +case 87: /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = yyvstack[$0]; break; @@ -1045,7 +1047,7 @@ case 34: /*! Production:: action_comments_body : ε */ case 43: /*! Production:: regex_list : ε */ -case 87: +case 88: /*! Production:: optional_module_code_chunk : ε */ this.$ = ''; break; @@ -1058,7 +1060,7 @@ case 57: /*! Production:: regex_base : regex_base range_regex */ case 66: /*! Production:: regex_set : regex_set_atom regex_set */ -case 85: +case 86: /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = yyvstack[$0 - 1] + yyvstack[$0]; break; @@ -1202,7 +1204,7 @@ case 61: case 65: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 81: +case 82: /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; break; @@ -1231,13 +1233,18 @@ case 77: break; case 78: - /*! Production:: option : NAME "=" OPTION_VALUE */ + /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ + yy.options[yyvstack[$0 - 2]] = yyvstack[$0]; + break; + case 79: + /*! Production:: option : NAME "=" OPTION_VALUE */ +case 80: /*! Production:: option : NAME "=" NAME */ - yy.options[yyvstack[$0 - 2]] = yyvstack[$0]; + yy.options[yyvstack[$0 - 2]] = parseValue(yyvstack[$0]); break; -case 82: +case 83: /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); var fileContent = fs.readFileSync(yyvstack[$0], { encoding: 'utf-8' }); @@ -1245,7 +1252,7 @@ case 82: this.$ = '\n// Included by Jison: ' + yyvstack[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[$0] + '\n\n'; break; -case 83: +case 84: /*! Production:: include_macro_code : INCLUDE error */ console.error("%include MUST be followed by a valid file path"); break; @@ -1317,7 +1324,7 @@ table: bt({ 3, 10, 1, - 2, + 3, 6, 17, 23, @@ -1326,7 +1333,7 @@ table: bt({ [26, 4], 1, s, - [2, 3], + [2, 4], 1, s, [3, 3], @@ -1347,7 +1354,7 @@ table: bt({ 19, 14, c, - [108, 3], + [109, 3], 1, 17, 14, @@ -1362,19 +1369,19 @@ table: bt({ s, [19, 6, 1], 37, - 40, - 43, - 45, + 41, + 44, + 46, 1, c, [13, 10], - 46, 47, - 72, - 76, + 48, + 73, + 77, 1, 19, - 44, + 45, c, [17, 14], 9, @@ -1386,29 +1393,29 @@ table: bt({ 33, 35, 36, - 60, + 61, s, - [62, 5, 1], - 69, - 71, - 25, - 48, + [63, 5, 1], + 70, + 72, 25, 49, + 25, + 50, 3, 4, 26, - 56, 57, + 58, c, [44, 10], c, [10, 30], 2, - 41, + 42, 20, - 73, 74, + 75, c, [107, 3], 5, @@ -1417,7 +1424,7 @@ table: bt({ 19, c, [80, 7], - 50, + 51, 1, 19, c, @@ -1432,13 +1439,13 @@ table: bt({ c, [45, 7], 37, - 40, + 41, c, [124, 5], c, [29, 24], s, - [61, 6, 1], + [62, 6, 1], c, [32, 4], 7, @@ -1448,8 +1455,8 @@ table: bt({ [35, 11], s, [34, 4, 1], - 40, - 70, + 41, + 71, c, [59, 7], c, @@ -1468,12 +1475,12 @@ table: bt({ [28, 190], s, [31, 7, 1], - 40, + 41, 29, 32, - 65, - 67, + 66, 68, + 69, c, [119, 86], s, @@ -1491,21 +1498,21 @@ table: bt({ [573, 8], c, [504, 14], - 42, + 43, c, [26, 26], 38, 20, 38, - 73, 74, + 75, 18, 20, 38, c, [633, 18], - 51, - 58, + 52, + 59, c, [583, 61], 1, @@ -1545,74 +1552,75 @@ table: bt({ 38, 20, 39, - 1, 40, - 42, - 75, - 77, + 1, + 41, + 43, + 76, 78, + 79, c, - [374, 17], + [375, 17], c, - [371, 3], + [372, 3], c, - [835, 11], - 53, + [836, 11], + 54, c, - [1102, 8], + [1103, 8], 7, 20, - 59, + 60, c, - [326, 95], + [327, 95], 31, 3, 4, 20, c, - [525, 3], - 1, - 1, - 40, - 76, + [526, 3], c, - [155, 3], + [523, 4], + 41, + 77, + c, + [157, 3], c, [3, 4], c, - [155, 16], + [157, 16], 4, c, - [155, 13], - 52, + [157, 13], + 53, 3, 23, - 40, - 54, + 41, 55, - 76, + 56, + 77, 6, 8, 6, 6, 8, c, - [220, 3], - 57, + [223, 3], + 58, c, - [208, 7], - 40, - 42, + [210, 7], + 41, + 43, c, [39, 14], c, - [194, 9], + [196, 9], c, - [643, 11], + [646, 11], c, - [235, 8], + [237, 8], c, - [1310, 6], + [1313, 6], c, [23, 9], 23, @@ -1623,12 +1631,12 @@ table: bt({ c, [37, 19], c, - [296, 14], + [298, 14], 20, c, [15, 14], c, - [364, 4], + [367, 4], c, [191, 31], 3, @@ -1699,25 +1707,25 @@ table: bt({ c, [503, 44], c, - [43, 21], + [43, 22], c, - [65, 34], + [66, 34], s, [0, 9], c, - [337, 108], + [338, 110], c, - [106, 38], + [108, 38], c, - [1245, 6], + [1248, 6], c, [44, 9], c, [15, 15], c, - [194, 20], + [196, 20], c, - [612, 45], + [615, 45], s, [2, 137] ]), @@ -1782,27 +1790,27 @@ table: bt({ 66, 86, 44, - 89, - 91, 90, - 93, - 95, + 92, + 91, + 94, + 96, c, [82, 7], - 96, - 100, - 102, + 97, + 101, 103, - 105, + 104, 106, - 111, + 107, 112, + 113, + 92, 91, - 90, - 114, + 115, c, [19, 8], - 115, + 116, 44 ]), mode: u([ @@ -1867,23 +1875,23 @@ table: bt({ c, [761, 30], c, - [117, 63], + [117, 57], c, - [961, 18], + [413, 21], c, - [806, 108], + [807, 112], c, - [458, 9], + [98, 10], c, - [429, 37], + [556, 38], c, - [148, 13], + [150, 13], c, - [278, 6], + [281, 6], c, - [173, 44], + [175, 44], c, - [206, 59], + [208, 59], c, [59, 17], c, @@ -2037,9 +2045,9 @@ table: bt({ 32, 73, s, - [82, 26], - s, [83, 26], + s, + [84, 26], 74, 49, 76, @@ -2130,17 +2138,18 @@ table: bt({ s, [74, 10], 75, - 88, + 89, + 87, s, - [87, 3], - 92, + [88, 3], + 93, s, [20, 17], - 94, + 95, c, - [1020, 13], - 97, + [1021, 13], 98, + 99, s, [44, 11], s, @@ -2151,47 +2160,49 @@ table: bt({ [65, 28], 66, 72, - 99, + 100, 78, 78, 79, 79, - 2, 80, + 80, + 2, + 81, 13, - 86, - 86, - 101, + 87, + 87, + 102, s, - [84, 3], + [85, 3], s, [22, 17], s, [25, 14], - 104, - 107, - 13, + 105, 108, + 13, 109, 110, + 111, 39, 39, s, [34, 3], c, - [189, 3], + [191, 3], s, - [85, 3], - 113, + [86, 3], + 114, c, - [175, 13], + [177, 13], s, [26, 18], s, [34, 3], s, [28, 11], - 116, + 117, s, [28, 7], s, @@ -2200,19 +2211,19 @@ table: bt({ [30, 19], s, [36, 14], - 117, + 118, s, [37, 14], 33, 33, 73, - 81, + 82, s, [23, 17], s, [24, 14], 72, - 118, + 119, s, [31, 19], 40, @@ -2245,27 +2256,26 @@ defaultActions: bda({ 78, s, [81, 5, 1], - 87, - 88, - 89, - 92, + s, + [87, 4, 1], 93, 94, - 98, + 95, 99, - 101, - 103, + 100, + 102, 104, - 106, + 105, 107, 108, - 110, - 112, + 109, + 111, 113, 114, - 116, + 115, 117, - 118 + 118, + 119 ]), goto: u([ 5, @@ -2284,8 +2294,8 @@ defaultActions: bda({ 70, 16, 18, - 82, 83, + 84, 1, 45, 42, @@ -2311,20 +2321,21 @@ defaultActions: bda({ 66, 78, 79, + 80, 2, - 84, + 85, 22, 25, 39, 34, - 85, + 86, 26, 34, 29, 30, 36, 37, - 81, + 82, 23, 24, 31, @@ -2903,7 +2914,28 @@ function prepareString (s) { s = s.replace(/\\\\/g, "\\"); s = encodeRE(s); return s; -}; +} + +// convert string value to number or boolean value, when possible +// (and when this is more or less obviously the intent) +// otherwise produce the string itself as value. +function parseValue(v) { + if (v === 'false') { + return false; + } + if (v === 'true') { + return true; + } + // http://stackoverflow.com/questions/175739/is-there-a-built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number + // Note that the `v` check ensures that we do not convert `undefined`, `null` and `''` (empty string!) + if (v && !isNaN(v)) { + var rv = +v; + if (isFinite(rv)) { + return rv; + } + } + return v; +} /* generated by jison-lex 0.3.4-166 */ var lexer = (function () { // See also: @@ -3685,11 +3717,11 @@ case 8 : /*! Conditions:: action */ /*! Rule:: \} */ - if (yy.depth == 0) { - this.pushState('trail'); - } else { - yy.depth--; - } + if (yy.depth == 0) { + this.pushState('trail'); + } else { + yy.depth--; + } return 4; break; @@ -3730,54 +3762,69 @@ break; case 20 : /*! Conditions:: options */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 39; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 39; // value is always a string type break; case 21 : /*! Conditions:: options */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 39; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 39; // value is always a string type +break; +case 22 : +/*! Conditions:: INITIAL start_condition trail rules macro path options */ +/*! Rule:: \/\/[^\r\n]* */ + /* skip single-line comment */ break; case 23 : +/*! Conditions:: INITIAL start_condition trail rules macro path options */ +/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /* skip multi-line comment */ +break; +case 25 : /*! Conditions:: options */ -/*! Rule:: {BR}+ */ +/*! Rule:: {BR}{WS}+(?=\S) */ + /* skip leading whitespace on the next line of input, when followed by more options */ +break; +case 26 : +/*! Conditions:: options */ +/*! Rule:: {BR} */ this.popState(); return 38; break; -case 24 : +case 27 : /*! Conditions:: options */ /*! Rule:: {WS}+ */ /* skip whitespace */ break; -case 26 : +case 29 : /*! Conditions:: start_condition */ /*! Rule:: {BR}+ */ this.popState(); break; -case 27 : +case 30 : /*! Conditions:: start_condition */ /*! Rule:: {WS}+ */ /* empty */ break; -case 28 : +case 31 : /*! Conditions:: trail */ /*! Rule:: {WS}*{BR}+ */ this.pushState('rules'); break; -case 29 : +case 32 : /*! Conditions:: indented */ /*! Rule:: \{ */ yy.depth = 0; this.pushState('action'); return 3; break; -case 30 : +case 33 : /*! Conditions:: indented */ /*! Rule:: %\{(.|{BR})*?%\} */ this.pushState('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; break; -case 31 : +case 34 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %\{(.|{BR})*?%\} */ yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; break; -case 32 : +case 35 : /*! Conditions:: indented */ /*! Rule:: %include\b */ @@ -3797,35 +3844,25 @@ case 32 : this.pushState('trail'); // then push the immediate need: the 'path' condition. this.pushState('path'); - return 40; + return 41; break; -case 33 : +case 36 : /*! Conditions:: indented */ /*! Rule:: .* */ this.popState(); return 23; break; -case 34 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - /* ignore */ -break; -case 35 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \/\/[^\r\n]* */ - /* ignore */ -break; -case 36 : +case 37 : /*! Conditions:: INITIAL */ /*! Rule:: {ID} */ this.pushState('macro'); return 20; break; -case 37 : +case 38 : /*! Conditions:: macro */ /*! Rule:: {BR}+ */ this.popState('macro'); break; -case 38 : +case 39 : /*! Conditions:: macro */ /*! Rule:: {ANY_LITERAL_CHAR}+ */ @@ -3834,77 +3871,77 @@ case 38 : return 36; break; -case 39 : +case 40 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: {BR}+ */ /* empty */ break; -case 40 : +case 41 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \s+ */ /* empty */ break; -case 41 : +case 42 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 35; break; -case 42 : +case 43 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 35; break; -case 43 : +case 44 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \[ */ this.pushState('set'); return 30; break; -case 56 : +case 57 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: < */ this.pushState('conditions'); return 5; break; -case 57 : +case 58 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/! */ return 28; // treated as `(?!atom)` break; -case 58 : +case 59 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \/ */ return 14; // treated as `(?=atom)` break; -case 60 : +case 61 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\. */ yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 33; break; -case 63 : +case 64 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %options\b */ this.pushState('options'); return 37; break; -case 64 : +case 65 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %s\b */ this.pushState('start_condition'); return 21; break; -case 65 : +case 66 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %x\b */ this.pushState('start_condition'); return 22; break; -case 66 : +case 67 : /*! Conditions:: INITIAL trail code */ /*! Rule:: %include\b */ - this.pushState('path'); return 40; + this.pushState('path'); return 41; break; -case 67 : +case 68 : /*! Conditions:: INITIAL rules trail code */ /*! Rule:: %{NAME}([^\r\n]*) */ /* ignore unrecognized decl */ - console.warn('LEX: ignoring unsupported lexer option: ', yy_.yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + console.warn('LEX: ignoring unsupported lexer option: ', yy_.yytext, ' while lexing in ', this.topState(), ' state:', this._input, ' /////// ', this.matched); // this.pushState('options'); yy_.yytext = [ this.matches[1], // {NAME} @@ -3913,47 +3950,47 @@ case 67 : return 24; break; -case 68 : +case 69 : /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: %% */ this.pushState('rules'); return 19; break; -case 76 : +case 77 : /*! Conditions:: set */ /*! Rule:: \] */ this.popState('set'); return 31; break; -case 78 : +case 79 : /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 42; // the bit of CODE just before EOF... + return 43; // the bit of CODE just before EOF... break; -case 79 : +case 80 : /*! Conditions:: path */ /*! Rule:: {BR} */ this.popState(); this.unput(yy_.yytext); break; -case 80 : +case 81 : /*! Conditions:: path */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 41; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 42; break; -case 81 : +case 82 : /*! Conditions:: path */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 41; + yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 42; break; -case 82 : +case 83 : /*! Conditions:: path */ /*! Rule:: {WS}+ */ // skip whitespace in the line break; -case 83 : +case 84 : /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ - this.popState(); return 41; + this.popState(); return 42; break; -case 84 : +case 85 : /*! Conditions:: * */ /*! Rule:: . */ @@ -3961,7 +3998,7 @@ case 84 : var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); var l2 = 3; var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); - throw new Error('unsupported lexer input: ', yy_.yytext, ' @ ' + this.describeYYLLOC(yy_.yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); + throw new Error('unsupported lexer input: "' + yy_.yytext + '" @ ' + this.describeYYLLOC(yy_.yylloc) + ' while lexing in ' + this.topState() + ' state:\n' + indent(this.showPosition(l1, l2), 4)); break; default: @@ -4008,82 +4045,82 @@ simpleCaseActionClusters: { 19 : 18, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 22 : 39, + 24 : 40, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 25 : 25, + 28 : 25, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \| */ - 44 : 9, + 45 : 9, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?: */ - 45 : 27, + 46 : 27, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?= */ - 46 : 27, + 47 : 27, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \(\?! */ - 47 : 27, + 48 : 27, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \( */ - 48 : 10, + 49 : 10, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \) */ - 49 : 11, + 50 : 11, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \+ */ - 50 : 12, + 51 : 12, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \* */ - 51 : 7, + 52 : 7, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \? */ - 52 : 13, + 53 : 13, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \^ */ - 53 : 16, + 54 : 16, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: , */ - 54 : 8, + 55 : 8, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: <> */ - 55 : 17, + 56 : 17, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 59 : 33, + 60 : 33, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \$ */ - 61 : 17, + 62 : 17, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \. */ - 62 : 15, + 63 : 15, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 69 : 34, + 70 : 34, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 70 : 29, + 71 : 29, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 71 : 29, + 72 : 29, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \{ */ - 72 : 3, + 73 : 3, /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: \} */ - 73 : 4, + 74 : 4, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 74 : 32, + 75 : 32, /*! Conditions:: set */ /*! Rule:: \{ */ - 75 : 32, + 76 : 32, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 77 : 42, + 78 : 43, /*! Conditions:: * */ /*! Rule:: $ */ - 85 : 1 + 86 : 1 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, @@ -4108,8 +4145,11 @@ new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{ /^(?:=)/, /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, /^(?:'((?:\\'|\\[^']|[^'\\])*)')/, +/^(?:\/\/[^\r\n]*)/, +/^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\S+)/, -/^(?:(\r\n|\n|\r)+)/, +/^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, +/^(?:(\r\n|\n|\r))/, /^(?:([^\S\n\r])+)/, new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), /^(?:(\r\n|\n|\r)+)/, @@ -4120,8 +4160,6 @@ new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), /^(?:%\{(.|(\r\n|\n|\r))*?%\})/, /^(?:%include\b)/, /^(?:.*)/, -/^(?:\/\*(.|\n|\r)*?\*\/)/, -/^(?:\/\/[^\r\n]*)/, new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), /^(?:(\r\n|\n|\r)+)/, /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, @@ -4176,22 +4214,24 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", conditions: { "code": { rules: [ - 66, 67, - 77, + 68, 78, - 84, - 85 + 79, + 85, + 86 ], inclusive: false }, "start_condition": { rules: [ - 25, - 26, - 27, - 84, - 85 + 22, + 23, + 28, + 29, + 30, + 85, + 86 ], inclusive: false }, @@ -4204,9 +4244,12 @@ conditions: { 22, 23, 24, - 71, - 84, - 85 + 25, + 26, + 27, + 72, + 85, + 86 ], inclusive: false }, @@ -4216,8 +4259,8 @@ conditions: { 10, 11, 12, - 84, - 85 + 85, + 86 ], inclusive: false }, @@ -4232,44 +4275,43 @@ conditions: { 6, 7, 8, - 84, - 85 + 85, + 86 ], inclusive: false }, "path": { rules: [ - 79, + 22, + 23, 80, 81, 82, 83, 84, - 85 + 85, + 86 ], inclusive: false }, "set": { rules: [ - 71, - 74, + 72, 75, 76, - 84, - 85 + 77, + 85, + 86 ], inclusive: false }, "indented": { rules: [ - 29, - 30, - 31, 32, 33, 34, 35, - 39, + 36, 40, 41, 42, @@ -4296,23 +4338,23 @@ conditions: { 63, 64, 65, - 68, + 66, 69, 70, - 72, + 71, 73, - 84, - 85 + 74, + 85, + 86 ], inclusive: true }, "trail": { rules: [ - 28, + 22, + 23, 31, 34, - 35, - 39, 40, 41, 42, @@ -4344,10 +4386,11 @@ conditions: { 68, 69, 70, - 72, + 71, 73, - 84, - 85 + 74, + 85, + 86 ], inclusive: true }, @@ -4358,10 +4401,9 @@ conditions: { 15, 16, 17, - 31, + 22, + 23, 34, - 35, - 39, 40, 41, 42, @@ -4388,23 +4430,23 @@ conditions: { 63, 64, 65, - 67, + 66, 68, 69, 70, - 72, + 71, 73, - 84, - 85 + 74, + 85, + 86 ], inclusive: true }, "macro": { rules: [ - 31, + 22, + 23, 34, - 35, - 37, 38, 39, 40, @@ -4433,23 +4475,23 @@ conditions: { 63, 64, 65, - 68, + 66, 69, 70, - 72, + 71, 73, - 84, - 85 + 74, + 85, + 86 ], inclusive: true }, "INITIAL": { rules: [ - 31, + 22, + 23, 34, - 35, - 36, - 39, + 37, 40, 41, 42, @@ -4481,10 +4523,11 @@ conditions: { 68, 69, 70, - 72, + 71, 73, - 84, - 85 + 74, + 85, + 86 ], inclusive: true } diff --git a/lex.l b/lex.l index 99f2795..f8360de 100644 --- a/lex.l +++ b/lex.l @@ -78,11 +78,19 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {NAME} return 'NAME'; "=" return '='; \"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; + yytext = yytext.substr(1, yyleng - 2); return 'OPTION_STRING_VALUE'; // value is always a string type \'{QUOTED_STRING_CONTENT}\' - yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; + yytext = yytext.substr(1, yyleng - 2); return 'OPTION_STRING_VALUE'; // value is always a string type + +// Comments should be gobbled and discarded anywhere *except* the code/action blocks: +"//"[^\r\n]* + /* skip single-line comment */ +"/*"(.|\n|\r)*?"*/" + /* skip multi-line comment */ + [^\s\r\n]+ return 'OPTION_VALUE'; -{BR}+ this.popState(); return 'OPTIONS_END'; +{BR}{WS}+(?=\S) /* skip leading whitespace on the next line of input, when followed by more options */ +{BR} this.popState(); return 'OPTIONS_END'; {WS}+ /* skip whitespace */ {ID} return 'START_COND'; @@ -115,9 +123,6 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] %} .* this.popState(); return 'ACTION'; -"/*"(.|\n|\r)*?"*/" /* ignore */ -"//"[^\r\n]* /* ignore */ - {ID} this.pushState('macro'); return 'NAME'; {BR}+ this.popState('macro'); diff --git a/lex.y b/lex.y index 9e5fceb..cd59872 100644 --- a/lex.y +++ b/lex.y @@ -379,10 +379,12 @@ option_list option : NAME[option] { yy.options[$option] = true; } - | NAME[option] '=' OPTION_VALUE[value] + | NAME[option] '=' OPTION_STRING_VALUE[value] { yy.options[$option] = $value; } + | NAME[option] '=' OPTION_VALUE[value] + { yy.options[$option] = parseValue($value); } | NAME[option] '=' NAME[value] - { yy.options[$option] = $value; } + { yy.options[$option] = parseValue($value); } ; extra_lexer_module_code @@ -434,3 +436,25 @@ function prepareString (s) { s = encodeRE(s); return s; }; + +// convert string value to number or boolean value, when possible +// (and when this is more or less obviously the intent) +// otherwise produce the string itself as value. +function parseValue(v) { + if (v === 'false') { + return false; + } + if (v === 'true') { + return true; + } + // http://stackoverflow.com/questions/175739/is-there-a-built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number + // Note that the `v` check ensures that we do not convert `undefined`, `null` and `''` (empty string!) + if (v && !isNaN(v)) { + var rv = +v; + if (isFinite(rv)) { + return rv; + } + } + return v; +} + diff --git a/tests/all-tests.js b/tests/all-tests.js index ff9e137..f86bedb 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -517,17 +517,44 @@ describe("LEX Parser", function () { }); it("test options with values", function () { - var lexgrammar = '%options ping=666 bla=blub bool1 s1="s1value" s2=\'s2value\' a-b-c="d"\n%%\n"foo" return 1;'; + var lexgrammar = '%options ping=666 bla=blub bool1 s1="s1value" s2=\'s2value\' s3=false s4="false" a-b-c="d"\n%%\n"foo" return 1;'; var expected = { rules: [ ["foo", "return 1;"] ], options: { - ping: "666", + ping: 666, bla: "blub", bool1: true, s1: "s1value", s2: "s2value", + s3: false, + s4: "false", + "a-b-c": "d" // `%options camel-casing` is done very late in the game: see Jison.Generator source code. + }, + macros: {}, + startConditions: {}, + unknownDecls: [] + }; + + lexer_reset(); + assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); + }); + + it("test options spread across multiple lines", function () { + var lexgrammar = '%options ping=666\n bla=blub\n bool1\n s1="s1value"\n s2=\'s2value\'\n s3=false\n s4="false"\n a-b-c="d"\n%%\n"foo" return 1;'; + var expected = { + rules: [ + ["foo", "return 1;"] + ], + options: { + ping: 666, + bla: "blub", + bool1: true, + s1: "s1value", + s2: "s2value", + s3: false, + s4: "false", "a-b-c": "d" // `%options camel-casing` is done very late in the game: see Jison.Generator source code. }, macros: {}, From 6ef5ec44b7cb2c0b0e2c0a9ccefb0d068eaedb3b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 20 Feb 2017 21:11:49 +0100 Subject: [PATCH 274/417] synced similar code with ebnf-parser: fixed bug lurking in the lexer spec where the error object was initialized incorrectly. Plus a whitespace/JSHint police raid. --- lex.l | 32 ++++++++++++++++---------------- lex.y | 3 ++- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/lex.l b/lex.l index f8360de..4afed0c 100644 --- a/lex.l +++ b/lex.l @@ -1,7 +1,7 @@ ASCII_LETTER [a-zA-z] -// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge -// with {UNICODE_LETTER} (though jison has code to optimize if you *did* +// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge +// with {UNICODE_LETTER} (though jison has code to optimize if you *did* // include the `[a-zA-Z]` anyway): UNICODE_LETTER [\p{Alphabetic}] ALPHA [{UNICODE_LETTER}_] @@ -22,7 +22,7 @@ WS [^\S\r\n] QUOTED_STRING_CONTENT (?:\\\'|\\[^\']|[^\\\'])* DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* -// Accept any non-regex-special character as a direct literal without +// Accept any non-regex-special character as a direct literal without // the need to put quotes around it: ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] @@ -41,20 +41,20 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; "//".* return 'ACTION_BODY'; -// regexp with braces or quotes (and no spaces, so we don't mistake +// regexp with braces or quotes (and no spaces, so we don't mistake // a *division operator* `/` for a regex delimiter here in most circumstances): -"/"[^ /]*?['"{}][^ ]*?"/" return 'ACTION_BODY'; +"/"[^ /]*?['"{}][^ ]*?"/" return 'ACTION_BODY'; \"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; "'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; [/"'][^{}/"']+ return 'ACTION_BODY'; [^{}/"']+ return 'ACTION_BODY'; "{" yy.depth++; return '{'; "}" %{ - if (yy.depth == 0) { - this.pushState('trail'); - } else { - yy.depth--; - } + if (yy.depth == 0) { + this.pushState('trail'); + } else { + yy.depth--; + } return '}'; %} @@ -67,7 +67,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {WS}+{BR}+ /* empty */ {WS}+ this.pushState('indented'); "%%" this.pushState('code'); return '%%'; -// Accept any non-regex-special character as a direct literal without +// Accept any non-regex-special character as a direct literal without // the need to put quotes around it: {ANY_LITERAL_CHAR}+ %{ @@ -126,7 +126,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {ID} this.pushState('macro'); return 'NAME'; {BR}+ this.popState('macro'); -// Accept any non-regex-special character as a direct literal without +// Accept any non-regex-special character as a direct literal without // the need to put quotes around it: {ANY_LITERAL_CHAR}+ %{ @@ -170,7 +170,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "%"{NAME}([^\r\n]*) %{ /* ignore unrecognized decl */ - console.warn('LEX: ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); + console.warn('LEX: ignoring unsupported lexer option: ', yytext, ' while lexing in ', this.topState(), ' state:', this._input, ' /////// ', this.matched); // this.pushState('options'); yytext = [ this.matches[1], // {NAME} @@ -191,8 +191,8 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "]" this.popState('set'); return 'REGEX_SET_END'; -// in the trailing CODE block, only accept these `%include` macros when -// they appear at the start of a line and make sure the rest of lexer +// in the trailing CODE block, only accept these `%include` macros when +// they appear at the start of a line and make sure the rest of lexer // regexes account for this one so it'll match that way only: [^\r\n]*(\r|\n)+ return 'CODE'; [^\r\n]+ return 'CODE'; // the bit of CODE just before EOF... @@ -211,7 +211,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); var l2 = 3; var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); - throw new Error('unsupported lexer input: ', yytext, ' @ ' + this.describeYYLLOC(yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); + throw new Error('unsupported lexer input: "' + yytext + '" @ ' + this.describeYYLLOC(yylloc) + ' while lexing in ' + this.topState() + ' state:\n' + indent(this.showPosition(l1, l2), 4)); %} <*><> return 'EOF'; diff --git a/lex.y b/lex.y index cd59872..c8d1be1 100644 --- a/lex.y +++ b/lex.y @@ -1,3 +1,4 @@ + %start lex /* Jison lexer file format grammar */ @@ -435,7 +436,7 @@ function prepareString (s) { s = s.replace(/\\\\/g, "\\"); s = encodeRE(s); return s; -}; +} // convert string value to number or boolean value, when possible // (and when this is more or less obviously the intent) From 66e185992d144aec661f4f35dff78795bd10d90f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 21 Feb 2017 00:24:23 +0100 Subject: [PATCH 275/417] rebuilt library files --- lex-parser.js | 375 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 282 insertions(+), 93 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 1131692..305d319 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -131,7 +131,8 @@ * * defaultActions: {...}, * - * parseError: function(str, hash), + * parseError: function(str, hash, ExceptionClass), + * yyError: function(str, ...), * yyErrOk: function(), * yyClearIn: function(), * @@ -142,10 +143,10 @@ * * var infoObj = parser.constructParseErrorInfo('fail!', null, * parser.collect_expected_token_set(state), true); - * var retVal = parser.parseError(infoObj.errStr, infoObj); + * var retVal = parser.parseError(infoObj.errStr, infoObj, parser.JisonParserError); * - * originalParseError: function(str, hash), - * The basic parseError handler provided by JISON. + * originalParseError: function(str, hash, ExceptionClass), + * The basic `parseError` handler provided by JISON. * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function * at the end of the `parse()`. * @@ -170,7 +171,7 @@ * EOF: 1, * ERROR: 2, * JisonLexerError: function(msg, hash), - * parseError: function(str, hash), + * parseError: function(str, hash, ExceptionClass), * setInput: function(input, [yy]), * input: function(), * unput: function(str), @@ -211,7 +212,7 @@ * * --- * - * The parseError function receives a 'hash' object with these members for lexer and + * The `parseError` function receives a 'hash' object with these members for lexer and * parser errors: * * { @@ -267,7 +268,7 @@ * } * * Please do note that in the latter situation, the `expected` field will be omitted as - * type of failure is assumed not to be due to *parse errors* but rather due to user + * this type of failure is assumed not to be due to *parse errors* but rather due to user * action code in either parser or lexer failing unexpectedly. * * --- @@ -301,7 +302,7 @@ * `retval`. * This function is invoked immediately before `Parser.post_parse()`. * - * parseError: function(str, hash) + * parseError: function(str, hash, ExceptionClass) * optional: overrides the default `parseError` function. * quoteName: function(name), * optional: overrides the default `quoteName` function. @@ -500,6 +501,7 @@ JisonParserError: JisonParserError, yy: {}, options: { type: "lalr", + hasPartialLrUpgradeOnConflict: true, errorRecoveryTokenDiscardCount: 3 }, symbols_: { @@ -840,17 +842,17 @@ productions_: bp({ 0 ]) }), -performAction: function parser__PerformAction(yystate /* action[1] */, $0, yyvstack) { +performAction: function parser__PerformAction(yystate /* action[1] */, yysp, yyvstack) { /* this == yyval */ var yy = this.yy; switch (yystate) { case 1: /*! Production:: lex : init definitions rules_and_epilogue EOF */ - this.$ = yyvstack[$0 - 1]; - this.$.macros = yyvstack[$0 - 2].macros; - this.$.startConditions = yyvstack[$0 - 2].startConditions; - this.$.unknownDecls = yyvstack[$0 - 2].unknownDecls; + this.$ = yyvstack[yysp - 1]; + this.$.macros = yyvstack[yysp - 2].macros; + this.$.startConditions = yyvstack[yysp - 2].startConditions; + this.$.unknownDecls = yyvstack[yysp - 2].unknownDecls; // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { @@ -871,16 +873,16 @@ case 1: case 2: /*! Production:: rules_and_epilogue : "%%" rules "%%" extra_lexer_module_code */ - if (yyvstack[$0] && yyvstack[$0].trim() !== '') { - this.$ = { rules: yyvstack[$0 - 2], moduleInclude: yyvstack[$0] }; + if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; } else { - this.$ = { rules: yyvstack[$0 - 2] }; + this.$ = { rules: yyvstack[yysp - 2] }; } break; case 3: /*! Production:: rules_and_epilogue : "%%" rules */ - this.$ = { rules: yyvstack[$0] }; + this.$ = { rules: yyvstack[yysp] }; break; case 4: @@ -896,16 +898,16 @@ case 5: case 6: /*! Production:: definitions : definition definitions */ - this.$ = yyvstack[$0]; - if (yyvstack[$0 - 1] != null) { - if ('length' in yyvstack[$0 - 1]) { - this.$.macros[yyvstack[$0 - 1][0]] = yyvstack[$0 - 1][1]; - } else if (yyvstack[$0 - 1].type === 'names') { - for (var name in yyvstack[$0 - 1].names) { - this.$.startConditions[name] = yyvstack[$0 - 1].names[name]; + this.$ = yyvstack[yysp]; + if (yyvstack[yysp - 1] != null) { + if ('length' in yyvstack[yysp - 1]) { + this.$.macros[yyvstack[yysp - 1][0]] = yyvstack[yysp - 1][1]; + } else if (yyvstack[yysp - 1].type === 'names') { + for (var name in yyvstack[yysp - 1].names) { + this.$.startConditions[name] = yyvstack[yysp - 1].names[name]; } - } else if (yyvstack[$0 - 1].type === 'unknown') { - this.$.unknownDecls.push(yyvstack[$0 - 1].body); + } else if (yyvstack[yysp - 1].type === 'unknown') { + this.$.unknownDecls.push(yyvstack[yysp - 1].body); } } break; @@ -923,7 +925,7 @@ case 8: /*! Production:: definition : NAME regex */ case 26: /*! Production:: rule : regex action */ - this.$ = [yyvstack[$0 - 1], yyvstack[$0]]; + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; case 9: @@ -946,19 +948,19 @@ case 85: /*! Production:: module_code_chunk : CODE */ case 87: /*! Production:: optional_module_code_chunk : module_code_chunk */ - this.$ = yyvstack[$0]; + this.$ = yyvstack[yysp]; break; case 11: /*! Production:: definition : "{" action_body "}" */ - yy.actionInclude.push(yyvstack[$0 - 1]); this.$ = null; + yy.actionInclude.push(yyvstack[yysp - 1]); this.$ = null; break; case 12: /*! Production:: definition : ACTION */ case 13: /*! Production:: definition : include_macro_code */ - yy.actionInclude.push(yyvstack[$0]); this.$ = null; + yy.actionInclude.push(yyvstack[yysp]); this.$ = null; break; case 14: @@ -968,32 +970,32 @@ case 14: case 15: /*! Production:: definition : UNKNOWN_DECL */ - this.$ = {type: 'unknown', body: yyvstack[$0]}; + this.$ = {type: 'unknown', body: yyvstack[yysp]}; break; case 16: /*! Production:: names_inclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 0; + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; break; case 17: /*! Production:: names_inclusive : names_inclusive START_COND */ - this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 0; + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; break; case 18: /*! Production:: names_exclusive : START_COND */ - this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[$0]] = 1; + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; break; case 19: /*! Production:: names_exclusive : names_exclusive START_COND */ - this.$ = yyvstack[$0 - 1]; this.$.names[yyvstack[$0]] = 1; + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; break; case 20: /*! Production:: rules : rules rules_collective */ - this.$ = yyvstack[$0 - 1].concat(yyvstack[$0]); + this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; case 21: @@ -1005,42 +1007,42 @@ case 25: case 22: /*! Production:: rules_collective : start_conditions rule */ - if (yyvstack[$0 - 1]) { - yyvstack[$0].unshift(yyvstack[$0 - 1]); + if (yyvstack[yysp - 1]) { + yyvstack[yysp].unshift(yyvstack[yysp - 1]); } - this.$ = [yyvstack[$0]]; + this.$ = [yyvstack[yysp]]; break; case 23: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ - if (yyvstack[$0 - 3]) { - yyvstack[$0 - 1].forEach(function (d) { - d.unshift(yyvstack[$0 - 3]); + if (yyvstack[yysp - 3]) { + yyvstack[yysp - 1].forEach(function (d) { + d.unshift(yyvstack[yysp - 3]); }); } - this.$ = yyvstack[$0 - 1]; + this.$ = yyvstack[yysp - 1]; break; case 24: /*! Production:: rule_block : rule_block rule */ - this.$ = $rules; this.$.push(yyvstack[$0]); + this.$ = $rules; this.$.push(yyvstack[yysp]); break; case 27: /*! Production:: action : "{" action_body "}" */ case 36: /*! Production:: start_conditions : "<" name_list ">" */ - this.$ = yyvstack[$0 - 1]; + this.$ = yyvstack[yysp - 1]; break; case 31: /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ - this.$ = yyvstack[$0 - 1] + '\n' + yyvstack[$0]; + this.$ = yyvstack[yysp - 1] + '\n' + yyvstack[yysp]; break; case 33: /*! Production:: action_body : action_body "{" action_body "}" action_comments_body */ - this.$ = yyvstack[$0 - 4] + yyvstack[$0 - 3] + yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; + this.$ = yyvstack[yysp - 4] + yyvstack[yysp - 3] + yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; case 34: @@ -1062,7 +1064,7 @@ case 66: /*! Production:: regex_set : regex_set_atom regex_set */ case 86: /*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = yyvstack[$0 - 1] + yyvstack[$0]; + this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; case 37: @@ -1072,12 +1074,12 @@ case 37: case 39: /*! Production:: name_list : NAME */ - this.$ = [yyvstack[$0]]; + this.$ = [yyvstack[yysp]]; break; case 40: /*! Production:: name_list : name_list "," NAME */ - this.$ = yyvstack[$0 - 2]; this.$.push(yyvstack[$0]); + this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; case 41: @@ -1104,7 +1106,7 @@ case 41: // `bar` to be the keyword, which is fine with us as we're only // interested in the trailing boundary and patching that one for // the `easy_keyword_rules` option. - this.$ = yyvstack[$0]; + this.$ = yyvstack[yysp]; if (yy.options.easy_keyword_rules) { // We need to 'protect' `eval` here as keywords are allowed // to contain double-quotes and other leading cruft. @@ -1135,56 +1137,56 @@ case 41: // followed by zero or more alphanumerics or digits: var re = new XRegExp('\\w[\\w\\d]*$'); if (XRegExp.match(this.$, re)) { - this.$ = yyvstack[$0] + "\\b"; + this.$ = yyvstack[yysp] + "\\b"; } else { - this.$ = yyvstack[$0]; + this.$ = yyvstack[yysp]; } } break; case 44: /*! Production:: nonempty_regex_list : regex_concat "|" regex_list */ - this.$ = yyvstack[$0 - 2] + '|' + yyvstack[$0]; + this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; case 45: /*! Production:: nonempty_regex_list : "|" regex_list */ - this.$ = '|' + yyvstack[$0]; + this.$ = '|' + yyvstack[yysp]; break; case 49: /*! Production:: regex_base : "(" regex_list ")" */ - this.$ = '(' + yyvstack[$0 - 1] + ')'; + this.$ = '(' + yyvstack[yysp - 1] + ')'; break; case 50: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ - this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + ')'; + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; case 51: /*! Production:: regex_base : regex_base "+" */ - this.$ = yyvstack[$0 - 1] + '+'; + this.$ = yyvstack[yysp - 1] + '+'; break; case 52: /*! Production:: regex_base : regex_base "*" */ - this.$ = yyvstack[$0 - 1] + '*'; + this.$ = yyvstack[yysp - 1] + '*'; break; case 53: /*! Production:: regex_base : regex_base "?" */ - this.$ = yyvstack[$0 - 1] + '?'; + this.$ = yyvstack[yysp - 1] + '?'; break; case 54: /*! Production:: regex_base : "/" regex_base */ - this.$ = '(?=' + yyvstack[$0] + ')'; + this.$ = '(?=' + yyvstack[yysp] + ')'; break; case 55: /*! Production:: regex_base : "/!" regex_base */ - this.$ = '(?!' + yyvstack[$0] + ')'; + this.$ = '(?!' + yyvstack[yysp] + ')'; break; case 59: @@ -1206,50 +1208,50 @@ case 65: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ case 82: /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ - this.$ = yyvstack[$0 - 2] + yyvstack[$0 - 1] + yyvstack[$0]; + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; case 69: /*! Production:: regex_set_atom : name_expansion */ - if (XRegExp._getUnicodeProperty(yyvstack[$0].replace(/[{}]/g, '')) - && yyvstack[$0].toUpperCase() !== yyvstack[$0] + if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) + && yyvstack[yysp].toUpperCase() !== yyvstack[yysp] ) { // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories - this.$ = yyvstack[$0]; + this.$ = yyvstack[yysp]; } else { - this.$ = yyvstack[$0]; + this.$ = yyvstack[yysp]; } //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; case 72: /*! Production:: string : STRING_LIT */ - this.$ = prepareString(yyvstack[$0].substr(1, yyvstack[$0].length - 2)); + this.$ = prepareString(yyvstack[yysp].substr(1, yyvstack[yysp].length - 2)); break; case 77: /*! Production:: option : NAME */ - yy.options[yyvstack[$0]] = true; + yy.options[yyvstack[yysp]] = true; break; case 78: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ - yy.options[yyvstack[$0 - 2]] = yyvstack[$0]; + yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; case 79: /*! Production:: option : NAME "=" OPTION_VALUE */ case 80: /*! Production:: option : NAME "=" NAME */ - yy.options[yyvstack[$0 - 2]] = parseValue(yyvstack[$0]); + yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; case 83: /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); - var fileContent = fs.readFileSync(yyvstack[$0], { encoding: 'utf-8' }); + var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); // And no, we don't support nested '%include': - this.$ = '\n// Included by Jison: ' + yyvstack[$0] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[$0] + '\n\n'; + this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; case 84: @@ -2343,12 +2345,12 @@ defaultActions: bda({ 27 ]) }), -parseError: function parseError(str, hash) { +parseError: function parseError(str, hash, ExceptionClass) { if (hash.recoverable) { this.trace(str); hash.destroy(); // destroy... well, *almost*! } else { - throw new this.JisonParserError(str, hash); + throw new ExceptionClass(str, hash); } }, parse: function parse(input) { @@ -2422,7 +2424,9 @@ parse: function parse(input) { // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState_yy.parseError === 'function') { - this.parseError = sharedState_yy.parseError; + this.parseError = function parseErrorAlt(str, hash, ExceptionClass) { + return sharedState_yy.parseError(str, hash, ExceptionClass); + }; } else { this.parseError = this.originalParseError; } @@ -2685,7 +2689,7 @@ parse: function parse(input) { errStr += 'Unexpected ' + errSymbolDescr; } p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0)); - r = this.parseError(p.errStr, p); + r = this.parseError(p.errStr, p, this.JisonParserError); if (!p.recoverable) { @@ -2706,7 +2710,7 @@ parse: function parse(input) { // throwing away a few items if that is what it takes to match the nearest recovery rule! if (symbol === EOF || preErrorSymbol === EOF) { p = this.constructParseErrorInfo((errStr || 'Parsing halted while starting to recover from another error.'), null, expected, false); - retval = this.parseError(p.errStr, p); + retval = this.parseError(p.errStr, p, this.JisonParserError); break; } @@ -2724,7 +2728,7 @@ parse: function parse(input) { // try to recover from error if (error_rule_depth < 0) { p = this.constructParseErrorInfo((errStr || 'Parsing halted. No suitable error recovery rule available.'), null, expected, false); - retval = this.parseError(p.errStr, p); + retval = this.parseError(p.errStr, p, this.JisonParserError); break; } sp -= error_rule_depth; @@ -2745,19 +2749,26 @@ parse: function parse(input) { } + + + + + + + switch (action) { // catch misc. parse failures: default: // this shouldn't happen, unless resolve defaults are off if (action instanceof Array) { p = this.constructParseErrorInfo(('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol), null, null, false); - retval = this.parseError(p.errStr, p); + retval = this.parseError(p.errStr, p, this.JisonParserError); break; } // Another case of better safe than sorry: in case state transitions come out of another error recovery process // or a buggy LUT (LookUp Table): p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); - retval = this.parseError(p.errStr, p); + retval = this.parseError(p.errStr, p, this.JisonParserError); break; // shift: @@ -2891,7 +2902,7 @@ parse: function parse(input) { } catch (ex) { // report exceptions through the parseError callback too: p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); - retval = this.parseError(p.errStr, p); + retval = this.parseError(p.errStr, p, this.JisonParserError); } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; @@ -2936,7 +2947,175 @@ function parseValue(v) { } return v; } -/* generated by jison-lex 0.3.4-166 */ +/* lexer generated by jison-lex 0.3.4-166 */ +/* + * Returns a Lexer object of the following structure: + * + * Lexer: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a derivative/copy of this one, + * not a direct reference! + * } + * + * Lexer.prototype: { + * yy: {}, + * EOF: 1, + * ERROR: 2, + * + * JisonLexerError: function(msg, hash), + * + * performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START, ...), + * where `...` denotes the (optional) additional arguments the user passed to + * `lexer.lex(...)` and specified by way of `%parse-param ...` in the **parser** grammar file + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `lexer` instance. + * + * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer + * by way of the `lexer.setInput(str, yy)` API before. + * + * - `yy_` : lexer instance reference used internally. + * + * - `$avoiding_name_collisions` : index of the matched lexer rule (regex), used internally. + * + * - `YY_START`: the current lexer "start condition" state. + * + * - `...` : the extra arguments you specified in the `%parse-param` statement in your + * **parser** grammar definition file and which are passed to the lexer via + * its `lexer.lex(...)` API. + * + * parseError: function(str, hash, ExceptionClass), + * + * constructLexErrorInfo: function(error_message, is_recoverable), + * Helper function. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this lexer kernel in many places; example usage: + * + * var infoObj = lexer.constructParseErrorInfo('fail!', true); + * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); + * + * options: { ... lexer %options ... }, + * + * lex: function([args...]), + * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. + * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **parser** grammar: + * these extra `args...` are passed verbatim to the lexer rules' action code. + * + * cleanupAfterLex: function(do_not_nuke_errorinfos), + * Helper function. + * This helper API is invoked when the parse process has completed. This helper may + * be invoked by user code to ensure the internal lexer gets properly garbage collected. + * + * setInput: function(input, [yy]), + * input: function(), + * unput: function(str), + * more: function(), + * reject: function(), + * less: function(n), + * pastInput: function(n), + * upcomingInput: function(n), + * showPosition: function(), + * test_match: function(regex_match_array, rule_index), + * next: function(...), + * lex: function(...), + * begin: function(condition), + * pushState: function(condition), + * popState: function(), + * topState: function(), + * _currentRules: function(), + * stateStackSize: function(), + * + * options: { ... lexer %options ... }, + * + * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...), + * rules: [...], + * conditions: {associative list: name ==> set}, + * } + * + * + * token location info (`yylloc`): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * } + * + * while `this` will reference the current lexer instance. + * + * When `parseError` is invoked by the lexer, the default implementation will + * attempt to invoke `yy.parser.parseError()`; when this callback is not provided + * it will try to invoke `yy.parseError()` instead. When that callback is also not + * provided, a `JisonLexerError` exception will be thrown containing the error + * message and `hash`, as constructed by the `constructLexErrorInfo()` API. + * + * Note that the lexer's `JisonLexerError` error class is passed via the + * `ExceptionClass` argument, which is invoked to construct the exception + * instance to be thrown, so technically `parseError` will throw the object + * produced by the `new ExceptionClass(str, hash)` JavaScript expression. + * + * --- + * + * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. + * These options are available: + * + * (Options are permanent.) + * + * yy: { + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * } + * + * lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * WARNING: the next set of options are not meant to be changed. They echo the abilities of + * the lexer as per when it was compiled! + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + var lexer = (function () { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 @@ -2990,6 +3169,7 @@ JisonLexerError.prototype.constructor = JisonLexerError; JisonLexerError.prototype.name = 'JisonLexerError'; + var lexer = { EOF: 1, ERROR: 2, @@ -3061,13 +3241,13 @@ var lexer = { return pei; }, - parseError: function lexer_parseError(str, hash) { + parseError: function lexer_parseError(str, hash, ExceptionClass) { if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { - return this.yy.parser.parseError(str, hash) || this.ERROR; + return this.yy.parser.parseError(str, hash, ExceptionClass) || this.ERROR; } else if (typeof this.yy.parseError === 'function') { - return this.yy.parseError.call(this, str, hash) || this.ERROR; + return this.yy.parseError(str, hash, ExceptionClass) || this.ERROR; } else { - throw new this.JisonLexerError(str); + throw new ExceptionClass(str, hash); } }, @@ -3321,11 +3501,11 @@ var lexer = { if (this.options.backtrack_lexer) { this._backtrack = true; } else { - // when the parseError() call returns, we MUST ensure that the error is registered. + // when the `parseError()` call returns, we MUST ensure that the error is registered. // We accomplish this by signaling an 'error' token to be produced for the current - // .lex() run. + // `.lex()` run. var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), false); - this._signaled_error_token = (this.parseError(p.errStr, p) || this.ERROR); + this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); } return this; }, @@ -3535,7 +3715,7 @@ var lexer = { this.__currentRuleSet__ = null; return false; // rule action called reject() implying the next rule should be tested instead. } else if (this._signaled_error_token) { - // produce one 'error' token as .parseError() in reject() did not guarantee a failure signal by throwing an exception! + // produce one 'error' token as `.parseError()` in `reject()` did not guarantee a failure signal by throwing an exception! token = this._signaled_error_token; this._signaled_error_token = false; return token; @@ -3567,6 +3747,13 @@ var lexer = { // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps // speed up those activities a tiny bit. spec = this.__currentRuleSet__ = this._currentRules(); + // Check whether a *sane* condition has been pushed before: this makes the lexer robust against + // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 + if (!spec || !spec.rules) { + var p = this.constructLexErrorInfo('Internal lexer engine error on line ' + (this.yylineno + 1) + '. The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!\n', false); + // produce one 'error' token until this situation has been resolved, most probably by parse termination! + return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); + } } var rule_ids = spec.rules; @@ -3622,9 +3809,9 @@ var lexer = { return this.EOF; } else { var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); - token = (this.parseError(p.errStr, p) || this.ERROR); + token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); if (token === this.ERROR) { - // we can try to recover from a lexer error that parseError() did not 'recover' for us, by moving forward at least one character at a time: + // we can try to recover from a lexer error that `parseError()` did not 'recover' for us, by moving forward at least one character at a time: if (!this.match.length) { this.input(); } @@ -4534,11 +4721,13 @@ conditions: { } }; + function indent(s, i) { var a = s.split('\n'); var pf = (new Array(i + 1)).join(' '); return pf + a.join('\n' + pf); }; + return lexer; })(); parser.lexer = lexer; From 6ae2a5e669452feccbc2de0d027a1c3777c72bc8 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 21 Feb 2017 00:30:55 +0100 Subject: [PATCH 276/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2233411..2ceed89 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-171", + "version": "0.1.4-172", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 90206f08f9594d9f87973a605241167ce0f8d7de Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 21 Feb 2017 00:37:08 +0100 Subject: [PATCH 277/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 305d319..55d11ec 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-171 */ +/* parser generated by jison 0.4.18-172 */ /* * Returns a Parser object of the following structure: * From 7e99a437c4c3aa21e26a3e8f475bb2f27c41a0fb Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 21 Feb 2017 02:37:20 +0100 Subject: [PATCH 278/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 55d11ec..3f1c104 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2485,7 +2485,7 @@ parse: function parse(input) { sstack.length = 0; vstack.length = 0; - stack_pointer = 0; + sp = 0; // nuke the error hash info instances created during this run. // Userland code must COPY any data/references From 65a57494cd597029159afc80c4fa5356d7af8906 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 21 Feb 2017 02:37:56 +0100 Subject: [PATCH 279/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2ceed89..d734070 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-172", + "version": "0.1.4-173", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 84f66647d834f7cb6dd01cb68ed7bd2af2f2346c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 21 Feb 2017 02:44:40 +0100 Subject: [PATCH 280/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 3f1c104..1c33472 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-172 */ +/* parser generated by jison 0.4.18-173 */ /* * Returns a Parser object of the following structure: * From fa0f9f2a976650c31de98a288cc4fb7c30e055d5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 4 Mar 2017 19:05:37 +0100 Subject: [PATCH 281/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d734070..7b10b95 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-173", + "version": "0.1.4-174", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 52513ff6782d73de20057c4644a1e0ced80f071f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 4 Mar 2017 19:13:15 +0100 Subject: [PATCH 282/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 1c33472..7f395a2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-173 */ +/* parser generated by jison 0.4.18-174 */ /* * Returns a Parser object of the following structure: * From d6929a110eba98a9dcd275e06d030d6dca1bd361 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 8 Mar 2017 02:21:45 +0100 Subject: [PATCH 283/417] rebuilt library files --- lex-parser.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 7f395a2..db4f9cf 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3885,13 +3885,13 @@ var lexer = { stateStackSize: function lexer_stateStackSize() { return this.conditionStack.length; }, -options: { + options: { easy_keyword_rules: true, ranges: true, xregexp: true }, -JisonLexerError: JisonLexerError, -performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) { + JisonLexerError: JisonLexerError, + performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) { var YYSTATE = YY_START; switch($avoiding_name_collisions) { @@ -4192,7 +4192,7 @@ default: return this.simpleCaseActionClusters[$avoiding_name_collisions]; } }, -simpleCaseActionClusters: { + simpleCaseActionClusters: { /*! Conditions:: action */ /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ @@ -4309,7 +4309,7 @@ simpleCaseActionClusters: { /*! Rule:: $ */ 86 : 1 }, -rules: [ + rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/.*)/, /^(?:\/[^ \/]*?['"{}][^ ]*?\/)/, @@ -4398,7 +4398,7 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", /^(?:.)/, /^(?:$)/ ], -conditions: { + conditions: { "code": { rules: [ 67, From 3335cbec167867a2dee9b5424c3faa9463b2f3be Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 8 Mar 2017 02:29:49 +0100 Subject: [PATCH 284/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b10b95..2b75f01 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-174", + "version": "0.1.4-175", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From d2028eec013c0f8ae83c627f79f2af531e436f91 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 8 Mar 2017 02:37:41 +0100 Subject: [PATCH 285/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index db4f9cf..bf61504 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-174 */ +/* parser generated by jison 0.4.18-175 */ /* * Returns a Parser object of the following structure: * From 5c015959b038ad9e61ba4cec8dc22de5152a2436 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 26 Mar 2017 23:08:12 +0200 Subject: [PATCH 286/417] * refactor: instead of cutting up strings, use the built-in lexer features: macros expand to regex closures, which are available via the `this.matches[]` member array in the lexer action code. * use a non-capturing group in the lexer rule regex when the submatch isn't fetched via `this.matches[]` anyway: this should be slightly faster at run-time --- lex.l | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lex.l b/lex.l index 4afed0c..5ef164e 100644 --- a/lex.l +++ b/lex.l @@ -78,9 +78,9 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {NAME} return 'NAME'; "=" return '='; \"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = yytext.substr(1, yyleng - 2); return 'OPTION_STRING_VALUE'; // value is always a string type + yytext = this.matches[1]; return 'OPTION_STRING_VALUE'; // value is always a string type \'{QUOTED_STRING_CONTENT}\' - yytext = yytext.substr(1, yyleng - 2); return 'OPTION_STRING_VALUE'; // value is always a string type + yytext = this.matches[1]; return 'OPTION_STRING_VALUE'; // value is always a string type // Comments should be gobbled and discarded anywhere *except* the code/action blocks: "//"[^\r\n]* @@ -100,8 +100,8 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {WS}*{BR}+ this.pushState('rules'); "{" yy.depth = 0; this.pushState('action'); return '{'; -"%{"(.|{BR})*?"%}" this.pushState('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; -"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; +"%{"(?:.|{BR})*?"%}" this.pushState('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; +"%{"(?:.|{BR})*?"%}" yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; "%include" %{ // This is an include instruction in place of an action: // thanks to the `.+` rule immediately below we need to semi-duplicate @@ -200,9 +200,9 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR} this.popState(); this.unput(yytext); \"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; + yytext = this.matches[1]; this.popState(); return 'PATH'; \'{QUOTED_STRING_CONTENT}\' - yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; + yytext = this.matches[1]; this.popState(); return 'PATH'; {WS}+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; From fc7512cdccd55e8a6d71187b620881f75386f0f1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 26 Mar 2017 23:10:01 +0200 Subject: [PATCH 287/417] regenerated library files --- lex-parser.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index bf61504..4cfddba 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3949,12 +3949,12 @@ break; case 20 : /*! Conditions:: options */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 39; // value is always a string type + yy_.yytext = this.matches[1]; return 39; // value is always a string type break; case 21 : /*! Conditions:: options */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); return 39; // value is always a string type + yy_.yytext = this.matches[1]; return 39; // value is always a string type break; case 22 : /*! Conditions:: INITIAL start_condition trail rules macro path options */ @@ -4003,12 +4003,12 @@ case 32 : break; case 33 : /*! Conditions:: indented */ -/*! Rule:: %\{(.|{BR})*?%\} */ +/*! Rule:: %\{(?:.|{BR})*?%\} */ this.pushState('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; break; case 34 : /*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %\{(.|{BR})*?%\} */ +/*! Rule:: %\{(?:.|{BR})*?%\} */ yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; break; case 35 : @@ -4160,12 +4160,12 @@ break; case 81 : /*! Conditions:: path */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 42; + yy_.yytext = this.matches[1]; this.popState(); return 42; break; case 82 : /*! Conditions:: path */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2); this.popState(); return 42; + yy_.yytext = this.matches[1]; this.popState(); return 42; break; case 83 : /*! Conditions:: path */ @@ -4343,8 +4343,8 @@ new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), /^(?:([^\S\n\r])+)/, /^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, /^(?:\{)/, -/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, -/^(?:%\{(.|(\r\n|\n|\r))*?%\})/, +/^(?:%\{(?:.|(\r\n|\n|\r))*?%\})/, +/^(?:%\{(?:.|(\r\n|\n|\r))*?%\})/, /^(?:%include\b)/, /^(?:.*)/, new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), From f0ca4e0a8d2ac6e24f38fe7b11c7ce9bda7f484f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 27 Mar 2017 00:55:09 +0200 Subject: [PATCH 288/417] rebuilt library files --- lex-parser.js | 181 +++++++++++++++++++++++++++----------------------- 1 file changed, 97 insertions(+), 84 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 4cfddba..8037d7b 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,5 @@ /* parser generated by jison 0.4.18-175 */ + /* * Returns a Parser object of the following structure: * @@ -287,7 +288,7 @@ * the parser will return the original `retval`. * * ### options which can be set up per parser instance - * + * * yy: { * pre_parse: function(yy [, optional parse() args]) * optional: is invoked before the parse cycle starts (and before the first @@ -297,9 +298,9 @@ * optional: is invoked when the parse terminates due to success ('accept') * or failure (even when exceptions are thrown). * `retval` contains the return value to be produced by `Parser.parse()`; - * this function can override the return value by returning another. + * this function can override the return value by returning another. * When it does not return any value, the parser will return the original - * `retval`. + * `retval`. * This function is invoked immediately before `Parser.post_parse()`. * * parseError: function(str, hash, ExceptionClass) @@ -496,6 +497,49 @@ function u(a) { var parser = { + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // no default action: ............... false + // no try..catch: ................... false + // no default resolve on conflict: false + // on-demand look-ahead: ............ false + // error recovery token skip maximum: 3 + // debug grammar/output: ............ false + // has partial LR conflict upgrade: true + // rudimentary token-stack support: false + // parser table compression mode: ... 2 + // export debug tables: ............. false + // export *all* tables: ............. false + // module type: ..................... commonjs + // parser engine type: .............. lalr + // output main() in the module: ..... true + // + // + // Parser Analysis flags: + // + // all actions are default: ......... false + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses ParseError API: ............. false + // uses YYERROR: .................... false + // uses YYERROK: .................... false + // uses YYCLEARIN: .................. false + // tracks rule values: .............. true + // assigns rule values: ............. true + // uses location tracking: .......... false + // assigns location: ................ false + // uses yystack: .................... false + // uses yysstack: ................... false + // uses yysp: ....................... true + // has error recovery: .............. true + // + // --------- END OF REPORT ----------- + trace: function no_op_trace() { }, JisonParserError: JisonParserError, yy: {}, @@ -3170,7 +3214,26 @@ JisonLexerError.prototype.name = 'JisonLexerError'; + var lexer = { + // Code Generator Information Report + // --------------------------------- + // + // Options: + // backtracking: false + // location.ranges: true + // + // Forwarded Parser Analysis flags: + // uses yyleng: false + // uses yylineno: false + // uses yytext: false + // uses yylloc: false + // uses lexer values: true / true + // location tracking: false + // location assignment: false + // + // --------- END OF REPORT ----------- + EOF: 1, ERROR: 2, @@ -3251,7 +3314,7 @@ var lexer = { } }, - // final cleanup function for when we have completed lexing the input; + // final cleanup function for when we have completed lexing the input; // make it an API so that external code can use this one once userland // code has decided it's time to destroy any lingering lexer error // hash object instances and the like: this function helps to clean @@ -3320,64 +3383,11 @@ var lexer = { var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); - if (this.rules_prefix1) { - var rule_prefixes = new Array(65536); - var first_catch_all_index = 0; - - for (var i = 0; i < len; i++) { - var idx = rule_ids[i]; - var rule_re = rules[idx]; - rule_regexes[i + 1] = rule_re; - rule_new_ids[i + 1] = idx; - - var prefix = this.rules_prefix1[idx]; - // compression: is the PREFIX-STRING an xref to another PREFIX-STRING slot in the rules_prefix1[] table? - if (typeof prefix === 'number') { - prefix = this.rules_prefix1[prefix]; - } - // init the prefix lookup table: first come, first serve... - if (!prefix) { - if (!first_catch_all_index) { - first_catch_all_index = i + 1; - } - } else { - for (var j = 0, pfxlen = prefix.length; j < pfxlen; j++) { - var pfxch = prefix.charCodeAt(j); - // first come, first serve: - if (!rule_prefixes[pfxch]) { - rule_prefixes[pfxch] = i + 1; - } - } - } - } - - // if no catch-all prefix has been encountered yet, it means all - // rules have limited prefix sets and it MAY be that particular - // input characters won't be recognized by any rule in this - // condition state. - // - // To speed up their discovery at run-time while keeping the - // remainder of the lexer kernel code very simple (and fast), - // we point these to an 'illegal' rule set index *beyond* - // the end of the rule set. - if (!first_catch_all_index) { - first_catch_all_index = len + 1; - } - - for (var i = 0; i < 65536; i++) { - if (!rule_prefixes[i]) { - rule_prefixes[i] = first_catch_all_index; - } - } - - spec.__dispatch_lut = rule_prefixes; - } else { - for (var i = 0; i < len; i++) { - var idx = rule_ids[i]; - var rule_re = rules[idx]; - rule_regexes[i + 1] = rule_re; - rule_new_ids[i + 1] = idx; - } + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; } spec.rules = rule_new_ids; @@ -3538,7 +3548,7 @@ var lexer = { var a = past.replace(/\r\n|\r/g, '\n').split('\n'); a = a.slice(-maxLines); past = a.join('\n'); - // When, after limiting to maxLines, we still have too much to return, + // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis prefix... if (past.length > maxSize) { past = '...' + past.substr(-maxSize); @@ -3571,7 +3581,7 @@ var lexer = { var a = next.replace(/\r\n|\r/g, '\n').split('\n'); a = a.slice(0, maxLines); next = a.join('\n'); - // When, after limiting to maxLines, we still have too much to return, + // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis postfix... if (next.length > maxSize) { next = next.substring(0, maxSize) + '...'; @@ -3587,9 +3597,9 @@ var lexer = { }, // helper function, used to produce a human readable description as a string, given - // the input `yylloc` location object. + // the input `yylloc` location object. // Set `display_range_too` to TRUE to include the string character index position(s) - // in the description if the `yylloc.range` is available. + // in the description if the `yylloc.range` is available. describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { var l1 = yylloc.first_line; var l2 = yylloc.last_line; @@ -3667,16 +3677,18 @@ var lexer = { } match_str = match[0]; - lines = match_str.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; - } + // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { + lines = match_str.match(/(?:\r\n?|\n).*/g); + if (lines) { + this.yylineno += lines.length; + } + // } this.yylloc = { first_line: this.yylloc.last_line, last_line: this.yylineno + 1, first_column: this.yylloc.last_column, last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : + lines[lines.length - 1].length - lines[lines.length - 1].match(/^\r?\n?/)[0].length : this.yylloc.last_column + match_str.length }; this.yytext += match_str; @@ -3695,7 +3707,7 @@ var lexer = { this._input = this._input.slice(match_str.length); this.matched += match_str; - // calling this method: + // calling this method: // // function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) {...} token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */); @@ -3750,9 +3762,9 @@ var lexer = { // Check whether a *sane* condition has been pushed before: this makes the lexer robust against // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 if (!spec || !spec.rules) { - var p = this.constructLexErrorInfo('Internal lexer engine error on line ' + (this.yylineno + 1) + '. The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!\n', false); - // produce one 'error' token until this situation has been resolved, most probably by parse termination! - return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); + var p = this.constructLexErrorInfo('Internal lexer engine error on line ' + (this.yylineno + 1) + '. The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!\n', false); + // produce one 'error' token until this situation has been resolved, most probably by parse termination! + return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); } } @@ -3763,18 +3775,18 @@ var lexer = { // var c0 = this._input[0]; - // Note: the arrays are 1-based, while `len` itself is a valid index, + // Note: the arrays are 1-based, while `len` itself is a valid index, // hence the non-standard less-or-equal check in the next loop condition! - // + // // `dispatch` is a lookup table which lists the *first* rule which matches the 1-char *prefix* of the rule-to-match. // By using that array as a jumpstart, we can cut down on the otherwise O(n*m) behaviour of this lexer, down to // O(n) ideally, where: - // - // - N is the number of input particles -- which is not precisely characters + // + // - N is the number of input particles -- which is not precisely characters // as we progress on a per-regex-match basis rather than on a per-character basis - // + // // - M is the number of rules (regexes) to test in the active condition state. - // + // for (var i = 1 /* (dispatch[c0] || 1) */ ; i <= len; i++) { tempMatch = this._input.match(regexes[i]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { @@ -3811,7 +3823,8 @@ var lexer = { var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); if (token === this.ERROR) { - // we can try to recover from a lexer error that `parseError()` did not 'recover' for us, by moving forward at least one character at a time: + // we can try to recover from a lexer error that `parseError()` did not 'recover' for us + // by moving forward at least one character at a time: if (!this.match.length) { this.input(); } @@ -3886,9 +3899,9 @@ var lexer = { return this.conditionStack.length; }, options: { + xregexp: true, easy_keyword_rules: true, - ranges: true, - xregexp: true + ranges: true }, JisonLexerError: JisonLexerError, performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) { From f6297425c721ec496bc45fff49678320d5d3d2f8 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 27 Mar 2017 00:55:45 +0200 Subject: [PATCH 289/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2b75f01..62b095a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-175", + "version": "0.1.4-176", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From ad3f59715cc90a4793dbf7f073e006a5fe762b9a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 27 Mar 2017 01:04:54 +0200 Subject: [PATCH 290/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 8037d7b..d2d6ae8 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-175 */ +/* parser generated by jison 0.4.18-176 */ /* * Returns a Parser object of the following structure: From d9ed83189451f3fde54f819da2f59e8f6e0b937b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 8 Apr 2017 15:51:43 +0200 Subject: [PATCH 291/417] no need to run `npm install --only-dev` any more; this was a quick hacky fix for an `npm install` issue on Windows --- Makefile | 1 - 1 file changed, 1 deletion(-) diff --git a/Makefile b/Makefile index 44c2ff1..539af4d 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,6 @@ prep: npm-install npm-install: npm install - npm install --only=dev build: lex-parser.js From 0626af07c6311a34f236341c2a45b7043e4438e1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 8 Apr 2017 15:52:41 +0200 Subject: [PATCH 292/417] a bit of run-time optimization: invariant code motion --- lex-parser.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d2d6ae8..898d16e 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3647,7 +3647,8 @@ var lexer = { var token, lines, backup, - match_str; + match_str, + match_str_len; if (this.options.backtrack_lexer) { // save context @@ -3677,6 +3678,7 @@ var lexer = { } match_str = match[0]; + match_str_len = match_str.length; // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { lines = match_str.match(/(?:\r\n?|\n).*/g); if (lines) { @@ -3689,7 +3691,7 @@ var lexer = { first_column: this.yylloc.last_column, last_column: lines ? lines[lines.length - 1].length - lines[lines.length - 1].match(/^\r?\n?/)[0].length : - this.yylloc.last_column + match_str.length + this.yylloc.last_column + match_str_len }; this.yytext += match_str; this.match += match_str; @@ -3701,10 +3703,10 @@ var lexer = { // previous lex rules MAY have invoked the `more()` API rather than producing a token: // those rules will already have moved this `offset` forward matching their match lengths, // hence we must only add our own match length now: - this.offset += match_str.length; + this.offset += match_str_len; this._more = false; this._backtrack = false; - this._input = this._input.slice(match_str.length); + this._input = this._input.slice(match_str_len); this.matched += match_str; // calling this method: From 53fe416fe1f47e9643c86c4a590ccba9ff524efc Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 8 Apr 2017 16:19:32 +0200 Subject: [PATCH 293/417] rebuilt library files --- lex-parser.js | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 898d16e..1a4bf15 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -134,6 +134,7 @@ * * parseError: function(str, hash, ExceptionClass), * yyError: function(str, ...), + * yyRecovering: function(), * yyErrOk: function(), * yyClearIn: function(), * @@ -527,6 +528,7 @@ var parser = { // uses yylloc: ..................... false // uses ParseError API: ............. false // uses YYERROR: .................... false + // uses YYRECOVERING: ............... false // uses YYERROK: .................... false // uses YYCLEARIN: .................. false // tracks rule values: .............. true @@ -690,6 +692,7 @@ __reentrant_call_depth: 0, // INTERNAL USE ONLY __error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup // APIs which will be set up depending on user action code analysis: +//yyRecovering: 0, //yyErrOk: 0, //yyClearIn: 0, @@ -2449,22 +2452,11 @@ parse: function parse(input) { - - - vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; ++sp; - if (typeof lexer.yytext === 'undefined') { - lexer.yytext = ''; - } - - if (typeof lexer.yylineno === 'undefined') { - lexer.yylineno = 0; - } - // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState_yy.parseError === 'function') { @@ -2722,10 +2714,13 @@ parse: function parse(input) { if (!recovering) { // Report error - if (lexer.showPosition) { - errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ':\n' + lexer.showPosition(79 - 10, 10) + '\n'; - } else { + if (typeof lexer.yylineno === 'number') { errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; + } else { + errStr = 'Parse error: '; + } + if (lexer.showPosition) { + errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; } if (expected.length) { errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; From 581269b5d7a4c3c1d324c0c0c12f8b6496182370 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Apr 2017 12:43:26 +0200 Subject: [PATCH 294/417] fix https://github.com/zaach/ebnf-parser/issues/9 --- LICENSE.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 LICENSE.md diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..3d59b33 --- /dev/null +++ b/LICENSE.md @@ -0,0 +1,20 @@ +The MIT License (MIT) + +Copyright (c) 2014 Matt Eckert + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. From 64953c3d39dab3f7cdbea1053c4446887ee3181b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Apr 2017 13:21:30 +0200 Subject: [PATCH 295/417] rebuilt library files --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 62b095a..570f6ee 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-176", + "version": "0.1.4-177", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 50c6d232c00e21305990b3fd1cdfdd18049673eb Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Apr 2017 13:27:38 +0200 Subject: [PATCH 296/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 1a4bf15..e08921d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-176 */ +/* parser generated by jison 0.4.18-177 */ /* * Returns a Parser object of the following structure: From 72dd684e204b14e2de80aeefdc2362ee9a850390 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Apr 2017 13:28:30 +0200 Subject: [PATCH 297/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 570f6ee..4c780d6 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-177", + "version": "0.1.4-178", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 4ef8fc750fb29397dd1ce7744a68cd97d0e66b39 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Apr 2017 13:35:27 +0200 Subject: [PATCH 298/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index e08921d..aa70fac 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-177 */ +/* parser generated by jison 0.4.18-178 */ /* * Returns a Parser object of the following structure: From 75a99bd8629f27f632eae146ae491f57d136f472 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Apr 2017 17:17:14 +0200 Subject: [PATCH 299/417] rebuilt library files --- lex-parser.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lex-parser.js b/lex-parser.js index aa70fac..ab4002c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -517,6 +517,7 @@ var parser = { // module type: ..................... commonjs // parser engine type: .............. lalr // output main() in the module: ..... true + // number of expected conflicts: .... 0 // // // Parser Analysis flags: @@ -3897,6 +3898,7 @@ var lexer = { }, options: { xregexp: true, + inputFilename: "lex.y", easy_keyword_rules: true, ranges: true }, From f41fa10ff2b55564ff3d0f6685bd90d3d9a44e33 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Apr 2017 17:24:26 +0200 Subject: [PATCH 300/417] bumped build revision --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 4c780d6..154aad0 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-178", + "version": "0.1.4-179", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 5a70191dfdc96076d79792f700792fca35df1749 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 9 Apr 2017 17:31:53 +0200 Subject: [PATCH 301/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index ab4002c..b19fbf2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-178 */ +/* parser generated by jison 0.4.18-179 */ /* * Returns a Parser object of the following structure: From a77f74637386e9936e0509cd2e0886fa93ee2a0f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 15 Apr 2017 11:10:29 +0200 Subject: [PATCH 302/417] bump version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 154aad0..a77c8a9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-179", + "version": "0.1.4-181", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From d1f2e988528d9c9a580ba479554daf233cf189d6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 25 Jun 2017 23:35:45 +0200 Subject: [PATCH 303/417] updated NPM packages --- package-lock.json | 1916 +++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 +- 2 files changed, 1918 insertions(+), 2 deletions(-) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..30e8653 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1916 @@ +{ + "name": "lex-parser", + "version": "0.1.4-181", + "lockfileVersion": 1, + "dependencies": { + "acorn": { + "version": "4.0.13", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", + "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", + "dev": true + }, + "align-text": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", + "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", + "dev": true + }, + "alter": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/alter/-/alter-0.2.0.tgz", + "integrity": "sha1-x1iICGF1cgNKrmJICvJrHU0cs80=", + "dev": true + }, + "amdefine": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", + "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", + "dev": true + }, + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true + }, + "arr-flatten": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.0.3.tgz", + "integrity": "sha1-onTthawIhJtr14R8RYB0XcUa37E=", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "assertion-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", + "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", + "dev": true + }, + "ast-traverse": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/ast-traverse/-/ast-traverse-0.1.1.tgz", + "integrity": "sha1-ac8rg4bxnc2hux4F1o/jWdiJfeY=", + "dev": true + }, + "ast-types": { + "version": "0.9.6", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.6.tgz", + "integrity": "sha1-ECyenpAF0+fjgpvwxPok7oYu6bk=", + "dev": true + }, + "async": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", + "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", + "dev": true + }, + "babel-code-frame": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", + "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", + "dev": true, + "dependencies": { + "js-tokens": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz", + "integrity": "sha1-COnxMkhKLEWjCQfp3E1VZ7fxFNc=", + "dev": true + } + } + }, + "babel-core": { + "version": "5.8.38", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-5.8.38.tgz", + "integrity": "sha1-H8ruedfmG3ULALjlT238nQr4ZVg=", + "dev": true, + "dependencies": { + "babylon": { + "version": "5.8.38", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-5.8.38.tgz", + "integrity": "sha1-7JsSCxG/bM1Bc6GL8hfmC3mFn/0=", + "dev": true + }, + "json5": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.4.0.tgz", + "integrity": "sha1-BUNS5MTIDIbAkjh31EneF2pzLI0=", + "dev": true + }, + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + } + } + }, + "babel-generator": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", + "integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", + "dev": true, + "dependencies": { + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true + } + } + }, + "babel-helper-bindify-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz", + "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", + "dev": true + }, + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", + "dev": true + }, + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true + }, + "babel-helper-define-map": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.24.1.tgz", + "integrity": "sha1-epdH8ljYlH0y1RX2qhx70CIEoIA=", + "dev": true + }, + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "dev": true + }, + "babel-helper-explode-class": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz", + "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", + "dev": true + }, + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "dev": true + }, + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "dev": true + }, + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", + "dev": true + }, + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "dev": true + }, + "babel-helper-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.24.1.tgz", + "integrity": "sha1-024i+rEAjXnYhkjjIRaGgShFbOg=", + "dev": true + }, + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "dev": true + }, + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "dev": true + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "dev": true + }, + "babel-plugin-constant-folding": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-constant-folding/-/babel-plugin-constant-folding-1.0.1.tgz", + "integrity": "sha1-g2HTZMmORJw2kr26Ue/whEKQqo4=", + "dev": true + }, + "babel-plugin-dead-code-elimination": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/babel-plugin-dead-code-elimination/-/babel-plugin-dead-code-elimination-1.0.2.tgz", + "integrity": "sha1-X3xFEnTc18zNv7s+C4XdKBIfD2U=", + "dev": true + }, + "babel-plugin-eval": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-eval/-/babel-plugin-eval-1.0.1.tgz", + "integrity": "sha1-ovrtJc5r5preS/7CY/cBaRlZUNo=", + "dev": true + }, + "babel-plugin-inline-environment-variables": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-inline-environment-variables/-/babel-plugin-inline-environment-variables-1.0.1.tgz", + "integrity": "sha1-H1jOkSB61qgmqL9kX6/mj/X+P/4=", + "dev": true + }, + "babel-plugin-jscript": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/babel-plugin-jscript/-/babel-plugin-jscript-1.0.4.tgz", + "integrity": "sha1-jzQsOCduh6R9X6CovT1etsytj8w=", + "dev": true + }, + "babel-plugin-member-expression-literals": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-member-expression-literals/-/babel-plugin-member-expression-literals-1.0.1.tgz", + "integrity": "sha1-zF7bD6qNyScXDnTW0cAkQAIWJNM=", + "dev": true + }, + "babel-plugin-property-literals": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-property-literals/-/babel-plugin-property-literals-1.0.1.tgz", + "integrity": "sha1-AlIwGQAZKYCxwRjv6kjOk6q4MzY=", + "dev": true + }, + "babel-plugin-proto-to-assign": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/babel-plugin-proto-to-assign/-/babel-plugin-proto-to-assign-1.0.4.tgz", + "integrity": "sha1-xJ56/QL1d7xNoF6i3wAiUM980SM=", + "dev": true, + "dependencies": { + "lodash": { + "version": "3.10.1", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", + "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", + "dev": true + } + } + }, + "babel-plugin-react-constant-elements": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/babel-plugin-react-constant-elements/-/babel-plugin-react-constant-elements-1.0.3.tgz", + "integrity": "sha1-lGc26DeEKcvDSdz/YvUcFDs041o=", + "dev": true + }, + "babel-plugin-react-display-name": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/babel-plugin-react-display-name/-/babel-plugin-react-display-name-1.0.3.tgz", + "integrity": "sha1-dU/jiSboQkpOexWrbqYTne4FFPw=", + "dev": true + }, + "babel-plugin-remove-console": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-remove-console/-/babel-plugin-remove-console-1.0.1.tgz", + "integrity": "sha1-2PJFVsOgUAXUKqqv0neH9T/wE6c=", + "dev": true + }, + "babel-plugin-remove-debugger": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-plugin-remove-debugger/-/babel-plugin-remove-debugger-1.0.1.tgz", + "integrity": "sha1-/S6jzWGkKK0fO5yJiC/0KT6MFMc=", + "dev": true + }, + "babel-plugin-runtime": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/babel-plugin-runtime/-/babel-plugin-runtime-1.0.7.tgz", + "integrity": "sha1-v3x9lm3Vbs1cF/ocslPJrLflSq8=", + "dev": true + }, + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", + "dev": true + }, + "babel-plugin-syntax-async-generators": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", + "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", + "dev": true + }, + "babel-plugin-syntax-class-constructor-call": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", + "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=", + "dev": true + }, + "babel-plugin-syntax-class-properties": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", + "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", + "dev": true + }, + "babel-plugin-syntax-decorators": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", + "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", + "dev": true + }, + "babel-plugin-syntax-dynamic-import": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", + "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", + "dev": true + }, + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", + "dev": true + }, + "babel-plugin-syntax-export-extensions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", + "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=", + "dev": true + }, + "babel-plugin-syntax-flow": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", + "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", + "dev": true + }, + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", + "dev": true + }, + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", + "dev": true + }, + "babel-plugin-transform-async-generator-functions": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", + "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", + "dev": true + }, + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "dev": true + }, + "babel-plugin-transform-class-constructor-call": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.24.1.tgz", + "integrity": "sha1-gNwoVQWsBn3LjWxl4vbxGrd2Xvk=", + "dev": true + }, + "babel-plugin-transform-class-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", + "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", + "dev": true + }, + "babel-plugin-transform-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz", + "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", + "dev": true + }, + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true + }, + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true + }, + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.24.1.tgz", + "integrity": "sha1-dsKV3DpHQbFmWt/TFnIV3P8ypXY=", + "dev": true + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", + "dev": true + }, + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", + "dev": true + }, + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", + "dev": true + }, + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", + "dev": true + }, + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", + "dev": true + }, + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", + "dev": true + }, + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "dev": true + }, + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", + "dev": true + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.1.tgz", + "integrity": "sha1-0+MQtA72ZKNmIiAAl8bUQCmPK/4=", + "dev": true + }, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", + "dev": true + }, + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", + "dev": true + }, + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", + "dev": true + }, + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", + "dev": true + }, + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", + "dev": true + }, + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "dev": true + }, + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", + "dev": true + }, + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "dev": true + }, + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", + "dev": true + }, + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", + "dev": true + }, + "babel-plugin-transform-exponentiation-operator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", + "dev": true + }, + "babel-plugin-transform-export-extensions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz", + "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", + "dev": true + }, + "babel-plugin-transform-flow-strip-types": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", + "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", + "dev": true + }, + "babel-plugin-transform-object-rest-spread": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz", + "integrity": "sha1-h11ryb52HFiirj/u5dxIldjH+SE=", + "dev": true + }, + "babel-plugin-transform-regenerator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.24.1.tgz", + "integrity": "sha1-uNowWtQ8PJm0hI5P5AN7dw0jxBg=", + "dev": true + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "dev": true + }, + "babel-plugin-undeclared-variables-check": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/babel-plugin-undeclared-variables-check/-/babel-plugin-undeclared-variables-check-1.0.2.tgz", + "integrity": "sha1-XPGqU52BP/ZOmWQSkK9iCWX2Xe4=", + "dev": true + }, + "babel-plugin-undefined-to-void": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/babel-plugin-undefined-to-void/-/babel-plugin-undefined-to-void-1.1.6.tgz", + "integrity": "sha1-f1eO+LeN+uYAM4XYQXph7aBuL4E=", + "dev": true + }, + "babel-preset-es2015": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", + "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", + "dev": true + }, + "babel-preset-stage-1": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", + "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", + "dev": true + }, + "babel-preset-stage-2": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", + "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", + "dev": true + }, + "babel-preset-stage-3": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", + "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", + "dev": true + }, + "babel-register": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.24.1.tgz", + "integrity": "sha1-fhDhOi9xBlvfrVoXh7pFvKbe118=", + "dev": true, + "dependencies": { + "babel-core": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.25.0.tgz", + "integrity": "sha1-fdQrBGPHQunVKW3rPsZ6kyLa1yk=", + "dev": true + }, + "core-js": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", + "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", + "dev": true + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true + }, + "source-map-support": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", + "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", + "dev": true + } + } + }, + "babel-runtime": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz", + "integrity": "sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs=", + "dev": true, + "dependencies": { + "core-js": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", + "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", + "dev": true + } + } + }, + "babel-template": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.25.0.tgz", + "integrity": "sha1-ZlJBFmt8KqTGGdceGSlpVSsQwHE=", + "dev": true + }, + "babel-traverse": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.25.0.tgz", + "integrity": "sha1-IldJfi/NGbie3BPEyROB+VEklvE=", + "dev": true, + "dependencies": { + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + } + } + }, + "babel-types": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.25.0.tgz", + "integrity": "sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4=", + "dev": true + }, + "babylon": { + "version": "6.17.4", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", + "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "bluebird": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", + "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true + }, + "breakable": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/breakable/-/breakable-1.0.0.tgz", + "integrity": "sha1-eEp5eRWjjq0nutRWtVcstLuqeME=", + "dev": true + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "camelcase": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", + "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "dev": true + }, + "center-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", + "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "dev": true + }, + "chai": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.0.2.tgz", + "integrity": "sha1-L3MnxN5vOF3XeHmZ4qsCaXoyuDs=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "cliui": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", + "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true + }, + "commoner": { + "version": "0.10.8", + "resolved": "https://registry.npmjs.org/commoner/-/commoner-0.10.8.tgz", + "integrity": "sha1-NPw2cs0kOT6LtH5wyqApOBH08sU=", + "dev": true, + "dependencies": { + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + }, + "recast": { + "version": "0.11.23", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", + "integrity": "sha1-RR/TAEqx5N+bTktmN2sqIZEkYtM=", + "dev": true + } + } + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "convert-source-map": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", + "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", + "dev": true + }, + "core-js": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "dev": true + }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "deep-eql": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-2.0.2.tgz", + "integrity": "sha1-sbrAblbwp2d3aG1Qyf63XC7XZ5o=", + "dev": true, + "dependencies": { + "type-detect": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-3.0.0.tgz", + "integrity": "sha1-RtDMhVOrt7E6NSsNbeov1Y8tm1U=", + "dev": true + } + } + }, + "defined": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", + "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", + "dev": true + }, + "defs": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/defs/-/defs-1.1.1.tgz", + "integrity": "sha1-siYJ8sehG6ej2xFoBcE5scr/qdI=", + "dev": true + }, + "detect-indent": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-3.0.1.tgz", + "integrity": "sha1-ncXl3bzu+DJXZLlFGwK8bVQIT3U=", + "dev": true + }, + "detective": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/detective/-/detective-4.5.0.tgz", + "integrity": "sha1-blqMaybmx6JUsca210kNmOyR7dE=", + "dev": true + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "ebnf-parser": { + "version": "github:GerHobbelt/ebnf-parser#892972f4c1d06918d12e6403b0a7cf5f2a7e2f70", + "dev": true + }, + "es6-promise": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", + "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima-fb": { + "version": "15001.1001.0-dev-harmony-fb", + "resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz", + "integrity": "sha1-Q761fsJujPI3092LM+QlM1d/Jlk=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true + }, + "flow-parser": { + "version": "0.47.0", + "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.47.0.tgz", + "integrity": "sha1-xX01/xm7QPsPByIimOWM1K+opZo=", + "dev": true + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true + }, + "fs-readdir-recursive": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-0.1.2.tgz", + "integrity": "sha1-MVtPuMHKW4xH3v7zGdBz2tNWgFk=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "dev": true + }, + "glob": { + "version": "5.0.15", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", + "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "dev": true + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true + }, + "globals": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/globals/-/globals-6.4.1.tgz", + "integrity": "sha1-hJgDKzttHMge68X3lpDY/in6v08=", + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true + }, + "has-color": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", + "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", + "dev": true + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "home-or-tmp": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-1.0.0.tgz", + "integrity": "sha1-S58eQIAMPlDGwn94FnavzOcfOYU=", + "dev": true + }, + "iconv-lite": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz", + "integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "dev": true + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true + }, + "is-integer": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/is-integer/-/is-integer-1.0.7.tgz", + "integrity": "sha1-a96Bqs3feLZZtmKdYpytxRqIbVw=", + "dev": true + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true + }, + "jison-gho": { + "version": "github:GerHobbelt/jison#c743374d2b66bb1fe901a61d2046be941cf4b83c", + "dev": true + }, + "jison-lex": { + "version": "github:GerHobbelt/jison-lex#5738cf7c5dce4e732e4c8f87ed4fdaed2540a657", + "dev": true + }, + "js-tokens": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.1.tgz", + "integrity": "sha1-zENaXIuUrRWst5gxQPyAGCyJrq4=", + "dev": true + }, + "jscodeshift": { + "version": "0.3.30", + "resolved": "https://registry.npmjs.org/jscodeshift/-/jscodeshift-0.3.30.tgz", + "integrity": "sha1-c/RZ2Pw7OoCEGZGut9JICc7238U=", + "dev": true, + "dependencies": { + "ansi-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", + "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", + "dev": true + }, + "chalk": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", + "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "dev": true + }, + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + }, + "nomnom": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", + "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", + "dev": true + }, + "recast": { + "version": "0.11.23", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", + "integrity": "sha1-RR/TAEqx5N+bTktmN2sqIZEkYtM=", + "dev": true + }, + "strip-ansi": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", + "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", + "dev": true + }, + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + } + } + }, + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + }, + "lazy-cache": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", + "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", + "dev": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true + }, + "leven": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/leven/-/leven-1.0.2.tgz", + "integrity": "sha1-kUS27ryl8dBoAWnxpncNzqYLdcM=", + "dev": true + }, + "lex-parser": { + "version": "github:GerHobbelt/lex-parser#5a70191dfdc96076d79792f700792fca35df1749", + "dev": true + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true + }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true, + "dependencies": { + "js-tokens": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz", + "integrity": "sha1-COnxMkhKLEWjCQfp3E1VZ7fxFNc=", + "dev": true + } + } + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true + }, + "minimatch": { + "version": "2.0.10", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", + "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", + "dev": true + }, + "minimist": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "dependencies": { + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + } + } + }, + "mocha": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.4.2.tgz", + "integrity": "sha1-0O9NMyEm2/GNDWQMmzgt1IvpdZQ=", + "dev": true, + "dependencies": { + "debug": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz", + "integrity": "sha1-vFlryr52F/Edn6FTYe3tVgi4SZs=", + "dev": true + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node-dir": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.8.tgz", + "integrity": "sha1-VfuN62mQcHB/tn+RpGDwRIKUx30=", + "dev": true + }, + "nomnom": { + "version": "github:GerHobbelt/nomnom#aa46a7e4df34a2812cfe1447d4292ec5b3ccdf3e", + "dev": true + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", + "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "output-file-sync": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-1.1.2.tgz", + "integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", + "dev": true + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true + }, + "path-exists": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-1.0.0.tgz", + "integrity": "sha1-1aiZjrce83p0w06w2eum6HjuoIE=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "private": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", + "dev": true + }, + "q": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/q/-/q-1.5.0.tgz", + "integrity": "sha1-3QG6ydBtMObyGa7LglPunr3DCPE=", + "dev": true + }, + "randomatic": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "dev": true, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true + } + } + }, + "recast": { + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.12.3.tgz", + "integrity": "sha1-zjnUGRHqVtaXASFtYeNQpNlQXU0=", + "dev": true, + "dependencies": { + "ast-types": { + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.11.tgz", + "integrity": "sha1-NxF3u1kjL/XOqh0J7lytcFsaWqk=", + "dev": true + }, + "core-js": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", + "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", + "dev": true + }, + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + } + } + }, + "regenerate": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.2.tgz", + "integrity": "sha1-0ZQcZ7rUN+G+dkM63Vs4X5WxkmA=", + "dev": true + }, + "regenerator": { + "version": "0.8.40", + "resolved": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz", + "integrity": "sha1-oORXxY69uuV1yfjNdRJ+k3VkNdg=", + "dev": true, + "dependencies": { + "ast-types": { + "version": "0.8.12", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.8.12.tgz", + "integrity": "sha1-oNkOQ1G7iHcWyD/WN+v4GK9K38w=", + "dev": true + }, + "recast": { + "version": "0.10.33", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz", + "integrity": "sha1-lCgI96oBbx+nFCxGHX5XBKqo1pc=", + "dev": true + } + } + }, + "regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "dev": true + }, + "regenerator-transform": { + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.9.11.tgz", + "integrity": "sha1-On0GdSDLe3F2dp61/4aGkb7+EoM=", + "dev": true + }, + "regex-cache": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.3.tgz", + "integrity": "sha1-mxpsNdTQ3871cRrmUejp09cRQUU=", + "dev": true + }, + "regexpu": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/regexpu/-/regexpu-1.3.0.tgz", + "integrity": "sha1-5TTcmRqeWEYFDJjebX3UpVyeoW0=", + "dev": true, + "dependencies": { + "ast-types": { + "version": "0.8.15", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.8.15.tgz", + "integrity": "sha1-ju8IJ/BN/w7IhXupJavj/qYZTlI=", + "dev": true + }, + "esprima": { + "version": "2.7.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", + "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", + "dev": true + }, + "recast": { + "version": "0.10.43", + "resolved": "https://registry.npmjs.org/recast/-/recast-0.10.43.tgz", + "integrity": "sha1-uV1Q9tYHYaX2JS4V2AZ4FoSRzn8=", + "dev": true + } + } + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true + }, + "remove-trailing-separator": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz", + "integrity": "sha1-abBi2XhyetFNxrVrpKt3L9jXBRE=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-1.1.3.tgz", + "integrity": "sha1-PUEUIYh3U3SU+X93+Xhfq4EPpKw=", + "dev": true + }, + "resolve": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.3.3.tgz", + "integrity": "sha1-ZVkHw0aahoDcLeOidaj91paR8OU=", + "dev": true + }, + "right-align": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", + "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "dev": true + }, + "rimraf": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", + "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "dev": true + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "simple-fmt": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/simple-fmt/-/simple-fmt-0.1.0.tgz", + "integrity": "sha1-GRv1ZqWeZTBILLJatTtKjchcOms=", + "dev": true + }, + "simple-is": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/simple-is/-/simple-is-0.2.0.tgz", + "integrity": "sha1-Krt1qt453rXMgVzhDmGRFkhQuvA=", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "dev": true + }, + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "dev": true + }, + "source-map-support": { + "version": "0.2.10", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.2.10.tgz", + "integrity": "sha1-6lo5AKHByyUJagrozFwrSxDe09w=", + "dev": true, + "dependencies": { + "source-map": { + "version": "0.1.32", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz", + "integrity": "sha1-yLbBZ3l7pHQKjqMyUhYv8IWRsmY=", + "dev": true + } + } + }, + "stable": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.6.tgz", + "integrity": "sha1-kQ9dKu17Ugxud3SZwfMuE5/eyxA=", + "dev": true + }, + "stringmap": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/stringmap/-/stringmap-0.2.2.tgz", + "integrity": "sha1-VWwTeyWPlCuHdvWy71gqoGnX0bE=", + "dev": true + }, + "stringset": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/stringset/-/stringset-0.2.1.tgz", + "integrity": "sha1-7yWcTjSTRDd/zRyRPdLoSMnAQrU=", + "dev": true + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "temp": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", + "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", + "dev": true + }, + "through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "try-resolve": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/try-resolve/-/try-resolve-1.0.1.tgz", + "integrity": "sha1-z95vq9ctY+V5fPqrhzq76OcA6RI=", + "dev": true + }, + "tryor": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz", + "integrity": "sha1-gUXkynyv9ArN48z5Rui4u3W0Fys=", + "dev": true + }, + "type-detect": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", + "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", + "dev": true + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "dev": true + }, + "user-home": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", + "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "dev": true + }, + "window-size": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", + "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=", + "dev": true + }, + "wordwrap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", + "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz", + "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", + "dev": true + }, + "xregexp": { + "version": "github:GerHobbelt/xregexp#7cb56f9a90a802ae34087ac5a257a992904a602c" + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yargs": { + "version": "3.27.0", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.27.0.tgz", + "integrity": "sha1-ISBUaTFuk5Ex1Z8toMbX+YIh6kA=", + "dev": true + } + } +} diff --git a/package.json b/package.json index a77c8a9..0278151 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "xregexp": "github:GerHobbelt/xregexp#master" }, "devDependencies": { - "chai": "3.5.0", + "chai": "4.0.2", "jison-gho": "github:GerHobbelt/jison#master", - "mocha": "3.2.0" + "mocha": "3.4.2" } } From 61b8f1beec20bf415b99bda09b788a5504010cb5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 25 Jun 2017 23:36:17 +0200 Subject: [PATCH 304/417] regenerated library files --- lex-parser.js | 111 ++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 104 insertions(+), 7 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index b19fbf2..0fd3d32 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-179 */ +/* parser generated by jison 0.4.18-181 */ /* * Returns a Parser object of the following structure: @@ -3230,6 +3230,7 @@ var lexer = { // // --------- END OF REPORT ----------- + EOF: 1, ERROR: 2, @@ -3263,7 +3264,12 @@ var lexer = { yylloc: null, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction // INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + /** + @public + @this {RegExpLexer} + */ constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + /** @constructor */ var pei = { errStr: msg, recoverable: !!recoverable, @@ -3281,6 +3287,10 @@ var lexer = { // Note that only array and object references are nuked as those // constitute the set of elements which can produce a cyclic ref. // The rest of the members is kept intact as they are harmless. + /** + @public + @this {LexErrorInfo} + */ destroy: function destructLexErrorInfo() { // remove cyclic references added to error info: // info.yy = null; @@ -3300,6 +3310,10 @@ var lexer = { return pei; }, + /** + @public + @this {RegExpLexer} + */ parseError: function lexer_parseError(str, hash, ExceptionClass) { if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { return this.yy.parser.parseError(str, hash, ExceptionClass) || this.ERROR; @@ -3317,6 +3331,10 @@ var lexer = { // up these constructs, which *may* carry cyclic references which would // otherwise prevent the instances from being properly and timely // garbage-collected, i.e. this function helps prevent memory leaks! + /** + @public + @this {RegExpLexer} + */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { var rv; @@ -3340,6 +3358,10 @@ var lexer = { }, // clear the lexer token context; intended for internal use only + /** + @public + @this {RegExpLexer} + */ clear: function lexer_clear() { this.yytext = ''; this.yyleng = 0; @@ -3350,6 +3372,10 @@ var lexer = { }, // resets the lexer, sets new input + /** + @public + @this {RegExpLexer} + */ setInput: function lexer_setInput(input, yy) { this.yy = yy || this.yy || {}; @@ -3416,6 +3442,10 @@ var lexer = { }, // consumes and returns one char from the input + /** + @public + @this {RegExpLexer} + */ input: function lexer_input() { if (!this._input) { //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) @@ -3466,6 +3496,10 @@ var lexer = { }, // unshifts one char (or a string) into the input + /** + @public + @this {RegExpLexer} + */ unput: function lexer_unput(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); @@ -3497,12 +3531,20 @@ var lexer = { }, // When called from action, caches matched text and appends it on next action + /** + @public + @this {RegExpLexer} + */ more: function lexer_more() { this._more = true; return this; }, // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + /** + @public + @this {RegExpLexer} + */ reject: function lexer_reject() { if (this.options.backtrack_lexer) { this._backtrack = true; @@ -3510,13 +3552,17 @@ var lexer = { // when the `parseError()` call returns, we MUST ensure that the error is registered. // We accomplish this by signaling an 'error' token to be produced for the current // `.lex()` run. - var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), false); + var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), false); this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); } return this; }, // retain first n characters of the match + /** + @public + @this {RegExpLexer} + */ less: function lexer_less(n) { return this.unput(this.match.slice(n)); }, @@ -3525,6 +3571,10 @@ var lexer = { // Limit the returned string length to `maxSize` (default: 20). // Limit the returned string to the `maxLines` number of lines of input (default: 1). // Negative limit values equal *unlimited*. + /** + @public + @this {RegExpLexer} + */ pastInput: function lexer_pastInput(maxSize, maxLines) { var past = this.matched.substring(0, this.matched.length - this.match.length); if (maxSize < 0) @@ -3556,6 +3606,10 @@ var lexer = { // Limit the returned string length to `maxSize` (default: 20). // Limit the returned string to the `maxLines` number of lines of input (default: 1). // Negative limit values equal *unlimited*. + /** + @public + @this {RegExpLexer} + */ upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { var next = this.match; if (maxSize < 0) @@ -3586,6 +3640,10 @@ var lexer = { }, // return a string which displays the character position where the lexing error occurred, i.e. for error messages + /** + @public + @this {RegExpLexer} + */ showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); var c = new Array(pre.length + 1).join('-'); @@ -3596,6 +3654,10 @@ var lexer = { // the input `yylloc` location object. // Set `display_range_too` to TRUE to include the string character index position(s) // in the description if the `yylloc.range` is available. + /** + @public + @this {RegExpLexer} + */ describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { var l1 = yylloc.first_line; var l2 = yylloc.last_line; @@ -3639,6 +3701,10 @@ var lexer = { // - matches // - yylloc // - offset + /** + @public + @this {RegExpLexer} + */ test_match: function lexer_test_match(match, indexed_rule) { var token, lines, @@ -3734,6 +3800,10 @@ var lexer = { }, // return next match in input + /** + @public + @this {RegExpLexer} + */ next: function lexer_next() { if (this.done) { this.clear(); @@ -3760,18 +3830,18 @@ var lexer = { // Check whether a *sane* condition has been pushed before: this makes the lexer robust against // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 if (!spec || !spec.rules) { - var p = this.constructLexErrorInfo('Internal lexer engine error on line ' + (this.yylineno + 1) + '. The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!\n', false); + var p = this.constructLexErrorInfo('Internal lexer engine error on line ' + (this.yylineno + 1) + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!\n', false); // produce one 'error' token until this situation has been resolved, most probably by parse termination! return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); } } var rule_ids = spec.rules; -// var dispatch = spec.__dispatch_lut; + //var dispatch = spec.__dispatch_lut; var regexes = spec.__rule_regexes; var len = spec.__rule_count; -// var c0 = this._input[0]; + //var c0 = this._input[0]; // Note: the arrays are 1-based, while `len` itself is a valid index, // hence the non-standard less-or-equal check in the next loop condition! @@ -3818,7 +3888,7 @@ var lexer = { this.done = true; return this.EOF; } else { - var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); + var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + ': Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us @@ -3832,6 +3902,10 @@ var lexer = { }, // return next match that has a token + /** + @public + @this {RegExpLexer} + */ lex: function lexer_lex() { var r; // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: @@ -3851,11 +3925,19 @@ var lexer = { // backwards compatible alias for `pushState()`; // the latter is symmetrical with `popState()` and we advise to use // those APIs in any modern lexer code, rather than `begin()`. + /** + @public + @this {RegExpLexer} + */ begin: function lexer_begin(condition) { return this.pushState(condition); }, // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + /** + @public + @this {RegExpLexer} + */ pushState: function lexer_pushState(condition) { this.conditionStack.push(condition); this.__currentRuleSet__ = null; @@ -3863,6 +3945,10 @@ var lexer = { }, // pop the previously active lexer condition state off the condition stack + /** + @public + @this {RegExpLexer} + */ popState: function lexer_popState() { var n = this.conditionStack.length - 1; if (n > 0) { @@ -3874,6 +3960,10 @@ var lexer = { }, // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + /** + @public + @this {RegExpLexer} + */ topState: function lexer_topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { @@ -3884,6 +3974,10 @@ var lexer = { }, // (internal) determine the lexer rule set which is active for the currently active lexer condition state + /** + @public + @this {RegExpLexer} + */ _currentRules: function lexer__currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; @@ -3893,12 +3987,15 @@ var lexer = { }, // return the number of states currently on the stack + /** + @public + @this {RegExpLexer} + */ stateStackSize: function lexer_stateStackSize() { return this.conditionStack.length; }, options: { xregexp: true, - inputFilename: "lex.y", easy_keyword_rules: true, ranges: true }, From 1a5331e9c946d250396c433a20620744ae7a4b24 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 23 Jul 2017 03:25:51 +0200 Subject: [PATCH 305/417] updated NPM packages and regenerated library files --- lex-parser.js | 6 +++--- package-lock.json | 50 ++++++++++++++++++++++++++--------------------- package.json | 2 +- 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 0fd3d32..e780d00 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3552,7 +3552,7 @@ var lexer = { // when the `parseError()` call returns, we MUST ensure that the error is registered. // We accomplish this by signaling an 'error' token to be produced for the current // `.lex()` run. - var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), false); + var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), false); this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); } return this; @@ -3830,7 +3830,7 @@ var lexer = { // Check whether a *sane* condition has been pushed before: this makes the lexer robust against // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 if (!spec || !spec.rules) { - var p = this.constructLexErrorInfo('Internal lexer engine error on line ' + (this.yylineno + 1) + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!\n', false); + var p = this.constructLexErrorInfo('Internal lexer engine error on line ' + (this.yylineno + 1) + '. The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!\n', false); // produce one 'error' token until this situation has been resolved, most probably by parse termination! return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); } @@ -3888,7 +3888,7 @@ var lexer = { this.done = true; return this.EOF; } else { - var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + ': Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); + var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us diff --git a/package-lock.json b/package-lock.json index 30e8653..efc82e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -46,9 +46,9 @@ "dev": true }, "arr-flatten": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.0.3.tgz", - "integrity": "sha1-onTthawIhJtr14R8RYB0XcUa37E=", + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, "array-unique": { @@ -88,9 +88,9 @@ "dev": true, "dependencies": { "js-tokens": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz", - "integrity": "sha1-COnxMkhKLEWjCQfp3E1VZ7fxFNc=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true } } @@ -762,9 +762,9 @@ "dev": true }, "chai": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.0.2.tgz", - "integrity": "sha1-L3MnxN5vOF3XeHmZ4qsCaXoyuDs=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.0.tgz", + "integrity": "sha1-MxoDkbVcOvh0CunDt0WLwcOAXm0=", "dev": true }, "chalk": { @@ -792,9 +792,9 @@ "dev": true }, "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", "dev": true }, "commoner": { @@ -892,7 +892,7 @@ "dev": true }, "ebnf-parser": { - "version": "github:GerHobbelt/ebnf-parser#892972f4c1d06918d12e6403b0a7cf5f2a7e2f70", + "version": "github:GerHobbelt/ebnf-parser#5beffb16754b0f48f32a4794593523c6083f85a3", "dev": true }, "es6-promise": { @@ -956,9 +956,9 @@ "dev": true }, "flow-parser": { - "version": "0.47.0", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.47.0.tgz", - "integrity": "sha1-xX01/xm7QPsPByIimOWM1K+opZo=", + "version": "0.51.0", + "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.51.0.tgz", + "integrity": "sha1-4cDOtvgCuiHRbC/ajkLIJPQPRoQ=", "dev": true }, "for-in": { @@ -1178,11 +1178,11 @@ "dev": true }, "jison-gho": { - "version": "github:GerHobbelt/jison#c743374d2b66bb1fe901a61d2046be941cf4b83c", + "version": "github:GerHobbelt/jison#3c086ab3367f4e8df99b5b5321e2b58da2b080ed", "dev": true }, "jison-lex": { - "version": "github:GerHobbelt/jison-lex#5738cf7c5dce4e732e4c8f87ed4fdaed2540a657", + "version": "github:GerHobbelt/jison-lex#bba881cd10094567602db7e6077253f79d7cf83e", "dev": true }, "js-tokens": { @@ -1284,7 +1284,7 @@ "dev": true }, "lex-parser": { - "version": "github:GerHobbelt/lex-parser#5a70191dfdc96076d79792f700792fca35df1749", + "version": "github:GerHobbelt/lex-parser#61b8f1beec20bf415b99bda09b788a5504010cb5", "dev": true }, "lodash": { @@ -1360,9 +1360,9 @@ "dev": true, "dependencies": { "js-tokens": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.1.tgz", - "integrity": "sha1-COnxMkhKLEWjCQfp3E1VZ7fxFNc=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true } } @@ -1405,6 +1405,12 @@ "integrity": "sha1-0O9NMyEm2/GNDWQMmzgt1IvpdZQ=", "dev": true, "dependencies": { + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true + }, "debug": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz", diff --git a/package.json b/package.json index 0278151..bd8e093 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ "xregexp": "github:GerHobbelt/xregexp#master" }, "devDependencies": { - "chai": "4.0.2", + "chai": "4.1.0", "jison-gho": "github:GerHobbelt/jison#master", "mocha": "3.4.2" } From eab87175a3e686b90bf278733563805c35fbceb5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 03:27:03 +0200 Subject: [PATCH 306/417] improved error analysis and reporting for many common coding mistakes in lexer rules, actions, etc. --- lex.y | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 59 insertions(+), 1 deletion(-) diff --git a/lex.y b/lex.y index c8d1be1..7d5a02b 100644 --- a/lex.y +++ b/lex.y @@ -34,6 +34,10 @@ lex delete yy.actionInclude; return $$; } + | init definitions error EOF + { + yyerror("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: definitions %% rules [%% extra_module_code]"); + } ; rules_and_epilogue @@ -102,6 +106,12 @@ definition { $$ = $names_exclusive; } | '{' action_body '}' { yy.actionInclude.push($action_body); $$ = null; } + | '{' action_body error + { + var l = $action_body.split('\n'); + var ab = l.slice(0, 10).join('\n'); + yyerror("Seems you did not correctly bracket the lexer 'preparatory' action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + } | ACTION { yy.actionInclude.push($ACTION); $$ = null; } | include_macro_code @@ -150,6 +160,15 @@ rules_collective } $$ = $rule_block; } + | start_conditions '{' rule_block error + { + if ($start_conditions) { + $rule_block.forEach(function (d) { + d.unshift($start_conditions); + }); + } + yyerror("Seems you did not correctly bracket a lexer rule set inside the start condition <" + $start_conditions.join(',') + "> { rules... } as a terminating curly brace '}' could not be found.", $rule_block); + } ; rule_block @@ -167,6 +186,12 @@ rule action : '{' action_body '}' { $$ = $action_body; } + | '{' action_body error + { + var l = $action_body.split('\n'); + var ab = l.slice(0, 10).join('\n'); + yyerror("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + } | unbracketed_action_body { $$ = $unbracketed_action_body; } | include_macro_code @@ -184,6 +209,12 @@ action_body { $$ = $action_comments_body; } | action_body '{' action_body '}' action_comments_body { $$ = $1 + $2 + $3 + $4 + $5; } + | action_body '{' action_body error + { + var l = $action_body2.split('\n'); + var ab = l.slice(0, 10).join('\n'); + yyerror("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Offending action body part:\n" + ab); + } ; action_comments_body @@ -196,6 +227,12 @@ action_comments_body start_conditions : '<' name_list '>' { $$ = $name_list; } + | '<' name_list error + { + var l = $name_list; + var ab = l.slice(0, 10).join(',').replace(/[\s\r\n]/g, ' '); + yyerror("Seems you did not correctly terminate the start condition set <" + ab + ",???> with a terminating '>'"); + } | '<' '*' '>' { $$ = ['*']; } | ε @@ -252,6 +289,9 @@ regex .replace(/\\[^xu0-9]/g, '.'); try { + // Convert Unicode escapes and other escapes to their literal characters + // BEFORE we go and check whether this item is subject to the + // `easy_keyword_rules` option. $$ = eval('"' + $$ + '"'); } catch (ex) { @@ -297,6 +337,18 @@ regex_base { $$ = '(' + $regex_list + ')'; } | SPECIAL_GROUP regex_list ')' { $$ = $SPECIAL_GROUP + $regex_list + ')'; } + | '(' regex_list error + { + var l = $regex_list; + var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); + yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: (" + ab, $regex_list); + } + | SPECIAL_GROUP regex_list error + { + var l = $regex_list; + var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); + yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: " + $SPECIAL_GROUP + ab, $regex_list); + } | regex_base '+' { $$ = $regex_base + '+'; } | regex_base '*' @@ -328,6 +380,12 @@ name_expansion any_group_regex : REGEX_SET_START regex_set REGEX_SET_END { $$ = $REGEX_SET_START + $regex_set + $REGEX_SET_END; } + | REGEX_SET_START regex_set error + { + var l = $regex_set; + var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); + yyerror("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: " + $REGEX_SET_START + ab, $regex_set); + } ; regex_set @@ -405,7 +463,7 @@ include_macro_code } | INCLUDE error { - console.error("%include MUST be followed by a valid file path"); + yyerror("%include MUST be followed by a valid file path"); } ; From 1311bf953283ad51eeb94b46f632ce030349afea Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 03:47:12 +0200 Subject: [PATCH 307/417] improve error analysis/diagnosis by extended error from the lexer: several easy-to-make mistakes in lexer rule regex writing are caught and now provide a bit of a hint how to proceed. Also relates to https://github.com/zaach/jison/issues/357 --- lex.l | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/lex.l b/lex.l index 5ef164e..62e4fb3 100644 --- a/lex.l +++ b/lex.l @@ -170,7 +170,10 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "%"{NAME}([^\r\n]*) %{ /* ignore unrecognized decl */ - console.warn('LEX: ignoring unsupported lexer option: ', yytext, ' while lexing in ', this.topState(), ' state:', this._input, ' /////// ', this.matched); + var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); + var l2 = 19; + var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); + console.warn('LEX: ignoring unsupported lexer option ' + dquote(yytext) + ' while lexing in ' + this.topState() + ' state:\n' + indent(this.showPosition(l1, l2), 4), this._input, ' /////// ', this.matched); // this.pushState('options'); yytext = [ this.matches[1], // {NAME} @@ -206,12 +209,29 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {WS}+ // skip whitespace in the line [^\s\r\n]+ this.popState(); return 'PATH'; +. %{ + /* b0rk on bad characters */ + var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); + var l2 = 39; + var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + var pos_str = this.showPosition(l1, l2); + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); + } + yyerror('unsupported lexer input: ' + dquote(yytext) + ' while lexing ' + rules + '\n (i.e. jison lex regexes).\n\n NOTE: When you want the input ' + dquote(yytext) + ' to be interpreted as a literal part\n of a lex rule regex, you MUST enclose it in double or single quotes,\n e.g. as shown in this error message just before. If not, then know\n that this is not accepted as a regex operator here in\n jison-lex ' + rules + '.' + pos_str); + %} + <*>. %{ /* b0rk on bad characters */ var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); - var l2 = 3; + var l2 = 39; var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); - throw new Error('unsupported lexer input: "' + yytext + '" @ ' + this.describeYYLLOC(yylloc) + ' while lexing in ' + this.topState() + ' state:\n' + indent(this.showPosition(l1, l2), 4)); + var pos_str = this.showPosition(l1, l2); + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); + } + yyerror('unsupported lexer input: ' + dquote(yytext) + ' while lexing in ' + dquote(this.topState()) + ' state.' + pos_str); %} <*><> return 'EOF'; @@ -223,3 +243,20 @@ function indent(s, i) { var pf = (new Array(i + 1)).join(' '); return pf + a.join('\n' + pf); } + +// properly quote and escape the given input string +function dquote(s) { + var sq = (s.indexOf('\'') >= 0); + var dq = (s.indexOf('"') >= 0); + if (sq && dq) { + s = s.replace(/"/g, '\\"'); + dq = false; + } + if (dq) { + s = '\'' + s + '\''; + } + else { + s = '"' + s + '"'; + } + return s; +} From f46d168cf91b8fda00f2fdd382e9d549abe110f6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 03:47:35 +0200 Subject: [PATCH 308/417] regenerated library files --- lex-parser.js | 1541 ++++++++++++++++++++++++++++--------------------- 1 file changed, 879 insertions(+), 662 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index e780d00..3e252f5 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -528,7 +528,7 @@ var parser = { // uses yytext: ..................... false // uses yylloc: ..................... false // uses ParseError API: ............. false - // uses YYERROR: .................... false + // uses YYERROR: .................... true // uses YYRECOVERING: ............... false // uses YYERROK: .................... false // uses YYCLEARIN: .................. false @@ -771,34 +771,35 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do productions_: bp({ pop: u([ 44, + 44, s, [45, 3], 46, 47, 47, s, - [48, 8], + [48, 9], 49, 49, 50, 50, 51, 51, - 52, - 52, + s, + [52, 3], 53, 53, 54, s, - [55, 3], + [55, 4], 56, 56, - 57, - 57, + s, + [57, 3], 58, 58, s, - [59, 3], + [59, 4], 60, 60, 61, @@ -809,9 +810,10 @@ productions_: bp({ 64, 64, s, - [65, 15], + [65, 17], 66, 67, + 67, 68, 68, 69, @@ -833,8 +835,8 @@ productions_: bp({ 79 ]), rule: u([ - 4, - 4, + s, + [4, 3], 2, 0, 0, @@ -843,50 +845,54 @@ productions_: bp({ s, [2, 3], 3, + 3, s, [1, 5], 2, 1, 2, c, - [14, 3], + [15, 3], c, - [21, 3], + [23, 4], c, - [16, 5], + [18, 6], 2, 1, 5, + 4, c, - [9, 3], + [11, 4], 3, 0, 1, c, - [13, 3], + [15, 3], 0, 3, c, - [28, 3], + [32, 3], 1, - 3, - 3, + s, + [3, 4], s, [2, 5], c, - [10, 3], + [12, 3], s, [1, 6], c, - [21, 3], + [16, 3], + c, + [10, 8], c, - [9, 10], + [9, 3], s, [3, 3], c, [8, 3], c, - [29, 4], + [30, 4], 0 ]) }), @@ -920,6 +926,11 @@ case 1: break; case 2: + /*! Production:: lex : init definitions error EOF */ + yy.parser.yyError("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: definitions %% rules [%% extra_module_code]"); + break; + +case 3: /*! Production:: rules_and_epilogue : "%%" rules "%%" extra_lexer_module_code */ if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; @@ -928,23 +939,23 @@ case 2: } break; -case 3: +case 4: /*! Production:: rules_and_epilogue : "%%" rules */ this.$ = { rules: yyvstack[yysp] }; break; -case 4: +case 5: /*! Production:: rules_and_epilogue : ε */ this.$ = { rules: [] }; break; -case 5: +case 6: /*! Production:: init : ε */ yy.actionInclude = []; if (!yy.options) yy.options = {}; break; -case 6: +case 7: /*! Production:: definitions : definition definitions */ this.$ = yyvstack[yysp]; if (yyvstack[yysp - 1] != null) { @@ -960,7 +971,7 @@ case 6: } break; -case 7: +case 8: /*! Production:: definitions : ε */ this.$ = { macros: {}, // { hash table } @@ -969,91 +980,98 @@ case 7: }; break; -case 8: +case 9: /*! Production:: definition : NAME regex */ -case 26: +case 29: /*! Production:: rule : regex action */ this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; -case 9: - /*! Production:: definition : START_INC names_inclusive */ case 10: + /*! Production:: definition : START_INC names_inclusive */ +case 11: /*! Production:: definition : START_EXC names_exclusive */ -case 28: +case 32: /*! Production:: action : unbracketed_action_body */ -case 29: +case 33: /*! Production:: action : include_macro_code */ -case 32: +case 36: /*! Production:: action_body : action_comments_body */ -case 70: +case 79: /*! Production:: escape_char : ESCAPE_CHAR */ -case 71: +case 80: /*! Production:: range_regex : RANGE_REGEX */ -case 81: +case 90: /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 85: +case 94: /*! Production:: module_code_chunk : CODE */ -case 87: +case 96: /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = yyvstack[yysp]; break; -case 11: +case 12: /*! Production:: definition : "{" action_body "}" */ yy.actionInclude.push(yyvstack[yysp - 1]); this.$ = null; break; -case 12: - /*! Production:: definition : ACTION */ case 13: + /*! Production:: definition : "{" action_body error */ + var l = yyvstack[yysp - 1].split('\n'); + var ab = l.slice(0, 10).join('\n'); + yy.parser.yyError("Seems you did not correctly bracket the lexer 'preparatory' action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + break; + +case 14: + /*! Production:: definition : ACTION */ +case 15: /*! Production:: definition : include_macro_code */ yy.actionInclude.push(yyvstack[yysp]); this.$ = null; break; -case 14: +case 16: /*! Production:: definition : options */ this.$ = null; break; -case 15: +case 17: /*! Production:: definition : UNKNOWN_DECL */ this.$ = {type: 'unknown', body: yyvstack[yysp]}; break; -case 16: +case 18: /*! Production:: names_inclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; break; -case 17: +case 19: /*! Production:: names_inclusive : names_inclusive START_COND */ this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; break; -case 18: +case 20: /*! Production:: names_exclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; break; -case 19: +case 21: /*! Production:: names_exclusive : names_exclusive START_COND */ this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; break; -case 20: +case 22: /*! Production:: rules : rules rules_collective */ this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; -case 21: +case 23: /*! Production:: rules : ε */ -case 25: +case 28: /*! Production:: rule_block : ε */ this.$ = []; break; -case 22: +case 24: /*! Production:: rules_collective : start_conditions rule */ if (yyvstack[yysp - 1]) { yyvstack[yysp].unshift(yyvstack[yysp - 1]); @@ -1061,7 +1079,7 @@ case 22: this.$ = [yyvstack[yysp]]; break; -case 23: +case 25: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ if (yyvstack[yysp - 3]) { yyvstack[yysp - 1].forEach(function (d) { @@ -1071,66 +1089,97 @@ case 23: this.$ = yyvstack[yysp - 1]; break; -case 24: +case 26: + /*! Production:: rules_collective : start_conditions "{" rule_block error */ + if (yyvstack[yysp - 3]) { + yyvstack[yysp - 1].forEach(function (d) { + d.unshift(yyvstack[yysp - 3]); + }); + } + yy.parser.yyError("Seems you did not correctly bracket a lexer rule set inside the start condition <" + yyvstack[yysp - 3].join(',') + "> { rules... } as a terminating curly brace '}' could not be found.", yyvstack[yysp - 1]); + break; + +case 27: /*! Production:: rule_block : rule_block rule */ this.$ = $rules; this.$.push(yyvstack[yysp]); break; -case 27: +case 30: /*! Production:: action : "{" action_body "}" */ -case 36: +case 41: /*! Production:: start_conditions : "<" name_list ">" */ this.$ = yyvstack[yysp - 1]; break; case 31: + /*! Production:: action : "{" action_body error */ + var l = yyvstack[yysp - 1].split('\n'); + var ab = l.slice(0, 10).join('\n'); + yy.parser.yyError("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + break; + +case 35: /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ this.$ = yyvstack[yysp - 1] + '\n' + yyvstack[yysp]; break; -case 33: +case 37: /*! Production:: action_body : action_body "{" action_body "}" action_comments_body */ this.$ = yyvstack[yysp - 4] + yyvstack[yysp - 3] + yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 34: +case 38: + /*! Production:: action_body : action_body "{" action_body error */ + var l = yyvstack[yysp - 1].split('\n'); + var ab = l.slice(0, 10).join('\n'); + yy.parser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Offending action body part:\n" + ab); + break; + +case 39: /*! Production:: action_comments_body : ε */ -case 43: +case 49: /*! Production:: regex_list : ε */ -case 88: +case 97: /*! Production:: optional_module_code_chunk : ε */ this.$ = ''; break; -case 35: +case 40: /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ -case 47: +case 53: /*! Production:: regex_concat : regex_concat regex_base */ -case 57: +case 65: /*! Production:: regex_base : regex_base range_regex */ -case 66: +case 75: /*! Production:: regex_set : regex_set_atom regex_set */ -case 86: +case 95: /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 37: +case 42: + /*! Production:: start_conditions : "<" name_list error */ + var l = yyvstack[yysp - 1]; + var ab = l.slice(0, 10).join(',').replace(/[\s\r\n]/g, ' '); + yy.parser.yyError("Seems you did not correctly terminate the start condition set <" + ab + ",???> with a terminating '>'"); + break; + +case 43: /*! Production:: start_conditions : "<" "*" ">" */ this.$ = ['*']; break; -case 39: +case 45: /*! Production:: name_list : NAME */ this.$ = [yyvstack[yysp]]; break; -case 40: +case 46: /*! Production:: name_list : name_list "," NAME */ this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; -case 41: +case 47: /*! Production:: regex : nonempty_regex_list */ // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' @@ -1173,6 +1222,9 @@ case 41: .replace(/\\[^xu0-9]/g, '.'); try { + // Convert Unicode escapes and other escapes to their literal characters + // BEFORE we go and check whether this item is subject to the + // `easy_keyword_rules` option. this.$ = eval('"' + this.$ + '"'); } catch (ex) { @@ -1192,74 +1244,95 @@ case 41: } break; -case 44: +case 50: /*! Production:: nonempty_regex_list : regex_concat "|" regex_list */ this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; -case 45: +case 51: /*! Production:: nonempty_regex_list : "|" regex_list */ this.$ = '|' + yyvstack[yysp]; break; -case 49: +case 55: /*! Production:: regex_base : "(" regex_list ")" */ this.$ = '(' + yyvstack[yysp - 1] + ')'; break; -case 50: +case 56: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; -case 51: +case 57: + /*! Production:: regex_base : "(" regex_list error */ + var l = yyvstack[yysp - 1]; + var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); + yy.parser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: (" + ab, yyvstack[yysp - 1]); + break; + +case 58: + /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ + var l = yyvstack[yysp - 1]; + var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); + yy.parser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: " + yyvstack[yysp - 2] + ab, yyvstack[yysp - 1]); + break; + +case 59: /*! Production:: regex_base : regex_base "+" */ this.$ = yyvstack[yysp - 1] + '+'; break; -case 52: +case 60: /*! Production:: regex_base : regex_base "*" */ this.$ = yyvstack[yysp - 1] + '*'; break; -case 53: +case 61: /*! Production:: regex_base : regex_base "?" */ this.$ = yyvstack[yysp - 1] + '?'; break; -case 54: +case 62: /*! Production:: regex_base : "/" regex_base */ this.$ = '(?=' + yyvstack[yysp] + ')'; break; -case 55: +case 63: /*! Production:: regex_base : "/!" regex_base */ this.$ = '(?!' + yyvstack[yysp] + ')'; break; -case 59: +case 67: /*! Production:: regex_base : "." */ this.$ = '.'; break; -case 60: +case 68: /*! Production:: regex_base : "^" */ this.$ = '^'; break; -case 61: +case 69: /*! Production:: regex_base : "$" */ this.$ = '$'; break; -case 65: +case 73: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 82: +case 91: /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 69: +case 74: + /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ + var l = yyvstack[yysp - 1]; + var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); + yy.parser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: " + yyvstack[yysp - 2] + ab, yyvstack[yysp - 1]); + break; + +case 78: /*! Production:: regex_set_atom : name_expansion */ if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) && yyvstack[yysp].toUpperCase() !== yyvstack[yysp] @@ -1272,29 +1345,29 @@ case 69: //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 72: +case 81: /*! Production:: string : STRING_LIT */ this.$ = prepareString(yyvstack[yysp].substr(1, yyvstack[yysp].length - 2)); break; -case 77: +case 86: /*! Production:: option : NAME */ yy.options[yyvstack[yysp]] = true; break; -case 78: +case 87: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; -case 79: +case 88: /*! Production:: option : NAME "=" OPTION_VALUE */ -case 80: +case 89: /*! Production:: option : NAME "=" NAME */ yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; -case 83: +case 92: /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); @@ -1302,77 +1375,79 @@ case 83: this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; -case 84: +case 93: /*! Production:: include_macro_code : INCLUDE error */ - console.error("%include MUST be followed by a valid file path"); + yy.parser.yyError("%include MUST be followed by a valid file path"); break; } }, table: bt({ len: u([ - 12, + 13, 1, - 14, - 3, - 14, + 15, + 4, + 15, 21, 2, 2, - 5, + 6, s, - [10, 4], + [11, 4], 2, 3, 1, + 1, 18, - 2, - 10, - 10, - 29, - 32, - 29, - 22, - 22, + 3, + 11, + 11, + 30, + 33, + 30, + 23, + 23, 17, 17, s, - [28, 7], - 30, + [29, 7], + 31, 5, s, - [28, 3], + [29, 3], s, - [11, 4], - 2, + [12, 4], 3, - 26, - 26, - 1, 4, - 3, + 27, + 27, 1, + 4, + c, + [36, 3], 19, - 32, - 29, + 33, + 30, + 12, + 12, + s, + [29, 5], + 2, + 2, + 30, + 30, + 2, + 7, + 4, + 4, + 12, + 12, 11, 11, - s, - [28, 5], - 1, - 1, - 29, - 29, - 1, 6, - 3, - 3, - 11, + 4, 11, - 10, - 5, - 3, - 10, 1, 3, 6, @@ -1380,41 +1455,49 @@ table: bt({ 23, 3, c, - [26, 4], - 1, + [27, 6], + 29, + 2, + 3, s, - [2, 4], + [2, 3], 1, s, [3, 3], 17, - 15, + 16, 6, - 2, + 3, 1, - 2, - 4, - 6, 3, - 23, - 18, 5, + 3, + 6, + 3, + 24, 19, - 18, + 6, + 20, 19, + 20, + 14, 14, - c, - [109, 3], 1, - 17, 14, - 2, + 4, + 1, + 17, + 17, + 15, + 3, + 20, + 3, 19, - 2, - 18 + 19 ]), symbol: u([ 1, + 2, 3, s, [19, 6, 1], @@ -1424,16 +1507,17 @@ table: bt({ 46, 1, c, - [13, 10], + [14, 11], 47, 48, 73, 77, 1, + 2, 19, 45, c, - [17, 14], + [19, 15], 9, 10, s, @@ -1452,77 +1536,80 @@ table: bt({ 49, 25, 50, + 2, 3, 4, 26, 57, 58, c, - [44, 10], + [46, 11], c, - [10, 30], + [11, 33], 2, 42, 20, 74, 75, - c, - [107, 3], + s, + [1, 3], + 3, 5, c, - [79, 6], + [85, 6], 19, c, - [80, 7], + [86, 7], 51, - 1, - 19, c, - [56, 22], + [119, 3], + c, + [61, 25], 9, 10, 11, c, - [40, 5], + [44, 5], c, - [17, 5], + [18, 5], c, - [45, 7], + [49, 7], 37, 41, c, - [124, 5], + [134, 5], c, - [29, 24], + [30, 25], s, [62, 6, 1], c, - [32, 4], + [33, 5], 7, s, [9, 9, 1], c, - [35, 11], + [36, 11], s, [34, 4, 1], 41, 71, + 2, c, - [59, 7], + [61, 7], c, - [53, 7], + [55, 7], c, - [51, 8], + [53, 8], c, - [22, 22], + [23, 23], c, - [249, 12], + [263, 12], c, [17, 22], c, - [107, 28], + [110, 29], c, - [28, 190], + [29, 197], s, [31, 7, 1], 41, @@ -1532,25 +1619,24 @@ table: bt({ 68, 69, c, - [119, 86], + [123, 90], s, [19, 7, 1], c, - [11, 35], - 3, - 4, + [12, 38], c, - [620, 3], - 1, - 3, - 4, + [647, 3], c, - [573, 8], + [650, 4], + s, + [1, 5, 1], c, - [504, 14], + [599, 7], + c, + [525, 14], 43, c, - [26, 26], + [27, 27], 38, 20, 38, @@ -1560,45 +1646,48 @@ table: bt({ 20, 38, c, - [633, 18], + [661, 19], 52, 59, c, - [583, 61], - 1, - 3, + [607, 63], + c, + [30, 3], 11, c, - [684, 10], + [712, 11], c, - [11, 11], + [12, 12], c, - [471, 138], + [493, 142], + 2, 11, + 2, 11, c, - [193, 31], + [203, 33], c, - [29, 27], + [840, 28], 31, + 2, 29, 31, c, - [503, 4], + [530, 4], c, - [6, 3], + [7, 4], c, - [3, 3], + [4, 4], c, - [414, 30], + [439, 33], c, - [413, 4], + [1046, 14], c, - [1031, 3], + [1096, 5], c, - [416, 5], + [452, 7], c, - [18, 8], + [21, 8], 38, 20, 39, @@ -1610,38 +1699,41 @@ table: bt({ 78, 79, c, - [375, 17], + [409, 17], c, - [372, 3], + [405, 3], c, - [836, 11], + [890, 11], 54, c, - [1103, 8], + [1171, 8], 7, 20, 60, c, - [327, 95], + [358, 157], + c, + [387, 30], 31, - 3, - 4, + c, + [256, 3], 20, c, - [526, 3], + [654, 3], c, - [523, 4], + [651, 4], 41, 77, c, - [157, 3], + [250, 3], c, [3, 4], c, - [157, 16], + [250, 16], + 2, 4, c, - [157, 13], + [251, 13], 53, 3, 23, @@ -1649,135 +1741,142 @@ table: bt({ 55, 56, 77, + 2, 6, 8, 6, - 6, - 8, c, - [223, 3], - 58, + [4, 3], c, - [210, 7], + [321, 4], + c, + [326, 4], + c, + [310, 7], 41, 43, c, - [39, 14], + [46, 15], c, - [196, 9], + [297, 9], c, - [646, 11], + [783, 12], c, - [237, 8], + [89, 8], c, - [1313, 6], + [1483, 8], c, - [23, 9], + [25, 9], 23, c, - [24, 7], + [26, 7], + c, + [45, 19], c, - [42, 18], + [39, 20], c, - [37, 19], + [404, 14], c, - [298, 14], + [14, 14], 20, c, [15, 14], c, - [367, 4], + [489, 5], c, - [191, 31], - 3, - 4, + [219, 17], c, - [85, 19], - 6, - 8, + [236, 32], c, - [124, 18] + [217, 4], + c, + [120, 19], + c, + [248, 3], + c, + [162, 31], + c, + [19, 7] ]), type: u([ s, - [2, 10], + [2, 11], 0, 0, 1, c, - [13, 12], + [14, 13], 0, 0, c, - [6, 3], + [7, 4], c, - [17, 16], - s, - [2, 11], - s, - [0, 8], + [19, 18], c, - [37, 3], + [17, 14], c, - [25, 4], + [21, 5], + 0, + c, + [40, 6], c, - [30, 15], + [31, 15], s, - [2, 30], + [2, 34], c, - [45, 20], + [49, 21], c, - [64, 44], + [69, 48], c, - [127, 8], + [137, 8], c, - [29, 29], + [30, 30], c, - [32, 27], + [33, 28], c, - [112, 19], + [118, 20], c, - [51, 22], + [53, 23], c, - [22, 20], + [23, 20], c, [17, 34], s, - [2, 216], + [2, 224], c, - [231, 191], + [239, 202], c, - [190, 23], + [201, 24], c, - [583, 77], + [607, 80], c, - [278, 179], + [291, 188], c, - [29, 33], + [30, 36], c, - [503, 44], + [530, 61], c, - [43, 22], + [389, 26], c, - [66, 34], + [85, 32], s, [0, 9], c, - [338, 110], + [370, 203], c, - [108, 38], + [201, 39], c, - [1248, 6], + [1454, 5], c, - [44, 9], + [289, 13], c, - [15, 15], + [395, 28], c, - [196, 20], + [297, 11], c, - [615, 45], + [752, 48], s, - [2, 137] + [2, 195] ]), state: u([ s, @@ -1785,176 +1884,181 @@ table: bt({ 11, 10, 15, - 17, + 18, c, [5, 3], - 18, 19, 20, - 22, - 27, + 21, + 23, 28, + 29, + 34, 33, - 32, - 39, - 41, - 43, + 40, + 42, 44, - 47, + 45, 48, - 51, + 49, 53, + 55, c, [12, 4], - 54, - 55, + 56, + 57, c, [20, 6], - 59, 61, + 63, c, [9, 7], - 62, + 64, c, [8, 7], - 63, + 65, c, [5, 4], - 64, + 66, c, [5, 4], + 70, + 67, 68, - 65, - 66, - 75, - 48, 78, - 79, + 49, 81, + 82, + 84, c, [42, 8], - 59, - 59, + 61, + 61, + 70, + 91, 68, - 85, - 66, - 86, - 44, - 90, 92, - 91, - 94, + 45, 96, + 98, + 97, + 100, + 102, c, [82, 7], - 97, - 101, 103, - 104, - 106, - 107, - 112, + 108, + 110, + 111, 113, - 92, - 91, - 115, + 114, + 120, + 121, + 98, + 97, + 124, c, [19, 8], - 116, - 44 + 125, + 45 ]), mode: u([ s, - [2, 11], + [2, 13], 1, 2, s, [1, 7], c, - [10, 4], + [8, 3], c, - [12, 8], + [14, 11], s, [1, 15], s, - [2, 43], + [2, 48], c, - [47, 45], + [53, 50], c, - [117, 4], + [129, 5], c, - [48, 9], + [52, 8], c, - [108, 11], + [118, 12], c, - [24, 25], + [25, 26], c, - [28, 6], + [29, 6], c, - [69, 15], + [71, 15], c, - [50, 11], + [52, 12], c, - [178, 10], + [218, 11], s, [1, 35], s, - [2, 226], + [2, 234], + c, + [236, 98], + c, + [97, 24], c, - [228, 94], + [24, 15], c, - [93, 22], + [374, 6], c, - [22, 14], + [142, 55], c, - [130, 4], + [470, 4], c, - [133, 53], + [86, 13], c, - [656, 5], + [72, 11], c, - [80, 11], + [565, 52], c, - [69, 10], + [446, 170], c, - [541, 50], + [310, 9], c, - [425, 166], + [202, 25], c, - [192, 28], + [29, 26], c, - [761, 30], + [310, 5], c, - [117, 57], + [241, 75], c, - [413, 21], + [141, 5], c, - [807, 112], + [80, 18], c, - [98, 10], + [861, 204], c, - [556, 38], + [191, 11], c, - [150, 13], + [236, 21], c, - [281, 6], + [1279, 23], c, - [175, 44], + [245, 14], c, - [208, 59], + [402, 6], c, - [59, 17], + [276, 48], c, - [109, 34], + [425, 76], c, - [110, 40] + [93, 68], + c, + [458, 64] ]), goto: u([ s, - [5, 10], - 7, - 8, - 7, + [6, 11], + s, + [8, 4], 5, 6, 7, @@ -1962,324 +2066,351 @@ table: bt({ 12, 14, 13, - 4, + 5, 16, + 17, c, - [12, 10], - 21, - 23, - 25, - 29, - 30, - 31, + [14, 11], + 22, 24, 26, - 34, + 30, + 31, + 32, + 25, + 27, 35, - 38, 36, + 39, 37, - 40, - 42, + 38, + 41, + 43, s, - [34, 3], + [39, 4], s, - [12, 10], + [14, 11], s, - [13, 10], + [15, 11], s, - [14, 10], + [16, 11], s, - [15, 10], + [17, 11], + 47, 46, - 45, - 49, 50, + 51, + 52, s, - [21, 17], - 6, - 6, + [23, 17], s, - [8, 10], + [7, 3], s, - [41, 10], - 46, - 46, + [9, 11], + s, + [47, 11], + s, + [52, 3], + 54, + 24, 52, - 23, - 46, c, - [104, 4], + [114, 4], s, - [46, 6], + [52, 6], c, - [110, 7], - 46, - 46, - 43, - 43, - 21, - 23, - 43, + [120, 7], + 52, + 52, + s, + [49, 3], + 22, + 24, + 49, c, - [24, 4], + [25, 4], s, - [43, 6], + [49, 6], c, - [24, 7], - 43, - 43, - 48, - 48, - 57, + [25, 7], + 49, + 49, s, - [48, 3], - 56, - 58, + [54, 3], + 59, s, - [48, 15], + [54, 3], + 58, 60, s, - [48, 4], + [54, 15], + 62, + s, + [54, 4], c, - [50, 7], + [52, 8], c, - [44, 7], + [46, 8], c, - [14, 14], + [15, 14], c, - [204, 12], + [218, 12], c, [12, 12], s, - [56, 28], - s, - [58, 28], - s, - [59, 28], + [64, 29], s, - [60, 28], + [66, 29], s, - [61, 28], + [67, 29], s, - [62, 28], + [68, 29], s, - [63, 28], + [69, 29], s, - [64, 30], - 34, - 67, + [70, 29], s, - [72, 28], + [71, 29], s, - [73, 28], + [72, 31], + 35, + 69, s, - [70, 28], + [81, 29], s, - [9, 8], - 69, - 9, - 9, + [82, 29], s, - [16, 11], + [79, 29], s, - [10, 8], - 70, + [10, 9], + 71, 10, 10, s, - [18, 11], - 72, - 71, - 32, - 32, - 73, + [18, 12], s, - [83, 26], + [11, 9], + 72, + 11, + 11, s, - [84, 26], + [20, 12], 74, - 49, - 76, + 75, + 73, + s, + [36, 3], 76, + s, + [92, 27], + s, + [93, 27], 77, - 77, + 50, + 85, + 79, + 86, + 86, 1, - 3, - 38, - 80, + 2, + 4, + 44, + 83, s, - [38, 6], - 77, + [44, 6], + 80, s, - [38, 7], + [44, 7], c, - [541, 24], - 47, - 47, - 57, + [565, 25], s, - [47, 3], - 56, - 58, + [53, 3], + 59, s, - [47, 15], + [53, 3], + 58, 60, s, - [47, 4], + [53, 15], + 62, s, - [45, 11], + [53, 4], s, - [42, 11], + [51, 12], s, - [51, 28], + [48, 12], s, - [52, 28], + [59, 29], s, - [53, 28], + [60, 29], s, - [57, 28], + [61, 29], s, - [71, 28], - 82, - 83, - 54, - 54, - 57, + [65, 29], s, - [54, 3], - 56, - 58, + [80, 29], + 86, + 85, + 88, + 87, s, - [54, 15], + [62, 3], + 59, + s, + [62, 3], + 58, 60, s, - [54, 4], - 55, - 55, - 57, + [62, 20], s, - [55, 3], - 56, - 58, + [63, 3], + 59, s, - [55, 15], + [63, 3], + 58, 60, s, - [55, 4], - 84, - 34, - 67, - 67, + [63, 15], + c, + [25, 4], + 63, + 90, + 89, + 76, + 35, + 76, + 69, s, - [68, 3], + [77, 4], s, - [69, 3], + [78, 4], s, - [17, 11], + [19, 12], s, - [19, 11], + [21, 12], s, - [11, 10], + [12, 11], s, - [34, 3], + [13, 11], s, - [35, 3], + [39, 4], s, - [74, 10], - 75, - 89, - 87, + [40, 4], s, - [88, 3], + [83, 11], + 84, + 95, 93, + 94, + 97, + 97, + 99, s, - [20, 17], - 95, + [22, 17], + 101, c, - [1021, 13], - 98, - 99, + [1089, 13], + 104, + 105, + s, + [50, 12], s, - [44, 11], + [55, 29], s, - [49, 28], + [57, 29], s, - [50, 28], + [56, 29], s, - [65, 28], - 66, - 72, - 100, - 78, - 78, - 79, - 79, - 80, - 80, - 2, - 81, - 13, + [58, 29], + s, + [73, 29], + s, + [74, 29], + 75, + 75, + 107, + 75, + 106, 87, 87, - 102, + 88, + 88, + 89, + 89, + 3, + 90, + 13, + 96, + 96, + 109, s, - [85, 3], + [94, 3], s, - [22, 17], + [24, 17], s, - [25, 14], - 105, - 108, + [28, 15], + 112, + 115, 13, - 109, - 110, - 111, - 39, - 39, + 117, + 116, + 118, + 119, + s, + [45, 3], s, - [34, 3], + [39, 4], + s, + [38, 3], c, - [191, 3], + [291, 3], s, - [86, 3], - 114, + [95, 3], + 123, + 122, c, - [177, 13], + [278, 13], s, - [26, 18], + [29, 19], s, - [34, 3], + [39, 4], s, - [28, 11], - 117, + [32, 12], + 126, s, - [28, 7], + [32, 7], s, - [29, 18], + [33, 19], s, - [30, 19], + [34, 20], s, - [36, 14], - 118, + [41, 14], s, - [37, 14], - 33, - 33, - 73, - 82, + [42, 14], + 127, s, - [23, 17], + [43, 14], s, - [24, 14], - 72, - 119, + [37, 3], + 76, + 91, s, - [31, 19], - 40, - 40, + [25, 17], + s, + [26, 17], + s, + [27, 15], + 129, + 75, + 128, s, - [27, 18] + [35, 20], + s, + [46, 3], + s, + [30, 19], + s, + [31, 19] ]) }), defaultActions: bda({ @@ -2288,109 +2419,117 @@ defaultActions: bda({ s, [8, 5, 1], s, - [16, 4, 1], + [17, 4, 1], s, - [27, 8, 1], - 36, + [28, 8, 1], 37, 38, - 40, - 42, - 45, + 39, + 41, + 43, 46, - 50, + 47, + 51, + 52, s, - [54, 7, 1], + [56, 7, 1], s, - [67, 9, 1], - 78, + [69, 10, 1], + 81, s, - [81, 5, 1], + [84, 8, 1], s, - [87, 4, 1], - 93, - 94, - 95, + [93, 4, 1], 99, 100, - 102, - 104, + 101, 105, + 106, 107, - 108, 109, 111, - 113, - 114, - 115, - 117, - 118, - 119 + 112, + s, + [114, 4, 1], + 119, + s, + [121, 4, 1], + s, + [126, 4, 1] ]), goto: u([ - 5, - 34, - s, - [12, 4, 1], - 21, 6, - 8, - 41, - 56, + 39, s, - [58, 7, 1], - 72, - 73, - 70, - 16, + [14, 4, 1], + 23, + 7, + 9, + 47, + 64, + s, + [66, 7, 1], + 81, + 82, + 79, 18, - 83, - 84, + 20, + 92, + 93, 1, - 45, - 42, + 2, 51, - 52, - 53, - 57, - 71, - 68, - 69, - 17, - 19, - 11, - 34, - 35, - 74, - 75, - 20, - 44, - 49, - 50, + 48, + 59, + 60, + 61, 65, - 66, - 78, - 79, 80, - 2, - 85, + 77, + 78, + 19, + 21, + 12, + 13, + 39, + 40, + 83, + 84, 22, - 25, + 50, + 55, + 57, + 56, + 58, + 73, + 74, + 75, + 87, + 88, + 89, + 3, + 94, + 24, + 28, + 45, + 39, + 38, + 95, + 29, 39, + 33, 34, - 86, + 41, + 42, + 43, + 91, + 25, 26, - 34, - 29, + 27, + 35, + 46, 30, - 36, - 37, - 82, - 23, - 24, - 31, - 40, - 27 + 31 ]) }), parseError: function parseError(str, hash, ExceptionClass) { @@ -2449,6 +2588,40 @@ parse: function parse(input) { + + + + + + + + + + + + + + // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount + // to have *their* closure match ours -- if we only set them up once, + // any subsequent `parse()` runs will fail in very obscure ways when + // these functions are invoked in the user action code block(s) as + // their closure will still refer to the `parse()` instance which set + // them up. Hence we MUST set them up at the start of every `parse()` run! + if (this.yyError) { + this.yyError = function yyError(str) { + + // var error_rule_depth = locateNearestErrorRecoveryRule(state); + // var expected = this.collect_expected_token_set(state); + var hash = this.constructParseErrorInfo(str, null, null, false); // (str, null, expected, (error_rule_depth >= 0)); + var r = this.parseError(str, hash, this.JisonParserError); + }; + } + + + + + + lexer.setInput(input, sharedState_yy); @@ -2949,7 +3122,8 @@ parse: function parse(input) { } return retval; -} +}, +yyError: 1 }; parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; @@ -4237,7 +4411,10 @@ case 68 : /*! Rule:: %{NAME}([^\r\n]*) */ /* ignore unrecognized decl */ - console.warn('LEX: ignoring unsupported lexer option: ', yy_.yytext, ' while lexing in ', this.topState(), ' state:', this._input, ' /////// ', this.matched); + var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); + var l2 = 19; + var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); + console.warn('LEX: ignoring unsupported lexer option ' + dquote(yy_.yytext) + ' while lexing in ' + this.topState() + ' state:\n' + indent(this.showPosition(l1, l2), 4), this._input, ' /////// ', this.matched); // this.pushState('options'); yy_.yytext = [ this.matches[1], // {NAME} @@ -4287,14 +4464,34 @@ case 84 : this.popState(); return 42; break; case 85 : +/*! Conditions:: macro rules */ +/*! Rule:: . */ + + /* b0rk on bad characters */ + var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); + var l2 = 39; + var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + var pos_str = this.showPosition(l1, l2); + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); + } + yyerror('unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing ' + rules + '\n (i.e. jison lex regexes).\n\n NOTE: When you want the input ' + dquote(yy_.yytext) + ' to be interpreted as a literal part\n of a lex rule regex, you MUST enclose it in double or single quotes,\n e.g. as shown in this error message just before. If not, then know\n that this is not accepted as a regex operator here in\n jison-lex ' + rules + '.' + pos_str); + +break; +case 86 : /*! Conditions:: * */ /*! Rule:: . */ /* b0rk on bad characters */ var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); - var l2 = 3; + var l2 = 39; var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); - throw new Error('unsupported lexer input: "' + yy_.yytext + '" @ ' + this.describeYYLLOC(yy_.yylloc) + ' while lexing in ' + this.topState() + ' state:\n' + indent(this.showPosition(l1, l2), 4)); + var pos_str = this.showPosition(l1, l2); + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); + } + yyerror('unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing in ' + dquote(this.topState()) + ' state.' + pos_str); break; default: @@ -4416,7 +4613,7 @@ default: 78 : 43, /*! Conditions:: * */ /*! Rule:: $ */ - 86 : 1 + 87 : 1 }, rules: [ /^(?:\/\*(.|\n|\r)*?\*\/)/, @@ -4505,6 +4702,7 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", /^(?:([^\S\n\r])+)/, /^(?:\S+)/, /^(?:.)/, +/^(?:.)/, /^(?:$)/ ], conditions: { @@ -4514,8 +4712,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 68, 78, 79, - 85, - 86 + 86, + 87 ], inclusive: false }, @@ -4526,8 +4724,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 28, 29, 30, - 85, - 86 + 86, + 87 ], inclusive: false }, @@ -4544,8 +4742,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 26, 27, 72, - 85, - 86 + 86, + 87 ], inclusive: false }, @@ -4555,8 +4753,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 10, 11, 12, - 85, - 86 + 86, + 87 ], inclusive: false }, @@ -4571,8 +4769,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 6, 7, 8, - 85, - 86 + 86, + 87 ], inclusive: false }, @@ -4585,8 +4783,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 82, 83, 84, - 85, - 86 + 86, + 87 ], inclusive: false }, @@ -4596,8 +4794,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 75, 76, 77, - 85, - 86 + 86, + 87 ], inclusive: false }, @@ -4640,8 +4838,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 71, 73, 74, - 85, - 86 + 86, + 87 ], inclusive: true }, @@ -4685,8 +4883,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 71, 73, 74, - 85, - 86 + 86, + 87 ], inclusive: true }, @@ -4734,7 +4932,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 73, 74, 85, - 86 + 86, + 87 ], inclusive: true }, @@ -4778,7 +4977,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 73, 74, 85, - 86 + 86, + 87 ], inclusive: true }, @@ -4822,8 +5022,8 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", 71, 73, 74, - 85, - 86 + 86, + 87 ], inclusive: true } @@ -4835,6 +5035,23 @@ function indent(s, i) { var a = s.split('\n'); var pf = (new Array(i + 1)).join(' '); return pf + a.join('\n' + pf); +} + +// properly quote and escape the given input string +function dquote(s) { + var sq = (s.indexOf('\'') >= 0); + var dq = (s.indexOf('"') >= 0); + if (sq && dq) { + s = s.replace(/"/g, '\\"'); + dq = false; + } + if (dq) { + s = '\'' + s + '\''; + } + else { + s = '"' + s + '"'; + } + return s; }; return lexer; From 4a05ec24344a39678ca148df727b89c4db728812 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 04:01:48 +0200 Subject: [PATCH 309/417] bumped build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index efc82e5..9599368 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lex-parser", - "version": "0.1.4-181", + "version": "0.1.4-182", "lockfileVersion": 1, "dependencies": { "acorn": { diff --git a/package.json b/package.json index bd8e093..1f0f18c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-181", + "version": "0.1.4-182", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From b2f896f3b81d33cfadaa6bfb3fd526e8b11799db Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 04:23:16 +0200 Subject: [PATCH 310/417] rebuilt library files --- lex-parser.js | 633 +++++++++++++++++--------- package-lock.json | 1114 +++++++++++++++------------------------------ 2 files changed, 765 insertions(+), 982 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 3e252f5..1b5f051 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-181 */ +/* parser generated by jison 0.4.18-182 */ /* * Returns a Parser object of the following structure: @@ -508,6 +508,9 @@ var parser = { // no default resolve on conflict: false // on-demand look-ahead: ............ false // error recovery token skip maximum: 3 + // yyerror in parse actions is: ..... NOT recoverable, + // yyerror in lexer actions and other non-fatal lexer are: + // .................................. NOT recoverable, // debug grammar/output: ............ false // has partial LR conflict upgrade: true // rudimentary token-stack support: false @@ -2533,10 +2536,13 @@ defaultActions: bda({ ]) }), parseError: function parseError(str, hash, ExceptionClass) { - if (hash.recoverable) { + if (hash.recoverable && typeof this.trace === 'function') { this.trace(str); hash.destroy(); // destroy... well, *almost*! } else { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } throw new ExceptionClass(str, hash); } }, @@ -2608,12 +2614,23 @@ parse: function parse(input) { // their closure will still refer to the `parse()` instance which set // them up. Hence we MUST set them up at the start of every `parse()` run! if (this.yyError) { - this.yyError = function yyError(str) { + this.yyError = function yyError(str /*, ...args */) { + + + + var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1); + var expected = this.collect_expected_token_set(state); + var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0)); + + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + if (args.length) { + hash.extra_error_attributes = args; + } - // var error_rule_depth = locateNearestErrorRecoveryRule(state); - // var expected = this.collect_expected_token_set(state); - var hash = this.constructParseErrorInfo(str, null, null, false); // (str, null, expected, (error_rule_depth >= 0)); var r = this.parseError(str, hash, this.JisonParserError); + return r; }; } @@ -2635,6 +2652,9 @@ parse: function parse(input) { // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState_yy.parseError === 'function') { this.parseError = function parseErrorAlt(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } return sharedState_yy.parseError(str, hash, ExceptionClass); }; } else { @@ -2922,7 +2942,13 @@ parse: function parse(input) { // suit the error recovery rules... The error HAS been reported already so we're fine with // throwing away a few items if that is what it takes to match the nearest recovery rule! if (symbol === EOF || preErrorSymbol === EOF) { - p = this.constructParseErrorInfo((errStr || 'Parsing halted while starting to recover from another error.'), null, expected, false); + p = this.__error_infos[this.__error_infos.length - 1]; + if (!p) { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error.', null, expected, false); + } else { + p.errStr = 'Parsing halted while starting to recover from another error. Previous error which resulted in this fatal result: ' + p.errStr; + p.recoverable = false; + } retval = this.parseError(p.errStr, p, this.JisonParserError); break; } @@ -3113,9 +3139,18 @@ parse: function parse(input) { break; } } catch (ex) { - // report exceptions through the parseError callback too: - p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); - retval = this.parseError(p.errStr, p, this.JisonParserError); + // report exceptions through the parseError callback too, but keep the exception intact + // if it is a known parser or lexer error which has been thrown by parseError() already: + if (ex instanceof this.JisonParserError) { + throw ex; + } + else if (lexer && typeof lexer.JisonLexerError === 'function' && ex instanceof lexer.JisonLexerError) { + throw ex; + } + else { + p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + } } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; @@ -3386,21 +3421,43 @@ JisonLexerError.prototype.name = 'JisonLexerError'; var lexer = { + // Code Generator Information Report // --------------------------------- // // Options: - // backtracking: false - // location.ranges: true + // + // backtracking: .................... false + // location.ranges: ................. true + // location line+column tracking: ... true + // // // Forwarded Parser Analysis flags: - // uses yyleng: false - // uses yylineno: false - // uses yytext: false - // uses yylloc: false - // uses lexer values: true / true - // location tracking: false - // location assignment: false + // + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses lexer values: ............... true / true + // location tracking: ............... false + // location assignment: ............. false + // + // + // Lexer Analysis flags: + // + // uses yyleng: ..................... undefined + // uses yylineno: ................... undefined + // uses yytext: ..................... undefined + // uses yylloc: ..................... undefined + // uses ParseError API: ............. undefined + // uses location tracking & editing: undefined + // uses more() API: ................. undefined + // uses unput() API: ................ undefined + // uses reject() API: ............... undefined + // uses less() API: ................. undefined + // uses display APIs pastInput(), upcomingInput(), showPosition(): + // ............................. undefined + // uses describeYYLLOC() API: ....... undefined // // --------- END OF REPORT ----------- @@ -3408,39 +3465,40 @@ var lexer = { EOF: 1, ERROR: 2, - // JisonLexerError: JisonLexerError, // <-- injected by the code generator + // JisonLexerError: JisonLexerError, /// <-- injected by the code generator - // options: {}, // <-- injected by the code generator + // options: {}, /// <-- injected by the code generator - // yy: ..., // <-- injected by setInput() + // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, // <-- internal rule set cache for the current lexer state + __currentRuleSet__: null, /// <-- internal rule set cache for the current lexer state - __error_infos: [], // INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __decompressed: false, // INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - done: false, // INTERNAL USE ONLY - _backtrack: false, // INTERNAL USE ONLY - _input: '', // INTERNAL USE ONLY - _more: false, // INTERNAL USE ONLY - _signaled_error_token: false, // INTERNAL USE ONLY + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY - conditionStack: [], // INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - match: '', // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', // ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, // READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction - // INTERNAL USE: construct a suitable error info hash object instance for `parseError`. /** - @public - @this {RegExpLexer} + INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + + @public + @this {RegExpLexer} */ constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { /** @constructor */ @@ -3454,16 +3512,17 @@ var lexer = { yy: this.yy, lexer: this, - // and make sure the error info doesn't stay due to potential - // ref cycle via userland code manipulations. - // These would otherwise all be memory leak opportunities! - // - // Note that only array and object references are nuked as those - // constitute the set of elements which can produce a cyclic ref. - // The rest of the members is kept intact as they are harmless. - /** - @public - @this {LexErrorInfo} + /** + and make sure the error info doesn't stay due to potential + ref cycle via userland code manipulations. + These would otherwise all be memory leak opportunities! + + Note that only array and object references are nuked as those + constitute the set of elements which can produce a cyclic ref. + The rest of the members is kept intact as they are harmless. + + @public + @this {LexErrorInfo} */ destroy: function destructLexErrorInfo() { // remove cyclic references added to error info: @@ -3484,11 +3543,16 @@ var lexer = { return pei; }, - /** - @public - @this {RegExpLexer} + /** + handler which is invoked when a lexer error occurs. + + @public + @this {RegExpLexer} */ parseError: function lexer_parseError(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonLexerError; + } if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { return this.yy.parser.parseError(str, hash, ExceptionClass) || this.ERROR; } else if (typeof this.yy.parseError === 'function') { @@ -3498,16 +3562,39 @@ var lexer = { } }, - // final cleanup function for when we have completed lexing the input; - // make it an API so that external code can use this one once userland - // code has decided it's time to destroy any lingering lexer error - // hash object instances and the like: this function helps to clean - // up these constructs, which *may* carry cyclic references which would - // otherwise prevent the instances from being properly and timely - // garbage-collected, i.e. this function helps prevent memory leaks! - /** - @public - @this {RegExpLexer} + /** + method which implements `yyerror(str, ...args)` functionality for use inside lexer actions. + + @public + @this {RegExpLexer} + */ + yyerror: function yyError(str /*, ...args */) { + var lineno_msg = ''; + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': ' + str, this.options.lexerErrorsAreRecoverable); + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + if (args.length) { + hash.extra_error_attributes = args; + } + + return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); + }, + + /** + final cleanup function for when we have completed lexing the input; + make it an API so that external code can use this one once userland + code has decided it's time to destroy any lingering lexer error + hash object instances and the like: this function helps to clean + up these constructs, which *may* carry cyclic references which would + otherwise prevent the instances from being properly and timely + garbage-collected, i.e. this function helps prevent memory leaks! + + @public + @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { var rv; @@ -3531,10 +3618,11 @@ var lexer = { return this; }, - // clear the lexer token context; intended for internal use only - /** - @public - @this {RegExpLexer} + /** + clear the lexer token context; intended for internal use only + + @public + @this {RegExpLexer} */ clear: function lexer_clear() { this.yytext = ''; @@ -3543,12 +3631,23 @@ var lexer = { this.matches = false; this._more = false; this._backtrack = false; + + var col = this.yylloc ? this.yylloc.last_column : 0; + this.yylloc = { + first_line: this.yylineno + 1, + first_column: col, + last_line: this.yylineno + 1, + last_column: col, + + range: (this.options.ranges ? [this.offset, this.offset] : undefined) + }; }, - // resets the lexer, sets new input - /** - @public - @this {RegExpLexer} + /** + resets the lexer, sets new input + + @public + @this {RegExpLexer} */ setInput: function lexer_setInput(input, yy) { this.yy = yy || this.yy || {}; @@ -3606,19 +3705,63 @@ var lexer = { first_line: 1, first_column: 0, last_line: 1, - last_column: 0 + last_column: 0, + + range: (this.options.ranges ? [0, 0] : undefined) }; - if (this.options.ranges) { - this.yylloc.range = [0, 0]; - } this.offset = 0; return this; }, - // consumes and returns one char from the input - /** - @public - @this {RegExpLexer} + /** + push a new input into the lexer and activate it: + the old input position is stored and will be resumed + once this new input has been consumed. + + Use this API to help implement C-preprocessor-like + `#include` statements. + + Available options: + + - `emit_EOF_at_end` : {int} the `EOF`-like token to emit + when the new input is consumed: use + this to mark the end of the new input + in the parser grammar. zero/falsey + token value means no end marker token + will be emitted before the lexer + resumes reading from the previous input. + + @public + @this {RegExpLexer} + */ + pushInput: function lexer_pushInput(input, label, options) { + options = options || {}; + + this._input = input || ''; + this.clear(); + // this._signaled_error_token = false; + this.done = false; + this.yylineno = 0; + this.matched = ''; + // this.conditionStack = ['INITIAL']; + // this.__currentRuleSet__ = null; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0, + + range: (this.options.ranges ? [0, 0] : undefined) + }; + this.offset = 0; + return this; + }, + + /** + consumes and returns one char from the input + + @public + @this {RegExpLexer} */ input: function lexer_input() { if (!this._input) { @@ -3658,6 +3801,7 @@ var lexer = { if (lines) { this.yylineno++; this.yylloc.last_line++; + this.yylloc.last_column = 0; } else { this.yylloc.last_column++; } @@ -3669,10 +3813,11 @@ var lexer = { return ch; }, - // unshifts one char (or a string) into the input - /** - @public - @this {RegExpLexer} + /** + unshifts one char (or an entire string) into the input + + @public + @this {RegExpLexer} */ unput: function lexer_unput(ch) { var len = ch.length; @@ -3680,44 +3825,49 @@ var lexer = { this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); - //this.yyleng -= len; + this.yyleng = this.yytext.length; this.offset -= len; - var oldLines = this.match.split(/(?:\r\n?|\n)/g); this.match = this.match.substr(0, this.match.length - len); this.matched = this.matched.substr(0, this.matched.length - len); - if (lines.length - 1) { + if (lines.length > 1) { this.yylineno -= lines.length - 1; - } - this.yylloc.last_line = this.yylineno + 1; - this.yylloc.last_column = (lines ? - (lines.length === oldLines.length ? this.yylloc.first_column : 0) - + oldLines[oldLines.length - lines.length].length - lines[0].length : - this.yylloc.first_column - len); + this.yylloc.last_line = this.yylineno + 1; + var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); + if (pre_lines.length === 1) { + pre = this.matched; + pre_lines = pre.split(/(?:\r\n?|\n)/g); + } + this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; + } else { + this.yylloc.last_column -= len; + } if (this.options.ranges) { - this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng - len; + this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; } - this.yyleng = this.yytext.length; this.done = false; return this; }, - // When called from action, caches matched text and appends it on next action - /** - @public - @this {RegExpLexer} + /** + cache matched text and append it on next action + + @public + @this {RegExpLexer} */ more: function lexer_more() { this._more = true; return this; }, - // When called from action, signals the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. - /** - @public - @this {RegExpLexer} + /** + signal the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. + + @public + @this {RegExpLexer} */ reject: function lexer_reject() { if (this.options.backtrack_lexer) { @@ -3726,28 +3876,41 @@ var lexer = { // when the `parseError()` call returns, we MUST ensure that the error is registered. // We accomplish this by signaling an 'error' token to be produced for the current // `.lex()` run. - var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).\n' + this.showPosition(), false); + var lineno_msg = ''; + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + var pos_str = this.showPosition(); + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, false); this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); } return this; }, - // retain first n characters of the match - /** - @public - @this {RegExpLexer} + /** + retain first n characters of the match + + @public + @this {RegExpLexer} */ less: function lexer_less(n) { return this.unput(this.match.slice(n)); }, - // return (part of the) already matched input, i.e. for error messages. - // Limit the returned string length to `maxSize` (default: 20). - // Limit the returned string to the `maxLines` number of lines of input (default: 1). - // Negative limit values equal *unlimited*. - /** - @public - @this {RegExpLexer} + /** + return (part of the) already matched input, i.e. for error messages. + + Limit the returned string length to `maxSize` (default: 20). + + Limit the returned string to the `maxLines` number of lines of input (default: 1). + + Negative limit values equal *unlimited*. + + @public + @this {RegExpLexer} */ pastInput: function lexer_pastInput(maxSize, maxLines) { var past = this.matched.substring(0, this.matched.length - this.match.length); @@ -3776,13 +3939,17 @@ var lexer = { return past; }, - // return (part of the) upcoming input, i.e. for error messages. - // Limit the returned string length to `maxSize` (default: 20). - // Limit the returned string to the `maxLines` number of lines of input (default: 1). - // Negative limit values equal *unlimited*. - /** - @public - @this {RegExpLexer} + /** + return (part of the) upcoming input, i.e. for error messages. + + Limit the returned string length to `maxSize` (default: 20). + + Limit the returned string to the `maxLines` number of lines of input (default: 1). + + Negative limit values equal *unlimited*. + + @public + @this {RegExpLexer} */ upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { var next = this.match; @@ -3813,10 +3980,11 @@ var lexer = { return next; }, - // return a string which displays the character position where the lexing error occurred, i.e. for error messages - /** - @public - @this {RegExpLexer} + /** + return a string which displays the character position where the lexing error occurred, i.e. for error messages + + @public + @this {RegExpLexer} */ showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); @@ -3824,25 +3992,27 @@ var lexer = { return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; }, - // helper function, used to produce a human readable description as a string, given - // the input `yylloc` location object. - // Set `display_range_too` to TRUE to include the string character index position(s) - // in the description if the `yylloc.range` is available. - /** - @public - @this {RegExpLexer} + /** + helper function, used to produce a human readable description as a string, given + the input `yylloc` location object. + + Set `display_range_too` to TRUE to include the string character index position(s) + in the description if the `yylloc.range` is available. + + @public + @this {RegExpLexer} */ describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { var l1 = yylloc.first_line; var l2 = yylloc.last_line; var o1 = yylloc.first_column; - var o2 = yylloc.last_column - 1; + var o2 = yylloc.last_column; var dl = l2 - l1; - var d_o = (dl === 0 ? o2 - o1 : 1000); + var d_o = o2 - o1; var rv; if (dl === 0) { rv = 'line ' + l1 + ', '; - if (d_o === 0) { + if (d_o === 1) { rv += 'column ' + o1; } else { rv += 'columns ' + o1 + ' .. ' + o2; @@ -3863,21 +4033,23 @@ var lexer = { // return JSON.stringify(yylloc); }, - // test the lexed token: return FALSE when not a match, otherwise return token. - // - // `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` - // contains the actually matched text string. - // - // Also move the input cursor forward and update the match collectors: - // - yytext - // - yyleng - // - match - // - matches - // - yylloc - // - offset - /** - @public - @this {RegExpLexer} + /** + test the lexed token: return FALSE when not a match, otherwise return token. + + `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + contains the actually matched text string. + + Also move the input cursor forward and update the match collectors: + + - `yytext` + - `yyleng` + - `match` + - `matches` + - `yylloc` + - `offset` + + @public + @this {RegExpLexer} */ test_match: function lexer_test_match(match, indexed_rule) { var token, @@ -3892,9 +4064,11 @@ var lexer = { yylineno: this.yylineno, yylloc: { first_line: this.yylloc.first_line, - last_line: this.last_line, + last_line: this.yylloc.last_line, first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column + last_column: this.yylloc.last_column, + + range: (this.options.ranges ? this.yylloc.range.slice(0) : undefined) }, yytext: this.yytext, match: this.match, @@ -3904,37 +4078,32 @@ var lexer = { offset: this.offset, _more: this._more, _input: this._input, + //_signaled_error_token: this._signaled_error_token, yy: this.yy, conditionStack: this.conditionStack.slice(0), done: this.done }; - if (this.options.ranges) { - backup.yylloc.range = this.yylloc.range.slice(0); - } } match_str = match[0]; match_str_len = match_str.length; // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { - lines = match_str.match(/(?:\r\n?|\n).*/g); - if (lines) { - this.yylineno += lines.length; + lines = match_str.split(/(?:\r\n?|\n)/g); + if (lines.length > 1) { + this.yylineno += lines.length - 1; + + this.yylloc.last_line = this.yylineno + 1, + this.yylloc.last_column = lines[lines.length - 1].length; + } else { + this.yylloc.last_column += match_str_len; } // } - this.yylloc = { - first_line: this.yylloc.last_line, - last_line: this.yylineno + 1, - first_column: this.yylloc.last_column, - last_column: lines ? - lines[lines.length - 1].length - lines[lines.length - 1].match(/^\r?\n?/)[0].length : - this.yylloc.last_column + match_str_len - }; this.yytext += match_str; this.match += match_str; this.matches = match; this.yyleng = this.yytext.length; if (this.options.ranges) { - this.yylloc.range = [this.offset, this.offset + this.yyleng]; + this.yylloc.range[1] += match_str_len; } // previous lex rules MAY have invoked the `more()` API rather than producing a token: // those rules will already have moved this `offset` forward matching their match lengths, @@ -3973,10 +4142,11 @@ var lexer = { return false; }, - // return next match in input - /** - @public - @this {RegExpLexer} + /** + return next match in input + + @public + @this {RegExpLexer} */ next: function lexer_next() { if (this.done) { @@ -4004,7 +4174,15 @@ var lexer = { // Check whether a *sane* condition has been pushed before: this makes the lexer robust against // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 if (!spec || !spec.rules) { - var p = this.constructLexErrorInfo('Internal lexer engine error on line ' + (this.yylineno + 1) + '. The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!\n', false); + var lineno_msg = ''; + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + var pos_str = this.showPosition(); + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + var p = this.constructLexErrorInfo('Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, false); // produce one 'error' token until this situation has been resolved, most probably by parse termination! return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); } @@ -4015,21 +4193,9 @@ var lexer = { var regexes = spec.__rule_regexes; var len = spec.__rule_count; - //var c0 = this._input[0]; - // Note: the arrays are 1-based, while `len` itself is a valid index, // hence the non-standard less-or-equal check in the next loop condition! - // - // `dispatch` is a lookup table which lists the *first* rule which matches the 1-char *prefix* of the rule-to-match. - // By using that array as a jumpstart, we can cut down on the otherwise O(n*m) behaviour of this lexer, down to - // O(n) ideally, where: - // - // - N is the number of input particles -- which is not precisely characters - // as we progress on a per-regex-match basis rather than on a per-character basis - // - // - M is the number of rules (regexes) to test in the active condition state. - // - for (var i = 1 /* (dispatch[c0] || 1) */ ; i <= len; i++) { + for (var i = 1; i <= len; i++) { tempMatch = this._input.match(regexes[i]); if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; @@ -4058,11 +4224,20 @@ var lexer = { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } - if (this._input === '') { + if (!this._input) { this.done = true; + this.clear(); return this.EOF; } else { - var p = this.constructLexErrorInfo('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), this.options.lexer_errors_are_recoverable); + var lineno_msg = ''; + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + var pos_str = this.showPosition(); + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, this.options.lexerErrorsAreRecoverable); token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us @@ -4075,10 +4250,11 @@ var lexer = { } }, - // return next match that has a token - /** - @public - @this {RegExpLexer} + /** + return next match that has a token + + @public + @this {RegExpLexer} */ lex: function lexer_lex() { var r; @@ -4096,21 +4272,23 @@ var lexer = { return r; }, - // backwards compatible alias for `pushState()`; - // the latter is symmetrical with `popState()` and we advise to use - // those APIs in any modern lexer code, rather than `begin()`. - /** - @public - @this {RegExpLexer} + /** + backwards compatible alias for `pushState()`; + the latter is symmetrical with `popState()` and we advise to use + those APIs in any modern lexer code, rather than `begin()`. + + @public + @this {RegExpLexer} */ begin: function lexer_begin(condition) { return this.pushState(condition); }, - // activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) - /** - @public - @this {RegExpLexer} + /** + activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) + + @public + @this {RegExpLexer} */ pushState: function lexer_pushState(condition) { this.conditionStack.push(condition); @@ -4118,10 +4296,11 @@ var lexer = { return this; }, - // pop the previously active lexer condition state off the condition stack - /** - @public - @this {RegExpLexer} + /** + pop the previously active lexer condition state off the condition stack + + @public + @this {RegExpLexer} */ popState: function lexer_popState() { var n = this.conditionStack.length - 1; @@ -4133,10 +4312,11 @@ var lexer = { } }, - // return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available - /** - @public - @this {RegExpLexer} + /** + return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available + + @public + @this {RegExpLexer} */ topState: function lexer_topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); @@ -4147,10 +4327,11 @@ var lexer = { } }, - // (internal) determine the lexer rule set which is active for the currently active lexer condition state - /** - @public - @this {RegExpLexer} + /** + (internal) determine the lexer rule set which is active for the currently active lexer condition state + + @public + @this {RegExpLexer} */ _currentRules: function lexer__currentRules() { if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { @@ -4160,18 +4341,20 @@ var lexer = { } }, - // return the number of states currently on the stack - /** - @public - @this {RegExpLexer} + /** + return the number of states currently on the stack + + @public + @this {RegExpLexer} */ stateStackSize: function lexer_stateStackSize() { return this.conditionStack.length; }, options: { xregexp: true, - easy_keyword_rules: true, - ranges: true + ranges: true, + trackPosition: true, + easy_keyword_rules: true }, JisonLexerError: JisonLexerError, performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) { @@ -4476,7 +4659,7 @@ case 85 : if (pos_str && pos_str[0] !== '\n') { pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); } - yyerror('unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing ' + rules + '\n (i.e. jison lex regexes).\n\n NOTE: When you want the input ' + dquote(yy_.yytext) + ' to be interpreted as a literal part\n of a lex rule regex, you MUST enclose it in double or single quotes,\n e.g. as shown in this error message just before. If not, then know\n that this is not accepted as a regex operator here in\n jison-lex ' + rules + '.' + pos_str); + yy_.yyerror('unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing ' + rules + '\n (i.e. jison lex regexes).\n\n NOTE: When you want the input ' + dquote(yy_.yytext) + ' to be interpreted as a literal part\n of a lex rule regex, you MUST enclose it in double or single quotes,\n e.g. as shown in this error message just before. If not, then know\n that this is not accepted as a regex operator here in\n jison-lex ' + rules + '.' + pos_str); break; case 86 : @@ -4491,7 +4674,7 @@ case 86 : if (pos_str && pos_str[0] !== '\n') { pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); } - yyerror('unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing in ' + dquote(this.topState()) + ' state.' + pos_str); + yy_.yyerror('unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing in ' + dquote(this.topState()) + ' state.' + pos_str); break; default: @@ -4616,7 +4799,7 @@ default: 87 : 1 }, rules: [ -/^(?:\/\*(.|\n|\r)*?\*\/)/, + /^(?:\/\*(.|\n|\r)*?\*\/)/, /^(?:\/\/.*)/, /^(?:\/[^ \/]*?['"{}][^ ]*?\/)/, /^(?:"(\\\\|\\"|[^"])*")/, @@ -4704,7 +4887,7 @@ new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", /^(?:.)/, /^(?:.)/, /^(?:$)/ -], + ], conditions: { "code": { rules: [ diff --git a/package-lock.json b/package-lock.json index 9599368..0f457bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3,30 +3,6 @@ "version": "0.1.4-182", "lockfileVersion": 1, "dependencies": { - "acorn": { - "version": "4.0.13", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz", - "integrity": "sha1-EFSVrlNh1pe9GVyCUZLhrX8lN4c=", - "dev": true - }, - "align-text": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", - "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", - "dev": true - }, - "alter": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/alter/-/alter-0.2.0.tgz", - "integrity": "sha1-x1iICGF1cgNKrmJICvJrHU0cs80=", - "dev": true - }, - "amdefine": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz", - "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=", - "dev": true - }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", @@ -63,89 +39,17 @@ "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", "dev": true }, - "ast-traverse": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ast-traverse/-/ast-traverse-0.1.1.tgz", - "integrity": "sha1-ac8rg4bxnc2hux4F1o/jWdiJfeY=", - "dev": true - }, - "ast-types": { - "version": "0.9.6", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.6.tgz", - "integrity": "sha1-ECyenpAF0+fjgpvwxPok7oYu6bk=", - "dev": true - }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, "babel-code-frame": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", - "dev": true, - "dependencies": { - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - } - } - }, - "babel-core": { - "version": "5.8.38", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-5.8.38.tgz", - "integrity": "sha1-H8ruedfmG3ULALjlT238nQr4ZVg=", - "dev": true, - "dependencies": { - "babylon": { - "version": "5.8.38", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-5.8.38.tgz", - "integrity": "sha1-7JsSCxG/bM1Bc6GL8hfmC3mFn/0=", - "dev": true - }, - "json5": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.4.0.tgz", - "integrity": "sha1-BUNS5MTIDIbAkjh31EneF2pzLI0=", - "dev": true - }, - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - } - } + "dev": true }, "babel-generator": { "version": "6.25.0", "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", "integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", - "dev": true, - "dependencies": { - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true - }, - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", - "dev": true - }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true - } - } + "dev": true }, "babel-helper-bindify-decorators": { "version": "6.24.1", @@ -243,92 +147,6 @@ "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", "dev": true }, - "babel-plugin-constant-folding": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-constant-folding/-/babel-plugin-constant-folding-1.0.1.tgz", - "integrity": "sha1-g2HTZMmORJw2kr26Ue/whEKQqo4=", - "dev": true - }, - "babel-plugin-dead-code-elimination": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/babel-plugin-dead-code-elimination/-/babel-plugin-dead-code-elimination-1.0.2.tgz", - "integrity": "sha1-X3xFEnTc18zNv7s+C4XdKBIfD2U=", - "dev": true - }, - "babel-plugin-eval": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-eval/-/babel-plugin-eval-1.0.1.tgz", - "integrity": "sha1-ovrtJc5r5preS/7CY/cBaRlZUNo=", - "dev": true - }, - "babel-plugin-inline-environment-variables": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-inline-environment-variables/-/babel-plugin-inline-environment-variables-1.0.1.tgz", - "integrity": "sha1-H1jOkSB61qgmqL9kX6/mj/X+P/4=", - "dev": true - }, - "babel-plugin-jscript": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/babel-plugin-jscript/-/babel-plugin-jscript-1.0.4.tgz", - "integrity": "sha1-jzQsOCduh6R9X6CovT1etsytj8w=", - "dev": true - }, - "babel-plugin-member-expression-literals": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-member-expression-literals/-/babel-plugin-member-expression-literals-1.0.1.tgz", - "integrity": "sha1-zF7bD6qNyScXDnTW0cAkQAIWJNM=", - "dev": true - }, - "babel-plugin-property-literals": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-property-literals/-/babel-plugin-property-literals-1.0.1.tgz", - "integrity": "sha1-AlIwGQAZKYCxwRjv6kjOk6q4MzY=", - "dev": true - }, - "babel-plugin-proto-to-assign": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/babel-plugin-proto-to-assign/-/babel-plugin-proto-to-assign-1.0.4.tgz", - "integrity": "sha1-xJ56/QL1d7xNoF6i3wAiUM980SM=", - "dev": true, - "dependencies": { - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=", - "dev": true - } - } - }, - "babel-plugin-react-constant-elements": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/babel-plugin-react-constant-elements/-/babel-plugin-react-constant-elements-1.0.3.tgz", - "integrity": "sha1-lGc26DeEKcvDSdz/YvUcFDs041o=", - "dev": true - }, - "babel-plugin-react-display-name": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/babel-plugin-react-display-name/-/babel-plugin-react-display-name-1.0.3.tgz", - "integrity": "sha1-dU/jiSboQkpOexWrbqYTne4FFPw=", - "dev": true - }, - "babel-plugin-remove-console": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-remove-console/-/babel-plugin-remove-console-1.0.1.tgz", - "integrity": "sha1-2PJFVsOgUAXUKqqv0neH9T/wE6c=", - "dev": true - }, - "babel-plugin-remove-debugger": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/babel-plugin-remove-debugger/-/babel-plugin-remove-debugger-1.0.1.tgz", - "integrity": "sha1-/S6jzWGkKK0fO5yJiC/0KT6MFMc=", - "dev": true - }, - "babel-plugin-runtime": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/babel-plugin-runtime/-/babel-plugin-runtime-1.0.7.tgz", - "integrity": "sha1-v3x9lm3Vbs1cF/ocslPJrLflSq8=", - "dev": true - }, "babel-plugin-syntax-async-functions": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", @@ -569,12 +387,6 @@ "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", "dev": true }, - "babel-plugin-transform-flow-strip-types": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", - "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", - "dev": true - }, "babel-plugin-transform-object-rest-spread": { "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz", @@ -593,30 +405,6 @@ "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", "dev": true }, - "babel-plugin-undeclared-variables-check": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/babel-plugin-undeclared-variables-check/-/babel-plugin-undeclared-variables-check-1.0.2.tgz", - "integrity": "sha1-XPGqU52BP/ZOmWQSkK9iCWX2Xe4=", - "dev": true - }, - "babel-plugin-undefined-to-void": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/babel-plugin-undefined-to-void/-/babel-plugin-undefined-to-void-1.1.6.tgz", - "integrity": "sha1-f1eO+LeN+uYAM4XYQXph7aBuL4E=", - "dev": true - }, - "babel-preset-es2015": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", - "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", - "dev": true - }, - "babel-preset-stage-1": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", - "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", - "dev": true - }, "babel-preset-stage-2": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", @@ -629,63 +417,25 @@ "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", "dev": true }, - "babel-register": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.24.1.tgz", - "integrity": "sha1-fhDhOi9xBlvfrVoXh7pFvKbe118=", - "dev": true, - "dependencies": { - "babel-core": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.25.0.tgz", - "integrity": "sha1-fdQrBGPHQunVKW3rPsZ6kyLa1yk=", - "dev": true - }, - "core-js": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", - "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", - "dev": true - }, - "home-or-tmp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", - "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true - }, - "source-map-support": { - "version": "0.4.15", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", - "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", - "dev": true - } - } - }, "babel-runtime": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz", - "integrity": "sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs=", - "dev": true, - "dependencies": { - "core-js": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", - "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", - "dev": true - } - } + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", + "integrity": "sha1-M7mOql1IK7AajRqmtDetKwGuxBw=", + "dev": true }, "babel-template": { "version": "6.25.0", "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.25.0.tgz", "integrity": "sha1-ZlJBFmt8KqTGGdceGSlpVSsQwHE=", - "dev": true + "dev": true, + "dependencies": { + "babylon": { + "version": "6.17.4", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", + "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", + "dev": true + } + } }, "babel-traverse": { "version": "6.25.0", @@ -693,10 +443,10 @@ "integrity": "sha1-IldJfi/NGbie3BPEyROB+VEklvE=", "dev": true, "dependencies": { - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "babylon": { + "version": "6.17.4", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", + "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", "dev": true } } @@ -707,24 +457,12 @@ "integrity": "sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4=", "dev": true }, - "babylon": { - "version": "6.17.4", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", - "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", - "dev": true - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "bluebird": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz", - "integrity": "sha1-U0uQM8AiyVecVro7Plpcqvu2UOE=", - "dev": true - }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", @@ -737,28 +475,22 @@ "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", "dev": true }, - "breakable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/breakable/-/breakable-1.0.0.tgz", - "integrity": "sha1-eEp5eRWjjq0nutRWtVcstLuqeME=", - "dev": true - }, "browser-stdout": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", "dev": true }, - "camelcase": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-1.2.1.tgz", - "integrity": "sha1-m7UwTS4LVmmLLHWLCKPqqdqlijk=", + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, - "center-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/center-align/-/center-align-0.1.3.tgz", - "integrity": "sha1-qg0yYptu6XIgBBHL1EYckHvCt60=", + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", "dev": true }, "chai": { @@ -767,12 +499,6 @@ "integrity": "sha1-MxoDkbVcOvh0CunDt0WLwcOAXm0=", "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true - }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -780,43 +506,31 @@ "dev": true }, "cliui": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-2.1.0.tgz", - "integrity": "sha1-S0dXYP+AJkx2LDoXGQMukcf+oNE=", - "dev": true - }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", - "dev": true - }, - "commoner": { - "version": "0.10.8", - "resolved": "https://registry.npmjs.org/commoner/-/commoner-0.10.8.tgz", - "integrity": "sha1-NPw2cs0kOT6LtH5wyqApOBH08sU=", + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", "dev": true, "dependencies": { - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - }, - "recast": { - "version": "0.11.23", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", - "integrity": "sha1-RR/TAEqx5N+bTktmN2sqIZEkYtM=", + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true } } }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -829,10 +543,10 @@ "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", "dev": true }, - "core-js": { - "version": "1.2.7", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", - "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true }, "debug": { @@ -861,28 +575,10 @@ } } }, - "defined": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", - "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", - "dev": true - }, - "defs": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/defs/-/defs-1.1.1.tgz", - "integrity": "sha1-siYJ8sehG6ej2xFoBcE5scr/qdI=", - "dev": true - }, "detect-indent": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-3.0.1.tgz", - "integrity": "sha1-ncXl3bzu+DJXZLlFGwK8bVQIT3U=", - "dev": true - }, - "detective": { - "version": "4.5.0", - "resolved": "https://registry.npmjs.org/detective/-/detective-4.5.0.tgz", - "integrity": "sha1-blqMaybmx6JUsca210kNmOyR7dE=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", "dev": true }, "diff": { @@ -891,14 +587,10 @@ "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", "dev": true }, - "ebnf-parser": { - "version": "github:GerHobbelt/ebnf-parser#5beffb16754b0f48f32a4794593523c6083f85a3", - "dev": true - }, - "es6-promise": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-3.3.1.tgz", - "integrity": "sha1-oIzd6EzNvzTQJ6FFG8kdS80ophM=", + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true }, "escape-string-regexp": { @@ -907,22 +599,16 @@ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "esprima-fb": { - "version": "15001.1001.0-dev-harmony-fb", - "resolved": "https://registry.npmjs.org/esprima-fb/-/esprima-fb-15001.1001.0-dev-harmony-fb.tgz", - "integrity": "sha1-Q761fsJujPI3092LM+QlM1d/Jlk=", - "dev": true - }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", "dev": true }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true }, "expand-brackets": { @@ -955,10 +641,10 @@ "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", "dev": true }, - "flow-parser": { - "version": "0.51.0", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.51.0.tgz", - "integrity": "sha1-4cDOtvgCuiHRbC/ajkLIJPQPRoQ=", + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true }, "for-in": { @@ -973,34 +659,34 @@ "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", "dev": true }, - "fs-readdir-recursive": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-0.1.2.tgz", - "integrity": "sha1-MVtPuMHKW4xH3v7zGdBz2tNWgFk=", - "dev": true - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, - "get-stdin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", - "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=", + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, "glob": { - "version": "5.0.15", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz", - "integrity": "sha1-G8k2ueAvSmA/zCIuz3Yz0wuLk7E=", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", "dev": true }, "glob-base": { @@ -1016,9 +702,9 @@ "dev": true }, "globals": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/globals/-/globals-6.4.1.tgz", - "integrity": "sha1-hJgDKzttHMge68X3lpDY/in6v08=", + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", "dev": true }, "graceful-fs": { @@ -1058,15 +744,15 @@ "dev": true }, "home-or-tmp": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-1.0.0.tgz", - "integrity": "sha1-S58eQIAMPlDGwn94FnavzOcfOYU=", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", "dev": true }, - "iconv-lite": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.18.tgz", - "integrity": "sha512-sr1ZQph3UwHTR0XftSbK85OvBbxe/abLGzEnPENCQwmHf7sck8Oyu4ob3LgBxWWxRoM+QszeUyl7jbqapu2TqA==", + "hosted-git-info": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", "dev": true }, "imurmurhash": { @@ -1099,12 +785,24 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, "is-buffer": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", "dev": true }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true + }, "is-dotfile": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", @@ -1135,18 +833,18 @@ "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", "dev": true }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true + }, "is-glob": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true }, - "is-integer": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/is-integer/-/is-integer-1.0.7.tgz", - "integrity": "sha1-a96Bqs3feLZZtmKdYpytxRqIbVw=", - "dev": true - }, "is-number": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", @@ -1165,12 +863,24 @@ "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", "dev": true }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "isobject": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", @@ -1178,73 +888,19 @@ "dev": true }, "jison-gho": { - "version": "github:GerHobbelt/jison#3c086ab3367f4e8df99b5b5321e2b58da2b080ed", - "dev": true - }, - "jison-lex": { - "version": "github:GerHobbelt/jison-lex#bba881cd10094567602db7e6077253f79d7cf83e", + "version": "github:GerHobbelt/jison#3449c6aa662268fa2a8d47394aaffde45eb82bea", "dev": true }, "js-tokens": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-1.0.1.tgz", - "integrity": "sha1-zENaXIuUrRWst5gxQPyAGCyJrq4=", + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true }, - "jscodeshift": { - "version": "0.3.30", - "resolved": "https://registry.npmjs.org/jscodeshift/-/jscodeshift-0.3.30.tgz", - "integrity": "sha1-c/RZ2Pw7OoCEGZGut9JICc7238U=", - "dev": true, - "dependencies": { - "ansi-styles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", - "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", - "dev": true - }, - "chalk": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", - "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", - "dev": true - }, - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - }, - "nomnom": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", - "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", - "dev": true - }, - "recast": { - "version": "0.11.23", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.11.23.tgz", - "integrity": "sha1-RR/TAEqx5N+bTktmN2sqIZEkYtM=", - "dev": true - }, - "strip-ansi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", - "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", - "dev": true - }, - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", "dev": true }, "json3": { @@ -1253,44 +909,28 @@ "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", "dev": true }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true }, - "lazy-cache": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-1.0.4.tgz", - "integrity": "sha1-odePw6UEdMuAhF07O24dpJpEbo4=", - "dev": true - }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true }, - "leven": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/leven/-/leven-1.0.2.tgz", - "integrity": "sha1-kUS27ryl8dBoAWnxpncNzqYLdcM=", - "dev": true - }, - "lex-parser": { - "version": "github:GerHobbelt/lex-parser#61b8f1beec20bf415b99bda09b788a5504010cb5", + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", "dev": true }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true }, "lodash._baseassign": { @@ -1347,57 +987,47 @@ "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true }, - "longest": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", - "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", - "dev": true - }, "loose-envify": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", - "dev": true, - "dependencies": { - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - } - } + "dev": true }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", "dev": true }, "minimatch": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz", - "integrity": "sha1-jQh8OcazjAAbl/ynzm0OHoCvusc=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true }, "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } + "dev": true }, "mocha": { "version": "3.4.2", @@ -1405,30 +1035,12 @@ "integrity": "sha1-0O9NMyEm2/GNDWQMmzgt1IvpdZQ=", "dev": true, "dependencies": { - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true - }, "debug": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz", "integrity": "sha1-vFlryr52F/Edn6FTYe3tVgi4SZs=", "dev": true }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true - }, "ms": { "version": "0.7.2", "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", @@ -1449,14 +1061,10 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "node-dir": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.8.tgz", - "integrity": "sha1-VfuN62mQcHB/tn+RpGDwRIKUx30=", - "dev": true - }, - "nomnom": { - "version": "github:GerHobbelt/nomnom#aa46a7e4df34a2812cfe1447d4292ec5b3ccdf3e", + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true }, "normalize-path": { @@ -1465,18 +1073,18 @@ "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", "dev": true }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true - }, "object.omit": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", @@ -1496,9 +1104,9 @@ "dev": true }, "os-locale": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-1.4.0.tgz", - "integrity": "sha1-IPnxeuKe00XoveWDsT0gCYA8FNk=", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true }, "os-tmpdir": { @@ -1507,10 +1115,22 @@ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true }, - "output-file-sync": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-1.1.2.tgz", - "integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", + "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", + "dev": true + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true }, "parse-glob": { @@ -1519,10 +1139,16 @@ "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", "dev": true }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true + }, "path-exists": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-1.0.0.tgz", - "integrity": "sha1-1aiZjrce83p0w06w2eum6HjuoIE=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", "dev": true }, "path-is-absolute": { @@ -1531,10 +1157,16 @@ "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", "dev": true }, "pathval": { @@ -1543,22 +1175,22 @@ "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, "preserve": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, - "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", - "dev": true - }, - "q": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/q/-/q-1.5.0.tgz", - "integrity": "sha1-3QG6ydBtMObyGa7LglPunr3DCPE=", + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, "randomatic": { @@ -1589,31 +1221,17 @@ } } }, - "recast": { - "version": "0.12.3", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.12.3.tgz", - "integrity": "sha1-zjnUGRHqVtaXASFtYeNQpNlQXU0=", - "dev": true, - "dependencies": { - "ast-types": { - "version": "0.9.11", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.11.tgz", - "integrity": "sha1-NxF3u1kjL/XOqh0J7lytcFsaWqk=", - "dev": true - }, - "core-js": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", - "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", - "dev": true - }, - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - } - } + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true }, "regenerate": { "version": "1.3.2", @@ -1621,26 +1239,6 @@ "integrity": "sha1-0ZQcZ7rUN+G+dkM63Vs4X5WxkmA=", "dev": true }, - "regenerator": { - "version": "0.8.40", - "resolved": "https://registry.npmjs.org/regenerator/-/regenerator-0.8.40.tgz", - "integrity": "sha1-oORXxY69uuV1yfjNdRJ+k3VkNdg=", - "dev": true, - "dependencies": { - "ast-types": { - "version": "0.8.12", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.8.12.tgz", - "integrity": "sha1-oNkOQ1G7iHcWyD/WN+v4GK9K38w=", - "dev": true - }, - "recast": { - "version": "0.10.33", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.10.33.tgz", - "integrity": "sha1-lCgI96oBbx+nFCxGHX5XBKqo1pc=", - "dev": true - } - } - }, "regenerator-runtime": { "version": "0.10.5", "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", @@ -1659,32 +1257,6 @@ "integrity": "sha1-mxpsNdTQ3871cRrmUejp09cRQUU=", "dev": true }, - "regexpu": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/regexpu/-/regexpu-1.3.0.tgz", - "integrity": "sha1-5TTcmRqeWEYFDJjebX3UpVyeoW0=", - "dev": true, - "dependencies": { - "ast-types": { - "version": "0.8.15", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.8.15.tgz", - "integrity": "sha1-ju8IJ/BN/w7IhXupJavj/qYZTlI=", - "dev": true - }, - "esprima": { - "version": "2.7.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", - "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=", - "dev": true - }, - "recast": { - "version": "0.10.43", - "resolved": "https://registry.npmjs.org/recast/-/recast-0.10.43.tgz", - "integrity": "sha1-uV1Q9tYHYaX2JS4V2AZ4FoSRzn8=", - "dev": true - } - } - }, "regexpu-core": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", @@ -1701,7 +1273,15 @@ "version": "0.1.5", "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", - "dev": true + "dev": true, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } }, "remove-trailing-separator": { "version": "1.0.2", @@ -1722,21 +1302,21 @@ "dev": true }, "repeating": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-1.1.3.tgz", - "integrity": "sha1-PUEUIYh3U3SU+X93+Xhfq4EPpKw=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", "dev": true }, - "resolve": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.3.3.tgz", - "integrity": "sha1-ZVkHw0aahoDcLeOidaj91paR8OU=", + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", "dev": true }, - "right-align": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/right-align/-/right-align-0.1.3.tgz", - "integrity": "sha1-YTObci/mo1FWiSENJOFMlhSGE+8=", + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, "rimraf": { @@ -1745,22 +1325,34 @@ "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", "dev": true }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true + }, "shebang-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", "dev": true }, - "simple-fmt": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/simple-fmt/-/simple-fmt-0.1.0.tgz", - "integrity": "sha1-GRv1ZqWeZTBILLJatTtKjchcOms=", - "dev": true - }, - "simple-is": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/simple-is/-/simple-is-0.2.0.tgz", - "integrity": "sha1-Krt1qt453rXMgVzhDmGRFkhQuvA=", + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, "slash": { @@ -1775,66 +1367,78 @@ "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", "dev": true }, - "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", - "dev": true - }, "source-map-support": { - "version": "0.2.10", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.2.10.tgz", - "integrity": "sha1-6lo5AKHByyUJagrozFwrSxDe09w=", - "dev": true, - "dependencies": { - "source-map": { - "version": "0.1.32", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.32.tgz", - "integrity": "sha1-yLbBZ3l7pHQKjqMyUhYv8IWRsmY=", - "dev": true - } - } + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", + "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", + "dev": true }, - "stable": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.6.tgz", - "integrity": "sha1-kQ9dKu17Ugxud3SZwfMuE5/eyxA=", + "spdx-correct": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", "dev": true }, - "stringmap": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/stringmap/-/stringmap-0.2.2.tgz", - "integrity": "sha1-VWwTeyWPlCuHdvWy71gqoGnX0bE=", + "spdx-expression-parse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", "dev": true }, - "stringset": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/stringset/-/stringset-0.2.1.tgz", - "integrity": "sha1-7yWcTjSTRDd/zRyRPdLoSMnAQrU=", + "spdx-license-ids": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true + } + } + }, "strip-ansi": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", "dev": true }, - "temp": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", - "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, "to-fast-properties": { @@ -1849,47 +1453,43 @@ "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "dev": true }, - "try-resolve": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/try-resolve/-/try-resolve-1.0.1.tgz", - "integrity": "sha1-z95vq9ctY+V5fPqrhzq76OcA6RI=", - "dev": true - }, - "tryor": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/tryor/-/tryor-0.1.2.tgz", - "integrity": "sha1-gUXkynyv9ArN48z5Rui4u3W0Fys=", - "dev": true - }, "type-detect": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", "dev": true }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "validate-npm-package-license": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", "dev": true }, - "user-home": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", - "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "which": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", + "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", "dev": true }, - "window-size": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/window-size/-/window-size-0.1.4.tgz", - "integrity": "sha1-+OGqHuWlPsW/FR/6CXQqatdpeHY=", + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, - "wordwrap": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz", - "integrity": "sha1-t5Zpu0LstAn4PVg8rVLKF+qhZD8=", - "dev": true + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true + } + } }, "wrappy": { "version": "1.0.2", @@ -1897,12 +1497,6 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "write-file-atomic": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.4.tgz", - "integrity": "sha1-+Aek8LHZ6ROuekgRLmzDrxmRtF8=", - "dev": true - }, "xregexp": { "version": "github:GerHobbelt/xregexp#7cb56f9a90a802ae34087ac5a257a992904a602c" }, @@ -1912,10 +1506,16 @@ "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", "dev": true }, - "yargs": { - "version": "3.27.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.27.0.tgz", - "integrity": "sha1-ISBUaTFuk5Ex1Z8toMbX+YIh6kA=", + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", "dev": true } } From f4ecfb333212a4c2a06660db2aa162b023f45801 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 04:33:07 +0200 Subject: [PATCH 311/417] rebuilt library files --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0f457bf..28c8883 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lex-parser", - "version": "0.1.4-182", + "version": "0.1.4-183", "lockfileVersion": 1, "dependencies": { "ansi-regex": { diff --git a/package.json b/package.json index 1f0f18c..aa5533c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-182", + "version": "0.1.4-183", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From faca425e9c789fbc1a270486d2434b6155839367 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 04:39:18 +0200 Subject: [PATCH 312/417] bumped build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 28c8883..17c2e31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lex-parser", - "version": "0.1.4-183", + "version": "0.1.4-184", "lockfileVersion": 1, "dependencies": { "ansi-regex": { diff --git a/package.json b/package.json index aa5533c..3ac8311 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-183", + "version": "0.1.4-184", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 5099fa73b48fba7339925db7eb0cb3fcecb57c55 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 04:40:10 +0200 Subject: [PATCH 313/417] updated NPM packages --- package-lock.json | 1522 --------------------------------------------- 1 file changed, 1522 deletions(-) delete mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 17c2e31..0000000 --- a/package-lock.json +++ /dev/null @@ -1,1522 +0,0 @@ -{ - "name": "lex-parser", - "version": "0.1.4-184", - "lockfileVersion": 1, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", - "dev": true - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", - "dev": true - }, - "assertion-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", - "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", - "dev": true - }, - "babel-code-frame": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", - "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", - "dev": true - }, - "babel-generator": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", - "integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", - "dev": true - }, - "babel-helper-bindify-decorators": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz", - "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", - "dev": true - }, - "babel-helper-builder-binary-assignment-operator-visitor": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", - "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", - "dev": true - }, - "babel-helper-call-delegate": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", - "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", - "dev": true - }, - "babel-helper-define-map": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.24.1.tgz", - "integrity": "sha1-epdH8ljYlH0y1RX2qhx70CIEoIA=", - "dev": true - }, - "babel-helper-explode-assignable-expression": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", - "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", - "dev": true - }, - "babel-helper-explode-class": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz", - "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", - "dev": true - }, - "babel-helper-function-name": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", - "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", - "dev": true - }, - "babel-helper-get-function-arity": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", - "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", - "dev": true - }, - "babel-helper-hoist-variables": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", - "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", - "dev": true - }, - "babel-helper-optimise-call-expression": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", - "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", - "dev": true - }, - "babel-helper-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.24.1.tgz", - "integrity": "sha1-024i+rEAjXnYhkjjIRaGgShFbOg=", - "dev": true - }, - "babel-helper-remap-async-to-generator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", - "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", - "dev": true - }, - "babel-helper-replace-supers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", - "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", - "dev": true - }, - "babel-helpers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", - "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", - "dev": true - }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "dev": true - }, - "babel-plugin-check-es2015-constants": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", - "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", - "dev": true - }, - "babel-plugin-syntax-async-functions": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", - "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", - "dev": true - }, - "babel-plugin-syntax-async-generators": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", - "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", - "dev": true - }, - "babel-plugin-syntax-class-constructor-call": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", - "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=", - "dev": true - }, - "babel-plugin-syntax-class-properties": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", - "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", - "dev": true - }, - "babel-plugin-syntax-decorators": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", - "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", - "dev": true - }, - "babel-plugin-syntax-dynamic-import": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", - "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", - "dev": true - }, - "babel-plugin-syntax-exponentiation-operator": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", - "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", - "dev": true - }, - "babel-plugin-syntax-export-extensions": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", - "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=", - "dev": true - }, - "babel-plugin-syntax-flow": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", - "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", - "dev": true - }, - "babel-plugin-syntax-object-rest-spread": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", - "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", - "dev": true - }, - "babel-plugin-syntax-trailing-function-commas": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", - "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", - "dev": true - }, - "babel-plugin-transform-async-generator-functions": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", - "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", - "dev": true - }, - "babel-plugin-transform-async-to-generator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", - "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", - "dev": true - }, - "babel-plugin-transform-class-constructor-call": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.24.1.tgz", - "integrity": "sha1-gNwoVQWsBn3LjWxl4vbxGrd2Xvk=", - "dev": true - }, - "babel-plugin-transform-class-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", - "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", - "dev": true - }, - "babel-plugin-transform-decorators": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz", - "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", - "dev": true - }, - "babel-plugin-transform-es2015-arrow-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", - "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", - "dev": true - }, - "babel-plugin-transform-es2015-block-scoped-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", - "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", - "dev": true - }, - "babel-plugin-transform-es2015-block-scoping": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.24.1.tgz", - "integrity": "sha1-dsKV3DpHQbFmWt/TFnIV3P8ypXY=", - "dev": true - }, - "babel-plugin-transform-es2015-classes": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", - "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", - "dev": true - }, - "babel-plugin-transform-es2015-computed-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", - "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", - "dev": true - }, - "babel-plugin-transform-es2015-destructuring": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", - "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", - "dev": true - }, - "babel-plugin-transform-es2015-duplicate-keys": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", - "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", - "dev": true - }, - "babel-plugin-transform-es2015-for-of": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", - "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", - "dev": true - }, - "babel-plugin-transform-es2015-function-name": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", - "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", - "dev": true - }, - "babel-plugin-transform-es2015-literals": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", - "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", - "dev": true - }, - "babel-plugin-transform-es2015-modules-amd": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", - "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", - "dev": true - }, - "babel-plugin-transform-es2015-modules-commonjs": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.1.tgz", - "integrity": "sha1-0+MQtA72ZKNmIiAAl8bUQCmPK/4=", - "dev": true - }, - "babel-plugin-transform-es2015-modules-systemjs": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", - "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", - "dev": true - }, - "babel-plugin-transform-es2015-modules-umd": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", - "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", - "dev": true - }, - "babel-plugin-transform-es2015-object-super": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", - "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", - "dev": true - }, - "babel-plugin-transform-es2015-parameters": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", - "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", - "dev": true - }, - "babel-plugin-transform-es2015-shorthand-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", - "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", - "dev": true - }, - "babel-plugin-transform-es2015-spread": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", - "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", - "dev": true - }, - "babel-plugin-transform-es2015-sticky-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", - "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", - "dev": true - }, - "babel-plugin-transform-es2015-template-literals": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", - "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", - "dev": true - }, - "babel-plugin-transform-es2015-typeof-symbol": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", - "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", - "dev": true - }, - "babel-plugin-transform-es2015-unicode-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", - "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", - "dev": true - }, - "babel-plugin-transform-exponentiation-operator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", - "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", - "dev": true - }, - "babel-plugin-transform-export-extensions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz", - "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", - "dev": true - }, - "babel-plugin-transform-object-rest-spread": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz", - "integrity": "sha1-h11ryb52HFiirj/u5dxIldjH+SE=", - "dev": true - }, - "babel-plugin-transform-regenerator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.24.1.tgz", - "integrity": "sha1-uNowWtQ8PJm0hI5P5AN7dw0jxBg=", - "dev": true - }, - "babel-plugin-transform-strict-mode": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", - "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", - "dev": true - }, - "babel-preset-stage-2": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", - "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", - "dev": true - }, - "babel-preset-stage-3": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", - "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", - "dev": true - }, - "babel-runtime": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", - "integrity": "sha1-M7mOql1IK7AajRqmtDetKwGuxBw=", - "dev": true - }, - "babel-template": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.25.0.tgz", - "integrity": "sha1-ZlJBFmt8KqTGGdceGSlpVSsQwHE=", - "dev": true, - "dependencies": { - "babylon": { - "version": "6.17.4", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", - "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", - "dev": true - } - } - }, - "babel-traverse": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.25.0.tgz", - "integrity": "sha1-IldJfi/NGbie3BPEyROB+VEklvE=", - "dev": true, - "dependencies": { - "babylon": { - "version": "6.17.4", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", - "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", - "dev": true - } - } - }, - "babel-types": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.25.0.tgz", - "integrity": "sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4=", - "dev": true - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true - }, - "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", - "dev": true - }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - }, - "chai": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.0.tgz", - "integrity": "sha1-MxoDkbVcOvh0CunDt0WLwcOAXm0=", - "dev": true - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true - } - } - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "convert-source-map": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", - "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", - "dev": true - }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true - }, - "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", - "dev": true - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "deep-eql": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-2.0.2.tgz", - "integrity": "sha1-sbrAblbwp2d3aG1Qyf63XC7XZ5o=", - "dev": true, - "dependencies": { - "type-detect": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-3.0.0.tgz", - "integrity": "sha1-RtDMhVOrt7E6NSsNbeov1Y8tm1U=", - "dev": true - } - } - }, - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true - }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", - "dev": true - }, - "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true - }, - "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true - }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", - "dev": true - }, - "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true - }, - "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", - "dev": true - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", - "dev": true - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", - "dev": true - }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true - }, - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true - }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", - "dev": true - }, - "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", - "dev": true - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true - }, - "has-color": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", - "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", - "dev": true - }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", - "dev": true - }, - "home-or-tmp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", - "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", - "dev": true - }, - "hosted-git-info": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", - "dev": true - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "invariant": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", - "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", - "dev": true - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true - }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true - }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "dev": true - }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true - }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true - }, - "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true - }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", - "dev": true - }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true - }, - "jison-gho": { - "version": "github:GerHobbelt/jison#3449c6aa662268fa2a8d47394aaffde45eb82bea", - "dev": true - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", - "dev": true - }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", - "dev": true - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true - }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true - }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", - "dev": true - }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", - "dev": true - }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", - "dev": true - }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", - "dev": true - }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", - "dev": true - }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", - "dev": true - }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", - "dev": true - }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", - "dev": true - }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", - "dev": true - }, - "loose-envify": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", - "dev": true - }, - "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", - "dev": true - }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "dev": true - }, - "mimic-fn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true - }, - "mocha": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.4.2.tgz", - "integrity": "sha1-0O9NMyEm2/GNDWQMmzgt1IvpdZQ=", - "dev": true, - "dependencies": { - "debug": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz", - "integrity": "sha1-vFlryr52F/Edn6FTYe3tVgi4SZs=", - "dev": true - }, - "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", - "dev": true - }, - "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", - "dev": true - } - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, - "normalize-package-data": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", - "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", - "dev": true - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", - "dev": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "dev": true - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", - "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", - "dev": true - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true - }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true - }, - "parse-json": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", - "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true - }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", - "dev": true - }, - "pify": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", - "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", - "dev": true - }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", - "dev": true, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true - } - } - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true - }, - "regenerate": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.2.tgz", - "integrity": "sha1-0ZQcZ7rUN+G+dkM63Vs4X5WxkmA=", - "dev": true - }, - "regenerator-runtime": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", - "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", - "dev": true - }, - "regenerator-transform": { - "version": "0.9.11", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.9.11.tgz", - "integrity": "sha1-On0GdSDLe3F2dp61/4aGkb7+EoM=", - "dev": true - }, - "regex-cache": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.3.tgz", - "integrity": "sha1-mxpsNdTQ3871cRrmUejp09cRQUU=", - "dev": true - }, - "regexpu-core": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", - "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", - "dev": true - }, - "regjsgen": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", - "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", - "dev": true - }, - "regjsparser": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", - "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", - "dev": true, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - } - } - }, - "remove-trailing-separator": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz", - "integrity": "sha1-abBi2XhyetFNxrVrpKt3L9jXBRE=", - "dev": true - }, - "repeat-element": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", - "dev": true - }, - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", - "dev": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", - "dev": true - }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, - "slide": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", - "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", - "dev": true - }, - "source-map-support": { - "version": "0.4.15", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", - "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", - "dev": true - }, - "spdx-correct": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", - "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", - "dev": true - }, - "spdx-expression-parse": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", - "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", - "dev": true - }, - "spdx-license-ids": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", - "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true - } - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", - "dev": true - }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, - "type-detect": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", - "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", - "dev": true - }, - "validate-npm-package-license": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", - "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", - "dev": true - }, - "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", - "dev": true - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true - } - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true - }, - "xregexp": { - "version": "github:GerHobbelt/xregexp#7cb56f9a90a802ae34087ac5a257a992904a602c" - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - }, - "yargs-parser": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", - "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", - "dev": true - } - } -} From 67690a8a42cad7e09ffd3be93821970a3ee2c472 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 04:46:35 +0200 Subject: [PATCH 314/417] rebuilt library files --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index 1b5f051..bdc67ac 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-182 */ +/* parser generated by jison 0.4.18-184 */ /* * Returns a Parser object of the following structure: From 0071bd369f02a9d746977065e084c1028ed4d1d2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 04:48:11 +0200 Subject: [PATCH 315/417] update the git tag&bump shell script to fix the issue of losing the package-lock.json file in the commit set :-( --- package-lock.json | 1746 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 1746 insertions(+) create mode 100644 package-lock.json diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..e1ed13f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1746 @@ +{ + "name": "lex-parser", + "version": "0.1.4-184", + "lockfileVersion": 1, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true + }, + "assertion-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", + "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", + "dev": true + }, + "ast-types": { + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.11.tgz", + "integrity": "sha1-NxF3u1kjL/XOqh0J7lytcFsaWqk=", + "dev": true + }, + "ast-util": { + "version": "github:GerHobbelt/ast-util#1ce4d00a6c2568209bc10d13c5bf6390f23b9dbc", + "dev": true + }, + "async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.3.0.tgz", + "integrity": "sha1-EBPRBRBH3TIP4k5JTVxm7K9hR9k=", + "dev": true + }, + "babel-code-frame": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", + "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", + "dev": true + }, + "babel-core": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.24.1.tgz", + "integrity": "sha1-jEKFZNzh4fQfszfsNPTDsCK1rYM=", + "dev": true, + "dependencies": { + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + } + } + }, + "babel-generator": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", + "integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", + "dev": true + }, + "babel-helper-bindify-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz", + "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", + "dev": true + }, + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", + "dev": true + }, + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true + }, + "babel-helper-define-map": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.24.1.tgz", + "integrity": "sha1-epdH8ljYlH0y1RX2qhx70CIEoIA=", + "dev": true + }, + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", + "dev": true + }, + "babel-helper-explode-class": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz", + "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", + "dev": true + }, + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", + "dev": true + }, + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", + "dev": true + }, + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", + "dev": true + }, + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", + "dev": true + }, + "babel-helper-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.24.1.tgz", + "integrity": "sha1-024i+rEAjXnYhkjjIRaGgShFbOg=", + "dev": true + }, + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", + "dev": true + }, + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", + "dev": true + }, + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", + "dev": true + }, + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", + "dev": true + }, + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", + "dev": true + }, + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", + "dev": true + }, + "babel-plugin-syntax-async-generators": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", + "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", + "dev": true + }, + "babel-plugin-syntax-class-constructor-call": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", + "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=", + "dev": true + }, + "babel-plugin-syntax-class-properties": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", + "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", + "dev": true + }, + "babel-plugin-syntax-decorators": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", + "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", + "dev": true + }, + "babel-plugin-syntax-dynamic-import": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", + "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", + "dev": true + }, + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", + "dev": true + }, + "babel-plugin-syntax-export-extensions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", + "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=", + "dev": true + }, + "babel-plugin-syntax-flow": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", + "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", + "dev": true + }, + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", + "dev": true + }, + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", + "dev": true + }, + "babel-plugin-transform-async-generator-functions": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", + "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", + "dev": true + }, + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", + "dev": true + }, + "babel-plugin-transform-class-constructor-call": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.24.1.tgz", + "integrity": "sha1-gNwoVQWsBn3LjWxl4vbxGrd2Xvk=", + "dev": true + }, + "babel-plugin-transform-class-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", + "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", + "dev": true + }, + "babel-plugin-transform-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz", + "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", + "dev": true + }, + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", + "dev": true + }, + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", + "dev": true + }, + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.24.1.tgz", + "integrity": "sha1-dsKV3DpHQbFmWt/TFnIV3P8ypXY=", + "dev": true + }, + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", + "dev": true + }, + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", + "dev": true + }, + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", + "dev": true + }, + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", + "dev": true + }, + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", + "dev": true + }, + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", + "dev": true + }, + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", + "dev": true + }, + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", + "dev": true + }, + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.1.tgz", + "integrity": "sha1-0+MQtA72ZKNmIiAAl8bUQCmPK/4=", + "dev": true + }, + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", + "dev": true + }, + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", + "dev": true + }, + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", + "dev": true + }, + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", + "dev": true + }, + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", + "dev": true + }, + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", + "dev": true + }, + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", + "dev": true + }, + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", + "dev": true + }, + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", + "dev": true + }, + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", + "dev": true + }, + "babel-plugin-transform-exponentiation-operator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", + "dev": true + }, + "babel-plugin-transform-export-extensions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz", + "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", + "dev": true + }, + "babel-plugin-transform-flow-strip-types": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", + "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", + "dev": true + }, + "babel-plugin-transform-object-rest-spread": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz", + "integrity": "sha1-h11ryb52HFiirj/u5dxIldjH+SE=", + "dev": true + }, + "babel-plugin-transform-regenerator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.24.1.tgz", + "integrity": "sha1-uNowWtQ8PJm0hI5P5AN7dw0jxBg=", + "dev": true + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "dev": true + }, + "babel-preset-es2015": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", + "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", + "dev": true + }, + "babel-preset-stage-1": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", + "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", + "dev": true + }, + "babel-preset-stage-2": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", + "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", + "dev": true + }, + "babel-preset-stage-3": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", + "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", + "dev": true + }, + "babel-register": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.24.1.tgz", + "integrity": "sha1-fhDhOi9xBlvfrVoXh7pFvKbe118=", + "dev": true + }, + "babel-runtime": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", + "integrity": "sha1-M7mOql1IK7AajRqmtDetKwGuxBw=", + "dev": true + }, + "babel-template": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.25.0.tgz", + "integrity": "sha1-ZlJBFmt8KqTGGdceGSlpVSsQwHE=", + "dev": true, + "dependencies": { + "babylon": { + "version": "6.17.4", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", + "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", + "dev": true + } + } + }, + "babel-traverse": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.25.0.tgz", + "integrity": "sha1-IldJfi/NGbie3BPEyROB+VEklvE=", + "dev": true, + "dependencies": { + "babylon": { + "version": "6.17.4", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", + "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", + "dev": true + } + } + }, + "babel-types": { + "version": "6.25.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.25.0.tgz", + "integrity": "sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4=", + "dev": true + }, + "babylon": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.16.1.tgz", + "integrity": "sha1-MMWiL0gZeKnn+M399JaxHZS0BNM=", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "chai": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.0.tgz", + "integrity": "sha1-MxoDkbVcOvh0CunDt0WLwcOAXm0=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "convert-source-map": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", + "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", + "dev": true + }, + "core-js": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", + "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", + "dev": true + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true + }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "deep-eql": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-2.0.2.tgz", + "integrity": "sha1-sbrAblbwp2d3aG1Qyf63XC7XZ5o=", + "dev": true, + "dependencies": { + "type-detect": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-3.0.0.tgz", + "integrity": "sha1-RtDMhVOrt7E6NSsNbeov1Y8tm1U=", + "dev": true + } + } + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "ebnf-parser": { + "version": "github:GerHobbelt/ebnf-parser#a124c5e4ae4163e446a780dcea59791d077ec4f0", + "dev": true + }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "dev": true + }, + "es6-promise": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.0.tgz", + "integrity": "sha1-3aA8qPn4m8WX5omEKSnee6jOvfA=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true + }, + "flow-parser": { + "version": "0.44.0", + "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.44.0.tgz", + "integrity": "sha1-zzE8aHkUfRUh6ZzC0lAOfsUug04=", + "dev": true + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true + }, + "has-color": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", + "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", + "dev": true + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true + }, + "hosted-git-info": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true + }, + "jison-gho": { + "version": "github:GerHobbelt/jison#1cf65cd57c778dd728e66fa7d86cfd261003bec1", + "dev": true + }, + "jison-lex": { + "version": "github:GerHobbelt/jison-lex#82045ca40ec0475708cb12708005e701556f66c9", + "dev": true, + "dependencies": { + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + } + } + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "jscodeshift": { + "version": "github:GerHobbelt/jscodeshift#3263e85323850d713c259747a35f4fbb82f818f9", + "dev": true, + "dependencies": { + "ansi-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", + "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", + "dev": true + }, + "chalk": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", + "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "dev": true + }, + "nomnom": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", + "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", + "dev": true + }, + "strip-ansi": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", + "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", + "dev": true + }, + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + } + } + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "json5": { + "version": "github:GerHobbelt/json5#14967677303e37041244e5ad7b32c61266d44140", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true + }, + "lex-parser": { + "version": "github:GerHobbelt/lex-parser#5099fa73b48fba7339925db7eb0cb3fcecb57c55", + "dev": true + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true + }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true + }, + "mocha": { + "version": "3.4.2", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.4.2.tgz", + "integrity": "sha1-0O9NMyEm2/GNDWQMmzgt1IvpdZQ=", + "dev": true, + "dependencies": { + "debug": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz", + "integrity": "sha1-vFlryr52F/Edn6FTYe3tVgi4SZs=", + "dev": true + }, + "ms": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", + "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", + "dev": true + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "node-dir": { + "version": "0.1.16", + "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.16.tgz", + "integrity": "sha1-0u9YOqULkNk9uM3Sb86lg1OVf+Q=", + "dev": true + }, + "nomnom": { + "version": "github:GerHobbelt/nomnom#aa46a7e4df34a2812cfe1447d4292ec5b3ccdf3e", + "dev": true + }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true + }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true + }, + "npm-run-path": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", + "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", + "dev": true + }, + "number-is-nan": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "dev": true + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, + "os-locale": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", + "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", + "dev": true + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "p-finally": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", + "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", + "dev": true + }, + "p-limit": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.1.0.tgz", + "integrity": "sha1-sH/y2aXYi+yAYDWJWiurZqJ5iLw=", + "dev": true + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true + }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true + }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true + }, + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "path-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true + }, + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", + "dev": true + }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true + }, + "private": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", + "dev": true + }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, + "randomatic": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "dev": true, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true + } + } + }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true + }, + "recast": { + "version": "github:GerHobbelt/recast#354e62b5b8e6050fc63f44ab705768b949d8471d", + "dev": true + }, + "regenerate": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.2.tgz", + "integrity": "sha1-0ZQcZ7rUN+G+dkM63Vs4X5WxkmA=", + "dev": true + }, + "regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "dev": true + }, + "regenerator-transform": { + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.9.11.tgz", + "integrity": "sha1-On0GdSDLe3F2dp61/4aGkb7+EoM=", + "dev": true + }, + "regex-cache": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.3.tgz", + "integrity": "sha1-mxpsNdTQ3871cRrmUejp09cRQUU=", + "dev": true + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz", + "integrity": "sha1-abBi2XhyetFNxrVrpKt3L9jXBRE=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true + }, + "require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true + }, + "require-main-filename": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", + "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", + "dev": true + }, + "rimraf": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", + "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "dev": true + }, + "semver": { + "version": "5.4.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "dev": true + }, + "set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "slide": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", + "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "dev": true + }, + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "dev": true + }, + "source-map-support": { + "version": "0.4.15", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", + "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", + "dev": true + }, + "spdx-correct": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", + "integrity": "sha1-SzBz2TP/UfORLwOsVRlJikFQ20A=", + "dev": true + }, + "spdx-expression-parse": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-1.0.4.tgz", + "integrity": "sha1-m98vIOH0DtRH++JzJmGR/O1RYmw=", + "dev": true + }, + "spdx-license-ids": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-1.2.2.tgz", + "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true + } + } + }, + "strip-ansi": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "dev": true + }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-eof": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", + "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "temp": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", + "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", + "dev": true + }, + "type-detect": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", + "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", + "dev": true + }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "dev": true + }, + "validate-npm-package-license": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", + "integrity": "sha1-KAS6vnEq0zeUWaz74kdGqywwP7w=", + "dev": true + }, + "which": { + "version": "1.2.14", + "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", + "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", + "dev": true + }, + "which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "wrap-ansi": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", + "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", + "dev": true, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true + } + } + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + }, + "write-file-atomic": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.1.tgz", + "integrity": "sha1-fUW6MjFjKN0ex9kPYOvA2EW7dZo=", + "dev": true + }, + "xregexp": { + "version": "github:GerHobbelt/xregexp#7cb56f9a90a802ae34087ac5a257a992904a602c" + }, + "y18n": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", + "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", + "dev": true + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "dev": true + }, + "yargs-parser": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", + "integrity": "sha1-jQrELxbqVd69MyyvTEA4s+P139k=", + "dev": true + } + } +} From 92071a933f36bb264b73bbaa669a61064c3c3253 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 04:56:35 +0200 Subject: [PATCH 316/417] rebuilt library files --- package-lock.json | 224 ---------------------------------------------- 1 file changed, 224 deletions(-) diff --git a/package-lock.json b/package-lock.json index e1ed13f..658dce4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,42 +39,12 @@ "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", "dev": true }, - "ast-types": { - "version": "0.9.11", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.11.tgz", - "integrity": "sha1-NxF3u1kjL/XOqh0J7lytcFsaWqk=", - "dev": true - }, - "ast-util": { - "version": "github:GerHobbelt/ast-util#1ce4d00a6c2568209bc10d13c5bf6390f23b9dbc", - "dev": true - }, - "async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.3.0.tgz", - "integrity": "sha1-EBPRBRBH3TIP4k5JTVxm7K9hR9k=", - "dev": true - }, "babel-code-frame": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", "dev": true }, - "babel-core": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.24.1.tgz", - "integrity": "sha1-jEKFZNzh4fQfszfsNPTDsCK1rYM=", - "dev": true, - "dependencies": { - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - } - } - }, "babel-generator": { "version": "6.25.0", "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", @@ -417,12 +387,6 @@ "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", "dev": true }, - "babel-plugin-transform-flow-strip-types": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", - "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", - "dev": true - }, "babel-plugin-transform-object-rest-spread": { "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz", @@ -441,18 +405,6 @@ "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", "dev": true }, - "babel-preset-es2015": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", - "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", - "dev": true - }, - "babel-preset-stage-1": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", - "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", - "dev": true - }, "babel-preset-stage-2": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", @@ -465,12 +417,6 @@ "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", "dev": true }, - "babel-register": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.24.1.tgz", - "integrity": "sha1-fhDhOi9xBlvfrVoXh7pFvKbe118=", - "dev": true - }, "babel-runtime": { "version": "6.25.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", @@ -511,12 +457,6 @@ "integrity": "sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4=", "dev": true }, - "babylon": { - "version": "6.16.1", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.16.1.tgz", - "integrity": "sha1-MMWiL0gZeKnn+M399JaxHZS0BNM=", - "dev": true - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -559,12 +499,6 @@ "integrity": "sha1-MxoDkbVcOvh0CunDt0WLwcOAXm0=", "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true - }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -591,12 +525,6 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, "commander": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", @@ -615,12 +543,6 @@ "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", "dev": true }, - "core-js": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", - "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", - "dev": true - }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -665,34 +587,18 @@ "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", "dev": true }, - "ebnf-parser": { - "version": "github:GerHobbelt/ebnf-parser#a124c5e4ae4163e446a780dcea59791d077ec4f0", - "dev": true - }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true }, - "es6-promise": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.0.tgz", - "integrity": "sha1-3aA8qPn4m8WX5omEKSnee6jOvfA=", - "dev": true - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", - "dev": true - }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", @@ -705,12 +611,6 @@ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", - "dev": true - }, "expand-brackets": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", @@ -747,12 +647,6 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true }, - "flow-parser": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.44.0.tgz", - "integrity": "sha1-zzE8aHkUfRUh6ZzC0lAOfsUug04=", - "dev": true - }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -997,60 +891,12 @@ "version": "github:GerHobbelt/jison#1cf65cd57c778dd728e66fa7d86cfd261003bec1", "dev": true }, - "jison-lex": { - "version": "github:GerHobbelt/jison-lex#82045ca40ec0475708cb12708005e701556f66c9", - "dev": true, - "dependencies": { - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - } - } - }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true }, - "jscodeshift": { - "version": "github:GerHobbelt/jscodeshift#3263e85323850d713c259747a35f4fbb82f818f9", - "dev": true, - "dependencies": { - "ansi-styles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", - "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", - "dev": true - }, - "chalk": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", - "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", - "dev": true - }, - "nomnom": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", - "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", - "dev": true - }, - "strip-ansi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", - "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", - "dev": true - }, - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, "jsesc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", @@ -1063,10 +909,6 @@ "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", "dev": true }, - "json5": { - "version": "github:GerHobbelt/json5#14967677303e37041244e5ad7b32c61266d44140", - "dev": true - }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -1079,10 +921,6 @@ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true }, - "lex-parser": { - "version": "github:GerHobbelt/lex-parser#5099fa73b48fba7339925db7eb0cb3fcecb57c55", - "dev": true - }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -1095,12 +933,6 @@ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true - }, "lodash._baseassign": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", @@ -1173,12 +1005,6 @@ "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true }, - "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", - "dev": true - }, "mimic-fn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", @@ -1235,16 +1061,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "node-dir": { - "version": "0.1.16", - "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.16.tgz", - "integrity": "sha1-0u9YOqULkNk9uM3Sb86lg1OVf+Q=", - "dev": true - }, - "nomnom": { - "version": "github:GerHobbelt/nomnom#aa46a7e4df34a2812cfe1447d4292ec5b3ccdf3e", - "dev": true - }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -1371,12 +1187,6 @@ "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, - "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", - "dev": true - }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -1423,10 +1233,6 @@ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true }, - "recast": { - "version": "github:GerHobbelt/recast#354e62b5b8e6050fc63f44ab705768b949d8471d", - "dev": true - }, "regenerate": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.2.tgz", @@ -1561,12 +1367,6 @@ "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", "dev": true }, - "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", - "dev": true - }, "source-map-support": { "version": "0.4.15", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", @@ -1641,12 +1441,6 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, - "temp": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", - "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", - "dev": true - }, "to-fast-properties": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", @@ -1665,12 +1459,6 @@ "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", "dev": true }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true - }, "validate-npm-package-license": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", @@ -1709,12 +1497,6 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "write-file-atomic": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.1.tgz", - "integrity": "sha1-fUW6MjFjKN0ex9kPYOvA2EW7dZo=", - "dev": true - }, "xregexp": { "version": "github:GerHobbelt/xregexp#7cb56f9a90a802ae34087ac5a257a992904a602c" }, @@ -1730,12 +1512,6 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, - "yargs": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", - "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", - "dev": true - }, "yargs-parser": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", From 61cfbb726787d93e025adc0c510e516c23cbcf00 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 05:01:29 +0200 Subject: [PATCH 317/417] bumped build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 658dce4..138ae3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lex-parser", - "version": "0.1.4-184", + "version": "0.1.4-185", "lockfileVersion": 1, "dependencies": { "ansi-regex": { diff --git a/package.json b/package.json index 3ac8311..aba397e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-184", + "version": "0.1.4-185", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 5bdfe494f396ad79f89524d1fa5e8b1a9f93bd3b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 31 Jul 2017 05:05:04 +0200 Subject: [PATCH 318/417] updated NPM packages --- package-lock.json | 226 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 225 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 138ae3f..ad27080 100644 --- a/package-lock.json +++ b/package-lock.json @@ -39,12 +39,42 @@ "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", "dev": true }, + "ast-types": { + "version": "0.9.11", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.11.tgz", + "integrity": "sha1-NxF3u1kjL/XOqh0J7lytcFsaWqk=", + "dev": true + }, + "ast-util": { + "version": "github:GerHobbelt/ast-util#1ce4d00a6c2568209bc10d13c5bf6390f23b9dbc", + "dev": true + }, + "async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.3.0.tgz", + "integrity": "sha1-EBPRBRBH3TIP4k5JTVxm7K9hR9k=", + "dev": true + }, "babel-code-frame": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", "dev": true }, + "babel-core": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.24.1.tgz", + "integrity": "sha1-jEKFZNzh4fQfszfsNPTDsCK1rYM=", + "dev": true, + "dependencies": { + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + } + } + }, "babel-generator": { "version": "6.25.0", "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", @@ -387,6 +417,12 @@ "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", "dev": true }, + "babel-plugin-transform-flow-strip-types": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", + "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", + "dev": true + }, "babel-plugin-transform-object-rest-spread": { "version": "6.23.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz", @@ -405,6 +441,18 @@ "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", "dev": true }, + "babel-preset-es2015": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", + "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", + "dev": true + }, + "babel-preset-stage-1": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", + "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", + "dev": true + }, "babel-preset-stage-2": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", @@ -417,6 +465,12 @@ "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", "dev": true }, + "babel-register": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.24.1.tgz", + "integrity": "sha1-fhDhOi9xBlvfrVoXh7pFvKbe118=", + "dev": true + }, "babel-runtime": { "version": "6.25.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", @@ -457,6 +511,12 @@ "integrity": "sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4=", "dev": true }, + "babylon": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.16.1.tgz", + "integrity": "sha1-MMWiL0gZeKnn+M399JaxHZS0BNM=", + "dev": true + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -499,6 +559,12 @@ "integrity": "sha1-MxoDkbVcOvh0CunDt0WLwcOAXm0=", "dev": true }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -525,6 +591,12 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, "commander": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", @@ -543,6 +615,12 @@ "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", "dev": true }, + "core-js": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", + "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", + "dev": true + }, "cross-spawn": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", @@ -587,18 +665,34 @@ "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", "dev": true }, + "ebnf-parser": { + "version": "github:GerHobbelt/ebnf-parser#5908e671c4bf87a902dcb3064dcedb554bc02cbc", + "dev": true + }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true }, + "es6-promise": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.0.tgz", + "integrity": "sha1-3aA8qPn4m8WX5omEKSnee6jOvfA=", + "dev": true + }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, + "esprima": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", + "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "dev": true + }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", @@ -611,6 +705,12 @@ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, "expand-brackets": { "version": "0.1.5", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", @@ -647,6 +747,12 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true }, + "flow-parser": { + "version": "0.44.0", + "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.44.0.tgz", + "integrity": "sha1-zzE8aHkUfRUh6ZzC0lAOfsUug04=", + "dev": true + }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", @@ -888,15 +994,63 @@ "dev": true }, "jison-gho": { - "version": "github:GerHobbelt/jison#1cf65cd57c778dd728e66fa7d86cfd261003bec1", + "version": "github:GerHobbelt/jison#0f6a041395e6cd287f35e4c1280cd90b667fd439", "dev": true }, + "jison-lex": { + "version": "github:GerHobbelt/jison-lex#57dacf6dc121b0c188e4652373a63ee2ef419ef3", + "dev": true, + "dependencies": { + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + } + } + }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true }, + "jscodeshift": { + "version": "github:GerHobbelt/jscodeshift#3263e85323850d713c259747a35f4fbb82f818f9", + "dev": true, + "dependencies": { + "ansi-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", + "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", + "dev": true + }, + "chalk": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", + "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "dev": true + }, + "nomnom": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", + "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", + "dev": true + }, + "strip-ansi": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", + "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", + "dev": true + }, + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + } + } + }, "jsesc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", @@ -909,6 +1063,10 @@ "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", "dev": true }, + "json5": { + "version": "github:GerHobbelt/json5#14967677303e37041244e5ad7b32c61266d44140", + "dev": true + }, "kind-of": { "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", @@ -921,6 +1079,10 @@ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true }, + "lex-parser": { + "version": "github:GerHobbelt/lex-parser#61cfbb726787d93e025adc0c510e516c23cbcf00", + "dev": true + }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -933,6 +1095,12 @@ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, "lodash._baseassign": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", @@ -1005,6 +1173,12 @@ "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true + }, "mimic-fn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", @@ -1061,6 +1235,16 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "node-dir": { + "version": "0.1.16", + "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.16.tgz", + "integrity": "sha1-0u9YOqULkNk9uM3Sb86lg1OVf+Q=", + "dev": true + }, + "nomnom": { + "version": "github:GerHobbelt/nomnom#aa46a7e4df34a2812cfe1447d4292ec5b3ccdf3e", + "dev": true + }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -1187,6 +1371,12 @@ "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", "dev": true }, + "private": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", + "dev": true + }, "pseudomap": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", @@ -1233,6 +1423,10 @@ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true }, + "recast": { + "version": "github:GerHobbelt/recast#354e62b5b8e6050fc63f44ab705768b949d8471d", + "dev": true + }, "regenerate": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.2.tgz", @@ -1367,6 +1561,12 @@ "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", "dev": true }, + "source-map": { + "version": "0.5.6", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", + "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "dev": true + }, "source-map-support": { "version": "0.4.15", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", @@ -1441,6 +1641,12 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, + "temp": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", + "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", + "dev": true + }, "to-fast-properties": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", @@ -1459,6 +1665,12 @@ "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", "dev": true }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "dev": true + }, "validate-npm-package-license": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", @@ -1497,6 +1709,12 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write-file-atomic": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.1.tgz", + "integrity": "sha1-fUW6MjFjKN0ex9kPYOvA2EW7dZo=", + "dev": true + }, "xregexp": { "version": "github:GerHobbelt/xregexp#7cb56f9a90a802ae34087ac5a257a992904a602c" }, @@ -1512,6 +1730,12 @@ "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", "dev": true }, + "yargs": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-8.0.2.tgz", + "integrity": "sha1-YpmpBVsc78lp/355wdkY3Osiw2A=", + "dev": true + }, "yargs-parser": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-7.0.0.tgz", From 95da530b73871b43e33d16ed08dae6a87c412ee4 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 1 Aug 2017 01:01:34 +0200 Subject: [PATCH 319/417] update TravisCI config to support NodeJS 4-8 and don't use deprecated `nvm` labels in there any more (`stable` --> `node`) + update NPM packages --- .gitattributes | 2 ++ .travis.yml | 25 +++++-------------------- package-lock.json | 18 +++--------------- package.json | 4 ++-- 4 files changed, 12 insertions(+), 37 deletions(-) diff --git a/.gitattributes b/.gitattributes index d57c14e..442aed3 100644 --- a/.gitattributes +++ b/.gitattributes @@ -3,6 +3,7 @@ *.php text eol=lf *.inc text eol=lf *.html text eol=lf +*.json text eol=lf *.js text eol=lf *.css text eol=lf *.less text eol=lf @@ -12,6 +13,7 @@ *.xml text eol=lf *.md text eol=lf *.markdown text eol=lf +*.json5 text eol=lf *.pdf binary *.psd binary diff --git a/.travis.yml b/.travis.yml index 800d5f2..f0913fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,26 +1,11 @@ -sudo: false language: node_js +sudo: false + node_js: + - 8 + - 7 - 6 - - 6.0 - 5 - - 5.0 - 4 - - 4.0 - - stable - -# http://stackoverflow.com/questions/15674064/github-submodule-access-rights-travis-ci -# -# This can (thankfully) be easily solved by modifying the .gitmodules file on-the-fly on Travis, -# so that the SSH URL is replaced with the public URL, before initializing submodules. -# To accomplish this, add the following to .travis.yml: - -# Handle git submodules yourself -git: - submodules: false - -# Use sed to replace the jison package -before_install: - - sed -i 's/github:GerHobbelt\/jison#master/latest/' package.json - - cat package.json + - node diff --git a/package-lock.json b/package-lock.json index ad27080..f486020 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1204,23 +1204,11 @@ "dev": true }, "mocha": { - "version": "3.4.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.4.2.tgz", - "integrity": "sha1-0O9NMyEm2/GNDWQMmzgt1IvpdZQ=", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.0.tgz", + "integrity": "sha512-pIU2PJjrPYvYRqVpjXzj76qltO9uBYI7woYAMoxbSefsa+vqAfptjoeevd6bUgwD0mPIO+hv9f7ltvsNreL2PA==", "dev": true, "dependencies": { - "debug": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.0.tgz", - "integrity": "sha1-vFlryr52F/Edn6FTYe3tVgi4SZs=", - "dev": true - }, - "ms": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.2.tgz", - "integrity": "sha1-riXPJRKziFodldfwN4aNhDESR2U=", - "dev": true - }, "supports-color": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", diff --git a/package.json b/package.json index aba397e..e520183 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "repository": { "type": "git", - "url": "https://github.com/zaach/lex-parser.git" + "url": "https://github.com/GerHobbelt/lex-parser.git" }, "keywords": [ "lexical", @@ -31,6 +31,6 @@ "devDependencies": { "chai": "4.1.0", "jison-gho": "github:GerHobbelt/jison#master", - "mocha": "3.4.2" + "mocha": "3.5.0" } } From 8962f32a192e0e146955a5f6b6def7725899546e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 20 Aug 2017 16:44:27 +0200 Subject: [PATCH 320/417] updated NPM packages; point jison-gho to the NPM repo --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e520183..95d6ab6 100644 --- a/package.json +++ b/package.json @@ -29,8 +29,8 @@ "xregexp": "github:GerHobbelt/xregexp#master" }, "devDependencies": { - "chai": "4.1.0", - "jison-gho": "github:GerHobbelt/jison#master", + "chai": "4.1.1", + "jison-gho": "0.4.18-184", "mocha": "3.5.0" } } From a228969de38fc43dc08f6ab7f9e4d06040f9644d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 20 Aug 2017 18:53:37 +0200 Subject: [PATCH 321/417] - fix corrupted console output/reports due to printf-style behaviour of console.log, console.warn, et al: https://nodejs.org/api/console.html#console_console_log_data_args --- lex-parser.js | 44 +++++++++++++++++++++++++++++++++++--------- lex.l | 24 +++++++++++++++++++++++- lex.y | 12 ++++++++++-- 3 files changed, 68 insertions(+), 12 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index bdc67ac..d737c6d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-184 */ +/* parser generated by jison 0.4.18-185 */ /* * Returns a Parser object of the following structure: @@ -1231,7 +1231,7 @@ case 47: this.$ = eval('"' + this.$ + '"'); } catch (ex) { - console.warn('easy-keyword-rule FAIL on eval: ', ex); + this.warn('easy-keyword-rule FAIL on eval: ', ex); // make the next keyword test fail: this.$ = '.'; @@ -1345,7 +1345,7 @@ case 78: } else { this.$ = yyvstack[yysp]; } - //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + //this.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; case 81: @@ -2562,8 +2562,6 @@ parse: function parse(input) { ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; var NO_ACTION = [0, table.length /* ensures that anyone using this new state will fail dramatically! */]; - //this.reductionCount = this.shiftCount = 0; - var lexer; if (this.__lexer__) { lexer = this.__lexer__; @@ -3012,7 +3010,6 @@ parse: function parse(input) { // shift: case 1: - //this.shiftCount++; stack[sp] = symbol; vstack[sp] = lexer.yytext; @@ -3055,7 +3052,6 @@ parse: function parse(input) { // reduce: case 2: - //this.reductionCount++; this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... len = this_production[1]; @@ -3196,6 +3192,14 @@ function parseValue(v) { } return v; } + +parser.warn = function p_warn() { + console.warn.apply(console, arguments); +}; + +parser.log = function p_log() { + console.log.apply(console, arguments); +}; /* lexer generated by jison-lex 0.3.4-166 */ /* * Returns a Lexer object of the following structure: @@ -4597,7 +4601,13 @@ case 68 : var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); var l2 = 19; var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); - console.warn('LEX: ignoring unsupported lexer option ' + dquote(yy_.yytext) + ' while lexing in ' + this.topState() + ' state:\n' + indent(this.showPosition(l1, l2), 4), this._input, ' /////// ', this.matched); + this.warn('LEX: ignoring unsupported lexer option', dquote(yy_.yytext), 'while lexing in', this.topState(), 'state:\n' + indent(this.showPosition(l1, l2), 4) + // , '\n', { + // remaining_input: this._input, + // matched: this.matched, + // matches: this.matches + // } + ); // this.pushState('options'); yy_.yytext = [ this.matches[1], // {NAME} @@ -5235,8 +5245,24 @@ function dquote(s) { s = '"' + s + '"'; } return s; +} + +lexer.warn = function l_warn() { + if (this.yy.parser && typeof this.yy.parser.warn === 'function') { + return this.yy.parser.warn.apply(this, arguments); + } else { + console.warn.apply(console, arguments); + } }; +lexer.log = function l_log() { + if (this.yy.parser && typeof this.yy.parser.log === 'function') { + return this.yy.parser.log.apply(this, arguments); + } else { + console.log.apply(console, arguments); + } +};; + return lexer; })(); parser.lexer = lexer; @@ -5259,5 +5285,5 @@ if (typeof require !== 'undefined' && typeof exports !== 'undefined') { exports.parse = function () { return lexParser.parse.apply(lexParser, arguments); }; - + } diff --git a/lex.l b/lex.l index 62e4fb3..b9ed8b9 100644 --- a/lex.l +++ b/lex.l @@ -173,7 +173,13 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); var l2 = 19; var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); - console.warn('LEX: ignoring unsupported lexer option ' + dquote(yytext) + ' while lexing in ' + this.topState() + ' state:\n' + indent(this.showPosition(l1, l2), 4), this._input, ' /////// ', this.matched); + this.warn('LEX: ignoring unsupported lexer option', dquote(yytext), 'while lexing in', this.topState(), 'state:\n' + indent(this.showPosition(l1, l2), 4) + // , '\n', { + // remaining_input: this._input, + // matched: this.matched, + // matches: this.matches + // } + ); // this.pushState('options'); yytext = [ this.matches[1], // {NAME} @@ -260,3 +266,19 @@ function dquote(s) { } return s; } + +lexer.warn = function l_warn() { + if (this.yy.parser && typeof this.yy.parser.warn === 'function') { + return this.yy.parser.warn.apply(this, arguments); + } else { + console.warn.apply(console, arguments); + } +}; + +lexer.log = function l_log() { + if (this.yy.parser && typeof this.yy.parser.log === 'function') { + return this.yy.parser.log.apply(this, arguments); + } else { + console.log.apply(console, arguments); + } +}; diff --git a/lex.y b/lex.y index 7d5a02b..1c1f934 100644 --- a/lex.y +++ b/lex.y @@ -295,7 +295,7 @@ regex $$ = eval('"' + $$ + '"'); } catch (ex) { - console.warn('easy-keyword-rule FAIL on eval: ', ex); + this.warn('easy-keyword-rule FAIL on eval: ', ex); // make the next keyword test fail: $$ = '.'; @@ -406,7 +406,7 @@ regex_set_atom } else { $$ = $name_expansion; } - //console.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + //this.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); } ; @@ -517,3 +517,11 @@ function parseValue(v) { return v; } +parser.warn = function p_warn() { + console.warn.apply(console, arguments); +}; + +parser.log = function p_log() { + console.log.apply(console, arguments); +}; + From dffcc4de29e2dbca2f6ce52f348195404418fc2c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 20 Aug 2017 18:56:03 +0200 Subject: [PATCH 322/417] - silence the warn/log output of the tests' internals (unless you set debug=1 in the test code's lexer_reset() function: RTFC) - fix/clean a few tests. --- tests/all-tests.js | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/tests/all-tests.js b/tests/all-tests.js index f86bedb..36a1d0e 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -19,6 +19,27 @@ function lexer_reset() { } lex.parser.yy = {}; + + var debug = 0; + + if (!debug) { + // silence warn+log messages from the test internals: + lex.warn = function tl_warn() { + // console.warn("TEST WARNING: ", arguments); + }; + + lex.log = function tl_log() { + // console.warn("TEST LOG: ", arguments); + }; + + lex.parser.warn = function tl_warn() { + // console.warn("TEST WARNING: ", arguments); + }; + + lex.parser.log = function tl_log() { + // console.warn("TEST LOG: ", arguments); + }; + } } describe("LEX Parser", function () { @@ -69,6 +90,8 @@ describe("LEX Parser", function () { rules: [], startConditions: {}, }; + + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, 'grammar should be parsed correctly'); }); @@ -246,25 +269,25 @@ describe("LEX Parser", function () { }); it("test bnf lex grammar", function () { + lexer_reset(); var lexgrammar = lex.parse(read('lex', 'bnf.jisonlex')); var expected = JSON.parse(read('lex', 'bnf.lex.json')); - lexer_reset(); assert.deepEqual(lexgrammar, expected, "grammar should be parsed correctly"); }); it("test lex grammar bootstrap", function () { + lexer_reset(); var lexgrammar = lex.parse(read('lex', 'lex_grammar.jisonlex')); var expected = JSON.parse(read('lex', 'lex_grammar.lex.json')); - lexer_reset(); assert.deepEqual(lexgrammar, expected, "grammar should be parsed correctly"); }); it("test ANSI C lexical grammar", function () { + lexer_reset(); var lexgrammar = lex.parse(read('lex','ansic.jisonlex')); - lexer_reset(); assert.ok(lexgrammar, "grammar should be parsed correctly"); }); @@ -324,6 +347,7 @@ describe("LEX Parser", function () { startConditions: {} }; + lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "unknown declarations should be parsed correctly"); }); From 2122c8b849d601fef87a95cae08eab2aa39d63d6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 20 Aug 2017 18:57:59 +0200 Subject: [PATCH 323/417] use the devDependency jison-gho as a fallback: when we're developing, we want to use the bleeding edge jison code which should have installed this module as a git submodule. (TravisCI should merely use the jison-gho as listed in the package.json file though!) --- Makefile | 15 +++++++++++++-- package-lock.json | 10 ++++++---- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 539af4d..df0c852 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,16 @@ +ifeq ($(wildcard ../../lib/cli.js),) + ifeq ($(wildcard ./node_modules/.bin/jison),) + echo "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###" + else + JISON = sh node_modules/.bin/jison + endif +else + JISON = node $(wildcard ../../lib/cli.js) +endif + + + all: build test prep: npm-install @@ -9,8 +21,7 @@ npm-install: build: lex-parser.js lex-parser.js: lex.y lex.l - @[ -a ./node_modules/.bin/jison ] || echo "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###" - sh node_modules/.bin/jison -o lex-parser.js lex.y lex.l + $(JISON) -o lex-parser.js lex.y lex.l test: node_modules/.bin/mocha tests/ diff --git a/package-lock.json b/package-lock.json index f486020..d64865d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -554,9 +554,9 @@ "dev": true }, "chai": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.0.tgz", - "integrity": "sha1-MxoDkbVcOvh0CunDt0WLwcOAXm0=", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.1.tgz", + "integrity": "sha1-ZuISeebzxkFf+CMYeCJ5AOIXGzk=", "dev": true }, "chalk": { @@ -994,7 +994,9 @@ "dev": true }, "jison-gho": { - "version": "github:GerHobbelt/jison#0f6a041395e6cd287f35e4c1280cd90b667fd439", + "version": "0.4.18-184", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.4.18-184.tgz", + "integrity": "sha512-Z22ZN0i4oh0GYXNCB/hlVv3i4s+f+Q3aIQBn139koo/grHH97VTk/hfWx0/VRt67/NYaLpoEtbcw0FkWynephw==", "dev": true }, "jison-lex": { From 0c544b99369a6a0c624b8b43f286f0bdb20a5ed6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 20 Aug 2017 19:09:57 +0200 Subject: [PATCH 324/417] cleanup tests: use beforeEach to set up each test --- tests/all-tests.js | 48 ++++------------------------------------------ 1 file changed, 4 insertions(+), 44 deletions(-) diff --git a/tests/all-tests.js b/tests/all-tests.js index 36a1d0e..dacf54c 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -43,6 +43,10 @@ function lexer_reset() { } describe("LEX Parser", function () { + beforeEach(function beforeEachTest() { + lexer_reset(); + }); + it("test lex grammar with macros", function () { var lexgrammar = 'D [0-9]\nID [a-zA-Z_][a-zA-Z0-9_]+\n%%\n\n{D}"ohhai" {print(9);}\n"{" return \'{\';'; var expected = { @@ -58,7 +62,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -78,7 +81,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -91,7 +93,6 @@ describe("LEX Parser", function () { startConditions: {}, }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, 'grammar should be parsed correctly'); }); @@ -108,7 +109,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -126,7 +126,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -143,7 +142,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -158,7 +156,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -173,7 +170,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -188,7 +184,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -203,7 +198,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -218,7 +212,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -233,7 +226,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -248,7 +240,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -264,12 +255,10 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); it("test bnf lex grammar", function () { - lexer_reset(); var lexgrammar = lex.parse(read('lex', 'bnf.jisonlex')); var expected = JSON.parse(read('lex', 'bnf.lex.json')); @@ -277,7 +266,6 @@ describe("LEX Parser", function () { }); it("test lex grammar bootstrap", function () { - lexer_reset(); var lexgrammar = lex.parse(read('lex', 'lex_grammar.jisonlex')); var expected = JSON.parse(read('lex', 'lex_grammar.lex.json')); @@ -285,7 +273,6 @@ describe("LEX Parser", function () { }); it("test ANSI C lexical grammar", function () { - lexer_reset(); var lexgrammar = lex.parse(read('lex','ansic.jisonlex')); assert.ok(lexgrammar, "grammar should be parsed correctly"); @@ -302,7 +289,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -328,7 +314,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -347,7 +332,6 @@ describe("LEX Parser", function () { startConditions: {} }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "unknown declarations should be parsed correctly"); }); @@ -363,7 +347,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -378,7 +361,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -397,7 +379,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -412,7 +393,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -427,7 +407,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -443,7 +422,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -458,7 +436,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -473,7 +450,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -489,7 +465,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -504,7 +479,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -520,7 +494,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -536,7 +509,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -561,7 +533,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -586,7 +557,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -605,7 +575,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -620,7 +589,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -637,7 +605,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -652,7 +619,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -667,7 +633,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -683,7 +648,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -698,7 +662,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -713,7 +676,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -729,7 +691,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); @@ -773,7 +734,6 @@ describe("LEX Parser", function () { unknownDecls: [] }; - lexer_reset(); assert.deepEqual(lex.parse(lexgrammar), expected, "grammar should be parsed correctly"); }); }); From eb02fb8ff3620d064424865b7e7a2caf7cc5ebbc Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 20 Aug 2017 20:18:37 +0200 Subject: [PATCH 325/417] bump build revision and rebuild the lexer unconditionally: there's to many files that influence the precise output to allow the makefile to only do this depending on a few dependencies! --- Makefile | 4 +--- lex-parser.js | 2 +- package-lock.json | 2 +- package.json | 2 +- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index df0c852..1d5b407 100644 --- a/Makefile +++ b/Makefile @@ -18,9 +18,7 @@ prep: npm-install npm-install: npm install -build: lex-parser.js - -lex-parser.js: lex.y lex.l +build: $(JISON) -o lex-parser.js lex.y lex.l test: diff --git a/lex-parser.js b/lex-parser.js index d737c6d..9b91b67 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,4 @@ -/* parser generated by jison 0.4.18-185 */ +/* parser generated by jison 0.4.18-186 */ /* * Returns a Parser object of the following structure: diff --git a/package-lock.json b/package-lock.json index d64865d..da99f27 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lex-parser", - "version": "0.1.4-185", + "version": "0.1.4-186", "lockfileVersion": 1, "dependencies": { "ansi-regex": { diff --git a/package.json b/package.json index 95d6ab6..f484b39 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-185", + "version": "0.1.4-186", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From ca8c6cbf6df8a0a7026521b6a7a4ef3acdc21a53 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 20 Aug 2017 20:46:04 +0200 Subject: [PATCH 326/417] - updated `make clean` target to get rid of the package lock file produced by new NPM. - bumped build revision. - rebuilt library and reference files. --- Makefile | 1 + lex-parser.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1d5b407..72f8cb0 100644 --- a/Makefile +++ b/Makefile @@ -39,6 +39,7 @@ git-tag: clean: -rm -f lex-parser.js -rm -rf node_modules/ + -rm -f package-lock.json superclean: clean -find . -type d -name 'node_modules' -exec rm -rf "{}" \; diff --git a/lex-parser.js b/lex-parser.js index 9b91b67..871d857 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3200,7 +3200,7 @@ parser.warn = function p_warn() { parser.log = function p_log() { console.log.apply(console, arguments); }; -/* lexer generated by jison-lex 0.3.4-166 */ +/* lexer generated by jison-lex 0.3.4-186 */ /* * Returns a Lexer object of the following structure: * From 5d5a003b6fea0ca95d90b81b0d3a7977d9620663 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 21 Aug 2017 00:43:28 +0200 Subject: [PATCH 327/417] regenerated library files following jison commit https://github.com/GerHobbelt/jison/commit/5f8e197e44b5d2526e7641c8511402c6675d25db --- lex-parser.js | 73 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 54 insertions(+), 19 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 871d857..27e5864 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -904,6 +904,12 @@ performAction: function parser__PerformAction(yystate /* action[1] */, yysp, yyv var yy = this.yy; switch (yystate) { +case 0: + /*! Production:: $accept : lex "$end" */ + // default action (generated by JISON): + this.$ = yyvstack[yysp - 1]; + break; + case 1: /*! Production:: lex : init definitions rules_and_epilogue EOF */ this.$ = yyvstack[yysp - 1]; @@ -1121,6 +1127,36 @@ case 31: yy.parser.yyError("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body:\n" + ab); break; +case 34: + /*! Production:: unbracketed_action_body : ACTION */ +case 48: + /*! Production:: regex_list : nonempty_regex_list */ +case 52: + /*! Production:: nonempty_regex_list : regex_concat */ +case 54: + /*! Production:: regex_concat : regex_base */ +case 64: + /*! Production:: regex_base : name_expansion */ +case 66: + /*! Production:: regex_base : any_group_regex */ +case 70: + /*! Production:: regex_base : string */ +case 71: + /*! Production:: regex_base : escape_char */ +case 72: + /*! Production:: name_expansion : NAME_BRACE */ +case 76: + /*! Production:: regex_set : regex_set_atom */ +case 77: + /*! Production:: regex_set_atom : REGEX_SET */ +case 82: + /*! Production:: string : CHARACTER_LIT */ +case 85: + /*! Production:: option_list : option */ + // default action (generated by JISON): + this.$ = yyvstack[yysp]; + break; + case 35: /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ this.$ = yyvstack[yysp - 1] + '\n' + yyvstack[yysp]; @@ -1172,6 +1208,12 @@ case 43: this.$ = ['*']; break; +case 44: + /*! Production:: start_conditions : ε */ + // default action (generated by JISON): + this.$ = undefined; + break; + case 45: /*! Production:: name_list : NAME */ this.$ = [yyvstack[yysp]]; @@ -1353,6 +1395,18 @@ case 81: this.$ = prepareString(yyvstack[yysp].substr(1, yyvstack[yysp].length - 2)); break; +case 83: + /*! Production:: options : OPTIONS option_list OPTIONS_END */ + // default action (generated by JISON): + this.$ = [yyvstack[yysp - 2], yyvstack[yysp - 1], yyvstack[yysp]]; + break; + +case 84: + /*! Production:: option_list : option option_list */ + // default action (generated by JISON): + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + case 86: /*! Production:: option : NAME */ yy.options[yyvstack[yysp]] = true; @@ -3060,25 +3114,6 @@ parse: function parse(input) { - // Make sure subsequent `$$ = $1` default action doesn't fail - // for rules where len==0 as then there's no $1 (you're reducing an epsilon rule then!) - // - // Also do this to prevent nasty action block codes to *read* `$0` or `$$` - // and *not* get `undefined` as a result for their efforts! - vstack[sp] = undefined; - - // perform semantic action - yyval.$ = vstack[sp - len]; // default to $$ = $1; result must produce `undefined` when len == 0, as then there's no $1 - - - - - - - - - - r = this.performAction.call(yyval, newState, sp - 1, vstack); if (typeof r !== 'undefined') { From 69375055fd68deb4fe1d2380d69ee3dbe127574a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 21 Aug 2017 02:42:34 +0200 Subject: [PATCH 328/417] regenerated library files after jison update --- lex-parser.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 27e5864..057cf3d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -905,7 +905,7 @@ var yy = this.yy; switch (yystate) { case 0: - /*! Production:: $accept : lex "$end" */ + /*! Production:: $accept : lex $end */ // default action (generated by JISON): this.$ = yyvstack[yysp - 1]; break; @@ -3160,8 +3160,9 @@ parse: function parse(input) { // else // return true; // the default parse result if the rule actions don't produce anything // %} - if (typeof yyval.$ !== 'undefined') { - retval = yyval.$; + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; } break; } From 16e3edcb0d474b443225c60d3fc1570ce92bd2c5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 21 Aug 2017 21:15:50 +0200 Subject: [PATCH 329/417] - cleanup: `popState()` API does not accept an argument. - cleanup: clean up the lexer condition stack better by better matching `pushState()` actions with their matching `popState()` counterparts: this is non-trivial in the current lexer grammar though... - defensive coding: fix situations like https://github.com/zaach/jison/issues/358 / https://github.com/wycats/handlebars.js/issues/1368 in the spurious case where the lexer `parseError()` API is invoked *before* the `setInput()` API is invoked (which would *always* set up a non-NULL (though possibly *empty*) `this.yy` lexer context. (Original jison (https://github.com/zaach/jison) doesn't do the latter either, BTW) --- lex.l | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lex.l b/lex.l index b9ed8b9..3517889 100644 --- a/lex.l +++ b/lex.l @@ -51,6 +51,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "{" yy.depth++; return '{'; "}" %{ if (yy.depth == 0) { + this.popState(); this.pushState('trail'); } else { yy.depth--; @@ -66,7 +67,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR}+ /* empty */ {WS}+{BR}+ /* empty */ {WS}+ this.pushState('indented'); -"%%" this.pushState('code'); return '%%'; +"%%" this.popState(); this.pushState('code'); return '%%'; // Accept any non-regex-special character as a direct literal without // the need to put quotes around it: {ANY_LITERAL_CHAR}+ @@ -97,8 +98,9 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR}+ this.popState(); {WS}+ /* empty */ -{WS}*{BR}+ this.pushState('rules'); +{WS}*{BR}+ this.popState(); this.unput(yytext); /* this.unput(yytext); can be used here instead of this.reject(); which would only work when we set the backtrack_lexer option */ +{WS}*{BR}+ this.popState(); "{" yy.depth = 0; this.pushState('action'); return '{'; "%{"(?:.|{BR})*?"%}" this.pushState('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; "%{"(?:.|{BR})*?"%}" yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; @@ -124,7 +126,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] .* this.popState(); return 'ACTION'; {ID} this.pushState('macro'); return 'NAME'; -{BR}+ this.popState('macro'); +{BR}+ this.popState(); // Accept any non-regex-special character as a direct literal without // the need to put quotes around it: @@ -180,7 +182,6 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] // matches: this.matches // } ); - // this.pushState('options'); yytext = [ this.matches[1], // {NAME} this.matches[2].trim() // optional value/parameters @@ -197,7 +198,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] (?:"\\\\"|"\\]"|[^\]{])+ return 'REGEX_SET'; "{" return 'REGEX_SET'; -"]" this.popState('set'); return 'REGEX_SET_END'; +"]" this.popState(); return 'REGEX_SET_END'; // in the trailing CODE block, only accept these `%include` macros when @@ -268,7 +269,7 @@ function dquote(s) { } lexer.warn = function l_warn() { - if (this.yy.parser && typeof this.yy.parser.warn === 'function') { + if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { return this.yy.parser.warn.apply(this, arguments); } else { console.warn.apply(console, arguments); @@ -276,7 +277,7 @@ lexer.warn = function l_warn() { }; lexer.log = function l_log() { - if (this.yy.parser && typeof this.yy.parser.log === 'function') { + if (this.yy && this.yy.parser && typeof this.yy.parser.log === 'function') { return this.yy.parser.log.apply(this, arguments); } else { console.log.apply(console, arguments); From 49188be00cf73133072e495d6e10a9c64af61941 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 21 Aug 2017 21:17:22 +0200 Subject: [PATCH 330/417] fix crash when parsing lexer condition groups (which are otherwise still a broken feature!): the reference name in the action did not exist. --- lex.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex.y b/lex.y index 1c1f934..fda0439 100644 --- a/lex.y +++ b/lex.y @@ -173,7 +173,7 @@ rules_collective rule_block : rule_block rule - { $$ = $rules; $$.push($rule); } + { $$ = $rule_block; $$.push($rule); } | ε { $$ = []; } ; From 7066542dd9074e0176c68d0820efeb7a381c065f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 01:00:43 +0200 Subject: [PATCH 331/417] updated the package version to 0.6.0- to mirror the jison version: after all these modules are tightly related to jison itself --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f484b39..217bc1d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "lex-parser", - "version": "0.1.4-186", + "version": "0.6.0-186", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From aa97526f19ef1b1e173c8b2e1d4c0bf98fe1eb8c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 01:02:19 +0200 Subject: [PATCH 332/417] cleaned up the lexer/parser string handling. --- lex.l | 18 ++++++++++++------ lex.y | 6 +++--- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lex.l b/lex.l index 3517889..8cce662 100644 --- a/lex.l +++ b/lex.l @@ -102,8 +102,8 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {WS}*{BR}+ this.popState(); "{" yy.depth = 0; this.pushState('action'); return '{'; -"%{"(?:.|{BR})*?"%}" this.pushState('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; -"%{"(?:.|{BR})*?"%}" yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; +"%{"((?:.|{BR})*?)"%}" this.pushState('trail'); yytext = this.matches[1]; return 'ACTION'; +"%{"((?:.|{BR})*?)"%}" yytext = this.matches[1]; return 'ACTION'; "%include" %{ // This is an include instruction in place of an action: // thanks to the `.+` rule immediately below we need to semi-duplicate @@ -140,10 +140,16 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR}+ /* empty */ \s+ /* empty */ -\"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; -\'{QUOTED_STRING_CONTENT}\' - yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" %{ + yytext = this.matches[1]; + yytext = yytext.replace(/\\"/g,'"'); + return 'STRING_LIT'; + %} +\'{QUOTED_STRING_CONTENT}\' %{ + yytext = this.matches[1]; + yytext = yytext.replace(/\\'/g,"'"); + return 'STRING_LIT'; + %} "[" this.pushState('set'); return 'REGEX_SET_START'; "|" return '|'; "(?:" return 'SPECIAL_GROUP'; diff --git a/lex.y b/lex.y index fda0439..6194dfe 100644 --- a/lex.y +++ b/lex.y @@ -422,7 +422,7 @@ range_regex string : STRING_LIT - { $$ = prepareString($STRING_LIT.substr(1, $STRING_LIT.length - 2)); } + { $$ = prepareString($STRING_LIT); } | CHARACTER_LIT ; @@ -485,11 +485,11 @@ optional_module_code_chunk var XRegExp = require('xregexp'); // for helping out the `%options xregexp` in the lexer -function encodeRE (s) { +function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); } -function prepareString (s) { +function prepareString(s) { // unescape slashes s = s.replace(/\\\\/g, "\\"); s = encodeRE(s); From 1d160f7b5da6d3efd0937ef6b3a6dc5d1ac16945 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 01:04:53 +0200 Subject: [PATCH 333/417] Added error recovery/diagnostic rules to help error reporting. Largely a TODO. --- lex.y | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/lex.y b/lex.y index 6194dfe..043d5c4 100644 --- a/lex.y +++ b/lex.y @@ -36,7 +36,7 @@ lex } | init definitions error EOF { - yyerror("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: definitions %% rules [%% extra_module_code]"); + yyerror("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: definitions %% rules [%% extra_module_code]", @error); } ; @@ -160,14 +160,13 @@ rules_collective } $$ = $rule_block; } - | start_conditions '{' rule_block error + | start_conditions '{' error '}' { - if ($start_conditions) { - $rule_block.forEach(function (d) { - d.unshift($start_conditions); - }); - } - yyerror("Seems you did not correctly bracket a lexer rule set inside the start condition <" + $start_conditions.join(',') + "> { rules... } as a terminating curly brace '}' could not be found.", $rule_block); + yyerror("Seems you made a mistake while specifying one of the lexer rules inside the start condition <" + $start_conditions.join(',') + "> { rules... } block.", @error); + } + | start_conditions '{' error + { + yyerror("Seems you did not correctly bracket a lexer rules set inside the start condition <" + $start_conditions.join(',') + "> { rules... } as a terminating curly brace '}' could not be found.", @error, $rule_block); } ; @@ -181,6 +180,11 @@ rule_block rule : regex action { $$ = [$regex, $action]; } + | regex error + { + $$ = [$regex, $error]; + yyerror("lexer rule regex action code declaration error?", @error); + } ; action From a6444124422289313e95f5ef202cd34d2d91c3b0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 01:34:28 +0200 Subject: [PATCH 334/417] regenerated library files --- lex-parser.js | 4411 +++++++++++++++++++++++++-------------------- package-lock.json | 1061 +++++++---- 2 files changed, 3219 insertions(+), 2253 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 057cf3d..101dfe6 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,5 @@ -/* parser generated by jison 0.4.18-186 */ + +/* parser generated by jison 0.6.0-186 */ /* * Returns a Parser object of the following structure: @@ -41,9 +42,7 @@ * terminal_descriptions_: (if there are any) {associative list: number ==> description}, * productions_: [...], * - * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack, ...), - * where `...` denotes the (optional) additional arguments the user passed to - * `parser.parse(str, ...)` and specified by way of `%parse-param ...` in the grammar file + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack), * * The function parameters and `this` have the following value/meaning: * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) @@ -54,6 +53,13 @@ * data from one reduce action through to the next within a single parse run, then you * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. * + * `this.yy` is a direct reference to the `yy` shared state object. + * + * `%parse-param`-specified additional `parse()` arguments have been added to this `yy` + * object at `parse()` start and are therefore available to the action code via the + * same named `yy.xxxx` attributes (where `xxxx` represents a identifier name from + * the %parse-param` list. + * * - `yytext` : reference to the lexer value which belongs to the last lexer token used * to match this rule. This is *not* the look-ahead token, but the last token * that's actually part of this rule. @@ -68,8 +74,11 @@ * * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. * + * WARNING: since jison 0.4.18-186 this entry may be NULL/UNDEFINED instead + * of an empty object when no suitable location info can be provided. + * * - `yystate` : the current parser state number, used internally for dispatching and - * executing the action code chunk matching the rule currently being reduced. + * executing the action code chunk matching the rule currently being reduced. * * - `yysp` : the current state stack position (a.k.a. 'stack pointer') * @@ -90,18 +99,28 @@ * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. * + * - `yyrulelength`: the current rule's term count, i.e. the number of entries occupied on the stack. + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. * constructs. * * - `yylstack`: reference to the parser token location stack. Also accessed via * the `@1` etc. constructs. * + * WARNING: since jison 0.4.18-186 this array MAY contain slots which are + * UNDEFINED rather than an empty (location) object, when the lexer/parser + * action code did not provide a suitable location info object when such a + * slot was filled! + * * - `yystack` : reference to the parser token id stack. Also accessed via the * `#1` etc. constructs. * * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might - * want access for your own purposes, such as error analysis as mentioned above! + * want access this array for your own purposes, such as error analysis as mentioned above! * * Note that this stack stores the current stack of *tokens*, that is the sequence of * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* @@ -158,7 +177,17 @@ * Parse the given `input` and return the parsed value (or `true` when none was provided by * the root action, in which case the parser is acting as a *matcher*). * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: - * these extra `args...` are passed verbatim to the grammar rules' action code. + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * the lexer section of the grammar spec): these will be inserted in the `yy` shared state + * object and any collision with those will be reported by the lexer via a thrown exception. * * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), * Helper function **which will be set up during the first invocation of the `parse()` method**. @@ -167,6 +196,17 @@ * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and * the internal parser gets properly garbage collected under these particular circumstances. * + * mergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API can be invoked to calculate a spanning `yylloc` location info object. + * + * Note: %epsilon rules MAY specify no `first_index` and `first_yylloc`, in which case + * this function will attempt to obtain a suitable location marker by inspecting the location stack + * backwards. + * + * For more info see the documentation comment further below, immediately above this function's + * implementation. + * * lexer: { * yy: {...}, A reference to the so-called "shared state" `yy` once * received via a call to the `.setInput(input, yy)` lexer API. @@ -280,10 +320,10 @@ * * ### options which are global for all parser instances * - * Parser.pre_parse: function(yy [, optional parse() args]) + * Parser.pre_parse: function(yy) * optional: you can specify a pre_parse() function in the chunk following * the grammar, i.e. after the last `%%`. - * Parser.post_parse: function(yy, retval [, optional parse() args]) { return retval; } + * Parser.post_parse: function(yy, retval, parseInfo) { return retval; } * optional: you can specify a post_parse() function in the chunk following * the grammar, i.e. after the last `%%`. When it does not return any value, * the parser will return the original `retval`. @@ -291,18 +331,18 @@ * ### options which can be set up per parser instance * * yy: { - * pre_parse: function(yy [, optional parse() args]) + * pre_parse: function(yy) * optional: is invoked before the parse cycle starts (and before the first * invocation of `lex()`) but immediately after the invocation of * `parser.pre_parse()`). - * post_parse: function(yy, retval [, optional parse() args]) { return retval; } + * post_parse: function(yy, retval, parseInfo) { return retval; } * optional: is invoked when the parse terminates due to success ('accept') * or failure (even when exceptions are thrown). * `retval` contains the return value to be produced by `Parser.parse()`; * this function can override the return value by returning another. * When it does not return any value, the parser will return the original * `retval`. - * This function is invoked immediately before `Parser.post_parse()`. + * This function is invoked immediately before `parser.post_parse()`. * * parseError: function(str, hash, ExceptionClass) * optional: overrides the default `parseError` function. @@ -331,7 +371,7 @@ * the lexer terminates the scan when a token is returned by the action code. * xregexp: boolean * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the - * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * `XRegExp` library. When this `%option` has not been specified at compile time, all lexer * rule regexes have been written as standard JavaScript RegExp expressions. * } */ @@ -537,11 +577,12 @@ var parser = { // uses YYCLEARIN: .................. false // tracks rule values: .............. true // assigns rule values: ............. true - // uses location tracking: .......... false - // assigns location: ................ false + // uses location tracking: .......... true + // assigns location: ................ true // uses yystack: .................... false // uses yysstack: ................... false // uses yysp: ....................... true + // uses yyrulelength: ............... false // has error recovery: .............. true // // --------- END OF REPORT ----------- @@ -691,6 +732,7 @@ originalQuoteName: null, originalParseError: null, cleanupAfterParse: null, constructParseErrorInfo: null, +mergeLocationInfo: null, __reentrant_call_depth: 0, // INTERNAL USE ONLY __error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup @@ -789,10 +831,11 @@ productions_: bp({ 51, 51, s, - [52, 3], + [52, 4], 53, 53, 54, + 54, s, [55, 4], 56, @@ -856,16 +899,20 @@ productions_: bp({ 2, c, [15, 3], + 4, + 4, + 3, c, - [23, 4], + [21, 4], c, - [18, 6], + [20, 5], 2, 1, 5, 4, + 0, c, - [11, 4], + [11, 3], 3, 0, 1, @@ -874,7 +921,7 @@ productions_: bp({ 0, 3, c, - [32, 3], + [34, 3], 1, s, [3, 4], @@ -899,15 +946,23 @@ productions_: bp({ 0 ]) }), -performAction: function parser__PerformAction(yystate /* action[1] */, yysp, yyvstack) { -/* this == yyval */ -var yy = this.yy; +performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyrulelength, yyvstack, yylstack) { + + /* this == yyval */ + + // the JS engine itself can go and remove these statements when `yy` turns out to be unused in any action code! + var yy = this.yy; + var yyparser = yy.parser; + var yylexer = yy.lexer; -switch (yystate) { + + + switch (yystate) { case 0: /*! Production:: $accept : lex $end */ // default action (generated by JISON): this.$ = yyvstack[yysp - 1]; + this._$ = yylstack[yysp - 1]; break; case 1: @@ -936,7 +991,7 @@ case 1: case 2: /*! Production:: lex : init definitions error EOF */ - yy.parser.yyError("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: definitions %% rules [%% extra_module_code]"); + yyparser.yyError("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: definitions %% rules [%% extra_module_code]", yylstack[yysp - 1]); break; case 3: @@ -991,7 +1046,7 @@ case 8: case 9: /*! Production:: definition : NAME regex */ -case 29: +case 30: /*! Production:: rule : regex action */ this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; @@ -1000,21 +1055,21 @@ case 10: /*! Production:: definition : START_INC names_inclusive */ case 11: /*! Production:: definition : START_EXC names_exclusive */ -case 32: +case 34: /*! Production:: action : unbracketed_action_body */ -case 33: +case 35: /*! Production:: action : include_macro_code */ -case 36: +case 38: /*! Production:: action_body : action_comments_body */ -case 79: +case 81: /*! Production:: escape_char : ESCAPE_CHAR */ -case 80: +case 82: /*! Production:: range_regex : RANGE_REGEX */ -case 90: +case 92: /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 94: - /*! Production:: module_code_chunk : CODE */ case 96: + /*! Production:: module_code_chunk : CODE */ +case 98: /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = yyvstack[yysp]; break; @@ -1028,7 +1083,7 @@ case 13: /*! Production:: definition : "{" action_body error */ var l = yyvstack[yysp - 1].split('\n'); var ab = l.slice(0, 10).join('\n'); - yy.parser.yyError("Seems you did not correctly bracket the lexer 'preparatory' action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + yyparser.yyError("Seems you did not correctly bracket the lexer 'preparatory' action block in curly braces: '{ ... }'. Offending action body:\n" + ab); break; case 14: @@ -1075,7 +1130,7 @@ case 22: case 23: /*! Production:: rules : ε */ -case 28: +case 29: /*! Production:: rule_block : ε */ this.$ = []; break; @@ -1099,132 +1154,140 @@ case 25: break; case 26: - /*! Production:: rules_collective : start_conditions "{" rule_block error */ - if (yyvstack[yysp - 3]) { - yyvstack[yysp - 1].forEach(function (d) { - d.unshift(yyvstack[yysp - 3]); - }); - } - yy.parser.yyError("Seems you did not correctly bracket a lexer rule set inside the start condition <" + yyvstack[yysp - 3].join(',') + "> { rules... } as a terminating curly brace '}' could not be found.", yyvstack[yysp - 1]); + /*! Production:: rules_collective : start_conditions "{" error "}" */ + yyparser.yyError("Seems you made a mistake while specifying one of the lexer rules inside the start condition <" + yyvstack[yysp - 3].join(',') + "> { rules... } block.", yylstack[yysp - 1]); break; case 27: + /*! Production:: rules_collective : start_conditions "{" error */ + yyparser.yyError("Seems you did not correctly bracket a lexer rules set inside the start condition <" + yyvstack[yysp - 2].join(',') + "> { rules... } as a terminating curly brace '}' could not be found.", yylstack[yysp], $rule_block); + break; + +case 28: /*! Production:: rule_block : rule_block rule */ - this.$ = $rules; this.$.push(yyvstack[yysp]); + this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); break; -case 30: +case 31: + /*! Production:: rule : regex error */ + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + yyparser.yyError("lexer rule regex action code declaration error?", yylstack[yysp]); + break; + +case 32: /*! Production:: action : "{" action_body "}" */ -case 41: +case 43: /*! Production:: start_conditions : "<" name_list ">" */ this.$ = yyvstack[yysp - 1]; break; -case 31: +case 33: /*! Production:: action : "{" action_body error */ var l = yyvstack[yysp - 1].split('\n'); var ab = l.slice(0, 10).join('\n'); - yy.parser.yyError("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + yyparser.yyError("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body:\n" + ab); break; -case 34: +case 36: /*! Production:: unbracketed_action_body : ACTION */ -case 48: +case 50: /*! Production:: regex_list : nonempty_regex_list */ -case 52: - /*! Production:: nonempty_regex_list : regex_concat */ case 54: + /*! Production:: nonempty_regex_list : regex_concat */ +case 56: /*! Production:: regex_concat : regex_base */ -case 64: - /*! Production:: regex_base : name_expansion */ case 66: + /*! Production:: regex_base : name_expansion */ +case 68: /*! Production:: regex_base : any_group_regex */ -case 70: +case 72: /*! Production:: regex_base : string */ -case 71: +case 73: /*! Production:: regex_base : escape_char */ -case 72: +case 74: /*! Production:: name_expansion : NAME_BRACE */ -case 76: +case 78: /*! Production:: regex_set : regex_set_atom */ -case 77: +case 79: /*! Production:: regex_set_atom : REGEX_SET */ -case 82: +case 84: /*! Production:: string : CHARACTER_LIT */ -case 85: +case 87: /*! Production:: option_list : option */ // default action (generated by JISON): this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; break; -case 35: +case 37: /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ this.$ = yyvstack[yysp - 1] + '\n' + yyvstack[yysp]; break; -case 37: +case 39: /*! Production:: action_body : action_body "{" action_body "}" action_comments_body */ this.$ = yyvstack[yysp - 4] + yyvstack[yysp - 3] + yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 38: +case 40: /*! Production:: action_body : action_body "{" action_body error */ var l = yyvstack[yysp - 1].split('\n'); var ab = l.slice(0, 10).join('\n'); - yy.parser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Offending action body part:\n" + ab); + yyparser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Offending action body part:\n" + ab); break; -case 39: +case 41: /*! Production:: action_comments_body : ε */ -case 49: +case 51: /*! Production:: regex_list : ε */ -case 97: +case 99: /*! Production:: optional_module_code_chunk : ε */ this.$ = ''; break; -case 40: +case 42: /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ -case 53: +case 55: /*! Production:: regex_concat : regex_concat regex_base */ -case 65: +case 67: /*! Production:: regex_base : regex_base range_regex */ -case 75: +case 77: /*! Production:: regex_set : regex_set_atom regex_set */ -case 95: +case 97: /*! Production:: module_code_chunk : module_code_chunk CODE */ this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 42: +case 44: /*! Production:: start_conditions : "<" name_list error */ var l = yyvstack[yysp - 1]; var ab = l.slice(0, 10).join(',').replace(/[\s\r\n]/g, ' '); - yy.parser.yyError("Seems you did not correctly terminate the start condition set <" + ab + ",???> with a terminating '>'"); + yyparser.yyError("Seems you did not correctly terminate the start condition set <" + ab + ",???> with a terminating '>'"); break; -case 43: +case 45: /*! Production:: start_conditions : "<" "*" ">" */ this.$ = ['*']; break; -case 44: +case 46: /*! Production:: start_conditions : ε */ // default action (generated by JISON): this.$ = undefined; + this._$ = undefined; break; -case 45: +case 47: /*! Production:: name_list : NAME */ this.$ = [yyvstack[yysp]]; break; -case 46: +case 48: /*! Production:: name_list : name_list "," NAME */ this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; -case 47: +case 49: /*! Production:: regex : nonempty_regex_list */ // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' @@ -1289,95 +1352,95 @@ case 47: } break; -case 50: +case 52: /*! Production:: nonempty_regex_list : regex_concat "|" regex_list */ this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; -case 51: +case 53: /*! Production:: nonempty_regex_list : "|" regex_list */ this.$ = '|' + yyvstack[yysp]; break; -case 55: +case 57: /*! Production:: regex_base : "(" regex_list ")" */ this.$ = '(' + yyvstack[yysp - 1] + ')'; break; -case 56: +case 58: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; -case 57: +case 59: /*! Production:: regex_base : "(" regex_list error */ var l = yyvstack[yysp - 1]; var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); - yy.parser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: (" + ab, yyvstack[yysp - 1]); + yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: (" + ab, yyvstack[yysp - 1]); break; -case 58: +case 60: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ var l = yyvstack[yysp - 1]; var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); - yy.parser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: " + yyvstack[yysp - 2] + ab, yyvstack[yysp - 1]); + yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: " + yyvstack[yysp - 2] + ab, yyvstack[yysp - 1]); break; -case 59: +case 61: /*! Production:: regex_base : regex_base "+" */ this.$ = yyvstack[yysp - 1] + '+'; break; -case 60: +case 62: /*! Production:: regex_base : regex_base "*" */ this.$ = yyvstack[yysp - 1] + '*'; break; -case 61: +case 63: /*! Production:: regex_base : regex_base "?" */ this.$ = yyvstack[yysp - 1] + '?'; break; -case 62: +case 64: /*! Production:: regex_base : "/" regex_base */ this.$ = '(?=' + yyvstack[yysp] + ')'; break; -case 63: +case 65: /*! Production:: regex_base : "/!" regex_base */ this.$ = '(?!' + yyvstack[yysp] + ')'; break; -case 67: +case 69: /*! Production:: regex_base : "." */ this.$ = '.'; break; -case 68: +case 70: /*! Production:: regex_base : "^" */ this.$ = '^'; break; -case 69: +case 71: /*! Production:: regex_base : "$" */ this.$ = '$'; break; -case 73: +case 75: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 91: +case 93: /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 74: +case 76: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ var l = yyvstack[yysp - 1]; var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); - yy.parser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: " + yyvstack[yysp - 2] + ab, yyvstack[yysp - 1]); + yyparser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: " + yyvstack[yysp - 2] + ab, yyvstack[yysp - 1]); break; -case 78: +case 80: /*! Production:: regex_set_atom : name_expansion */ if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) && yyvstack[yysp].toUpperCase() !== yyvstack[yysp] @@ -1390,41 +1453,43 @@ case 78: //this.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 81: +case 83: /*! Production:: string : STRING_LIT */ - this.$ = prepareString(yyvstack[yysp].substr(1, yyvstack[yysp].length - 2)); + this.$ = prepareString(yyvstack[yysp]); break; -case 83: +case 85: /*! Production:: options : OPTIONS option_list OPTIONS_END */ // default action (generated by JISON): - this.$ = [yyvstack[yysp - 2], yyvstack[yysp - 1], yyvstack[yysp]]; + this.$ = yyvstack.slice(yysp - 2, yysp + 1); + this._$ = yyparser.mergeLocationInfo(yysp - 2, yysp); break; -case 84: +case 86: /*! Production:: option_list : option option_list */ // default action (generated by JISON): - this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + this.$ = yyvstack.slice(yysp - 1, yysp + 1); + this._$ = yyparser.mergeLocationInfo(yysp - 1, yysp); break; -case 86: +case 88: /*! Production:: option : NAME */ yy.options[yyvstack[yysp]] = true; break; -case 87: +case 89: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; -case 88: +case 90: /*! Production:: option : NAME "=" OPTION_VALUE */ -case 89: +case 91: /*! Production:: option : NAME "=" NAME */ yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; -case 92: +case 94: /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); @@ -1432,11 +1497,19 @@ case 92: this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; -case 93: +case 95: /*! Production:: include_macro_code : INCLUDE error */ - yy.parser.yyError("%include MUST be followed by a valid file path"); + yyparser.yyError("%include MUST be followed by a valid file path"); break; +case 100: + // error recovery reduction action (action generated by jison, + // using the user-specified `%code error_recovery_reduction` %{...%} + // code chunk below. + + + break; + } }, table: bt({ @@ -1523,7 +1596,7 @@ table: bt({ [3, 3], 17, 16, - 6, + 7, 3, 1, 3, @@ -1531,12 +1604,13 @@ table: bt({ 3, 6, 3, - 24, - 19, + 23, + s, + [18, 3], 6, - 20, 19, - 20, + 18, + 19, 14, 14, 1, @@ -1544,13 +1618,13 @@ table: bt({ 4, 1, 17, + 14, 17, - 15, - 3, - 20, 3, 19, - 19 + 3, + 18, + 18 ]), symbol: u([ 1, @@ -1792,6 +1866,7 @@ table: bt({ c, [251, 13], 53, + 2, 3, 23, 41, @@ -1805,55 +1880,56 @@ table: bt({ c, [4, 3], c, - [321, 4], + [322, 4], c, - [326, 4], + [327, 4], c, - [310, 7], + [311, 7], 41, 43, c, - [46, 15], + [46, 14], c, [297, 9], + 1, c, - [783, 12], + [782, 10], c, - [89, 8], + [27, 7], c, - [1483, 8], + [18, 36], c, - [25, 9], - 23, + [1518, 7], c, - [26, 7], + [24, 10], + 23, c, - [45, 19], + [61, 36], c, - [39, 20], + [37, 8], c, - [404, 14], + [436, 14], c, [14, 14], 20, c, [15, 14], c, - [489, 5], + [521, 5], c, - [219, 17], + [251, 17], c, - [236, 32], + [204, 14], c, - [217, 4], + [282, 18], c, - [120, 19], + [247, 3], c, - [248, 3], + [118, 18], c, - [162, 31], + [277, 3], c, - [19, 7] + [219, 36] ]), type: u([ s, @@ -1923,17 +1999,17 @@ table: bt({ c, [201, 39], c, - [1454, 5], + [1410, 7], c, - [289, 13], + [1457, 13], c, - [395, 28], + [311, 26], c, [297, 11], c, - [752, 48], + [422, 80], s, - [2, 195] + [2, 191] ]), state: u([ s, @@ -2006,17 +2082,17 @@ table: bt({ 103, 108, 110, - 111, - 113, - 114, - 120, - 121, + 112, + 115, + 116, + 122, + 123, 98, 97, - 124, + 125, c, [19, 8], - 125, + 127, 45 ]), mode: u([ @@ -2097,19 +2173,23 @@ table: bt({ c, [236, 21], c, - [1279, 23], + [728, 21], c, - [245, 14], + [246, 17], c, - [402, 6], + [403, 6], c, - [276, 48], + [276, 14], c, - [425, 76], + [279, 67], c, - [93, 68], + [346, 73], c, - [458, 64] + [452, 19], + c, + [298, 60], + s, + [2, 50] ]), goto: u([ s, @@ -2144,7 +2224,7 @@ table: bt({ 41, 43, s, - [39, 4], + [41, 4], s, [14, 11], s, @@ -2165,45 +2245,44 @@ table: bt({ s, [9, 11], s, - [47, 11], + [49, 11], s, - [52, 3], - 54, + [54, 4], 24, - 52, + 54, c, [114, 4], s, - [52, 6], + [54, 6], c, [120, 7], - 52, - 52, + 54, + 54, s, - [49, 3], + [51, 3], 22, 24, - 49, + 51, c, [25, 4], s, - [49, 6], + [51, 6], c, [25, 7], - 49, - 49, + 51, + 51, s, - [54, 3], + [56, 3], 59, s, - [54, 3], + [56, 3], 58, 60, s, - [54, 15], + [56, 15], 62, s, - [54, 4], + [56, 4], c, [52, 8], c, @@ -2215,12 +2294,8 @@ table: bt({ c, [12, 12], s, - [64, 29], - s, [66, 29], s, - [67, 29], - s, [68, 29], s, [69, 29], @@ -2229,15 +2304,19 @@ table: bt({ s, [71, 29], s, - [72, 31], + [72, 29], + s, + [73, 29], + s, + [74, 31], 35, 69, s, - [81, 29], + [83, 29], s, - [82, 29], + [84, 29], s, - [79, 29], + [81, 29], s, [10, 9], 71, @@ -2256,91 +2335,94 @@ table: bt({ 75, 73, s, - [36, 3], + [38, 3], 76, s, - [92, 27], + [94, 27], s, - [93, 27], + [95, 27], 77, 50, - 85, + 87, 79, - 86, - 86, + 88, + 88, 1, 2, 4, - 44, + 46, 83, s, - [44, 6], + [46, 6], 80, s, - [44, 7], + [46, 7], c, [565, 25], s, - [53, 3], + [55, 3], 59, s, - [53, 3], + [55, 3], 58, 60, s, - [53, 15], + [55, 15], 62, s, - [53, 4], + [55, 4], s, - [51, 12], + [53, 12], s, - [48, 12], + [50, 12], s, - [59, 29], + [61, 29], s, - [60, 29], + [62, 29], s, - [61, 29], + [63, 29], s, - [65, 29], + [67, 29], s, - [80, 29], + [82, 29], 86, 85, 88, 87, s, - [62, 3], + [64, 3], 59, s, - [62, 3], + [64, 3], 58, 60, s, - [62, 20], + [64, 15], + 62, s, - [63, 3], + [64, 4], + s, + [65, 3], 59, s, - [63, 3], + [65, 3], 58, 60, s, - [63, 15], - c, - [25, 4], - 63, + [65, 15], + 62, + s, + [65, 4], 90, 89, - 76, + 78, 35, - 76, + 78, 69, s, - [77, 4], + [79, 4], s, - [78, 4], + [80, 4], s, [19, 12], s, @@ -2350,18 +2432,17 @@ table: bt({ s, [13, 11], s, - [39, 4], + [41, 4], s, - [40, 4], + [42, 4], s, - [83, 11], - 84, + [85, 11], + 86, 95, 93, 94, - 97, - 97, - 99, + s, + [99, 3], s, [22, 17], 101, @@ -2370,104 +2451,112 @@ table: bt({ 104, 105, s, - [50, 12], - s, - [55, 29], + [52, 12], s, [57, 29], s, - [56, 29], + [59, 29], s, [58, 29], s, - [73, 29], + [60, 29], s, - [74, 29], - 75, - 75, + [75, 29], + s, + [76, 29], + 77, + 77, 107, 75, 106, - 87, - 87, - 88, - 88, 89, 89, - 3, 90, + 90, + 91, + 91, + 3, + 92, 13, - 96, - 96, + 98, + 98, 109, s, - [94, 3], + [96, 3], s, [24, 17], + 111, s, - [28, 15], - 112, - 115, - 13, + [29, 14], + 113, + 114, 117, - 116, - 118, + 13, 119, + 118, + 120, + 121, s, - [45, 3], + [47, 3], s, - [39, 4], + [41, 4], s, - [38, 3], - c, - [291, 3], + [40, 3], s, - [95, 3], - 123, - 122, + [99, 3], + s, + [97, 3], + 124, c, [278, 13], + 27, + 27, + 126, s, - [29, 19], + [27, 15], s, - [39, 4], + [30, 18], s, - [32, 12], - 126, + [31, 18], s, - [32, 7], + [41, 4], s, - [33, 19], + [34, 11], + 128, s, - [34, 20], + [34, 7], s, - [41, 14], + [35, 18], s, - [42, 14], - 127, + [36, 19], s, [43, 14], s, - [37, 3], + [44, 14], + 129, + s, + [45, 14], + s, + [39, 3], 76, - 91, + 93, s, [25, 17], s, - [26, 17], + [28, 14], s, - [27, 15], - 129, + [26, 17], + 131, 75, - 128, + 130, s, - [35, 20], + [37, 19], s, - [46, 3], + [48, 3], s, - [30, 19], + [32, 18], s, - [31, 19] + [33, 18] ]) }), defaultActions: bda({ @@ -2499,94 +2588,94 @@ defaultActions: bda({ [93, 4, 1], 99, 100, - 101, 105, 106, 107, 109, - 111, 112, + 113, + 114, s, - [114, 4, 1], - 119, + [116, 4, 1], + 121, s, - [121, 4, 1], + [123, 4, 1], s, - [126, 4, 1] + [128, 4, 1] ]), goto: u([ 6, - 39, + 41, s, [14, 4, 1], 23, 7, 9, - 47, - 64, + 49, + 66, s, - [66, 7, 1], + [68, 7, 1], + 83, + 84, 81, - 82, - 79, 18, 20, - 92, - 93, + 94, + 95, 1, 2, - 51, - 48, - 59, - 60, + 53, + 50, 61, - 65, + 62, + 63, + 67, + 82, + 79, 80, - 77, - 78, 19, 21, 12, 13, - 39, - 40, - 83, - 84, + 41, + 42, + 85, + 86, 22, - 50, - 55, + 52, 57, - 56, + 59, 58, - 73, - 74, + 60, 75, - 87, - 88, + 76, + 77, 89, + 90, + 91, 3, - 94, + 96, 24, - 28, - 45, - 39, - 38, - 95, - 29, - 39, - 33, - 34, + 47, 41, - 42, + 40, + 97, + 30, + 31, + 41, + 35, + 36, 43, - 91, + 44, + 45, + 93, 25, + 28, 26, - 27, - 35, - 46, - 30, - 31 + 37, + 48, + 32, + 33 ]) }), parseError: function parseError(str, hash, ExceptionClass) { @@ -2606,7 +2695,7 @@ parse: function parse(input) { sstack = new Array(128), // state stack: stores states (column storage) vstack = new Array(128), // semantic value stack - + lstack = new Array(128), // location stack table = this.table, sp = 0; // 'stack pointer': index into the stacks @@ -2629,15 +2718,29 @@ parse: function parse(input) { lexer: null, parser: null, pre_parse: null, - post_parse: null + post_parse: null, + pre_lex: null, + post_lex: null }; - // copy state - for (var k in this.yy) { - if (Object.prototype.hasOwnProperty.call(this.yy, k)) { - sharedState_yy[k] = this.yy[k]; - } + + function shallow_copy(dst, src) { + for (var k in src) { + if (Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + } + function shallow_copy_noclobber(dst, src) { + for (var k in src) { + if (dst[k] === undefined && Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } } + // copy state + shallow_copy(sharedState_yy, this.yy); + sharedState_yy.lexer = lexer; sharedState_yy.parser = this; @@ -2693,21 +2796,26 @@ parse: function parse(input) { lexer.setInput(input, sharedState_yy); - - + var yyloc = lexer.yylloc; + lstack[sp] = yyloc; vstack[sp] = null; sstack[sp] = 0; stack[sp] = 0; ++sp; + + + + var ranges = lexer.options && lexer.options.ranges; + // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState_yy.parseError === 'function') { this.parseError = function parseErrorAlt(str, hash, ExceptionClass) { if (!ExceptionClass) { ExceptionClass = this.JisonParserError; } - return sharedState_yy.parseError(str, hash, ExceptionClass); + return sharedState_yy.parseError.call(this, str, hash, ExceptionClass); }; } else { this.parseError = this.originalParseError; @@ -2715,7 +2823,9 @@ parse: function parse(input) { // Does the shared state override the default `quoteName` that already comes with this instance? if (typeof sharedState_yy.quoteName === 'function') { - this.quoteName = sharedState_yy.quoteName; + this.quoteName = function quoteNameAlt(id_str) { + return sharedState_yy.quoteName.call(this, id_str); + }; } else { this.quoteName = this.originalQuoteName; } @@ -2730,14 +2840,27 @@ parse: function parse(input) { var rv; if (invoke_post_methods) { + var hash; + + if (sharedState_yy.post_parse || this.post_parse) { + // create an error hash info instance: we re-use this API in a **non-error situation** + // as this one delivers all parser internals ready for access by userland code. + hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false); + } + if (sharedState_yy.post_parse) { - rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue); + rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash); if (typeof rv !== 'undefined') resultValue = rv; } if (this.post_parse) { - rv = this.post_parse.call(this, sharedState_yy, resultValue); + rv = this.post_parse.call(this, sharedState_yy, resultValue, hash); if (typeof rv !== 'undefined') resultValue = rv; } + + // cleanup: + if (hash) { + hash.destroy(); + } } if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. @@ -2749,8 +2872,6 @@ parse: function parse(input) { // prevent lingering circular references from causing memory leaks: if (sharedState_yy) { - sharedState_yy.parseError = undefined; - sharedState_yy.quoteName = undefined; sharedState_yy.lexer = undefined; sharedState_yy.parser = undefined; if (lexer.yy === sharedState_yy) { @@ -2765,7 +2886,7 @@ parse: function parse(input) { // To be safe, we nuke the other internal stack columns as well... stack.length = 0; // fastest way to nuke an array without overly bothering the GC sstack.length = 0; - + lstack.length = 0; vstack.length = 0; sp = 0; @@ -2785,6 +2906,139 @@ parse: function parse(input) { return resultValue; }; + // merge yylloc info into a new yylloc instance. + // + // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stakc array. + // + // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which + // case these override the corresponding first/last indexes. + // + // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search + // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!) + // yylloc info. + // + // Note: epsilon rule's yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL. + this.mergeLocationInfo = function parser_mergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) { + var i1 = first_index | 0, + i2 = last_index | 0; + var l1 = first_yylloc, + l2 = last_yylloc; + var rv; + + // rules: + // - first/last yylloc entries override first/last indexes + + if (!l1) { + if (first_index != null) { + for (var i = i1; i <= i2; i++) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + } + + if (!l2) { + if (last_index != null) { + for (var i = i2; i >= i1; i--) { + l2 = lstack[i]; + if (l2) { + break; + } + } + } + } + + // - detect if an epsilon rule is being processed and act accordingly: + var start_with_epsilon = false; + if (!l1 && first_index == null) { + // epsilon rule span merger. With optional look-ahead in l2. + start_with_epsilon = true; + if (!dont_look_back) { + for (var i = (i1 || sp) - 1; i >= 0; i--) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + if (!l1) { + if (!l2) { + // when we still don't have any valid yylloc info, we're looking at an epsilon rule + // without look-ahead and no preceding terms and/or `dont_look_back` set: + // in that case we ca do nothing but return NULL/UNDEFINED: + return undefined; + } else { + // shallow-copy L2: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = {}; + shallow_copy(rv, l2); + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + return rv; + } + } else { + // shallow-copy L1, then adjust first col/row 1 column past the end. + rv = {}; + shallow_copy(rv, l1); + rv.first_line = rv.last_line; + rv.first_column = rv.last_column; + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + rv.range[0] = rv.range[1]; + } + + if (l2) { + // shallow-mixin L2, then adjust last col/row accordingly. + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + return rv; + } + } + + if (!l1) { + l1 = l2; + l2 = null; + } + if (!l1) { + return undefined; + } + + rv = {}; + // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking + // at unconventional yylloc info objects... + shallow_copy(rv, l1); + + // first_line: ..., + // first_column: ..., + // last_line: ..., + // last_column: ..., + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + + if (l2) { + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + + return rv; + }; + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, // or else your `lexer`, `sharedState`, etc. references will be *wrong*! this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { @@ -2796,7 +3050,7 @@ parse: function parse(input) { token: this.describeSymbol(symbol) || symbol, token_id: symbol, line: lexer.yylineno, - + loc: lexer.yylloc, expected: expected, recoverable: recoverable, state: state, @@ -2805,7 +3059,7 @@ parse: function parse(input) { symbol_stack: stack, state_stack: sstack, value_stack: vstack, - + location_stack: lstack, stack_pointer: sp, yy: sharedState_yy, lexer: lexer, @@ -2860,7 +3114,6 @@ parse: function parse(input) { yy: sharedState_yy }; var p, len, this_production; - var newState; var retval = false; @@ -2977,7 +3230,10 @@ parse: function parse(input) { r = this.parseError(p.errStr, p, this.JisonParserError); - if (!p.recoverable) { + // Protect against overly blunt userland `parseError` code which *sets* + // the `recoverable` flag without properly checking first: + // we always terminate the parse when there's no recovery rule available anyhow! + if (!p.recoverable || error_rule_depth < 0) { retval = r; break; } else { @@ -2989,52 +3245,92 @@ parse: function parse(input) { // just recovered from another error if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { - // only barf a fatal hairball when we're out of look-ahead symbols and none hit a match; - // this DOES discard look-ahead while recovering from an error when said look-ahead doesn't - // suit the error recovery rules... The error HAS been reported already so we're fine with - // throwing away a few items if that is what it takes to match the nearest recovery rule! - if (symbol === EOF || preErrorSymbol === EOF) { - p = this.__error_infos[this.__error_infos.length - 1]; - if (!p) { - p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error.', null, expected, false); - } else { - p.errStr = 'Parsing halted while starting to recover from another error. Previous error which resulted in this fatal result: ' + p.errStr; - p.recoverable = false; - } - retval = this.parseError(p.errStr, p, this.JisonParserError); - break; - } - - // discard current lookahead and grab another - + // SHIFT current lookahead and grab another + stack[sp] = symbol; + vstack[sp] = lexer.yytext; + lstack[sp] = lexer.yylloc; + sstack[sp] = newState; // push state + ++sp; + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + yyloc = lexer.yylloc; symbol = lex(); + if (error_rule_depth >= 0) { + // correct for the ERROR SHIFT above by adjusting the REDUCE amount: + error_rule_depth++; + } + } // try to recover from error if (error_rule_depth < 0) { - p = this.constructParseErrorInfo((errStr || 'Parsing halted. No suitable error recovery rule available.'), null, expected, false); + //assert(recovering); + + // barf a fatal hairball when we're out of look-ahead symbols and none hit a match + // while we are still busy recovering from another error: + var po = this.__error_infos[this.__error_infos.length - 1]; + if (!po) { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error.', null, expected, false); + } else { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error. Previous error which resulted in this fatal result: ' + po.errStr, null, expected, false); + p.extra_error_attributes = po; + } retval = this.parseError(p.errStr, p, this.JisonParserError); break; } - sp -= error_rule_depth; preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token symbol = TERROR; // insert generic error symbol as new lookahead - // allow N (default: 3) real symbols to be shifted before reporting a new error - recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; - newState = sstack[sp - 1]; + // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token: + stack[sp] = preErrorSymbol; + vstack[sp] = lexer.yytext; + lstack[sp] = lexer.yylloc; + sstack[sp] = newState || NO_ACTION[1]; + sp++; + error_rule_depth++; + yyval.$ = undefined; + yyval._$ = undefined; + len = error_rule_depth; - continue; - } + r = this.performAction.call(yyval, yyloc, NO_ACTION[1], sp - 1, len, vstack, lstack); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= len; + + stack[sp] = TERROR; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + + newState = sstack[sp - 1]; + + if (this.defaultActions[newState]) { + sstack[sp] = this.defaultActions[newState]; + } else { + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + sstack[sp] = t[1]; + } + + // allow N (default: 3) real symbols to be shifted before reporting a new error + recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; + + + + continue; + } } @@ -3047,12 +3343,13 @@ parse: function parse(input) { + switch (action) { // catch misc. parse failures: default: // this shouldn't happen, unless resolve defaults are off if (action instanceof Array) { - p = this.constructParseErrorInfo(('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol), null, null, false); + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); retval = this.parseError(p.errStr, p, this.JisonParserError); break; } @@ -3066,7 +3363,7 @@ parse: function parse(input) { case 1: stack[sp] = symbol; vstack[sp] = lexer.yytext; - + lstack[sp] = lexer.yylloc; sstack[sp] = newState; // push state ++sp; symbol = 0; @@ -3075,7 +3372,7 @@ parse: function parse(input) { - + yyloc = lexer.yylloc; if (recovering > 0) { recovering--; @@ -3111,10 +3408,10 @@ parse: function parse(input) { + yyval.$ = undefined; + yyval._$ = undefined; - - - r = this.performAction.call(yyval, newState, sp - 1, vstack); + r = this.performAction.call(yyval, yyloc, newState, sp - 1, len, vstack, lstack); if (typeof r !== 'undefined') { retval = r; @@ -3128,7 +3425,7 @@ parse: function parse(input) { var ntsymbol = this_production[0]; // push nonterminal (reduce) stack[sp] = ntsymbol; vstack[sp] = yyval.$; - + lstack[sp] = yyval._$; // goto new state = table[STATE][NONTERMINAL] newState = table[sstack[sp - 1]][ntsymbol]; sstack[sp] = newState; @@ -3197,11 +3494,11 @@ parser.originalQuoteName = parser.quoteName; var XRegExp = require('xregexp'); // for helping out the `%options xregexp` in the lexer -function encodeRE (s) { +function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); } -function prepareString (s) { +function prepareString(s) { // unescape slashes s = s.replace(/\\\\/g, "\\"); s = encodeRE(s); @@ -3236,27 +3533,34 @@ parser.warn = function p_warn() { parser.log = function p_log() { console.log.apply(console, arguments); }; -/* lexer generated by jison-lex 0.3.4-186 */ +/* lexer generated by jison-lex 0.6.0-186 */ + /* * Returns a Lexer object of the following structure: * * Lexer: { * yy: {} The so-called "shared state" or rather the *source* of it; * the real "shared state" `yy` passed around to - * the rule actions, etc. is a derivative/copy of this one, - * not a direct reference! + * the rule actions, etc. is a direct reference! + * + * This "shared context" object was passed to the lexer by way of + * the `lexer.setInput(str, yy)` API before you may use it. + * + * This "shared context" object is passed to the lexer action code in `performAction()` + * so userland code in the lexer actions may communicate with the outside world + * and/or other lexer rules' actions in more or less complex ways. + * * } * * Lexer.prototype: { - * yy: {}, * EOF: 1, * ERROR: 2, * + * yy: The overall "shared context" object reference. + * * JisonLexerError: function(msg, hash), * - * performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START, ...), - * where `...` denotes the (optional) additional arguments the user passed to - * `lexer.lex(...)` and specified by way of `%parse-param ...` in the **parser** grammar file + * performAction: function lexer__performAction(yy, yy_, yyrulenumber, YY_START), * * The function parameters and `this` have the following value/meaning: * - `this` : reference to the `lexer` instance. @@ -3264,16 +3568,17 @@ parser.log = function p_log() { * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer * by way of the `lexer.setInput(str, yy)` API before. * + * Note: + * The extra arguments you specified in the `%parse-param` statement in your + * **parser** grammar definition file are passed to the lexer via this object + * reference as member variables. + * * - `yy_` : lexer instance reference used internally. * - * - `$avoiding_name_collisions` : index of the matched lexer rule (regex), used internally. + * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. * * - `YY_START`: the current lexer "start condition" state. * - * - `...` : the extra arguments you specified in the `%parse-param` statement in your - * **parser** grammar definition file and which are passed to the lexer via - * its `lexer.lex(...)` API. - * * parseError: function(str, hash, ExceptionClass), * * constructLexErrorInfo: function(error_message, is_recoverable), @@ -3286,40 +3591,83 @@ parser.log = function p_log() { * * options: { ... lexer %options ... }, * - * lex: function([args...]), + * lex: function(), * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. - * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **parser** grammar: - * these extra `args...` are passed verbatim to the lexer rules' action code. + * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the **parser** or the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! * * cleanupAfterLex: function(do_not_nuke_errorinfos), * Helper function. - * This helper API is invoked when the parse process has completed. This helper may - * be invoked by user code to ensure the internal lexer gets properly garbage collected. * - * setInput: function(input, [yy]), - * input: function(), - * unput: function(str), - * more: function(), - * reject: function(), - * less: function(n), - * pastInput: function(n), - * upcomingInput: function(n), - * showPosition: function(), - * test_match: function(regex_match_array, rule_index), - * next: function(...), - * lex: function(...), - * begin: function(condition), - * pushState: function(condition), - * popState: function(), - * topState: function(), - * _currentRules: function(), - * stateStackSize: function(), + * This helper API is invoked when the **parse process** has completed: it is the responsibility + * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. * - * options: { ... lexer %options ... }, + * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. * - * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...), - * rules: [...], - * conditions: {associative list: name ==> set}, + * setInput: function(input, [yy]), + * + * + * input: function(), + * + * + * unput: function(str), + * + * + * more: function(), + * + * + * reject: function(), + * + * + * less: function(n), + * + * + * pastInput: function(n), + * + * + * upcomingInput: function(n), + * + * + * showPosition: function(), + * + * + * test_match: function(regex_match_array, rule_index), + * + * + * next: function(), + * + * + * begin: function(condition), + * + * + * pushState: function(condition), + * + * + * popState: function(), + * + * + * topState: function(), + * + * + * _currentRules: function(), + * + * + * stateStackSize: function(), + * + * + * performAction: function(yy, yy_, yyrulenumber, YY_START), + * + * + * rules: [...], + * + * + * conditions: {associative list: name ==> set}, * } * * @@ -3405,63 +3753,65 @@ parser.log = function p_log() { */ -var lexer = (function () { -// See also: -// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 -// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility -// with userland code which might access the derived class in a 'classic' way. -function JisonLexerError(msg, hash) { +var lexer = function() { + // See also: + // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + // with userland code which might access the derived class in a 'classic' way. + function JisonLexerError(msg, hash) { Object.defineProperty(this, 'name', { - enumerable: false, - writable: false, - value: 'JisonLexerError' + enumerable: false, + writable: false, + value: 'JisonLexerError' }); - if (msg == null) msg = '???'; + if (msg == null) + msg = '???'; Object.defineProperty(this, 'message', { - enumerable: false, - writable: true, - value: msg + enumerable: false, + writable: true, + value: msg }); this.hash = hash; - var stacktrace; + if (hash && hash.exception instanceof Error) { - var ex2 = hash.exception; - this.message = ex2.message || msg; - stacktrace = ex2.stack; + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; } + if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { // V8 - Error.captureStackTrace(this, this.constructor); - } else { - stacktrace = (new Error(msg)).stack; - } + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = new Error(msg).stack; + } } + if (stacktrace) { - Object.defineProperty(this, 'stack', { - enumerable: false, - writable: false, - value: stacktrace - }); + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); } -} + } -if (typeof Object.setPrototypeOf === 'function') { + if (typeof Object.setPrototypeOf === 'function') { Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); -} else { + } else { JisonLexerError.prototype = Object.create(Error.prototype); -} -JisonLexerError.prototype.constructor = JisonLexerError; -JisonLexerError.prototype.name = 'JisonLexerError'; - - - + } -var lexer = { + JisonLexerError.prototype.constructor = JisonLexerError; + JisonLexerError.prototype.name = 'JisonLexerError'; + var lexer = { + // Code Generator Information Report // --------------------------------- // @@ -3479,30 +3829,32 @@ var lexer = { // uses yytext: ..................... false // uses yylloc: ..................... false // uses lexer values: ............... true / true - // location tracking: ............... false - // location assignment: ............. false + // location tracking: ............... true + // location assignment: ............. true // // // Lexer Analysis flags: // - // uses yyleng: ..................... undefined - // uses yylineno: ................... undefined - // uses yytext: ..................... undefined - // uses yylloc: ..................... undefined - // uses ParseError API: ............. undefined - // uses location tracking & editing: undefined - // uses more() API: ................. undefined - // uses unput() API: ................ undefined - // uses reject() API: ............... undefined - // uses less() API: ................. undefined + // uses yyleng: ..................... ??? + // uses yylineno: ................... ??? + // uses yytext: ..................... ??? + // uses yylloc: ..................... ??? + // uses ParseError API: ............. ??? + // uses yyerror: .................... ??? + // uses location tracking & editing: ??? + // uses more() API: ................. ??? + // uses unput() API: ................ ??? + // uses reject() API: ............... ??? + // uses less() API: ................. ??? // uses display APIs pastInput(), upcomingInput(), showPosition(): - // ............................. undefined - // uses describeYYLLOC() API: ....... undefined + // ............................. ??? + // uses describeYYLLOC() API: ....... ??? // // --------- END OF REPORT ----------- EOF: 1, + ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator @@ -3511,28 +3863,56 @@ var lexer = { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// <-- internal rule set cache for the current lexer state + /// <-- internal rule set cache for the current lexer state + __currentRuleSet__: null, + + /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __error_infos: [], + + /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + __decompressed: false, + + /// INTERNAL USE ONLY + done: false, + + /// INTERNAL USE ONLY + _backtrack: false, + + /// INTERNAL USE ONLY + _input: '', + + /// INTERNAL USE ONLY + _more: false, + + /// INTERNAL USE ONLY + _signaled_error_token: false, - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + conditionStack: [], - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + match: '', - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: '', /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY + /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matched: '', - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + matches: false, - match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + yytext: '', + + /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + offset: 0, + + /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yyleng: 0, + + /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylineno: 0, + + /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + yylloc: null, /** INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -3541,46 +3921,53 @@ var lexer = { @this {RegExpLexer} */ constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { - /** @constructor */ - var pei = { - errStr: msg, - recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... - token: null, - line: this.yylineno, - loc: this.yylloc, - yy: this.yy, - lexer: this, - - /** - and make sure the error info doesn't stay due to potential - ref cycle via userland code manipulations. - These would otherwise all be memory leak opportunities! - - Note that only array and object references are nuked as those - constitute the set of elements which can produce a cyclic ref. - The rest of the members is kept intact as they are harmless. - - @public - @this {LexErrorInfo} - */ - destroy: function destructLexErrorInfo() { - // remove cyclic references added to error info: - // info.yy = null; - // info.lexer = null; - // ... - var rec = !!this.recoverable; - for (var key in this) { - if (this.hasOwnProperty(key) && typeof key === 'object') { - this[key] = undefined; - } - } - this.recoverable = rec; + /** @constructor */ + var pei = { + errStr: msg, + recoverable: !!recoverable, + + // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, + + token: null, + line: this.yylineno, + loc: this.yylloc, + yy: this.yy, + lexer: this, + + /** + and make sure the error info doesn't stay due to potential + ref cycle via userland code manipulations. + These would otherwise all be memory leak opportunities! + + Note that only array and object references are nuked as those + constitute the set of elements which can produce a cyclic ref. + The rest of the members is kept intact as they are harmless. + + @public + @this {LexErrorInfo} + */ + destroy: function destructLexErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // ... + var rec = !!this.recoverable; + + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; } - }; - // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! - this.__error_infos.push(pei); - return pei; + } + + this.recoverable = rec; + } + }; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + + return pei; }, /** @@ -3590,16 +3977,19 @@ var lexer = { @this {RegExpLexer} */ parseError: function lexer_parseError(str, hash, ExceptionClass) { - if (!ExceptionClass) { - ExceptionClass = this.JisonLexerError; - } + if (!ExceptionClass) { + ExceptionClass = this.JisonLexerError; + } + + if (this.yy) { if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { - return this.yy.parser.parseError(str, hash, ExceptionClass) || this.ERROR; + return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; } else if (typeof this.yy.parseError === 'function') { - return this.yy.parseError(str, hash, ExceptionClass) || this.ERROR; - } else { - throw new ExceptionClass(str, hash); + return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; } + } + + throw new ExceptionClass(str, hash); }, /** @@ -3609,19 +3999,25 @@ var lexer = { @this {RegExpLexer} */ yyerror: function yyError(str /*, ...args */) { - var lineno_msg = ''; - if (this.options.trackPosition) { - lineno_msg = ' on line ' + (this.yylineno + 1); - } - var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': ' + str, this.options.lexerErrorsAreRecoverable); + var lineno_msg = ''; - // Add any extra args to the hash under the name `extra_error_attributes`: - var args = Array.prototype.slice.call(arguments, 1); - if (args.length) { - hash.extra_error_attributes = args; - } + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } - return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': ' + str, + this.options.lexerErrorsAreRecoverable + ); + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + + if (args.length) { + p.extra_error_attributes = args; + } + + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; }, /** @@ -3637,25 +4033,27 @@ var lexer = { @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { - var rv; + var rv; - // prevent lingering circular references from causing memory leaks: - this.setInput('', {}); + // prevent lingering circular references from causing memory leaks: + this.setInput('', {}); - // nuke the error hash info instances created during this run. - // Userland code must COPY any data/references - // in the error hash instance(s) it is more permanently interested in. - if (!do_not_nuke_errorinfos) { - for (var i = this.__error_infos.length - 1; i >= 0; i--) { - var el = this.__error_infos[i]; - if (el && typeof el.destroy === 'function') { - el.destroy(); - } - } - this.__error_infos.length = 0; + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + + if (el && typeof el.destroy === 'function') { + el.destroy(); + } } - return this; + this.__error_infos.length = 0; + } + + return this; }, /** @@ -3665,22 +4063,21 @@ var lexer = { @this {RegExpLexer} */ clear: function lexer_clear() { - this.yytext = ''; - this.yyleng = 0; - this.match = ''; - this.matches = false; - this._more = false; - this._backtrack = false; - - var col = this.yylloc ? this.yylloc.last_column : 0; - this.yylloc = { - first_line: this.yylineno + 1, - first_column: col, - last_line: this.yylineno + 1, - last_column: col, - - range: (this.options.ranges ? [this.offset, this.offset] : undefined) - }; + this.yytext = ''; + this.yyleng = 0; + this.match = ''; + this.matches = false; + this._more = false; + this._backtrack = false; + var col = (this.yylloc ? this.yylloc.last_column : 0); + + this.yylloc = { + first_line: this.yylineno + 1, + first_column: col, + last_line: this.yylineno + 1, + last_column: col, + range: [this.offset, this.offset] + }; }, /** @@ -3690,67 +4087,68 @@ var lexer = { @this {RegExpLexer} */ setInput: function lexer_setInput(input, yy) { - this.yy = yy || this.yy || {}; - - // also check if we've fully initialized the lexer instance, - // including expansion work to be done to go from a loaded - // lexer to a usable lexer: - if (!this.__decompressed) { - // step 1: decompress the regex list: - var rules = this.rules; - for (var i = 0, len = rules.length; i < len; i++) { - var rule_re = rules[i]; - - // compression: is the RE an xref to another RE slot in the rules[] table? - if (typeof rule_re === 'number') { - rules[i] = rules[rule_re]; - } - } - - // step 2: unfold the conditions[] set to make these ready for use: - var conditions = this.conditions; - for (var k in conditions) { - var spec = conditions[k]; + this.yy = yy || this.yy || {}; - var rule_ids = spec.rules; + // also check if we've fully initialized the lexer instance, + // including expansion work to be done to go from a loaded + // lexer to a usable lexer: + if (!this.__decompressed) { + // step 1: decompress the regex list: + var rules = this.rules; - var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! - var rule_new_ids = new Array(len + 1); + for (var i = 0, len = rules.length; i < len; i++) { + var rule_re = rules[i]; - for (var i = 0; i < len; i++) { - var idx = rule_ids[i]; - var rule_re = rules[idx]; - rule_regexes[i + 1] = rule_re; - rule_new_ids[i + 1] = idx; - } + // compression: is the RE an xref to another RE slot in the rules[] table? + if (typeof rule_re === 'number') { + rules[i] = rules[rule_re]; + } + } - spec.rules = rule_new_ids; - spec.__rule_regexes = rule_regexes; - spec.__rule_count = len; + // step 2: unfold the conditions[] set to make these ready for use: + var conditions = this.conditions; + + for (var k in conditions) { + var spec = conditions[k]; + var rule_ids = spec.rules; + var len = rule_ids.length; + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_new_ids = new Array(len + 1); + + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; } - this.__decompressed = true; + spec.rules = rule_new_ids; + spec.__rule_regexes = rule_regexes; + spec.__rule_count = len; } - this._input = input || ''; - this.clear(); - this._signaled_error_token = false; - this.done = false; - this.yylineno = 0; - this.matched = ''; - this.conditionStack = ['INITIAL']; - this.__currentRuleSet__ = null; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0, + this.__decompressed = true; + } - range: (this.options.ranges ? [0, 0] : undefined) - }; - this.offset = 0; - return this; + this._input = input || ''; + this.clear(); + this._signaled_error_token = false; + this.done = false; + this.yylineno = 0; + this.matched = ''; + this.conditionStack = ['INITIAL']; + this.__currentRuleSet__ = null; + + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0, + range: [0, 0] + }; + + this.offset = 0; + return this; }, /** @@ -3775,26 +4173,28 @@ var lexer = { @this {RegExpLexer} */ pushInput: function lexer_pushInput(input, label, options) { - options = options || {}; - - this._input = input || ''; - this.clear(); - // this._signaled_error_token = false; - this.done = false; - this.yylineno = 0; - this.matched = ''; - // this.conditionStack = ['INITIAL']; - // this.__currentRuleSet__ = null; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0, - - range: (this.options.ranges ? [0, 0] : undefined) - }; - this.offset = 0; - return this; + options = options || {}; + this._input = input || ''; + this.clear(); + + // this._signaled_error_token = false; + this.done = false; + + this.yylineno = 0; + this.matched = ''; + + // this.conditionStack = ['INITIAL']; + // this.__currentRuleSet__ = null; + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0, + range: [0, 0] + }; + + this.offset = 0; + return this; }, /** @@ -3804,53 +4204,55 @@ var lexer = { @this {RegExpLexer} */ input: function lexer_input() { - if (!this._input) { - //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) - return null; - } - var ch = this._input[0]; - this.yytext += ch; - this.yyleng++; - this.offset++; - this.match += ch; - this.matched += ch; - // Count the linenumber up when we hit the LF (or a stand-alone CR). - // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo - // and we advance immediately past the LF as well, returning both together as if - // it was all a single 'character' only. - var slice_len = 1; - var lines = false; - if (ch === '\n') { - lines = true; - } else if (ch === '\r') { - lines = true; - var ch2 = this._input[1]; - if (ch2 === '\n') { - slice_len++; - ch += ch2; - this.yytext += ch2; - this.yyleng++; - this.offset++; - this.match += ch2; - this.matched += ch2; - if (this.options.ranges) { - this.yylloc.range[1]++; - } - } - } - if (lines) { - this.yylineno++; - this.yylloc.last_line++; - this.yylloc.last_column = 0; - } else { - this.yylloc.last_column++; - } - if (this.options.ranges) { - this.yylloc.range[1]++; + if (!this._input) { + //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) + return null; + } + + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + + // Count the linenumber up when we hit the LF (or a stand-alone CR). + // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo + // and we advance immediately past the LF as well, returning both together as if + // it was all a single 'character' only. + var slice_len = 1; + + var lines = false; + + if (ch === '\n') { + lines = true; + } else if (ch === '\r') { + lines = true; + var ch2 = this._input[1]; + + if (ch2 === '\n') { + slice_len++; + ch += ch2; + this.yytext += ch2; + this.yyleng++; + this.offset++; + this.match += ch2; + this.matched += ch2; + this.yylloc.range[1]++; } + } + + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + this.yylloc.last_column = 0; + } else { + this.yylloc.last_column++; + } - this._input = this._input.slice(slice_len); - return ch; + this.yylloc.range[1]++; + this._input = this._input.slice(slice_len); + return ch; }, /** @@ -3860,36 +4262,34 @@ var lexer = { @this {RegExpLexer} */ unput: function lexer_unput(ch) { - var len = ch.length; - var lines = ch.split(/(?:\r\n?|\n)/g); - - this._input = ch + this._input; - this.yytext = this.yytext.substr(0, this.yytext.length - len); - this.yyleng = this.yytext.length; - this.offset -= len; - this.match = this.match.substr(0, this.match.length - len); - this.matched = this.matched.substr(0, this.matched.length - len); - - if (lines.length > 1) { - this.yylineno -= lines.length - 1; - - this.yylloc.last_line = this.yylineno + 1; - var pre = this.match; - var pre_lines = pre.split(/(?:\r\n?|\n)/g); - if (pre_lines.length === 1) { - pre = this.matched; - pre_lines = pre.split(/(?:\r\n?|\n)/g); - } - this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; - } else { - this.yylloc.last_column -= len; + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.yyleng = this.yytext.length; + this.offset -= len; + this.match = this.match.substr(0, this.match.length - len); + this.matched = this.matched.substr(0, this.matched.length - len); + + if (lines.length > 1) { + this.yylineno -= lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); + + if (pre_lines.length === 1) { + pre = this.matched; + pre_lines = pre.split(/(?:\r\n?|\n)/g); } - if (this.options.ranges) { - this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; - } - this.done = false; - return this; + this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; + } else { + this.yylloc.last_column -= len; + } + + this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; + this.done = false; + return this; }, /** @@ -3899,8 +4299,8 @@ var lexer = { @this {RegExpLexer} */ more: function lexer_more() { - this._more = true; - return this; + this._more = true; + return this; }, /** @@ -3910,24 +4310,33 @@ var lexer = { @this {RegExpLexer} */ reject: function lexer_reject() { - if (this.options.backtrack_lexer) { - this._backtrack = true; - } else { - // when the `parseError()` call returns, we MUST ensure that the error is registered. - // We accomplish this by signaling an 'error' token to be produced for the current - // `.lex()` run. - var lineno_msg = ''; - if (this.options.trackPosition) { - lineno_msg = ' on line ' + (this.yylineno + 1); - } - var pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, false); - this._signaled_error_token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + // when the `parseError()` call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // `.lex()` run. + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); } - return this; + + var pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, + false + ); + + this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + + return this; }, /** @@ -3937,7 +4346,7 @@ var lexer = { @this {RegExpLexer} */ less: function lexer_less(n) { - return this.unput(this.match.slice(n)); + return this.unput(this.match.slice(n)); }, /** @@ -3953,30 +4362,37 @@ var lexer = { @this {RegExpLexer} */ pastInput: function lexer_pastInput(maxSize, maxLines) { - var past = this.matched.substring(0, this.matched.length - this.match.length); - if (maxSize < 0) - maxSize = past.length; - else if (!maxSize) - maxSize = 20; - if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! - else if (!maxLines) - maxLines = 1; - // `substr` anticipation: treat \r\n as a single character and take a little - // more than necessary so that we can still properly check against maxSize - // after we've transformed and limited the newLines in here: - past = past.substr(-maxSize * 2 - 2); - // now that we have a significantly reduced string to process, transform the newlines - // and chop them, then limit them: - var a = past.replace(/\r\n|\r/g, '\n').split('\n'); - a = a.slice(-maxLines); - past = a.join('\n'); - // When, after limiting to maxLines, we still have too much to return, - // do add an ellipsis prefix... - if (past.length > maxSize) { - past = '...' + past.substr(-maxSize); - } - return past; + var past = this.matched.substring(0, this.matched.length - this.match.length); + + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = past.length; // can't ever have more input lines than this!; + else if (!maxLines) + maxLines = 1; + + // `substr` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + past = past.substr(-maxSize * 2 - 2); + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = past.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(-maxLines); + past = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis prefix... + if (past.length > maxSize) { + past = '...' + past.substr(-maxSize); + } + + return past; }, /** @@ -3992,32 +4408,39 @@ var lexer = { @this {RegExpLexer} */ upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { - var next = this.match; - if (maxSize < 0) - maxSize = next.length + this._input.length; - else if (!maxSize) - maxSize = 20; - if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! - else if (!maxLines) - maxLines = 1; - // `substring` anticipation: treat \r\n as a single character and take a little - // more than necessary so that we can still properly check against maxSize - // after we've transformed and limited the newLines in here: - if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 - } - // now that we have a significantly reduced string to process, transform the newlines - // and chop them, then limit them: - var a = next.replace(/\r\n|\r/g, '\n').split('\n'); - a = a.slice(0, maxLines); - next = a.join('\n'); - // When, after limiting to maxLines, we still have too much to return, - // do add an ellipsis postfix... - if (next.length > maxSize) { - next = next.substring(0, maxSize) + '...'; - } - return next; + var next = this.match; + + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = maxSize; // can't ever have more input lines than this!; + else if (!maxLines) + maxLines = 1; + + // `substring` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + if (next.length < maxSize * 2 + 2) { + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + } + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = next.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(0, maxLines); + next = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis postfix... + if (next.length > maxSize) { + next = next.substring(0, maxSize) + '...'; + } + + return next; }, /** @@ -4027,9 +4450,9 @@ var lexer = { @this {RegExpLexer} */ showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { - var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); - var c = new Array(pre.length + 1).join('-'); - return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; + var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; }, /** @@ -4043,34 +4466,38 @@ var lexer = { @this {RegExpLexer} */ describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { - var l1 = yylloc.first_line; - var l2 = yylloc.last_line; - var o1 = yylloc.first_column; - var o2 = yylloc.last_column; - var dl = l2 - l1; - var d_o = o2 - o1; - var rv; - if (dl === 0) { - rv = 'line ' + l1 + ', '; - if (d_o === 1) { - rv += 'column ' + o1; - } else { - rv += 'columns ' + o1 + ' .. ' + o2; - } + var l1 = yylloc.first_line; + var l2 = yylloc.last_line; + var c1 = yylloc.first_column; + var c2 = yylloc.last_column; + var dl = l2 - l1; + var dc = c2 - c1; + var rv; + + if (dl === 0) { + rv = 'line ' + l1 + ', '; + + if (dc <= 1) { + rv += 'column ' + c1; } else { - rv = 'lines ' + l1 + '(column ' + o1 + ') .. ' + l2 + '(column ' + o2 + ')'; + rv += 'columns ' + c1 + ' .. ' + c2; } - if (yylloc.range && display_range_too) { - var r1 = yylloc.range[0]; - var r2 = yylloc.range[1] - 1; - if (r2 === r1) { - rv += ' {String Offset: ' + r1 + '}'; - } else { - rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; - } + } else { + rv = 'lines ' + l1 + '(column ' + c1 + ') .. ' + l2 + '(column ' + c2 + ')'; + } + + if (yylloc.range && display_range_too) { + var r1 = yylloc.range[0]; + var r2 = yylloc.range[1] - 1; + + if (r2 <= r1) { + rv += ' {String Offset: ' + r1 + '}'; + } else { + rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; } - return rv; - // return JSON.stringify(yylloc); + } + + return rv; }, /** @@ -4092,94 +4519,107 @@ var lexer = { @this {RegExpLexer} */ test_match: function lexer_test_match(match, indexed_rule) { - var token, - lines, - backup, - match_str, - match_str_len; - - if (this.options.backtrack_lexer) { - // save context - backup = { - yylineno: this.yylineno, - yylloc: { - first_line: this.yylloc.first_line, - last_line: this.yylloc.last_line, - first_column: this.yylloc.first_column, - last_column: this.yylloc.last_column, - - range: (this.options.ranges ? this.yylloc.range.slice(0) : undefined) - }, - yytext: this.yytext, - match: this.match, - matches: this.matches, - matched: this.matched, - yyleng: this.yyleng, - offset: this.offset, - _more: this._more, - _input: this._input, - //_signaled_error_token: this._signaled_error_token, - yy: this.yy, - conditionStack: this.conditionStack.slice(0), - done: this.done - }; - } + var token, lines, backup, match_str, match_str_len; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.yylloc.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column, + range: this.yylloc.range.slice(0) + }, + + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + + //_signaled_error_token: this._signaled_error_token, + yy: this.yy, + + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + } - match_str = match[0]; - match_str_len = match_str.length; - // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { - lines = match_str.split(/(?:\r\n?|\n)/g); - if (lines.length > 1) { - this.yylineno += lines.length - 1; + match_str = match[0]; + match_str_len = match_str.length; - this.yylloc.last_line = this.yylineno + 1, - this.yylloc.last_column = lines[lines.length - 1].length; - } else { - this.yylloc.last_column += match_str_len; - } - // } - this.yytext += match_str; - this.match += match_str; - this.matches = match; - this.yyleng = this.yytext.length; - if (this.options.ranges) { - this.yylloc.range[1] += match_str_len; - } - // previous lex rules MAY have invoked the `more()` API rather than producing a token: - // those rules will already have moved this `offset` forward matching their match lengths, - // hence we must only add our own match length now: - this.offset += match_str_len; - this._more = false; - this._backtrack = false; - this._input = this._input.slice(match_str_len); - this.matched += match_str; - - // calling this method: - // - // function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) {...} - token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */); - // otherwise, when the action codes are all simple return token statements: - //token = this.simpleCaseActionClusters[indexed_rule]; + // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { + lines = match_str.split(/(?:\r\n?|\n)/g); - if (this.done && this._input) { - this.done = false; - } - if (token) { - return token; - } else if (this._backtrack) { - // recover context - for (var k in backup) { - this[k] = backup[k]; - } - this.__currentRuleSet__ = null; - return false; // rule action called reject() implying the next rule should be tested instead. - } else if (this._signaled_error_token) { - // produce one 'error' token as `.parseError()` in `reject()` did not guarantee a failure signal by throwing an exception! - token = this._signaled_error_token; - this._signaled_error_token = false; - return token; + if (lines.length > 1) { + this.yylineno += lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + this.yylloc.last_column = lines[lines.length - 1].length; + } else { + this.yylloc.last_column += match_str_len; + } + + // } + this.yytext += match_str; + + this.match += match_str; + this.matches = match; + this.yyleng = this.yytext.length; + this.yylloc.range[1] += match_str_len; + + // previous lex rules MAY have invoked the `more()` API rather than producing a token: + // those rules will already have moved this `offset` forward matching their match lengths, + // hence we must only add our own match length now: + this.offset += match_str_len; + + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match_str_len); + this.matched += match_str; + + // calling this method: + // + // function lexer__performAction(yy, yy_, yyrulenumber, YY_START) {...} + token = this.performAction.call( + this, + this.yy, + this, + indexed_rule, + this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ + ); + + // otherwise, when the action codes are all simple return token statements: + //token = this.simpleCaseActionClusters[indexed_rule]; + + if (this.done && this._input) { + this.done = false; + } + + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; } - return false; + + this.__currentRuleSet__ = null; + return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as `.parseError()` in `reject()` did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + + this._signaled_error_token = false; + return token; + } + + return false; }, /** @@ -4189,105 +4629,134 @@ var lexer = { @this {RegExpLexer} */ next: function lexer_next() { - if (this.done) { - this.clear(); - return this.EOF; - } - if (!this._input) { - this.done = true; - } + if (this.done) { + this.clear(); + return this.EOF; + } - var token, - match, - tempMatch, - index; - if (!this._more) { - this.clear(); + if (!this._input) { + this.done = true; + } + + var token, match, tempMatch, index; + + if (!this._more) { + this.clear(); + } + + var spec = this.__currentRuleSet__; + + if (!spec) { + // Update the ruleset cache as we apparently encountered a state change or just started lexing. + // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will + // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps + // speed up those activities a tiny bit. + spec = this.__currentRuleSet__ = this._currentRules(); + + // Check whether a *sane* condition has been pushed before: this makes the lexer robust against + // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 + if (!spec || !spec.rules) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + + var p = this.constructLexErrorInfo( + 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, + false + ); + + // produce one 'error' token until this situation has been resolved, most probably by parse termination! + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; } - var spec = this.__currentRuleSet__; - if (!spec) { - // Update the ruleset cache as we apparently encountered a state change or just started lexing. - // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will - // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps - // speed up those activities a tiny bit. - spec = this.__currentRuleSet__ = this._currentRules(); - // Check whether a *sane* condition has been pushed before: this makes the lexer robust against - // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 - if (!spec || !spec.rules) { - var lineno_msg = ''; - if (this.options.trackPosition) { - lineno_msg = ' on line ' + (this.yylineno + 1); - } - var pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - var p = this.constructLexErrorInfo('Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, false); - // produce one 'error' token until this situation has been resolved, most probably by parse termination! - return (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); + } + + var rule_ids = spec.rules; + + //var dispatch = spec.__dispatch_lut; + var regexes = spec.__rule_regexes; + + var len = spec.__rule_count; + + // Note: the arrays are 1-based, while `len` itself is a valid index, + // hence the non-standard less-or-equal check in the next loop condition! + for (var i = 1; i <= len; i++) { + tempMatch = this._input.match(regexes[i]); + + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rule_ids[i]); + + if (token !== false) { + return token; + } else if (this._backtrack) { + match = undefined; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; } + } else if (!this.options.flex) { + break; + } } + } - var rule_ids = spec.rules; - //var dispatch = spec.__dispatch_lut; - var regexes = spec.__rule_regexes; - var len = spec.__rule_count; - - // Note: the arrays are 1-based, while `len` itself is a valid index, - // hence the non-standard less-or-equal check in the next loop condition! - for (var i = 1; i <= len; i++) { - tempMatch = this._input.match(regexes[i]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { - match = tempMatch; - index = i; - if (this.options.backtrack_lexer) { - token = this.test_match(tempMatch, rule_ids[i]); - if (token !== false) { - return token; - } else if (this._backtrack) { - match = undefined; - continue; // rule action called reject() implying a rule MISmatch. - } else { - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; - } - } else if (!this.options.flex) { - break; - } - } + if (match) { + token = this.test_match(match, rule_ids[index]); + + if (token !== false) { + return token; } - if (match) { - token = this.test_match(match, rule_ids[index]); - if (token !== false) { - return token; - } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) - return false; + + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + + if (!this._input) { + this.done = true; + this.clear(); + return this.EOF; + } else { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); } - if (!this._input) { - this.done = true; - this.clear(); - return this.EOF; - } else { - var lineno_msg = ''; - if (this.options.trackPosition) { - lineno_msg = ' on line ' + (this.yylineno + 1); - } - var pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, this.options.lexerErrorsAreRecoverable); - token = (this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR); - if (token === this.ERROR) { - // we can try to recover from a lexer error that `parseError()` did not 'recover' for us - // by moving forward at least one character at a time: - if (!this.match.length) { - this.input(); - } - } - return token; + + var pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, + this.options.lexerErrorsAreRecoverable + ); + + token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + + if (token === this.ERROR) { + // we can try to recover from a lexer error that `parseError()` did not 'recover' for us + // by moving forward at least one character at a time: + if (!this.match.length) { + this.input(); + } + } + + return token; + } }, /** @@ -4297,19 +4766,23 @@ var lexer = { @this {RegExpLexer} */ lex: function lexer_lex() { - var r; - // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: - if (typeof this.options.pre_lex === 'function') { - r = this.options.pre_lex.call(this); - } - while (!r) { - r = this.next(); - } - if (typeof this.options.post_lex === 'function') { - // (also account for a userdef function which does not return any value: keep the token as is) - r = this.options.post_lex.call(this, r) || r; - } - return r; + var r; + + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + + while (!r) { + r = this.next(); + } + + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + + return r; }, /** @@ -4321,7 +4794,7 @@ var lexer = { @this {RegExpLexer} */ begin: function lexer_begin(condition) { - return this.pushState(condition); + return this.pushState(condition); }, /** @@ -4331,9 +4804,9 @@ var lexer = { @this {RegExpLexer} */ pushState: function lexer_pushState(condition) { - this.conditionStack.push(condition); - this.__currentRuleSet__ = null; - return this; + this.conditionStack.push(condition); + this.__currentRuleSet__ = null; + return this; }, /** @@ -4343,13 +4816,14 @@ var lexer = { @this {RegExpLexer} */ popState: function lexer_popState() { - var n = this.conditionStack.length - 1; - if (n > 0) { - this.__currentRuleSet__ = null; - return this.conditionStack.pop(); - } else { - return this.conditionStack[0]; - } + var n = this.conditionStack.length - 1; + + if (n > 0) { + this.__currentRuleSet__ = null; + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } }, /** @@ -4359,12 +4833,13 @@ var lexer = { @this {RegExpLexer} */ topState: function lexer_topState(n) { - n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { - return this.conditionStack[n]; - } else { - return 'INITIAL'; - } + n = this.conditionStack.length - 1 - Math.abs(n || 0); + + if (n >= 0) { + return this.conditionStack[n]; + } else { + return 'INITIAL'; + } }, /** @@ -4374,11 +4849,11 @@ var lexer = { @this {RegExpLexer} */ _currentRules: function lexer__currentRules() { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; - } else { - return this.conditions['INITIAL']; - } + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; + } else { + return this.conditions['INITIAL']; + } }, /** @@ -4388,919 +4863,1019 @@ var lexer = { @this {RegExpLexer} */ stateStackSize: function lexer_stateStackSize() { - return this.conditionStack.length; + return this.conditionStack.length; }, + options: { - xregexp: true, - ranges: true, - trackPosition: true, - easy_keyword_rules: true -}, + xregexp: true, + ranges: true, + trackPosition: true, + easy_keyword_rules: true + }, + JisonLexerError: JisonLexerError, - performAction: function lexer__performAction(yy, yy_, $avoiding_name_collisions, YY_START) { - -var YYSTATE = YY_START; -switch($avoiding_name_collisions) { -case 7 : -/*! Conditions:: action */ -/*! Rule:: \{ */ - yy.depth++; return 3; -break; -case 8 : -/*! Conditions:: action */ -/*! Rule:: \} */ - - if (yy.depth == 0) { - this.pushState('trail'); - } else { - yy.depth--; - } - return 4; - -break; -case 10 : -/*! Conditions:: conditions */ -/*! Rule:: > */ - this.popState(); return 6; -break; -case 13 : -/*! Conditions:: rules */ -/*! Rule:: {BR}+ */ - /* empty */ -break; -case 14 : -/*! Conditions:: rules */ -/*! Rule:: {WS}+{BR}+ */ - /* empty */ -break; -case 15 : -/*! Conditions:: rules */ -/*! Rule:: {WS}+ */ - this.pushState('indented'); -break; -case 16 : -/*! Conditions:: rules */ -/*! Rule:: %% */ - this.pushState('code'); return 19; -break; -case 17 : -/*! Conditions:: rules */ -/*! Rule:: {ANY_LITERAL_CHAR}+ */ - - // accept any non-regex, non-lex, non-string-delim, - // non-escape-starter, non-space character as-is - return 36; - -break; -case 20 : -/*! Conditions:: options */ -/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = this.matches[1]; return 39; // value is always a string type -break; -case 21 : -/*! Conditions:: options */ -/*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = this.matches[1]; return 39; // value is always a string type -break; -case 22 : -/*! Conditions:: INITIAL start_condition trail rules macro path options */ -/*! Rule:: \/\/[^\r\n]* */ - /* skip single-line comment */ -break; -case 23 : -/*! Conditions:: INITIAL start_condition trail rules macro path options */ -/*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - /* skip multi-line comment */ -break; -case 25 : -/*! Conditions:: options */ -/*! Rule:: {BR}{WS}+(?=\S) */ - /* skip leading whitespace on the next line of input, when followed by more options */ -break; -case 26 : -/*! Conditions:: options */ -/*! Rule:: {BR} */ - this.popState(); return 38; -break; -case 27 : -/*! Conditions:: options */ -/*! Rule:: {WS}+ */ - /* skip whitespace */ -break; -case 29 : -/*! Conditions:: start_condition */ -/*! Rule:: {BR}+ */ - this.popState(); -break; -case 30 : -/*! Conditions:: start_condition */ -/*! Rule:: {WS}+ */ - /* empty */ -break; -case 31 : -/*! Conditions:: trail */ -/*! Rule:: {WS}*{BR}+ */ - this.pushState('rules'); -break; -case 32 : -/*! Conditions:: indented */ -/*! Rule:: \{ */ - yy.depth = 0; this.pushState('action'); return 3; -break; -case 33 : -/*! Conditions:: indented */ -/*! Rule:: %\{(?:.|{BR})*?%\} */ - this.pushState('trail'); yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; -break; -case 34 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %\{(?:.|{BR})*?%\} */ - yy_.yytext = yy_.yytext.substr(2, yy_.yyleng - 4); return 23; -break; -case 35 : -/*! Conditions:: indented */ -/*! Rule:: %include\b */ - - // This is an include instruction in place of an action: - // thanks to the `.+` rule immediately below we need to semi-duplicate - // the `%include` token recognition here vs. the almost-identical rule for the same - // further below. - // There's no real harm as we need to do something special in this case anyway: - // push 2 (two!) conditions. - // - // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar - // parse correctly took several hours as the debug facilities were - and are - too meager to - // quickly diagnose the problem while we hadn't. So the code got littered with debug prints - // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) - - // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... - this.pushState('trail'); - // then push the immediate need: the 'path' condition. - this.pushState('path'); - return 41; - -break; -case 36 : -/*! Conditions:: indented */ -/*! Rule:: .* */ - this.popState(); return 23; -break; -case 37 : -/*! Conditions:: INITIAL */ -/*! Rule:: {ID} */ - this.pushState('macro'); return 20; -break; -case 38 : -/*! Conditions:: macro */ -/*! Rule:: {BR}+ */ - this.popState('macro'); -break; -case 39 : -/*! Conditions:: macro */ -/*! Rule:: {ANY_LITERAL_CHAR}+ */ - - // accept any non-regex, non-lex, non-string-delim, - // non-escape-starter, non-space character as-is - return 36; - -break; -case 40 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: {BR}+ */ - /* empty */ -break; -case 41 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \s+ */ - /* empty */ -break; -case 42 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = yy_.yytext.replace(/\\"/g,'"'); return 35; -break; -case 43 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = yy_.yytext.replace(/\\'/g,"'"); return 35; -break; -case 44 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \[ */ - this.pushState('set'); return 30; -break; -case 57 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: < */ - this.pushState('conditions'); return 5; -break; -case 58 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \/! */ - return 28; // treated as `(?!atom)` -break; -case 59 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \/ */ - return 14; // treated as `(?=atom)` -break; -case 61 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); return 33; -break; -case 64 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %options\b */ - this.pushState('options'); return 37; -break; -case 65 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %s\b */ - this.pushState('start_condition'); return 21; -break; -case 66 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %x\b */ - this.pushState('start_condition'); return 22; -break; -case 67 : -/*! Conditions:: INITIAL trail code */ -/*! Rule:: %include\b */ - this.pushState('path'); return 41; -break; -case 68 : -/*! Conditions:: INITIAL rules trail code */ -/*! Rule:: %{NAME}([^\r\n]*) */ - - /* ignore unrecognized decl */ - var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); - var l2 = 19; - var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); - this.warn('LEX: ignoring unsupported lexer option', dquote(yy_.yytext), 'while lexing in', this.topState(), 'state:\n' + indent(this.showPosition(l1, l2), 4) - // , '\n', { - // remaining_input: this._input, - // matched: this.matched, - // matches: this.matches - // } - ); - // this.pushState('options'); - yy_.yytext = [ - this.matches[1], // {NAME} - this.matches[2].trim() // optional value/parameters - ]; - return 24; - -break; -case 69 : -/*! Conditions:: indented trail rules macro INITIAL */ -/*! Rule:: %% */ - this.pushState('rules'); return 19; -break; -case 77 : -/*! Conditions:: set */ -/*! Rule:: \] */ - this.popState('set'); return 31; -break; -case 79 : -/*! Conditions:: code */ -/*! Rule:: [^\r\n]+ */ - return 43; // the bit of CODE just before EOF... -break; -case 80 : -/*! Conditions:: path */ -/*! Rule:: {BR} */ - this.popState(); this.unput(yy_.yytext); -break; -case 81 : -/*! Conditions:: path */ -/*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = this.matches[1]; this.popState(); return 42; -break; -case 82 : -/*! Conditions:: path */ -/*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = this.matches[1]; this.popState(); return 42; -break; -case 83 : -/*! Conditions:: path */ -/*! Rule:: {WS}+ */ - // skip whitespace in the line -break; -case 84 : -/*! Conditions:: path */ -/*! Rule:: [^\s\r\n]+ */ - this.popState(); return 42; -break; -case 85 : -/*! Conditions:: macro rules */ -/*! Rule:: . */ - - /* b0rk on bad characters */ - var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); - var l2 = 39; - var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); - var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); - var pos_str = this.showPosition(l1, l2); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); - } - yy_.yyerror('unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing ' + rules + '\n (i.e. jison lex regexes).\n\n NOTE: When you want the input ' + dquote(yy_.yytext) + ' to be interpreted as a literal part\n of a lex rule regex, you MUST enclose it in double or single quotes,\n e.g. as shown in this error message just before. If not, then know\n that this is not accepted as a regex operator here in\n jison-lex ' + rules + '.' + pos_str); - -break; -case 86 : -/*! Conditions:: * */ -/*! Rule:: . */ - - /* b0rk on bad characters */ - var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); - var l2 = 39; - var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); - var pos_str = this.showPosition(l1, l2); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); - } - yy_.yyerror('unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing in ' + dquote(this.topState()) + ' state.' + pos_str); - -break; -default: - return this.simpleCaseActionClusters[$avoiding_name_collisions]; -} -}, + + performAction: function lexer__performAction(yy, yy_, yyrulenumber, YY_START) { + var YYSTATE = YY_START; + + switch (yyrulenumber) { + case 7: + /*! Conditions:: action */ + /*! Rule:: \{ */ + yy.depth++; + + return 3; + break; + case 8: + /*! Conditions:: action */ + /*! Rule:: \} */ + + if (yy.depth == 0) { + this.popState(); + this.pushState('trail'); + } else { + yy.depth--; + } + + return 4; + break; + case 10: + /*! Conditions:: conditions */ + /*! Rule:: > */ + this.popState(); + + return 6; + break; + case 13: + /*! Conditions:: rules */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + case 14: + /*! Conditions:: rules */ + /*! Rule:: {WS}+{BR}+ */ + /* empty */ + break; + case 15: + /*! Conditions:: rules */ + /*! Rule:: {WS}+ */ + this.pushState('indented'); + + break; + case 16: + /*! Conditions:: rules */ + /*! Rule:: %% */ + this.popState(); + + this.pushState('code'); + return 19; + break; + case 17: + /*! Conditions:: rules */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 36; + + break; + case 20: + /*! Conditions:: options */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = this.matches[1]; + + return 39; // value is always a string type + break; + case 21: + /*! Conditions:: options */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = this.matches[1]; + + return 39; // value is always a string type + break; + case 22: + /*! Conditions:: INITIAL start_condition trail rules macro path options */ + /*! Rule:: \/\/[^\r\n]* */ + /* skip single-line comment */ + break; + case 23: + /*! Conditions:: INITIAL start_condition trail rules macro path options */ + /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /* skip multi-line comment */ + break; + case 25: + /*! Conditions:: options */ + /*! Rule:: {BR}{WS}+(?=\S) */ + /* skip leading whitespace on the next line of input, when followed by more options */ + break; + case 26: + /*! Conditions:: options */ + /*! Rule:: {BR} */ + this.popState(); + + return 38; + break; + case 27: + /*! Conditions:: options */ + /*! Rule:: {WS}+ */ + /* skip whitespace */ + break; + case 29: + /*! Conditions:: start_condition */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + case 30: + /*! Conditions:: start_condition */ + /*! Rule:: {WS}+ */ + /* empty */ + break; + case 31: + /*! Conditions:: trail */ + /*! Rule:: {WS}*{BR}+ */ + this.popState(); + + this.unput(yy_.yytext); + + /* this.unput(yy_.yytext); can be used here instead of this.reject(); which would only work when we set the backtrack_lexer option */ + break; + case 32: + /*! Conditions:: indented */ + /*! Rule:: {WS}*{BR}+ */ + this.popState(); + + break; + case 33: + /*! Conditions:: indented */ + /*! Rule:: \{ */ + yy.depth = 0; + + this.pushState('action'); + return 3; + break; + case 34: + /*! Conditions:: indented */ + /*! Rule:: %\{((?:.|{BR})*?)%\} */ + this.pushState('trail'); + + yy_.yytext = this.matches[1]; + return 23; + break; + case 35: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: %\{((?:.|{BR})*?)%\} */ + yy_.yytext = this.matches[1]; + + return 23; + break; + case 36: + /*! Conditions:: indented */ + /*! Rule:: %include\b */ + + // This is an include instruction in place of an action: + // thanks to the `.+` rule immediately below we need to semi-duplicate + // the `%include` token recognition here vs. the almost-identical rule for the same + // further below. + // There's no real harm as we need to do something special in this case anyway: + // push 2 (two!) conditions. + // + // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar + // parse correctly took several hours as the debug facilities were - and are - too meager to + // quickly diagnose the problem while we hadn't. So the code got littered with debug prints + // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) + + // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... + this.pushState('trail'); + + // then push the immediate need: the 'path' condition. + this.pushState('path'); + + return 41; + break; + case 37: + /*! Conditions:: indented */ + /*! Rule:: .* */ + this.popState(); + + return 23; + break; + case 38: + /*! Conditions:: INITIAL */ + /*! Rule:: {ID} */ + this.pushState('macro'); + + return 20; + break; + case 39: + /*! Conditions:: macro */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + case 40: + /*! Conditions:: macro */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 36; + + break; + case 41: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + case 42: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \s+ */ + /* empty */ + break; + case 43: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + + yy_.yytext = this.matches[1]; + + yy_.yytext = yy_.yytext.replace(/\\"/g, '"'); + return 35; + break; + case 44: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + + yy_.yytext = this.matches[1]; + + yy_.yytext = yy_.yytext.replace(/\\'/g, '\''); + return 35; + break; + case 45: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \[ */ + this.pushState('set'); + + return 30; + break; + case 58: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: < */ + this.pushState('conditions'); + + return 5; + break; + case 59: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \/! */ + return 28; // treated as `(?!atom)` + + break; + case 60: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \/ */ + return 14; // treated as `(?=atom)` + + break; + case 62: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); + + return 33; + break; + case 65: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: %options\b */ + this.pushState('options'); + + return 37; + break; + case 66: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: %s\b */ + this.pushState('start_condition'); + + return 21; + break; + case 67: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: %x\b */ + this.pushState('start_condition'); + + return 22; + break; + case 68: + /*! Conditions:: INITIAL trail code */ + /*! Rule:: %include\b */ + this.pushState('path'); + + return 41; + break; + case 69: + /*! Conditions:: INITIAL rules trail code */ + /*! Rule:: %{NAME}([^\r\n]*) */ + + /* ignore unrecognized decl */ + var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); + + var l2 = 19; + var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); + + this.warn( + 'LEX: ignoring unsupported lexer option', + dquote(yy_.yytext), + 'while lexing in', + this.topState(), + // , '\n', { + // remaining_input: this._input, + // matched: this.matched, + // matches: this.matches + // } + 'state:\n' + indent(this.showPosition(l1, l2), 4) + ); + + yy_.yytext = [// {NAME} + this.matches[1], // optional value/parameters + this.matches[2].trim()]; + + return 24; + break; + case 70: + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: %% */ + this.pushState('rules'); + + return 19; + break; + case 78: + /*! Conditions:: set */ + /*! Rule:: \] */ + this.popState(); + + return 31; + break; + case 80: + /*! Conditions:: code */ + /*! Rule:: [^\r\n]+ */ + return 43; // the bit of CODE just before EOF... + + break; + case 81: + /*! Conditions:: path */ + /*! Rule:: {BR} */ + this.popState(); + + this.unput(yy_.yytext); + break; + case 82: + /*! Conditions:: path */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = this.matches[1]; + + this.popState(); + return 42; + break; + case 83: + /*! Conditions:: path */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = this.matches[1]; + + this.popState(); + return 42; + break; + case 84: + /*! Conditions:: path */ + /*! Rule:: {WS}+ */ + // skip whitespace in the line + break; + case 85: + /*! Conditions:: path */ + /*! Rule:: [^\s\r\n]+ */ + this.popState(); + + return 42; + break; + case 86: + /*! Conditions:: macro rules */ + /*! Rule:: . */ + + /* b0rk on bad characters */ + var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); + + var l2 = 39; + var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + var pos_str = this.showPosition(l1, l2); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); + } + + yy_.yyerror( + 'unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing ' + rules + '\n (i.e. jison lex regexes).\n\n NOTE: When you want the input ' + dquote(yy_.yytext) + ' to be interpreted as a literal part\n of a lex rule regex, you MUST enclose it in double or single quotes,\n e.g. as shown in this error message just before. If not, then know\n that this is not accepted as a regex operator here in\n jison-lex ' + rules + '.' + pos_str + ); + + break; + case 87: + /*! Conditions:: * */ + /*! Rule:: . */ + + /* b0rk on bad characters */ + var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); + + var l2 = 39; + var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); + var pos_str = this.showPosition(l1, l2); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); + } + + yy_.yyerror( + 'unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing in ' + dquote(this.topState()) + ' state.' + pos_str + ); + + break; + default: + return this.simpleCaseActionClusters[yyrulenumber]; + } + }, + simpleCaseActionClusters: { + /*! Conditions:: action */ + /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + 0: 26, + + /*! Conditions:: action */ + /*! Rule:: \/\/.* */ + 1: 26, + + /*! Conditions:: action */ + /*! Rule:: \/[^ /]*?['"{}][^ ]*?\/ */ + 2: 26, + + /*! Conditions:: action */ + /*! Rule:: "(\\\\|\\"|[^"])*" */ + 3: 26, + + /*! Conditions:: action */ + /*! Rule:: '(\\\\|\\'|[^'])*' */ + 4: 26, + + /*! Conditions:: action */ + /*! Rule:: [/"'][^{}/"']+ */ + 5: 26, + + /*! Conditions:: action */ + /*! Rule:: [^{}/"']+ */ + 6: 26, + + /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ + 9: 20, + + /*! Conditions:: conditions */ + /*! Rule:: , */ + 11: 8, + + /*! Conditions:: conditions */ + /*! Rule:: \* */ + 12: 7, + + /*! Conditions:: options */ + /*! Rule:: {NAME} */ + 18: 20, + + /*! Conditions:: options */ + /*! Rule:: = */ + 19: 18, + + /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ + 24: 40, + + /*! Conditions:: start_condition */ + /*! Rule:: {ID} */ + 28: 25, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \| */ + 46: 9, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \(\?: */ + 47: 27, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \(\?= */ + 48: 27, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \(\?! */ + 49: 27, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \( */ + 50: 10, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \) */ + 51: 11, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \+ */ + 52: 12, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \* */ + 53: 7, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \? */ + 54: 13, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \^ */ + 55: 16, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: , */ + 56: 8, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: <> */ + 57: 17, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + 61: 33, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \$ */ + 63: 17, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \. */ + 64: 15, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \{\d+(,\s?\d+|,)?\} */ + 71: 34, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \{{ID}\} */ + 72: 29, + + /*! Conditions:: set options */ + /*! Rule:: \{{ID}\} */ + 73: 29, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \{ */ + 74: 3, + + /*! Conditions:: indented trail rules macro INITIAL */ + /*! Rule:: \} */ + 75: 4, + + /*! Conditions:: set */ + /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ + 76: 32, + + /*! Conditions:: set */ + /*! Rule:: \{ */ + 77: 32, + + /*! Conditions:: code */ + /*! Rule:: [^\r\n]*(\r|\n)+ */ + 79: 43, + + /*! Conditions:: * */ + /*! Rule:: $ */ + 88: 1 + }, - /*! Conditions:: action */ - /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - 0 : 26, - /*! Conditions:: action */ - /*! Rule:: \/\/.* */ - 1 : 26, - /*! Conditions:: action */ - /*! Rule:: \/[^ /]*?['"{}][^ ]*?\/ */ - 2 : 26, - /*! Conditions:: action */ - /*! Rule:: "(\\\\|\\"|[^"])*" */ - 3 : 26, - /*! Conditions:: action */ - /*! Rule:: '(\\\\|\\'|[^'])*' */ - 4 : 26, - /*! Conditions:: action */ - /*! Rule:: [/"'][^{}/"']+ */ - 5 : 26, - /*! Conditions:: action */ - /*! Rule:: [^{}/"']+ */ - 6 : 26, - /*! Conditions:: conditions */ - /*! Rule:: {NAME} */ - 9 : 20, - /*! Conditions:: conditions */ - /*! Rule:: , */ - 11 : 8, - /*! Conditions:: conditions */ - /*! Rule:: \* */ - 12 : 7, - /*! Conditions:: options */ - /*! Rule:: {NAME} */ - 18 : 20, - /*! Conditions:: options */ - /*! Rule:: = */ - 19 : 18, - /*! Conditions:: options */ - /*! Rule:: [^\s\r\n]+ */ - 24 : 40, - /*! Conditions:: start_condition */ - /*! Rule:: {ID} */ - 28 : 25, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \| */ - 45 : 9, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \(\?: */ - 46 : 27, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \(\?= */ - 47 : 27, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \(\?! */ - 48 : 27, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \( */ - 49 : 10, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \) */ - 50 : 11, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \+ */ - 51 : 12, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \* */ - 52 : 7, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \? */ - 53 : 13, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \^ */ - 54 : 16, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: , */ - 55 : 8, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: <> */ - 56 : 17, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 60 : 33, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \$ */ - 62 : 17, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \. */ - 63 : 15, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \{\d+(,\s?\d+|,)?\} */ - 70 : 34, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \{{ID}\} */ - 71 : 29, - /*! Conditions:: set options */ - /*! Rule:: \{{ID}\} */ - 72 : 29, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \{ */ - 73 : 3, - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \} */ - 74 : 4, - /*! Conditions:: set */ - /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 75 : 32, - /*! Conditions:: set */ - /*! Rule:: \{ */ - 76 : 32, - /*! Conditions:: code */ - /*! Rule:: [^\r\n]*(\r|\n)+ */ - 78 : 43, - /*! Conditions:: * */ - /*! Rule:: $ */ - 87 : 1 -}, - rules: [ - /^(?:\/\*(.|\n|\r)*?\*\/)/, -/^(?:\/\/.*)/, -/^(?:\/[^ \/]*?['"{}][^ ]*?\/)/, -/^(?:"(\\\\|\\"|[^"])*")/, -/^(?:'(\\\\|\\'|[^'])*')/, -/^(?:[\/"'][^{}\/"']+)/, -/^(?:[^{}\/"']+)/, -/^(?:\{)/, -/^(?:\})/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", ""), -/^(?:>)/, -/^(?:,)/, -/^(?:\*)/, -/^(?:(\r\n|\n|\r)+)/, -/^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, -/^(?:([^\S\n\r])+)/, -/^(?:%%)/, -/^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", ""), -/^(?:=)/, -/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, -/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, -/^(?:\/\/[^\r\n]*)/, -/^(?:\/\*(.|\n|\r)*?\*\/)/, -/^(?:\S+)/, -/^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, -/^(?:(\r\n|\n|\r))/, -/^(?:([^\S\n\r])+)/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), -/^(?:(\r\n|\n|\r)+)/, -/^(?:([^\S\n\r])+)/, -/^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, -/^(?:\{)/, -/^(?:%\{(?:.|(\r\n|\n|\r))*?%\})/, -/^(?:%\{(?:.|(\r\n|\n|\r))*?%\})/, -/^(?:%include\b)/, -/^(?:.*)/, -new XRegExp("^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", ""), -/^(?:(\r\n|\n|\r)+)/, -/^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, -/^(?:(\r\n|\n|\r)+)/, -/^(?:\s+)/, -/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, -/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, -/^(?:\[)/, -/^(?:\|)/, -/^(?:\(\?:)/, -/^(?:\(\?=)/, -/^(?:\(\?!)/, -/^(?:\()/, -/^(?:\))/, -/^(?:\+)/, -/^(?:\*)/, -/^(?:\?)/, -/^(?:\^)/, -/^(?:,)/, -/^(?:<>)/, -/^(?:<)/, -/^(?:\/!)/, -/^(?:\/)/, -/^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, -/^(?:\\.)/, -/^(?:\$)/, -/^(?:\.)/, -/^(?:%options\b)/, -/^(?:%s\b)/, -/^(?:%x\b)/, -/^(?:%include\b)/, -new XRegExp("^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))", ""), -/^(?:%%)/, -/^(?:\{\d+(,\s?\d+|,)?\})/, -new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", ""), -new XRegExp("^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", ""), -/^(?:\{)/, -/^(?:\})/, -/^(?:(?:\\\\|\\\]|[^\]{])+)/, -/^(?:\{)/, -/^(?:\])/, -/^(?:[^\r\n]*(\r|\n)+)/, -/^(?:[^\r\n]+)/, -/^(?:(\r\n|\n|\r))/, -/^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, -/^(?:'((?:\\'|\\[^']|[^'\\])*)')/, -/^(?:([^\S\n\r])+)/, -/^(?:\S+)/, -/^(?:.)/, -/^(?:.)/, -/^(?:$)/ - ], - conditions: { - "code": { - rules: [ - 67, - 68, - 78, - 79, - 86, - 87 - ], - inclusive: false - }, - "start_condition": { - rules: [ - 22, - 23, - 28, - 29, - 30, - 86, - 87 - ], - inclusive: false - }, - "options": { - rules: [ - 18, - 19, - 20, - 21, - 22, - 23, - 24, - 25, - 26, - 27, - 72, - 86, - 87 - ], - inclusive: false - }, - "conditions": { - rules: [ - 9, - 10, - 11, - 12, - 86, - 87 - ], - inclusive: false - }, - "action": { - rules: [ - 0, - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 86, - 87 - ], - inclusive: false - }, - "path": { - rules: [ - 22, - 23, - 80, - 81, - 82, - 83, - 84, - 86, - 87 - ], - inclusive: false - }, - "set": { - rules: [ - 72, - 75, - 76, - 77, - 86, - 87 - ], - inclusive: false - }, - "indented": { - rules: [ - 32, - 33, - 34, - 35, - 36, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 69, - 70, - 71, - 73, - 74, - 86, - 87 - ], - inclusive: true - }, - "trail": { - rules: [ - 22, - 23, - 31, - 34, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 73, - 74, - 86, - 87 - ], - inclusive: true - }, - "rules": { - rules: [ - 13, - 14, - 15, - 16, - 17, - 22, - 23, - 34, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 68, - 69, - 70, - 71, - 73, - 74, - 85, - 86, - 87 - ], - inclusive: true - }, - "macro": { - rules: [ - 22, - 23, - 34, - 38, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 69, - 70, - 71, - 73, - 74, - 85, - 86, - 87 - ], - inclusive: true - }, - "INITIAL": { rules: [ - 22, - 23, - 34, - 37, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 68, - 69, - 70, - 71, - 73, - 74, - 86, - 87 + /* 0: */ /^(?:\/\*(.|\n|\r)*?\*\/)/, + /* 1: */ /^(?:\/\/.*)/, + /* 2: */ /^(?:\/[^ \/]*?['"{}][^ ]*?\/)/, + /* 3: */ /^(?:"(\\\\|\\"|[^"])*")/, + /* 4: */ /^(?:'(\\\\|\\'|[^'])*')/, + /* 5: */ /^(?:[\/"'][^{}\/"']+)/, + /* 6: */ /^(?:[^{}\/"']+)/, + /* 7: */ /^(?:\{)/, + /* 8: */ /^(?:\})/, + /* 9: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' + ), + /* 10: */ /^(?:>)/, + /* 11: */ /^(?:,)/, + /* 12: */ /^(?:\*)/, + /* 13: */ /^(?:(\r\n|\n|\r)+)/, + /* 14: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, + /* 15: */ /^(?:([^\S\n\r])+)/, + /* 16: */ /^(?:%%)/, + /* 17: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 18: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' + ), + /* 19: */ /^(?:=)/, + /* 20: */ /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, + /* 21: */ /^(?:'((?:\\'|\\[^']|[^'\\])*)')/, + /* 22: */ /^(?:\/\/[^\r\n]*)/, + /* 23: */ /^(?:\/\*(.|\n|\r)*?\*\/)/, + /* 24: */ /^(?:\S+)/, + /* 25: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, + /* 26: */ /^(?:(\r\n|\n|\r))/, + /* 27: */ /^(?:([^\S\n\r])+)/, + /* 28: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 29: */ /^(?:(\r\n|\n|\r)+)/, + /* 30: */ /^(?:([^\S\n\r])+)/, + /* 31: */ /^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, + /* 32: */ /^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, + /* 33: */ /^(?:\{)/, + /* 34: */ /^(?:%\{((?:.|(\r\n|\n|\r))*?)%\})/, + /* 35: */ /^(?:%\{((?:.|(\r\n|\n|\r))*?)%\})/, + /* 36: */ /^(?:%include\b)/, + /* 37: */ /^(?:.*)/, + /* 38: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 39: */ /^(?:(\r\n|\n|\r)+)/, + /* 40: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 41: */ /^(?:(\r\n|\n|\r)+)/, + /* 42: */ /^(?:\s+)/, + /* 43: */ /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, + /* 44: */ /^(?:'((?:\\'|\\[^']|[^'\\])*)')/, + /* 45: */ /^(?:\[)/, + /* 46: */ /^(?:\|)/, + /* 47: */ /^(?:\(\?:)/, + /* 48: */ /^(?:\(\?=)/, + /* 49: */ /^(?:\(\?!)/, + /* 50: */ /^(?:\()/, + /* 51: */ /^(?:\))/, + /* 52: */ /^(?:\+)/, + /* 53: */ /^(?:\*)/, + /* 54: */ /^(?:\?)/, + /* 55: */ /^(?:\^)/, + /* 56: */ /^(?:,)/, + /* 57: */ /^(?:<>)/, + /* 58: */ /^(?:<)/, + /* 59: */ /^(?:\/!)/, + /* 60: */ /^(?:\/)/, + /* 61: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 62: */ /^(?:\\.)/, + /* 63: */ /^(?:\$)/, + /* 64: */ /^(?:\.)/, + /* 65: */ /^(?:%options\b)/, + /* 66: */ /^(?:%s\b)/, + /* 67: */ /^(?:%x\b)/, + /* 68: */ /^(?:%include\b)/, + /* 69: */ new XRegExp( + '^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))', + '' + ), + /* 70: */ /^(?:%%)/, + /* 71: */ /^(?:\{\d+(,\s?\d+|,)?\})/, + /* 72: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 73: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 74: */ /^(?:\{)/, + /* 75: */ /^(?:\})/, + /* 76: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 77: */ /^(?:\{)/, + /* 78: */ /^(?:\])/, + /* 79: */ /^(?:[^\r\n]*(\r|\n)+)/, + /* 80: */ /^(?:[^\r\n]+)/, + /* 81: */ /^(?:(\r\n|\n|\r))/, + /* 82: */ /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, + /* 83: */ /^(?:'((?:\\'|\\[^']|[^'\\])*)')/, + /* 84: */ /^(?:([^\S\n\r])+)/, + /* 85: */ /^(?:\S+)/, + /* 86: */ /^(?:.)/, + /* 87: */ /^(?:.)/, + /* 88: */ /^(?:$)/ ], - inclusive: true - } -} -}; + conditions: { + 'code': { + rules: [68, 69, 79, 80, 87, 88], + inclusive: false + }, + + 'start_condition': { + rules: [22, 23, 28, 29, 30, 87, 88], + inclusive: false + }, + + 'options': { + rules: [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 73, 87, 88], + inclusive: false + }, + + 'conditions': { + rules: [9, 10, 11, 12, 87, 88], + inclusive: false + }, + + 'action': { + rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 87, 88], + inclusive: false + }, + + 'path': { + rules: [22, 23, 81, 82, 83, 84, 85, 87, 88], + inclusive: false + }, + + 'set': { + rules: [73, 76, 77, 78, 87, 88], + inclusive: false + }, + + 'indented': { + rules: [ + 32, + 33, + 34, + 35, + 36, + 37, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 70, + 71, + 72, + 74, + 75, + 87, + 88 + ], + + inclusive: true + }, + + 'trail': { + rules: [ + 22, + 23, + 31, + 35, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 74, + 75, + 87, + 88 + ], + + inclusive: true + }, + + 'rules': { + rules: [ + 13, + 14, + 15, + 16, + 17, + 22, + 23, + 35, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 69, + 70, + 71, + 72, + 74, + 75, + 86, + 87, + 88 + ], + + inclusive: true + }, + + 'macro': { + rules: [ + 22, + 23, + 35, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 70, + 71, + 72, + 74, + 75, + 86, + 87, + 88 + ], + + inclusive: true + }, + + 'INITIAL': { + rules: [ + 22, + 23, + 35, + 38, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 74, + 75, + 87, + 88 + ], + + inclusive: true + } + } + }; -function indent(s, i) { + function indent(s, i) { var a = s.split('\n'); - var pf = (new Array(i + 1)).join(' '); + var pf = new Array(i + 1).join(' '); return pf + a.join('\n' + pf); -} + } + + // properly quote and escape the given input string + function dquote(s) { + var sq = s.indexOf('\'') >= 0; + var dq = s.indexOf('"') >= 0; -// properly quote and escape the given input string -function dquote(s) { - var sq = (s.indexOf('\'') >= 0); - var dq = (s.indexOf('"') >= 0); if (sq && dq) { - s = s.replace(/"/g, '\\"'); - dq = false; + s = s.replace(/"/g, '\\"'); + dq = false; } + if (dq) { - s = '\'' + s + '\''; - } - else { - s = '"' + s + '"'; + s = '\'' + s + '\''; + } else { + s = '"' + s + '"'; } + return s; -} + } -lexer.warn = function l_warn() { - if (this.yy.parser && typeof this.yy.parser.warn === 'function') { - return this.yy.parser.warn.apply(this, arguments); + lexer.warn = function l_warn() { + if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { + return this.yy.parser.warn.apply(this, arguments); } else { - console.warn.apply(console, arguments); + console.warn.apply(console, arguments); } -}; + }; -lexer.log = function l_log() { - if (this.yy.parser && typeof this.yy.parser.log === 'function') { - return this.yy.parser.log.apply(this, arguments); + lexer.log = function l_log() { + if (this.yy && this.yy.parser && typeof this.yy.parser.log === 'function') { + return this.yy.parser.log.apply(this, arguments); } else { - console.log.apply(console, arguments); + console.log.apply(console, arguments); } -};; + }; -return lexer; -})(); + return lexer; +}(); parser.lexer = lexer; function Parser() { diff --git a/package-lock.json b/package-lock.json index da99f27..7846dbc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "lex-parser", - "version": "0.1.4-186", + "version": "0.6.0-186", "lockfileVersion": 1, "dependencies": { "ansi-regex": { @@ -9,16 +9,10 @@ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, "arr-diff": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", - "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", "dev": true }, "arr-flatten": { @@ -27,10 +21,16 @@ "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, "array-unique": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", - "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", "dev": true }, "assertion-error": { @@ -40,31 +40,57 @@ "dev": true }, "ast-types": { - "version": "0.9.11", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.11.tgz", - "integrity": "sha1-NxF3u1kjL/XOqh0J7lytcFsaWqk=", + "version": "0.9.12", + "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.12.tgz", + "integrity": "sha1-sTYwDWcCZiWuFTJpgsqZGOXbc8k=", "dev": true }, "ast-util": { - "version": "github:GerHobbelt/ast-util#1ce4d00a6c2568209bc10d13c5bf6390f23b9dbc", + "version": "github:GerHobbelt/ast-util#386dd1c60e90368f49ee29aafd91d9e438aee787", "dev": true }, "async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.3.0.tgz", - "integrity": "sha1-EBPRBRBH3TIP4k5JTVxm7K9hR9k=", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", + "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", "dev": true }, - "babel-code-frame": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", - "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", + "atob": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", + "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", "dev": true }, + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", + "dev": true, + "dependencies": { + "ansi-styles": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true + }, + "supports-color": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + } + } + }, "babel-core": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.24.1.tgz", - "integrity": "sha1-jEKFZNzh4fQfszfsNPTDsCK1rYM=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", + "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", "dev": true, "dependencies": { "json5": { @@ -76,9 +102,9 @@ } }, "babel-generator": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.25.0.tgz", - "integrity": "sha1-M6GvcNXyiQrrRlpKd5PB32qeqfw=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", "dev": true }, "babel-helper-bindify-decorators": { @@ -100,9 +126,9 @@ "dev": true }, "babel-helper-define-map": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.24.1.tgz", - "integrity": "sha1-epdH8ljYlH0y1RX2qhx70CIEoIA=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", "dev": true }, "babel-helper-explode-assignable-expression": { @@ -142,9 +168,9 @@ "dev": true }, "babel-helper-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.24.1.tgz", - "integrity": "sha1-024i+rEAjXnYhkjjIRaGgShFbOg=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", "dev": true }, "babel-helper-remap-async-to-generator": { @@ -286,9 +312,9 @@ "dev": true }, "babel-plugin-transform-es2015-block-scoping": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.24.1.tgz", - "integrity": "sha1-dsKV3DpHQbFmWt/TFnIV3P8ypXY=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", "dev": true }, "babel-plugin-transform-es2015-classes": { @@ -340,9 +366,9 @@ "dev": true }, "babel-plugin-transform-es2015-modules-commonjs": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.24.1.tgz", - "integrity": "sha1-0+MQtA72ZKNmIiAAl8bUQCmPK/4=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz", + "integrity": "sha1-DYOUApt9xqvhqX7xgeAHWN0uXYo=", "dev": true }, "babel-plugin-transform-es2015-modules-systemjs": { @@ -424,15 +450,15 @@ "dev": true }, "babel-plugin-transform-object-rest-spread": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.23.0.tgz", - "integrity": "sha1-h11ryb52HFiirj/u5dxIldjH+SE=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz", + "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", "dev": true }, "babel-plugin-transform-regenerator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.24.1.tgz", - "integrity": "sha1-uNowWtQ8PJm0hI5P5AN7dw0jxBg=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", + "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", "dev": true }, "babel-plugin-transform-strict-mode": { @@ -466,55 +492,39 @@ "dev": true }, "babel-register": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.24.1.tgz", - "integrity": "sha1-fhDhOi9xBlvfrVoXh7pFvKbe118=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", "dev": true }, "babel-runtime": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.25.0.tgz", - "integrity": "sha1-M7mOql1IK7AajRqmtDetKwGuxBw=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", "dev": true }, "babel-template": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.25.0.tgz", - "integrity": "sha1-ZlJBFmt8KqTGGdceGSlpVSsQwHE=", - "dev": true, - "dependencies": { - "babylon": { - "version": "6.17.4", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", - "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", - "dev": true - } - } + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true }, "babel-traverse": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.25.0.tgz", - "integrity": "sha1-IldJfi/NGbie3BPEyROB+VEklvE=", - "dev": true, - "dependencies": { - "babylon": { - "version": "6.17.4", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.17.4.tgz", - "integrity": "sha512-kChlV+0SXkjE0vUn9OZ7pBMWRFd8uq3mZe8x1K6jhuNcAFAtEnjchFAqB+dYEXKyd+JpT6eppRR78QAr5gTsUw==", - "dev": true - } - } + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true }, "babel-types": { - "version": "6.25.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.25.0.tgz", - "integrity": "sha1-cK+ySNVmDl0Y+BHZHIMDtUE0oY4=", + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", "dev": true }, "babylon": { - "version": "6.16.1", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.16.1.tgz", - "integrity": "sha1-MMWiL0gZeKnn+M399JaxHZS0BNM=", + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", "dev": true }, "balanced-match": { @@ -523,6 +533,38 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, + "base": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.1.tgz", + "integrity": "sha1-s2p/ERE4U6NCoVaR2Y4tzIpswnA=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", @@ -530,9 +572,9 @@ "dev": true }, "braces": { - "version": "1.8.5", - "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", - "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.2.2.tgz", + "integrity": "sha1-JB+GjCsmkNn+vu5afIP7vyXQCxs=", "dev": true }, "browser-stdout": { @@ -547,6 +589,12 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, + "cache-base": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-0.8.5.tgz", + "integrity": "sha1-YM6zUEAh7O7HAR/TOEt/TpVym/o=", + "dev": true + }, "camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -559,18 +607,38 @@ "integrity": "sha1-ZuISeebzxkFf+CMYeCJ5AOIXGzk=", "dev": true }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true - }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, + "class-utils": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.5.tgz", + "integrity": "sha1-F+eTEDdQ+WJ7IXbqNM/RtWWQPIA=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -591,6 +659,12 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, + "collection-visit": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-0.2.3.tgz", + "integrity": "sha1-L2JIPK7MlfCDuaRUo+6eYTmteVc=", + "dev": true + }, "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", @@ -603,6 +677,12 @@ "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", "dev": true }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -615,10 +695,16 @@ "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", "dev": true }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, "core-js": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", - "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=", + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", + "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=", "dev": true }, "cross-spawn": { @@ -653,6 +739,12 @@ } } }, + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true + }, "detect-indent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", @@ -666,7 +758,7 @@ "dev": true }, "ebnf-parser": { - "version": "github:GerHobbelt/ebnf-parser#5908e671c4bf87a902dcb3064dcedb554bc02cbc", + "version": "github:GerHobbelt/ebnf-parser#eb709578e126dd3c04b1c20062c3e5340612f726", "dev": true }, "error-ex": { @@ -675,12 +767,6 @@ "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", "dev": true }, - "es6-promise": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.0.tgz", - "integrity": "sha1-3aA8qPn4m8WX5omEKSnee6jOvfA=", - "dev": true - }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", @@ -688,9 +774,9 @@ "dev": true }, "esprima": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", - "integrity": "sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", "dev": true }, "esutils": { @@ -705,40 +791,82 @@ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", - "dev": true - }, "expand-brackets": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", - "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", - "dev": true + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } }, - "expand-range": { - "version": "1.8.2", - "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", - "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", "dev": true }, "extglob": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", - "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", - "dev": true - }, - "filename-regex": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", - "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", - "dev": true + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-1.1.0.tgz", + "integrity": "sha1-Bni04s5FwOTlD15er7Gw2rW05CQ=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + }, + "to-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-2.1.0.tgz", + "integrity": "sha1-4606QM/hGVWaBa6kPkyu+sxekB0=", + "dev": true, + "dependencies": { + "regex-not": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-0.1.2.tgz", + "integrity": "sha1-vH8cSUSxGINT0H3uuRK5TgreJds=", + "dev": true + } + } + } + } }, "fill-range": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", - "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", "dev": true }, "find-up": { @@ -748,9 +876,9 @@ "dev": true }, "flow-parser": { - "version": "0.44.0", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.44.0.tgz", - "integrity": "sha1-zzE8aHkUfRUh6ZzC0lAOfsUug04=", + "version": "0.53.1", + "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.53.1.tgz", + "integrity": "sha1-a8lrbQGmlXG+ounKU/T/MY2YtD8=", "dev": true }, "for-in": { @@ -759,10 +887,10 @@ "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", "dev": true }, - "for-own": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", - "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", "dev": true }, "fs.realpath": { @@ -789,24 +917,18 @@ "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, "glob": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", "dev": true }, - "glob-base": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", - "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", - "dev": true - }, - "glob-parent": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", - "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "dev": true - }, "globals": { "version": "9.18.0", "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", @@ -843,10 +965,24 @@ "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", "dev": true }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", "dev": true }, "home-or-tmp": { @@ -891,6 +1027,20 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } + }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -909,17 +1059,33 @@ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true }, - "is-dotfile": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", - "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", - "dev": true + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } }, - "is-equal-shallow": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", - "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", - "dev": true + "is-descriptor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.1.tgz", + "integrity": "sha512-G3fFVFTqfaqu7r4YuSBHKBAuOaLz8Sy7ekklUpFEliaLMP1Y2ZjoN9jS62YWCAPQrQpMUQSitRlrzibbuCZjdA==", + "dev": true, + "dependencies": { + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } }, "is-extendable": { "version": "0.1.1", @@ -928,9 +1094,9 @@ "dev": true }, "is-extglob": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", "dev": true }, "is-finite": { @@ -945,28 +1111,30 @@ "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true }, - "is-glob": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", - "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "dev": true - }, "is-number": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", - "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", - "dev": true + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } }, - "is-posix-bracket": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", - "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "is-odd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", + "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", "dev": true }, - "is-primitive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", - "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", "dev": true }, "is-stream": { @@ -988,9 +1156,9 @@ "dev": true }, "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "dev": true }, "jison-gho": { @@ -1000,14 +1168,11 @@ "dev": true }, "jison-lex": { - "version": "github:GerHobbelt/jison-lex#57dacf6dc121b0c188e4652373a63ee2ef419ef3", + "version": "github:GerHobbelt/jison-lex#5134fd42879b989a9e69464420f0ba738b7eeaa4", "dev": true, "dependencies": { - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true + "@gerhobbelt/nomnom": { + "version": "github:GerHobbelt/nomnom#baa5d75a5e5d68f46fdbc1bab1d97a4aaaebd3a5" } } }, @@ -1018,40 +1183,8 @@ "dev": true }, "jscodeshift": { - "version": "github:GerHobbelt/jscodeshift#3263e85323850d713c259747a35f4fbb82f818f9", - "dev": true, - "dependencies": { - "ansi-styles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", - "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", - "dev": true - }, - "chalk": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", - "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", - "dev": true - }, - "nomnom": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", - "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", - "dev": true - }, - "strip-ansi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", - "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", - "dev": true - }, - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } + "version": "github:GerHobbelt/jscodeshift#cebef559cde6c7402e3f96c8d606bf49d46adae1", + "dev": true }, "jsesc": { "version": "1.3.0", @@ -1070,9 +1203,15 @@ "dev": true }, "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true + }, + "lazy-cache": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", + "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", "dev": true }, "lcid": { @@ -1082,7 +1221,7 @@ "dev": true }, "lex-parser": { - "version": "github:GerHobbelt/lex-parser#61cfbb726787d93e025adc0c510e516c23cbcf00", + "version": "github:GerHobbelt/lex-parser#ca8c6cbf6df8a0a7026521b6a7a4ef3acdc21a53", "dev": true }, "load-json-file": { @@ -1169,6 +1308,18 @@ "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-0.1.5.tgz", + "integrity": "sha1-2+Q5J85VJbgN/BVzpE1oxR8mgWs=", + "dev": true + }, "mem": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", @@ -1176,9 +1327,9 @@ "dev": true }, "micromatch": { - "version": "2.3.11", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", - "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.0.4.tgz", + "integrity": "sha1-FUPx0EgTRHrIUgAcX1qTNAF4bR0=", "dev": true }, "mimic-fn": { @@ -1199,6 +1350,12 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, + "mixin-deep": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.2.0.tgz", + "integrity": "sha1-0CuMb4ttS49ZgtP9AJxJGYUcP+I=", + "dev": true + }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -1211,6 +1368,12 @@ "integrity": "sha512-pIU2PJjrPYvYRqVpjXzj76qltO9uBYI7woYAMoxbSefsa+vqAfptjoeevd6bUgwD0mPIO+hv9f7ltvsNreL2PA==", "dev": true, "dependencies": { + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, "supports-color": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", @@ -1225,15 +1388,49 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, + "nanomatch": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.0.tgz", + "integrity": "sha1-dv2z1K52F+N3GeekBHuECFfAyxw=", + "dev": true + }, "node-dir": { - "version": "0.1.16", - "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.16.tgz", - "integrity": "sha1-0u9YOqULkNk9uM3Sb86lg1OVf+Q=", + "version": "0.1.17", + "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz", + "integrity": "sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU=", "dev": true }, "nomnom": { - "version": "github:GerHobbelt/nomnom#aa46a7e4df34a2812cfe1447d4292ec5b3ccdf3e", - "dev": true + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", + "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", + "dev": true, + "dependencies": { + "ansi-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", + "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", + "dev": true + }, + "chalk": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", + "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", + "dev": true + }, + "strip-ansi": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", + "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", + "dev": true + }, + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", + "dev": true + } + } }, "normalize-package-data": { "version": "2.4.0", @@ -1241,12 +1438,6 @@ "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true - }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -1259,10 +1450,58 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, - "object.omit": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", - "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "dependencies": { + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } + }, + "object-visit": { + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-0.3.4.tgz", + "integrity": "sha1-rhXPhvCy/dVRdxY2RIRSxUw9qCk=", + "dev": true, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true + } + } + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", "dev": true }, "once": { @@ -1307,18 +1546,18 @@ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true }, - "parse-glob": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", - "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", - "dev": true - }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -1355,10 +1594,10 @@ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, - "preserve": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", - "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", "dev": true }, "private": { @@ -1373,34 +1612,6 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, - "randomatic": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", - "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", - "dev": true, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true - } - } - }, "read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", @@ -1414,8 +1625,14 @@ "dev": true }, "recast": { - "version": "github:GerHobbelt/recast#354e62b5b8e6050fc63f44ab705768b949d8471d", - "dev": true + "version": "github:GerHobbelt/recast#3a98341ba742608a912699900ab20958582f4636", + "dev": true, + "dependencies": { + "ast-types": { + "version": "github:GerHobbelt/ast-types#77a50128ed587b7bc6cd518573f3b2fd57ae9e5d", + "dev": true + } + } }, "regenerate": { "version": "1.3.2", @@ -1424,21 +1641,21 @@ "dev": true }, "regenerator-runtime": { - "version": "0.10.5", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", - "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", "dev": true }, "regenerator-transform": { - "version": "0.9.11", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.9.11.tgz", - "integrity": "sha1-On0GdSDLe3F2dp61/4aGkb7+EoM=", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", + "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", "dev": true }, - "regex-cache": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.3.tgz", - "integrity": "sha1-mxpsNdTQ3871cRrmUejp09cRQUU=", + "regex-not": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", + "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", "dev": true }, "regexpu-core": { @@ -1467,12 +1684,6 @@ } } }, - "remove-trailing-separator": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz", - "integrity": "sha1-abBi2XhyetFNxrVrpKt3L9jXBRE=", - "dev": true - }, "repeat-element": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", @@ -1503,6 +1714,12 @@ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, "rimraf": { "version": "2.2.8", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", @@ -1521,6 +1738,18 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, + "set-getter": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", + "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", + "dev": true + }, + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -1545,22 +1774,74 @@ "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", "dev": true }, - "slide": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/slide/-/slide-1.1.6.tgz", - "integrity": "sha1-VusCfWW00tzmyy4tMsTUr8nh1wc=", + "snapdragon": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", + "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", "dev": true }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } + }, "source-map": { - "version": "0.5.6", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.6.tgz", - "integrity": "sha1-dc449SvwczxafwwRjYEzSiu19BI=", + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + }, + "source-map-resolve": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.0.tgz", + "integrity": "sha1-/K0LZLcK+ydpnkJZUMtevNQQvCA=", "dev": true }, "source-map-support": { - "version": "0.4.15", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.15.tgz", - "integrity": "sha1-AyAt9lwG0r2MfsI2KhkwVv7407E=", + "version": "0.4.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.16.tgz", + "integrity": "sha512-A6vlydY7H/ljr4L2UOhDSajQdZQ6dMD7cLH0pzwcmwLyc9u8PNI4WGtnfDDzX7uzGL6c/T+ORL97Zlh+S4iOrg==", + "dev": true + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", "dev": true }, "spdx-correct": { @@ -1581,6 +1862,38 @@ "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, + "split-string": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-2.1.1.tgz", + "integrity": "sha1-r0sG2CFWBCZEbDzZMc2mGJQNN9A=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -1625,12 +1938,6 @@ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - }, "temp": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", @@ -1643,6 +1950,52 @@ "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", "dev": true }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } + }, + "to-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", + "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true + }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", @@ -1655,12 +2008,50 @@ "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", "dev": true }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "union-value": { + "version": "0.2.4", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-0.2.4.tgz", + "integrity": "sha1-c3UVJ4ZnkFfns3qmdug0aPwCdPA=", "dev": true }, + "unset-value": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-0.1.2.tgz", + "integrity": "sha1-UGgQuGfyfCpabpsEgzYx9t5Y0xA=", + "dev": true + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "use": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", + "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, "validate-npm-package-license": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", @@ -1668,9 +2059,9 @@ "dev": true }, "which": { - "version": "1.2.14", - "resolved": "https://registry.npmjs.org/which/-/which-1.2.14.tgz", - "integrity": "sha1-mofEN48D6CfOyvGs31bHNsAcFOU=", + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", "dev": true }, "which-module": { @@ -1700,13 +2091,13 @@ "dev": true }, "write-file-atomic": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-1.3.1.tgz", - "integrity": "sha1-fUW6MjFjKN0ex9kPYOvA2EW7dZo=", + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", "dev": true }, "xregexp": { - "version": "github:GerHobbelt/xregexp#7cb56f9a90a802ae34087ac5a257a992904a602c" + "version": "github:GerHobbelt/xregexp#bec0718d8b9871cee62028687a4dbe60b1226abe" }, "y18n": { "version": "3.2.1", From 79fdf41f628451367c8dfd0ba7a423b0269bc8ce Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 12:09:42 +0200 Subject: [PATCH 335/417] fix/cleanup: strings anywhere in the lexer spec are now properly unescaped: only the quotes are unescaped, while any other escapes in there are kept as is. (Hence you'll need to 'decode' such strings through something like JSON5.parse() to convert the other escapes as well: we decided to keep those intact (as they were kept intact before!) as you, the lexer spec writer, MAY want to introduce your own custom escapes as part of some underlying language. --- lex-parser.js | 47 ++++++++++++++++++++------------ lex.l | 50 ++++++++++++++++++++++------------ tests/all-tests.js | 4 +-- tests/lex/lex_grammar.lex.json | 4 +-- 4 files changed, 66 insertions(+), 39 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 101dfe6..c2f3a1c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -4942,14 +4942,14 @@ var lexer = function() { case 20: /*! Conditions:: options */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = this.matches[1]; + yy_.yytext = unescQuote(this.matches[1]); return 39; // value is always a string type break; case 21: /*! Conditions:: options */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = this.matches[1]; + yy_.yytext = unescQuote(this.matches[1]); return 39; // value is always a string type break; @@ -5096,18 +5096,16 @@ var lexer = function() { /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = this.matches[1]; + yy_.yytext = unescQuote(this.matches[1]); - yy_.yytext = yy_.yytext.replace(/\\"/g, '"'); return 35; break; case 44: /*! Conditions:: indented trail rules macro INITIAL */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = this.matches[1]; + yy_.yytext = unescQuote(this.matches[1]); - yy_.yytext = yy_.yytext.replace(/\\'/g, '\''); return 35; break; case 45: @@ -5230,7 +5228,7 @@ var lexer = function() { case 82: /*! Conditions:: path */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = this.matches[1]; + yy_.yytext = unescQuote(this.matches[1]); this.popState(); return 42; @@ -5238,7 +5236,7 @@ var lexer = function() { case 83: /*! Conditions:: path */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = this.matches[1]; + yy_.yytext = unescQuote(this.matches[1]); this.popState(); return 42; @@ -5303,7 +5301,7 @@ var lexer = function() { simpleCaseActionClusters: { /*! Conditions:: action */ - /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /*! Rule:: \/\*[^]*?\*\/ */ 0: 26, /*! Conditions:: action */ @@ -5311,15 +5309,15 @@ var lexer = function() { 1: 26, /*! Conditions:: action */ - /*! Rule:: \/[^ /]*?['"{}][^ ]*?\/ */ + /*! Rule:: \/[^\s/]*?['"{}][^\s]*?\/ */ 2: 26, /*! Conditions:: action */ - /*! Rule:: "(\\\\|\\"|[^"])*" */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ 3: 26, /*! Conditions:: action */ - /*! Rule:: '(\\\\|\\'|[^'])*' */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ 4: 26, /*! Conditions:: action */ @@ -5419,7 +5417,7 @@ var lexer = function() { 64: 15, /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: \{\d+(,\s?\d+|,)?\} */ + /*! Rule:: \{\d+(,\s*\d+|,)?\} */ 71: 34, /*! Conditions:: indented trail rules macro INITIAL */ @@ -5456,11 +5454,11 @@ var lexer = function() { }, rules: [ - /* 0: */ /^(?:\/\*(.|\n|\r)*?\*\/)/, + /* 0: */ new XRegExp('^(?:\\/\\*[^]*?\\*\\/)', ''), /* 1: */ /^(?:\/\/.*)/, - /* 2: */ /^(?:\/[^ \/]*?['"{}][^ ]*?\/)/, - /* 3: */ /^(?:"(\\\\|\\"|[^"])*")/, - /* 4: */ /^(?:'(\\\\|\\'|[^'])*')/, + /* 2: */ /^(?:\/[^\s\/]*?["'{}]\S*?\/)/, + /* 3: */ /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, + /* 4: */ /^(?:'((?:\\'|\\[^']|[^'\\])*)')/, /* 5: */ /^(?:[\/"'][^{}\/"']+)/, /* 6: */ /^(?:[^{}\/"']+)/, /* 7: */ /^(?:\{)/, @@ -5536,7 +5534,7 @@ var lexer = function() { '' ), /* 70: */ /^(?:%%)/, - /* 71: */ /^(?:\{\d+(,\s?\d+|,)?\})/, + /* 71: */ /^(?:\{\d+(,\s*\d+|,)?\})/, /* 72: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), /* 73: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), /* 74: */ /^(?:\{)/, @@ -5839,6 +5837,19 @@ var lexer = function() { return pf + a.join('\n' + pf); } + // unescape a string value which is wrapped in quotes/doublequotes + function unescQuote(str) { + str = '' + str; + var a = str.split('\\\\'); + + a = a.map(function(s) { + return s.replace(/\\'/g, '\'').replace(/\\"/g, '"'); + }); + + str = a.join('\\\\'); + return str; + } + // properly quote and escape the given input string function dquote(s) { var sq = s.indexOf('\'') >= 0; diff --git a/lex.l b/lex.l index 8cce662..2afb6dc 100644 --- a/lex.l +++ b/lex.l @@ -39,13 +39,15 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] %% -"/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; +"/*"[^]*?"*/" return 'ACTION_BODY'; "//".* return 'ACTION_BODY'; // regexp with braces or quotes (and no spaces, so we don't mistake // a *division operator* `/` for a regex delimiter here in most circumstances): -"/"[^ /]*?['"{}][^ ]*?"/" return 'ACTION_BODY'; -\"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; -"'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; +"/"[^\s/]*?['"{}][^\s]*?"/" return 'ACTION_BODY'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" + return 'ACTION_BODY'; +\'{QUOTED_STRING_CONTENT}\' + return 'ACTION_BODY'; [/"'][^{}/"']+ return 'ACTION_BODY'; [^{}/"']+ return 'ACTION_BODY'; "{" yy.depth++; return '{'; @@ -79,9 +81,9 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {NAME} return 'NAME'; "=" return '='; \"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = this.matches[1]; return 'OPTION_STRING_VALUE'; // value is always a string type + yytext = unescQuote(this.matches[1]); return 'OPTION_STRING_VALUE'; // value is always a string type \'{QUOTED_STRING_CONTENT}\' - yytext = this.matches[1]; return 'OPTION_STRING_VALUE'; // value is always a string type + yytext = unescQuote(this.matches[1]); return 'OPTION_STRING_VALUE'; // value is always a string type // Comments should be gobbled and discarded anywhere *except* the code/action blocks: "//"[^\r\n]* @@ -130,8 +132,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] // Accept any non-regex-special character as a direct literal without // the need to put quotes around it: -{ANY_LITERAL_CHAR}+ - %{ +{ANY_LITERAL_CHAR}+ %{ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is return 'CHARACTER_LIT'; @@ -141,13 +142,11 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] \s+ /* empty */ \"{DOUBLEQUOTED_STRING_CONTENT}\" %{ - yytext = this.matches[1]; - yytext = yytext.replace(/\\"/g,'"'); + yytext = unescQuote(this.matches[1]); return 'STRING_LIT'; %} \'{QUOTED_STRING_CONTENT}\' %{ - yytext = this.matches[1]; - yytext = yytext.replace(/\\'/g,"'"); + yytext = unescQuote(this.matches[1]); return 'STRING_LIT'; %} "[" this.pushState('set'); return 'REGEX_SET_START'; @@ -195,7 +194,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] return 'UNKNOWN_DECL'; %} "%%" this.pushState('rules'); return '%%'; -"{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; +"{"\d+(","\s*\d+|",")?"}" return 'RANGE_REGEX'; "{"{ID}"}" return 'NAME_BRACE'; "{"{ID}"}" return 'NAME_BRACE'; "{" return '{'; @@ -204,7 +203,8 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] (?:"\\\\"|"\\]"|[^\]{])+ return 'REGEX_SET'; "{" return 'REGEX_SET'; -"]" this.popState(); return 'REGEX_SET_END'; +"]" this.popState(); + return 'REGEX_SET_END'; // in the trailing CODE block, only accept these `%include` macros when @@ -216,11 +216,16 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR} this.popState(); this.unput(yytext); \"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = this.matches[1]; this.popState(); return 'PATH'; + yytext = unescQuote(this.matches[1]); + this.popState(); + return 'PATH'; \'{QUOTED_STRING_CONTENT}\' - yytext = this.matches[1]; this.popState(); return 'PATH'; + yytext = unescQuote(this.matches[1]); + this.popState(); + return 'PATH'; {WS}+ // skip whitespace in the line -[^\s\r\n]+ this.popState(); return 'PATH'; +[^\s\r\n]+ this.popState(); + return 'PATH'; . %{ /* b0rk on bad characters */ @@ -257,6 +262,17 @@ function indent(s, i) { return pf + a.join('\n' + pf); } +// unescape a string value which is wrapped in quotes/doublequotes +function unescQuote(str) { + str = '' + str; + var a = str.split('\\\\'); + a = a.map(function (s) { + return s.replace(/\\'/g, "'").replace(/\\"/g, '"'); + }); + str = a.join('\\\\'); + return str; +} + // properly quote and escape the given input string function dquote(s) { var sq = (s.indexOf('\'') >= 0); diff --git a/tests/all-tests.js b/tests/all-tests.js index dacf54c..916e5a7 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -567,8 +567,8 @@ describe("LEX Parser", function () { ["foo", "return 1;"] ], options: { - s1: "s1\\\"val'ue", - s2: "s2\\\\x\\'val\"ue" + s1: "s1\"val'ue", + s2: "s2\\\\x'val\"ue" }, macros: {}, startConditions: {}, diff --git a/tests/lex/lex_grammar.lex.json b/tests/lex/lex_grammar.lex.json index 810f2e8..63dd32d 100644 --- a/tests/lex/lex_grammar.lex.json +++ b/tests/lex/lex_grammar.lex.json @@ -4,8 +4,8 @@ ["\\s+", "yy.freshLine = false;"], ["y\\{[^}]*\\}", "yytext = yytext.substr(2, yyleng-3);return 'ACTION';"], ["[a-zA-Z_][a-zA-Z0-9_]*", "return 'NAME';"], - ["\"([^\"]|\\\\\")*\"", "return 'STRING_LIT';"], - ["'([^']|\\\\')*'", "return 'STRING_LIT';"], + ["\"([^\"]|\")*\"", "return 'STRING_LIT';"], + ["'([^']|')*'", "return 'STRING_LIT';"], ["\\|", "return '|';"], ["\\[(\\\\\\]|[^\\]])*\\]", "return 'ANY_GROUP_REGEX';"], ["\\(", "return '(';"], From eaf0eeea67334e292c1af0ea7a84fa92f2bb0ad3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 12:28:03 +0200 Subject: [PATCH 336/417] grammar cleanup --- lex-parser.js | 8 ++++---- lex.y | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index c2f3a1c..1018183 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1083,7 +1083,7 @@ case 13: /*! Production:: definition : "{" action_body error */ var l = yyvstack[yysp - 1].split('\n'); var ab = l.slice(0, 10).join('\n'); - yyparser.yyError("Seems you did not correctly bracket the lexer 'preparatory' action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + yyparser.yyError("Seems you did not correctly bracket the lexer preparatory action block in curly braces: '{ ... }'. Offending action body:\n" + ab); break; case 14: @@ -1170,7 +1170,7 @@ case 28: case 31: /*! Production:: rule : regex error */ - this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; yyparser.yyError("lexer rule regex action code declaration error?", yylstack[yysp]); break; @@ -1331,8 +1331,8 @@ case 49: try { // Convert Unicode escapes and other escapes to their literal characters - // BEFORE we go and check whether this item is subject to the - // `easy_keyword_rules` option. + // BEFORE we go and check whether this item is subject to the + // `easy_keyword_rules` option. this.$ = eval('"' + this.$ + '"'); } catch (ex) { diff --git a/lex.y b/lex.y index 043d5c4..6875baa 100644 --- a/lex.y +++ b/lex.y @@ -88,7 +88,7 @@ definitions } } | ε - { + { $$ = { macros: {}, // { hash table } startConditions: {}, // { hash table } @@ -110,7 +110,7 @@ definition { var l = $action_body.split('\n'); var ab = l.slice(0, 10).join('\n'); - yyerror("Seems you did not correctly bracket the lexer 'preparatory' action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + yyerror("Seems you did not correctly bracket the lexer preparatory action block in curly braces: '{ ... }'. Offending action body:\n" + ab); } | ACTION { yy.actionInclude.push($ACTION); $$ = null; } @@ -145,14 +145,14 @@ rules rules_collective : start_conditions rule - { + { if ($start_conditions) { $rule.unshift($start_conditions); } $$ = [$rule]; } | start_conditions '{' rule_block '}' - { + { if ($start_conditions) { $rule_block.forEach(function (d) { d.unshift($start_conditions); @@ -181,10 +181,10 @@ rule : regex action { $$ = [$regex, $action]; } | regex error - { - $$ = [$regex, $error]; + { + $$ = [$regex, $error]; yyerror("lexer rule regex action code declaration error?", @error); - } + } ; action @@ -294,8 +294,8 @@ regex try { // Convert Unicode escapes and other escapes to their literal characters - // BEFORE we go and check whether this item is subject to the - // `easy_keyword_rules` option. + // BEFORE we go and check whether this item is subject to the + // `easy_keyword_rules` option. $$ = eval('"' + $$ + '"'); } catch (ex) { From de43013a6b89507e71d0586292687a4b58e1859d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 13:24:28 +0200 Subject: [PATCH 337/417] working on a better error report: display the offending lines of input, including line numbers, for easier diagnostics of failures. --- lex-parser.js | 105 +++++++++++++++++++++++++++++--------------------- lex.y | 85 +++++++++++++++++++++++++++------------- 2 files changed, 120 insertions(+), 70 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 1018183..a43e30e 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -991,7 +991,7 @@ case 1: case 2: /*! Production:: lex : init definitions error EOF */ - yyparser.yyError("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: definitions %% rules [%% extra_module_code]", yylstack[yysp - 1]); + yyparser.yyError("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure:\n definitions %% rules [%% extra_module_code]\n\nErroneous code:\n" + prettyPrintRange(yylexer, yylstack[yysp - 1])); break; case 3: @@ -1081,9 +1081,7 @@ case 12: case 13: /*! Production:: definition : "{" action_body error */ - var l = yyvstack[yysp - 1].split('\n'); - var ab = l.slice(0, 10).join('\n'); - yyparser.yyError("Seems you did not correctly bracket the lexer preparatory action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + yyparser.yyError("Seems you did not correctly bracket the lexer preparatory action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; case 14: @@ -1095,6 +1093,12 @@ case 15: case 16: /*! Production:: definition : options */ +case 85: + /*! Production:: options : OPTIONS option_list OPTIONS_END */ +case 86: + /*! Production:: option_list : option option_list */ +case 87: + /*! Production:: option_list : option */ this.$ = null; break; @@ -1155,12 +1159,12 @@ case 25: case 26: /*! Production:: rules_collective : start_conditions "{" error "}" */ - yyparser.yyError("Seems you made a mistake while specifying one of the lexer rules inside the start condition <" + yyvstack[yysp - 3].join(',') + "> { rules... } block.", yylstack[yysp - 1]); + yyparser.yyError("Seems you made a mistake while specifying one of the lexer rules inside the start condition <" + yyvstack[yysp - 3].join(',') + "> { rules... } block.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])); break; case 27: /*! Production:: rules_collective : start_conditions "{" error */ - yyparser.yyError("Seems you did not correctly bracket a lexer rules set inside the start condition <" + yyvstack[yysp - 2].join(',') + "> { rules... } as a terminating curly brace '}' could not be found.", yylstack[yysp], $rule_block); + yyparser.yyError("Seems you did not correctly bracket a lexer rules set inside the start condition <" + yyvstack[yysp - 2].join(',') + "> { rules... } as a terminating curly brace '}' could not be found.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 28: @@ -1171,7 +1175,7 @@ case 28: case 31: /*! Production:: rule : regex error */ this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; - yyparser.yyError("lexer rule regex action code declaration error?", yylstack[yysp]); + yyparser.yyError("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; case 32: @@ -1183,9 +1187,7 @@ case 43: case 33: /*! Production:: action : "{" action_body error */ - var l = yyvstack[yysp - 1].split('\n'); - var ab = l.slice(0, 10).join('\n'); - yyparser.yyError("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + yyparser.yyError("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 36: @@ -1212,8 +1214,6 @@ case 79: /*! Production:: regex_set_atom : REGEX_SET */ case 84: /*! Production:: string : CHARACTER_LIT */ -case 87: - /*! Production:: option_list : option */ // default action (generated by JISON): this.$ = yyvstack[yysp]; this._$ = yylstack[yysp]; @@ -1231,9 +1231,7 @@ case 39: case 40: /*! Production:: action_body : action_body "{" action_body error */ - var l = yyvstack[yysp - 1].split('\n'); - var ab = l.slice(0, 10).join('\n'); - yyparser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Offending action body part:\n" + ab); + yyparser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 3])); break; case 41: @@ -1260,9 +1258,7 @@ case 97: case 44: /*! Production:: start_conditions : "<" name_list error */ - var l = yyvstack[yysp - 1]; - var ab = l.slice(0, 10).join(',').replace(/[\s\r\n]/g, ' '); - yyparser.yyError("Seems you did not correctly terminate the start condition set <" + ab + ",???> with a terminating '>'"); + yyparser.yyError("Seems you did not correctly terminate the start condition set <" + yyvstack[yysp - 1].join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 45: @@ -1374,16 +1370,9 @@ case 58: case 59: /*! Production:: regex_base : "(" regex_list error */ - var l = yyvstack[yysp - 1]; - var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); - yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: (" + ab, yyvstack[yysp - 1]); - break; - case 60: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ - var l = yyvstack[yysp - 1]; - var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); - yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: " + yyvstack[yysp - 2] + ab, yyvstack[yysp - 1]); + yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 61: @@ -1435,9 +1424,7 @@ case 93: case 76: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ - var l = yyvstack[yysp - 1]; - var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); - yyparser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: " + yyvstack[yysp - 2] + ab, yyvstack[yysp - 1]); + yyparser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 80: @@ -1458,20 +1445,6 @@ case 83: this.$ = prepareString(yyvstack[yysp]); break; -case 85: - /*! Production:: options : OPTIONS option_list OPTIONS_END */ - // default action (generated by JISON): - this.$ = yyvstack.slice(yysp - 2, yysp + 1); - this._$ = yyparser.mergeLocationInfo(yysp - 2, yysp); - break; - -case 86: - /*! Production:: option_list : option option_list */ - // default action (generated by JISON): - this.$ = yyvstack.slice(yysp - 1, yysp + 1); - this._$ = yyparser.mergeLocationInfo(yysp - 1, yysp); - break; - case 88: /*! Production:: option : NAME */ yy.options[yyvstack[yysp]] = true; @@ -1499,7 +1472,7 @@ case 94: case 95: /*! Production:: include_macro_code : INCLUDE error */ - yyparser.yyError("%include MUST be followed by a valid file path"); + yyparser.yyError("%include MUST be followed by a valid file path\n\n Erroneous path:\n" + prettyPrintRange(yylexer, yylstack[yysp])); break; case 100: @@ -3526,6 +3499,50 @@ function parseValue(v) { return v; } +// pretty-print the erroneous section of the input, with line numbers and everything... +function prettyPrintRange(lexer, loc, context_loc) { + assert(loc); + var error_size = loc.last_line - loc.first_line; + const CONTEXT = 3; + var input = lexer.matched; + var lines = input.split('\n'); + var show_context = (error_size < 5 || context_loc); + var l0 = (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT); + var l1 = loc.last_line; + var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); + var ws_prefix = new Array(lineno_display_width).join(' '); + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + line = lno_pfx + ': ' + line; + if (show_context) { + var errpfx = (new Array(lineno_display_width + 1)).join('^'); + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + var len = (lno === loc_last_line ? loc.last_column : line.length) - loc.first_column + 1; + var lead = (new Array(offset)).join(' '); + var mark = (new Array(len)).join('^'); + line += '\n' + errpfx + lead + mark; + } else if (lno === loc_last_line) { + var offset = 2 + 1; + var len = loc.last_column + 1; + var lead = (new Array(offset)).join(' '); + var mark = (new Array(len)).join('^'); + line += '\n' + errpfx + lead + mark; + } else if (lno > loc.first_line && lno < loc_last_line) { + var offset = 2 + 1; + var len = line.length + 1; + var lead = (new Array(offset)).join(' '); + var mark = (new Array(len)).join('^'); + line += '\n' + errpfx + lead + mark; + } + } + line = line.replace(/\t/g, ' '); + return line; + }); + return rv.join('\n'); +} + parser.warn = function p_warn() { console.warn.apply(console, arguments); }; diff --git a/lex.y b/lex.y index 6875baa..45bfb5a 100644 --- a/lex.y +++ b/lex.y @@ -36,7 +36,7 @@ lex } | init definitions error EOF { - yyerror("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: definitions %% rules [%% extra_module_code]", @error); + yyerror("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure:\n definitions %% rules [%% extra_module_code]\n\nErroneous code:\n" + prettyPrintRange(yylexer, @error)); } ; @@ -108,9 +108,7 @@ definition { yy.actionInclude.push($action_body); $$ = null; } | '{' action_body error { - var l = $action_body.split('\n'); - var ab = l.slice(0, 10).join('\n'); - yyerror("Seems you did not correctly bracket the lexer preparatory action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + yyerror("Seems you did not correctly bracket the lexer preparatory action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, @error, @action_body)); } | ACTION { yy.actionInclude.push($ACTION); $$ = null; } @@ -162,11 +160,11 @@ rules_collective } | start_conditions '{' error '}' { - yyerror("Seems you made a mistake while specifying one of the lexer rules inside the start condition <" + $start_conditions.join(',') + "> { rules... } block.", @error); + yyerror("Seems you made a mistake while specifying one of the lexer rules inside the start condition <" + $start_conditions.join(',') + "> { rules... } block.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylexer.mergeLocationInfo(##start_conditions, ##4), @start_conditions)); } | start_conditions '{' error { - yyerror("Seems you did not correctly bracket a lexer rules set inside the start condition <" + $start_conditions.join(',') + "> { rules... } as a terminating curly brace '}' could not be found.", @error, $rule_block); + yyerror("Seems you did not correctly bracket a lexer rules set inside the start condition <" + $start_conditions.join(',') + "> { rules... } as a terminating curly brace '}' could not be found.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error, @start_conditions)); } ; @@ -183,7 +181,7 @@ rule | regex error { $$ = [$regex, $error]; - yyerror("lexer rule regex action code declaration error?", @error); + yyerror("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error, @regex)); } ; @@ -192,9 +190,7 @@ action { $$ = $action_body; } | '{' action_body error { - var l = $action_body.split('\n'); - var ab = l.slice(0, 10).join('\n'); - yyerror("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body:\n" + ab); + yyerror("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, @error, @1)); } | unbracketed_action_body { $$ = $unbracketed_action_body; } @@ -215,9 +211,7 @@ action_body { $$ = $1 + $2 + $3 + $4 + $5; } | action_body '{' action_body error { - var l = $action_body2.split('\n'); - var ab = l.slice(0, 10).join('\n'); - yyerror("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Offending action body part:\n" + ab); + yyerror("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + prettyPrintRange(yylexer, @error, @action_body1)); } ; @@ -233,9 +227,7 @@ start_conditions { $$ = $name_list; } | '<' name_list error { - var l = $name_list; - var ab = l.slice(0, 10).join(',').replace(/[\s\r\n]/g, ' '); - yyerror("Seems you did not correctly terminate the start condition set <" + ab + ",???> with a terminating '>'"); + yyerror("Seems you did not correctly terminate the start condition set <" + $name_list.join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error, @1)); } | '<' '*' '>' { $$ = ['*']; } @@ -343,15 +335,11 @@ regex_base { $$ = $SPECIAL_GROUP + $regex_list + ')'; } | '(' regex_list error { - var l = $regex_list; - var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); - yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: (" + ab, $regex_list); + yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + prettyPrintRange(yylexer, @error, @1)); } | SPECIAL_GROUP regex_list error { - var l = $regex_list; - var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); - yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: " + $SPECIAL_GROUP + ab, $regex_list); + yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + prettyPrintRange(yylexer, @error, @SPECIAL_GROUP)); } | regex_base '+' { $$ = $regex_base + '+'; } @@ -386,9 +374,7 @@ any_group_regex { $$ = $REGEX_SET_START + $regex_set + $REGEX_SET_END; } | REGEX_SET_START regex_set error { - var l = $regex_set; - var ab = l.replace(/[\s\r\n]/g, ' ').substring(0, 32); - yyerror("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: " + $REGEX_SET_START + ab, $regex_set); + yyerror("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + prettyPrintRange(yylexer, @error, @REGEX_SET_START)); } ; @@ -432,11 +418,14 @@ string options : OPTIONS option_list OPTIONS_END + { $$ = null; } ; option_list : option option_list + { $$ = null; } | option + { $$ = null; } ; option @@ -467,7 +456,7 @@ include_macro_code } | INCLUDE error { - yyerror("%include MUST be followed by a valid file path"); + yyerror("%include MUST be followed by a valid file path\n\n Erroneous path:\n" + prettyPrintRange(yylexer, @error)); } ; @@ -521,6 +510,50 @@ function parseValue(v) { return v; } +// pretty-print the erroneous section of the input, with line numbers and everything... +function prettyPrintRange(lexer, loc, context_loc) { + assert(loc); + var error_size = loc.last_line - loc.first_line; + const CONTEXT = 3; + var input = lexer.matched; + var lines = input.split('\n'); + var show_context = (error_size < 5 || context_loc); + var l0 = (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT); + var l1 = loc.last_line; + var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); + var ws_prefix = new Array(lineno_display_width).join(' '); + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + line = lno_pfx + ': ' + line; + if (show_context) { + var errpfx = (new Array(lineno_display_width + 1)).join('^'); + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + var len = (lno === loc_last_line ? loc.last_column : line.length) - loc.first_column + 1; + var lead = (new Array(offset)).join(' '); + var mark = (new Array(len)).join('^'); + line += '\n' + errpfx + lead + mark; + } else if (lno === loc_last_line) { + var offset = 2 + 1; + var len = loc.last_column + 1; + var lead = (new Array(offset)).join(' '); + var mark = (new Array(len)).join('^'); + line += '\n' + errpfx + lead + mark; + } else if (lno > loc.first_line && lno < loc_last_line) { + var offset = 2 + 1; + var len = line.length + 1; + var lead = (new Array(offset)).join(' '); + var mark = (new Array(len)).join('^'); + line += '\n' + errpfx + lead + mark; + } + } + line = line.replace(/\t/g, ' '); + return line; + }); + return rv.join('\n'); +} + parser.warn = function p_warn() { console.warn.apply(console, arguments); }; From d922a83d469306e4c781e066d68974d5c3aa7333 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 14:47:38 +0200 Subject: [PATCH 338/417] moving towards public 'scoped package' releases as per https://docs.npmjs.com/misc/scope; this is also related to https://github.com/GerHobbelt/jison/issues/11 --- lex.y | 2 +- package-lock.json | 65 ++++++++++++++++++++++++++++++++++++++++++----- package.json | 6 ++--- 3 files changed, 62 insertions(+), 11 deletions(-) diff --git a/lex.y b/lex.y index 45bfb5a..70723d9 100644 --- a/lex.y +++ b/lex.y @@ -476,7 +476,7 @@ optional_module_code_chunk %% -var XRegExp = require('xregexp'); // for helping out the `%options xregexp` in the lexer +var XRegExp = require('@gerhobbelt/xregexp'); // for helping out the `%options xregexp` in the lexer function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); diff --git a/package-lock.json b/package-lock.json index 7846dbc..3f7451a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,14 +1,30 @@ { - "name": "lex-parser", + "name": "@gerhobbelt/lex-parser", "version": "0.6.0-186", "lockfileVersion": 1, "dependencies": { + "@gerhobbelt/nomnom": { + "version": "1.8.4-16", + "resolved": "https://registry.npmjs.org/@gerhobbelt/nomnom/-/nomnom-1.8.4-16.tgz", + "integrity": "sha512-1qh0YojYP3r/5aOTJs/r6tCfi55zxLdeOWrMPrC1Ra73/yewbEkowchJppvxzzFPLgpkNX5GoJgKsfPv980R9g==", + "dev": true + }, + "@gerhobbelt/xregexp": { + "version": "3.2.0-21", + "resolved": "https://registry.npmjs.org/@gerhobbelt/xregexp/-/xregexp-3.2.0-21.tgz", + "integrity": "sha512-TAwlbrEi941S+U4JuE/WovxssajgXWZot/M8za35NN/wPoUaExd5rFaWNDfd7Xp/PyhQ4zz4UGBjPpxnsS9euA==" + }, "ansi-regex": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==" + }, "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", @@ -607,6 +623,11 @@ "integrity": "sha1-ZuISeebzxkFf+CMYeCJ5AOIXGzk=", "dev": true }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==" + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -665,6 +686,16 @@ "integrity": "sha1-L2JIPK7MlfCDuaRUo+6eYTmteVc=", "dev": true }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=" + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + }, "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", @@ -770,8 +801,7 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, "esprima": { "version": "4.0.0", @@ -791,6 +821,11 @@ "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", "dev": true }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=" + }, "expand-brackets": { "version": "2.1.4", "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", @@ -965,6 +1000,11 @@ "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", "dev": true }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + }, "has-value": { "version": "0.3.1", "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", @@ -1162,9 +1202,9 @@ "dev": true }, "jison-gho": { - "version": "0.4.18-184", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.4.18-184.tgz", - "integrity": "sha512-Z22ZN0i4oh0GYXNCB/hlVv3i4s+f+Q3aIQBn139koo/grHH97VTk/hfWx0/VRt67/NYaLpoEtbcw0FkWynephw==", + "version": "0.4.18-186", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.4.18-186.tgz", + "integrity": "sha512-ySraLVTD69Nx6pzpXW3k0qKUOi95ukK2MqijQRAEB3ueQXhvS6RoaUvtmO/O8TfiJ85RqF2C6OI129/qEqZsfg==", "dev": true }, "jison-lex": { @@ -1938,6 +1978,11 @@ "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", "dev": true }, + "supports-color": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", + "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==" + }, "temp": { "version": "0.8.3", "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", @@ -2008,6 +2053,11 @@ "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", "dev": true }, + "underscore": { + "version": "1.8.3", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + }, "union-value": { "version": "0.2.4", "resolved": "https://registry.npmjs.org/union-value/-/union-value-0.2.4.tgz", @@ -2097,7 +2147,8 @@ "dev": true }, "xregexp": { - "version": "github:GerHobbelt/xregexp#bec0718d8b9871cee62028687a4dbe60b1226abe" + "version": "github:GerHobbelt/xregexp#bec0718d8b9871cee62028687a4dbe60b1226abe", + "dev": true }, "y18n": { "version": "3.2.1", diff --git a/package.json b/package.json index 217bc1d..47388ad 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "email": "zach@carter.name", "url": "http://zaa.ch" }, - "name": "lex-parser", + "name": "@gerhobbelt/lex-parser", "version": "0.6.0-186", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", @@ -26,11 +26,11 @@ "node": ">=4.0" }, "dependencies": { - "xregexp": "github:GerHobbelt/xregexp#master" + "@gerhobbelt/xregexp": "3.2.0-21" }, "devDependencies": { "chai": "4.1.1", - "jison-gho": "0.4.18-184", + "jison-gho": "0.4.18-186", "mocha": "3.5.0" } } From 508d51fba5cf6f1dd871f50b2f2a25f03210d0f5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 15:33:40 +0200 Subject: [PATCH 339/417] rebuilt library files: moving towards public 'scoped package' releases as per https://docs.npmjs.com/misc/scope; this is also related to https://github.com/GerHobbelt/jison/issues/11 --- lex-parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex-parser.js b/lex-parser.js index a43e30e..cdfebfd 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -3465,7 +3465,7 @@ yyError: 1 parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -var XRegExp = require('xregexp'); // for helping out the `%options xregexp` in the lexer +var XRegExp = require('@gerhobbelt/xregexp'); // for helping out the `%options xregexp` in the lexer function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); From 5a8da7bfdc5e6948f2bce664314babda52ef36bb Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 15:35:29 +0200 Subject: [PATCH 340/417] add `npm run pub` task to help moving towards public 'scoped package' releases as per https://docs.npmjs.com/misc/scope; this is also related to https://github.com/GerHobbelt/jison/issues/11 --- package.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 47388ad..c340719 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,8 @@ "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { - "test": "make test" + "test": "make test", + "pub": "npm publish --access public" }, "repository": { "type": "git", From db9ce4846b7e9e8cb465b3ece284499704db23a9 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 18:25:32 +0200 Subject: [PATCH 341/417] added `make publish' target to publish all jison modules to NPM at once. --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 72f8cb0..5992a92 100644 --- a/Makefile +++ b/Makefile @@ -32,6 +32,10 @@ bump: git-tag: node -e 'var pkg = require("./package.json"); console.log(pkg.version);' | xargs git tag +publish: + npm run pub + + @@ -48,4 +52,4 @@ superclean: clean -.PHONY: all prep npm-install build test clean superclean bump git-tag +.PHONY: all prep npm-install build test clean superclean bump git-tag publish From faa5261f8333261948cbe760f920958587553d61 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 18:26:42 +0200 Subject: [PATCH 342/417] bumped build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3f7451a..58c4460 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-186", + "version": "0.6.0-187", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/nomnom": { diff --git a/package.json b/package.json index c340719..2887f99 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-186", + "version": "0.6.0-187", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 32d4e0bb57e828f38d90aa1314f325d5d43ce4d8 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 19:36:11 +0200 Subject: [PATCH 343/417] fixed detection of proper working JISON in a full development environment (and using that one instead of the npm dependency!) in the Makefile --- Makefile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 5992a92..7dffab3 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,13 @@ -ifeq ($(wildcard ../../lib/cli.js),) +JISON_VERSION := $(shell node ../../lib/cli.js -V 2> /dev/null ) +ifndef JISON_VERSION ifeq ($(wildcard ./node_modules/.bin/jison),) echo "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###" else JISON = sh node_modules/.bin/jison endif else - JISON = node $(wildcard ../../lib/cli.js) + JISON = node ../../lib/cli.js endif From e00b0361179cb19b82b1e3a2594f2f522894236e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 19:41:50 +0200 Subject: [PATCH 344/417] added `make npm-update` target to run the npmu/ncu npm utility across the board --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 7dffab3..57a672d 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,9 @@ prep: npm-install npm-install: npm install +npm-update: + ncu -a --packageFile=package.json + build: $(JISON) -o lex-parser.js lex.y lex.l From a12282f184da8c0b8b2ffd17eca92d2996f7d377 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 19:52:16 +0200 Subject: [PATCH 345/417] fix SHA-1: 32d4e0bb57e828f38d90aa1314f325d5d43ce4d8 :: fixed detection of proper working JISON in a full development environment (and using that one instead of the npm dependency!) in the Makefile --- Makefile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 57a672d..67cd41b 100644 --- a/Makefile +++ b/Makefile @@ -1,17 +1,15 @@ JISON_VERSION := $(shell node ../../lib/cli.js -V 2> /dev/null ) + ifndef JISON_VERSION - ifeq ($(wildcard ./node_modules/.bin/jison),) - echo "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###" - else - JISON = sh node_modules/.bin/jison - endif + JISON = sh node_modules/.bin/jison else JISON = node ../../lib/cli.js endif + all: build test prep: npm-install @@ -23,6 +21,9 @@ npm-update: ncu -a --packageFile=package.json build: +ifeq ($(wildcard ./node_modules/.bin/jison),) + $(error "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###") +endif $(JISON) -o lex-parser.js lex.y lex.l test: @@ -56,4 +57,5 @@ superclean: clean -.PHONY: all prep npm-install build test clean superclean bump git-tag publish +.PHONY: all prep npm-install build test clean superclean bump git-tag publish npm-update + From baa2006e7d58a42d041278691de4bc5163b92197 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 20:40:40 +0200 Subject: [PATCH 346/417] `make superclean && make prep && make && make site` executed without fail --- lex-parser.js | 4 +- package-lock.json | 120 +++++++++++++++++++++------------------------- package.json | 2 +- 3 files changed, 57 insertions(+), 69 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index cdfebfd..1435e97 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-186 */ +/* parser generated by jison 0.6.0-187 */ /* * Returns a Parser object of the following structure: @@ -3550,7 +3550,7 @@ parser.warn = function p_warn() { parser.log = function p_log() { console.log.apply(console, arguments); }; -/* lexer generated by jison-lex 0.6.0-186 */ +/* lexer generated by jison-lex 0.6.0-187 */ /* * Returns a Lexer object of the following structure: diff --git a/package-lock.json b/package-lock.json index 58c4460..afeeb65 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3,12 +3,35 @@ "version": "0.6.0-187", "lockfileVersion": 1, "dependencies": { + "@gerhobbelt/ast-types": { + "version": "0.9.13-4", + "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.13-4.tgz", + "integrity": "sha512-V8UIj1XN6XOP014fPpecxEa7AlAB9kaTOB/wF9UbguuwIMWCHDmdA9i03JDK9zXyVDVaLWCYh42JK8F9f27AtA==" + }, + "@gerhobbelt/ast-util": { + "version": "0.6.1-4", + "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-util/-/ast-util-0.6.1-4.tgz", + "integrity": "sha512-NP7YZh7rR6CNiMLyKTF+qb2Epx0r5x/zKQ3Z14TgXl73YJurC8WkMkFM9nDj8cRXb6R+f+BEu4DqAvvYKMxbqg==", + "dev": true + }, + "@gerhobbelt/json5": { + "version": "0.5.1-19", + "resolved": "https://registry.npmjs.org/@gerhobbelt/json5/-/json5-0.5.1-19.tgz", + "integrity": "sha512-TDAMTzjDUosbRbkz/l+wzARC3XYPU6bzMJA2WBmd2fIqKUHixg42fp04fX06aYyyDzM0noxSugl6Z0+l+N29mw==", + "dev": true + }, "@gerhobbelt/nomnom": { "version": "1.8.4-16", "resolved": "https://registry.npmjs.org/@gerhobbelt/nomnom/-/nomnom-1.8.4-16.tgz", "integrity": "sha512-1qh0YojYP3r/5aOTJs/r6tCfi55zxLdeOWrMPrC1Ra73/yewbEkowchJppvxzzFPLgpkNX5GoJgKsfPv980R9g==", "dev": true }, + "@gerhobbelt/recast": { + "version": "0.12.7-7", + "resolved": "https://registry.npmjs.org/@gerhobbelt/recast/-/recast-0.12.7-7.tgz", + "integrity": "sha512-rGQfklyX1CV5wj3o8/4QvjdFYXqrAkBJffAa1cilxEPjZTEaMP86CjM6o+B4EpoY8AwzxuUnawPQiARhTphLMQ==", + "dev": true + }, "@gerhobbelt/xregexp": { "version": "3.2.0-21", "resolved": "https://registry.npmjs.org/@gerhobbelt/xregexp/-/xregexp-3.2.0-21.tgz", @@ -23,7 +46,8 @@ "ansi-styles": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==" + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true }, "arr-diff": { "version": "4.0.0", @@ -55,16 +79,6 @@ "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", "dev": true }, - "ast-types": { - "version": "0.9.12", - "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.9.12.tgz", - "integrity": "sha1-sTYwDWcCZiWuFTJpgsqZGOXbc8k=", - "dev": true - }, - "ast-util": { - "version": "github:GerHobbelt/ast-util#386dd1c60e90368f49ee29aafd91d9e438aee787", - "dev": true - }, "async": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", @@ -626,7 +640,8 @@ "chalk": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", - "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==" + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true }, "check-error": { "version": "1.0.2", @@ -689,12 +704,14 @@ "color-convert": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", - "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=" + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "dev": true }, "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=" + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true }, "colors": { "version": "1.1.2", @@ -735,8 +752,7 @@ "core-js": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", - "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=", - "dev": true + "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=" }, "cross-spawn": { "version": "5.1.0", @@ -788,10 +804,6 @@ "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", "dev": true }, - "ebnf-parser": { - "version": "github:GerHobbelt/ebnf-parser#eb709578e126dd3c04b1c20062c3e5340612f726", - "dev": true - }, "error-ex": { "version": "1.3.1", "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", @@ -801,13 +813,13 @@ "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true }, "esprima": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", - "dev": true + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" }, "esutils": { "version": "2.0.2", @@ -824,7 +836,8 @@ "exit": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=" + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true }, "expand-brackets": { "version": "2.1.4", @@ -1003,7 +1016,8 @@ "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=" + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true }, "has-value": { "version": "0.3.1", @@ -1202,20 +1216,11 @@ "dev": true }, "jison-gho": { - "version": "0.4.18-186", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.4.18-186.tgz", - "integrity": "sha512-ySraLVTD69Nx6pzpXW3k0qKUOi95ukK2MqijQRAEB3ueQXhvS6RoaUvtmO/O8TfiJ85RqF2C6OI129/qEqZsfg==", + "version": "0.6.0-187.2", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-187.2.tgz", + "integrity": "sha512-tUcNUC8/AXLuMmJwkvpmOuVhHZ9Yol+6Ms3WeJonNct7szcYI5n0wD3HLYw2a9yzsGcMNCSVssA9N0gosojkCA==", "dev": true }, - "jison-lex": { - "version": "github:GerHobbelt/jison-lex#5134fd42879b989a9e69464420f0ba738b7eeaa4", - "dev": true, - "dependencies": { - "@gerhobbelt/nomnom": { - "version": "github:GerHobbelt/nomnom#baa5d75a5e5d68f46fdbc1bab1d97a4aaaebd3a5" - } - } - }, "js-tokens": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", @@ -1224,7 +1229,12 @@ }, "jscodeshift": { "version": "github:GerHobbelt/jscodeshift#cebef559cde6c7402e3f96c8d606bf49d46adae1", - "dev": true + "dev": true, + "dependencies": { + "@gerhobbelt/recast": { + "version": "github:GerHobbelt/recast#d724957cde9dc08583382f7256eb3ffa52ea681a" + } + } }, "jsesc": { "version": "1.3.0", @@ -1238,10 +1248,6 @@ "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", "dev": true }, - "json5": { - "version": "github:GerHobbelt/json5#14967677303e37041244e5ad7b32c61266d44140", - "dev": true - }, "kind-of": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", @@ -1260,10 +1266,6 @@ "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", "dev": true }, - "lex-parser": { - "version": "github:GerHobbelt/lex-parser#ca8c6cbf6df8a0a7026521b6a7a4ef3acdc21a53", - "dev": true - }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -1643,8 +1645,7 @@ "private": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", - "dev": true + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" }, "pseudomap": { "version": "1.0.2", @@ -1664,16 +1665,6 @@ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true }, - "recast": { - "version": "github:GerHobbelt/recast#3a98341ba742608a912699900ab20958582f4636", - "dev": true, - "dependencies": { - "ast-types": { - "version": "github:GerHobbelt/ast-types#77a50128ed587b7bc6cd518573f3b2fd57ae9e5d", - "dev": true - } - } - }, "regenerate": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.2.tgz", @@ -1863,8 +1854,7 @@ "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" }, "source-map-resolve": { "version": "0.5.0", @@ -1981,7 +1971,8 @@ "supports-color": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==" + "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "dev": true }, "temp": { "version": "0.8.3", @@ -2056,7 +2047,8 @@ "underscore": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=" + "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", + "dev": true }, "union-value": { "version": "0.2.4", @@ -2146,10 +2138,6 @@ "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", "dev": true }, - "xregexp": { - "version": "github:GerHobbelt/xregexp#bec0718d8b9871cee62028687a4dbe60b1226abe", - "dev": true - }, "y18n": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", diff --git a/package.json b/package.json index 2887f99..5d23fbd 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "chai": "4.1.1", - "jison-gho": "0.4.18-186", + "jison-gho": "0.6.0-187.2", "mocha": "3.5.0" } } From a25a5115294e36f325b006b62dafae7bea667f06 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 20:50:03 +0200 Subject: [PATCH 347/417] bumped build revision before we produce another release. --- lex-parser.js | 4 ++-- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 1435e97..b97f10d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-187 */ +/* parser generated by jison 0.6.0-188 */ /* * Returns a Parser object of the following structure: @@ -3550,7 +3550,7 @@ parser.warn = function p_warn() { parser.log = function p_log() { console.log.apply(console, arguments); }; -/* lexer generated by jison-lex 0.6.0-187 */ +/* lexer generated by jison-lex 0.6.0-188 */ /* * Returns a Lexer object of the following structure: diff --git a/package-lock.json b/package-lock.json index afeeb65..b42e60d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-187", + "version": "0.6.0-188", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { diff --git a/package.json b/package.json index 5d23fbd..3ea12a2 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-187", + "version": "0.6.0-188", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From c82fa91eb0a967ee75f8c42eea252f9cd371d319 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 20:56:34 +0200 Subject: [PATCH 348/417] rebuilt library files --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index b97f10d..dc34574 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-188 */ +/* parser generated by jison 0.6.0-187.2 */ /* * Returns a Parser object of the following structure: @@ -3550,7 +3550,7 @@ parser.warn = function p_warn() { parser.log = function p_log() { console.log.apply(console, arguments); }; -/* lexer generated by jison-lex 0.6.0-188 */ +/* lexer generated by jison-lex 0.6.0-186 */ /* * Returns a Lexer object of the following structure: From 1ecc5e9967331a13997d2bf87cd61dcae07a7bf0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 21:03:50 +0200 Subject: [PATCH 349/417] bumped build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index b42e60d..7921b97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-188", + "version": "0.6.0-189", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { diff --git a/package.json b/package.json index 3ea12a2..5549827 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-188", + "version": "0.6.0-189", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From cb23581025f4ed75a90e05664cff70b3882a5993 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 27 Aug 2017 21:10:26 +0200 Subject: [PATCH 350/417] updated NPM packages --- lex-parser.js | 4 ++-- package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index dc34574..b97f10d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-187.2 */ +/* parser generated by jison 0.6.0-188 */ /* * Returns a Parser object of the following structure: @@ -3550,7 +3550,7 @@ parser.warn = function p_warn() { parser.log = function p_log() { console.log.apply(console, arguments); }; -/* lexer generated by jison-lex 0.6.0-186 */ +/* lexer generated by jison-lex 0.6.0-188 */ /* * Returns a Lexer object of the following structure: diff --git a/package-lock.json b/package-lock.json index 7921b97..1d5926a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1216,9 +1216,9 @@ "dev": true }, "jison-gho": { - "version": "0.6.0-187.2", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-187.2.tgz", - "integrity": "sha512-tUcNUC8/AXLuMmJwkvpmOuVhHZ9Yol+6Ms3WeJonNct7szcYI5n0wD3HLYw2a9yzsGcMNCSVssA9N0gosojkCA==", + "version": "0.6.0-188", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-188.tgz", + "integrity": "sha512-l8L+Whne/tR/mzyb0893MV2ZOvtC/60rHZRIPJTmNd8N7GOouWxM4qhkTWyDQ6Z6zfD0VdhHrcVbPxEfHRLATA==", "dev": true }, "js-tokens": { diff --git a/package.json b/package.json index 5549827..14c6d13 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "chai": "4.1.1", - "jison-gho": "0.6.0-187.2", + "jison-gho": "0.6.0-188", "mocha": "3.5.0" } } From 21ec2e603e5a5dc4b494cc0b7d43c75173cec935 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 31 Aug 2017 12:03:35 +0200 Subject: [PATCH 351/417] fixes for location tracking bugs introduced/released in build 188; make sure all error reports via `yyerror()` report error location and content for simplified error inspection by the user. --- lex.y | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lex.y b/lex.y index 70723d9..e5c997a 100644 --- a/lex.y +++ b/lex.y @@ -36,7 +36,7 @@ lex } | init definitions error EOF { - yyerror("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure:\n definitions %% rules [%% extra_module_code]\n\nErroneous code:\n" + prettyPrintRange(yylexer, @error)); + yyerror("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure:\n definitions %% rules [%% extra_module_code]\n\n Erroneous code:\n" + prettyPrintRange(yylexer, @error)); } ; @@ -456,7 +456,7 @@ include_macro_code } | INCLUDE error { - yyerror("%include MUST be followed by a valid file path\n\n Erroneous path:\n" + prettyPrintRange(yylexer, @error)); + yyerror("%include MUST be followed by a valid file path.\n\n Erroneous path:\n" + prettyPrintRange(yylexer, @error)); } ; @@ -465,6 +465,11 @@ module_code_chunk { $$ = $CODE; } | module_code_chunk CODE { $$ = $module_code_chunk + $CODE; } + | error + { + // TODO ... + yyerror("module code declaration error?\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error)); + } ; optional_module_code_chunk @@ -512,7 +517,6 @@ function parseValue(v) { // pretty-print the erroneous section of the input, with line numbers and everything... function prettyPrintRange(lexer, loc, context_loc) { - assert(loc); var error_size = loc.last_line - loc.first_line; const CONTEXT = 3; var input = lexer.matched; @@ -530,17 +534,17 @@ function prettyPrintRange(lexer, loc, context_loc) { var errpfx = (new Array(lineno_display_width + 1)).join('^'); if (lno === loc.first_line) { var offset = loc.first_column + 2; - var len = (lno === loc_last_line ? loc.last_column : line.length) - loc.first_column + 1; + var len = (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1; var lead = (new Array(offset)).join(' '); var mark = (new Array(len)).join('^'); line += '\n' + errpfx + lead + mark; - } else if (lno === loc_last_line) { + } else if (lno === loc.last_line) { var offset = 2 + 1; var len = loc.last_column + 1; var lead = (new Array(offset)).join(' '); var mark = (new Array(len)).join('^'); line += '\n' + errpfx + lead + mark; - } else if (lno > loc.first_line && lno < loc_last_line) { + } else if (lno > loc.first_line && lno < loc.last_line) { var offset = 2 + 1; var len = line.length + 1; var lead = (new Array(offset)).join(' '); @@ -554,6 +558,7 @@ function prettyPrintRange(lexer, loc, context_loc) { return rv.join('\n'); } + parser.warn = function p_warn() { console.warn.apply(console, arguments); }; From 79fac419db9afb98f99c8d96cde07ce92f7d213f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 31 Aug 2017 12:32:56 +0200 Subject: [PATCH 352/417] more error reporting detail for lex grammar coding mistakes by the user. --- lex.y | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/lex.y b/lex.y index e5c997a..ebf72a1 100644 --- a/lex.y +++ b/lex.y @@ -17,12 +17,14 @@ lex $$.macros = $definitions.macros; $$.startConditions = $definitions.startConditions; $$.unknownDecls = $definitions.unknownDecls; + // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { $$.options = yy.options; break; } + if (yy.actionInclude) { var asrc = yy.actionInclude.join('\n\n'); // Only a non-empty action code chunk should actually make it through: @@ -30,13 +32,23 @@ lex $$.actionInclude = asrc; } } + delete yy.options; delete yy.actionInclude; return $$; } | init definitions error EOF { - yyerror("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure:\n definitions %% rules [%% extra_module_code]\n\n Erroneous code:\n" + prettyPrintRange(yylexer, @error)); + yyerror(`Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: + + definitions + %% + rules + %% // <-- optional! + extra_module_code // <-- optional! + + Erroneous code: +` + prettyPrintRange(yylexer, @error)); } ; @@ -437,6 +449,16 @@ option { yy.options[$option] = parseValue($value); } | NAME[option] '=' NAME[value] { yy.options[$option] = parseValue($value); } + | NAME[option] '=' error + { + // TODO ... + yyerror(`internal error: option ${$option} value assignment failure.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error, @option)); + } + | error + { + // TODO ... + yyerror("expected a valid option name (with optional value assignment).\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error)); + } ; extra_lexer_module_code From f279006e382b9d146818416e86f8d8f18d7e32fc Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 31 Aug 2017 12:58:31 +0200 Subject: [PATCH 353/417] first part of fixing https://github.com/GerHobbelt/jison/issues/13; also adding ES6/ES2017 string template recognition support so we can better scan through action code chunks. --- lex.l | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lex.l b/lex.l index 2afb6dc..c0df045 100644 --- a/lex.l +++ b/lex.l @@ -19,8 +19,10 @@ BR \r\n|\n|\r WS [^\S\r\n] // Quoted string content: support *escaped* quotes inside strings: -QUOTED_STRING_CONTENT (?:\\\'|\\[^\']|[^\\\'])* -DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* +QUOTED_STRING_CONTENT (?:\\\'|\\[^\']|[^\\\'\r\n])* +DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"\r\n])* +// backquoted ES6/ES2017 string templates MAY span multiple lines: +ES2017_STRING_CONTENT (?:\\\`|\\[^\`]|[^\\\`])* // Accept any non-regex-special character as a direct literal without // the need to put quotes around it: From 9904d3a167f546b268303ee7e41d4d971c994641 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 31 Aug 2017 13:03:47 +0200 Subject: [PATCH 354/417] correcting the typo b0rkb0rkb0rk which is mentioned in the example for https://github.com/GerHobbelt/jison/issues/13 --- lex.y | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lex.y b/lex.y index ebf72a1..e501cbf 100644 --- a/lex.y +++ b/lex.y @@ -452,7 +452,10 @@ option | NAME[option] '=' error { // TODO ... - yyerror(`internal error: option ${$option} value assignment failure.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error, @option)); + yyerror(`internal error: option "${$option}" value assignment failure. + + Erroneous area: +` + prettyPrintRange(yylexer, @error, @option)); } | error { From ba20c96442923cffd4158f9708c16eed40abc331 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 1 Sep 2017 20:30:46 +0200 Subject: [PATCH 355/417] locking down intermediate development stage --- Makefile | 2 +- lex-parser.js | 3727 +++++++++++++++++++++++++------------------- lex.l | 459 ++++-- lex.y | 301 +++- tests/all-tests.js | 28 +- 5 files changed, 2728 insertions(+), 1789 deletions(-) diff --git a/Makefile b/Makefile index 67cd41b..cb6d125 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ endif $(JISON) -o lex-parser.js lex.y lex.l test: - node_modules/.bin/mocha tests/ + node_modules/.bin/mocha --timeout 18000 tests/ # increment the XXX number in the package.json file: version ..- diff --git a/lex-parser.js b/lex-parser.js index b97f10d..dd699e5 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-188 */ +/* parser generated by jison 0.6.0-189 */ /* * Returns a Parser object of the following structure: @@ -568,7 +568,7 @@ var parser = { // all actions are default: ......... false // uses yyleng: ..................... false // uses yylineno: ................... false - // uses yytext: ..................... false + // uses yytext: ..................... true // uses yylloc: ..................... false // uses ParseError API: ............. false // uses YYERROR: .................... true @@ -579,10 +579,10 @@ var parser = { // assigns rule values: ............. true // uses location tracking: .......... true // assigns location: ................ true - // uses yystack: .................... false - // uses yysstack: ................... false + // uses yystack: .................... true + // uses yysstack: ................... true // uses yysp: ....................... true - // uses yyrulelength: ............... false + // uses yyrulelength: ............... true // has error recovery: .............. true // // --------- END OF REPORT ----------- @@ -607,73 +607,79 @@ symbols_: { ",": 8, ".": 15, "/": 14, - "/!": 28, + "/!": 36, "<": 5, "=": 18, ">": 6, "?": 13, - "ACTION": 23, - "ACTION_BODY": 26, - "CHARACTER_LIT": 36, - "CODE": 43, + "ACTION": 29, + "ACTION_BODY": 30, + "ACTION_BODY_CPP_COMMENT": 32, + "ACTION_BODY_C_COMMENT": 31, + "ACTION_BODY_WHITESPACE": 33, + "ACTION_END": 28, + "ACTION_START": 25, + "BRACKET_MISSING": 26, + "BRACKET_SURPLUS": 27, + "CHARACTER_LIT": 44, + "CODE": 51, "EOF": 1, - "ESCAPE_CHAR": 33, - "INCLUDE": 41, + "ESCAPE_CHAR": 41, + "INCLUDE": 49, + "INCLUDE_PLACEMENT_ERROR": 34, "NAME": 20, - "NAME_BRACE": 29, - "OPTIONS": 37, - "OPTIONS_END": 38, - "OPTION_STRING_VALUE": 39, - "OPTION_VALUE": 40, - "PATH": 42, - "RANGE_REGEX": 34, - "REGEX_SET": 32, - "REGEX_SET_END": 31, - "REGEX_SET_START": 30, - "SPECIAL_GROUP": 27, - "START_COND": 25, + "NAME_BRACE": 37, + "OPTIONS": 45, + "OPTIONS_END": 46, + "OPTION_STRING_VALUE": 47, + "OPTION_VALUE": 48, + "PATH": 50, + "RANGE_REGEX": 42, + "REGEX_SET": 40, + "REGEX_SET_END": 39, + "REGEX_SET_START": 38, + "SPECIAL_GROUP": 35, + "START_COND": 24, "START_EXC": 22, "START_INC": 21, - "STRING_LIT": 35, - "UNKNOWN_DECL": 24, + "STRING_LIT": 43, + "UNKNOWN_DECL": 23, "^": 16, - "action": 55, - "action_body": 57, - "action_comments_body": 58, - "any_group_regex": 67, - "definition": 48, - "definitions": 47, + "action": 63, + "action_body": 64, + "any_group_regex": 73, + "definition": 56, + "definitions": 55, "error": 2, - "escape_char": 70, - "extra_lexer_module_code": 76, - "include_macro_code": 77, - "init": 46, - "lex": 44, - "module_code_chunk": 78, - "name_expansion": 66, - "name_list": 60, - "names_exclusive": 50, - "names_inclusive": 49, - "nonempty_regex_list": 63, - "option": 75, - "option_list": 74, - "optional_module_code_chunk": 79, - "options": 73, - "range_regex": 71, - "regex": 61, - "regex_base": 65, - "regex_concat": 64, - "regex_list": 62, - "regex_set": 68, - "regex_set_atom": 69, - "rule": 54, - "rule_block": 53, - "rules": 51, - "rules_and_epilogue": 45, - "rules_collective": 52, - "start_conditions": 59, - "string": 72, - "unbracketed_action_body": 56, + "escape_char": 76, + "extra_lexer_module_code": 82, + "include_macro_code": 83, + "init": 54, + "lex": 52, + "module_code_chunk": 84, + "name_expansion": 72, + "name_list": 66, + "names_exclusive": 58, + "names_inclusive": 57, + "nonempty_regex_list": 69, + "option": 81, + "option_list": 80, + "optional_module_code_chunk": 85, + "options": 79, + "range_regex": 77, + "regex": 67, + "regex_base": 71, + "regex_concat": 70, + "regex_list": 68, + "regex_set": 74, + "regex_set_atom": 75, + "rule": 62, + "rule_block": 61, + "rules": 59, + "rules_and_epilogue": 53, + "rules_collective": 60, + "start_conditions": 65, + "string": 78, "{": 3, "|": 9, "}": 4 @@ -701,27 +707,35 @@ terminals_: { 20: "NAME", 21: "START_INC", 22: "START_EXC", - 23: "ACTION", - 24: "UNKNOWN_DECL", - 25: "START_COND", - 26: "ACTION_BODY", - 27: "SPECIAL_GROUP", - 28: "/!", - 29: "NAME_BRACE", - 30: "REGEX_SET_START", - 31: "REGEX_SET_END", - 32: "REGEX_SET", - 33: "ESCAPE_CHAR", - 34: "RANGE_REGEX", - 35: "STRING_LIT", - 36: "CHARACTER_LIT", - 37: "OPTIONS", - 38: "OPTIONS_END", - 39: "OPTION_STRING_VALUE", - 40: "OPTION_VALUE", - 41: "INCLUDE", - 42: "PATH", - 43: "CODE" + 23: "UNKNOWN_DECL", + 24: "START_COND", + 25: "ACTION_START", + 26: "BRACKET_MISSING", + 27: "BRACKET_SURPLUS", + 28: "ACTION_END", + 29: "ACTION", + 30: "ACTION_BODY", + 31: "ACTION_BODY_C_COMMENT", + 32: "ACTION_BODY_CPP_COMMENT", + 33: "ACTION_BODY_WHITESPACE", + 34: "INCLUDE_PLACEMENT_ERROR", + 35: "SPECIAL_GROUP", + 36: "/!", + 37: "NAME_BRACE", + 38: "REGEX_SET_START", + 39: "REGEX_SET_END", + 40: "REGEX_SET", + 41: "ESCAPE_CHAR", + 42: "RANGE_REGEX", + 43: "STRING_LIT", + 44: "CHARACTER_LIT", + 45: "OPTIONS", + 46: "OPTIONS_END", + 47: "OPTION_STRING_VALUE", + 48: "OPTION_VALUE", + 49: "INCLUDE", + 50: "PATH", + 51: "CODE" }, TERROR: 2, EOF: 1, @@ -815,70 +829,66 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do }, productions_: bp({ pop: u([ - 44, - 44, - s, - [45, 3], - 46, - 47, - 47, - s, - [48, 9], - 49, - 49, - 50, - 50, - 51, - 51, + 52, + 52, s, - [52, 4], - 53, - 53, + [53, 3], 54, - 54, - s, - [55, 4], - 56, - 56, + 55, + 55, s, - [57, 3], + [56, 6], + 57, + 57, 58, 58, + 59, + 59, s, - [59, 4], - 60, - 60, + [60, 4], + 61, 61, 62, 62, s, [63, 3], - 64, - 64, s, - [65, 17], + [64, 9], + s, + [65, 4], + 66, 66, 67, - 67, - 68, - 68, - 69, s, - [69, 4, 1], + [68, 4], + s, + [69, 4], + 70, + 70, + s, + [71, 17], 72, 73, + 73, 74, 74, + 75, s, - [75, 4], - 76, - 76, - 77, - 77, - 78, + [75, 4, 1], 78, 79, - 79 + 80, + 80, + s, + [81, 6], + 82, + 82, + 83, + 83, + s, + [84, 3], + 85, + 85 ]), rule: u([ s, @@ -890,40 +900,36 @@ productions_: bp({ 0, s, [2, 3], - 3, - 3, s, - [1, 5], + [1, 4], 2, 1, 2, c, - [15, 3], + [12, 3], 4, 4, 3, c, - [21, 4], - c, - [20, 5], - 2, - 1, - 5, - 4, + [18, 4], + s, + [3, 3], + s, + [2, 8], 0, - c, - [11, 3], - 3, + s, + [3, 3], 0, 1, - c, - [15, 3], - 0, 3, - c, - [34, 3], 1, s, + [3, 4, -1], + c, + [21, 3], + c, + [40, 3], + s, [3, 4], s, [2, 5], @@ -938,15 +944,15 @@ productions_: bp({ c, [9, 3], s, - [3, 3], + [3, 4], c, - [8, 3], + [10, 4], c, - [30, 4], + [32, 5], 0 ]) }), -performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyrulelength, yyvstack, yylstack) { +performAction: function parser__PerformAction(yytext, yyloc, yystate /* action[1] */, yysp, yyrulelength, yyvstack, yylstack, yystack, yysstack) { /* this == yyval */ @@ -971,12 +977,14 @@ case 1: this.$.macros = yyvstack[yysp - 2].macros; this.$.startConditions = yyvstack[yysp - 2].startConditions; this.$.unknownDecls = yyvstack[yysp - 2].unknownDecls; + // if there are any options, add them all, otherwise set options to NULL: // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: for (var k in yy.options) { this.$.options = yy.options; break; } + if (yy.actionInclude) { var asrc = yy.actionInclude.join('\n\n'); // Only a non-empty action code chunk should actually make it through: @@ -984,6 +992,7 @@ case 1: this.$.actionInclude = asrc; } } + delete yy.options; delete yy.actionInclude; return this.$; @@ -991,7 +1000,19 @@ case 1: case 2: /*! Production:: lex : init definitions error EOF */ - yyparser.yyError("Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure:\n definitions %% rules [%% extra_module_code]\n\nErroneous code:\n" + prettyPrintRange(yylexer, yylstack[yysp - 1])); + yyparser.yyError(rmCommonWS` + Maybe you did not correctly separate the lexer sections with a '%%' + on an otherwise empty line? + The lexer spec file should have this structure: + + definitions + %% + rules + %% // <-- optional! + extra_module_code // <-- optional! + + Erroneous code: + ` + prettyPrintRange(yylexer, yylstack[yysp - 1])); break; case 3: @@ -1020,17 +1041,17 @@ case 6: break; case 7: - /*! Production:: definitions : definition definitions */ - this.$ = yyvstack[yysp]; - if (yyvstack[yysp - 1] != null) { - if ('length' in yyvstack[yysp - 1]) { - this.$.macros[yyvstack[yysp - 1][0]] = yyvstack[yysp - 1][1]; - } else if (yyvstack[yysp - 1].type === 'names') { - for (var name in yyvstack[yysp - 1].names) { - this.$.startConditions[name] = yyvstack[yysp - 1].names[name]; + /*! Production:: definitions : definitions definition */ + this.$ = yyvstack[yysp - 1]; + if (yyvstack[yysp] != null) { + if ('length' in yyvstack[yysp]) { + this.$.macros[yyvstack[yysp][0]] = yyvstack[yysp][1]; + } else if (yyvstack[yysp].type === 'names') { + for (var name in yyvstack[yysp].names) { + this.$.startConditions[name] = yyvstack[yysp].names[name]; } - } else if (yyvstack[yysp - 1].type === 'unknown') { - this.$.unknownDecls.push(yyvstack[yysp - 1].body); + } else if (yyvstack[yysp].type === 'unknown') { + this.$.unknownDecls.push(yyvstack[yysp].body); } } break; @@ -1046,7 +1067,7 @@ case 8: case 9: /*! Production:: definition : NAME regex */ -case 30: +case 27: /*! Production:: rule : regex action */ this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; @@ -1055,91 +1076,79 @@ case 10: /*! Production:: definition : START_INC names_inclusive */ case 11: /*! Production:: definition : START_EXC names_exclusive */ -case 34: - /*! Production:: action : unbracketed_action_body */ -case 35: - /*! Production:: action : include_macro_code */ -case 38: - /*! Production:: action_body : action_comments_body */ -case 81: - /*! Production:: escape_char : ESCAPE_CHAR */ +case 50: + /*! Production:: regex_list : regex_concat */ +case 55: + /*! Production:: nonempty_regex_list : regex_concat */ +case 57: + /*! Production:: regex_concat : regex_base */ case 82: + /*! Production:: escape_char : ESCAPE_CHAR */ +case 83: /*! Production:: range_regex : RANGE_REGEX */ -case 92: +case 95: /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 96: +case 99: /*! Production:: module_code_chunk : CODE */ -case 98: +case 102: /*! Production:: optional_module_code_chunk : module_code_chunk */ this.$ = yyvstack[yysp]; break; case 12: - /*! Production:: definition : "{" action_body "}" */ - yy.actionInclude.push(yyvstack[yysp - 1]); this.$ = null; - break; - -case 13: - /*! Production:: definition : "{" action_body error */ - yyparser.yyError("Seems you did not correctly bracket the lexer preparatory action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); - break; - -case 14: - /*! Production:: definition : ACTION */ -case 15: - /*! Production:: definition : include_macro_code */ + /*! Production:: definition : action */ yy.actionInclude.push(yyvstack[yysp]); this.$ = null; break; -case 16: +case 13: /*! Production:: definition : options */ -case 85: - /*! Production:: options : OPTIONS option_list OPTIONS_END */ case 86: - /*! Production:: option_list : option option_list */ + /*! Production:: options : OPTIONS option_list OPTIONS_END */ case 87: + /*! Production:: option_list : option option_list */ +case 88: /*! Production:: option_list : option */ this.$ = null; break; -case 17: +case 14: /*! Production:: definition : UNKNOWN_DECL */ this.$ = {type: 'unknown', body: yyvstack[yysp]}; break; -case 18: +case 15: /*! Production:: names_inclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; break; -case 19: +case 16: /*! Production:: names_inclusive : names_inclusive START_COND */ this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; break; -case 20: +case 17: /*! Production:: names_exclusive : START_COND */ this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; break; -case 21: +case 18: /*! Production:: names_exclusive : names_exclusive START_COND */ this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; break; -case 22: +case 19: /*! Production:: rules : rules rules_collective */ this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; -case 23: +case 20: /*! Production:: rules : ε */ -case 29: +case 26: /*! Production:: rule_block : ε */ this.$ = []; break; -case 24: +case 21: /*! Production:: rules_collective : start_conditions rule */ if (yyvstack[yysp - 1]) { yyvstack[yysp].unshift(yyvstack[yysp - 1]); @@ -1147,7 +1156,7 @@ case 24: this.$ = [yyvstack[yysp]]; break; -case 25: +case 22: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ if (yyvstack[yysp - 3]) { yyvstack[yysp - 1].forEach(function (d) { @@ -1157,133 +1166,167 @@ case 25: this.$ = yyvstack[yysp - 1]; break; -case 26: +case 23: /*! Production:: rules_collective : start_conditions "{" error "}" */ - yyparser.yyError("Seems you made a mistake while specifying one of the lexer rules inside the start condition <" + yyvstack[yysp - 3].join(',') + "> { rules... } block.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])); + yyparser.yyError(rmCommonWS` + Seems you made a mistake while specifying one of the lexer rules inside + the start condition + <${yyvstack[yysp - 3].join(',')}> { rules... } + block. + + Erroneous area: + ` + prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])); break; -case 27: +case 24: /*! Production:: rules_collective : start_conditions "{" error */ - yyparser.yyError("Seems you did not correctly bracket a lexer rules set inside the start condition <" + yyvstack[yysp - 2].join(',') + "> { rules... } as a terminating curly brace '}' could not be found.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lexer rules set inside + the start condition + <${yyvstack[yysp - 2].join(',')}> { rules... } + as a terminating curly brace '}' could not be found. + + Erroneous area: + ` + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; -case 28: +case 25: /*! Production:: rule_block : rule_block rule */ this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); break; -case 31: +case 28: /*! Production:: rule : regex error */ this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + console.log('############# DUMP:', { + yysp, + yyrulelength, + yyvstack, + yystack, + yysstack, + error: yyvstack[yysp], + text: yytext + }); yyparser.yyError("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; -case 32: - /*! Production:: action : "{" action_body "}" */ -case 43: - /*! Production:: start_conditions : "<" name_list ">" */ - this.$ = yyvstack[yysp - 1]; +case 29: + /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ + yyparser.yyError("Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; -case 33: - /*! Production:: action : "{" action_body error */ - yyparser.yyError("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); +case 30: + /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ + yyparser.yyError("Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + break; + +case 31: + /*! Production:: action : ACTION_START action_body ACTION_END */ + if (0) { + this.$ = 'XXX' + yyvstack[yysp - 1] + 'YYY'; + } else { + var s = yyvstack[yysp - 1].trim(); + // remove outermost set of braces UNLESS there's + // a curly brace in there anywhere: in that case + // we should leave it up to the sophisticated + // code analyzer to simplify the code! + // + // This is a very rough check as it ill also look + // inside code comments, which should not have + // any influence. + // + // Nevertheless: this is a *safe* transform! + if (s[0] === '{' && s.indexOf('}') === s.length - 1) { + this.$ = s.substring(1, s.length - 1).trim(); + } else { + this.$ = s; + } + } + break; + +case 32: + /*! Production:: action_body : action_body ACTION */ +case 37: + /*! Production:: action_body : action_body include_macro_code */ + this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; break; +case 33: + /*! Production:: action_body : action_body ACTION_BODY */ +case 34: + /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ +case 35: + /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ case 36: - /*! Production:: unbracketed_action_body : ACTION */ -case 50: - /*! Production:: regex_list : nonempty_regex_list */ -case 54: - /*! Production:: nonempty_regex_list : regex_concat */ + /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ case 56: - /*! Production:: regex_concat : regex_base */ -case 66: - /*! Production:: regex_base : name_expansion */ + /*! Production:: regex_concat : regex_concat regex_base */ case 68: - /*! Production:: regex_base : any_group_regex */ -case 72: - /*! Production:: regex_base : string */ -case 73: - /*! Production:: regex_base : escape_char */ -case 74: - /*! Production:: name_expansion : NAME_BRACE */ + /*! Production:: regex_base : regex_base range_regex */ case 78: - /*! Production:: regex_set : regex_set_atom */ -case 79: - /*! Production:: regex_set_atom : REGEX_SET */ -case 84: - /*! Production:: string : CHARACTER_LIT */ - // default action (generated by JISON): - this.$ = yyvstack[yysp]; - this._$ = yylstack[yysp]; + /*! Production:: regex_set : regex_set regex_set_atom */ +case 100: + /*! Production:: module_code_chunk : module_code_chunk CODE */ + this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 37: - /*! Production:: unbracketed_action_body : unbracketed_action_body ACTION */ - this.$ = yyvstack[yysp - 1] + '\n' + yyvstack[yysp]; +case 38: + /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ + yyparser.yyError("" + + " You may place the '%include' instruction only at the start/front of" + + " a line. " + + "" + + " It's use is not permitted at this position:" + + "" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; case 39: - /*! Production:: action_body : action_body "{" action_body "}" action_comments_body */ - this.$ = yyvstack[yysp - 4] + yyvstack[yysp - 3] + yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + /*! Production:: action_body : action_body error */ + yyparser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; case 40: - /*! Production:: action_body : action_body "{" action_body error */ - yyparser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 3])); - break; - -case 41: - /*! Production:: action_comments_body : ε */ + /*! Production:: action_body : ε */ case 51: /*! Production:: regex_list : ε */ -case 99: +case 103: /*! Production:: optional_module_code_chunk : ε */ this.$ = ''; break; -case 42: - /*! Production:: action_comments_body : action_comments_body ACTION_BODY */ -case 55: - /*! Production:: regex_concat : regex_concat regex_base */ -case 67: - /*! Production:: regex_base : regex_base range_regex */ -case 77: - /*! Production:: regex_set : regex_set_atom regex_set */ -case 97: - /*! Production:: module_code_chunk : module_code_chunk CODE */ - this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; +case 41: + /*! Production:: start_conditions : "<" name_list ">" */ + this.$ = yyvstack[yysp - 1]; break; -case 44: +case 42: /*! Production:: start_conditions : "<" name_list error */ yyparser.yyError("Seems you did not correctly terminate the start condition set <" + yyvstack[yysp - 1].join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; -case 45: +case 43: /*! Production:: start_conditions : "<" "*" ">" */ this.$ = ['*']; break; -case 46: +case 44: /*! Production:: start_conditions : ε */ // default action (generated by JISON): this.$ = undefined; this._$ = undefined; break; -case 47: +case 45: /*! Production:: name_list : NAME */ this.$ = [yyvstack[yysp]]; break; -case 48: +case 46: /*! Production:: name_list : name_list "," NAME */ this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; -case 49: +case 47: /*! Production:: regex : nonempty_regex_list */ // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' @@ -1348,86 +1391,116 @@ case 49: } break; +case 48: + /*! Production:: regex_list : regex_list "|" regex_concat */ case 52: - /*! Production:: nonempty_regex_list : regex_concat "|" regex_list */ + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; +case 49: + /*! Production:: regex_list : regex_list "|" */ case 53: - /*! Production:: nonempty_regex_list : "|" regex_list */ + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ + this.$ = yyvstack[yysp - 1] + '|'; + break; + +case 54: + /*! Production:: nonempty_regex_list : "|" regex_concat */ this.$ = '|' + yyvstack[yysp]; break; -case 57: +case 58: /*! Production:: regex_base : "(" regex_list ")" */ this.$ = '(' + yyvstack[yysp - 1] + ')'; break; -case 58: +case 59: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; -case 59: - /*! Production:: regex_base : "(" regex_list error */ case 60: + /*! Production:: regex_base : "(" regex_list error */ +case 61: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; -case 61: +case 62: /*! Production:: regex_base : regex_base "+" */ this.$ = yyvstack[yysp - 1] + '+'; break; -case 62: +case 63: /*! Production:: regex_base : regex_base "*" */ this.$ = yyvstack[yysp - 1] + '*'; break; -case 63: +case 64: /*! Production:: regex_base : regex_base "?" */ this.$ = yyvstack[yysp - 1] + '?'; break; -case 64: +case 65: /*! Production:: regex_base : "/" regex_base */ this.$ = '(?=' + yyvstack[yysp] + ')'; break; -case 65: +case 66: /*! Production:: regex_base : "/!" regex_base */ this.$ = '(?!' + yyvstack[yysp] + ')'; break; +case 67: + /*! Production:: regex_base : name_expansion */ case 69: + /*! Production:: regex_base : any_group_regex */ +case 73: + /*! Production:: regex_base : string */ +case 74: + /*! Production:: regex_base : escape_char */ +case 75: + /*! Production:: name_expansion : NAME_BRACE */ +case 79: + /*! Production:: regex_set : regex_set_atom */ +case 80: + /*! Production:: regex_set_atom : REGEX_SET */ +case 85: + /*! Production:: string : CHARACTER_LIT */ + // default action (generated by JISON): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + break; + +case 70: /*! Production:: regex_base : "." */ this.$ = '.'; break; -case 70: +case 71: /*! Production:: regex_base : "^" */ this.$ = '^'; break; -case 71: +case 72: /*! Production:: regex_base : "$" */ this.$ = '$'; break; -case 75: +case 76: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 93: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk include_macro_code extra_lexer_module_code */ +case 96: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 76: +case 77: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ yyparser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; -case 80: +case 81: /*! Production:: regex_set_atom : name_expansion */ if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) && yyvstack[yysp].toUpperCase() !== yyvstack[yysp] @@ -1440,29 +1513,49 @@ case 80: //this.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 83: +case 84: /*! Production:: string : STRING_LIT */ this.$ = prepareString(yyvstack[yysp]); break; -case 88: +case 89: /*! Production:: option : NAME */ yy.options[yyvstack[yysp]] = true; break; -case 89: +case 90: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; -case 90: - /*! Production:: option : NAME "=" OPTION_VALUE */ case 91: + /*! Production:: option : NAME "=" OPTION_VALUE */ +case 92: /*! Production:: option : NAME "=" NAME */ yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; +case 93: + /*! Production:: option : NAME "=" error */ + // TODO ... + yyparser.yyError(rmCommonWS` + internal error: option "${$option}" value assignment failure. + + Erroneous area: + ` + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + break; + case 94: + /*! Production:: option : error */ + // TODO ... + yyparser.yyError(rmCommonWS` + expected a valid option name (with optional value assignment). + + Erroneous area: + ` + prettyPrintRange(yylexer, yylstack[yysp])); + break; + +case 97: /*! Production:: include_macro_code : INCLUDE PATH */ var fs = require('fs'); var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); @@ -1470,382 +1563,382 @@ case 94: this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; -case 95: +case 98: /*! Production:: include_macro_code : INCLUDE error */ - yyparser.yyError("%include MUST be followed by a valid file path\n\n Erroneous path:\n" + prettyPrintRange(yylexer, yylstack[yysp])); + yyparser.yyError(rmCommonWS` + %include MUST be followed by a valid file path. + + Erroneous path: + ` + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; -case 100: +case 101: + /*! Production:: module_code_chunk : error */ + // TODO ... + yyparser.yyError(rmCommonWS` + module code declaration error? + + Erroneous area: + ` + prettyPrintRange(yylexer, yylstack[yysp])); + break; + +case 129: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. + var yye_values = yyvstack.slice(yysp - yyrulelength, yysp + 1); + var yye_symbols = yystack.slice(yysp - yyrulelength, yysp + 1); + $$ = { + values: yye_values, + symbols: yye_symbols + }; + console.log('############# COMBINE:', { + yysp, + yyrulelength, + yyvstack, + yystack, + yysstack + }); + break; } }, table: bt({ len: u([ + 11, + 1, + 10, 13, 1, - 15, - 4, - 15, + 1, + 9, + 18, 21, 2, 2, - 6, s, - [11, 4], - 2, - 3, + [9, 3], + 12, + 4, 1, 1, + 19, + 9, + 10, 18, - 3, - 11, - 11, - 30, - 33, - 30, - 23, - 23, + 27, + 28, + 22, + 22, 17, 17, s, - [29, 7], - 31, + [27, 7], + 29, 5, s, - [29, 3], + [27, 3], s, - [12, 4], - 3, - 4, - 27, - 27, - 1, - 4, - c, - [36, 3], - 19, - 33, - 30, - 12, - 12, - s, - [29, 5], - 2, - 2, - 30, - 30, - 2, - 7, - 4, - 4, + [10, 4], 12, - 12, - 11, - 11, - 6, - 4, - 11, 1, + 5, + 4, 3, - 6, + 7, 17, 23, 3, - c, - [27, 6], - 29, - 2, + 28, + 27, + 28, + s, + [27, 5], + 3, + 20, 3, + 28, + 28, + 6, s, - [2, 3], + [4, 3], + 10, + 10, + s, + [25, 3], + s, + [11, 8], + 2, + 9, 1, + 4, + 3, + 2, s, [3, 3], 17, 16, - 7, 3, - 1, 3, - 5, + 1, 3, + s, + [27, 3], + 21, + s, + [27, 4], + 4, + 13, + 13, + s, + [3, 4], 6, 3, 23, s, [18, 3], - 6, - 19, - 18, - 19, 14, 14, 1, 14, - 4, - 1, + 20, + 2, 17, 14, 17, - 3, - 19, - 3, - 18, - 18 + 3 ]), symbol: u([ 1, 2, - 3, s, - [19, 6, 1], - 37, - 41, - 44, - 46, + [19, 5, 1], + 25, + 45, + 52, + 54, 1, c, - [14, 11], - 47, - 48, - 73, - 77, - 1, - 2, - 19, - 45, + [12, 9], + 55, c, - [19, 15], + [10, 9], + 53, + 56, + 63, + 79, + s, + [1, 3], + c, + [15, 8], + 1, + 3, + 5, 9, 10, s, [14, 4, 1], + 19, s, - [27, 4, 1], - 33, - 35, - 36, - 61, + [35, 4, 1], + 41, + 43, + 44, + 59, + c, + [15, 6], + c, + [14, 7], + 67, s, - [63, 5, 1], - 70, - 72, - 25, - 49, - 25, - 50, - 2, - 3, - 4, - 26, + [69, 5, 1], + 76, + 78, + 24, 57, + 24, 58, c, - [46, 11], + [52, 10], c, - [11, 33], + [9, 17], + 2, + s, + [26, 9, 1], + 49, + 64, 2, - 42, 20, - 74, - 75, + 80, + 81, s, [1, 3], - 3, - 5, - c, - [85, 6], - 19, c, - [86, 7], - 51, - c, - [119, 3], + [88, 16], + 60, + 65, c, - [61, 25], + [55, 11], 9, - 10, - 11, c, - [44, 5], + [10, 7], c, - [18, 5], + [107, 12], c, - [49, 7], - 37, - 41, + [105, 6], c, - [134, 5], + [28, 3], c, - [30, 25], - s, - [62, 6, 1], + [55, 6], c, [33, 5], + c, + [27, 7], + 45, + c, + [27, 7], 7, s, [9, 9, 1], c, - [36, 11], + [31, 11], s, - [34, 4, 1], - 41, - 71, - 2, + [42, 4, 1], + 77, c, - [61, 7], + [54, 3], + 11, c, - [55, 7], + [76, 11], + 68, c, - [53, 8], + [77, 6], c, - [23, 23], + [22, 22], c, - [263, 12], + [117, 12], c, [17, 22], c, - [110, 29], + [106, 27], c, - [29, 197], + [27, 184], s, - [31, 7, 1], - 41, - 29, - 32, - 66, - 68, - 69, + [39, 7, 1], + 37, + 40, + 72, + 74, + 75, c, - [123, 90], + [115, 83], s, [19, 7, 1], c, - [12, 38], - c, - [647, 3], - c, - [650, 4], - s, - [1, 5, 1], - c, - [599, 7], + [10, 31], c, - [525, 14], - 43, - c, - [27, 27], - 38, + [551, 11], + 83, + 46, + 2, 20, - 38, - 74, - 75, + 46, + 80, + 81, + 2, 18, 20, - 38, c, - [661, 19], - 52, - 59, - c, - [607, 63], - c, - [30, 3], - 11, - c, - [712, 11], - c, - [12, 12], - c, - [493, 142], - 2, - 11, + [9, 4], + 1, 2, - 11, - c, - [203, 33], + 49, + 51, + 82, + 84, + 85, c, - [840, 28], - 31, - 2, - 29, - 31, + [565, 17], + 3, c, - [530, 4], + [653, 13], + 62, c, - [7, 4], + [654, 8], + 7, + 20, + 66, c, - [4, 4], + [552, 22], c, - [439, 33], + [580, 61], c, - [1046, 14], + [448, 135], + 2, + 9, + 11, c, - [1096, 5], + [696, 15], c, - [452, 7], + [716, 7], + 11, c, - [21, 8], - 38, - 20, + [189, 55], + 77, + 2, + 37, 39, 40, - 1, - 41, - 43, - 76, - 78, - 79, + 72, + 75, c, - [409, 17], + [6, 4], c, - [405, 3], + [4, 8], c, - [890, 11], - 54, + [423, 22], + 3, + 4, c, - [1171, 8], - 7, - 20, - 60, + [383, 8], c, - [358, 157], + [313, 13], c, - [387, 30], - 31, + [25, 50], c, - [256, 3], - 20, + [488, 11], c, - [654, 3], + [11, 78], + 50, c, - [651, 4], - 41, - 77, + [1092, 9], c, - [250, 3], + [566, 3], + 47, + 48, + 1, + 49, + 83, + 1, + 49, + 1, + 49, + 51, c, - [3, 4], + [3, 7], c, - [250, 16], + [574, 16], 2, 4, c, - [251, 13], - 53, + [575, 13], + 61, 2, - 3, - 23, - 41, - 55, - 56, - 77, + 25, + 63, 2, 6, 8, @@ -1853,149 +1946,155 @@ table: bt({ c, [4, 3], c, - [322, 4], + [546, 54], c, - [327, 4], + [437, 29], c, - [311, 7], - 41, - 43, + [434, 13], c, - [46, 14], + [648, 8], c, - [297, 9], - 1, + [566, 107], c, - [782, 10], + [470, 5], c, - [27, 7], + [299, 10], + 51, c, - [18, 36], + [13, 13], c, - [1518, 7], + [867, 3], c, - [24, 10], - 23, + [3, 9], c, - [61, 36], + [876, 4], c, - [37, 8], + [875, 3], + 49, + 51, c, - [436, 14], + [286, 14], c, - [14, 14], - 20, + [861, 9], + 1, c, - [15, 14], + [469, 10], + c, + [27, 7], c, - [521, 5], + [18, 36], c, - [251, 17], + [938, 14], c, - [204, 14], + [14, 14], + 20, c, - [282, 18], + [15, 14], c, - [247, 3], + [734, 20], c, - [118, 18], + [455, 3], c, - [277, 3], + [446, 16], c, - [219, 36] + [159, 14], + c, + [477, 18], + 6, + 8 ]), type: u([ s, - [2, 11], + [2, 9], 0, 0, 1, c, - [14, 13], - 0, - 0, - c, - [7, 4], - c, - [19, 18], - c, - [17, 14], + [12, 10], c, - [21, 5], + [22, 11], 0, c, - [40, 6], + [13, 10], + s, + [2, 19], c, - [31, 15], + [29, 14], s, - [2, 34], + [0, 8], + c, + [23, 3], c, - [49, 21], + [54, 29], c, - [69, 48], + [64, 13], c, - [137, 8], + [97, 21], c, - [30, 30], + [118, 30], c, - [33, 28], + [107, 9], c, - [118, 20], + [28, 27], c, - [53, 23], + [181, 41], c, - [23, 20], + [183, 9], + c, + [22, 34], c, [17, 34], s, - [2, 224], + [2, 208], + c, + [223, 135], + c, + [133, 5], c, - [239, 202], + [139, 13], c, - [201, 24], + [153, 34], + s, + [0, 9], c, - [607, 80], + [497, 18], c, - [291, 188], + [580, 83], c, - [30, 36], + [435, 141], c, - [530, 61], + [284, 32], c, - [389, 26], + [217, 33], c, - [85, 32], - s, - [0, 9], + [725, 215], c, - [370, 203], + [214, 44], c, - [201, 39], + [567, 26], c, - [1410, 7], + [1020, 81], c, - [1457, 13], + [648, 28], c, - [311, 26], + [594, 134], c, - [297, 11], + [861, 28], c, - [422, 80], + [734, 145], s, - [2, 191] + [2, 23] ]), state: u([ s, [1, 4, 1], + 6, 11, - 10, - 15, + 12, 18, - c, - [5, 3], 19, 20, - 21, + 22, 23, 28, 29, @@ -2005,183 +2104,174 @@ table: bt({ 42, 44, 45, - 48, - 49, - 53, - 55, + 46, + 50, + 51, + 54, c, - [12, 4], - 56, - 57, + [13, 5], + 55, c, - [20, 6], + [5, 4], + 59, 61, + 62, + c, + [13, 5], 63, c, - [9, 7], + [7, 6], 64, c, - [8, 7], + [5, 4], 65, c, [5, 4], + 69, 66, - c, - [5, 4], - 70, 67, - 68, - 78, - 49, - 81, - 82, - 84, - c, - [42, 8], - 61, - 61, - 70, - 91, - 68, + 80, + 85, + 46, + 87, + 89, + 88, 92, - 45, - 96, + 94, + c, + [61, 7], + 95, 98, - 97, - 100, - 102, c, - [82, 7], - 103, - 108, - 110, - 112, + [55, 11], + c, + [6, 6], + 59, + 69, + 106, + 113, 115, - 116, - 122, + 117, + c, + [12, 5], 123, - 98, - 97, - 125, c, - [19, 8], - 127, - 45 + [29, 5], + 89, + 124, + 126, + c, + [47, 8], + c, + [22, 5] ]), mode: u([ s, - [2, 13], - 1, - 2, + [2, 19], s, - [1, 7], - c, - [8, 3], - c, - [14, 11], + [1, 10], + s, + [2, 26], s, [1, 15], s, - [2, 48], + [2, 38], + c, + [40, 6], c, - [53, 50], + [45, 7], c, - [129, 5], + [52, 19], c, - [52, 8], + [19, 8], + c, + [90, 15], c, - [118, 12], + [98, 11], c, - [25, 26], + [21, 11], c, - [29, 6], + [80, 9], c, - [71, 15], + [65, 17], + 1, c, - [52, 12], + [65, 12], c, - [218, 11], + [15, 15], s, - [1, 35], + [1, 24], s, - [2, 234], + [2, 218], c, - [236, 98], + [220, 90], c, - [97, 24], + [89, 20], c, - [24, 15], - c, - [374, 6], + [20, 13], c, - [142, 55], + [355, 16], c, - [470, 4], + [506, 9], c, - [86, 13], + [58, 18], c, - [72, 11], + [400, 19], c, - [565, 52], + [503, 21], c, - [446, 170], + [525, 49], c, - [310, 9], + [388, 135], c, - [202, 25], + [648, 19], c, - [29, 26], + [708, 31], c, - [310, 5], + [27, 23], c, - [241, 75], + [685, 199], c, - [141, 5], + [197, 12], c, - [80, 18], + [211, 5], c, - [861, 204], + [1051, 12], c, - [191, 11], + [618, 32], c, - [236, 21], + [947, 12], c, - [728, 21], + [550, 22], c, - [246, 17], + [720, 55], c, - [403, 6], + [1041, 162], c, - [276, 14], + [297, 6], c, - [279, 67], + [857, 23], c, - [346, 73], + [986, 90], c, - [452, 19], - c, - [298, 60], - s, - [2, 50] + [283, 66] ]), goto: u([ s, - [6, 11], + [6, 9], s, - [8, 4], + [8, 9], 5, - 6, - 7, - 9, - 12, - 14, - 13, 5, - 16, - 17, - c, - [14, 11], - 22, + s, + [7, 4, 1], + s, + [13, 5, 1], + s, + [7, 9], + s, + [20, 17], + 21, 24, 26, 30, @@ -2197,348 +2287,363 @@ table: bt({ 41, 43, s, - [41, 4], - s, - [14, 11], + [12, 9], s, - [15, 11], + [13, 9], s, - [16, 11], + [14, 9], s, - [17, 11], + [40, 11], + 48, 47, - 46, - 50, - 51, + 1, + 2, + 4, + 44, 52, s, - [23, 17], - s, - [7, 3], - s, - [9, 11], + [44, 6], + 49, s, - [49, 11], + [44, 7], s, - [54, 4], - 24, - 54, - c, - [114, 4], + [9, 9], + 47, + 47, + 53, s, - [54, 6], + [47, 7], c, - [120, 7], - 54, - 54, + [92, 12], s, - [51, 3], - 22, - 24, - 51, + [55, 3], c, - [25, 4], + [15, 5], s, - [51, 6], + [55, 6], c, - [25, 7], - 51, - 51, - s, - [56, 3], - 59, + [21, 8], s, - [56, 3], + [57, 6], + 56, 58, - 60, s, - [56, 15], - 62, + [57, 15], + 60, s, - [56, 4], - c, - [52, 8], + [57, 3], + 51, + 51, + 24, + 51, c, - [46, 8], + [64, 11], c, - [15, 14], + [15, 15], c, - [218, 12], + [91, 12], c, [12, 12], s, - [66, 29], + [67, 27], s, - [68, 29], + [69, 27], s, - [69, 29], + [70, 27], s, - [70, 29], + [71, 27], s, - [71, 29], + [72, 27], s, - [72, 29], + [73, 27], s, - [73, 29], + [74, 27], s, - [74, 31], + [75, 29], 35, - 69, + 68, s, - [83, 29], + [84, 27], s, - [84, 29], + [85, 27], s, - [81, 29], + [82, 27], s, - [10, 9], - 71, + [10, 7], + 70, 10, 10, s, - [18, 12], + [15, 10], s, - [11, 9], - 72, + [11, 7], + 71, 11, 11, s, - [20, 12], - 74, - 75, - 73, - s, - [38, 3], - 76, - s, - [94, 27], + [17, 10], + 82, s, - [95, 27], - 77, - 50, - 87, - 79, - 88, - 88, - 1, - 2, - 4, - 46, + [72, 8, 1], + 81, 83, + 84, + 48, + 47, + 88, + 89, + 86, + 89, + 89, s, - [46, 6], - 80, + [94, 3], + 103, + 91, + 103, + 90, s, - [46, 7], + [19, 17], + 93, c, - [565, 25], + [593, 13], + 96, + 97, s, - [55, 3], - 59, + [53, 3], + c, + [17, 5], s, - [55, 3], - 58, - 60, + [53, 6], + c, + [23, 7], + 53, s, - [55, 15], - 62, + [54, 3], + c, + [22, 5], s, - [55, 4], + [54, 6], + c, + [22, 7], + 54, + 56, + 56, + 57, s, - [53, 12], + [56, 4], + 58, s, - [50, 12], + [56, 15], + 60, s, - [61, 29], + [56, 3], s, - [62, 29], + [62, 27], s, - [63, 29], + [63, 27], s, - [67, 29], + [64, 27], s, - [82, 29], - 86, - 85, - 88, - 87, + [68, 27], s, - [64, 3], - 59, + [83, 27], + 100, + 101, + 99, + 50, + 50, + 24, + 50, + c, + [226, 11], + 103, + 101, + 102, + 65, + 65, + 57, s, - [64, 3], + [65, 3], + 56, 58, - 60, - s, - [64, 15], - 62, s, - [64, 4], + [65, 15], + 60, s, [65, 3], - 59, + 66, + 66, + 57, s, - [65, 3], + [66, 3], + 56, 58, - 60, s, - [65, 15], - 62, + [66, 15], + 60, s, - [65, 4], - 90, - 89, - 78, + [66, 3], + 105, 35, - 78, - 69, + 104, + 68, s, [79, 4], s, [80, 4], s, - [19, 12], - s, - [21, 12], + [81, 4], s, - [12, 11], + [16, 10], s, - [13, 11], + [18, 10], s, - [41, 4], + [29, 25], s, - [42, 4], - s, - [85, 11], - 86, - 95, - 93, - 94, + [30, 25], s, - [99, 3], + [31, 25], s, - [22, 17], - 101, - c, - [1089, 13], - 104, - 105, + [32, 11], s, - [52, 12], + [33, 11], s, - [57, 29], + [34, 11], s, - [59, 29], + [35, 11], s, - [58, 29], + [36, 11], s, - [60, 29], + [37, 11], s, - [75, 29], + [38, 11], s, - [76, 29], - 77, - 77, + [39, 11], + 108, 107, - 75, - 106, - 89, - 89, - 90, - 90, - 91, - 91, - 3, - 92, - 13, - 98, - 98, + s, + [86, 9], + 87, + 112, + 111, 109, + 110, + 3, + 83, + 95, + 95, + 102, + 102, + 114, s, - [96, 3], + [99, 3], s, - [24, 17], - 111, + [101, 3], s, - [29, 14], - 113, - 114, - 117, - 13, - 119, + [21, 17], + 116, + s, + [26, 14], 118, + 14, 120, + 119, 121, + 122, s, - [47, 3], + [45, 3], s, - [41, 4], + [52, 3], + c, + [528, 5], s, - [40, 3], + [52, 6], + c, + [347, 7], + 52, s, - [99, 3], + [58, 27], s, - [97, 3], - 124, + [60, 27], + 49, + 49, + 24, + 49, c, - [278, 13], - 27, - 27, - 126, + [417, 11], s, - [27, 15], + [59, 27], s, - [30, 18], + [61, 27], s, - [31, 18], + [76, 27], s, - [41, 4], + [77, 27], s, - [34, 11], - 128, + [78, 4], s, - [34, 7], + [97, 13], s, - [35, 18], + [98, 13], s, - [36, 19], + [90, 3], s, - [43, 14], + [91, 3], s, - [44, 14], - 129, + [92, 3], s, - [45, 14], + [93, 3], + c, + [828, 4], s, - [39, 3], - 76, - 93, + [100, 3], + 125, + c, + [814, 13], + 24, + 24, + 127, + s, + [24, 15], s, - [25, 17], + [27, 18], s, - [28, 14], + [28, 18], s, - [26, 17], - 131, - 75, - 130, + [41, 14], + s, + [42, 14], + 128, s, - [37, 19], + [43, 14], + 48, + 48, + 24, + 48, + c, + [926, 12], + 96, + s, + [22, 17], s, - [48, 3], + [25, 14], s, - [32, 18], + [23, 17], s, - [33, 18] + [46, 3] ]) }), defaultActions: bda({ idx: u([ 0, + 2, + 6, + 7, s, - [8, 5, 1], - s, - [17, 4, 1], + [11, 4, 1], + 16, + 17, + 19, s, [28, 8, 1], 37, @@ -2546,109 +2651,93 @@ defaultActions: bda({ 39, 41, 43, - 46, - 47, - 51, - 52, - s, - [56, 7, 1], - s, - [69, 10, 1], - 81, + 48, + 50, s, - [84, 8, 1], + [56, 5, 1], s, - [93, 4, 1], + [67, 16, 1], + 84, + 85, + 88, + 90, + 91, + 92, + 97, 99, 100, - 105, - 106, - 107, - 109, - 112, - 113, - 114, s, - [116, 4, 1], - 121, + [102, 11, 1], + 114, s, - [123, 4, 1], + [117, 4, 1], + 122, s, - [128, 4, 1] + [124, 5, 1] ]), goto: u([ 6, - 41, - s, - [14, 4, 1], - 23, + 8, 7, + 20, + 12, + 13, + 14, + 40, + 1, + 2, 9, - 49, - 66, + 67, s, - [68, 7, 1], - 83, + [69, 7, 1], 84, - 81, - 18, - 20, + 85, + 82, + 15, + 17, 94, - 95, - 1, - 2, - 53, - 50, - 61, + 19, 62, 63, - 67, - 82, + 64, + 68, + 83, 79, 80, - 19, - 21, - 12, - 13, - 41, - 42, - 85, + 81, + 16, + 18, + s, + [29, 11, 1], 86, - 22, - 52, - 57, - 59, + 87, + 95, + 99, + 101, + 21, + 45, 58, 60, - 75, + 59, + 61, 76, 77, - 89, - 90, - 91, - 3, - 96, - 24, - 47, - 41, - 40, + 78, 97, - 30, - 31, + 98, + s, + [90, 4, 1], + 100, + 27, + 28, 41, - 35, - 36, + 42, 43, - 44, - 45, - 93, + 96, + 22, 25, - 28, - 26, - 37, - 48, - 32, - 33 + 23, + 46 ]) }), parseError: function parseError(str, hash, ExceptionClass) { @@ -2676,7 +2765,7 @@ parse: function parse(input) { var TERROR = this.TERROR, EOF = this.EOF, ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; - var NO_ACTION = [0, table.length /* ensures that anyone using this new state will fail dramatically! */]; + var NO_ACTION = [0, 129 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -2776,7 +2865,7 @@ parse: function parse(input) { stack[sp] = 0; ++sp; - + var yytext = lexer.yytext; @@ -3191,7 +3280,7 @@ parse: function parse(input) { } else { errStr = 'Parse error: '; } - if (lexer.showPosition) { + if (typeof lexer.showPosition === 'function') { errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; } if (expected.length) { @@ -3226,7 +3315,7 @@ parse: function parse(input) { ++sp; // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: - + yytext = lexer.yytext; yyloc = lexer.yylloc; @@ -3262,7 +3351,24 @@ parse: function parse(input) { // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token: stack[sp] = preErrorSymbol; - vstack[sp] = lexer.yytext; + if (errStr) { + console.log('########## PUSH ERROR TOK', { + sp, + vstack, + stack, + sstack, + combineState: NO_ACTION[1] + }); + vstack[sp] = { + yytext: lexer.yytext, + errorRuleDepth: error_rule_depth, + errorStr: errStr, + errorSymbolDescr: errSymbolDescr, + expectedStr: expected + }; + } else { + vstack[sp] = lexer.yytext; + } lstack[sp] = lexer.yylloc; sstack[sp] = newState || NO_ACTION[1]; sp++; @@ -3273,7 +3379,15 @@ parse: function parse(input) { len = error_rule_depth; - r = this.performAction.call(yyval, yyloc, NO_ACTION[1], sp - 1, len, vstack, lstack); + console.log('########## performAction: COMBINE', { + sp, + vstack, + stack, + sstack, + combineState: NO_ACTION[1], + yyval, yytext, len, + }); + r = this.performAction.call(yyval, yytext, yyloc, NO_ACTION[1], sp - 1, len, vstack, lstack, stack, sstack); if (typeof r !== 'undefined') { retval = r; @@ -3343,7 +3457,7 @@ parse: function parse(input) { if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: - + yytext = lexer.yytext; yyloc = lexer.yylloc; @@ -3384,7 +3498,7 @@ parse: function parse(input) { yyval.$ = undefined; yyval._$ = undefined; - r = this.performAction.call(yyval, yyloc, newState, sp - 1, len, vstack, lstack); + r = this.performAction.call(yyval, yytext, yyloc, newState, sp - 1, len, vstack, lstack, stack, sstack); if (typeof r !== 'undefined') { retval = r; @@ -3499,50 +3613,108 @@ function parseValue(v) { return v; } +// tagged template string helper which removes the indentation common to all +// non-empty lines: that indentation was added as part of the source code +// formatting of this lexer spec file and must be removed to produce what +// we were aiming for. +// +// Each template string starts with an optional empty line, which should be +// removed entirely, followed by a first line of error reporting content text, +// which should not be indented at all, i.e. the indentation of the first +// non-empty line should be treated as the 'common' indentation and thus +// should also be removed from all subsequent lines in the same template string. +// +// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals +function rmCommonWS(strings, ...values) { + // as `strings[]` is an array of strings, each potentially consisting + // of multiple lines, followed by one(1) value, we have to split each + // individual string into lines to keep that bit of information intact. + var src = strings.map(function splitIntoLines(s) { + return s.split('\n'); + }); + // fetch the first line of content which is expected to exhibit the common indent: + // that would be the SECOND line of input, always, as the FIRST line won't + // have any indentation at all! + var s0 = ''; + for (var i = 0, len = src.length; i < len; i++) { + if (src[i].length > 1) { + s0 = src[i][1]; + break; + } + } + var indent = s0.replace(/^(\s+)[^\s]*.*$/, '$1'); + // we assume clean code style, hence no random mix of tabs and spaces, so every + // line MUST have the same indent style as all others, so `length` of indent + // should suffice, but the way we coded this is stricter checking when we apply + // a find-and-replace regex instead: + var indent_re = new RegExp('^' + indent); + + // process template string partials now: + for (var i = 0, len = src.length; i < len; i++) { + // start-of-lines always end up at index 1 and above (for each template string partial): + for (var j = 1, linecnt = src[i].length; j < linecnt; j++) { + src[i][j] = src[i][j].replace(indent_re, ''); + } + } + + // now merge everything to construct the template result: + var rv = []; + for (var i = 0, len = src.length, klen = values.length; i < len; i++) { + rv.push(src[i].join('\n')); + // all but the last partial are followed by a template value: + if (i < klen) { + rv.push(values[i]); + } + } + var sv = rv.join(''); + return sv; +} + // pretty-print the erroneous section of the input, with line numbers and everything... -function prettyPrintRange(lexer, loc, context_loc) { - assert(loc); +function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var error_size = loc.last_line - loc.first_line; const CONTEXT = 3; - var input = lexer.matched; + const CONTEXT_TAIL = 1; + var input = lexer.matched + lexer._input; var lines = input.split('\n'); var show_context = (error_size < 5 || context_loc); - var l0 = (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT); - var l1 = loc.last_line; + var l0 = Math.max(1, (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); + var l1 = Math.max(1, (!show_context ? loc.last_line : context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); var ws_prefix = new Array(lineno_display_width).join(' '); var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { var lno = index + l0; var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); - line = lno_pfx + ': ' + line; + var rv = lno_pfx + ': ' + line; if (show_context) { var errpfx = (new Array(lineno_display_width + 1)).join('^'); if (lno === loc.first_line) { var offset = loc.first_column + 2; - var len = (lno === loc_last_line ? loc.last_column : line.length) - loc.first_column + 1; - var lead = (new Array(offset)).join(' '); + var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); + var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - line += '\n' + errpfx + lead + mark; - } else if (lno === loc_last_line) { + rv += '\n' + errpfx + lead + mark + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; + } else if (lno === loc.last_line) { var offset = 2 + 1; - var len = loc.last_column + 1; - var lead = (new Array(offset)).join(' '); + var len = Math.max(2, loc.last_column + 1); + var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - line += '\n' + errpfx + lead + mark; - } else if (lno > loc.first_line && lno < loc_last_line) { + rv += '\n' + errpfx + lead + mark + offset + '/E' + len; + } else if (lno > loc.first_line && lno < loc.last_line) { var offset = 2 + 1; - var len = line.length + 1; - var lead = (new Array(offset)).join(' '); + var len = Math.max(2, line.length + 1); + var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - line += '\n' + errpfx + lead + mark; + rv += '\n' + errpfx + lead + mark + offset + '/F' + len; } } - line = line.replace(/\t/g, ' '); - return line; + rv = rv.replace(/\t/g, ' '); + return rv; }); return rv.join('\n'); } + parser.warn = function p_warn() { console.warn.apply(console, arguments); }; @@ -3550,7 +3722,19 @@ parser.warn = function p_warn() { parser.log = function p_log() { console.log.apply(console, arguments); }; -/* lexer generated by jison-lex 0.6.0-188 */ + +parser.pre_parse = function p_lex() { + console.log('pre_parse:', arguments); +}; + +parser.yy.pre_parse = function p_lex() { + console.log('pre_parse YY:', arguments); +}; + +parser.yy.post_lex = function p_lex() { + console.log('post_lex:', arguments); +}; +/* lexer generated by jison-lex 0.6.0-189 */ /* * Returns a Lexer object of the following structure: @@ -3843,7 +4027,7 @@ var lexer = function() { // // uses yyleng: ..................... false // uses yylineno: ................... false - // uses yytext: ..................... false + // uses yytext: ..................... true // uses yylloc: ..................... false // uses lexer values: ............... true / true // location tracking: ............... true @@ -4339,10 +4523,14 @@ var lexer = function() { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = this.showPosition(); + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } } var p = this.constructLexErrorInfo( @@ -4679,10 +4867,14 @@ var lexer = function() { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = this.showPosition(); + var pos_str = ''; - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } } var p = this.constructLexErrorInfo( @@ -4751,10 +4943,14 @@ var lexer = function() { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = this.showPosition(); + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } } var p = this.constructLexErrorInfo( @@ -4794,6 +4990,14 @@ var lexer = function() { r = this.next(); } + console.log('@@@@@@@@@ lex: ', { + token: r, + sym: this.yy.parser && typeof this.yy.parser.describeSymbol === 'function' && this.yy.parser.describeSymbol(r), + describeTypeFunc: this.yy.parser && typeof this.yy.parser.describeSymbol, + condition: this.conditionStack, + text: this.yytext + }, '\n' + ((this.showPosition ? this.showPosition() : '???'))); + if (typeof this.options.post_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.options.post_lex.call(this, r) || r; @@ -4873,73 +5077,274 @@ var lexer = function() { } }, - /** - return the number of states currently on the stack + /** + return the number of states currently on the stack + + @public + @this {RegExpLexer} + */ + stateStackSize: function lexer_stateStackSize() { + return this.conditionStack.length; + }, + + options: { + xregexp: true, + ranges: true, + trackPosition: true, + easy_keyword_rules: true + }, + + JisonLexerError: JisonLexerError, + + performAction: function lexer__performAction(yy, yy_, yyrulenumber, YY_START) { + var YYSTATE = YY_START; + + switch (yyrulenumber) { + case 0: + /*! Conditions:: rules macro INITIAL */ + /*! Rule:: %\{ */ + yy.dept = 0; + + yy.include_command_allowed = false; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 25; + break; + case 1: + /*! Conditions:: action */ + /*! Rule:: %\{([^]*?)%\} */ + yy_.yytext = this.matches[1]; + + yy.include_command_allowed = true; + return 29; + break; + case 2: + /*! Conditions:: action */ + /*! Rule:: %include\b */ + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState('path'); + + return 49; + } else { + // TODO + yy_.yyerror('oops!'); + + return 34; + } + + break; + case 3: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 31; + + break; + case 4: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\/.* */ + yy.include_command_allowed = false; + + return 32; + break; + case 6: + /*! Conditions:: action */ + /*! Rule:: \| */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + } else { + return 30; + } + + break; + case 7: + /*! Conditions:: action */ + /*! Rule:: %% */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + } else { + return 30; + } - @public - @this {RegExpLexer} - */ - stateStackSize: function lexer_stateStackSize() { - return this.conditionStack.length; - }, + break; + case 9: + /*! Conditions:: action */ + /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ + yy.include_command_allowed = false; - options: { - xregexp: true, - ranges: true, - trackPosition: true, - easy_keyword_rules: true - }, + return 30; + break; + case 10: + /*! Conditions:: action */ + /*! Rule:: \/[^}{BR}]* */ + yy.include_command_allowed = false; - JisonLexerError: JisonLexerError, + return 30; + break; + case 11: + /*! Conditions:: action */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy.include_command_allowed = false; - performAction: function lexer__performAction(yy, yy_, yyrulenumber, YY_START) { - var YYSTATE = YY_START; + return 30; + break; + case 12: + /*! Conditions:: action */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy.include_command_allowed = false; - switch (yyrulenumber) { - case 7: + return 30; + break; + case 13: + /*! Conditions:: action */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy.include_command_allowed = false; + + return 30; + break; + case 14: + /*! Conditions:: action */ + /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ + yy.include_command_allowed = false; + + return 30; + break; + case 15: /*! Conditions:: action */ /*! Rule:: \{ */ yy.depth++; - return 3; + yy.include_command_allowed = false; + return 30; break; - case 8: + case 16: /*! Conditions:: action */ /*! Rule:: \} */ + yy.include_command_allowed = false; - if (yy.depth == 0) { - this.popState(); - this.pushState('trail'); + if (yy.depth <= 0) { + yy_.yyerror(rmCommonWS` + too many closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + return 'BRACKETS_SURPLUS'; } else { yy.depth--; } - return 4; + return 30; break; - case 10: + case 17: + /*! Conditions:: action */ + /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|%]) */ + yy.include_command_allowed = true; + + return 33; // keep empty lines as-is inside action code blocks. + break; + case 18: + /*! Conditions:: action */ + /*! Rule:: {BR} */ + if (yy.depth > 0) { + yy.include_command_allowed = true; + return 33; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk + this.popState(); + + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + } + + break; + case 19: + /*! Conditions:: action */ + /*! Rule:: $ */ + yy.include_command_allowed = false; + + if (yy.depth !== 0) { + yy_.yyerror(rmCommonWS` + missing ${yy.depth} closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = ''; + return 'BRACKETS_MISSING'; + } + + this.popState(); + yy_.yytext = ''; + return 28; + break; + case 21: /*! Conditions:: conditions */ /*! Rule:: > */ this.popState(); return 6; break; - case 13: + case 24: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\/[^\r\n]* */ + /* skip single-line comment */ + break; + case 25: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\*(.|\n|\r)*?\*\/ */ + /* skip multi-line comment */ + break; + case 26: /*! Conditions:: rules */ /*! Rule:: {BR}+ */ /* empty */ break; - case 14: + case 27: /*! Conditions:: rules */ /*! Rule:: {WS}+{BR}+ */ /* empty */ break; - case 15: + case 28: /*! Conditions:: rules */ - /*! Rule:: {WS}+ */ - this.pushState('indented'); + /*! Rule:: \/\/[^\r\n]* */ + /* skip single-line comment */ + break; + case 29: + /*! Conditions:: rules */ + /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /* skip multi-line comment */ + break; + case 30: + /*! Conditions:: rules */ + /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ + yy.depth = 0; + yy.include_command_allowed = true; + this.pushState('action'); + return 25; break; - case 16: + case 31: /*! Conditions:: rules */ /*! Rule:: %% */ this.popState(); @@ -4947,368 +5352,390 @@ var lexer = function() { this.pushState('code'); return 19; break; - case 17: + case 32: /*! Conditions:: rules */ /*! Rule:: {ANY_LITERAL_CHAR}+ */ - // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 36; + return 44; break; - case 20: + case 35: /*! Conditions:: options */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = unescQuote(this.matches[1]); + yy_.yytext = unescQuote(this.matches[1], /\\"/g); - return 39; // value is always a string type + return 47; // value is always a string type break; - case 21: + case 36: /*! Conditions:: options */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = unescQuote(this.matches[1]); + yy_.yytext = unescQuote(this.matches[1], /\\'/g); - return 39; // value is always a string type + return 47; // value is always a string type break; - case 22: - /*! Conditions:: INITIAL start_condition trail rules macro path options */ - /*! Rule:: \/\/[^\r\n]* */ - /* skip single-line comment */ - break; - case 23: - /*! Conditions:: INITIAL start_condition trail rules macro path options */ - /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - /* skip multi-line comment */ + case 37: + /*! Conditions:: options */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy_.yytext = unescQuote(this.matches[1], /\\`/g); + + return 47; // value is always a string type break; - case 25: + case 39: /*! Conditions:: options */ /*! Rule:: {BR}{WS}+(?=\S) */ /* skip leading whitespace on the next line of input, when followed by more options */ break; - case 26: + case 40: /*! Conditions:: options */ /*! Rule:: {BR} */ this.popState(); - return 38; + return 46; break; - case 27: + case 41: /*! Conditions:: options */ /*! Rule:: {WS}+ */ /* skip whitespace */ break; - case 29: + case 43: /*! Conditions:: start_condition */ /*! Rule:: {BR}+ */ this.popState(); break; - case 30: + case 44: /*! Conditions:: start_condition */ /*! Rule:: {WS}+ */ /* empty */ break; - case 31: - /*! Conditions:: trail */ - /*! Rule:: {WS}*{BR}+ */ - this.popState(); - - this.unput(yy_.yytext); - - /* this.unput(yy_.yytext); can be used here instead of this.reject(); which would only work when we set the backtrack_lexer option */ - break; - case 32: - /*! Conditions:: indented */ - /*! Rule:: {WS}*{BR}+ */ - this.popState(); - - break; - case 33: - /*! Conditions:: indented */ - /*! Rule:: \{ */ - yy.depth = 0; - - this.pushState('action'); - return 3; - break; - case 34: - /*! Conditions:: indented */ - /*! Rule:: %\{((?:.|{BR})*?)%\} */ - this.pushState('trail'); - - yy_.yytext = this.matches[1]; - return 23; - break; - case 35: - /*! Conditions:: indented trail rules macro INITIAL */ - /*! Rule:: %\{((?:.|{BR})*?)%\} */ - yy_.yytext = this.matches[1]; - - return 23; - break; - case 36: - /*! Conditions:: indented */ - /*! Rule:: %include\b */ - - // This is an include instruction in place of an action: - // thanks to the `.+` rule immediately below we need to semi-duplicate - // the `%include` token recognition here vs. the almost-identical rule for the same - // further below. - // There's no real harm as we need to do something special in this case anyway: - // push 2 (two!) conditions. - // - // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar - // parse correctly took several hours as the debug facilities were - and are - too meager to - // quickly diagnose the problem while we hadn't. So the code got littered with debug prints - // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) - - // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... - this.pushState('trail'); - - // then push the immediate need: the 'path' condition. - this.pushState('path'); - - return 41; - break; - case 37: - /*! Conditions:: indented */ - /*! Rule:: .* */ - this.popState(); - - return 23; - break; - case 38: + case 45: /*! Conditions:: INITIAL */ /*! Rule:: {ID} */ this.pushState('macro'); return 20; break; - case 39: + case 46: /*! Conditions:: macro */ /*! Rule:: {BR}+ */ this.popState(); break; - case 40: + case 47: /*! Conditions:: macro */ /*! Rule:: {ANY_LITERAL_CHAR}+ */ - // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 36; + return 44; break; - case 41: - /*! Conditions:: indented trail rules macro INITIAL */ + case 48: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: {BR}+ */ /* empty */ break; - case 42: - /*! Conditions:: indented trail rules macro INITIAL */ + case 49: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \s+ */ /* empty */ break; - case 43: - /*! Conditions:: indented trail rules macro INITIAL */ + case 50: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); - yy_.yytext = unescQuote(this.matches[1]); - - return 35; + return 43; break; - case 44: - /*! Conditions:: indented trail rules macro INITIAL */ + case 51: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); - yy_.yytext = unescQuote(this.matches[1]); - - return 35; + return 43; break; - case 45: - /*! Conditions:: indented trail rules macro INITIAL */ + case 52: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \[ */ this.pushState('set'); - return 30; + return 38; break; - case 58: - /*! Conditions:: indented trail rules macro INITIAL */ + case 65: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: < */ this.pushState('conditions'); return 5; break; - case 59: - /*! Conditions:: indented trail rules macro INITIAL */ + case 66: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \/! */ - return 28; // treated as `(?!atom)` + return 36; // treated as `(?!atom)` break; - case 60: - /*! Conditions:: indented trail rules macro INITIAL */ + case 67: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \/ */ return 14; // treated as `(?=atom)` break; - case 62: - /*! Conditions:: indented trail rules macro INITIAL */ + case 69: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \\. */ yy_.yytext = yy_.yytext.replace(/^\\/g, ''); - return 33; + return 41; break; - case 65: - /*! Conditions:: indented trail rules macro INITIAL */ + case 72: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: %options\b */ this.pushState('options'); - return 37; + return 45; break; - case 66: - /*! Conditions:: indented trail rules macro INITIAL */ + case 73: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: %s\b */ this.pushState('start_condition'); return 21; break; - case 67: - /*! Conditions:: indented trail rules macro INITIAL */ + case 74: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: %x\b */ this.pushState('start_condition'); return 22; break; - case 68: - /*! Conditions:: INITIAL trail code */ + case 75: + /*! Conditions:: rules macro INITIAL */ + /*! Rule:: %include\b */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 25; + break; + case 76: + /*! Conditions:: code */ /*! Rule:: %include\b */ this.pushState('path'); - return 41; + return 49; break; - case 69: - /*! Conditions:: INITIAL rules trail code */ + case 77: + /*! Conditions:: INITIAL rules code */ /*! Rule:: %{NAME}([^\r\n]*) */ - /* ignore unrecognized decl */ - var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); - - var l2 = 19; - var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); - - this.warn( - 'LEX: ignoring unsupported lexer option', - dquote(yy_.yytext), - 'while lexing in', - this.topState(), - // , '\n', { - // remaining_input: this._input, - // matched: this.matched, - // matches: this.matches - // } - 'state:\n' + indent(this.showPosition(l1, l2), 4) - ); + this.warn(rmCommonWS` + LEX: ignoring unsupported lexer option ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); yy_.yytext = [// {NAME} this.matches[1], // optional value/parameters this.matches[2].trim()]; - return 24; + return 23; break; - case 70: - /*! Conditions:: indented trail rules macro INITIAL */ + case 78: + /*! Conditions:: rules macro INITIAL */ /*! Rule:: %% */ this.pushState('rules'); return 19; break; - case 78: + case 86: /*! Conditions:: set */ /*! Rule:: \] */ this.popState(); - return 31; + return 39; break; - case 80: + case 88: /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 43; // the bit of CODE just before EOF... + return 51; // the bit of CODE just before EOF... + + break; + case 89: + /*! Conditions:: path */ + /*! Rule:: {BR} */ + this.popState(); + + this.unput(yy_.yytext); + break; + case 90: + /*! Conditions:: path */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 50; + break; + case 91: + /*! Conditions:: path */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 50; + break; + case 92: + /*! Conditions:: path */ + /*! Rule:: {WS}+ */ + // skip whitespace in the line + break; + case 93: + /*! Conditions:: path */ + /*! Rule:: [^\s\r\n]+ */ + this.popState(); + + return 50; + break; + case 94: + /*! Conditions:: action */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + case 95: + /*! Conditions:: action */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + case 96: + /*! Conditions:: action */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + case 97: + /*! Conditions:: options */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + return 2; break; - case 81: - /*! Conditions:: path */ - /*! Rule:: {BR} */ - this.popState(); + case 98: + /*! Conditions:: options */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. - this.unput(yy_.yytext); + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + return 2; break; - case 82: - /*! Conditions:: path */ - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = unescQuote(this.matches[1]); + case 99: + /*! Conditions:: options */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. - this.popState(); - return 42; + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + return 2; break; - case 83: - /*! Conditions:: path */ - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = unescQuote(this.matches[1]); + case 100: + /*! Conditions:: * */ + /*! Rule:: " */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); - this.popState(); - return 42; + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + return 2; break; - case 84: - /*! Conditions:: path */ - /*! Rule:: {WS}+ */ - // skip whitespace in the line + case 101: + /*! Conditions:: * */ + /*! Rule:: ' */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + return 2; break; - case 85: - /*! Conditions:: path */ - /*! Rule:: [^\s\r\n]+ */ - this.popState(); + case 102: + /*! Conditions:: * */ + /*! Rule:: ` */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. - return 42; + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); + + return 2; break; - case 86: + case 103: /*! Conditions:: macro rules */ /*! Rule:: . */ - /* b0rk on bad characters */ - var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); - - var l2 = 39; - var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); - var pos_str = this.showPosition(l1, l2); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); - } + yy_.yyerror(rmCommonWS` + unsupported lexer input encountered while lexing + ${rules} (i.e. jison lex regexes). - yy_.yyerror( - 'unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing ' + rules + '\n (i.e. jison lex regexes).\n\n NOTE: When you want the input ' + dquote(yy_.yytext) + ' to be interpreted as a literal part\n of a lex rule regex, you MUST enclose it in double or single quotes,\n e.g. as shown in this error message just before. If not, then know\n that this is not accepted as a regex operator here in\n jison-lex ' + rules + '.' + pos_str - ); + NOTE: When you want this input to be interpreted as a LITERAL part + of a lex rule regex, you MUST enclose it in double or + single quotes. + + If not, then know that this input is not accepted as a valid + regex expression here in jison-lex ${rules}. + + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); break; - case 87: + case 104: /*! Conditions:: * */ /*! Rule:: . */ + yy_.yyerror(rmCommonWS` + unsupported lexer input: ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. - /* b0rk on bad characters */ - var l0 = Math.max(0, yy_.yylloc.last_column - yy_.yylloc.first_column); - - var l2 = 39; - var l1 = Math.min(79 - 4 - l0 - l2, yy_.yylloc.first_column, 0); - var pos_str = this.showPosition(l1, l2); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); - } - - yy_.yyerror( - 'unsupported lexer input: ' + dquote(yy_.yytext) + ' while lexing in ' + dquote(this.topState()) + ' state.' + pos_str - ); + Erroneous area: + ` + prettyPrintRange(this, yy_.yylloc)); break; default: @@ -5318,310 +5745,267 @@ var lexer = function() { simpleCaseActionClusters: { /*! Conditions:: action */ - /*! Rule:: \/\*[^]*?\*\/ */ - 0: 26, + /*! Rule:: {WS}+ */ + 5: 33, /*! Conditions:: action */ - /*! Rule:: \/\/.* */ - 1: 26, - - /*! Conditions:: action */ - /*! Rule:: \/[^\s/]*?['"{}][^\s]*?\/ */ - 2: 26, - - /*! Conditions:: action */ - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - 3: 26, - - /*! Conditions:: action */ - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - 4: 26, - - /*! Conditions:: action */ - /*! Rule:: [/"'][^{}/"']+ */ - 5: 26, - - /*! Conditions:: action */ - /*! Rule:: [^{}/"']+ */ - 6: 26, + /*! Rule:: % */ + 8: 30, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 9: 20, + 20: 20, /*! Conditions:: conditions */ /*! Rule:: , */ - 11: 8, + 22: 8, /*! Conditions:: conditions */ /*! Rule:: \* */ - 12: 7, + 23: 7, /*! Conditions:: options */ /*! Rule:: {NAME} */ - 18: 20, + 33: 20, /*! Conditions:: options */ /*! Rule:: = */ - 19: 18, + 34: 18, /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 24: 40, + 38: 48, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 28: 25, + 42: 24, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \| */ - 46: 9, + 53: 9, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \(\?: */ - 47: 27, + 54: 35, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \(\?= */ - 48: 27, + 55: 35, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \(\?! */ - 49: 27, + 56: 35, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \( */ - 50: 10, + 57: 10, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \) */ - 51: 11, + 58: 11, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \+ */ - 52: 12, + 59: 12, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \* */ - 53: 7, + 60: 7, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \? */ - 54: 13, + 61: 13, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \^ */ - 55: 16, + 62: 16, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: , */ - 56: 8, + 63: 8, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: <> */ - 57: 17, + 64: 17, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 61: 33, + 68: 41, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \$ */ - 63: 17, + 70: 17, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \. */ - 64: 15, + 71: 15, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \{\d+(,\s*\d+|,)?\} */ - 71: 34, + 79: 42, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \{{ID}\} */ - 72: 29, + 80: 37, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 73: 29, + 81: 37, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \{ */ - 74: 3, + 82: 3, - /*! Conditions:: indented trail rules macro INITIAL */ + /*! Conditions:: rules macro INITIAL */ /*! Rule:: \} */ - 75: 4, + 83: 4, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 76: 32, + 84: 40, /*! Conditions:: set */ /*! Rule:: \{ */ - 77: 32, + 85: 40, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 79: 43, + 87: 51, /*! Conditions:: * */ /*! Rule:: $ */ - 88: 1 + 105: 1 }, rules: [ - /* 0: */ new XRegExp('^(?:\\/\\*[^]*?\\*\\/)', ''), - /* 1: */ /^(?:\/\/.*)/, - /* 2: */ /^(?:\/[^\s\/]*?["'{}]\S*?\/)/, - /* 3: */ /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, - /* 4: */ /^(?:'((?:\\'|\\[^']|[^'\\])*)')/, - /* 5: */ /^(?:[\/"'][^{}\/"']+)/, - /* 6: */ /^(?:[^{}\/"']+)/, - /* 7: */ /^(?:\{)/, - /* 8: */ /^(?:\})/, - /* 9: */ new XRegExp( + /* 0: */ /^(?:%\{)/, + /* 1: */ new XRegExp('^(?:%\\{([^]*?)%\\})', ''), + /* 2: */ /^(?:%include\b)/, + /* 3: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 4: */ /^(?:([^\S\n\r])*\/\/.*)/, + /* 5: */ /^(?:([^\S\n\r])+)/, + /* 6: */ /^(?:\|)/, + /* 7: */ /^(?:%%)/, + /* 8: */ /^(?:%)/, + /* 9: */ /^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, + /* 10: */ /^(?:\/[^\n\r}]*)/, + /* 11: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 12: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 13: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 14: */ /^(?:[^\s"%'\/`{-}]+)/, + /* 15: */ /^(?:\{)/, + /* 16: */ /^(?:\})/, + /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s%|]))/, + /* 18: */ /^(?:(\r\n|\n|\r))/, + /* 19: */ /^(?:$)/, + /* 20: */ new XRegExp( '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', '' ), - /* 10: */ /^(?:>)/, - /* 11: */ /^(?:,)/, - /* 12: */ /^(?:\*)/, - /* 13: */ /^(?:(\r\n|\n|\r)+)/, - /* 14: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, - /* 15: */ /^(?:([^\S\n\r])+)/, - /* 16: */ /^(?:%%)/, - /* 17: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, - /* 18: */ new XRegExp( + /* 21: */ /^(?:>)/, + /* 22: */ /^(?:,)/, + /* 23: */ /^(?:\*)/, + /* 24: */ /^(?:([^\S\n\r])*\/\/[^\n\r]*)/, + /* 25: */ /^(?:([^\S\n\r])*\/\*(.|\n|\r)*?\*\/)/, + /* 26: */ /^(?:(\r\n|\n|\r)+)/, + /* 27: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, + /* 28: */ /^(?:\/\/[^\r\n]*)/, + /* 29: */ /^(?:\/\*(.|\n|\r)*?\*\/)/, + /* 30: */ /^(?:([^\S\n\r])+(?=[^\s%|]))/, + /* 31: */ /^(?:%%)/, + /* 32: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 33: */ new XRegExp( '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', '' ), - /* 19: */ /^(?:=)/, - /* 20: */ /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, - /* 21: */ /^(?:'((?:\\'|\\[^']|[^'\\])*)')/, - /* 22: */ /^(?:\/\/[^\r\n]*)/, - /* 23: */ /^(?:\/\*(.|\n|\r)*?\*\/)/, - /* 24: */ /^(?:\S+)/, - /* 25: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, - /* 26: */ /^(?:(\r\n|\n|\r))/, - /* 27: */ /^(?:([^\S\n\r])+)/, - /* 28: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), - /* 29: */ /^(?:(\r\n|\n|\r)+)/, - /* 30: */ /^(?:([^\S\n\r])+)/, - /* 31: */ /^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, - /* 32: */ /^(?:([^\S\n\r])*(\r\n|\n|\r)+)/, - /* 33: */ /^(?:\{)/, - /* 34: */ /^(?:%\{((?:.|(\r\n|\n|\r))*?)%\})/, - /* 35: */ /^(?:%\{((?:.|(\r\n|\n|\r))*?)%\})/, - /* 36: */ /^(?:%include\b)/, - /* 37: */ /^(?:.*)/, - /* 38: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), - /* 39: */ /^(?:(\r\n|\n|\r)+)/, - /* 40: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, - /* 41: */ /^(?:(\r\n|\n|\r)+)/, - /* 42: */ /^(?:\s+)/, - /* 43: */ /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, - /* 44: */ /^(?:'((?:\\'|\\[^']|[^'\\])*)')/, - /* 45: */ /^(?:\[)/, - /* 46: */ /^(?:\|)/, - /* 47: */ /^(?:\(\?:)/, - /* 48: */ /^(?:\(\?=)/, - /* 49: */ /^(?:\(\?!)/, - /* 50: */ /^(?:\()/, - /* 51: */ /^(?:\))/, - /* 52: */ /^(?:\+)/, - /* 53: */ /^(?:\*)/, - /* 54: */ /^(?:\?)/, - /* 55: */ /^(?:\^)/, - /* 56: */ /^(?:,)/, - /* 57: */ /^(?:<>)/, - /* 58: */ /^(?:<)/, - /* 59: */ /^(?:\/!)/, - /* 60: */ /^(?:\/)/, - /* 61: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, - /* 62: */ /^(?:\\.)/, - /* 63: */ /^(?:\$)/, - /* 64: */ /^(?:\.)/, - /* 65: */ /^(?:%options\b)/, - /* 66: */ /^(?:%s\b)/, - /* 67: */ /^(?:%x\b)/, - /* 68: */ /^(?:%include\b)/, - /* 69: */ new XRegExp( + /* 34: */ /^(?:=)/, + /* 35: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 36: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 37: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 38: */ /^(?:\S+)/, + /* 39: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, + /* 40: */ /^(?:(\r\n|\n|\r))/, + /* 41: */ /^(?:([^\S\n\r])+)/, + /* 42: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 43: */ /^(?:(\r\n|\n|\r)+)/, + /* 44: */ /^(?:([^\S\n\r])+)/, + /* 45: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 46: */ /^(?:(\r\n|\n|\r)+)/, + /* 47: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 48: */ /^(?:(\r\n|\n|\r)+)/, + /* 49: */ /^(?:\s+)/, + /* 50: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 51: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 52: */ /^(?:\[)/, + /* 53: */ /^(?:\|)/, + /* 54: */ /^(?:\(\?:)/, + /* 55: */ /^(?:\(\?=)/, + /* 56: */ /^(?:\(\?!)/, + /* 57: */ /^(?:\()/, + /* 58: */ /^(?:\))/, + /* 59: */ /^(?:\+)/, + /* 60: */ /^(?:\*)/, + /* 61: */ /^(?:\?)/, + /* 62: */ /^(?:\^)/, + /* 63: */ /^(?:,)/, + /* 64: */ /^(?:<>)/, + /* 65: */ /^(?:<)/, + /* 66: */ /^(?:\/!)/, + /* 67: */ /^(?:\/)/, + /* 68: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 69: */ /^(?:\\.)/, + /* 70: */ /^(?:\$)/, + /* 71: */ /^(?:\.)/, + /* 72: */ /^(?:%options\b)/, + /* 73: */ /^(?:%s\b)/, + /* 74: */ /^(?:%x\b)/, + /* 75: */ /^(?:%include\b)/, + /* 76: */ /^(?:%include\b)/, + /* 77: */ new XRegExp( '^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))', '' ), - /* 70: */ /^(?:%%)/, - /* 71: */ /^(?:\{\d+(,\s*\d+|,)?\})/, - /* 72: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), - /* 73: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), - /* 74: */ /^(?:\{)/, - /* 75: */ /^(?:\})/, - /* 76: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, - /* 77: */ /^(?:\{)/, - /* 78: */ /^(?:\])/, - /* 79: */ /^(?:[^\r\n]*(\r|\n)+)/, - /* 80: */ /^(?:[^\r\n]+)/, - /* 81: */ /^(?:(\r\n|\n|\r))/, - /* 82: */ /^(?:"((?:\\"|\\[^"]|[^"\\])*)")/, - /* 83: */ /^(?:'((?:\\'|\\[^']|[^'\\])*)')/, - /* 84: */ /^(?:([^\S\n\r])+)/, - /* 85: */ /^(?:\S+)/, - /* 86: */ /^(?:.)/, - /* 87: */ /^(?:.)/, - /* 88: */ /^(?:$)/ + /* 78: */ /^(?:%%)/, + /* 79: */ /^(?:\{\d+(,\s*\d+|,)?\})/, + /* 80: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 81: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 82: */ /^(?:\{)/, + /* 83: */ /^(?:\})/, + /* 84: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 85: */ /^(?:\{)/, + /* 86: */ /^(?:\])/, + /* 87: */ /^(?:[^\r\n]*(\r|\n)+)/, + /* 88: */ /^(?:[^\r\n]+)/, + /* 89: */ /^(?:(\r\n|\n|\r))/, + /* 90: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 91: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 92: */ /^(?:([^\S\n\r])+)/, + /* 93: */ /^(?:\S+)/, + /* 94: */ /^(?:")/, + /* 95: */ /^(?:')/, + /* 96: */ /^(?:`)/, + /* 97: */ /^(?:")/, + /* 98: */ /^(?:')/, + /* 99: */ /^(?:`)/, + /* 100: */ /^(?:")/, + /* 101: */ /^(?:')/, + /* 102: */ /^(?:`)/, + /* 103: */ /^(?:.)/, + /* 104: */ /^(?:.)/, + /* 105: */ /^(?:$)/ ], conditions: { - 'code': { - rules: [68, 69, 79, 80, 87, 88], - inclusive: false - }, - - 'start_condition': { - rules: [22, 23, 28, 29, 30, 87, 88], - inclusive: false - }, - - 'options': { - rules: [18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 73, 87, 88], - inclusive: false - }, - - 'conditions': { - rules: [9, 10, 11, 12, 87, 88], - inclusive: false - }, - - 'action': { - rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 87, 88], - inclusive: false - }, - - 'path': { - rules: [22, 23, 81, 82, 83, 84, 85, 87, 88], - inclusive: false - }, - - 'set': { - rules: [73, 76, 77, 78, 87, 88], - inclusive: false - }, - - 'indented': { + 'rules': { rules: [ + 0, + 26, + 27, + 28, + 29, + 30, + 31, 32, - 33, - 34, - 35, - 36, - 37, - 41, - 42, - 43, - 44, - 45, - 46, - 47, 48, 49, 50, @@ -5642,29 +6026,36 @@ var lexer = function() { 65, 66, 67, + 68, + 69, 70, 71, 72, + 73, 74, 75, - 87, - 88 + 77, + 78, + 79, + 80, + 82, + 83, + 100, + 101, + 102, + 103, + 104, + 105 ], inclusive: true }, - 'trail': { + 'macro': { rules: [ - 22, - 23, - 31, - 35, - 41, - 42, - 43, - 44, - 45, + 0, + 24, + 25, 46, 47, 48, @@ -5692,126 +6083,117 @@ var lexer = function() { 70, 71, 72, + 73, 74, 75, - 87, - 88 + 78, + 79, + 80, + 82, + 83, + 100, + 101, + 102, + 103, + 104, + 105 ], inclusive: true }, - 'rules': { + 'code': { + rules: [76, 77, 87, 88, 100, 101, 102, 104, 105], + inclusive: false + }, + + 'start_condition': { + rules: [24, 25, 42, 43, 44, 100, 101, 102, 104, 105], + inclusive: false + }, + + 'options': { + rules: [ + 24, + 25, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 81, + 97, + 98, + 99, + 100, + 101, + 102, + 104, + 105 + ], + + inclusive: false + }, + + 'conditions': { + rules: [20, 21, 22, 23, 100, 101, 102, 104, 105], + inclusive: false + }, + + 'action': { rules: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, 13, 14, 15, 16, 17, - 22, - 23, - 35, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 69, - 70, - 71, - 72, - 74, - 75, - 86, - 87, - 88 + 18, + 19, + 94, + 95, + 96, + 100, + 101, + 102, + 104, + 105 ], - inclusive: true + inclusive: false }, - 'macro': { - rules: [ - 22, - 23, - 35, - 39, - 40, - 41, - 42, - 43, - 44, - 45, - 46, - 47, - 48, - 49, - 50, - 51, - 52, - 53, - 54, - 55, - 56, - 57, - 58, - 59, - 60, - 61, - 62, - 63, - 64, - 65, - 66, - 67, - 70, - 71, - 72, - 74, - 75, - 86, - 87, - 88 - ], + 'path': { + rules: [24, 25, 89, 90, 91, 92, 93, 100, 101, 102, 104, 105], + inclusive: false + }, - inclusive: true + 'set': { + rules: [81, 84, 85, 86, 100, 101, 102, 104, 105], + inclusive: false }, 'INITIAL': { rules: [ - 22, - 23, - 35, - 38, - 41, - 42, - 43, - 44, + 0, + 24, + 25, 45, - 46, - 47, 48, 49, 50, @@ -5837,10 +6219,20 @@ var lexer = function() { 70, 71, 72, + 73, 74, 75, - 87, - 88 + 77, + 78, + 79, + 80, + 82, + 83, + 100, + 101, + 102, + 104, + 105 ], inclusive: true @@ -5854,7 +6246,7 @@ var lexer = function() { return pf + a.join('\n' + pf); } - // unescape a string value which is wrapped in quotes/doublequotes + // unescape a string value which is wrapped in quotes/doublequotes function unescQuote(str) { str = '' + str; var a = str.split('\\\\'); @@ -5886,6 +6278,133 @@ var lexer = function() { return s; } + // tagged template string helper which removes the indentation common to all + // non-empty lines: that indentation was added as part of the source code + // formatting of this lexer spec file and must be removed to produce what + // we were aiming for. + // + // Each template string starts with an optional empty line, which should be + // removed entirely, followed by a first line of error reporting content text, + // which should not be indented at all, i.e. the indentation of the first + // non-empty line should be treated as the 'common' indentation and thus + // should also be removed from all subsequent lines in the same template string. + // + // See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals + function rmCommonWS(strings, ...values) { + // as `strings[]` is an array of strings, each potentially consisting + // of multiple lines, followed by one(1) value, we have to split each + // individual string into lines to keep that bit of information intact. + var src = strings.map(function splitIntoLines(s) { + return s.split('\n'); + }); + + // fetch the first line of content which is expected to exhibit the common indent: + // that would be the SECOND line of input, always, as the FIRST line won't + // have any indentation at all! + var s0 = ''; + + for (var i = 0, len = src.length; i < len; i++) { + if (src[i].length > 1) { + s0 = src[i][1]; + break; + } + } + + var indent = s0.replace(/^(\s+)[^\s]*.*$/, '$1'); + + // we assume clean code style, hence no random mix of tabs and spaces, so every + // line MUST have the same indent style as all others, so `length` of indent + // should suffice, but the way we coded this is stricter checking when we apply + // a find-and-replace regex instead: + var indent_re = new RegExp('^' + indent); + + // process template string partials now: + for (var i = 0, len = src.length; i < len; i++) { + // start-of-lines always end up at index 1 and above (for each template string partial): + for (var j = 1, linecnt = src[i].length; j < linecnt; j++) { + src[i][j] = src[i][j].replace(indent_re, ''); + } + } + + // now merge everything to construct the template result: + var rv = []; + + for (var i = 0, len = src.length, klen = values.length; i < len; i++) { + rv.push(src[i].join('\n')); + + // all but the last partial are followed by a template value: + if (i < klen) { + rv.push(values[i]); + } + } + + var sv = rv.join(''); + return sv; + } + + // pretty-print the erroneous section of the input, with line numbers and everything... + function prettyPrintRange(lexer, loc, context_loc, context_loc2) { + var error_size = loc.last_line - loc.first_line; + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + var input = lexer.matched + lexer._input; + var lines = input.split('\n'); + var show_context = error_size < 5 || context_loc; + + var l0 = Math.max( + 1, + (!show_context ? loc.first_line : (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)) + ); + + var l1 = Math.max( + 1, + (!show_context ? loc.last_line : (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)) + ); + + var lineno_display_width = 1 + Math.log10(l1 | 1) | 0; + var ws_prefix = new Array(lineno_display_width).join(' '); + + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ': ' + line; + + if (show_context) { + var errpfx = new Array(lineno_display_width + 1).join('^'); + + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + + var len = Math.max( + 2, + ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 + ); + + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark + offset + '/A' + len; + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark + offset + '/B' + len; + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark + offset + '/C' + len; + } + } + + rv = rv.replace(/\t/g, ' '); + return rv; + }); + + return rv.join('\n'); + } + lexer.warn = function l_warn() { if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { return this.yy.parser.warn.apply(this, arguments); diff --git a/lex.l b/lex.l index c0df045..493307d 100644 --- a/lex.l +++ b/lex.l @@ -29,7 +29,7 @@ ES2017_STRING_CONTENT (?:\\\`|\\[^\`]|[^\\\`])* ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] -%s indented trail rules macro +%s rules macro %x code start_condition options conditions action path set @@ -41,26 +41,133 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] %% -"/*"[^]*?"*/" return 'ACTION_BODY'; -"//".* return 'ACTION_BODY'; +"%{" yy.dept = 0; + yy.include_command_allowed = false; + this.pushState('action'); + this.unput(yytext); + yytext = ''; + return 'ACTION_START'; +"%{"([^]*?)"%}" yytext = this.matches[1]; + yy.include_command_allowed = true; + return 'ACTION'; +"%include" %{ + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState('path'); + return 'INCLUDE'; + } else { + // TODO + yyerror('oops!'); + return 'INCLUDE_PLACEMENT_ERROR'; + } + %} +{WS}*"/*"[^]*?"*/" //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 'ACTION_BODY_C_COMMENT'; +{WS}*"//".* yy.include_command_allowed = false; + return 'ACTION_BODY_CPP_COMMENT'; +{WS}+ return 'ACTION_BODY_WHITESPACE'; + +// make sure to terminate on linefeed before the next rule alternative, +// which is announced by `|`: +"|" if (yy.include_command_allowed) { + this.popState(); + this.unput(yytext); + yytext = ''; + return 'ACTION_END'; + } else { + return 'ACTION_BODY'; + } + +// make sure to terminate on linefeed before the rule section ends, +// which is announced by `%%`: +"%%" if (yy.include_command_allowed) { + this.popState(); + this.unput(yytext); + yytext = ''; + return 'ACTION_END'; + } else { + return 'ACTION_BODY'; + } + +"%" return 'ACTION_BODY'; + // regexp with braces or quotes (and no spaces, so we don't mistake // a *division operator* `/` for a regex delimiter here in most circumstances): -"/"[^\s/]*?['"{}][^\s]*?"/" return 'ACTION_BODY'; +"/"[^\s/]*?(?:['"`{}][^\s/]*?)*"/" + yy.include_command_allowed = false; + return 'ACTION_BODY'; +// hack to cope with slashes which MAY be divide operators OR are regex starters: +// we simply gobble the entire line until the end or until we hit a closing brace, +// as we MUST keep track of the curly brace pairs inside an action body. +"/"[^}{BR}]* + yy.include_command_allowed = false; + return 'ACTION_BODY'; \"{DOUBLEQUOTED_STRING_CONTENT}\" + yy.include_command_allowed = false; + return 'ACTION_BODY'; +\'{QUOTED_STRING_CONTENT}\' yy.include_command_allowed = false; return 'ACTION_BODY'; -\'{QUOTED_STRING_CONTENT}\' +\`{ES2017_STRING_CONTENT}\` yy.include_command_allowed = false; + return 'ACTION_BODY'; +[^{}/"'`|%\{\}{BR}{WS}]+ yy.include_command_allowed = false; + return 'ACTION_BODY'; +"{" yy.depth++; + yy.include_command_allowed = false; return 'ACTION_BODY'; -[/"'][^{}/"']+ return 'ACTION_BODY'; -[^{}/"']+ return 'ACTION_BODY'; -"{" yy.depth++; return '{'; "}" %{ - if (yy.depth == 0) { - this.popState(); - this.pushState('trail'); + yy.include_command_allowed = false; + if (yy.depth <= 0) { + yyerror(rmCommonWS` + too many closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'BRACKETS_SURPLUS'; } else { yy.depth--; } - return '}'; + return 'ACTION_BODY'; + %} +// make sure to terminate on linefeed before the next rule alternative, +// which is announced by `|`, or lexer option/command, which +// starts with `%`, e.g. `%include`: +(?:{BR}{WS}+)+/[^{WS}{BR}|%] yy.include_command_allowed = true; + return 'ACTION_BODY_WHITESPACE'; // keep empty lines as-is inside action code blocks. +{BR} if (yy.depth > 0) { + yy.include_command_allowed = true; + return 'ACTION_BODY_WHITESPACE'; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk + this.popState(); + this.unput(yytext); + yytext = ''; + return 'ACTION_END'; + } +<> %{ + yy.include_command_allowed = false; + if (yy.depth !== 0) { + yyerror(rmCommonWS` + missing ${yy.depth} closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + yytext = ''; + return 'BRACKETS_MISSING'; + } + this.popState(); + yytext = ''; + return 'ACTION_END'; %} {NAME} return 'NAME'; @@ -68,10 +175,31 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "," return ','; "*" return '*'; +// Comments should be gobbled and discarded anywhere +// *except* the code/action blocks: +{WS}*"//"[^\r\n]* + /* skip single-line comment */ +{WS}*"/*"(.|\n|\r)*?"*/" + /* skip multi-line comment */ + {BR}+ /* empty */ {WS}+{BR}+ /* empty */ -{WS}+ this.pushState('indented'); -"%%" this.popState(); this.pushState('code'); return '%%'; +"//"[^\r\n]* + /* skip single-line comment */ +"/*"(.|\n|\r)*?"*/" + /* skip multi-line comment */ +// ACTION code chunks follow rules and are generally indented, but +// never start with characters special to the lex language itself: +// - `%` can start options, commands, etc., e.g. `%include` or `%options` +// - `|` starts a rule alternative, never a chunk of action code. +// - +{WS}+/[^{WS}{BR}|%] yy.depth = 0; + yy.include_command_allowed = true; + this.pushState('action'); + return 'ACTION_START'; +"%%" this.popState(); + this.pushState('code'); + return '%%'; // Accept any non-regex-special character as a direct literal without // the need to put quotes around it: {ANY_LITERAL_CHAR}+ @@ -83,15 +211,11 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {NAME} return 'NAME'; "=" return '='; \"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = unescQuote(this.matches[1]); return 'OPTION_STRING_VALUE'; // value is always a string type + yytext = unescQuote(this.matches[1], /\\"/g); return 'OPTION_STRING_VALUE'; // value is always a string type \'{QUOTED_STRING_CONTENT}\' - yytext = unescQuote(this.matches[1]); return 'OPTION_STRING_VALUE'; // value is always a string type - -// Comments should be gobbled and discarded anywhere *except* the code/action blocks: -"//"[^\r\n]* - /* skip single-line comment */ -"/*"(.|\n|\r)*?"*/" - /* skip multi-line comment */ + yytext = unescQuote(this.matches[1], /\\'/g); return 'OPTION_STRING_VALUE'; // value is always a string type +\`{ES2017_STRING_CONTENT}\` + yytext = unescQuote(this.matches[1], /\\`/g); return 'OPTION_STRING_VALUE'; // value is always a string type [^\s\r\n]+ return 'OPTION_VALUE'; {BR}{WS}+(?=\S) /* skip leading whitespace on the next line of input, when followed by more options */ @@ -102,33 +226,6 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR}+ this.popState(); {WS}+ /* empty */ -{WS}*{BR}+ this.popState(); this.unput(yytext); /* this.unput(yytext); can be used here instead of this.reject(); which would only work when we set the backtrack_lexer option */ - -{WS}*{BR}+ this.popState(); -"{" yy.depth = 0; this.pushState('action'); return '{'; -"%{"((?:.|{BR})*?)"%}" this.pushState('trail'); yytext = this.matches[1]; return 'ACTION'; -"%{"((?:.|{BR})*?)"%}" yytext = this.matches[1]; return 'ACTION'; -"%include" %{ - // This is an include instruction in place of an action: - // thanks to the `.+` rule immediately below we need to semi-duplicate - // the `%include` token recognition here vs. the almost-identical rule for the same - // further below. - // There's no real harm as we need to do something special in this case anyway: - // push 2 (two!) conditions. - // - // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar - // parse correctly took several hours as the debug facilities were - and are - too meager to - // quickly diagnose the problem while we hadn't. So the code got littered with debug prints - // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) - - // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... - this.pushState('trail'); - // then push the immediate need: the 'path' condition. - this.pushState('path'); - return 'INCLUDE'; - %} -.* this.popState(); return 'ACTION'; - {ID} this.pushState('macro'); return 'NAME'; {BR}+ this.popState(); @@ -144,11 +241,11 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] \s+ /* empty */ \"{DOUBLEQUOTED_STRING_CONTENT}\" %{ - yytext = unescQuote(this.matches[1]); + yytext = unescQuote(this.matches[1], /\\"/g); return 'STRING_LIT'; %} \'{QUOTED_STRING_CONTENT}\' %{ - yytext = unescQuote(this.matches[1]); + yytext = unescQuote(this.matches[1], /\\'/g); return 'STRING_LIT'; %} "[" this.pushState('set'); return 'REGEX_SET_START'; @@ -175,27 +272,34 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "%options" this.pushState('options'); return 'OPTIONS'; "%s" this.pushState('start_condition'); return 'START_INC'; "%x" this.pushState('start_condition'); return 'START_EXC'; -"%include" this.pushState('path'); return 'INCLUDE'; -"%"{NAME}([^\r\n]*) + +"%include" yy.depth = 0; + yy.include_command_allowed = true; + this.pushState('action'); + this.unput(yytext); + yytext = ''; + return 'ACTION_START'; + +"%include" this.pushState('path'); + return 'INCLUDE'; + +"%"{NAME}([^\r\n]*) %{ /* ignore unrecognized decl */ - var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); - var l2 = 19; - var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); - this.warn('LEX: ignoring unsupported lexer option', dquote(yytext), 'while lexing in', this.topState(), 'state:\n' + indent(this.showPosition(l1, l2), 4) - // , '\n', { - // remaining_input: this._input, - // matched: this.matched, - // matches: this.matches - // } - ); + this.warn(rmCommonWS` + LEX: ignoring unsupported lexer option ${dquote(yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); yytext = [ this.matches[1], // {NAME} this.matches[2].trim() // optional value/parameters ]; return 'UNKNOWN_DECL'; %} -"%%" this.pushState('rules'); return '%%'; +"%%" this.pushState('rules'); + return '%%'; "{"\d+(","\s*\d+|",")?"}" return 'RANGE_REGEX'; "{"{ID}"}" return 'NAME_BRACE'; "{"{ID}"}" return 'NAME_BRACE'; @@ -205,7 +309,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] (?:"\\\\"|"\\]"|[^\]{])+ return 'REGEX_SET'; "{" return 'REGEX_SET'; -"]" this.popState(); +"]" this.popState(); return 'REGEX_SET_END'; @@ -217,41 +321,114 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR} this.popState(); this.unput(yytext); + \"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = unescQuote(this.matches[1]); - this.popState(); - return 'PATH'; + yytext = unescQuote(this.matches[1]); + this.popState(); + return 'PATH'; \'{QUOTED_STRING_CONTENT}\' - yytext = unescQuote(this.matches[1]); - this.popState(); - return 'PATH'; + yytext = unescQuote(this.matches[1]); + this.popState(); + return 'PATH'; + {WS}+ // skip whitespace in the line -[^\s\r\n]+ this.popState(); +[^\s\r\n]+ this.popState(); return 'PATH'; + +// detect and report unterminated string constants ASAP +// for 'action', 'options', but also for other lexer conditions: +// +// these error catching rules fix https://github.com/GerHobbelt/jison/issues/13 +\" yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'error'; +\' yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'error'; +\` yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'error'; + +\" yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'error'; +\' yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'error'; +\` yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'error'; + +<*>\" var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'error'; +<*>\' var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'error'; +<*>\` var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); + return 'error'; + + . %{ /* b0rk on bad characters */ - var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); - var l2 = 39; - var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); - var pos_str = this.showPosition(l1, l2); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); - } - yyerror('unsupported lexer input: ' + dquote(yytext) + ' while lexing ' + rules + '\n (i.e. jison lex regexes).\n\n NOTE: When you want the input ' + dquote(yytext) + ' to be interpreted as a literal part\n of a lex rule regex, you MUST enclose it in double or single quotes,\n e.g. as shown in this error message just before. If not, then know\n that this is not accepted as a regex operator here in\n jison-lex ' + rules + '.' + pos_str); + yyerror(rmCommonWS` + unsupported lexer input encountered while lexing + ${rules} (i.e. jison lex regexes). + + NOTE: When you want this input to be interpreted as a LITERAL part + of a lex rule regex, you MUST enclose it in double or + single quotes. + + If not, then know that this input is not accepted as a valid + regex expression here in jison-lex ${rules}. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); %} <*>. %{ - /* b0rk on bad characters */ - var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); - var l2 = 39; - var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); - var pos_str = this.showPosition(l1, l2); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n\n Offending input:\n' + indent(pos_str, 4); - } - yyerror('unsupported lexer input: ' + dquote(yytext) + ' while lexing in ' + dquote(this.topState()) + ' state.' + pos_str); + yyerror(rmCommonWS` + unsupported lexer input: ${dquote(yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + prettyPrintRange(this, yylloc)); %} <*><> return 'EOF'; @@ -264,7 +441,7 @@ function indent(s, i) { return pf + a.join('\n' + pf); } -// unescape a string value which is wrapped in quotes/doublequotes +// unescape a string value which is wrapped in quotes/doublequotes function unescQuote(str) { str = '' + str; var a = str.split('\\\\'); @@ -292,6 +469,108 @@ function dquote(s) { return s; } +// tagged template string helper which removes the indentation common to all +// non-empty lines: that indentation was added as part of the source code +// formatting of this lexer spec file and must be removed to produce what +// we were aiming for. +// +// Each template string starts with an optional empty line, which should be +// removed entirely, followed by a first line of error reporting content text, +// which should not be indented at all, i.e. the indentation of the first +// non-empty line should be treated as the 'common' indentation and thus +// should also be removed from all subsequent lines in the same template string. +// +// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals +function rmCommonWS(strings, ...values) { + // as `strings[]` is an array of strings, each potentially consisting + // of multiple lines, followed by one(1) value, we have to split each + // individual string into lines to keep that bit of information intact. + var src = strings.map(function splitIntoLines(s) { + return s.split('\n'); + }); + // fetch the first line of content which is expected to exhibit the common indent: + // that would be the SECOND line of input, always, as the FIRST line won't + // have any indentation at all! + var s0 = ''; + for (var i = 0, len = src.length; i < len; i++) { + if (src[i].length > 1) { + s0 = src[i][1]; + break; + } + } + var indent = s0.replace(/^(\s+)[^\s]*.*$/, '$1'); + // we assume clean code style, hence no random mix of tabs and spaces, so every + // line MUST have the same indent style as all others, so `length` of indent + // should suffice, but the way we coded this is stricter checking when we apply + // a find-and-replace regex instead: + var indent_re = new RegExp('^' + indent); + + // process template string partials now: + for (var i = 0, len = src.length; i < len; i++) { + // start-of-lines always end up at index 1 and above (for each template string partial): + for (var j = 1, linecnt = src[i].length; j < linecnt; j++) { + src[i][j] = src[i][j].replace(indent_re, ''); + } + } + + // now merge everything to construct the template result: + var rv = []; + for (var i = 0, len = src.length, klen = values.length; i < len; i++) { + rv.push(src[i].join('\n')); + // all but the last partial are followed by a template value: + if (i < klen) { + rv.push(values[i]); + } + } + var sv = rv.join(''); + return sv; +} + +// pretty-print the erroneous section of the input, with line numbers and everything... +function prettyPrintRange(lexer, loc, context_loc, context_loc2) { + var error_size = loc.last_line - loc.first_line; + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + var input = lexer.matched + lexer._input; + var lines = input.split('\n'); + var show_context = (error_size < 5 || context_loc); + var l0 = Math.max(1, (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); + var l1 = Math.max(1, (!show_context ? loc.last_line : context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); + var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); + var ws_prefix = new Array(lineno_display_width).join(' '); + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ': ' + line; + if (show_context) { + var errpfx = (new Array(lineno_display_width + 1)).join('^'); + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); + var lead = (new Array(offset)).join('.'); + var mark = (new Array(len)).join('^'); + rv += '\n' + errpfx + lead + mark + offset + '/A' + len; + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = (new Array(offset)).join('.'); + var mark = (new Array(len)).join('^'); + rv += '\n' + errpfx + lead + mark + offset + '/B' + len; + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = (new Array(offset)).join('.'); + var mark = (new Array(len)).join('^'); + rv += '\n' + errpfx + lead + mark + offset + '/C' + len; + } + } + rv = rv.replace(/\t/g, ' '); + return rv; + }); + return rv.join('\n'); +} + + lexer.warn = function l_warn() { if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { return this.yy.parser.warn.apply(this, arguments); diff --git a/lex.y b/lex.y index e501cbf..b6d440a 100644 --- a/lex.y +++ b/lex.y @@ -6,6 +6,8 @@ %nonassoc '/' '/!' %left '*' '+' '?' RANGE_REGEX +%left '|' +%left '(' %% @@ -24,7 +26,7 @@ lex $$.options = yy.options; break; } - + if (yy.actionInclude) { var asrc = yy.actionInclude.join('\n\n'); // Only a non-empty action code chunk should actually make it through: @@ -39,16 +41,19 @@ lex } | init definitions error EOF { - yyerror(`Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: - - definitions - %% - rules - %% // <-- optional! - extra_module_code // <-- optional! - - Erroneous code: -` + prettyPrintRange(yylexer, @error)); + yyerror(rmCommonWS` + Maybe you did not correctly separate the lexer sections with a '%%' + on an otherwise empty line? + The lexer spec file should have this structure: + + definitions + %% + rules + %% // <-- optional! + extra_module_code // <-- optional! + + Erroneous code: + ` + prettyPrintRange(yylexer, @error)); } ; @@ -84,7 +89,7 @@ init ; definitions - : definition definitions + : definitions definition { $$ = $definitions; if ($definition != null) { @@ -116,16 +121,8 @@ definition { $$ = $names_inclusive; } | START_EXC names_exclusive { $$ = $names_exclusive; } - | '{' action_body '}' - { yy.actionInclude.push($action_body); $$ = null; } - | '{' action_body error - { - yyerror("Seems you did not correctly bracket the lexer preparatory action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, @error, @action_body)); - } - | ACTION - { yy.actionInclude.push($ACTION); $$ = null; } - | include_macro_code - { yy.actionInclude.push($include_macro_code); $$ = null; } + | action + { yy.actionInclude.push($action); $$ = null; } | options { $$ = null; } | UNKNOWN_DECL @@ -172,11 +169,25 @@ rules_collective } | start_conditions '{' error '}' { - yyerror("Seems you made a mistake while specifying one of the lexer rules inside the start condition <" + $start_conditions.join(',') + "> { rules... } block.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylexer.mergeLocationInfo(##start_conditions, ##4), @start_conditions)); + yyerror(rmCommonWS` + Seems you made a mistake while specifying one of the lexer rules inside + the start condition + <${$start_conditions.join(',')}> { rules... } + block. + + Erroneous area: + ` + prettyPrintRange(yylexer, yylexer.mergeLocationInfo(##start_conditions, ##4), @start_conditions)); } | start_conditions '{' error { - yyerror("Seems you did not correctly bracket a lexer rules set inside the start condition <" + $start_conditions.join(',') + "> { rules... } as a terminating curly brace '}' could not be found.\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error, @start_conditions)); + yyerror(rmCommonWS` + Seems you did not correctly bracket a lexer rules set inside + the start condition + <${$start_conditions.join(',')}> { rules... } + as a terminating curly brace '}' could not be found. + + Erroneous area: + ` + prettyPrintRange(yylexer, @error, @start_conditions)); } ; @@ -189,49 +200,87 @@ rule_block rule : regex action - { $$ = [$regex, $action]; } + { + $$ = [$regex, $action]; + } | regex error { $$ = [$regex, $error]; + console.log('############# DUMP:', { + yysp, + yyrulelength, + yyvstack, + yystack, + yysstack, + error: $error, + text: yytext + }); yyerror("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error, @regex)); } ; action - : '{' action_body '}' - { $$ = $action_body; } - | '{' action_body error + : ACTION_START action_body BRACKET_MISSING { - yyerror("Seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, @error, @1)); + yyerror("Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, @BRACKET_MISSING, @1)); + } + | ACTION_START action_body BRACKET_SURPLUS + { + yyerror("Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, @BRACKET_SURPLUS, @1)); + } + | ACTION_START action_body ACTION_END + { + if (0) { + $$ = 'XXX' + $action_body + 'YYY'; + } else { + var s = $action_body.trim(); + // remove outermost set of braces UNLESS there's + // a curly brace in there anywhere: in that case + // we should leave it up to the sophisticated + // code analyzer to simplify the code! + // + // This is a very rough check as it ill also look + // inside code comments, which should not have + // any influence. + // + // Nevertheless: this is a *safe* transform! + if (s[0] === '{' && s.indexOf('}') === s.length - 1) { + $$ = s.substring(1, s.length - 1).trim(); + } else { + $$ = s; + } + } } - | unbracketed_action_body - { $$ = $unbracketed_action_body; } - | include_macro_code - { $$ = $include_macro_code; } - ; - -unbracketed_action_body - : ACTION - | unbracketed_action_body ACTION - { $$ = $unbracketed_action_body + '\n' + $ACTION; } ; action_body - : action_comments_body - { $$ = $action_comments_body; } - | action_body '{' action_body '}' action_comments_body - { $$ = $1 + $2 + $3 + $4 + $5; } - | action_body '{' action_body error + : action_body ACTION + { $$ = $action_body + '\n\n' + $ACTION + '\n\n'; } + | action_body ACTION_BODY + { $$ = $action_body + $ACTION_BODY; } + | action_body ACTION_BODY_C_COMMENT + { $$ = $action_body + $ACTION_BODY_C_COMMENT; } + | action_body ACTION_BODY_CPP_COMMENT + { $$ = $action_body + $ACTION_BODY_CPP_COMMENT; } + | action_body ACTION_BODY_WHITESPACE + { $$ = $action_body + $ACTION_BODY_WHITESPACE; } + | action_body include_macro_code + { $$ = $action_body + '\n\n' + $include_macro_code + '\n\n'; } + | action_body INCLUDE_PLACEMENT_ERROR + { + yyerror("" + + " You may place the '%include' instruction only at the start/front of" + + " a line. " + +"" + + " It's use is not permitted at this position:" + + "" + prettyPrintRange(yylexer, @INCLUDE_PLACEMENT_ERROR, @action_body)); + } + | action_body error { - yyerror("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + prettyPrintRange(yylexer, @error, @action_body1)); + yyerror("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + prettyPrintRange(yylexer, @error, @action_body)); } - ; - -action_comments_body - : ε + | ε { $$ = ''; } - | action_comments_body ACTION_BODY - { $$ = $action_comments_body + $ACTION_BODY; } ; start_conditions @@ -321,23 +370,32 @@ regex ; regex_list - : nonempty_regex_list + : regex_list '|' regex_concat + { $$ = $1 + '|' + $3; } + | regex_list '|' + { $$ = $1 + '|'; } + | regex_concat + { $$ = $1; } | ε { $$ = ''; } ; nonempty_regex_list - : regex_concat '|' regex_list + : nonempty_regex_list '|' regex_concat { $$ = $1 + '|' + $3; } - | '|' regex_list + | nonempty_regex_list '|' + { $$ = $1 + '|'; } + | '|' regex_concat { $$ = '|' + $2; } | regex_concat + { $$ = $1; } ; regex_concat : regex_concat regex_base { $$ = $1 + $2; } | regex_base + { $$ = $1; } ; regex_base @@ -391,8 +449,8 @@ any_group_regex ; regex_set - : regex_set_atom regex_set - { $$ = $regex_set_atom + $regex_set; } + : regex_set regex_set_atom + { $$ = $regex_set + $regex_set_atom; } | regex_set_atom ; @@ -452,23 +510,28 @@ option | NAME[option] '=' error { // TODO ... - yyerror(`internal error: option "${$option}" value assignment failure. + yyerror(rmCommonWS` + internal error: option "${$option}" value assignment failure. - Erroneous area: -` + prettyPrintRange(yylexer, @error, @option)); + Erroneous area: + ` + prettyPrintRange(yylexer, @error, @option)); } | error { // TODO ... - yyerror("expected a valid option name (with optional value assignment).\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error)); + yyerror(rmCommonWS` + expected a valid option name (with optional value assignment). + + Erroneous area: + ` + prettyPrintRange(yylexer, @error)); } ; extra_lexer_module_code : optional_module_code_chunk { $$ = $optional_module_code_chunk; } - | optional_module_code_chunk include_macro_code extra_lexer_module_code - { $$ = $optional_module_code_chunk + $include_macro_code + $extra_lexer_module_code; } + | extra_lexer_module_code include_macro_code optional_module_code_chunk + { $$ = $extra_lexer_module_code + $include_macro_code + $optional_module_code_chunk; } ; include_macro_code @@ -481,7 +544,11 @@ include_macro_code } | INCLUDE error { - yyerror("%include MUST be followed by a valid file path.\n\n Erroneous path:\n" + prettyPrintRange(yylexer, @error)); + yyerror(rmCommonWS` + %include MUST be followed by a valid file path. + + Erroneous path: + ` + prettyPrintRange(yylexer, @error, @INCLUDE)); } ; @@ -493,7 +560,11 @@ module_code_chunk | error { // TODO ... - yyerror("module code declaration error?\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error)); + yyerror(rmCommonWS` + module code declaration error? + + Erroneous area: + ` + prettyPrintRange(yylexer, @error)); } ; @@ -540,45 +611,103 @@ function parseValue(v) { return v; } +// tagged template string helper which removes the indentation common to all +// non-empty lines: that indentation was added as part of the source code +// formatting of this lexer spec file and must be removed to produce what +// we were aiming for. +// +// Each template string starts with an optional empty line, which should be +// removed entirely, followed by a first line of error reporting content text, +// which should not be indented at all, i.e. the indentation of the first +// non-empty line should be treated as the 'common' indentation and thus +// should also be removed from all subsequent lines in the same template string. +// +// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals +function rmCommonWS(strings, ...values) { + // as `strings[]` is an array of strings, each potentially consisting + // of multiple lines, followed by one(1) value, we have to split each + // individual string into lines to keep that bit of information intact. + var src = strings.map(function splitIntoLines(s) { + return s.split('\n'); + }); + // fetch the first line of content which is expected to exhibit the common indent: + // that would be the SECOND line of input, always, as the FIRST line won't + // have any indentation at all! + var s0 = ''; + for (var i = 0, len = src.length; i < len; i++) { + if (src[i].length > 1) { + s0 = src[i][1]; + break; + } + } + var indent = s0.replace(/^(\s+)[^\s]*.*$/, '$1'); + // we assume clean code style, hence no random mix of tabs and spaces, so every + // line MUST have the same indent style as all others, so `length` of indent + // should suffice, but the way we coded this is stricter checking when we apply + // a find-and-replace regex instead: + var indent_re = new RegExp('^' + indent); + + // process template string partials now: + for (var i = 0, len = src.length; i < len; i++) { + // start-of-lines always end up at index 1 and above (for each template string partial): + for (var j = 1, linecnt = src[i].length; j < linecnt; j++) { + src[i][j] = src[i][j].replace(indent_re, ''); + } + } + + // now merge everything to construct the template result: + var rv = []; + for (var i = 0, len = src.length, klen = values.length; i < len; i++) { + rv.push(src[i].join('\n')); + // all but the last partial are followed by a template value: + if (i < klen) { + rv.push(values[i]); + } + } + var sv = rv.join(''); + return sv; +} + // pretty-print the erroneous section of the input, with line numbers and everything... -function prettyPrintRange(lexer, loc, context_loc) { +function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var error_size = loc.last_line - loc.first_line; const CONTEXT = 3; - var input = lexer.matched; + const CONTEXT_TAIL = 1; + var input = lexer.matched + lexer._input; var lines = input.split('\n'); var show_context = (error_size < 5 || context_loc); - var l0 = (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT); - var l1 = loc.last_line; + var l0 = Math.max(1, (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); + var l1 = Math.max(1, (!show_context ? loc.last_line : context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); var ws_prefix = new Array(lineno_display_width).join(' '); var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { var lno = index + l0; var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); - line = lno_pfx + ': ' + line; + var rv = lno_pfx + ': ' + line; if (show_context) { var errpfx = (new Array(lineno_display_width + 1)).join('^'); if (lno === loc.first_line) { var offset = loc.first_column + 2; - var len = (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1; - var lead = (new Array(offset)).join(' '); + var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); + var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - line += '\n' + errpfx + lead + mark; + rv += '\n' + errpfx + lead + mark + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; } else if (lno === loc.last_line) { var offset = 2 + 1; - var len = loc.last_column + 1; - var lead = (new Array(offset)).join(' '); + var len = Math.max(2, loc.last_column + 1); + var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - line += '\n' + errpfx + lead + mark; + rv += '\n' + errpfx + lead + mark + offset + '/E' + len; } else if (lno > loc.first_line && lno < loc.last_line) { var offset = 2 + 1; - var len = line.length + 1; - var lead = (new Array(offset)).join(' '); + var len = Math.max(2, line.length + 1); + var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - line += '\n' + errpfx + lead + mark; + rv += '\n' + errpfx + lead + mark + offset + '/F' + len; } } - line = line.replace(/\t/g, ' '); - return line; + rv = rv.replace(/\t/g, ' '); + return rv; }); return rv.join('\n'); } @@ -592,3 +721,15 @@ parser.log = function p_log() { console.log.apply(console, arguments); }; +parser.pre_parse = function p_lex() { + console.log('pre_parse:', arguments); +}; + +parser.yy.pre_parse = function p_lex() { + console.log('pre_parse YY:', arguments); +}; + +parser.yy.post_lex = function p_lex() { + console.log('post_lex:', arguments); +}; + diff --git a/tests/all-tests.js b/tests/all-tests.js index 916e5a7..562422a 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -149,7 +149,7 @@ describe("LEX Parser", function () { var lexgrammar = '%%\n"["[^\\]]"]" %{\nreturn true;\n%}\n'; var expected = { rules: [ - ["\\[[^\\]]\\]", "\nreturn true;\n"] + ["\\[[^\\]]\\]", "return true;"] ], macros: {}, startConditions: {}, @@ -163,7 +163,7 @@ describe("LEX Parser", function () { var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b={};return true;\n}\n'; var expected = { rules: [ - ["\\[[^\\]]\\]", "\nvar b={};return true;\n"] + ["\\[[^\\]]\\]", "{\nvar b={};return true;\n}"] ], macros: {}, startConditions: {}, @@ -174,10 +174,10 @@ describe("LEX Parser", function () { }); it("test multiline action with brace in a multi-line-comment", function () { - var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b={}; /* { */ return true;\n}\n'; + var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b=7; /* { */ return true;\n}\n'; var expected = { rules: [ - ["\\[[^\\]]\\]", "\nvar b={}; /* { */ return true;\n"] + ["\\[[^\\]]\\]", "var b=7; /* { */ return true;"] ], macros: {}, startConditions: {}, @@ -191,7 +191,7 @@ describe("LEX Parser", function () { var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b={}; // { \nreturn 2 / 3;\n}\n'; var expected = { rules: [ - ["\\[[^\\]]\\]", "\nvar b={}; // { \nreturn 2 / 3;\n"] + ["\\[[^\\]]\\]", "{\nvar b={}; // { \nreturn 2 / 3;\n}"] ], macros: {}, startConditions: {}, @@ -205,7 +205,7 @@ describe("LEX Parser", function () { var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b=\'{\' + "{"; // { \nreturn 2 / 3;\n}\n'; var expected = { rules: [ - ["\\[[^\\]]\\]", "\nvar b='{' + \"{\"; // { \nreturn 2 / 3;\n"] + ["\\[[^\\]]\\]", "var b='{' + \"{\"; // { \nreturn 2 / 3;"] ], macros: {}, startConditions: {}, @@ -219,7 +219,7 @@ describe("LEX Parser", function () { var lexgrammar = '%%\n"["[^\\]]"]" {\nvar b=/{/; // { \nreturn 2 / 3;\n}\n'; var expected = { rules: [ - ["\\[[^\\]]\\]", "\nvar b=/{/; // { \nreturn 2 / 3;\n"] + ["\\[[^\\]]\\]", "var b=/{/; // { \nreturn 2 / 3;"] ], macros: {}, startConditions: {}, @@ -233,7 +233,7 @@ describe("LEX Parser", function () { var lexgrammar = '%%\n"["[^\\]]"]"\n var b=/{/;\n // { \n return 2 / 3;\n'; var expected = { rules: [ - ["\\[[^\\]]\\]", "var b=/{/;\n// { \nreturn 2 / 3;"] + ["\\[[^\\]]\\]", "var b=/{/;\n // { \n return 2 / 3;"] ], macros: {}, startConditions: {}, @@ -247,9 +247,9 @@ describe("LEX Parser", function () { var lexgrammar = '\nRULE [0-9]\n\n%{\n hi \n%}\n%%\n"["[^\\]]"]" %{\nreturn true;\n%}\n'; var expected = { macros: {"RULE": "[0-9]"}, - actionInclude: "\n hi \n", + actionInclude: "hi ", rules: [ - ["\\[[^\\]]\\]", "\nreturn true;\n"] + ["\\[[^\\]]\\]", "return true;"] ], startConditions: {}, unknownDecls: [] @@ -656,7 +656,7 @@ describe("LEX Parser", function () { var expected = { macros: {"BR": "\\r\\n|\\n|\\r"}, rules: [ - ["{BR}", "\r\nreturn true;\r\n"] + ["{BR}", "return true;"] ], startConditions: {}, unknownDecls: [] @@ -669,7 +669,7 @@ describe("LEX Parser", function () { var lexgrammar = '%%\r\n"["[^\\]]"]" %{\r\nreturn true;\r\n%}\r\n'; var expected = { rules: [ - ["\\[[^\\]]\\]", "\r\nreturn true;\r\n"] + ["\\[[^\\]]\\]", "return true;"] ], macros: {}, startConditions: {}, @@ -683,8 +683,8 @@ describe("LEX Parser", function () { var lexgrammar = '%%\n"a" %{ \nreturn true;\n%} \n \n"b" %{ return 1;\n%} \n \n'; var expected = { rules: [ - ["a", " \nreturn true;\n"], - ["b", " return 1;\n"] + ["a", "return true;"], + ["b", "return 1;"] ], macros: {}, startConditions: {}, From a64c580a8367cdda0df91858d2a4eca18e865379 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 4 Sep 2017 18:13:11 +0200 Subject: [PATCH 356/417] updated NPM packages --- package-lock.json | 34 +++++++++++++--------------------- package.json | 2 +- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1d5926a..660c05d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -632,9 +632,9 @@ "dev": true }, "chai": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.1.tgz", - "integrity": "sha1-ZuISeebzxkFf+CMYeCJ5AOIXGzk=", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", "dev": true }, "chalk": { @@ -773,18 +773,10 @@ "dev": true }, "deep-eql": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-2.0.2.tgz", - "integrity": "sha1-sbrAblbwp2d3aG1Qyf63XC7XZ5o=", - "dev": true, - "dependencies": { - "type-detect": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-3.0.0.tgz", - "integrity": "sha1-RtDMhVOrt7E6NSsNbeov1Y8tm1U=", - "dev": true - } - } + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.0.tgz", + "integrity": "sha512-9zef2MtjASSE1Pts2Nm6Yh5MTVdVh+s4Qt/e+jPV6qTBhqTc0WOEaWnLvLKGxky0gwZGmcY6TnUqyCD6fNs5Lg==", + "dev": true }, "define-property": { "version": "1.0.0", @@ -1863,9 +1855,9 @@ "dev": true }, "source-map-support": { - "version": "0.4.16", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.16.tgz", - "integrity": "sha512-A6vlydY7H/ljr4L2UOhDSajQdZQ6dMD7cLH0pzwcmwLyc9u8PNI4WGtnfDDzX7uzGL6c/T+ORL97Zlh+S4iOrg==", + "version": "0.4.17", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.17.tgz", + "integrity": "sha512-30c1Ch8FSjV0FwC253iftbbj0dU/OXoSg1LAEGZJUlGgjTNj6cu+DVqJWWIZJY5RXLWV4eFtR+4ouo0VIOYOTg==", "dev": true }, "source-map-url": { @@ -1969,9 +1961,9 @@ "dev": true }, "supports-color": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.2.1.tgz", - "integrity": "sha512-qxzYsob3yv6U+xMzPrv170y8AwGP7i74g+pbixCfD6rgso8BscLT2qXIuz6TpOaiJZ3mFgT5O9lyT9nMU4LfaA==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true }, "temp": { diff --git a/package.json b/package.json index 14c6d13..83c9bd0 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "@gerhobbelt/xregexp": "3.2.0-21" }, "devDependencies": { - "chai": "4.1.1", + "chai": "4.1.2", "jison-gho": "0.6.0-188", "mocha": "3.5.0" } From 9e123d4fc5760d91bb80237ddae4e16d8fc64d3e Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 5 Sep 2017 19:02:53 +0200 Subject: [PATCH 357/417] - only output debug pre/post lexing info when yydebug is set. - regenerated parser. --- lex-parser.js | 346 +++++++++++++++++++++----------------------------- lex.y | 6 +- 2 files changed, 147 insertions(+), 205 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index dd699e5..1d75658 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-189 */ +/* parser generated by jison 0.6.0-188 */ /* * Returns a Parser object of the following structure: @@ -1582,26 +1582,12 @@ case 101: ` + prettyPrintRange(yylexer, yylstack[yysp])); break; -case 129: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! +case 104: // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. - var yye_values = yyvstack.slice(yysp - yyrulelength, yysp + 1); - var yye_symbols = yystack.slice(yysp - yyrulelength, yysp + 1); - $$ = { - values: yye_values, - symbols: yye_symbols - }; - console.log('############# COMBINE:', { - yysp, - yyrulelength, - yyvstack, - yystack, - yysstack - }); - break; } @@ -2765,7 +2751,7 @@ parse: function parse(input) { var TERROR = this.TERROR, EOF = this.EOF, ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; - var NO_ACTION = [0, 129 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + var NO_ACTION = [0, table.length /* ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -3280,7 +3266,7 @@ parse: function parse(input) { } else { errStr = 'Parse error: '; } - if (typeof lexer.showPosition === 'function') { + if (lexer.showPosition) { errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; } if (expected.length) { @@ -3351,24 +3337,7 @@ parse: function parse(input) { // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token: stack[sp] = preErrorSymbol; - if (errStr) { - console.log('########## PUSH ERROR TOK', { - sp, - vstack, - stack, - sstack, - combineState: NO_ACTION[1] - }); - vstack[sp] = { - yytext: lexer.yytext, - errorRuleDepth: error_rule_depth, - errorStr: errStr, - errorSymbolDescr: errSymbolDescr, - expectedStr: expected - }; - } else { - vstack[sp] = lexer.yytext; - } + vstack[sp] = lexer.yytext; lstack[sp] = lexer.yylloc; sstack[sp] = newState || NO_ACTION[1]; sp++; @@ -3379,14 +3348,6 @@ parse: function parse(input) { len = error_rule_depth; - console.log('########## performAction: COMBINE', { - sp, - vstack, - stack, - sstack, - combineState: NO_ACTION[1], - yyval, yytext, len, - }); r = this.performAction.call(yyval, yytext, yyloc, NO_ACTION[1], sp - 1, len, vstack, lstack, stack, sstack); if (typeof r !== 'undefined') { @@ -3724,17 +3685,17 @@ parser.log = function p_log() { }; parser.pre_parse = function p_lex() { - console.log('pre_parse:', arguments); + if (parser.yydebug) parser.log('pre_parse:', arguments); }; parser.yy.pre_parse = function p_lex() { - console.log('pre_parse YY:', arguments); + if (parser.yydebug) parser.log('pre_parse YY:', arguments); }; parser.yy.post_lex = function p_lex() { - console.log('post_lex:', arguments); + if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-189 */ +/* lexer generated by jison-lex 0.6.0-188 */ /* * Returns a Lexer object of the following structure: @@ -4523,14 +4484,10 @@ var lexer = function() { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; + var pos_str = this.showPosition(); - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; } var p = this.constructLexErrorInfo( @@ -4867,14 +4824,10 @@ var lexer = function() { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); + var pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; } var p = this.constructLexErrorInfo( @@ -4943,14 +4896,10 @@ var lexer = function() { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); + var pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; } var p = this.constructLexErrorInfo( @@ -4990,14 +4939,6 @@ var lexer = function() { r = this.next(); } - console.log('@@@@@@@@@ lex: ', { - token: r, - sym: this.yy.parser && typeof this.yy.parser.describeSymbol === 'function' && this.yy.parser.describeSymbol(r), - describeTypeFunc: this.yy.parser && typeof this.yy.parser.describeSymbol, - condition: this.conditionStack, - text: this.yytext - }, '\n' + ((this.showPosition ? this.showPosition() : '???'))); - if (typeof this.options.post_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.options.post_lex.call(this, r) || r; @@ -5122,6 +5063,7 @@ var lexer = function() { case 2: /*! Conditions:: action */ /*! Rule:: %include\b */ + if (yy.include_command_allowed) { // This is an include instruction in place of an action: // @@ -5231,6 +5173,7 @@ var lexer = function() { case 16: /*! Conditions:: action */ /*! Rule:: \} */ + yy.include_command_allowed = false; if (yy.depth <= 0) { @@ -5277,6 +5220,7 @@ var lexer = function() { case 19: /*! Conditions:: action */ /*! Rule:: $ */ + yy.include_command_allowed = false; if (yy.depth !== 0) { @@ -5355,6 +5299,7 @@ var lexer = function() { case 32: /*! Conditions:: rules */ /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is return 44; @@ -5425,6 +5370,7 @@ var lexer = function() { case 47: /*! Conditions:: macro */ /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is return 44; @@ -5443,6 +5389,7 @@ var lexer = function() { case 50: /*! Conditions:: rules macro INITIAL */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); return 43; @@ -5450,6 +5397,7 @@ var lexer = function() { case 51: /*! Conditions:: rules macro INITIAL */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); return 43; @@ -5529,6 +5477,7 @@ var lexer = function() { case 77: /*! Conditions:: INITIAL rules code */ /*! Rule:: %{NAME}([^\r\n]*) */ + /* ignore unrecognized decl */ this.warn(rmCommonWS` LEX: ignoring unsupported lexer option ${dquote(yy_.yytext)} @@ -5602,10 +5551,9 @@ var lexer = function() { /*! Conditions:: action */ /*! Rule:: " */ yy_.yyerror(rmCommonWS` - unterminated string constant in lexer rule action block. - - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); +unterminated string constant in lexer rule action block. +Erroneous area: +` + prettyPrintRange(this, yy_.yylloc)); return 2; break; @@ -5613,10 +5561,9 @@ var lexer = function() { /*! Conditions:: action */ /*! Rule:: ' */ yy_.yyerror(rmCommonWS` - unterminated string constant in lexer rule action block. - - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); +unterminated string constant in lexer rule action block. +Erroneous area: +` + prettyPrintRange(this, yy_.yylloc)); return 2; break; @@ -5624,10 +5571,9 @@ var lexer = function() { /*! Conditions:: action */ /*! Rule:: ` */ yy_.yyerror(rmCommonWS` - unterminated string constant in lexer rule action block. - - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); +unterminated string constant in lexer rule action block. +Erroneous area: +` + prettyPrintRange(this, yy_.yylloc)); return 2; break; @@ -5635,10 +5581,9 @@ var lexer = function() { /*! Conditions:: options */ /*! Rule:: " */ yy_.yyerror(rmCommonWS` - unterminated string constant in %options entry. - - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); +unterminated string constant in %options entry. +Erroneous area: +` + prettyPrintRange(this, yy_.yylloc)); return 2; break; @@ -5646,10 +5591,9 @@ var lexer = function() { /*! Conditions:: options */ /*! Rule:: ' */ yy_.yyerror(rmCommonWS` - unterminated string constant in %options entry. - - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); +unterminated string constant in %options entry. +Erroneous area: +` + prettyPrintRange(this, yy_.yylloc)); return 2; break; @@ -5657,10 +5601,9 @@ var lexer = function() { /*! Conditions:: options */ /*! Rule:: ` */ yy_.yyerror(rmCommonWS` - unterminated string constant in %options entry. - - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); +unterminated string constant in %options entry. +Erroneous area: +` + prettyPrintRange(this, yy_.yylloc)); return 2; break; @@ -5670,11 +5613,10 @@ var lexer = function() { var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); yy_.yyerror(rmCommonWS` - unterminated string constant encountered while lexing - ${rules}. - - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); +unterminated string constant encountered while lexing +${rules}. +Erroneous area: +` + prettyPrintRange(this, yy_.yylloc)); return 2; break; @@ -5684,11 +5626,10 @@ var lexer = function() { var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); yy_.yyerror(rmCommonWS` - unterminated string constant encountered while lexing - ${rules}. - - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); +unterminated string constant encountered while lexing +${rules}. +Erroneous area: +` + prettyPrintRange(this, yy_.yylloc)); return 2; break; @@ -5698,17 +5639,17 @@ var lexer = function() { var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); yy_.yyerror(rmCommonWS` - unterminated string constant encountered while lexing - ${rules}. - - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); +unterminated string constant encountered while lexing +${rules}. +Erroneous area: +` + prettyPrintRange(this, yy_.yylloc)); return 2; break; case 103: /*! Conditions:: macro rules */ /*! Rule:: . */ + /* b0rk on bad characters */ var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); @@ -5730,6 +5671,7 @@ var lexer = function() { case 104: /*! Conditions:: * */ /*! Rule:: . */ + yy_.yyerror(rmCommonWS` unsupported lexer input: ${dquote(yy_.yytext)} while lexing in ${dquote(this.topState())} state. @@ -5996,6 +5938,92 @@ var lexer = function() { ], conditions: { + 'code': { + rules: [76, 77, 87, 88, 100, 101, 102, 104, 105], + inclusive: false + }, + + 'start_condition': { + rules: [24, 25, 42, 43, 44, 100, 101, 102, 104, 105], + inclusive: false + }, + + 'options': { + rules: [ + 24, + 25, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 81, + 97, + 98, + 99, + 100, + 101, + 102, + 104, + 105 + ], + + inclusive: false + }, + + 'conditions': { + rules: [20, 21, 22, 23, 100, 101, 102, 104, 105], + inclusive: false + }, + + 'action': { + rules: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 94, + 95, + 96, + 100, + 101, + 102, + 104, + 105 + ], + + inclusive: false + }, + + 'path': { + rules: [24, 25, 89, 90, 91, 92, 93, 100, 101, 102, 104, 105], + inclusive: false + }, + + 'set': { + rules: [81, 84, 85, 86, 100, 101, 102, 104, 105], + inclusive: false + }, + 'rules': { rules: [ 0, @@ -6102,92 +6130,6 @@ var lexer = function() { inclusive: true }, - 'code': { - rules: [76, 77, 87, 88, 100, 101, 102, 104, 105], - inclusive: false - }, - - 'start_condition': { - rules: [24, 25, 42, 43, 44, 100, 101, 102, 104, 105], - inclusive: false - }, - - 'options': { - rules: [ - 24, - 25, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 81, - 97, - 98, - 99, - 100, - 101, - 102, - 104, - 105 - ], - - inclusive: false - }, - - 'conditions': { - rules: [20, 21, 22, 23, 100, 101, 102, 104, 105], - inclusive: false - }, - - 'action': { - rules: [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 94, - 95, - 96, - 100, - 101, - 102, - 104, - 105 - ], - - inclusive: false - }, - - 'path': { - rules: [24, 25, 89, 90, 91, 92, 93, 100, 101, 102, 104, 105], - inclusive: false - }, - - 'set': { - rules: [81, 84, 85, 86, 100, 101, 102, 104, 105], - inclusive: false - }, - 'INITIAL': { rules: [ 0, diff --git a/lex.y b/lex.y index b6d440a..5e4e0f8 100644 --- a/lex.y +++ b/lex.y @@ -722,14 +722,14 @@ parser.log = function p_log() { }; parser.pre_parse = function p_lex() { - console.log('pre_parse:', arguments); + if (parser.yydebug) parser.log('pre_parse:', arguments); }; parser.yy.pre_parse = function p_lex() { - console.log('pre_parse YY:', arguments); + if (parser.yydebug) parser.log('pre_parse YY:', arguments); }; parser.yy.post_lex = function p_lex() { - console.log('post_lex:', arguments); + if (parser.yydebug) parser.log('post_lex:', arguments); }; From 34fe95e6939794ff9b26ab47d7de65b054b8d6d1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 6 Sep 2017 04:22:22 +0200 Subject: [PATCH 358/417] rebuilt library files --- lex-parser.js | 3357 ++++++++++++++++++++++++++++++------------------- 1 file changed, 2093 insertions(+), 1264 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 1d75658..9e1722f 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-188 */ +/* parser generated by jison 0.6.0-189 */ /* * Returns a Parser object of the following structure: @@ -196,7 +196,7 @@ * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and * the internal parser gets properly garbage collected under these particular circumstances. * - * mergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back), + * yyMergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back), * Helper function **which will be set up during the first invocation of the `parse()` method**. * This helper API can be invoked to calculate a spanning `yylloc` location info object. * @@ -543,7 +543,7 @@ var parser = { // // Options: // - // no default action: ............... false + // default action mode: ............. classic,merge // no try..catch: ................... false // no default resolve on conflict: false // on-demand look-ahead: ............ false @@ -565,7 +565,8 @@ var parser = { // // Parser Analysis flags: // - // all actions are default: ......... false + // no significant actions (parser is a language matcher only): + // .................................. false // uses yyleng: ..................... false // uses yylineno: ................... false // uses yytext: ..................... true @@ -583,7 +584,9 @@ var parser = { // uses yysstack: ................... true // uses yysp: ....................... true // uses yyrulelength: ............... true + // uses yyMergeLocationInfo API: .... true // has error recovery: .............. true + // has error reporting: ............. true // // --------- END OF REPORT ----------- @@ -746,7 +749,7 @@ originalQuoteName: null, originalParseError: null, cleanupAfterParse: null, constructParseErrorInfo: null, -mergeLocationInfo: null, +yyMergeLocationInfo: null, __reentrant_call_depth: 0, // INTERNAL USE ONLY __error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup @@ -966,13 +969,21 @@ performAction: function parser__PerformAction(yytext, yyloc, yystate /* action[1 switch (yystate) { case 0: /*! Production:: $accept : lex $end */ - // default action (generated by JISON): + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): this.$ = yyvstack[yysp - 1]; this._$ = yylstack[yysp - 1]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; case 1: /*! Production:: lex : init definitions rules_and_epilogue EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1]; this.$.macros = yyvstack[yysp - 2].macros; this.$.startConditions = yyvstack[yysp - 2].startConditions; @@ -1000,6 +1011,13 @@ case 1: case 2: /*! Production:: lex : init definitions error EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError(rmCommonWS` Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? @@ -1017,6 +1035,12 @@ case 2: case 3: /*! Production:: rules_and_epilogue : "%%" rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; } else { @@ -1026,22 +1050,47 @@ case 3: case 4: /*! Production:: rules_and_epilogue : "%%" rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = { rules: yyvstack[yysp] }; break; case 5: - /*! Production:: rules_and_epilogue : ε */ + /*! Production:: rules_and_epilogue : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = { rules: [] }; break; case 6: - /*! Production:: init : ε */ + /*! Production:: init : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yy.actionInclude = []; if (!yy.options) yy.options = {}; break; case 7: /*! Production:: definitions : definitions definition */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1]; if (yyvstack[yysp] != null) { if ('length' in yyvstack[yysp]) { @@ -1057,7 +1106,13 @@ case 7: break; case 8: - /*! Production:: definitions : ε */ + /*! Production:: definitions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = { macros: {}, // { hash table } startConditions: {}, // { hash table } @@ -1069,6 +1124,12 @@ case 9: /*! Production:: definition : NAME regex */ case 27: /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; @@ -1076,80 +1137,126 @@ case 10: /*! Production:: definition : START_INC names_inclusive */ case 11: /*! Production:: definition : START_EXC names_exclusive */ -case 50: - /*! Production:: regex_list : regex_concat */ -case 55: - /*! Production:: nonempty_regex_list : regex_concat */ -case 57: - /*! Production:: regex_concat : regex_base */ -case 82: - /*! Production:: escape_char : ESCAPE_CHAR */ -case 83: - /*! Production:: range_regex : RANGE_REGEX */ -case 95: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 99: - /*! Production:: module_code_chunk : CODE */ -case 102: - /*! Production:: optional_module_code_chunk : module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp]; break; case 12: /*! Production:: definition : action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + yy.actionInclude.push(yyvstack[yysp]); this.$ = null; break; case 13: /*! Production:: definition : options */ -case 86: - /*! Production:: options : OPTIONS option_list OPTIONS_END */ -case 87: - /*! Production:: option_list : option option_list */ case 88: /*! Production:: option_list : option */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = null; break; case 14: /*! Production:: definition : UNKNOWN_DECL */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = {type: 'unknown', body: yyvstack[yysp]}; break; case 15: /*! Production:: names_inclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; break; case 16: /*! Production:: names_inclusive : names_inclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; break; case 17: /*! Production:: names_exclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; break; case 18: /*! Production:: names_exclusive : names_exclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; break; case 19: /*! Production:: rules : rules rules_collective */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; case 20: - /*! Production:: rules : ε */ + /*! Production:: rules : %epsilon */ case 26: - /*! Production:: rule_block : ε */ + /*! Production:: rule_block : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = []; break; case 21: /*! Production:: rules_collective : start_conditions rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + if (yyvstack[yysp - 1]) { yyvstack[yysp].unshift(yyvstack[yysp - 1]); } @@ -1158,6 +1265,12 @@ case 21: case 22: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + if (yyvstack[yysp - 3]) { yyvstack[yysp - 1].forEach(function (d) { d.unshift(yyvstack[yysp - 3]); @@ -1168,6 +1281,13 @@ case 22: case 23: /*! Production:: rules_collective : start_conditions "{" error "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError(rmCommonWS` Seems you made a mistake while specifying one of the lexer rules inside the start condition @@ -1180,6 +1300,13 @@ case 23: case 24: /*! Production:: rules_collective : start_conditions "{" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError(rmCommonWS` Seems you did not correctly bracket a lexer rules set inside the start condition @@ -1192,11 +1319,23 @@ case 24: case 25: /*! Production:: rule_block : rule_block rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); break; case 28: /*! Production:: rule : regex error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; console.log('############# DUMP:', { yysp, @@ -1212,16 +1351,36 @@ case 28: case 29: /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError("Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 30: /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError("Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 31: /*! Production:: action : ACTION_START action_body ACTION_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + if (0) { this.$ = 'XXX' + yyvstack[yysp - 1] + 'YYY'; } else { @@ -1248,6 +1407,12 @@ case 32: /*! Production:: action_body : action_body ACTION */ case 37: /*! Production:: action_body : action_body include_macro_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; break; @@ -1267,11 +1432,24 @@ case 78: /*! Production:: regex_set : regex_set regex_set_atom */ case 100: /*! Production:: module_code_chunk : module_code_chunk CODE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; case 38: /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError("" + " You may place the '%include' instruction only at the start/front of" + " a line. " + @@ -1282,52 +1460,104 @@ case 38: case 39: /*! Production:: action_body : action_body error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; case 40: - /*! Production:: action_body : ε */ + /*! Production:: action_body : %epsilon */ case 51: - /*! Production:: regex_list : ε */ + /*! Production:: regex_list : %epsilon */ case 103: - /*! Production:: optional_module_code_chunk : ε */ + /*! Production:: optional_module_code_chunk : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = ''; break; case 41: /*! Production:: start_conditions : "<" name_list ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1]; break; case 42: /*! Production:: start_conditions : "<" name_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError("Seems you did not correctly terminate the start condition set <" + yyvstack[yysp - 1].join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 43: /*! Production:: start_conditions : "<" "*" ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = ['*']; break; case 44: - /*! Production:: start_conditions : ε */ - // default action (generated by JISON): + /*! Production:: start_conditions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): this.$ = undefined; - this._$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; case 45: /*! Production:: name_list : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = [yyvstack[yysp]]; break; case 46: /*! Production:: name_list : name_list "," NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; case 47: /*! Production:: regex : nonempty_regex_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + // Detect if the regex ends with a pure (Unicode) word; // we *do* consider escaped characters which are 'alphanumeric' // to be equivalent to their non-escaped version, hence these are @@ -1395,6 +1625,12 @@ case 48: /*! Production:: regex_list : regex_list "|" regex_concat */ case 52: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; @@ -1402,21 +1638,70 @@ case 49: /*! Production:: regex_list : regex_list "|" */ case 53: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1] + '|'; break; +case 50: + /*! Production:: regex_list : regex_concat */ +case 55: + /*! Production:: nonempty_regex_list : regex_concat */ +case 57: + /*! Production:: regex_concat : regex_base */ +case 82: + /*! Production:: escape_char : ESCAPE_CHAR */ +case 83: + /*! Production:: range_regex : RANGE_REGEX */ +case 95: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ +case 99: + /*! Production:: module_code_chunk : CODE */ +case 102: + /*! Production:: optional_module_code_chunk : module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + case 54: /*! Production:: nonempty_regex_list : "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = '|' + yyvstack[yysp]; break; case 58: /*! Production:: regex_base : "(" regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = '(' + yyvstack[yysp - 1] + ')'; break; case 59: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; @@ -1424,31 +1709,68 @@ case 60: /*! Production:: regex_base : "(" regex_list error */ case 61: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 62: /*! Production:: regex_base : regex_base "+" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1] + '+'; break; case 63: /*! Production:: regex_base : regex_base "*" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1] + '*'; break; case 64: /*! Production:: regex_base : regex_base "?" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 1] + '?'; break; case 65: /*! Production:: regex_base : "/" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = '(?=' + yyvstack[yysp] + ')'; break; case 66: /*! Production:: regex_base : "/!" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = '(?!' + yyvstack[yysp] + ')'; break; @@ -1468,23 +1790,43 @@ case 80: /*! Production:: regex_set_atom : REGEX_SET */ case 85: /*! Production:: string : CHARACTER_LIT */ - // default action (generated by JISON): + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): this.$ = yyvstack[yysp]; this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; case 70: /*! Production:: regex_base : "." */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = '.'; break; case 71: /*! Production:: regex_base : "^" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = '^'; break; case 72: /*! Production:: regex_base : "$" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = '$'; break; @@ -1492,16 +1834,35 @@ case 76: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ case 96: /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; case 77: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 81: /*! Production:: regex_set_atom : name_expansion */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) && yyvstack[yysp].toUpperCase() !== yyvstack[yysp] ) { @@ -1515,16 +1876,58 @@ case 81: case 84: /*! Production:: string : STRING_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + this.$ = prepareString(yyvstack[yysp]); break; +case 86: + /*! Production:: options : OPTIONS option_list OPTIONS_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 87: + /*! Production:: option_list : option option_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + case 89: /*! Production:: option : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yy.options[yyvstack[yysp]] = true; break; case 90: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; @@ -1532,11 +1935,25 @@ case 91: /*! Production:: option : NAME "=" OPTION_VALUE */ case 92: /*! Production:: option : NAME "=" NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; case 93: /*! Production:: option : NAME "=" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + // TODO ... yyparser.yyError(rmCommonWS` internal error: option "${$option}" value assignment failure. @@ -1547,6 +1964,13 @@ case 93: case 94: /*! Production:: option : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + // TODO ... yyparser.yyError(rmCommonWS` expected a valid option name (with optional value assignment). @@ -1557,6 +1981,12 @@ case 94: case 97: /*! Production:: include_macro_code : INCLUDE PATH */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + var fs = require('fs'); var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); // And no, we don't support nested '%include': @@ -1565,6 +1995,13 @@ case 97: case 98: /*! Production:: include_macro_code : INCLUDE error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + yyparser.yyError(rmCommonWS` %include MUST be followed by a valid file path. @@ -1574,6 +2011,13 @@ case 98: case 101: /*! Production:: module_code_chunk : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + // TODO ... yyparser.yyError(rmCommonWS` module code declaration error? @@ -1582,7 +2026,7 @@ case 101: ` + prettyPrintRange(yylexer, yylstack[yysp])); break; -case 104: +case 129: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -2738,20 +3182,28 @@ parseError: function parseError(str, hash, ExceptionClass) { } }, parse: function parse(input) { - var self = this, - stack = new Array(128), // token stack: stores token which leads to state at the same index (column storage) - sstack = new Array(128), // state stack: stores states (column storage) + var self = this; + var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage) + var sstack = new Array(128); // state stack: stores states (column storage) + + var vstack = new Array(128); // semantic value stack + var lstack = new Array(128); // location stack + var table = this.table; + var sp = 0; // 'stack pointer': index into the stacks + var yyloc; + var yytext; + var yylineno; - vstack = new Array(128), // semantic value stack - lstack = new Array(128), // location stack - table = this.table, - sp = 0; // 'stack pointer': index into the stacks + var symbol = 0; + var preErrorSymbol = 0; + var lastEofErrorStateDepth = 0; + var recoveringErrorInfo = null; var recovering = 0; // (only used when the grammar contains error recovery rules) - var TERROR = this.TERROR, - EOF = this.EOF, - ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; - var NO_ACTION = [0, table.length /* ensures that anyone using this new state will fail dramatically! */]; + var TERROR = this.TERROR; + var EOF = this.EOF; + var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; + var NO_ACTION = [0, 129 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -2761,33 +3213,58 @@ parse: function parse(input) { } var sharedState_yy = { - parseError: null, - quoteName: null, - lexer: null, - parser: null, - pre_parse: null, - post_parse: null, - pre_lex: null, - post_lex: null + parseError: undefined, + quoteName: undefined, + lexer: undefined, + parser: undefined, + pre_parse: undefined, + post_parse: undefined, + pre_lex: undefined, + post_lex: undefined }; - function shallow_copy(dst, src) { - for (var k in src) { - if (Object.prototype.hasOwnProperty.call(src, k)) { - dst[k] = src[k]; + this.yyGetSharedState = function yyGetSharedState() { + return sharedState_yy; + }; + + + this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() { + return recoveringErrorInfo; + }; + + + // shallow clone objects, straight copy of simple `src` values + // e.g. `lexer.yytext` MAY be a complex value object, + // rather than a simple string/value. + function shallow_copy(src) { + if (typeof src === 'object') { + var dst = {}; + for (var k in src) { + if (Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } } + return dst; } + return src; } function shallow_copy_noclobber(dst, src) { for (var k in src) { - if (dst[k] === undefined && Object.prototype.hasOwnProperty.call(src, k)) { + if (typeof dst[k] === 'undefined' && Object.prototype.hasOwnProperty.call(src, k)) { dst[k] = src[k]; } } } + function copy_yylloc(loc) { + var rv = shallow_copy(loc); + if (rv && rv.range) { + rv.range = rv.range.slice(0); + } + return rv; + } // copy state - shallow_copy(sharedState_yy, this.yy); + shallow_copy_noclobber(sharedState_yy, this.yy); sharedState_yy.lexer = lexer; sharedState_yy.parser = this; @@ -2796,20 +3273,6 @@ parse: function parse(input) { - - - - - - - - - - - - - - // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount // to have *their* closure match ours -- if we only set them up once, // any subsequent `parse()` runs will fail in very obscure ways when @@ -2821,9 +3284,40 @@ parse: function parse(input) { + + + + + + + + var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1); var expected = this.collect_expected_token_set(state); var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0)); + // append to the old one? + if (recoveringErrorInfo) { + var esp = recoveringErrorInfo.info_stack_pointer; + + recoveringErrorInfo.symbol_stack[esp] = symbol; + var v = shallowCopyErrorInfo(hash); + v.yyError = true; + v.errorRuleDepth = error_rule_depth; + v.recovering = recovering; + // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH; + + recoveringErrorInfo.value_stack[esp] = v; + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + } else { + recoveringErrorInfo = shallowCopyErrorInfo(hash); + recoveringErrorInfo.yyError = true; + recoveringErrorInfo.errorRuleDepth = error_rule_depth; + recoveringErrorInfo.recovering = recovering; + } // Add any extra args to the hash under the name `extra_error_attributes`: @@ -2842,20 +3336,6 @@ parse: function parse(input) { - lexer.setInput(input, sharedState_yy); - - var yyloc = lexer.yylloc; - lstack[sp] = yyloc; - vstack[sp] = null; - sstack[sp] = 0; - stack[sp] = 0; - ++sp; - - var yytext = lexer.yytext; - - - - var ranges = lexer.options && lexer.options.ranges; // Does the shared state override the default `parseError` that already comes with this instance? if (typeof sharedState_yy.parseError === 'function') { @@ -2906,7 +3386,7 @@ parse: function parse(input) { } // cleanup: - if (hash) { + if (hash && hash.destroy) { hash.destroy(); } } @@ -2949,6 +3429,14 @@ parse: function parse(input) { } } this.__error_infos.length = 0; + + + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + recoveringErrorInfo = undefined; + } + + } return resultValue; @@ -2956,7 +3444,7 @@ parse: function parse(input) { // merge yylloc info into a new yylloc instance. // - // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stakc array. + // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array. // // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which // case these override the corresponding first/last indexes. @@ -2966,7 +3454,7 @@ parse: function parse(input) { // yylloc info. // // Note: epsilon rule's yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL. - this.mergeLocationInfo = function parser_mergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) { + this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) { var i1 = first_index | 0, i2 = last_index | 0; var l1 = first_yylloc, @@ -3020,8 +3508,7 @@ parse: function parse(input) { } else { // shallow-copy L2: after all, we MAY be looking // at unconventional yylloc info objects... - rv = {}; - shallow_copy(rv, l2); + rv = shallow_copy(l2); if (rv.range) { // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: rv.range = rv.range.slice(0); @@ -3030,8 +3517,7 @@ parse: function parse(input) { } } else { // shallow-copy L1, then adjust first col/row 1 column past the end. - rv = {}; - shallow_copy(rv, l1); + rv = shallow_copy(l1); rv.first_line = rv.last_line; rv.first_column = rv.last_column; if (rv.range) { @@ -3061,10 +3547,9 @@ parse: function parse(input) { return undefined; } - rv = {}; // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking // at unconventional yylloc info objects... - shallow_copy(rv, l1); + rv = shallow_copy(l1); // first_line: ..., // first_column: ..., @@ -3141,6 +3626,83 @@ parse: function parse(input) { return pei; }; + // clone some parts of the (possibly enhanced!) errorInfo object + // to give them some persistence. + function shallowCopyErrorInfo(p) { + var rv = shallow_copy(p); + + // lexer.yytext MAY be a complex value object, rather than a simple string/value: + rv.value = shallow_copy(rv.value); + + // yylloc info: + rv.loc = copy_yylloc(rv.loc); + + // the 'expected' set won't be modified, so no need to clone it: + //rv.expected = rv.expected.slice(0); + + //symbol stack is a simple array: + rv.symbol_stack = rv.symbol_stack.slice(0); + // ditto for state stack: + rv.state_stack = rv.state_stack.slice(0); + // clone the yylloc's in the location stack?: + rv.location_stack = rv.location_stack.map(copy_yylloc); + // and the value stack may carry both simple and complex values: + // shallow-copy the latter. + rv.value_stack = rv.value_stack.map(shallow_copy); + + // and we don't bother with the sharedState_yy reference: + //delete rv.yy; + + // now we prepare for tracking the COMBINE actions + // in the error recovery code path: + // + // as we want to keep the maximum error info context, we + // *scan* the state stack to find the first *empty* slot. + // This position will surely be AT OR ABOVE the current + // stack pointer, but we want to keep the 'used but discarded' + // part of the parse stacks *intact* as those slots carry + // error context that may be useful when you want to produce + // very detailed error diagnostic reports. + // + // ### Purpose of each stack pointer: + // + // - stack_pointer: points at the top of the parse stack + // **as it existed at the time of the error + // occurrence, i.e. at the time the stack + // snapshot was taken and copied into the + // errorInfo object.** + // - base_pointer: the bottom of the **empty part** of the + // stack, i.e. **the start of the rest of + // the stack space /above/ the existing + // parse stack. This section will be filled + // by the error recovery process as it + // travels the parse state machine to + // arrive at the resolving error recovery rule.** + // - info_stack_pointer: + // this stack pointer points to the **top of + // the error ecovery tracking stack space**, i.e. + // this stack pointer takes up the role of + // the `stack_pointer` for the error recovery + // process. Any mutations in the **parse stack** + // are **copy-appended** to this part of the + // stack space, keeping the bottom part of the + // stack (the 'snapshot' part where the parse + // state at the time of error occurrence was kept) + // intact. + // - root_failure_pointer: + // copy of the `stack_pointer`... + // + for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== 'undefined'; i++) { + // empty + } + rv.base_pointer = i; + rv.info_stack_pointer = i; + + rv.root_failure_pointer = rv.stack_pointer; + + return rv; + } + function lex() { var token = lexer.lex(); @@ -3152,16 +3714,15 @@ parse: function parse(input) { } - var symbol = 0; - var preErrorSymbol = 0; - var lastEofErrorStateDepth = 0; var state, action, r, t; var yyval = { $: true, _$: undefined, yy: sharedState_yy }; - var p, len, this_production; + var p; + var yyrulelen; + var this_production; var newState; var retval = false; @@ -3176,6 +3737,14 @@ parse: function parse(input) { for (;;) { // check for error recovery rule in this state + + + + + + + + var t = table[state][TERROR] || NO_ACTION; if (t[0]) { // We need to make sure we're not cycling forever: @@ -3192,11 +3761,27 @@ parse: function parse(input) { // very complex error/recovery code interplay in the core + user // action code blocks: + + + + + + + + if (symbol === EOF) { if (!lastEofErrorStateDepth) { lastEofErrorStateDepth = sp - 1 - depth; } else if (lastEofErrorStateDepth <= sp - 1 - depth) { + + + + + + + + --stack_probe; // popStack(1): [symbol, action] state = sstack[stack_probe]; ++depth; @@ -3207,6 +3792,14 @@ parse: function parse(input) { } if (state === 0 /* $accept rule */ || stack_probe < 1) { + + + + + + + + return -1; // No suitable error recovery rule available. } --stack_probe; // popStack(1): [symbol, action] @@ -3219,6 +3812,19 @@ parse: function parse(input) { try { this.__reentrant_call_depth++; + lexer.setInput(input, sharedState_yy); + + yyloc = lexer.yylloc; + lstack[sp] = yyloc; + vstack[sp] = null; + sstack[sp] = 0; + stack[sp] = 0; + ++sp; + + yytext = lexer.yytext; + + + if (this.pre_parse) { this.pre_parse.call(this, sharedState_yy); } @@ -3251,6 +3857,13 @@ parse: function parse(input) { + + + + + + + // handle parse error if (!action) { // first see if there's any chance at hitting an error recovery rule: @@ -3266,7 +3879,8 @@ parse: function parse(input) { } else { errStr = 'Parse error: '; } - if (lexer.showPosition) { + + if (typeof lexer.showPosition === 'function') { errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; } if (expected.length) { @@ -3274,10 +3888,25 @@ parse: function parse(input) { } else { errStr += 'Unexpected ' + errSymbolDescr; } + p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0)); + + // cleanup the old one before we start the new error info track: + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + } + recoveringErrorInfo = shallowCopyErrorInfo(p); + r = this.parseError(p.errStr, p, this.JisonParserError); + + + + + + + // Protect against overly blunt userland `parseError` code which *sets* // the `recoverable` flag without properly checking first: // we always terminate the parse when there's no recovery rule available anyhow! @@ -3291,14 +3920,24 @@ parse: function parse(input) { + + + + + + + + var esp = recoveringErrorInfo.info_stack_pointer; + // just recovered from another error if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { // SHIFT current lookahead and grab another - stack[sp] = symbol; - vstack[sp] = lexer.yytext; - lstack[sp] = lexer.yylloc; - sstack[sp] = newState; // push state - ++sp; + recoveringErrorInfo.symbol_stack[esp] = symbol; + recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState; // push state + ++esp; + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: yytext = lexer.yytext; @@ -3307,10 +3946,12 @@ parse: function parse(input) { symbol = lex(); - if (error_rule_depth >= 0) { - // correct for the ERROR SHIFT above by adjusting the REDUCE amount: - error_rule_depth++; - } + + + + + + } @@ -3318,6 +3959,7 @@ parse: function parse(input) { // try to recover from error if (error_rule_depth < 0) { //assert(recovering); + recoveringErrorInfo.info_stack_pointer = esp; // barf a fatal hairball when we're out of look-ahead symbols and none hit a match // while we are still busy recovering from another error: @@ -3335,20 +3977,55 @@ parse: function parse(input) { preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token symbol = TERROR; // insert generic error symbol as new lookahead + const EXTRA_STACK_SAMPLE_DEPTH = 3; + // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token: - stack[sp] = preErrorSymbol; - vstack[sp] = lexer.yytext; - lstack[sp] = lexer.yylloc; - sstack[sp] = newState || NO_ACTION[1]; - sp++; - error_rule_depth++; - - yyval.$ = undefined; + recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol; + if (errStr) { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + errorStr: errStr, + errorSymbolDescr: errSymbolDescr, + expectedStr: expected, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + + + + + + + + + + } else { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + } + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + yyval.$ = recoveringErrorInfo; yyval._$ = undefined; - len = error_rule_depth; + yyrulelen = error_rule_depth; + + + + + + - r = this.performAction.call(yyval, yytext, yyloc, NO_ACTION[1], sp - 1, len, vstack, lstack, stack, sstack); + + + r = this.performAction.call(yyval, yytext, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack); if (typeof r !== 'undefined') { retval = r; @@ -3356,27 +4033,45 @@ parse: function parse(input) { } // pop off stack - sp -= len; + sp -= yyrulelen; + + // and move the top entries + discarded part of the parse stacks onto the error info stack: + for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) { + recoveringErrorInfo.symbol_stack[esp] = stack[idx]; + recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]); + recoveringErrorInfo.state_stack[esp] = sstack[idx]; + } - stack[sp] = TERROR; - vstack[sp] = yyval.$; - lstack[sp] = yyval._$; - // goto new state = table[STATE][NONTERMINAL] + recoveringErrorInfo.symbol_stack[esp] = TERROR; + recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$); + // goto new state = table[STATE][NONTERMINAL] newState = sstack[sp - 1]; if (this.defaultActions[newState]) { - sstack[sp] = this.defaultActions[newState]; + recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState]; } else { t = (table[newState] && table[newState][symbol]) || NO_ACTION; - sstack[sp] = t[1]; + recoveringErrorInfo.state_stack[esp] = t[1]; } + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + // allow N (default: 3) real symbols to be shifted before reporting a new error recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; + + + + + + + continue; } @@ -3425,12 +4120,28 @@ parse: function parse(input) { if (recovering > 0) { recovering--; + + + + + + + + } } else { // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: symbol = preErrorSymbol; preErrorSymbol = 0; + + + + + + + + // read action for current state and first input t = (table[newState] && table[newState][symbol]) || NO_ACTION; if (!t[0] || symbol === TERROR) { @@ -3443,6 +4154,14 @@ parse: function parse(input) { // Yes, this does not take into account the possibility that the *lexer* may have // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + + + + + + symbol = 0; } } @@ -3452,14 +4171,18 @@ parse: function parse(input) { // reduce: case 2: this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... - len = this_production[1]; + yyrulelen = this_production[1]; + + + - yyval.$ = undefined; - yyval._$ = undefined; - r = this.performAction.call(yyval, yytext, yyloc, newState, sp - 1, len, vstack, lstack, stack, sstack); + + + + r = this.performAction.call(yyval, yytext, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack); if (typeof r !== 'undefined') { retval = r; @@ -3467,7 +4190,7 @@ parse: function parse(input) { } // pop off stack - sp -= len; + sp -= yyrulelen; // don't overwrite the `symbol` variable: use a local var to speed things up: var ntsymbol = this_production[0]; // push nonterminal (reduce) @@ -3479,6 +4202,14 @@ parse: function parse(input) { sstack[sp] = newState; ++sp; + + + + + + + + continue; // accept: @@ -3695,7 +4426,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-188 */ +/* lexer generated by jison-lex 0.6.0-189 */ /* * Returns a Lexer object of the following structure: @@ -3914,48 +4645,44 @@ parser.yy.post_lex = function p_lex() { * } */ - -var lexer = function() { +var lexer = (function() { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility // with userland code which might access the derived class in a 'classic' way. function JisonLexerError(msg, hash) { - Object.defineProperty(this, 'name', { + Object.defineProperty(this, "name", { enumerable: false, writable: false, - value: 'JisonLexerError' + value: "JisonLexerError" }); - if (msg == null) - msg = '???'; + if (msg == null) msg = "???"; - Object.defineProperty(this, 'message', { + Object.defineProperty(this, "message", { enumerable: false, writable: true, value: msg }); this.hash = hash; - var stacktrace; + var stacktrace; if (hash && hash.exception instanceof Error) { var ex2 = hash.exception; this.message = ex2.message || msg; stacktrace = ex2.stack; } - if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { + if (Error.hasOwnProperty("captureStackTrace")) { // V8 Error.captureStackTrace(this, this.constructor); } else { stacktrace = new Error(msg).stack; } } - if (stacktrace) { - Object.defineProperty(this, 'stack', { + Object.defineProperty(this, "stack", { enumerable: false, writable: false, value: stacktrace @@ -3963,14 +4690,13 @@ var lexer = function() { } } - if (typeof Object.setPrototypeOf === 'function') { + if (typeof Object.setPrototypeOf === "function") { Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); } else { JisonLexerError.prototype = Object.create(Error.prototype); } - JisonLexerError.prototype.constructor = JisonLexerError; - JisonLexerError.prototype.name = 'JisonLexerError'; + JisonLexerError.prototype.name = "JisonLexerError"; var lexer = { @@ -4016,7 +4742,6 @@ var lexer = function() { EOF: 1, - ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator @@ -4025,56 +4750,28 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - /// <-- internal rule set cache for the current lexer state - __currentRuleSet__: null, - - /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __error_infos: [], - - /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - __decompressed: false, - - /// INTERNAL USE ONLY - done: false, - - /// INTERNAL USE ONLY - _backtrack: false, + __currentRuleSet__: null, /// <-- internal rule set cache for the current lexer state - /// INTERNAL USE ONLY - _input: '', + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - /// INTERNAL USE ONLY - _more: false, + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - /// INTERNAL USE ONLY - _signaled_error_token: false, + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: "", /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY - /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - conditionStack: [], + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - match: '', - - /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matched: '', - - /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - matches: false, - - /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - yytext: '', - - /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - offset: 0, - - /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yyleng: 0, - - /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylineno: 0, - - /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction - yylloc: null, + match: "", /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: "", /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: "", /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -4082,15 +4779,15 @@ var lexer = function() { @public @this {RegExpLexer} */ - constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + constructLexErrorInfo: function lexer_constructLexErrorInfo( + msg, + recoverable + ) { /** @constructor */ var pei = { errStr: msg, recoverable: !!recoverable, - - // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... - text: this.match, - + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -4098,37 +4795,33 @@ var lexer = function() { lexer: this, /** - and make sure the error info doesn't stay due to potential - ref cycle via userland code manipulations. - These would otherwise all be memory leak opportunities! - - Note that only array and object references are nuked as those - constitute the set of elements which can produce a cyclic ref. - The rest of the members is kept intact as they are harmless. + and make sure the error info doesn't stay due to potential + ref cycle via userland code manipulations. + These would otherwise all be memory leak opportunities! + + Note that only array and object references are nuked as those + constitute the set of elements which can produce a cyclic ref. + The rest of the members is kept intact as they are harmless. - @public - @this {LexErrorInfo} - */ + @public + @this {LexErrorInfo} + */ destroy: function destructLexErrorInfo() { // remove cyclic references added to error info: // info.yy = null; // info.lexer = null; // ... var rec = !!this.recoverable; - for (var key in this) { - if (this.hasOwnProperty(key) && typeof key === 'object') { + if (this.hasOwnProperty(key) && typeof key === "object") { this[key] = undefined; } } - this.recoverable = rec; } }; - // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! this.__error_infos.push(pei); - return pei; }, @@ -4142,15 +4835,19 @@ var lexer = function() { if (!ExceptionClass) { ExceptionClass = this.JisonLexerError; } - if (this.yy) { - if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { - return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; - } else if (typeof this.yy.parseError === 'function') { - return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + if (this.yy.parser && typeof this.yy.parser.parseError === "function") { + return ( + this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || + this.ERROR + ); + } else if (typeof this.yy.parseError === "function") { + return ( + this.yy.parseError.call(this, str, hash, ExceptionClass) || + this.ERROR + ); } } - throw new ExceptionClass(str, hash); }, @@ -4161,20 +4858,17 @@ var lexer = function() { @this {RegExpLexer} */ yyerror: function yyError(str /*, ...args */) { - var lineno_msg = ''; - + var lineno_msg = ""; if (this.options.trackPosition) { - lineno_msg = ' on line ' + (this.yylineno + 1); + lineno_msg = " on line " + (this.yylineno + 1); } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': ' + str, + "Lexical error" + lineno_msg + ": " + str, this.options.lexerErrorsAreRecoverable ); // Add any extra args to the hash under the name `extra_error_attributes`: var args = Array.prototype.slice.call(arguments, 1); - if (args.length) { p.extra_error_attributes = args; } @@ -4198,7 +4892,7 @@ var lexer = function() { var rv; // prevent lingering circular references from causing memory leaks: - this.setInput('', {}); + this.setInput("", {}); // nuke the error hash info instances created during this run. // Userland code must COPY any data/references @@ -4206,12 +4900,10 @@ var lexer = function() { if (!do_not_nuke_errorinfos) { for (var i = this.__error_infos.length - 1; i >= 0; i--) { var el = this.__error_infos[i]; - - if (el && typeof el.destroy === 'function') { + if (el && typeof el.destroy === "function") { el.destroy(); } } - this.__error_infos.length = 0; } @@ -4225,19 +4917,20 @@ var lexer = function() { @this {RegExpLexer} */ clear: function lexer_clear() { - this.yytext = ''; + this.yytext = ""; this.yyleng = 0; - this.match = ''; + this.match = ""; this.matches = false; this._more = false; this._backtrack = false; - var col = (this.yylloc ? this.yylloc.last_column : 0); + var col = this.yylloc ? this.yylloc.last_column : 0; this.yylloc = { first_line: this.yylineno + 1, first_column: col, last_line: this.yylineno + 1, last_column: col, + range: [this.offset, this.offset] }; }, @@ -4257,24 +4950,24 @@ var lexer = function() { if (!this.__decompressed) { // step 1: decompress the regex list: var rules = this.rules; - for (var i = 0, len = rules.length; i < len; i++) { var rule_re = rules[i]; // compression: is the RE an xref to another RE slot in the rules[] table? - if (typeof rule_re === 'number') { + if (typeof rule_re === "number") { rules[i] = rules[rule_re]; } } // step 2: unfold the conditions[] set to make these ready for use: var conditions = this.conditions; - for (var k in conditions) { var spec = conditions[k]; + var rule_ids = spec.rules; + var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -4292,23 +4985,22 @@ var lexer = function() { this.__decompressed = true; } - this._input = input || ''; + this._input = input || ""; this.clear(); this._signaled_error_token = false; this.done = false; this.yylineno = 0; - this.matched = ''; - this.conditionStack = ['INITIAL']; + this.matched = ""; + this.conditionStack = ["INITIAL"]; this.__currentRuleSet__ = null; - this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0, + range: [0, 0] }; - this.offset = 0; return this; }, @@ -4336,15 +5028,13 @@ var lexer = function() { */ pushInput: function lexer_pushInput(input, label, options) { options = options || {}; - this._input = input || ''; - this.clear(); + this._input = input || ""; + this.clear(); // this._signaled_error_token = false; this.done = false; - this.yylineno = 0; - this.matched = ''; - + this.matched = ""; // this.conditionStack = ['INITIAL']; // this.__currentRuleSet__ = null; this.yylloc = { @@ -4352,9 +5042,9 @@ var lexer = function() { first_column: 0, last_line: 1, last_column: 0, + range: [0, 0] }; - this.offset = 0; return this; }, @@ -4370,29 +5060,24 @@ var lexer = function() { //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) return null; } - var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; - // Count the linenumber up when we hit the LF (or a stand-alone CR). // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo // and we advance immediately past the LF as well, returning both together as if // it was all a single 'character' only. var slice_len = 1; - var lines = false; - - if (ch === '\n') { + if (ch === "\n") { lines = true; - } else if (ch === '\r') { + } else if (ch === "\r") { lines = true; var ch2 = this._input[1]; - - if (ch2 === '\n') { + if (ch2 === "\n") { slice_len++; ch += ch2; this.yytext += ch2; @@ -4403,7 +5088,6 @@ var lexer = function() { this.yylloc.range[1]++; } } - if (lines) { this.yylineno++; this.yylloc.last_line++; @@ -4411,8 +5095,8 @@ var lexer = function() { } else { this.yylloc.last_column++; } - this.yylloc.range[1]++; + this._input = this._input.slice(slice_len); return ch; }, @@ -4426,6 +5110,7 @@ var lexer = function() { unput: function lexer_unput(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); this.yyleng = this.yytext.length; @@ -4435,21 +5120,21 @@ var lexer = function() { if (lines.length > 1) { this.yylineno -= lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; var pre = this.match; var pre_lines = pre.split(/(?:\r\n?|\n)/g); - if (pre_lines.length === 1) { pre = this.matched; pre_lines = pre.split(/(?:\r\n?|\n)/g); } - this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; } else { this.yylloc.last_column -= len; } this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; + this.done = false; return this; }, @@ -4478,26 +5163,27 @@ var lexer = function() { // when the `parseError()` call returns, we MUST ensure that the error is registered. // We accomplish this by signaling an 'error' token to be produced for the current // `.lex()` run. - var lineno_msg = ''; - + var lineno_msg = ""; if (this.options.trackPosition) { - lineno_msg = ' on line ' + (this.yylineno + 1); + lineno_msg = " on line " + (this.yylineno + 1); } - - var pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; + var pos_str = ""; + if (typeof this.showPosition === "function") { + pos_str = this.showPosition(); + if (pos_str && pos_str[0] !== "\n") { + pos_str = "\n" + pos_str; + } } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, + "Lexical error" + + lineno_msg + + ": You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true)." + + pos_str, false ); - - this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + this._signaled_error_token = + this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; } - return this; }, @@ -4524,36 +5210,30 @@ var lexer = function() { @this {RegExpLexer} */ pastInput: function lexer_pastInput(maxSize, maxLines) { - var past = this.matched.substring(0, this.matched.length - this.match.length); - - if (maxSize < 0) - maxSize = past.length; - else if (!maxSize) - maxSize = 20; - - if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this!; + var past = this.matched.substring( + 0, + this.matched.length - this.match.length + ); + if (maxSize < 0) maxSize = past.length; + else if (!maxSize) maxSize = 20; + if (maxLines < 0) maxLines = past.length; else if (!maxLines) + // can't ever have more input lines than this! maxLines = 1; - // `substr` anticipation: treat \r\n as a single character and take a little // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: past = past.substr(-maxSize * 2 - 2); - // now that we have a significantly reduced string to process, transform the newlines // and chop them, then limit them: - var a = past.replace(/\r\n|\r/g, '\n').split('\n'); - + var a = past.replace(/\r\n|\r/g, "\n").split("\n"); a = a.slice(-maxLines); - past = a.join('\n'); - + past = a.join("\n"); // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis prefix... if (past.length > maxSize) { - past = '...' + past.substr(-maxSize); + past = "..." + past.substr(-maxSize); } - return past; }, @@ -4571,37 +5251,28 @@ var lexer = function() { */ upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { var next = this.match; - - if (maxSize < 0) - maxSize = next.length + this._input.length; - else if (!maxSize) - maxSize = 20; - - if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this!; + if (maxSize < 0) maxSize = next.length + this._input.length; + else if (!maxSize) maxSize = 20; + if (maxLines < 0) maxLines = maxSize; else if (!maxLines) + // can't ever have more input lines than this! maxLines = 1; - // `substring` anticipation: treat \r\n as a single character and take a little // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } - // now that we have a significantly reduced string to process, transform the newlines // and chop them, then limit them: - var a = next.replace(/\r\n|\r/g, '\n').split('\n'); - + var a = next.replace(/\r\n|\r/g, "\n").split("\n"); a = a.slice(0, maxLines); - next = a.join('\n'); - + next = a.join("\n"); // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis postfix... if (next.length > maxSize) { - next = next.substring(0, maxSize) + '...'; + next = next.substring(0, maxSize) + "..."; } - return next; }, @@ -4612,9 +5283,15 @@ var lexer = function() { @this {RegExpLexer} */ showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { - var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); - var c = new Array(pre.length + 1).join('-'); - return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; + var pre = this.pastInput(maxPrefix).replace(/\s/g, " "); + var c = new Array(pre.length + 1).join("-"); + return ( + pre + + this.upcomingInput(maxPostfix).replace(/\s/g, " ") + + "\n" + + c + + "^" + ); }, /** @@ -4635,30 +5312,34 @@ var lexer = function() { var dl = l2 - l1; var dc = c2 - c1; var rv; - if (dl === 0) { - rv = 'line ' + l1 + ', '; - + rv = "line " + l1 + ", "; if (dc <= 1) { - rv += 'column ' + c1; + rv += "column " + c1; } else { - rv += 'columns ' + c1 + ' .. ' + c2; + rv += "columns " + c1 + " .. " + c2; } } else { - rv = 'lines ' + l1 + '(column ' + c1 + ') .. ' + l2 + '(column ' + c2 + ')'; + rv = + "lines " + + l1 + + "(column " + + c1 + + ") .. " + + l2 + + "(column " + + c2 + + ")"; } - if (yylloc.range && display_range_too) { var r1 = yylloc.range[0]; var r2 = yylloc.range[1] - 1; - if (r2 <= r1) { - rv += ' {String Offset: ' + r1 + '}'; + rv += " {String Offset: " + r1 + "}"; } else { - rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; + rv += " {String Offset range: " + r1 + " .. " + r2 + "}"; } } - return rv; }, @@ -4687,15 +5368,14 @@ var lexer = function() { // save context backup = { yylineno: this.yylineno, - yylloc: { first_line: this.yylloc.first_line, last_line: this.yylloc.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column, + range: this.yylloc.range.slice(0) }, - yytext: this.yytext, match: this.match, matches: this.matches, @@ -4704,10 +5384,8 @@ var lexer = function() { offset: this.offset, _more: this._more, _input: this._input, - //_signaled_error_token: this._signaled_error_token, yy: this.yy, - conditionStack: this.conditionStack.slice(0), done: this.done }; @@ -4715,21 +5393,18 @@ var lexer = function() { match_str = match[0]; match_str_len = match_str.length; - // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { lines = match_str.split(/(?:\r\n?|\n)/g); - if (lines.length > 1) { this.yylineno += lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; this.yylloc.last_column = lines[lines.length - 1].length; } else { this.yylloc.last_column += match_str_len; } - // } this.yytext += match_str; - this.match += match_str; this.matches = match; this.yyleng = this.yytext.length; @@ -4739,7 +5414,6 @@ var lexer = function() { // those rules will already have moved this `offset` forward matching their match lengths, // hence we must only add our own match length now: this.offset += match_str_len; - this._more = false; this._backtrack = false; this._input = this._input.slice(match_str_len); @@ -4755,14 +5429,12 @@ var lexer = function() { indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ ); - // otherwise, when the action codes are all simple return token statements: //token = this.simpleCaseActionClusters[indexed_rule]; if (this.done && this._input) { this.done = false; } - if (token) { return token; } else if (this._backtrack) { @@ -4770,17 +5442,14 @@ var lexer = function() { for (var k in backup) { this[k] = backup[k]; } - this.__currentRuleSet__ = null; return false; // rule action called reject() implying the next rule should be tested instead. } else if (this._signaled_error_token) { // produce one 'error' token as `.parseError()` in `reject()` did not guarantee a failure signal by throwing an exception! token = this._signaled_error_token; - this._signaled_error_token = false; return token; } - return false; }, @@ -4795,70 +5464,65 @@ var lexer = function() { this.clear(); return this.EOF; } - if (!this._input) { this.done = true; } var token, match, tempMatch, index; - if (!this._more) { this.clear(); } - var spec = this.__currentRuleSet__; - if (!spec) { // Update the ruleset cache as we apparently encountered a state change or just started lexing. // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps // speed up those activities a tiny bit. spec = this.__currentRuleSet__ = this._currentRules(); - // Check whether a *sane* condition has been pushed before: this makes the lexer robust against // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 if (!spec || !spec.rules) { - var lineno_msg = ''; - + var lineno_msg = ""; if (this.options.trackPosition) { - lineno_msg = ' on line ' + (this.yylineno + 1); + lineno_msg = " on line " + (this.yylineno + 1); } - - var pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; + var pos_str = ""; + if (typeof this.showPosition === "function") { + pos_str = this.showPosition(); + if (pos_str && pos_str[0] !== "\n") { + pos_str = "\n" + pos_str; + } } - var p = this.constructLexErrorInfo( - 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, + "Internal lexer engine error" + + lineno_msg + + ': The lex grammar programmer pushed a non-existing condition name "' + + this.topState() + + '"; this is a fatal error and should be reported to the application programmer team!' + + pos_str, false ); - // produce one 'error' token until this situation has been resolved, most probably by parse termination! - return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + return ( + this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR + ); } } var rule_ids = spec.rules; - //var dispatch = spec.__dispatch_lut; var regexes = spec.__rule_regexes; - var len = spec.__rule_count; // Note: the arrays are 1-based, while `len` itself is a valid index, // hence the non-standard less-or-equal check in the next loop condition! for (var i = 1; i <= len; i++) { tempMatch = this._input.match(regexes[i]); - if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; - if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rule_ids[i]); - if (token !== false) { return token; } else if (this._backtrack) { @@ -4873,42 +5537,36 @@ var lexer = function() { } } } - if (match) { token = this.test_match(match, rule_ids[index]); - if (token !== false) { return token; } - // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } - if (!this._input) { this.done = true; this.clear(); return this.EOF; } else { - var lineno_msg = ''; - + var lineno_msg = ""; if (this.options.trackPosition) { - lineno_msg = ' on line ' + (this.yylineno + 1); + lineno_msg = " on line " + (this.yylineno + 1); } - - var pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; + var pos_str = ""; + if (typeof this.showPosition === "function") { + pos_str = this.showPosition(); + if (pos_str && pos_str[0] !== "\n") { + pos_str = "\n" + pos_str; + } } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, + "Lexical error" + lineno_msg + ": Unrecognized text." + pos_str, this.options.lexerErrorsAreRecoverable ); - - token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; - + token = + this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us // by moving forward at least one character at a time: @@ -4916,7 +5574,6 @@ var lexer = function() { this.input(); } } - return token; } }, @@ -4929,21 +5586,36 @@ var lexer = function() { */ lex: function lexer_lex() { var r; - // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: - if (typeof this.options.pre_lex === 'function') { + if (typeof this.options.pre_lex === "function") { r = this.options.pre_lex.call(this); } - while (!r) { r = this.next(); } - if (typeof this.options.post_lex === 'function') { + if (0) { + console.log( + "@@@@@@@@@ lex: ", + { + token: r, + sym: + this.yy.parser && + typeof this.yy.parser.describeSymbol === "function" && + this.yy.parser.describeSymbol(r), + describeTypeFunc: + this.yy.parser && typeof this.yy.parser.describeSymbol, + condition: this.conditionStack, + text: this.yytext + }, + "\n" + (this.showPosition ? this.showPosition() : "???") + ); + } + + if (typeof this.options.post_lex === "function") { // (also account for a userdef function which does not return any value: keep the token as is) r = this.options.post_lex.call(this, r) || r; } - return r; }, @@ -4979,7 +5651,6 @@ var lexer = function() { */ popState: function lexer_popState() { var n = this.conditionStack.length - 1; - if (n > 0) { this.__currentRuleSet__ = null; return this.conditionStack.pop(); @@ -4996,11 +5667,10 @@ var lexer = function() { */ topState: function lexer_topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); - if (n >= 0) { return this.conditionStack[n]; } else { - return 'INITIAL'; + return "INITIAL"; } }, @@ -5011,10 +5681,15 @@ var lexer = function() { @this {RegExpLexer} */ _currentRules: function lexer__currentRules() { - if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { - return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; + if ( + this.conditionStack.length && + this.conditionStack[this.conditionStack.length - 1] + ) { + return this.conditions[ + this.conditionStack[this.conditionStack.length - 1] + ]; } else { - return this.conditions['INITIAL']; + return this.conditions["INITIAL"]; } }, @@ -5027,157 +5702,171 @@ var lexer = function() { stateStackSize: function lexer_stateStackSize() { return this.conditionStack.length; }, - options: { xregexp: true, ranges: true, trackPosition: true, + parseActionsUseYYMERGELOCATIONINFO: true, easy_keyword_rules: true }, - JisonLexerError: JisonLexerError, - - performAction: function lexer__performAction(yy, yy_, yyrulenumber, YY_START) { + performAction: function lexer__performAction( + yy, + yy_, + yyrulenumber, + YY_START + ) { var YYSTATE = YY_START; - switch (yyrulenumber) { - case 0: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: %\{ */ - yy.dept = 0; - - yy.include_command_allowed = false; - this.pushState('action'); - this.unput(yy_.yytext); - yy_.yytext = ''; - return 25; - break; - case 1: - /*! Conditions:: action */ - /*! Rule:: %\{([^]*?)%\} */ - yy_.yytext = this.matches[1]; + case 0: + /*! Conditions:: rules macro INITIAL */ - yy.include_command_allowed = true; - return 29; - break; - case 2: - /*! Conditions:: action */ - /*! Rule:: %include\b */ + /*! Rule:: %\{ */ - if (yy.include_command_allowed) { - // This is an include instruction in place of an action: - // - // - one %include per action chunk - // - one %include replaces an entire action chunk - this.pushState('path'); + yy.dept = 0; + yy.include_command_allowed = false; + this.pushState("action"); + this.unput(yy_.yytext); + yy_.yytext = ""; + return 25; + break; + case 1: + /*! Conditions:: action */ - return 49; - } else { - // TODO - yy_.yyerror('oops!'); + /*! Rule:: %\{([^]*?)%\} */ - return 34; - } + yy_.yytext = this.matches[1]; + yy.include_command_allowed = true; + return 29; + break; + case 2: + /*! Conditions:: action */ - break; - case 3: - /*! Conditions:: action */ - /*! Rule:: {WS}*\/\*[^]*?\*\/ */ - //yy.include_command_allowed = false; -- doesn't impact include-allowed state - return 31; + /*! Rule:: %include\b */ - break; - case 4: - /*! Conditions:: action */ - /*! Rule:: {WS}*\/\/.* */ - yy.include_command_allowed = false; + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState("path"); + return 49; + } else { + // TODO + yy_.yyerror("oops!"); + return 34; + } + break; + case 3: + /*! Conditions:: action */ + + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + + //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 31; + break; + case 4: + /*! Conditions:: action */ + + /*! Rule:: {WS}*\/\/.* */ + + yy.include_command_allowed = false; + return 32; + break; + case 6: + /*! Conditions:: action */ + + /*! Rule:: \| */ + + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ""; + return 28; + } else { + return 30; + } + break; + case 7: + /*! Conditions:: action */ + + /*! Rule:: %% */ + + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ""; + return 28; + } else { + return 30; + } + break; + case 9: + /*! Conditions:: action */ - return 32; - break; - case 6: - /*! Conditions:: action */ - /*! Rule:: \| */ - if (yy.include_command_allowed) { - this.popState(); - this.unput(yy_.yytext); - yy_.yytext = ''; - return 28; - } else { + /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ + + yy.include_command_allowed = false; return 30; - } + break; + case 10: + /*! Conditions:: action */ - break; - case 7: - /*! Conditions:: action */ - /*! Rule:: %% */ - if (yy.include_command_allowed) { - this.popState(); - this.unput(yy_.yytext); - yy_.yytext = ''; - return 28; - } else { + /*! Rule:: \/[^}{BR}]* */ + + yy.include_command_allowed = false; return 30; - } + break; + case 11: + /*! Conditions:: action */ - break; - case 9: - /*! Conditions:: action */ - /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ - yy.include_command_allowed = false; + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - return 30; - break; - case 10: - /*! Conditions:: action */ - /*! Rule:: \/[^}{BR}]* */ - yy.include_command_allowed = false; + yy.include_command_allowed = false; + return 30; + break; + case 12: + /*! Conditions:: action */ - return 30; - break; - case 11: - /*! Conditions:: action */ - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy.include_command_allowed = false; + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - return 30; - break; - case 12: - /*! Conditions:: action */ - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy.include_command_allowed = false; + yy.include_command_allowed = false; + return 30; + break; + case 13: + /*! Conditions:: action */ - return 30; - break; - case 13: - /*! Conditions:: action */ - /*! Rule:: `{ES2017_STRING_CONTENT}` */ - yy.include_command_allowed = false; + /*! Rule:: `{ES2017_STRING_CONTENT}` */ - return 30; - break; - case 14: - /*! Conditions:: action */ - /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ - yy.include_command_allowed = false; + yy.include_command_allowed = false; + return 30; + break; + case 14: + /*! Conditions:: action */ - return 30; - break; - case 15: - /*! Conditions:: action */ - /*! Rule:: \{ */ - yy.depth++; + /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ - yy.include_command_allowed = false; - return 30; - break; - case 16: - /*! Conditions:: action */ - /*! Rule:: \} */ + yy.include_command_allowed = false; + return 30; + break; + case 15: + /*! Conditions:: action */ + + /*! Rule:: \{ */ - yy.include_command_allowed = false; + yy.depth++; + yy.include_command_allowed = false; + return 30; + break; + case 16: + /*! Conditions:: action */ + + /*! Rule:: \} */ - if (yy.depth <= 0) { - yy_.yyerror(rmCommonWS` + yy.include_command_allowed = false; + if (yy.depth <= 0) { + yy_.yyerror( + rmCommonWS` too many closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse @@ -5185,46 +5874,48 @@ var lexer = function() { to help jison grok more or less complex action code chunks. Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); - - return 'BRACKETS_SURPLUS'; - } else { - yy.depth--; - } + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return "BRACKETS_SURPLUS"; + } else { + yy.depth--; + } + return 30; + break; + case 17: + /*! Conditions:: action */ - return 30; - break; - case 17: - /*! Conditions:: action */ - /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|%]) */ - yy.include_command_allowed = true; + /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|%]) */ - return 33; // keep empty lines as-is inside action code blocks. - break; - case 18: - /*! Conditions:: action */ - /*! Rule:: {BR} */ - if (yy.depth > 0) { yy.include_command_allowed = true; - return 33; // keep empty lines as-is inside action code blocks. - } else { - // end of action code chunk - this.popState(); - - this.unput(yy_.yytext); - yy_.yytext = ''; - return 28; - } - - break; - case 19: - /*! Conditions:: action */ - /*! Rule:: $ */ + return 33; // keep empty lines as-is inside action code blocks. + break; + case 18: + /*! Conditions:: action */ + + /*! Rule:: {BR} */ + + if (yy.depth > 0) { + yy.include_command_allowed = true; + return 33; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ""; + return 28; + } + break; + case 19: + /*! Conditions:: action */ - yy.include_command_allowed = false; + /*! Rule:: $ */ - if (yy.depth !== 0) { - yy_.yyerror(rmCommonWS` + yy.include_command_allowed = false; + if (yy.depth !== 0) { + yy_.yyerror( + rmCommonWS` missing ${yy.depth} closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse @@ -5232,432 +5923,544 @@ var lexer = function() { to help jison grok more or less complex action code chunks. Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); + ` + + prettyPrintRange(this, yy_.yylloc) + ); + yy_.yytext = ""; + return "BRACKETS_MISSING"; + } + this.popState(); + yy_.yytext = ""; + return 28; + break; + case 21: + /*! Conditions:: conditions */ - yy_.yytext = ''; - return 'BRACKETS_MISSING'; - } + /*! Rule:: > */ - this.popState(); - yy_.yytext = ''; - return 28; - break; - case 21: - /*! Conditions:: conditions */ - /*! Rule:: > */ - this.popState(); + this.popState(); + return 6; + break; + case 24: + /*! Conditions:: INITIAL start_condition macro path options */ - return 6; - break; - case 24: - /*! Conditions:: INITIAL start_condition macro path options */ - /*! Rule:: {WS}*\/\/[^\r\n]* */ - /* skip single-line comment */ - break; - case 25: - /*! Conditions:: INITIAL start_condition macro path options */ - /*! Rule:: {WS}*\/\*(.|\n|\r)*?\*\/ */ - /* skip multi-line comment */ - break; - case 26: - /*! Conditions:: rules */ - /*! Rule:: {BR}+ */ - /* empty */ - break; - case 27: - /*! Conditions:: rules */ - /*! Rule:: {WS}+{BR}+ */ - /* empty */ - break; - case 28: - /*! Conditions:: rules */ - /*! Rule:: \/\/[^\r\n]* */ - /* skip single-line comment */ - break; - case 29: - /*! Conditions:: rules */ - /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - /* skip multi-line comment */ - break; - case 30: - /*! Conditions:: rules */ - /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ - yy.depth = 0; - - yy.include_command_allowed = true; - this.pushState('action'); - return 25; - break; - case 31: - /*! Conditions:: rules */ - /*! Rule:: %% */ - this.popState(); + /*! Rule:: {WS}*\/\/[^\r\n]* */ - this.pushState('code'); - return 19; - break; - case 32: - /*! Conditions:: rules */ - /*! Rule:: {ANY_LITERAL_CHAR}+ */ + /* skip single-line comment */ - // accept any non-regex, non-lex, non-string-delim, - // non-escape-starter, non-space character as-is - return 44; + break; + case 25: + /*! Conditions:: INITIAL start_condition macro path options */ - break; - case 35: - /*! Conditions:: options */ - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = unescQuote(this.matches[1], /\\"/g); + /*! Rule:: {WS}*\/\*(.|\n|\r)*?\*\/ */ - return 47; // value is always a string type - break; - case 36: - /*! Conditions:: options */ - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = unescQuote(this.matches[1], /\\'/g); + /* skip multi-line comment */ - return 47; // value is always a string type - break; - case 37: - /*! Conditions:: options */ - /*! Rule:: `{ES2017_STRING_CONTENT}` */ - yy_.yytext = unescQuote(this.matches[1], /\\`/g); + break; + case 26: + /*! Conditions:: rules */ - return 47; // value is always a string type - break; - case 39: - /*! Conditions:: options */ - /*! Rule:: {BR}{WS}+(?=\S) */ - /* skip leading whitespace on the next line of input, when followed by more options */ - break; - case 40: - /*! Conditions:: options */ - /*! Rule:: {BR} */ - this.popState(); + /*! Rule:: {BR}+ */ - return 46; - break; - case 41: - /*! Conditions:: options */ - /*! Rule:: {WS}+ */ - /* skip whitespace */ - break; - case 43: - /*! Conditions:: start_condition */ - /*! Rule:: {BR}+ */ - this.popState(); + /* empty */ - break; - case 44: - /*! Conditions:: start_condition */ - /*! Rule:: {WS}+ */ - /* empty */ - break; - case 45: - /*! Conditions:: INITIAL */ - /*! Rule:: {ID} */ - this.pushState('macro'); + break; + case 27: + /*! Conditions:: rules */ - return 20; - break; - case 46: - /*! Conditions:: macro */ - /*! Rule:: {BR}+ */ - this.popState(); + /*! Rule:: {WS}+{BR}+ */ - break; - case 47: - /*! Conditions:: macro */ - /*! Rule:: {ANY_LITERAL_CHAR}+ */ + /* empty */ - // accept any non-regex, non-lex, non-string-delim, - // non-escape-starter, non-space character as-is - return 44; + break; + case 28: + /*! Conditions:: rules */ - break; - case 48: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: {BR}+ */ - /* empty */ - break; - case 49: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: \s+ */ - /* empty */ - break; - case 50: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + /*! Rule:: \/\/[^\r\n]* */ - yy_.yytext = unescQuote(this.matches[1], /\\"/g); + /* skip single-line comment */ - return 43; - break; - case 51: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + break; + case 29: + /*! Conditions:: rules */ - yy_.yytext = unescQuote(this.matches[1], /\\'/g); + /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ - return 43; - break; - case 52: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: \[ */ - this.pushState('set'); + /* skip multi-line comment */ - return 38; - break; - case 65: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: < */ - this.pushState('conditions'); + break; + case 30: + /*! Conditions:: rules */ - return 5; - break; - case 66: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: \/! */ - return 36; // treated as `(?!atom)` + /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ - break; - case 67: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: \/ */ - return 14; // treated as `(?=atom)` + yy.depth = 0; + yy.include_command_allowed = true; + this.pushState("action"); + return 25; + break; + case 31: + /*! Conditions:: rules */ - break; - case 69: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: \\. */ - yy_.yytext = yy_.yytext.replace(/^\\/g, ''); + /*! Rule:: %% */ - return 41; - break; - case 72: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: %options\b */ - this.pushState('options'); + this.popState(); + this.pushState("code"); + return 19; + break; + case 32: + /*! Conditions:: rules */ - return 45; - break; - case 73: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: %s\b */ - this.pushState('start_condition'); + /*! Rule:: {ANY_LITERAL_CHAR}+ */ - return 21; - break; - case 74: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: %x\b */ - this.pushState('start_condition'); + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 44; + break; + case 35: + /*! Conditions:: options */ - return 22; - break; - case 75: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: %include\b */ - yy.depth = 0; - - yy.include_command_allowed = true; - this.pushState('action'); - this.unput(yy_.yytext); - yy_.yytext = ''; - return 25; - break; - case 76: - /*! Conditions:: code */ - /*! Rule:: %include\b */ - this.pushState('path'); + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - return 49; - break; - case 77: - /*! Conditions:: INITIAL rules code */ - /*! Rule:: %{NAME}([^\r\n]*) */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + return 47; // value is always a string type + break; + case 36: + /*! Conditions:: options */ - /* ignore unrecognized decl */ - this.warn(rmCommonWS` - LEX: ignoring unsupported lexer option ${dquote(yy_.yytext)} - while lexing in ${dquote(this.topState())} state. + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + return 47; // value is always a string type + break; + case 37: + /*! Conditions:: options */ - yy_.yytext = [// {NAME} - this.matches[1], // optional value/parameters - this.matches[2].trim()]; + /*! Rule:: `{ES2017_STRING_CONTENT}` */ - return 23; - break; - case 78: - /*! Conditions:: rules macro INITIAL */ - /*! Rule:: %% */ - this.pushState('rules'); + yy_.yytext = unescQuote(this.matches[1], /\\`/g); + return 47; // value is always a string type + break; + case 39: + /*! Conditions:: options */ - return 19; - break; - case 86: - /*! Conditions:: set */ - /*! Rule:: \] */ - this.popState(); + /*! Rule:: {BR}{WS}+(?=\S) */ - return 39; - break; - case 88: - /*! Conditions:: code */ - /*! Rule:: [^\r\n]+ */ - return 51; // the bit of CODE just before EOF... + /* skip leading whitespace on the next line of input, when followed by more options */ - break; - case 89: - /*! Conditions:: path */ - /*! Rule:: {BR} */ - this.popState(); + break; + case 40: + /*! Conditions:: options */ - this.unput(yy_.yytext); - break; - case 90: - /*! Conditions:: path */ - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - yy_.yytext = unescQuote(this.matches[1]); + /*! Rule:: {BR} */ - this.popState(); - return 50; - break; - case 91: - /*! Conditions:: path */ - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - yy_.yytext = unescQuote(this.matches[1]); + this.popState(); + return 46; + break; + case 41: + /*! Conditions:: options */ - this.popState(); - return 50; - break; - case 92: - /*! Conditions:: path */ - /*! Rule:: {WS}+ */ - // skip whitespace in the line - break; - case 93: - /*! Conditions:: path */ - /*! Rule:: [^\s\r\n]+ */ - this.popState(); + /*! Rule:: {WS}+ */ - return 50; - break; - case 94: - /*! Conditions:: action */ - /*! Rule:: " */ - yy_.yyerror(rmCommonWS` -unterminated string constant in lexer rule action block. -Erroneous area: -` + prettyPrintRange(this, yy_.yylloc)); - - return 2; - break; - case 95: - /*! Conditions:: action */ - /*! Rule:: ' */ - yy_.yyerror(rmCommonWS` -unterminated string constant in lexer rule action block. -Erroneous area: -` + prettyPrintRange(this, yy_.yylloc)); - - return 2; - break; - case 96: - /*! Conditions:: action */ - /*! Rule:: ` */ - yy_.yyerror(rmCommonWS` -unterminated string constant in lexer rule action block. -Erroneous area: -` + prettyPrintRange(this, yy_.yylloc)); - - return 2; - break; - case 97: - /*! Conditions:: options */ - /*! Rule:: " */ - yy_.yyerror(rmCommonWS` -unterminated string constant in %options entry. -Erroneous area: -` + prettyPrintRange(this, yy_.yylloc)); - - return 2; - break; - case 98: - /*! Conditions:: options */ - /*! Rule:: ' */ - yy_.yyerror(rmCommonWS` -unterminated string constant in %options entry. -Erroneous area: -` + prettyPrintRange(this, yy_.yylloc)); - - return 2; - break; - case 99: - /*! Conditions:: options */ - /*! Rule:: ` */ - yy_.yyerror(rmCommonWS` -unterminated string constant in %options entry. -Erroneous area: -` + prettyPrintRange(this, yy_.yylloc)); - - return 2; - break; - case 100: - /*! Conditions:: * */ - /*! Rule:: " */ - var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); - - yy_.yyerror(rmCommonWS` -unterminated string constant encountered while lexing -${rules}. -Erroneous area: -` + prettyPrintRange(this, yy_.yylloc)); - - return 2; - break; - case 101: - /*! Conditions:: * */ - /*! Rule:: ' */ - var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); - - yy_.yyerror(rmCommonWS` -unterminated string constant encountered while lexing -${rules}. -Erroneous area: -` + prettyPrintRange(this, yy_.yylloc)); - - return 2; - break; - case 102: - /*! Conditions:: * */ - /*! Rule:: ` */ - var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); - - yy_.yyerror(rmCommonWS` -unterminated string constant encountered while lexing -${rules}. -Erroneous area: -` + prettyPrintRange(this, yy_.yylloc)); - - return 2; - break; - case 103: - /*! Conditions:: macro rules */ - /*! Rule:: . */ + /* skip whitespace */ - /* b0rk on bad characters */ - var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + break; + case 43: + /*! Conditions:: start_condition */ - yy_.yyerror(rmCommonWS` - unsupported lexer input encountered while lexing - ${rules} (i.e. jison lex regexes). + /*! Rule:: {BR}+ */ - NOTE: When you want this input to be interpreted as a LITERAL part + this.popState(); + break; + case 44: + /*! Conditions:: start_condition */ + + /*! Rule:: {WS}+ */ + + /* empty */ + + break; + case 45: + /*! Conditions:: INITIAL */ + + /*! Rule:: {ID} */ + + this.pushState("macro"); + return 20; + break; + case 46: + /*! Conditions:: macro */ + + /*! Rule:: {BR}+ */ + + this.popState(); + break; + case 47: + /*! Conditions:: macro */ + + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 44; + break; + case 48: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: {BR}+ */ + + /* empty */ + + break; + case 49: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: \s+ */ + + /* empty */ + + break; + case 50: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + return 43; + break; + case 51: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + return 43; + break; + case 52: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: \[ */ + + this.pushState("set"); + return 38; + break; + case 65: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: < */ + + this.pushState("conditions"); + return 5; + break; + case 66: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: \/! */ + + return 36; // treated as `(?!atom)` + break; + case 67: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: \/ */ + + return 14; // treated as `(?=atom)` + break; + case 69: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: \\. */ + + yy_.yytext = yy_.yytext.replace(/^\\/g, ""); + return 41; + break; + case 72: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: %options\b */ + + this.pushState("options"); + return 45; + break; + case 73: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: %s\b */ + + this.pushState("start_condition"); + return 21; + break; + case 74: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: %x\b */ + + this.pushState("start_condition"); + return 22; + break; + case 75: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: %include\b */ + + yy.depth = 0; + yy.include_command_allowed = true; + this.pushState("action"); + this.unput(yy_.yytext); + yy_.yytext = ""; + return 25; + break; + case 76: + /*! Conditions:: code */ + + /*! Rule:: %include\b */ + + this.pushState("path"); + return 49; + break; + case 77: + /*! Conditions:: INITIAL rules code */ + + /*! Rule:: %{NAME}([^\r\n]*) */ + + /* ignore unrecognized decl */ + this.warn( + rmCommonWS` + LEX: ignoring unsupported lexer option ${dquote( + yy_.yytext + )} + while lexing in ${dquote( + this.topState() + )} state. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + yy_.yytext = [ + this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; + return 23; + break; + case 78: + /*! Conditions:: rules macro INITIAL */ + + /*! Rule:: %% */ + + this.pushState("rules"); + return 19; + break; + case 86: + /*! Conditions:: set */ + + /*! Rule:: \] */ + + this.popState(); + return 39; + break; + case 88: + /*! Conditions:: code */ + + /*! Rule:: [^\r\n]+ */ + + return 51; // the bit of CODE just before EOF... + break; + case 89: + /*! Conditions:: path */ + + /*! Rule:: {BR} */ + + this.popState(); + this.unput(yy_.yytext); + break; + case 90: + /*! Conditions:: path */ + + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + + yy_.yytext = unescQuote(this.matches[1]); + this.popState(); + return 50; + break; + case 91: + /*! Conditions:: path */ + + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + + yy_.yytext = unescQuote(this.matches[1]); + this.popState(); + return 50; + break; + case 92: + /*! Conditions:: path */ + + /*! Rule:: {WS}+ */ + + // skip whitespace in the line + break; + case 93: + /*! Conditions:: path */ + + /*! Rule:: [^\s\r\n]+ */ + + this.popState(); + return 50; + break; + case 94: + /*! Conditions:: action */ + + /*! Rule:: " */ + + yy_.yyerror( + rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return 2; + break; + case 95: + /*! Conditions:: action */ + + /*! Rule:: ' */ + + yy_.yyerror( + rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return 2; + break; + case 96: + /*! Conditions:: action */ + + /*! Rule:: ` */ + + yy_.yyerror( + rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return 2; + break; + case 97: + /*! Conditions:: options */ + + /*! Rule:: " */ + + yy_.yyerror( + rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return 2; + break; + case 98: + /*! Conditions:: options */ + + /*! Rule:: ' */ + + yy_.yyerror( + rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return 2; + break; + case 99: + /*! Conditions:: options */ + + /*! Rule:: ` */ + + yy_.yyerror( + rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return 2; + break; + case 100: + /*! Conditions:: * */ + + /*! Rule:: " */ + + var rules = this.topState() === "macro" ? "macro's" : this.topState(); + yy_.yyerror( + rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return 2; + break; + case 101: + /*! Conditions:: * */ + + /*! Rule:: ' */ + + var rules = this.topState() === "macro" ? "macro's" : this.topState(); + yy_.yyerror( + rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return 2; + break; + case 102: + /*! Conditions:: * */ + + /*! Rule:: ` */ + + var rules = this.topState() === "macro" ? "macro's" : this.topState(); + yy_.yyerror( + rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + + prettyPrintRange(this, yy_.yylloc) + ); + return 2; + break; + case 103: + /*! Conditions:: macro rules */ + + /*! Rule:: . */ + + /* b0rk on bad characters */ + var rules = this.topState() === "macro" ? "macro's" : this.topState(); + yy_.yyerror( + rmCommonWS` + unsupported lexer input encountered while lexing + ${rules} (i.e. jison lex regexes). + + NOTE: When you want this input to be interpreted as a LITERAL part of a lex rule regex, you MUST enclose it in double or single quotes. @@ -5665,366 +6468,329 @@ Erroneous area: regex expression here in jison-lex ${rules}. Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); + ` + + prettyPrintRange(this, yy_.yylloc) + ); + break; + case 104: + /*! Conditions:: * */ - break; - case 104: - /*! Conditions:: * */ - /*! Rule:: . */ + /*! Rule:: . */ - yy_.yyerror(rmCommonWS` - unsupported lexer input: ${dquote(yy_.yytext)} - while lexing in ${dquote(this.topState())} state. + yy_.yyerror( + rmCommonWS` + unsupported lexer input: ${dquote( + yy_.yytext + )} + while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + prettyPrintRange(this, yy_.yylloc)); - - break; - default: - return this.simpleCaseActionClusters[yyrulenumber]; + ` + + prettyPrintRange(this, yy_.yylloc) + ); + break; + default: + return this.simpleCaseActionClusters[yyrulenumber]; } }, - simpleCaseActionClusters: { /*! Conditions:: action */ + /*! Rule:: {WS}+ */ - 5: 33, + 5: 33, /*! Conditions:: action */ + /*! Rule:: % */ - 8: 30, + 8: 30, /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ - 20: 20, + 20: 20, /*! Conditions:: conditions */ + /*! Rule:: , */ - 22: 8, + 22: 8, /*! Conditions:: conditions */ + /*! Rule:: \* */ - 23: 7, + 23: 7, /*! Conditions:: options */ + /*! Rule:: {NAME} */ - 33: 20, + 33: 20, /*! Conditions:: options */ + /*! Rule:: = */ - 34: 18, + 34: 18, /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ - 38: 48, + 38: 48, /*! Conditions:: start_condition */ + /*! Rule:: {ID} */ - 42: 24, + 42: 24, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \| */ - 53: 9, + 53: 9, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \(\?: */ - 54: 35, + 54: 35, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \(\?= */ - 55: 35, + 55: 35, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \(\?! */ - 56: 35, + 56: 35, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \( */ - 57: 10, + 57: 10, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \) */ - 58: 11, + 58: 11, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \+ */ - 59: 12, + 59: 12, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \* */ - 60: 7, + 60: 7, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \? */ - 61: 13, + 61: 13, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \^ */ - 62: 16, + 62: 16, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: , */ - 63: 8, + 63: 8, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: <> */ - 64: 17, + 64: 17, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 68: 41, + 68: 41, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \$ */ - 70: 17, + 70: 17, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \. */ - 71: 15, + 71: 15, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \{\d+(,\s*\d+|,)?\} */ - 79: 42, + 79: 42, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \{{ID}\} */ - 80: 37, + 80: 37, /*! Conditions:: set options */ + /*! Rule:: \{{ID}\} */ - 81: 37, + 81: 37, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \{ */ - 82: 3, + 82: 3, /*! Conditions:: rules macro INITIAL */ + /*! Rule:: \} */ - 83: 4, + 83: 4, /*! Conditions:: set */ + /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 84: 40, + 84: 40, /*! Conditions:: set */ + /*! Rule:: \{ */ - 85: 40, + 85: 40, /*! Conditions:: code */ + /*! Rule:: [^\r\n]*(\r|\n)+ */ - 87: 51, + 87: 51, /*! Conditions:: * */ + /*! Rule:: $ */ + 105: 1 }, - rules: [ - /* 0: */ /^(?:%\{)/, - /* 1: */ new XRegExp('^(?:%\\{([^]*?)%\\})', ''), - /* 2: */ /^(?:%include\b)/, - /* 3: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), - /* 4: */ /^(?:([^\S\n\r])*\/\/.*)/, - /* 5: */ /^(?:([^\S\n\r])+)/, - /* 6: */ /^(?:\|)/, - /* 7: */ /^(?:%%)/, - /* 8: */ /^(?:%)/, - /* 9: */ /^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, - /* 10: */ /^(?:\/[^\n\r}]*)/, - /* 11: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 12: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 13: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, - /* 14: */ /^(?:[^\s"%'\/`{-}]+)/, - /* 15: */ /^(?:\{)/, - /* 16: */ /^(?:\})/, - /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s%|]))/, - /* 18: */ /^(?:(\r\n|\n|\r))/, - /* 19: */ /^(?:$)/, - /* 20: */ new XRegExp( - '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', - '' + /* 0: */ /^(?:%\{)/, + /* 1: */ new XRegExp("^(?:%\\{([^]*?)%\\})", ""), + /* 2: */ /^(?:%include\b)/, + /* 3: */ new XRegExp("^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)", ""), + /* 4: */ /^(?:([^\S\n\r])*\/\/.*)/, + /* 5: */ /^(?:([^\S\n\r])+)/, + /* 6: */ /^(?:\|)/, + /* 7: */ /^(?:%%)/, + /* 8: */ /^(?:%)/, + /* 9: */ /^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, + /* 10: */ /^(?:\/[^\n\r}]*)/, + /* 11: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 12: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 13: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 14: */ /^(?:[^\s"%'\/`{-}]+)/, + /* 15: */ /^(?:\{)/, + /* 16: */ /^(?:\})/, + /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s%|]))/, + /* 18: */ /^(?:(\r\n|\n|\r))/, + /* 19: */ /^(?:$)/, + /* 20: */ new XRegExp( + "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", + "" + ), + /* 21: */ /^(?:>)/, + /* 22: */ /^(?:,)/, + /* 23: */ /^(?:\*)/, + /* 24: */ /^(?:([^\S\n\r])*\/\/[^\n\r]*)/, + /* 25: */ /^(?:([^\S\n\r])*\/\*(.|\n|\r)*?\*\/)/, + /* 26: */ /^(?:(\r\n|\n|\r)+)/, + /* 27: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, + /* 28: */ /^(?:\/\/[^\r\n]*)/, + /* 29: */ /^(?:\/\*(.|\n|\r)*?\*\/)/, + /* 30: */ /^(?:([^\S\n\r])+(?=[^\s%|]))/, + /* 31: */ /^(?:%%)/, + /* 32: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 33: */ new XRegExp( + "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", + "" + ), + /* 34: */ /^(?:=)/, + /* 35: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 36: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 37: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 38: */ /^(?:\S+)/, + /* 39: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, + /* 40: */ /^(?:(\r\n|\n|\r))/, + /* 41: */ /^(?:([^\S\n\r])+)/, + /* 42: */ new XRegExp( + "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", + "" ), - /* 21: */ /^(?:>)/, - /* 22: */ /^(?:,)/, - /* 23: */ /^(?:\*)/, - /* 24: */ /^(?:([^\S\n\r])*\/\/[^\n\r]*)/, - /* 25: */ /^(?:([^\S\n\r])*\/\*(.|\n|\r)*?\*\/)/, - /* 26: */ /^(?:(\r\n|\n|\r)+)/, - /* 27: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, - /* 28: */ /^(?:\/\/[^\r\n]*)/, - /* 29: */ /^(?:\/\*(.|\n|\r)*?\*\/)/, - /* 30: */ /^(?:([^\S\n\r])+(?=[^\s%|]))/, - /* 31: */ /^(?:%%)/, - /* 32: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, - /* 33: */ new XRegExp( - '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', - '' + /* 43: */ /^(?:(\r\n|\n|\r)+)/, + /* 44: */ /^(?:([^\S\n\r])+)/, + /* 45: */ new XRegExp( + "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", + "" ), - /* 34: */ /^(?:=)/, - /* 35: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 36: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 37: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, - /* 38: */ /^(?:\S+)/, - /* 39: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, - /* 40: */ /^(?:(\r\n|\n|\r))/, - /* 41: */ /^(?:([^\S\n\r])+)/, - /* 42: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), - /* 43: */ /^(?:(\r\n|\n|\r)+)/, - /* 44: */ /^(?:([^\S\n\r])+)/, - /* 45: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), - /* 46: */ /^(?:(\r\n|\n|\r)+)/, - /* 47: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, - /* 48: */ /^(?:(\r\n|\n|\r)+)/, - /* 49: */ /^(?:\s+)/, - /* 50: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 51: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 52: */ /^(?:\[)/, - /* 53: */ /^(?:\|)/, - /* 54: */ /^(?:\(\?:)/, - /* 55: */ /^(?:\(\?=)/, - /* 56: */ /^(?:\(\?!)/, - /* 57: */ /^(?:\()/, - /* 58: */ /^(?:\))/, - /* 59: */ /^(?:\+)/, - /* 60: */ /^(?:\*)/, - /* 61: */ /^(?:\?)/, - /* 62: */ /^(?:\^)/, - /* 63: */ /^(?:,)/, - /* 64: */ /^(?:<>)/, - /* 65: */ /^(?:<)/, - /* 66: */ /^(?:\/!)/, - /* 67: */ /^(?:\/)/, - /* 68: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, - /* 69: */ /^(?:\\.)/, - /* 70: */ /^(?:\$)/, - /* 71: */ /^(?:\.)/, - /* 72: */ /^(?:%options\b)/, - /* 73: */ /^(?:%s\b)/, - /* 74: */ /^(?:%x\b)/, - /* 75: */ /^(?:%include\b)/, - /* 76: */ /^(?:%include\b)/, - /* 77: */ new XRegExp( - '^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))', - '' + /* 46: */ /^(?:(\r\n|\n|\r)+)/, + /* 47: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 48: */ /^(?:(\r\n|\n|\r)+)/, + /* 49: */ /^(?:\s+)/, + /* 50: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 51: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 52: */ /^(?:\[)/, + /* 53: */ /^(?:\|)/, + /* 54: */ /^(?:\(\?:)/, + /* 55: */ /^(?:\(\?=)/, + /* 56: */ /^(?:\(\?!)/, + /* 57: */ /^(?:\()/, + /* 58: */ /^(?:\))/, + /* 59: */ /^(?:\+)/, + /* 60: */ /^(?:\*)/, + /* 61: */ /^(?:\?)/, + /* 62: */ /^(?:\^)/, + /* 63: */ /^(?:,)/, + /* 64: */ /^(?:<>)/, + /* 65: */ /^(?:<)/, + /* 66: */ /^(?:\/!)/, + /* 67: */ /^(?:\/)/, + /* 68: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 69: */ /^(?:\\.)/, + /* 70: */ /^(?:\$)/, + /* 71: */ /^(?:\.)/, + /* 72: */ /^(?:%options\b)/, + /* 73: */ /^(?:%s\b)/, + /* 74: */ /^(?:%x\b)/, + /* 75: */ /^(?:%include\b)/, + /* 76: */ /^(?:%include\b)/, + /* 77: */ new XRegExp( + "^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))", + "" ), - /* 78: */ /^(?:%%)/, - /* 79: */ /^(?:\{\d+(,\s*\d+|,)?\})/, - /* 80: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), - /* 81: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), - /* 82: */ /^(?:\{)/, - /* 83: */ /^(?:\})/, - /* 84: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, - /* 85: */ /^(?:\{)/, - /* 86: */ /^(?:\])/, - /* 87: */ /^(?:[^\r\n]*(\r|\n)+)/, - /* 88: */ /^(?:[^\r\n]+)/, - /* 89: */ /^(?:(\r\n|\n|\r))/, - /* 90: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 91: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 92: */ /^(?:([^\S\n\r])+)/, - /* 93: */ /^(?:\S+)/, - /* 94: */ /^(?:")/, - /* 95: */ /^(?:')/, - /* 96: */ /^(?:`)/, - /* 97: */ /^(?:")/, - /* 98: */ /^(?:')/, - /* 99: */ /^(?:`)/, - /* 100: */ /^(?:")/, - /* 101: */ /^(?:')/, - /* 102: */ /^(?:`)/, - /* 103: */ /^(?:.)/, - /* 104: */ /^(?:.)/, - /* 105: */ /^(?:$)/ + /* 78: */ /^(?:%%)/, + /* 79: */ /^(?:\{\d+(,\s*\d+|,)?\})/, + /* 80: */ new XRegExp( + "^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", + "" + ), + /* 81: */ new XRegExp( + "^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", + "" + ), + /* 82: */ /^(?:\{)/, + /* 83: */ /^(?:\})/, + /* 84: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 85: */ /^(?:\{)/, + /* 86: */ /^(?:\])/, + /* 87: */ /^(?:[^\r\n]*(\r|\n)+)/, + /* 88: */ /^(?:[^\r\n]+)/, + /* 89: */ /^(?:(\r\n|\n|\r))/, + /* 90: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 91: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 92: */ /^(?:([^\S\n\r])+)/, + /* 93: */ /^(?:\S+)/, + /* 94: */ /^(?:")/, + /* 95: */ /^(?:')/, + /* 96: */ /^(?:`)/, + /* 97: */ /^(?:")/, + /* 98: */ /^(?:')/, + /* 99: */ /^(?:`)/, + /* 100: */ /^(?:")/, + /* 101: */ /^(?:')/, + /* 102: */ /^(?:`)/, + /* 103: */ /^(?:.)/, + /* 104: */ /^(?:.)/, + /* 105: */ /^(?:$)/ ], - conditions: { - 'code': { - rules: [76, 77, 87, 88, 100, 101, 102, 104, 105], - inclusive: false - }, - - 'start_condition': { - rules: [24, 25, 42, 43, 44, 100, 101, 102, 104, 105], - inclusive: false - }, - - 'options': { - rules: [ - 24, - 25, - 33, - 34, - 35, - 36, - 37, - 38, - 39, - 40, - 41, - 81, - 97, - 98, - 99, - 100, - 101, - 102, - 104, - 105 - ], - - inclusive: false - }, - - 'conditions': { - rules: [20, 21, 22, 23, 100, 101, 102, 104, 105], - inclusive: false - }, - - 'action': { - rules: [ - 1, - 2, - 3, - 4, - 5, - 6, - 7, - 8, - 9, - 10, - 11, - 12, - 13, - 14, - 15, - 16, - 17, - 18, - 19, - 94, - 95, - 96, - 100, - 101, - 102, - 104, - 105 - ], - - inclusive: false - }, - - 'path': { - rules: [24, 25, 89, 90, 91, 92, 93, 100, 101, 102, 104, 105], - inclusive: false - }, - - 'set': { - rules: [81, 84, 85, 86, 100, 101, 102, 104, 105], - inclusive: false - }, - - 'rules': { + rules: { rules: [ 0, 26, @@ -6075,11 +6841,9 @@ Erroneous area: 104, 105 ], - inclusive: true }, - - 'macro': { + macro: { rules: [ 0, 24, @@ -6126,11 +6890,86 @@ Erroneous area: 104, 105 ], - inclusive: true }, - - 'INITIAL': { + code: { + rules: [76, 77, 87, 88, 100, 101, 102, 104, 105], + inclusive: false + }, + start_condition: { + rules: [24, 25, 42, 43, 44, 100, 101, 102, 104, 105], + inclusive: false + }, + options: { + rules: [ + 24, + 25, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 81, + 97, + 98, + 99, + 100, + 101, + 102, + 104, + 105 + ], + inclusive: false + }, + conditions: { + rules: [20, 21, 22, 23, 100, 101, 102, 104, 105], + inclusive: false + }, + action: { + rules: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 94, + 95, + 96, + 100, + 101, + 102, + 104, + 105 + ], + inclusive: false + }, + path: { + rules: [24, 25, 89, 90, 91, 92, 93, 100, 101, 102, 104, 105], + inclusive: false + }, + set: { + rules: [81, 84, 85, 86, 100, 101, 102, 104, 105], + inclusive: false + }, + INITIAL: { rules: [ 0, 24, @@ -6176,47 +7015,41 @@ Erroneous area: 104, 105 ], - inclusive: true } } }; function indent(s, i) { - var a = s.split('\n'); - var pf = new Array(i + 1).join(' '); - return pf + a.join('\n' + pf); + var a = s.split("\n"); + var pf = new Array(i + 1).join(" "); + return pf + a.join("\n" + pf); } // unescape a string value which is wrapped in quotes/doublequotes function unescQuote(str) { - str = '' + str; - var a = str.split('\\\\'); - + str = "" + str; + var a = str.split("\\\\"); a = a.map(function(s) { - return s.replace(/\\'/g, '\'').replace(/\\"/g, '"'); + return s.replace(/\\'/g, "'").replace(/\\"/g, '"'); }); - - str = a.join('\\\\'); + str = a.join("\\\\"); return str; } // properly quote and escape the given input string function dquote(s) { - var sq = s.indexOf('\'') >= 0; + var sq = s.indexOf("'") >= 0; var dq = s.indexOf('"') >= 0; - if (sq && dq) { s = s.replace(/"/g, '\\"'); dq = false; } - if (dq) { - s = '\'' + s + '\''; + s = "'" + s + "'"; } else { s = '"' + s + '"'; } - return s; } @@ -6237,50 +7070,43 @@ Erroneous area: // of multiple lines, followed by one(1) value, we have to split each // individual string into lines to keep that bit of information intact. var src = strings.map(function splitIntoLines(s) { - return s.split('\n'); + return s.split("\n"); }); - // fetch the first line of content which is expected to exhibit the common indent: // that would be the SECOND line of input, always, as the FIRST line won't // have any indentation at all! - var s0 = ''; - + var s0 = ""; for (var i = 0, len = src.length; i < len; i++) { if (src[i].length > 1) { s0 = src[i][1]; break; } } - - var indent = s0.replace(/^(\s+)[^\s]*.*$/, '$1'); - + var indent = s0.replace(/^(\s+)[^\s]*.*$/, "$1"); // we assume clean code style, hence no random mix of tabs and spaces, so every // line MUST have the same indent style as all others, so `length` of indent // should suffice, but the way we coded this is stricter checking when we apply // a find-and-replace regex instead: - var indent_re = new RegExp('^' + indent); + var indent_re = new RegExp("^" + indent); // process template string partials now: for (var i = 0, len = src.length; i < len; i++) { // start-of-lines always end up at index 1 and above (for each template string partial): for (var j = 1, linecnt = src[i].length; j < linecnt; j++) { - src[i][j] = src[i][j].replace(indent_re, ''); + src[i][j] = src[i][j].replace(indent_re, ""); } } // now merge everything to construct the template result: var rv = []; - for (var i = 0, len = src.length, klen = values.length; i < len; i++) { - rv.push(src[i].join('\n')); - + rv.push(src[i].join("\n")); // all but the last partial are followed by a template value: if (i < klen) { rv.push(values[i]); } } - - var sv = rv.join(''); + var sv = rv.join(""); return sv; } @@ -6290,65 +7116,67 @@ Erroneous area: const CONTEXT = 3; const CONTEXT_TAIL = 1; var input = lexer.matched + lexer._input; - var lines = input.split('\n'); + var lines = input.split("\n"); var show_context = error_size < 5 || context_loc; - var l0 = Math.max( 1, - (!show_context ? loc.first_line : (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)) + !show_context + ? loc.first_line + : context_loc ? context_loc.first_line : loc.first_line - CONTEXT ); - var l1 = Math.max( 1, - (!show_context ? loc.last_line : (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)) + !show_context + ? loc.last_line + : context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL ); - - var lineno_display_width = 1 + Math.log10(l1 | 1) | 0; - var ws_prefix = new Array(lineno_display_width).join(' '); - - var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { - var lno = index + l0; - var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); - var rv = lno_pfx + ': ' + line; - - if (show_context) { - var errpfx = new Array(lineno_display_width + 1).join('^'); - - if (lno === loc.first_line) { - var offset = loc.first_column + 2; - - var len = Math.max( - 2, - ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 - ); - - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/A' + len; - } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/B' + len; - } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/C' + len; + var lineno_display_width = (1 + Math.log10(l1 | 1)) | 0; + var ws_prefix = new Array(lineno_display_width).join(" "); + var rv = lines + .slice(l0 - 1, l1 + 1) + .map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ": " + line; + if (show_context) { + var errpfx = new Array(lineno_display_width + 1).join("^"); + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + var len = Math.max( + 2, + (lno === loc.last_line ? loc.last_column : line.length) - + loc.first_column + + 1 + ); + var lead = new Array(offset).join("."); + var mark = new Array(len).join("^"); + rv += "\n" + errpfx + lead + mark + offset + "/A" + len; + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join("."); + var mark = new Array(len).join("^"); + rv += "\n" + errpfx + lead + mark + offset + "/B" + len; + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join("."); + var mark = new Array(len).join("^"); + rv += "\n" + errpfx + lead + mark + offset + "/C" + len; + } } - } - - rv = rv.replace(/\t/g, ' '); - return rv; - }); - - return rv.join('\n'); + rv = rv.replace(/\t/g, " "); + return rv; + }); + return rv.join("\n"); } lexer.warn = function l_warn() { - if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { + if ( + this.yy && + this.yy.parser && + typeof this.yy.parser.warn === "function" + ) { return this.yy.parser.warn.apply(this, arguments); } else { console.warn.apply(console, arguments); @@ -6356,7 +7184,7 @@ Erroneous area: }; lexer.log = function l_log() { - if (this.yy && this.yy.parser && typeof this.yy.parser.log === 'function') { + if (this.yy && this.yy.parser && typeof this.yy.parser.log === "function") { return this.yy.parser.log.apply(this, arguments); } else { console.log.apply(console, arguments); @@ -6364,7 +7192,8 @@ Erroneous area: }; return lexer; -}(); +})(); + parser.lexer = lexer; function Parser() { From f903f0965cf7e361664f5698aaad0df69c582627 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 11 Sep 2017 03:19:32 +0200 Subject: [PATCH 359/417] - bumped build revision - rebuilt library files --- lex-parser.js | 40 ++++++++++++++++++---------------------- package-lock.json | 2 +- package.json | 2 +- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 9e1722f..d5f415f 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-189 */ +/* parser generated by jison 0.6.0-190 */ /* * Returns a Parser object of the following structure: @@ -4426,7 +4426,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-189 */ +/* lexer generated by jison-lex 0.6.0-190 */ /* * Returns a Lexer object of the following structure: @@ -4453,10 +4453,11 @@ parser.yy.post_lex = function p_lex() { * * JisonLexerError: function(msg, hash), * - * performAction: function lexer__performAction(yy, yy_, yyrulenumber, YY_START), + * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), * * The function parameters and `this` have the following value/meaning: - * - `this` : reference to the `lexer` instance. + * - `this` : reference to the `lexer` instance. + * `yy_` is an alias for `this` lexer instance reference used internally. * * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer * by way of the `lexer.setInput(str, yy)` API before. @@ -4466,8 +4467,6 @@ parser.yy.post_lex = function p_lex() { * **parser** grammar definition file are passed to the lexer via this object * reference as member variables. * - * - `yy_` : lexer instance reference used internally. - * * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. * * - `YY_START`: the current lexer "start condition" state. @@ -5421,11 +5420,10 @@ var lexer = (function() { // calling this method: // - // function lexer__performAction(yy, yy_, yyrulenumber, YY_START) {...} + // function lexer__performAction(yy, yyrulenumber, YY_START) {...} token = this.performAction.call( this, this.yy, - this, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ ); @@ -5710,12 +5708,9 @@ var lexer = (function() { easy_keyword_rules: true }, JisonLexerError: JisonLexerError, - performAction: function lexer__performAction( - yy, - yy_, - yyrulenumber, - YY_START - ) { + performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { + var yy_ = this; + var YYSTATE = YY_START; switch (yyrulenumber) { case 0: @@ -7208,11 +7203,12 @@ return new Parser(); -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { - exports.parser = lexParser; - exports.Parser = lexParser.Parser; - exports.parse = function () { - return lexParser.parse.apply(lexParser, arguments); - }; - -} + if (typeof require !== 'undefined' && typeof exports !== 'undefined') { + exports.parser = lexParser; + exports.Parser = lexParser.Parser; + exports.parse = function () { + return lexParser.parse.apply(lexParser, arguments); + }; + + } + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 660c05d..e4b7cf5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-189", + "version": "0.6.0-190", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { diff --git a/package.json b/package.json index 83c9bd0..fd6e273 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-189", + "version": "0.6.0-190", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 90973144a813156649ea79f2df2bda8b3274c4f7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 11 Sep 2017 22:24:57 +0200 Subject: [PATCH 360/417] - fix error where `%include` statement would follow a comment in an open lexer action block: the `%` of the `%include` was incorrectly decoded as an end-of-action-code-block signaller. - augmented the error report source code prettyPrint function to not dump a huge slew of source code when an error happens to span many lines of input. --- lex.l | 9 ++++--- lex.y | 77 ++++++++++++++++++++++++++++++++++++++++------------------- 2 files changed, 59 insertions(+), 27 deletions(-) diff --git a/lex.l b/lex.l index 493307d..94b6ed2 100644 --- a/lex.l +++ b/lex.l @@ -136,9 +136,12 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] return 'ACTION_BODY'; %} // make sure to terminate on linefeed before the next rule alternative, -// which is announced by `|`, or lexer option/command, which -// starts with `%`, e.g. `%include`: -(?:{BR}{WS}+)+/[^{WS}{BR}|%] yy.include_command_allowed = true; +// which is announced by `|`. +// Note that lexer options & commands should be at the start-of-line, i.e. +// without leading whitespace. The only lexer command which we do accept +// here after the last indent is `%include`, which is considered (part +// of) the rule's action code block. +(?:{BR}{WS}+)+/[^{WS}{BR}|] yy.include_command_allowed = true; return 'ACTION_BODY_WHITESPACE'; // keep empty lines as-is inside action code blocks. {BR} if (yy.depth > 0) { yy.include_command_allowed = true; diff --git a/lex.y b/lex.y index 5e4e0f8..a20ab2a 100644 --- a/lex.y +++ b/lex.y @@ -53,7 +53,11 @@ lex extra_module_code // <-- optional! Erroneous code: - ` + prettyPrintRange(yylexer, @error)); + ${prettyPrintRange(yylexer, @error)} + + Technical error report: + ${$error.errStr} + `); } ; @@ -673,42 +677,67 @@ function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var error_size = loc.last_line - loc.first_line; const CONTEXT = 3; const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = lexer.matched + lexer._input; var lines = input.split('\n'); - var show_context = (error_size < 5 || context_loc); - var l0 = Math.max(1, (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); - var l1 = Math.max(1, (!show_context ? loc.last_line : context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); + //var show_context = (error_size < 5 || context_loc); + var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); + var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); var ws_prefix = new Array(lineno_display_width).join(' '); + var nonempty_line_indexes = []; var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { var lno = index + l0; var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ': ' + line; - if (show_context) { - var errpfx = (new Array(lineno_display_width + 1)).join('^'); - if (lno === loc.first_line) { - var offset = loc.first_column + 2; - var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; - } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/E' + len; - } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/F' + len; + var errpfx = (new Array(lineno_display_width + 1)).join('^'); + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); + var lead = (new Array(offset)).join('.'); + var mark = (new Array(len)).join('^'); + rv += '\n' + errpfx + lead + mark; // + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = (new Array(offset)).join('.'); + var mark = (new Array(len)).join('^'); + rv += '\n' + errpfx + lead + mark; // + offset + '/E' + len; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = (new Array(offset)).join('.'); + var mark = (new Array(len)).join('^'); + rv += '\n' + errpfx + lead + mark; // + offset + '/F' + len; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); } } rv = rv.replace(/\t/g, ' '); return rv; }); + // now make sure we don't print an overly large amount of error area: limit it + // to the top and bottom line count: + if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { + var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; + console.log("clip off: ", { + start: clip_start, + end: clip_end, + len: clip_end - clip_start + 1, + arr: nonempty_line_indexes, + rv + }); + var intermediate_line = (new Array(lineno_display_width + 1)).join(' ') + ' (...continued...)'; + intermediate_line += '\n' + (new Array(lineno_display_width + 1)).join('-') + ' (---------------)'; + rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); + } return rv.join('\n'); } From dfae7fcdfe7c9e5787eabe5cde828666b31db7fa Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 11 Sep 2017 22:25:09 +0200 Subject: [PATCH 361/417] regenerated library files using the latest jison --- lex-parser.js | 357 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 316 insertions(+), 41 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d5f415f..83d47c7 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1018,19 +1018,34 @@ case 2: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS` - Maybe you did not correctly separate the lexer sections with a '%%' - on an otherwise empty line? - The lexer spec file should have this structure: - - definitions - %% - rules - %% // <-- optional! - extra_module_code // <-- optional! - - Erroneous code: - ` + prettyPrintRange(yylexer, yylstack[yysp - 1])); + //console.log("error reduction action: ", yyparser.yyGetErrorInfoTrack()); + + if (0) { + console.log("@error dump:", { + yysp, + errtoc: /* error */ 2, + errloc: yylstack[yysp - 1], + error: yyvstack[yysp - 1], + }); + } + + yyparser.yyError(rmCommonWS` + Maybe you did not correctly separate the lexer sections with a '%%' + on an otherwise empty line? + The lexer spec file should have this structure: + + definitions + %% + rules + %% // <-- optional! + extra_module_code // <-- optional! + + Erroneous code: + ${prettyPrintRange(yylexer, yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); break; case 3: @@ -3223,6 +3238,14 @@ parse: function parse(input) { post_lex: undefined }; + if (typeof assert !== 'function') { + assert = function JisonAssert(cond, msg) { + if (!cond) { + throw new Error('assertion failed: ' + (msg || '***')); + } + }; + } + this.yyGetSharedState = function yyGetSharedState() { return sharedState_yy; }; @@ -3583,7 +3606,7 @@ parse: function parse(input) { token: this.describeSymbol(symbol) || symbol, token_id: symbol, line: lexer.yylineno, - loc: lexer.yylloc, + loc: copy_yylloc(lexer.yylloc), expected: expected, recoverable: recoverable, state: state, @@ -3944,6 +3967,7 @@ parse: function parse(input) { yyloc = lexer.yylloc; + preErrorSymbol = 0; symbol = lex(); @@ -3958,7 +3982,7 @@ parse: function parse(input) { // try to recover from error if (error_rule_depth < 0) { - //assert(recovering); + assert(recovering > 0); recoveringErrorInfo.info_stack_pointer = esp; // barf a fatal hairball when we're out of look-ahead symbols and none hit a match @@ -4072,6 +4096,231 @@ parse: function parse(input) { + // Now duplicate the standard parse machine here, at least its initial + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // as we wish to push something special then! + + + // Run the state machine in this copy of the parser state machine + // until we *either* consume the error symbol (and its related information) + // *or* we run into another error while recovering from this one + // *or* we execute a `reduce` action which outputs a final parse + // result (yes, that MAY happen!)... + + assert(symbol === TERROR); + while (symbol) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // read action for current state and first input + t = (table[state] && table[state][symbol]) || NO_ACTION; + newState = t[1]; + action = t[0]; + + + + + + + + + + + // encountered another parse error? If so, break out to main loop + // and take it from there! + if (!action) { + newState = state; + break; + } + } + + + + + + + + + + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + + // shift: + case 1: + stack[sp] = symbol; + //vstack[sp] = lexer.yytext; + vstack[sp] = recoveringErrorInfo; + //lstack[sp] = copy_yylloc(lexer.yylloc); + lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); + sstack[sp] = newState; // push state + ++sp; + symbol = 0; + if (!preErrorSymbol) { // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + yytext = lexer.yytext; + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + + + + + + + + + + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + + + + + + + + + // read action for current state and first input + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + + + + + + + + symbol = 0; + } + } + + continue; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + + + + + + + + + + r = this.performAction.call(yyval, yytext, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack); + + if (typeof r !== 'undefined') { + // signal end of error recovery loop AND end of outer parse loop + action = 3; + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + + + + + + + + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + break; + } + + // break out of loop: we accept or fail with error + break; + } + + // should we also break out of the regular/outer parse loop, + // i.e. did the parser already produce a parse result in here?! + if (action === 3) { + break; + } continue; } @@ -4106,10 +4355,11 @@ parse: function parse(input) { case 1: stack[sp] = symbol; vstack[sp] = lexer.yytext; - lstack[sp] = lexer.yylloc; + lstack[sp] = copy_yylloc(lexer.yylloc); sstack[sp] = newState; // push state ++sp; symbol = 0; + assert(preErrorSymbol === 0); if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: @@ -4367,42 +4617,67 @@ function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var error_size = loc.last_line - loc.first_line; const CONTEXT = 3; const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = lexer.matched + lexer._input; var lines = input.split('\n'); - var show_context = (error_size < 5 || context_loc); - var l0 = Math.max(1, (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); - var l1 = Math.max(1, (!show_context ? loc.last_line : context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); + //var show_context = (error_size < 5 || context_loc); + var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); + var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); var ws_prefix = new Array(lineno_display_width).join(' '); + var nonempty_line_indexes = []; var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { var lno = index + l0; var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ': ' + line; - if (show_context) { - var errpfx = (new Array(lineno_display_width + 1)).join('^'); - if (lno === loc.first_line) { - var offset = loc.first_column + 2; - var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; - } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/E' + len; - } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/F' + len; + var errpfx = (new Array(lineno_display_width + 1)).join('^'); + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); + var lead = (new Array(offset)).join('.'); + var mark = (new Array(len)).join('^'); + rv += '\n' + errpfx + lead + mark; // + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = (new Array(offset)).join('.'); + var mark = (new Array(len)).join('^'); + rv += '\n' + errpfx + lead + mark; // + offset + '/E' + len; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = (new Array(offset)).join('.'); + var mark = (new Array(len)).join('^'); + rv += '\n' + errpfx + lead + mark; // + offset + '/F' + len; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); } } rv = rv.replace(/\t/g, ' '); return rv; }); + // now make sure we don't print an overly large amount of error area: limit it + // to the top and bottom line count: + if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { + var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; + console.log("clip off: ", { + start: clip_start, + end: clip_end, + len: clip_end - clip_start + 1, + arr: nonempty_line_indexes, + rv + }); + var intermediate_line = (new Array(lineno_display_width + 1)).join(' ') + ' (...continued...)'; + intermediate_line += '\n' + (new Array(lineno_display_width + 1)).join('-') + ' (---------------)'; + rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); + } return rv.join('\n'); } @@ -5881,7 +6156,7 @@ var lexer = (function() { case 17: /*! Conditions:: action */ - /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|%]) */ + /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|]) */ yy.include_command_allowed = true; return 33; // keep empty lines as-is inside action code blocks. @@ -6673,7 +6948,7 @@ var lexer = (function() { /* 14: */ /^(?:[^\s"%'\/`{-}]+)/, /* 15: */ /^(?:\{)/, /* 16: */ /^(?:\})/, - /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s%|]))/, + /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s|]))/, /* 18: */ /^(?:(\r\n|\n|\r))/, /* 19: */ /^(?:$)/, /* 20: */ new XRegExp( From 3b641b78591311b5c96d15813bfbcfb6f8c3df1a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 11 Sep 2017 22:28:49 +0200 Subject: [PATCH 362/417] remove temporary debugging code. --- lex-parser.js | 45 +++++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 83d47c7..b92386b 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1018,34 +1018,23 @@ case 2: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - //console.log("error reduction action: ", yyparser.yyGetErrorInfoTrack()); - - if (0) { - console.log("@error dump:", { - yysp, - errtoc: /* error */ 2, - errloc: yylstack[yysp - 1], - error: yyvstack[yysp - 1], - }); - } - - yyparser.yyError(rmCommonWS` - Maybe you did not correctly separate the lexer sections with a '%%' - on an otherwise empty line? - The lexer spec file should have this structure: - - definitions - %% - rules - %% // <-- optional! - extra_module_code // <-- optional! - - Erroneous code: - ${prettyPrintRange(yylexer, yylstack[yysp - 1])} - - Technical error report: - ${yyvstack[yysp - 1].errStr} - `); + yyparser.yyError(rmCommonWS` + Maybe you did not correctly separate the lexer sections with a '%%' + on an otherwise empty line? + The lexer spec file should have this structure: + + definitions + %% + rules + %% // <-- optional! + extra_module_code // <-- optional! + + Erroneous code: + ${prettyPrintRange(yylexer, yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); break; case 3: From 0539616038e5019f5b43f03e8c1bd68928bd71b1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 11 Sep 2017 23:25:22 +0200 Subject: [PATCH 363/417] regenerated library files using bleeding edge jison --- lex-parser.js | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index b92386b..7da14f5 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -753,6 +753,7 @@ yyMergeLocationInfo: null, __reentrant_call_depth: 0, // INTERNAL USE ONLY __error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup // APIs which will be set up depending on user action code analysis: //yyRecovering: 0, @@ -3312,7 +3313,7 @@ parse: function parse(input) { var esp = recoveringErrorInfo.info_stack_pointer; recoveringErrorInfo.symbol_stack[esp] = symbol; - var v = shallowCopyErrorInfo(hash); + var v = this.shallowCopyErrorInfo(hash); v.yyError = true; v.errorRuleDepth = error_rule_depth; v.recovering = recovering; @@ -3325,7 +3326,7 @@ parse: function parse(input) { ++esp; recoveringErrorInfo.info_stack_pointer = esp; } else { - recoveringErrorInfo = shallowCopyErrorInfo(hash); + recoveringErrorInfo = this.shallowCopyErrorInfo(hash); recoveringErrorInfo.yyError = true; recoveringErrorInfo.errorRuleDepth = error_rule_depth; recoveringErrorInfo.recovering = recovering; @@ -3443,6 +3444,14 @@ parse: function parse(input) { this.__error_infos.length = 0; + for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) { + var el = this.__error_recovery_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_recovery_infos.length = 0; + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { recoveringErrorInfo.destroy(); recoveringErrorInfo = undefined; @@ -3640,9 +3649,15 @@ parse: function parse(input) { // clone some parts of the (possibly enhanced!) errorInfo object // to give them some persistence. - function shallowCopyErrorInfo(p) { + this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) { var rv = shallow_copy(p); + // remove the large parts which can only cause cyclic references + // and are otherwise available from the parser kernel anyway. + delete rv.sharedState_yy; + delete rv.parser; + delete rv.lexer; + // lexer.yytext MAY be a complex value object, rather than a simple string/value: rv.value = shallow_copy(rv.value); @@ -3712,8 +3727,11 @@ parse: function parse(input) { rv.root_failure_pointer = rv.stack_pointer; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_recovery_infos.push(rv); + return rv; - } + }; function lex() { @@ -3907,7 +3925,7 @@ parse: function parse(input) { if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { recoveringErrorInfo.destroy(); } - recoveringErrorInfo = shallowCopyErrorInfo(p); + recoveringErrorInfo = this.shallowCopyErrorInfo(p); r = this.parseError(p.errStr, p, this.JisonParserError); @@ -4096,6 +4114,7 @@ parse: function parse(input) { // *or* we execute a `reduce` action which outputs a final parse // result (yes, that MAY happen!)... + assert(recoveringErrorInfo); assert(symbol === TERROR); while (symbol) { // retrieve state number from top of stack @@ -4160,6 +4179,7 @@ parse: function parse(input) { case 1: stack[sp] = symbol; //vstack[sp] = lexer.yytext; + assert(recoveringErrorInfo); vstack[sp] = recoveringErrorInfo; //lstack[sp] = copy_yylloc(lexer.yylloc); lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); @@ -4222,7 +4242,8 @@ parse: function parse(input) { } } - continue; + // once we have pushed the special ERROR token value, we're done in this inner loop! + break; // reduce: case 2: From 9deea012ef7309f15f4cf0ac506abff651be83c9 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 12 Sep 2017 00:05:43 +0200 Subject: [PATCH 364/417] migrating the very useful `prettyPrintRange` to becoming a lexer API --- lex-parser.js | 243 ++++++++++++++++++++++++++++++++++++++++++-------- lex.y | 6 +- 2 files changed, 211 insertions(+), 38 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 7da14f5..077c27a 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -4646,7 +4646,7 @@ function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; // + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; + rv += '\n' + errpfx + lead + mark; if (line.trim().length > 0) { nonempty_line_indexes.push(index); } @@ -4655,7 +4655,7 @@ function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var len = Math.max(2, loc.last_column + 1); var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; // + offset + '/E' + len; + rv += '\n' + errpfx + lead + mark; if (line.trim().length > 0) { nonempty_line_indexes.push(index); } @@ -4664,7 +4664,7 @@ function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var len = Math.max(2, line.length + 1); var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; // + offset + '/F' + len; + rv += '\n' + errpfx + lead + mark; if (line.trim().length > 0) { nonempty_line_indexes.push(index); } @@ -5578,6 +5578,147 @@ var lexer = (function() { ); }, + /** + return a string which displays the lines & columns of input which are referenced + by the given location info range, plus a few lines of context. + + This function pretty-prints the indicated section of the input, with line numbers + and everything! + + This function is very useful to provide highly readable error reports, while + the location range may be specified in various flexible ways: + + - `loc` is the location info object which references the area which should be + displayed and 'marked up': these lines & columns of text are marked up by `^` + characters below each character in the entire input range. + + - `context_loc` is the *optional* location info object which instructs this + pretty-printer how much *leading* context should be displayed alongside + the area referenced by `loc`. This can help provide context for the displayed + error, etc. + + When this location info is not provided, a default context of 3 lines is + used. + + - `context_loc2` is another *optional* location info object, which serves + a similar purpose to `context_loc`: it specifies the amount of *trailing* + context lines to display in the pretty-print output. + + When this location info is not provided, a default context of 1 line only is + used. + + Special Notes: + + - when the `loc`-indicated range is very large (about 5 lines or more), then + only the first and last few lines of this block are printed while a + `...continued...` message will be printed between them. + + This serves the purpose of not printing a huge amount of text when the `loc` + range happens to be huge: this way a manageable & readable output results + for arbitrary large ranges. + + - this function can display lines of input which whave not yet been lexed. + `prettyPrintRange()` can access the entire input! + + @public + @this {RegExpLexer} + */ + prettyPrintRange: function lexer_prettyPrintRange( + loc, + context_loc, + context_loc2 + ) { + var error_size = loc.last_line - loc.first_line; + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var input = this.matched + this._input; + var lines = input.split("\n"); + //var show_context = (error_size < 5 || context_loc); + var l0 = Math.max( + 1, + context_loc ? context_loc.first_line : loc.first_line - CONTEXT + ); + var l1 = Math.max( + 1, + context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL + ); + var lineno_display_width = (1 + Math.log10(l1 | 1)) | 0; + var ws_prefix = new Array(lineno_display_width).join(" "); + var nonempty_line_indexes = []; + var rv = lines + .slice(l0 - 1, l1 + 1) + .map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ": " + line; + var errpfx = new Array(lineno_display_width + 1).join("^"); + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + var len = Math.max( + 2, + (lno === loc.last_line ? loc.last_column : line.length) - + loc.first_column + + 1 + ); + var lead = new Array(offset).join("."); + var mark = new Array(len).join("^"); + rv += "\n" + errpfx + lead + mark; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join("."); + var mark = new Array(len).join("^"); + rv += "\n" + errpfx + lead + mark; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join("."); + var mark = new Array(len).join("^"); + rv += "\n" + errpfx + lead + mark; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } + rv = rv.replace(/\t/g, " "); + return rv; + }); + // now make sure we don't print an overly large amount of error area: limit it + // to the top and bottom line count: + if ( + nonempty_line_indexes.length > + 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT + ) { + var clip_start = + nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = + nonempty_line_indexes[ + nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT + ] - 1; + console.log("clip off: ", { + start: clip_start, + end: clip_end, + len: clip_end - clip_start + 1, + arr: nonempty_line_indexes, + rv + }); + var intermediate_line = + new Array(lineno_display_width + 1).join(" ") + " (...continued...)"; + intermediate_line += + "\n" + + new Array(lineno_display_width + 1).join("-") + + " (---------------)"; + rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); + } + return rv.join("\n"); + }, + /** helper function, used to produce a human readable description as a string, given the input `yylloc` location object. @@ -7395,59 +7536,91 @@ var lexer = (function() { var error_size = loc.last_line - loc.first_line; const CONTEXT = 3; const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = lexer.matched + lexer._input; var lines = input.split("\n"); - var show_context = error_size < 5 || context_loc; + //var show_context = (error_size < 5 || context_loc); var l0 = Math.max( 1, - !show_context - ? loc.first_line - : context_loc ? context_loc.first_line : loc.first_line - CONTEXT + context_loc ? context_loc.first_line : loc.first_line - CONTEXT ); var l1 = Math.max( 1, - !show_context - ? loc.last_line - : context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL + context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL ); var lineno_display_width = (1 + Math.log10(l1 | 1)) | 0; var ws_prefix = new Array(lineno_display_width).join(" "); + var nonempty_line_indexes = []; var rv = lines .slice(l0 - 1, l1 + 1) .map(function injectLineNumber(line, index) { var lno = index + l0; var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ": " + line; - if (show_context) { - var errpfx = new Array(lineno_display_width + 1).join("^"); - if (lno === loc.first_line) { - var offset = loc.first_column + 2; - var len = Math.max( - 2, - (lno === loc.last_line ? loc.last_column : line.length) - - loc.first_column + - 1 - ); - var lead = new Array(offset).join("."); - var mark = new Array(len).join("^"); - rv += "\n" + errpfx + lead + mark + offset + "/A" + len; - } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join("."); - var mark = new Array(len).join("^"); - rv += "\n" + errpfx + lead + mark + offset + "/B" + len; - } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); - var lead = new Array(offset).join("."); - var mark = new Array(len).join("^"); - rv += "\n" + errpfx + lead + mark + offset + "/C" + len; + var errpfx = new Array(lineno_display_width + 1).join("^"); + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + var len = Math.max( + 2, + (lno === loc.last_line ? loc.last_column : line.length) - + loc.first_column + + 1 + ); + var lead = new Array(offset).join("."); + var mark = new Array(len).join("^"); + rv += "\n" + errpfx + lead + mark; // + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join("."); + var mark = new Array(len).join("^"); + rv += "\n" + errpfx + lead + mark; // + offset + '/E' + len; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join("."); + var mark = new Array(len).join("^"); + rv += "\n" + errpfx + lead + mark; // + offset + '/F' + len; + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); } } rv = rv.replace(/\t/g, " "); return rv; }); + // now make sure we don't print an overly large amount of error area: limit it + // to the top and bottom line count: + if ( + nonempty_line_indexes.length > + 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT + ) { + var clip_start = + nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = + nonempty_line_indexes[ + nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT + ] - 1; + console.log("clip off: ", { + start: clip_start, + end: clip_end, + len: clip_end - clip_start + 1, + arr: nonempty_line_indexes, + rv + }); + var intermediate_line = + new Array(lineno_display_width + 1).join(" ") + " (...continued...)"; + intermediate_line += + "\n" + + new Array(lineno_display_width + 1).join("-") + + " (---------------)"; + rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); + } return rv.join("\n"); } diff --git a/lex.y b/lex.y index a20ab2a..e7b2272 100644 --- a/lex.y +++ b/lex.y @@ -696,7 +696,7 @@ function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; // + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; + rv += '\n' + errpfx + lead + mark; if (line.trim().length > 0) { nonempty_line_indexes.push(index); } @@ -705,7 +705,7 @@ function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var len = Math.max(2, loc.last_column + 1); var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; // + offset + '/E' + len; + rv += '\n' + errpfx + lead + mark; if (line.trim().length > 0) { nonempty_line_indexes.push(index); } @@ -714,7 +714,7 @@ function prettyPrintRange(lexer, loc, context_loc, context_loc2) { var len = Math.max(2, line.length + 1); var lead = (new Array(offset)).join('.'); var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; // + offset + '/F' + len; + rv += '\n' + errpfx + lead + mark; if (line.trim().length > 0) { nonempty_line_indexes.push(index); } From aaa6716b073a7d2b2b04a520bc86738169c21189 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 12 Sep 2017 00:39:08 +0200 Subject: [PATCH 365/417] migrating the very useful `prettyPrintRange` to becoming a lexer API: this cuts down significantly on duplicated code right now. --- lex-parser.js | 694 ++++++++++++++++++++------------------------------ lex.l | 72 +----- lex.y | 101 ++------ 3 files changed, 301 insertions(+), 566 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 077c27a..85ba26a 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1031,7 +1031,7 @@ case 2: extra_module_code // <-- optional! Erroneous code: - ${prettyPrintRange(yylexer, yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp - 1].errStr} @@ -1300,7 +1300,7 @@ case 23: block. Erroneous area: - ` + prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])); + ` + yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])); break; case 24: @@ -1319,7 +1319,7 @@ case 24: as a terminating curly brace '}' could not be found. Erroneous area: - ` + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 25: @@ -1351,7 +1351,7 @@ case 28: error: yyvstack[yysp], text: yytext }); - yyparser.yyError("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); + yyparser.yyError("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; case 29: @@ -1363,7 +1363,7 @@ case 29: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError("Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 30: @@ -1375,7 +1375,7 @@ case 30: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError("Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 31: @@ -1460,7 +1460,7 @@ case 38: " a line. " + "" + " It's use is not permitted at this position:" + - "" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); + "" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; case 39: @@ -1472,7 +1472,7 @@ case 39: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); + yyparser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; case 40: @@ -1510,7 +1510,7 @@ case 42: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Seems you did not correctly terminate the start condition set <" + yyvstack[yysp - 1].join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError("Seems you did not correctly terminate the start condition set <" + yyvstack[yysp - 1].join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 43: @@ -1721,7 +1721,7 @@ case 61: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 62: @@ -1857,7 +1857,7 @@ case 77: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 81: @@ -1964,7 +1964,7 @@ case 93: internal error: option "${$option}" value assignment failure. Erroneous area: - ` + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); break; case 94: @@ -1981,7 +1981,7 @@ case 94: expected a valid option name (with optional value assignment). Erroneous area: - ` + prettyPrintRange(yylexer, yylstack[yysp])); + ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp])); break; case 97: @@ -2011,7 +2011,7 @@ case 98: %include MUST be followed by a valid file path. Erroneous path: - ` + prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); + ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); break; case 101: @@ -2028,7 +2028,7 @@ case 101: module code declaration error? Erroneous area: - ` + prettyPrintRange(yylexer, yylstack[yysp])); + ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp])); break; case 129: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! @@ -4622,75 +4622,6 @@ function rmCommonWS(strings, ...values) { return sv; } -// pretty-print the erroneous section of the input, with line numbers and everything... -function prettyPrintRange(lexer, loc, context_loc, context_loc2) { - var error_size = loc.last_line - loc.first_line; - const CONTEXT = 3; - const CONTEXT_TAIL = 1; - const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; - var input = lexer.matched + lexer._input; - var lines = input.split('\n'); - //var show_context = (error_size < 5 || context_loc); - var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); - var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); - var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); - var ws_prefix = new Array(lineno_display_width).join(' '); - var nonempty_line_indexes = []; - var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { - var lno = index + l0; - var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); - var rv = lno_pfx + ': ' + line; - var errpfx = (new Array(lineno_display_width + 1)).join('^'); - if (lno === loc.first_line) { - var offset = loc.first_column + 2; - var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } - rv = rv.replace(/\t/g, ' '); - return rv; - }); - // now make sure we don't print an overly large amount of error area: limit it - // to the top and bottom line count: - if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { - var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; - var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; - console.log("clip off: ", { - start: clip_start, - end: clip_end, - len: clip_end - clip_start + 1, - arr: nonempty_line_indexes, - rv - }); - var intermediate_line = (new Array(lineno_display_width + 1)).join(' ') + ' (...continued...)'; - intermediate_line += '\n' + (new Array(lineno_display_width + 1)).join('-') + ' (---------------)'; - rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); - } - return rv.join('\n'); -} - parser.warn = function p_warn() { console.warn.apply(console, arguments); @@ -5058,11 +4989,11 @@ var lexer = (function() { yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** - INTERNAL USE: construct a suitable error info hash object instance for `parseError`. - - @public - @this {RegExpLexer} - */ + * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + * + * @public + * @this {RegExpLexer} + */ constructLexErrorInfo: function lexer_constructLexErrorInfo( msg, recoverable @@ -5079,17 +5010,17 @@ var lexer = (function() { lexer: this, /** - and make sure the error info doesn't stay due to potential - ref cycle via userland code manipulations. - These would otherwise all be memory leak opportunities! - - Note that only array and object references are nuked as those - constitute the set of elements which can produce a cyclic ref. - The rest of the members is kept intact as they are harmless. - - @public - @this {LexErrorInfo} - */ + * and make sure the error info doesn't stay due to potential + * ref cycle via userland code manipulations. + * These would otherwise all be memory leak opportunities! + * + * Note that only array and object references are nuked as those + * constitute the set of elements which can produce a cyclic ref. + * The rest of the members is kept intact as they are harmless. + * + * @public + * @this {LexErrorInfo} + */ destroy: function destructLexErrorInfo() { // remove cyclic references added to error info: // info.yy = null; @@ -5110,11 +5041,11 @@ var lexer = (function() { }, /** - handler which is invoked when a lexer error occurs. - - @public - @this {RegExpLexer} - */ + * handler which is invoked when a lexer error occurs. + * + * @public + * @this {RegExpLexer} + */ parseError: function lexer_parseError(str, hash, ExceptionClass) { if (!ExceptionClass) { ExceptionClass = this.JisonLexerError; @@ -5136,11 +5067,11 @@ var lexer = (function() { }, /** - method which implements `yyerror(str, ...args)` functionality for use inside lexer actions. - - @public - @this {RegExpLexer} - */ + * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions. + * + * @public + * @this {RegExpLexer} + */ yyerror: function yyError(str /*, ...args */) { var lineno_msg = ""; if (this.options.trackPosition) { @@ -5161,17 +5092,17 @@ var lexer = (function() { }, /** - final cleanup function for when we have completed lexing the input; - make it an API so that external code can use this one once userland - code has decided it's time to destroy any lingering lexer error - hash object instances and the like: this function helps to clean - up these constructs, which *may* carry cyclic references which would - otherwise prevent the instances from being properly and timely - garbage-collected, i.e. this function helps prevent memory leaks! - - @public - @this {RegExpLexer} - */ + * final cleanup function for when we have completed lexing the input; + * make it an API so that external code can use this one once userland + * code has decided it's time to destroy any lingering lexer error + * hash object instances and the like: this function helps to clean + * up these constructs, which *may* carry cyclic references which would + * otherwise prevent the instances from being properly and timely + * garbage-collected, i.e. this function helps prevent memory leaks! + * + * @public + * @this {RegExpLexer} + */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { var rv; @@ -5195,11 +5126,11 @@ var lexer = (function() { }, /** - clear the lexer token context; intended for internal use only - - @public - @this {RegExpLexer} - */ + * clear the lexer token context; intended for internal use only + * + * @public + * @this {RegExpLexer} + */ clear: function lexer_clear() { this.yytext = ""; this.yyleng = 0; @@ -5220,11 +5151,11 @@ var lexer = (function() { }, /** - resets the lexer, sets new input - - @public - @this {RegExpLexer} - */ + * resets the lexer, sets new input + * + * @public + * @this {RegExpLexer} + */ setInput: function lexer_setInput(input, yy) { this.yy = yy || this.yy || {}; @@ -5290,26 +5221,26 @@ var lexer = (function() { }, /** - push a new input into the lexer and activate it: - the old input position is stored and will be resumed - once this new input has been consumed. - - Use this API to help implement C-preprocessor-like - `#include` statements. - - Available options: - - - `emit_EOF_at_end` : {int} the `EOF`-like token to emit - when the new input is consumed: use - this to mark the end of the new input - in the parser grammar. zero/falsey - token value means no end marker token - will be emitted before the lexer - resumes reading from the previous input. - - @public - @this {RegExpLexer} - */ + * push a new input into the lexer and activate it: + * the old input position is stored and will be resumed + * once this new input has been consumed. + * + * Use this API to help implement C-preprocessor-like + * `#include` statements. + * + * Available options: + * + * - `emit_EOF_at_end` : {int} the `EOF`-like token to emit + * when the new input is consumed: use + * this to mark the end of the new input + * in the parser grammar. zero/falsey + * token value means no end marker token + * will be emitted before the lexer + * resumes reading from the previous input. + * + * @public + * @this {RegExpLexer} + */ pushInput: function lexer_pushInput(input, label, options) { options = options || {}; @@ -5334,11 +5265,11 @@ var lexer = (function() { }, /** - consumes and returns one char from the input - - @public - @this {RegExpLexer} - */ + * consumes and returns one char from the input + * + * @public + * @this {RegExpLexer} + */ input: function lexer_input() { if (!this._input) { //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) @@ -5386,11 +5317,11 @@ var lexer = (function() { }, /** - unshifts one char (or an entire string) into the input - - @public - @this {RegExpLexer} - */ + * unshifts one char (or an entire string) into the input + * + * @public + * @this {RegExpLexer} + */ unput: function lexer_unput(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); @@ -5424,22 +5355,23 @@ var lexer = (function() { }, /** - cache matched text and append it on next action - - @public - @this {RegExpLexer} - */ + * cache matched text and append it on next action + * + * @public + * @this {RegExpLexer} + */ more: function lexer_more() { this._more = true; return this; }, /** - signal the lexer that this rule fails to match the input, so the next matching rule (regex) should be tested instead. - - @public - @this {RegExpLexer} - */ + * signal the lexer that this rule fails to match the input, so the + * next matching rule (regex) should be tested instead. + * + * @public + * @this {RegExpLexer} + */ reject: function lexer_reject() { if (this.options.backtrack_lexer) { this._backtrack = true; @@ -5472,27 +5404,29 @@ var lexer = (function() { }, /** - retain first n characters of the match - - @public - @this {RegExpLexer} - */ + * retain first n characters of the match + * + * @public + * @this {RegExpLexer} + */ less: function lexer_less(n) { return this.unput(this.match.slice(n)); }, /** - return (part of the) already matched input, i.e. for error messages. - - Limit the returned string length to `maxSize` (default: 20). - - Limit the returned string to the `maxLines` number of lines of input (default: 1). - - Negative limit values equal *unlimited*. - - @public - @this {RegExpLexer} - */ + * return (part of the) already matched input, i.e. for error + * messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of + * input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * @public + * @this {RegExpLexer} + */ pastInput: function lexer_pastInput(maxSize, maxLines) { var past = this.matched.substring( 0, @@ -5522,17 +5456,17 @@ var lexer = (function() { }, /** - return (part of the) upcoming input, i.e. for error messages. - - Limit the returned string length to `maxSize` (default: 20). - - Limit the returned string to the `maxLines` number of lines of input (default: 1). - - Negative limit values equal *unlimited*. - - @public - @this {RegExpLexer} - */ + * return (part of the) upcoming input, i.e. for error messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * @public + * @this {RegExpLexer} + */ upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { var next = this.match; if (maxSize < 0) maxSize = next.length + this._input.length; @@ -5561,11 +5495,12 @@ var lexer = (function() { }, /** - return a string which displays the character position where the lexing error occurred, i.e. for error messages - - @public - @this {RegExpLexer} - */ + * return a string which displays the character position where the + * lexing error occurred, i.e. for error messages + * + * @public + * @this {RegExpLexer} + */ showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { var pre = this.pastInput(maxPrefix).replace(/\s/g, " "); var c = new Array(pre.length + 1).join("-"); @@ -5579,50 +5514,50 @@ var lexer = (function() { }, /** - return a string which displays the lines & columns of input which are referenced - by the given location info range, plus a few lines of context. - - This function pretty-prints the indicated section of the input, with line numbers - and everything! - - This function is very useful to provide highly readable error reports, while - the location range may be specified in various flexible ways: - - - `loc` is the location info object which references the area which should be - displayed and 'marked up': these lines & columns of text are marked up by `^` - characters below each character in the entire input range. - - - `context_loc` is the *optional* location info object which instructs this - pretty-printer how much *leading* context should be displayed alongside - the area referenced by `loc`. This can help provide context for the displayed - error, etc. - - When this location info is not provided, a default context of 3 lines is - used. - - - `context_loc2` is another *optional* location info object, which serves - a similar purpose to `context_loc`: it specifies the amount of *trailing* - context lines to display in the pretty-print output. - - When this location info is not provided, a default context of 1 line only is - used. - - Special Notes: - - - when the `loc`-indicated range is very large (about 5 lines or more), then - only the first and last few lines of this block are printed while a - `...continued...` message will be printed between them. - - This serves the purpose of not printing a huge amount of text when the `loc` - range happens to be huge: this way a manageable & readable output results - for arbitrary large ranges. - - - this function can display lines of input which whave not yet been lexed. - `prettyPrintRange()` can access the entire input! - - @public - @this {RegExpLexer} - */ + * return a string which displays the lines & columns of input which are referenced + * by the given location info range, plus a few lines of context. + * + * This function pretty-prints the indicated section of the input, with line numbers + * and everything! + * + * This function is very useful to provide highly readable error reports, while + * the location range may be specified in various flexible ways: + * + * - `loc` is the location info object which references the area which should be + * displayed and 'marked up': these lines & columns of text are marked up by `^` + * characters below each character in the entire input range. + * + * - `context_loc` is the *optional* location info object which instructs this + * pretty-printer how much *leading* context should be displayed alongside + * the area referenced by `loc`. This can help provide context for the displayed + * error, etc. + * + * When this location info is not provided, a default context of 3 lines is + * used. + * + * - `context_loc2` is another *optional* location info object, which serves + * a similar purpose to `context_loc`: it specifies the amount of *trailing* + * context lines to display in the pretty-print output. + * + * When this location info is not provided, a default context of 1 line only is + * used. + * + * Special Notes: + * + * - when the `loc`-indicated range is very large (about 5 lines or more), then + * only the first and last few lines of this block are printed while a + * `...continued...` message will be printed between them. + * + * This serves the purpose of not printing a huge amount of text when the `loc` + * range happens to be huge: this way a manageable & readable output results + * for arbitrary large ranges. + * + * - this function can display lines of input which whave not yet been lexed. + * `prettyPrintRange()` can access the entire input! + * + * @public + * @this {RegExpLexer} + */ prettyPrintRange: function lexer_prettyPrintRange( loc, context_loc, @@ -5720,15 +5655,15 @@ var lexer = (function() { }, /** - helper function, used to produce a human readable description as a string, given - the input `yylloc` location object. - - Set `display_range_too` to TRUE to include the string character index position(s) - in the description if the `yylloc.range` is available. - - @public - @this {RegExpLexer} - */ + * helper function, used to produce a human readable description as a string, given + * the input `yylloc` location object. + * + * Set `display_range_too` to TRUE to include the string character index position(s) + * in the description if the `yylloc.range` is available. + * + * @public + * @this {RegExpLexer} + */ describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { var l1 = yylloc.first_line; var l2 = yylloc.last_line; @@ -5769,23 +5704,23 @@ var lexer = (function() { }, /** - test the lexed token: return FALSE when not a match, otherwise return token. - - `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` - contains the actually matched text string. - - Also move the input cursor forward and update the match collectors: - - - `yytext` - - `yyleng` - - `match` - - `matches` - - `yylloc` - - `offset` - - @public - @this {RegExpLexer} - */ + * test the lexed token: return FALSE when not a match, otherwise return token. + * + * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + * contains the actually matched text string. + * + * Also move the input cursor forward and update the match collectors: + * + * - `yytext` + * - `yyleng` + * - `match` + * - `matches` + * - `yylloc` + * - `offset` + * + * @public + * @this {RegExpLexer} + */ test_match: function lexer_test_match(match, indexed_rule) { var token, lines, backup, match_str, match_str_len; @@ -5869,7 +5804,8 @@ var lexer = (function() { this.__currentRuleSet__ = null; return false; // rule action called reject() implying the next rule should be tested instead. } else if (this._signaled_error_token) { - // produce one 'error' token as `.parseError()` in `reject()` did not guarantee a failure signal by throwing an exception! + // produce one 'error' token as `.parseError()` in `reject()` + // did not guarantee a failure signal by throwing an exception! token = this._signaled_error_token; this._signaled_error_token = false; return token; @@ -5878,11 +5814,11 @@ var lexer = (function() { }, /** - return next match in input - - @public - @this {RegExpLexer} - */ + * return next match in input + * + * @public + * @this {RegExpLexer} + */ next: function lexer_next() { if (this.done) { this.clear(); @@ -6003,11 +5939,11 @@ var lexer = (function() { }, /** - return next match that has a token - - @public - @this {RegExpLexer} - */ + * return next match that has a token + * + * @public + * @this {RegExpLexer} + */ lex: function lexer_lex() { var r; // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: @@ -6044,23 +5980,24 @@ var lexer = (function() { }, /** - backwards compatible alias for `pushState()`; - the latter is symmetrical with `popState()` and we advise to use - those APIs in any modern lexer code, rather than `begin()`. - - @public - @this {RegExpLexer} - */ + * backwards compatible alias for `pushState()`; + * the latter is symmetrical with `popState()` and we advise to use + * those APIs in any modern lexer code, rather than `begin()`. + * + * @public + * @this {RegExpLexer} + */ begin: function lexer_begin(condition) { return this.pushState(condition); }, /** - activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) - - @public - @this {RegExpLexer} - */ + * activates a new lexer condition state (pushes the new lexer + * condition state onto the condition stack) + * + * @public + * @this {RegExpLexer} + */ pushState: function lexer_pushState(condition) { this.conditionStack.push(condition); this.__currentRuleSet__ = null; @@ -6068,11 +6005,12 @@ var lexer = (function() { }, /** - pop the previously active lexer condition state off the condition stack - - @public - @this {RegExpLexer} - */ + * pop the previously active lexer condition state off the condition + * stack + * + * @public + * @this {RegExpLexer} + */ popState: function lexer_popState() { var n = this.conditionStack.length - 1; if (n > 0) { @@ -6084,11 +6022,13 @@ var lexer = (function() { }, /** - return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available - - @public - @this {RegExpLexer} - */ + * return the currently active lexer condition state; when an index + * argument is provided it produces the N-th previous condition state, + * if available + * + * @public + * @this {RegExpLexer} + */ topState: function lexer_topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); if (n >= 0) { @@ -6099,11 +6039,12 @@ var lexer = (function() { }, /** - (internal) determine the lexer rule set which is active for the currently active lexer condition state - - @public - @this {RegExpLexer} - */ + * (internal) determine the lexer rule set which is active for the + * currently active lexer condition state + * + * @public + * @this {RegExpLexer} + */ _currentRules: function lexer__currentRules() { if ( this.conditionStack.length && @@ -6118,11 +6059,11 @@ var lexer = (function() { }, /** - return the number of states currently on the stack - - @public - @this {RegExpLexer} - */ + * return the number of states currently on the stack + * + * @public + * @this {RegExpLexer} + */ stateStackSize: function lexer_stateStackSize() { return this.conditionStack.length; }, @@ -6296,7 +6237,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return "BRACKETS_SURPLUS"; } else { @@ -6345,7 +6286,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); yy_.yytext = ""; return "BRACKETS_MISSING"; @@ -6656,7 +6597,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); yy_.yytext = [ this.matches[1], // {NAME} @@ -6739,7 +6680,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return 2; break; @@ -6754,7 +6695,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return 2; break; @@ -6769,7 +6710,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return 2; break; @@ -6784,7 +6725,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return 2; break; @@ -6799,7 +6740,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return 2; break; @@ -6814,7 +6755,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return 2; break; @@ -6831,7 +6772,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return 2; break; @@ -6848,7 +6789,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return 2; break; @@ -6865,7 +6806,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); return 2; break; @@ -6890,7 +6831,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); break; case 104: @@ -6907,7 +6848,7 @@ var lexer = (function() { Erroneous area: ` + - prettyPrintRange(this, yy_.yylloc) + this.prettyPrintRange(this, yy_.yylloc) ); break; default: @@ -7531,99 +7472,6 @@ var lexer = (function() { return sv; } - // pretty-print the erroneous section of the input, with line numbers and everything... - function prettyPrintRange(lexer, loc, context_loc, context_loc2) { - var error_size = loc.last_line - loc.first_line; - const CONTEXT = 3; - const CONTEXT_TAIL = 1; - const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; - var input = lexer.matched + lexer._input; - var lines = input.split("\n"); - //var show_context = (error_size < 5 || context_loc); - var l0 = Math.max( - 1, - context_loc ? context_loc.first_line : loc.first_line - CONTEXT - ); - var l1 = Math.max( - 1, - context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL - ); - var lineno_display_width = (1 + Math.log10(l1 | 1)) | 0; - var ws_prefix = new Array(lineno_display_width).join(" "); - var nonempty_line_indexes = []; - var rv = lines - .slice(l0 - 1, l1 + 1) - .map(function injectLineNumber(line, index) { - var lno = index + l0; - var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); - var rv = lno_pfx + ": " + line; - var errpfx = new Array(lineno_display_width + 1).join("^"); - if (lno === loc.first_line) { - var offset = loc.first_column + 2; - var len = Math.max( - 2, - (lno === loc.last_line ? loc.last_column : line.length) - - loc.first_column + - 1 - ); - var lead = new Array(offset).join("."); - var mark = new Array(len).join("^"); - rv += "\n" + errpfx + lead + mark; // + offset + '/D' + len + '/' + lno + '/' + loc.last_line + '/' + loc.last_column + '/' + line.length + '/' + loc.first_column; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join("."); - var mark = new Array(len).join("^"); - rv += "\n" + errpfx + lead + mark; // + offset + '/E' + len; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); - var lead = new Array(offset).join("."); - var mark = new Array(len).join("^"); - rv += "\n" + errpfx + lead + mark; // + offset + '/F' + len; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } - rv = rv.replace(/\t/g, " "); - return rv; - }); - // now make sure we don't print an overly large amount of error area: limit it - // to the top and bottom line count: - if ( - nonempty_line_indexes.length > - 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - ) { - var clip_start = - nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; - var clip_end = - nonempty_line_indexes[ - nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - ] - 1; - console.log("clip off: ", { - start: clip_start, - end: clip_end, - len: clip_end - clip_start + 1, - arr: nonempty_line_indexes, - rv - }); - var intermediate_line = - new Array(lineno_display_width + 1).join(" ") + " (...continued...)"; - intermediate_line += - "\n" + - new Array(lineno_display_width + 1).join("-") + - " (---------------)"; - rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); - } - return rv.join("\n"); - } - lexer.warn = function l_warn() { if ( this.yy && diff --git a/lex.l b/lex.l index 94b6ed2..f16e920 100644 --- a/lex.l +++ b/lex.l @@ -128,7 +128,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] to help jison grok more or less complex action code chunks. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'BRACKETS_SURPLUS'; } else { yy.depth--; @@ -164,7 +164,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] to help jison grok more or less complex action code chunks. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); yytext = ''; return 'BRACKETS_MISSING'; } @@ -294,7 +294,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); yytext = [ this.matches[1], // {NAME} this.matches[2].trim() // optional value/parameters @@ -347,38 +347,38 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] unterminated string constant in lexer rule action block. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'error'; \' yyerror(rmCommonWS` unterminated string constant in lexer rule action block. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'error'; \` yyerror(rmCommonWS` unterminated string constant in lexer rule action block. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'error'; \" yyerror(rmCommonWS` unterminated string constant in %options entry. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'error'; \' yyerror(rmCommonWS` unterminated string constant in %options entry. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'error'; \` yyerror(rmCommonWS` unterminated string constant in %options entry. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'error'; <*>\" var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); @@ -387,7 +387,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] ${rules}. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'error'; <*>\' var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); yyerror(rmCommonWS` @@ -395,7 +395,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] ${rules}. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'error'; <*>\` var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); yyerror(rmCommonWS` @@ -403,7 +403,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] ${rules}. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); return 'error'; @@ -422,7 +422,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] regex expression here in jison-lex ${rules}. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); %} <*>. %{ @@ -431,7 +431,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(this, yylloc)); %} <*><> return 'EOF'; @@ -529,50 +529,6 @@ function rmCommonWS(strings, ...values) { return sv; } -// pretty-print the erroneous section of the input, with line numbers and everything... -function prettyPrintRange(lexer, loc, context_loc, context_loc2) { - var error_size = loc.last_line - loc.first_line; - const CONTEXT = 3; - const CONTEXT_TAIL = 1; - var input = lexer.matched + lexer._input; - var lines = input.split('\n'); - var show_context = (error_size < 5 || context_loc); - var l0 = Math.max(1, (!show_context ? loc.first_line : context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); - var l1 = Math.max(1, (!show_context ? loc.last_line : context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); - var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); - var ws_prefix = new Array(lineno_display_width).join(' '); - var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { - var lno = index + l0; - var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); - var rv = lno_pfx + ': ' + line; - if (show_context) { - var errpfx = (new Array(lineno_display_width + 1)).join('^'); - if (lno === loc.first_line) { - var offset = loc.first_column + 2; - var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/A' + len; - } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/B' + len; - } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark + offset + '/C' + len; - } - } - rv = rv.replace(/\t/g, ' '); - return rv; - }); - return rv.join('\n'); -} - lexer.warn = function l_warn() { if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { diff --git a/lex.y b/lex.y index e7b2272..00f5a01 100644 --- a/lex.y +++ b/lex.y @@ -53,7 +53,7 @@ lex extra_module_code // <-- optional! Erroneous code: - ${prettyPrintRange(yylexer, @error)} + ${yylexer.prettyPrintRange(yylexer, @error)} Technical error report: ${$error.errStr} @@ -180,7 +180,7 @@ rules_collective block. Erroneous area: - ` + prettyPrintRange(yylexer, yylexer.mergeLocationInfo(##start_conditions, ##4), @start_conditions)); + ` + yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo(##start_conditions, ##4), @start_conditions)); } | start_conditions '{' error { @@ -191,7 +191,7 @@ rules_collective as a terminating curly brace '}' could not be found. Erroneous area: - ` + prettyPrintRange(yylexer, @error, @start_conditions)); + ` + yylexer.prettyPrintRange(yylexer, @error, @start_conditions)); } ; @@ -219,18 +219,18 @@ rule error: $error, text: yytext }); - yyerror("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error, @regex)); + yyerror("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + yylexer.prettyPrintRange(yylexer, @error, @regex)); } ; action : ACTION_START action_body BRACKET_MISSING { - yyerror("Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, @BRACKET_MISSING, @1)); + yyerror("Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + yylexer.prettyPrintRange(yylexer, @BRACKET_MISSING, @1)); } | ACTION_START action_body BRACKET_SURPLUS { - yyerror("Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + prettyPrintRange(yylexer, @BRACKET_SURPLUS, @1)); + yyerror("Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + yylexer.prettyPrintRange(yylexer, @BRACKET_SURPLUS, @1)); } | ACTION_START action_body ACTION_END { @@ -277,11 +277,11 @@ action_body " a line. " + "" + " It's use is not permitted at this position:" + - "" + prettyPrintRange(yylexer, @INCLUDE_PLACEMENT_ERROR, @action_body)); + "" + yylexer.prettyPrintRange(yylexer, @INCLUDE_PLACEMENT_ERROR, @action_body)); } | action_body error { - yyerror("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + prettyPrintRange(yylexer, @error, @action_body)); + yyerror("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + yylexer.prettyPrintRange(yylexer, @error, @action_body)); } | ε { $$ = ''; } @@ -292,7 +292,7 @@ start_conditions { $$ = $name_list; } | '<' name_list error { - yyerror("Seems you did not correctly terminate the start condition set <" + $name_list.join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + prettyPrintRange(yylexer, @error, @1)); + yyerror("Seems you did not correctly terminate the start condition set <" + $name_list.join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + yylexer.prettyPrintRange(yylexer, @error, @1)); } | '<' '*' '>' { $$ = ['*']; } @@ -409,11 +409,11 @@ regex_base { $$ = $SPECIAL_GROUP + $regex_list + ')'; } | '(' regex_list error { - yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + prettyPrintRange(yylexer, @error, @1)); + yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + yylexer.prettyPrintRange(yylexer, @error, @1)); } | SPECIAL_GROUP regex_list error { - yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + prettyPrintRange(yylexer, @error, @SPECIAL_GROUP)); + yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + yylexer.prettyPrintRange(yylexer, @error, @SPECIAL_GROUP)); } | regex_base '+' { $$ = $regex_base + '+'; } @@ -448,7 +448,7 @@ any_group_regex { $$ = $REGEX_SET_START + $regex_set + $REGEX_SET_END; } | REGEX_SET_START regex_set error { - yyerror("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + prettyPrintRange(yylexer, @error, @REGEX_SET_START)); + yyerror("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + yylexer.prettyPrintRange(yylexer, @error, @REGEX_SET_START)); } ; @@ -518,7 +518,7 @@ option internal error: option "${$option}" value assignment failure. Erroneous area: - ` + prettyPrintRange(yylexer, @error, @option)); + ` + yylexer.prettyPrintRange(yylexer, @error, @option)); } | error { @@ -527,7 +527,7 @@ option expected a valid option name (with optional value assignment). Erroneous area: - ` + prettyPrintRange(yylexer, @error)); + ` + yylexer.prettyPrintRange(yylexer, @error)); } ; @@ -552,7 +552,7 @@ include_macro_code %include MUST be followed by a valid file path. Erroneous path: - ` + prettyPrintRange(yylexer, @error, @INCLUDE)); + ` + yylexer.prettyPrintRange(yylexer, @error, @INCLUDE)); } ; @@ -568,7 +568,7 @@ module_code_chunk module code declaration error? Erroneous area: - ` + prettyPrintRange(yylexer, @error)); + ` + yylexer.prettyPrintRange(yylexer, @error)); } ; @@ -672,75 +672,6 @@ function rmCommonWS(strings, ...values) { return sv; } -// pretty-print the erroneous section of the input, with line numbers and everything... -function prettyPrintRange(lexer, loc, context_loc, context_loc2) { - var error_size = loc.last_line - loc.first_line; - const CONTEXT = 3; - const CONTEXT_TAIL = 1; - const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; - var input = lexer.matched + lexer._input; - var lines = input.split('\n'); - //var show_context = (error_size < 5 || context_loc); - var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); - var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); - var lineno_display_width = (1 + Math.log10(l1 | 1) | 0); - var ws_prefix = new Array(lineno_display_width).join(' '); - var nonempty_line_indexes = []; - var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { - var lno = index + l0; - var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); - var rv = lno_pfx + ': ' + line; - var errpfx = (new Array(lineno_display_width + 1)).join('^'); - if (lno === loc.first_line) { - var offset = loc.first_column + 2; - var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); - var lead = (new Array(offset)).join('.'); - var mark = (new Array(len)).join('^'); - rv += '\n' + errpfx + lead + mark; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } - rv = rv.replace(/\t/g, ' '); - return rv; - }); - // now make sure we don't print an overly large amount of error area: limit it - // to the top and bottom line count: - if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { - var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; - var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; - console.log("clip off: ", { - start: clip_start, - end: clip_end, - len: clip_end - clip_start + 1, - arr: nonempty_line_indexes, - rv - }); - var intermediate_line = (new Array(lineno_display_width + 1)).join(' ') + ' (...continued...)'; - intermediate_line += '\n' + (new Array(lineno_display_width + 1)).join('-') + ' (---------------)'; - rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); - } - return rv.join('\n'); -} - parser.warn = function p_warn() { console.warn.apply(console, arguments); From db3fd93e1762ee74fc1c50bd133c6a1ed22066e0 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 12 Sep 2017 03:08:19 +0200 Subject: [PATCH 366/417] jison having modules is still a bloody nuisance when you introduce features that originate in those. Pushing an intermediate release now to ensure the build process will fly on the next one. GRMBL. --- package-lock.json | 186 +++++++++++++++++++++++----------------------- 1 file changed, 92 insertions(+), 94 deletions(-) diff --git a/package-lock.json b/package-lock.json index e4b7cf5..f713fbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -564,36 +564,10 @@ "dev": true }, "base": { - "version": "0.11.1", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.1.tgz", - "integrity": "sha1-s2p/ERE4U6NCoVaR2Y4tzIpswnA=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true - }, - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true }, "brace-expansion": { "version": "1.1.8", @@ -620,9 +594,9 @@ "dev": true }, "cache-base": { - "version": "0.8.5", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-0.8.5.tgz", - "integrity": "sha1-YM6zUEAh7O7HAR/TOEt/TpVym/o=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", "dev": true }, "camelcase": { @@ -696,9 +670,9 @@ "dev": true }, "collection-visit": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-0.2.3.tgz", - "integrity": "sha1-L2JIPK7MlfCDuaRUo+6eYTmteVc=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", "dev": true }, "color-convert": { @@ -773,9 +747,9 @@ "dev": true }, "deep-eql": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.0.tgz", - "integrity": "sha512-9zef2MtjASSE1Pts2Nm6Yh5MTVdVh+s4Qt/e+jPV6qTBhqTc0WOEaWnLvLKGxky0gwZGmcY6TnUqyCD6fNs5Lg==", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true }, "define-property": { @@ -1012,23 +986,15 @@ "dev": true }, "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true - } - } + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true }, "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "dev": true }, "home-or-tmp": { @@ -1139,12 +1105,6 @@ "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", "dev": true }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, "is-finite": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", @@ -1349,9 +1309,9 @@ "dev": true }, "map-visit": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-0.1.5.tgz", - "integrity": "sha1-2+Q5J85VJbgN/BVzpE1oxR8mgWs=", + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", "dev": true }, "mem": { @@ -1423,10 +1383,18 @@ "dev": true }, "nanomatch": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.0.tgz", - "integrity": "sha1-dv2z1K52F+N3GeekBHuECFfAyxw=", - "dev": true + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.1.tgz", + "integrity": "sha512-yZFZy8D7hJnki1+6+Ky7nJThbPUW6M6aQW4CVk+pgPcU69VdCwLWVIP7Tb5E+xAWROp+HOdjNkp5rnAfCM0XbA==", + "dev": true, + "dependencies": { + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } }, "node-dir": { "version": "0.1.17", @@ -1519,18 +1487,10 @@ } }, "object-visit": { - "version": "0.3.4", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-0.3.4.tgz", - "integrity": "sha1-rhXPhvCy/dVRdxY2RIRSxUw9qCk=", - "dev": true, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true - } - } + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true }, "object.pick": { "version": "1.3.0", @@ -1768,10 +1728,18 @@ "dev": true }, "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "dependencies": { + "split-string": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.0.2.tgz", + "integrity": "sha512-d6myUSfwmBz1izkY4r7r7I0PL41rh21qUDYK1OgclmGHeoqQoujduGxMbzw6BlF3HKmJR4sMpbWVo7/Xzg4YBQ==", + "dev": true + } + } }, "shebang-command": { "version": "1.2.0", @@ -1855,9 +1823,9 @@ "dev": true }, "source-map-support": { - "version": "0.4.17", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.17.tgz", - "integrity": "sha512-30c1Ch8FSjV0FwC253iftbbj0dU/OXoSg1LAEGZJUlGgjTNj6cu+DVqJWWIZJY5RXLWV4eFtR+4ouo0VIOYOTg==", + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", "dev": true }, "source-map-url": { @@ -2043,16 +2011,46 @@ "dev": true }, "union-value": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-0.2.4.tgz", - "integrity": "sha1-c3UVJ4ZnkFfns3qmdug0aPwCdPA=", - "dev": true + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "dependencies": { + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true + } + } }, "unset-value": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-0.1.2.tgz", - "integrity": "sha1-UGgQuGfyfCpabpsEgzYx9t5Y0xA=", - "dev": true + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + } + } }, "urix": { "version": "0.1.0", From b36edeac05b1dcb21f04ee02bd96b86c46280376 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 12 Sep 2017 03:10:25 +0200 Subject: [PATCH 367/417] bumped build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index f713fbb..8e3d855 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-190", + "version": "0.6.0-191", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { diff --git a/package.json b/package.json index fd6e273..ad4251c 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-190", + "version": "0.6.0-191", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From daa027e90772736cfb8f2478c67c7cf4b57c8e5f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 12 Sep 2017 03:27:41 +0200 Subject: [PATCH 368/417] updated NPM packages --- package-lock.json | 36 +++++++++++++++++++++++++++--------- package.json | 4 ++-- 2 files changed, 29 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8e3d855..c3dc569 100644 --- a/package-lock.json +++ b/package-lock.json @@ -20,10 +20,22 @@ "integrity": "sha512-TDAMTzjDUosbRbkz/l+wzARC3XYPU6bzMJA2WBmd2fIqKUHixg42fp04fX06aYyyDzM0noxSugl6Z0+l+N29mw==", "dev": true }, + "@gerhobbelt/linewrap": { + "version": "0.2.2-2", + "resolved": "https://registry.npmjs.org/@gerhobbelt/linewrap/-/linewrap-0.2.2-2.tgz", + "integrity": "sha512-5maUNZqQrbjdCFQ2Fy6DktRHujp5m/+HyPHeZCG58NgT01U4TfQ7QrEmaF4jgXoBb/WYfzHKVpqBvE7dj18bEQ==", + "dev": true + }, "@gerhobbelt/nomnom": { - "version": "1.8.4-16", - "resolved": "https://registry.npmjs.org/@gerhobbelt/nomnom/-/nomnom-1.8.4-16.tgz", - "integrity": "sha512-1qh0YojYP3r/5aOTJs/r6tCfi55zxLdeOWrMPrC1Ra73/yewbEkowchJppvxzzFPLgpkNX5GoJgKsfPv980R9g==", + "version": "1.8.4-18", + "resolved": "https://registry.npmjs.org/@gerhobbelt/nomnom/-/nomnom-1.8.4-18.tgz", + "integrity": "sha512-wt5cZb/CUBvCDRe1ulzg4hYtnIP5VJPKh6EGpBDtdx+UXpnIph5HsRQJ8PNy7kx2VBk3o3vU/eprNJiBxbXHyg==", + "dev": true + }, + "@gerhobbelt/prettier-miscellaneous": { + "version": "1.6.2-5", + "resolved": "https://registry.npmjs.org/@gerhobbelt/prettier-miscellaneous/-/prettier-miscellaneous-1.6.2-5.tgz", + "integrity": "sha512-MoWZbrLtY9Pu1O6lRB6DNYHVMrESW4ELQx652lgYssnWPq7I7lRwl19JSSfOlSvo/8RMJKhzWyujcjYPQJCP9Q==", "dev": true }, "@gerhobbelt/recast": { @@ -997,6 +1009,12 @@ "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", "dev": true }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, "home-or-tmp": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", @@ -1168,9 +1186,9 @@ "dev": true }, "jison-gho": { - "version": "0.6.0-188", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-188.tgz", - "integrity": "sha512-l8L+Whne/tR/mzyb0893MV2ZOvtC/60rHZRIPJTmNd8N7GOouWxM4qhkTWyDQ6Z6zfD0VdhHrcVbPxEfHRLATA==", + "version": "0.6.0-190", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-190.tgz", + "integrity": "sha512-ik6K06bDI9My3k4HSZ6MGXbTCZjYHaaFfWYHnt97adjU38WLziak6ywhOu41StgEsclbYyRAZMG4Yx2B5l0CTg==", "dev": true }, "js-tokens": { @@ -1357,9 +1375,9 @@ "dev": true }, "mocha": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.0.tgz", - "integrity": "sha512-pIU2PJjrPYvYRqVpjXzj76qltO9uBYI7woYAMoxbSefsa+vqAfptjoeevd6bUgwD0mPIO+hv9f7ltvsNreL2PA==", + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", + "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", "dev": true, "dependencies": { "has-flag": { diff --git a/package.json b/package.json index ad4251c..4b3528a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "chai": "4.1.2", - "jison-gho": "0.6.0-188", - "mocha": "3.5.0" + "jison-gho": "0.6.0-190", + "mocha": "3.5.3" } } From c1b878e9736f2c0d749c8056bd212f2a9125dab7 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 12 Sep 2017 03:37:58 +0200 Subject: [PATCH 369/417] bumped build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index c3dc569..405a238 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-191", + "version": "0.6.0-192", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { diff --git a/package.json b/package.json index 4b3528a..6e4ec4a 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-191", + "version": "0.6.0-192", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From f8bb2d4421e7ec125b217b1136b34eb2c6624d89 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 12 Sep 2017 03:47:33 +0200 Subject: [PATCH 370/417] updated NPM packages --- lex-parser.js | 4 ++-- package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 85ba26a..d3dee4f 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-190 */ +/* parser generated by jison 0.6.0-191 */ /* * Returns a Parser object of the following structure: @@ -4642,7 +4642,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-190 */ +/* lexer generated by jison-lex 0.6.0-191 */ /* * Returns a Lexer object of the following structure: diff --git a/package-lock.json b/package-lock.json index 405a238..097cf72 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1186,9 +1186,9 @@ "dev": true }, "jison-gho": { - "version": "0.6.0-190", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-190.tgz", - "integrity": "sha512-ik6K06bDI9My3k4HSZ6MGXbTCZjYHaaFfWYHnt97adjU38WLziak6ywhOu41StgEsclbYyRAZMG4Yx2B5l0CTg==", + "version": "0.6.0-191", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-191.tgz", + "integrity": "sha512-B9gxHUAKWW9/7zE0FriAeK2ofOAHRnX0K8+l+oVHtpJXEiUGY0ZMS3AITuFJC8W1nEbpa1ZKp39VELMjRF/Bvg==", "dev": true }, "js-tokens": { diff --git a/package.json b/package.json index 6e4ec4a..a3e2a5d 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "chai": "4.1.2", - "jison-gho": "0.6.0-190", + "jison-gho": "0.6.0-191", "mocha": "3.5.3" } } From 816693e8c199df9742e98b0710142db23bcc7175 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 17 Sep 2017 18:43:56 +0200 Subject: [PATCH 371/417] rebuilt library files --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d3dee4f..ac8bb2f 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-191 */ +/* parser generated by jison 0.6.0-192 */ /* * Returns a Parser object of the following structure: @@ -4642,7 +4642,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-191 */ +/* lexer generated by jison-lex 0.6.0-192 */ /* * Returns a Lexer object of the following structure: From 7fa3cbbecf8744ad419d774340b6eaa856a1af20 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 24 Sep 2017 21:27:11 +0200 Subject: [PATCH 372/417] rebuilt library files --- lex-parser.js | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index ac8bb2f..8b2c296 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -7509,12 +7509,11 @@ return new Parser(); - if (typeof require !== 'undefined' && typeof exports !== 'undefined') { - exports.parser = lexParser; - exports.Parser = lexParser.Parser; - exports.parse = function () { - return lexParser.parse.apply(lexParser, arguments); - }; - - } - \ No newline at end of file +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { + exports.parser = lexParser; + exports.Parser = lexParser.Parser; + exports.parse = function () { + return lexParser.parse.apply(lexParser, arguments); + }; + +} From 4c40e9f050bacc7f02f2c7480ab6b96e6ead83fc Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 24 Sep 2017 21:55:45 +0200 Subject: [PATCH 373/417] updated NPM packages --- lex-parser.js | 21 +++++++++++---------- package-lock.json | 24 +++++++++++++++--------- 2 files changed, 26 insertions(+), 19 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8b2c296..d3dee4f 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-192 */ +/* parser generated by jison 0.6.0-191 */ /* * Returns a Parser object of the following structure: @@ -4642,7 +4642,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-192 */ +/* lexer generated by jison-lex 0.6.0-191 */ /* * Returns a Lexer object of the following structure: @@ -7509,11 +7509,12 @@ return new Parser(); -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { - exports.parser = lexParser; - exports.Parser = lexParser.Parser; - exports.parse = function () { - return lexParser.parse.apply(lexParser, arguments); - }; - -} + if (typeof require !== 'undefined' && typeof exports !== 'undefined') { + exports.parser = lexParser; + exports.Parser = lexParser.Parser; + exports.parse = function () { + return lexParser.parse.apply(lexParser, arguments); + }; + + } + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 097cf72..bc0ee99 100644 --- a/package-lock.json +++ b/package-lock.json @@ -747,9 +747,9 @@ "dev": true }, "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", "dev": true }, "decamelize": { @@ -1380,6 +1380,12 @@ "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", "dev": true, "dependencies": { + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true + }, "has-flag": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", @@ -1401,9 +1407,9 @@ "dev": true }, "nanomatch": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.1.tgz", - "integrity": "sha512-yZFZy8D7hJnki1+6+Ky7nJThbPUW6M6aQW4CVk+pgPcU69VdCwLWVIP7Tb5E+xAWROp+HOdjNkp5rnAfCM0XbA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.3.tgz", + "integrity": "sha512-HqDMQWJlwpXbfKDpAnkc6AJQh5PFqVlrjYbruDjYVAS+05TQUb1qhIde4G9jMzHbs/u6bgEok1jMAV4yJzoh+w==", "dev": true, "dependencies": { "kind-of": { @@ -1636,9 +1642,9 @@ "dev": true }, "regenerate": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.2.tgz", - "integrity": "sha1-0ZQcZ7rUN+G+dkM63Vs4X5WxkmA=", + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz", + "integrity": "sha512-jVpo1GadrDAK59t/0jRx5VxYWQEDkkEKi6+HjE3joFVLfDOh9Xrdh0dF1eSq+BI/SwvTQ44gSscJ8N5zYL61sg==", "dev": true }, "regenerator-runtime": { From 857527b16ed30957688d78eff417b4cf13b58418 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 24 Sep 2017 22:06:18 +0200 Subject: [PATCH 374/417] bumped build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index bc0ee99..83abd61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-192", + "version": "0.6.0-193", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { diff --git a/package.json b/package.json index a3e2a5d..1cfa970 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-192", + "version": "0.6.0-193", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 4baa018333886b84eb50a1511f2af5fc9a9ccc3b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 24 Sep 2017 22:16:05 +0200 Subject: [PATCH 375/417] updated NPM packages --- lex-parser.js | 21 ++++++++++----------- package-lock.json | 12 ++++++------ package.json | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index d3dee4f..8b2c296 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-191 */ +/* parser generated by jison 0.6.0-192 */ /* * Returns a Parser object of the following structure: @@ -4642,7 +4642,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-191 */ +/* lexer generated by jison-lex 0.6.0-192 */ /* * Returns a Lexer object of the following structure: @@ -7509,12 +7509,11 @@ return new Parser(); - if (typeof require !== 'undefined' && typeof exports !== 'undefined') { - exports.parser = lexParser; - exports.Parser = lexParser.Parser; - exports.parse = function () { - return lexParser.parse.apply(lexParser, arguments); - }; - - } - \ No newline at end of file +if (typeof require !== 'undefined' && typeof exports !== 'undefined') { + exports.parser = lexParser; + exports.Parser = lexParser.Parser; + exports.parse = function () { + return lexParser.parse.apply(lexParser, arguments); + }; + +} diff --git a/package-lock.json b/package-lock.json index 83abd61..b112507 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,9 +27,9 @@ "dev": true }, "@gerhobbelt/nomnom": { - "version": "1.8.4-18", - "resolved": "https://registry.npmjs.org/@gerhobbelt/nomnom/-/nomnom-1.8.4-18.tgz", - "integrity": "sha512-wt5cZb/CUBvCDRe1ulzg4hYtnIP5VJPKh6EGpBDtdx+UXpnIph5HsRQJ8PNy7kx2VBk3o3vU/eprNJiBxbXHyg==", + "version": "1.8.4-21", + "resolved": "https://registry.npmjs.org/@gerhobbelt/nomnom/-/nomnom-1.8.4-21.tgz", + "integrity": "sha512-45Cy1g0RG2ZB99VFXmRmmcDlnQOAm2Z5FOKbfnJjRKBpCgxZYwDPAn/X6ewbjYk5j3ww1abMJZ26pSEFqcgIQg==", "dev": true }, "@gerhobbelt/prettier-miscellaneous": { @@ -1186,9 +1186,9 @@ "dev": true }, "jison-gho": { - "version": "0.6.0-191", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-191.tgz", - "integrity": "sha512-B9gxHUAKWW9/7zE0FriAeK2ofOAHRnX0K8+l+oVHtpJXEiUGY0ZMS3AITuFJC8W1nEbpa1ZKp39VELMjRF/Bvg==", + "version": "0.6.0-192", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-192.tgz", + "integrity": "sha512-U8iCGle3bGDHvTIKDt23XnViLBk48o/c5L2R/bBTymjkaQpCYykT6XYP06eeqUyFcvsDV50FV0W5NnYk24GzSA==", "dev": true }, "js-tokens": { diff --git a/package.json b/package.json index 1cfa970..ba4540a 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "chai": "4.1.2", - "jison-gho": "0.6.0-191", + "jison-gho": "0.6.0-192", "mocha": "3.5.3" } } From c6a3ca64524243b51bdfca7cc6be30b8413e09c9 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 24 Sep 2017 23:49:35 +0200 Subject: [PATCH 376/417] rebuilt library files --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8b2c296..c298814 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-192 */ +/* parser generated by jison 0.6.0-193 */ /* * Returns a Parser object of the following structure: @@ -4642,7 +4642,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-192 */ +/* lexer generated by jison-lex 0.6.0-193 */ /* * Returns a Lexer object of the following structure: From 05d4451afbb1561ea44d3b3dd53580384c9d400b Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 24 Sep 2017 23:58:32 +0200 Subject: [PATCH 377/417] updated NPM packages --- lex-parser.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index c298814..8b2c296 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-193 */ +/* parser generated by jison 0.6.0-192 */ /* * Returns a Parser object of the following structure: @@ -4642,7 +4642,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-193 */ +/* lexer generated by jison-lex 0.6.0-192 */ /* * Returns a Lexer object of the following structure: From 5bce2fef1ff3bedb48e42af3dcb9477153cd4841 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 25 Sep 2017 00:08:36 +0200 Subject: [PATCH 378/417] bumped build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index b112507..bc2a876 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-193", + "version": "0.6.0-194", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { diff --git a/package.json b/package.json index ba4540a..1bf46fc 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-193", + "version": "0.6.0-194", "description": "A parser for lexical grammars used by jison", "main": "lex-parser.js", "scripts": { From 8808b77fbded598c7738e1b71d7870ad907ce930 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 25 Sep 2017 00:17:51 +0200 Subject: [PATCH 379/417] updated NPM packages --- lex-parser.js | 4 ++-- package-lock.json | 6 +++--- package.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8b2c296..c298814 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-192 */ +/* parser generated by jison 0.6.0-193 */ /* * Returns a Parser object of the following structure: @@ -4642,7 +4642,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-192 */ +/* lexer generated by jison-lex 0.6.0-193 */ /* * Returns a Lexer object of the following structure: diff --git a/package-lock.json b/package-lock.json index bc2a876..69b57ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1186,9 +1186,9 @@ "dev": true }, "jison-gho": { - "version": "0.6.0-192", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-192.tgz", - "integrity": "sha512-U8iCGle3bGDHvTIKDt23XnViLBk48o/c5L2R/bBTymjkaQpCYykT6XYP06eeqUyFcvsDV50FV0W5NnYk24GzSA==", + "version": "0.6.0-193", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-193.tgz", + "integrity": "sha512-7aud9KQ8Ka2usOtisRk6nvoFoIzfhMBsztVoD5pEN4faMgJzNCuFNCUVJ098OPWE+SwtveONJf6x1Qe2aKrmmg==", "dev": true }, "js-tokens": { diff --git a/package.json b/package.json index 1bf46fc..3b8a231 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ }, "devDependencies": { "chai": "4.1.2", - "jison-gho": "0.6.0-192", + "jison-gho": "0.6.0-193", "mocha": "3.5.3" } } From f376ed473bbccadb3069f268e56df5e62dd7d3f1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 29 Sep 2017 18:02:49 +0200 Subject: [PATCH 380/417] corrected the copyright in the license files (now correctly attributing Zachary Carter, just like the package.json file does) --- LICENSE.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LICENSE.md b/LICENSE.md index 3d59b33..e8fcb80 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2014 Matt Eckert +Copyright (c) 2009-2017 Zachary Carter Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in From 40b9e1d2c5cade481c8f77e03eb6190cbf593f4f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 29 Sep 2017 20:10:37 +0200 Subject: [PATCH 381/417] code refactoring: migrate to using the common library json-helpers-lib --- lex-parser.js | 746 ++++++++++++++++++++++++-------------------------- lex.l | 60 +--- lex.y | 61 +---- 3 files changed, 368 insertions(+), 499 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index c298814..ee9e277 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,5 +1,5 @@ -/* parser generated by jison 0.6.0-193 */ +/* parser generated by jison 0.6.0-194 */ /* * Returns a Parser object of the following structure: @@ -769,28 +769,21 @@ quoteName: function parser_quoteName(id_str) { return '"' + id_str + '"'; }, -// Return a more-or-less human-readable description of the given symbol, when available, -// or the symbol itself, serving as its own 'description' for lack of something better to serve up. +// Return the name of the given symbol (terminal or non-terminal) as a string, when available. // // Return NULL when the symbol is unknown to the parser. -describeSymbol: function parser_describeSymbol(symbol) { - if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { - return this.terminal_descriptions_[symbol]; - } - else if (symbol === this.EOF) { - return 'end of input'; - } - else if (this.terminals_[symbol]) { - return this.quoteName(this.terminals_[symbol]); +getSymbolName: function parser_getSymbolName(symbol) { + if (this.terminals_[symbol]) { + return this.terminals_[symbol]; } + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. // // An example of this may be where a rule's action code contains a call like this: // - // parser.describeSymbol(#$) + // parser.getSymbolName(#$) // - // to obtain a human-readable description or name of the current grammar rule. This comes handy in - // error handling action code blocks, for example. + // to obtain a human-readable name of the current grammar rule. var s = this.symbols_; for (var key in s) { if (s[key] === symbol) { @@ -800,6 +793,24 @@ describeSymbol: function parser_describeSymbol(symbol) { return null; }, +// Return a more-or-less human-readable description of the given symbol, when available, +// or the symbol itself, serving as its own 'description' for lack of something better to serve up. +// +// Return NULL when the symbol is unknown to the parser. +describeSymbol: function parser_describeSymbol(symbol) { + if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { + return this.terminal_descriptions_[symbol]; + } + else if (symbol === this.EOF) { + return 'end of input'; + } + var id = this.getSymbolName(symbol); + if (id) { + return this.quoteName(id); + } + return null; +}, + // Produce a (more or less) human-readable list of expected tokens at the point of failure. // // The produced list may contain token or token set descriptions instead of the tokens @@ -3733,6 +3744,14 @@ parse: function parse(input) { return rv; }; + function getNonTerminalFromCode(symbol) { + var tokenName = self.getSymbolName(symbol); + if (!tokenName) { + tokenName = symbol; + } + return tokenName; + } + function lex() { var token = lexer.lex(); @@ -3740,6 +3759,20 @@ parse: function parse(input) { if (typeof token !== 'number') { token = self.symbols_[token] || token; } + + if (typeof Jison !== 'undefined' && Jison.lexDebugger) { + var tokenName = self.getSymbolName(token || EOF); + if (!tokenName) { + tokenName = token; + } + + Jison.lexDebugger.push({ + tokenName: tokenName, + tokenText: lexer.match, + tokenValue: lexer.yytext + }); + } + return token || EOF; } @@ -4367,6 +4400,21 @@ parse: function parse(input) { vstack[sp] = lexer.yytext; lstack[sp] = copy_yylloc(lexer.yylloc); sstack[sp] = newState; // push state + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + var tokenName = self.getSymbolName(symbol || EOF); + if (!tokenName) { + tokenName = symbol; + } + + Jison.parserDebugger.push({ + action: 'shift', + text: lexer.yytext, + terminal: tokenName, + terminal_id: symbol + }); + } + ++sp; symbol = 0; assert(preErrorSymbol === 0); @@ -4444,6 +4492,28 @@ parse: function parse(input) { r = this.performAction.call(yyval, yytext, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack); + if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { + var prereduceValue = vstack.slice(sp - yyrulelen, sp); + var debuggableProductions = []; + for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { + var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); + debuggableProductions.push(debuggableProduction); + } + // find the current nonterminal name (- nolan) + var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; + var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); + + Jison.parserDebugger.push({ + action: 'reduce', + nonterminal: currentNonterminal, + nonterminal_id: currentNonterminalCode, + prereduce: prereduceValue, + result: r, + productions: debuggableProductions, + text: yyval.$ + }); + } + if (typeof r !== 'undefined') { retval = r; break; @@ -4500,6 +4570,15 @@ parse: function parse(input) { if (typeof vstack[sp] !== 'undefined') { retval = vstack[sp]; } + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'accept', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + break; } @@ -4522,6 +4601,14 @@ parse: function parse(input) { } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'return', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } } return retval; @@ -4531,7 +4618,9 @@ yyError: 1 parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -var XRegExp = require('@gerhobbelt/xregexp'); // for helping out the `%options xregexp` in the lexer +var XRegExp = require('@gerhobbelt/xregexp'); +var helpers = require('../../modules/helpers-lib'); +var rmCommonWS = helpers.rmCommonWS; function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); @@ -4565,63 +4654,6 @@ function parseValue(v) { return v; } -// tagged template string helper which removes the indentation common to all -// non-empty lines: that indentation was added as part of the source code -// formatting of this lexer spec file and must be removed to produce what -// we were aiming for. -// -// Each template string starts with an optional empty line, which should be -// removed entirely, followed by a first line of error reporting content text, -// which should not be indented at all, i.e. the indentation of the first -// non-empty line should be treated as the 'common' indentation and thus -// should also be removed from all subsequent lines in the same template string. -// -// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals -function rmCommonWS(strings, ...values) { - // as `strings[]` is an array of strings, each potentially consisting - // of multiple lines, followed by one(1) value, we have to split each - // individual string into lines to keep that bit of information intact. - var src = strings.map(function splitIntoLines(s) { - return s.split('\n'); - }); - // fetch the first line of content which is expected to exhibit the common indent: - // that would be the SECOND line of input, always, as the FIRST line won't - // have any indentation at all! - var s0 = ''; - for (var i = 0, len = src.length; i < len; i++) { - if (src[i].length > 1) { - s0 = src[i][1]; - break; - } - } - var indent = s0.replace(/^(\s+)[^\s]*.*$/, '$1'); - // we assume clean code style, hence no random mix of tabs and spaces, so every - // line MUST have the same indent style as all others, so `length` of indent - // should suffice, but the way we coded this is stricter checking when we apply - // a find-and-replace regex instead: - var indent_re = new RegExp('^' + indent); - - // process template string partials now: - for (var i = 0, len = src.length; i < len; i++) { - // start-of-lines always end up at index 1 and above (for each template string partial): - for (var j = 1, linecnt = src[i].length; j < linecnt; j++) { - src[i][j] = src[i][j].replace(indent_re, ''); - } - } - - // now merge everything to construct the template result: - var rv = []; - for (var i = 0, len = src.length, klen = values.length; i < len; i++) { - rv.push(src[i].join('\n')); - // all but the last partial are followed by a template value: - if (i < klen) { - rv.push(values[i]); - } - } - var sv = rv.join(''); - return sv; -} - parser.warn = function p_warn() { console.warn.apply(console, arguments); @@ -4642,223 +4674,223 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-193 */ +/* lexer generated by jison-lex 0.6.0-194*/ /* - * Returns a Lexer object of the following structure: - * - * Lexer: { - * yy: {} The so-called "shared state" or rather the *source* of it; - * the real "shared state" `yy` passed around to - * the rule actions, etc. is a direct reference! - * - * This "shared context" object was passed to the lexer by way of - * the `lexer.setInput(str, yy)` API before you may use it. - * - * This "shared context" object is passed to the lexer action code in `performAction()` - * so userland code in the lexer actions may communicate with the outside world - * and/or other lexer rules' actions in more or less complex ways. - * - * } - * - * Lexer.prototype: { - * EOF: 1, - * ERROR: 2, - * - * yy: The overall "shared context" object reference. - * - * JisonLexerError: function(msg, hash), - * - * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), - * - * The function parameters and `this` have the following value/meaning: - * - `this` : reference to the `lexer` instance. - * `yy_` is an alias for `this` lexer instance reference used internally. - * - * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer - * by way of the `lexer.setInput(str, yy)` API before. - * - * Note: - * The extra arguments you specified in the `%parse-param` statement in your - * **parser** grammar definition file are passed to the lexer via this object - * reference as member variables. - * - * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. - * - * - `YY_START`: the current lexer "start condition" state. - * - * parseError: function(str, hash, ExceptionClass), - * - * constructLexErrorInfo: function(error_message, is_recoverable), - * Helper function. - * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. - * See it's use in this lexer kernel in many places; example usage: - * - * var infoObj = lexer.constructParseErrorInfo('fail!', true); - * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); - * - * options: { ... lexer %options ... }, - * - * lex: function(), - * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. - * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: - * these extra `args...` are added verbatim to the `yy` object reference as member variables. - * - * WARNING: - * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with - * any attributes already added to `yy` by the **parser** or the jison run-time; - * when such a collision is detected an exception is thrown to prevent the generated run-time - * from silently accepting this confusing and potentially hazardous situation! - * - * cleanupAfterLex: function(do_not_nuke_errorinfos), - * Helper function. - * - * This helper API is invoked when the **parse process** has completed: it is the responsibility - * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. - * - * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. - * - * setInput: function(input, [yy]), - * - * - * input: function(), - * - * - * unput: function(str), - * - * - * more: function(), - * - * - * reject: function(), - * - * - * less: function(n), - * - * - * pastInput: function(n), - * - * - * upcomingInput: function(n), - * - * - * showPosition: function(), - * - * - * test_match: function(regex_match_array, rule_index), - * - * - * next: function(), - * - * - * begin: function(condition), - * - * - * pushState: function(condition), - * - * - * popState: function(), - * - * - * topState: function(), - * - * - * _currentRules: function(), - * - * - * stateStackSize: function(), - * - * - * performAction: function(yy, yy_, yyrulenumber, YY_START), - * - * - * rules: [...], - * - * - * conditions: {associative list: name ==> set}, - * } - * - * - * token location info (`yylloc`): { - * first_line: n, - * last_line: n, - * first_column: n, - * last_column: n, - * range: [start_number, end_number] - * (where the numbers are indexes into the input string, zero-based) - * } - * - * --- - * - * The `parseError` function receives a 'hash' object with these members for lexer errors: - * - * { - * text: (matched text) - * token: (the produced terminal token, if any) - * token_id: (the produced terminal token numeric ID, if any) - * line: (yylineno) - * loc: (yylloc) - * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule - * available for this particular error) - * yy: (object: the current parser internal "shared state" `yy` - * as is also available in the rule actions; this can be used, - * for instance, for advanced error analysis and reporting) - * lexer: (reference to the current lexer instance used by the parser) - * } - * - * while `this` will reference the current lexer instance. - * - * When `parseError` is invoked by the lexer, the default implementation will - * attempt to invoke `yy.parser.parseError()`; when this callback is not provided - * it will try to invoke `yy.parseError()` instead. When that callback is also not - * provided, a `JisonLexerError` exception will be thrown containing the error - * message and `hash`, as constructed by the `constructLexErrorInfo()` API. - * - * Note that the lexer's `JisonLexerError` error class is passed via the - * `ExceptionClass` argument, which is invoked to construct the exception - * instance to be thrown, so technically `parseError` will throw the object - * produced by the `new ExceptionClass(str, hash)` JavaScript expression. - * - * --- - * - * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. - * These options are available: - * - * (Options are permanent.) - * - * yy: { - * parseError: function(str, hash, ExceptionClass) - * optional: overrides the default `parseError` function. - * } - * - * lexer.options: { - * pre_lex: function() - * optional: is invoked before the lexer is invoked to produce another token. - * `this` refers to the Lexer object. - * post_lex: function(token) { return token; } - * optional: is invoked when the lexer has produced a token `token`; - * this function can override the returned token value by returning another. - * When it does not return any (truthy) value, the lexer will return - * the original `token`. - * `this` refers to the Lexer object. - * - * WARNING: the next set of options are not meant to be changed. They echo the abilities of - * the lexer as per when it was compiled! - * - * ranges: boolean - * optional: `true` ==> token location info will include a .range[] member. - * flex: boolean - * optional: `true` ==> flex-like lexing behaviour where the rules are tested - * exhaustively to find the longest match. - * backtrack_lexer: boolean - * optional: `true` ==> lexer regexes are tested in order and for invoked; - * the lexer terminates the scan when a token is returned by the action code. - * xregexp: boolean - * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the - * `XRegExp` library. When this %option has not been specified at compile time, all lexer - * rule regexes have been written as standard JavaScript RegExp expressions. - * } - */ + * Returns a Lexer object of the following structure: + * + * Lexer: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a direct reference! + * + * This "shared context" object was passed to the lexer by way of + * the `lexer.setInput(str, yy)` API before you may use it. + * + * This "shared context" object is passed to the lexer action code in `performAction()` + * so userland code in the lexer actions may communicate with the outside world + * and/or other lexer rules' actions in more or less complex ways. + * + * } + * + * Lexer.prototype: { + * EOF: 1, + * ERROR: 2, + * + * yy: The overall "shared context" object reference. + * + * JisonLexerError: function(msg, hash), + * + * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `lexer` instance. + * `yy_` is an alias for `this` lexer instance reference used internally. + * + * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer + * by way of the `lexer.setInput(str, yy)` API before. + * + * Note: + * The extra arguments you specified in the `%parse-param` statement in your + * **parser** grammar definition file are passed to the lexer via this object + * reference as member variables. + * + * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. + * + * - `YY_START`: the current lexer "start condition" state. + * + * parseError: function(str, hash, ExceptionClass), + * + * constructLexErrorInfo: function(error_message, is_recoverable), + * Helper function. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this lexer kernel in many places; example usage: + * + * var infoObj = lexer.constructParseErrorInfo('fail!', true); + * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); + * + * options: { ... lexer %options ... }, + * + * lex: function(), + * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. + * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the **parser** or the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * cleanupAfterLex: function(do_not_nuke_errorinfos), + * Helper function. + * + * This helper API is invoked when the **parse process** has completed: it is the responsibility + * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. + * + * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. + * + * setInput: function(input, [yy]), + * + * + * input: function(), + * + * + * unput: function(str), + * + * + * more: function(), + * + * + * reject: function(), + * + * + * less: function(n), + * + * + * pastInput: function(n), + * + * + * upcomingInput: function(n), + * + * + * showPosition: function(), + * + * + * test_match: function(regex_match_array, rule_index), + * + * + * next: function(), + * + * + * begin: function(condition), + * + * + * pushState: function(condition), + * + * + * popState: function(), + * + * + * topState: function(), + * + * + * _currentRules: function(), + * + * + * stateStackSize: function(), + * + * + * performAction: function(yy, yy_, yyrulenumber, YY_START), + * + * + * rules: [...], + * + * + * conditions: {associative list: name ==> set}, + * } + * + * + * token location info (`yylloc`): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * } + * + * while `this` will reference the current lexer instance. + * + * When `parseError` is invoked by the lexer, the default implementation will + * attempt to invoke `yy.parser.parseError()`; when this callback is not provided + * it will try to invoke `yy.parseError()` instead. When that callback is also not + * provided, a `JisonLexerError` exception will be thrown containing the error + * message and `hash`, as constructed by the `constructLexErrorInfo()` API. + * + * Note that the lexer's `JisonLexerError` error class is passed via the + * `ExceptionClass` argument, which is invoked to construct the exception + * instance to be thrown, so technically `parseError` will throw the object + * produced by the `new ExceptionClass(str, hash)` JavaScript expression. + * + * --- + * + * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. + * These options are available: + * + * (Options are permanent.) + * + * yy: { + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * } + * + * lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * WARNING: the next set of options are not meant to be changed. They echo the abilities of + * the lexer as per when it was compiled! + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ var lexer = (function() { // See also: @@ -4915,45 +4947,45 @@ var lexer = (function() { var lexer = { - // Code Generator Information Report - // --------------------------------- - // - // Options: - // - // backtracking: .................... false - // location.ranges: ................. true - // location line+column tracking: ... true - // - // - // Forwarded Parser Analysis flags: - // - // uses yyleng: ..................... false - // uses yylineno: ................... false - // uses yytext: ..................... true - // uses yylloc: ..................... false - // uses lexer values: ............... true / true - // location tracking: ............... true - // location assignment: ............. true - // - // - // Lexer Analysis flags: - // - // uses yyleng: ..................... ??? - // uses yylineno: ................... ??? - // uses yytext: ..................... ??? - // uses yylloc: ..................... ??? - // uses ParseError API: ............. ??? - // uses yyerror: .................... ??? - // uses location tracking & editing: ??? - // uses more() API: ................. ??? - // uses unput() API: ................ ??? - // uses reject() API: ............... ??? - // uses less() API: ................. ??? - // uses display APIs pastInput(), upcomingInput(), showPosition(): - // ............................. ??? - // uses describeYYLLOC() API: ....... ??? - // - // --------- END OF REPORT ----------- + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // backtracking: .................... false + // location.ranges: ................. true + // location line+column tracking: ... true + // + // + // Forwarded Parser Analysis flags: + // + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... true + // uses yylloc: ..................... false + // uses lexer values: ............... true/ true + // location tracking: ............... true + // location assignment: ............. true + // + // + // Lexer Analysis flags: + // + // uses yyleng: ..................... ??? + // uses yylineno: ................... ??? + // uses yytext: ..................... ??? + // uses yylloc: ..................... ??? + // uses ParseError API: ............. ??? + // uses yyerror: .................... ??? + // uses location tracking & editing: ??? + // uses more() API: ................. ??? + // uses unput() API: ................ ??? + // uses reject() API: ............... ??? + // uses less() API: ................. ??? + // uses display APIs pastInput(), upcomingInput(), showPosition(): + // ............................. ??? + // uses describeYYLLOC() API: ....... ??? + // + // --------- END OF REPORT ----------- EOF: 1, @@ -7382,6 +7414,9 @@ var lexer = (function() { } }; + var helpers = require("../../modules/helpers-lib"); + var rmCommonWS = helpers.rmCommonWS; + function indent(s, i) { var a = s.split("\n"); var pf = new Array(i + 1).join(" "); @@ -7415,63 +7450,6 @@ var lexer = (function() { return s; } - // tagged template string helper which removes the indentation common to all - // non-empty lines: that indentation was added as part of the source code - // formatting of this lexer spec file and must be removed to produce what - // we were aiming for. - // - // Each template string starts with an optional empty line, which should be - // removed entirely, followed by a first line of error reporting content text, - // which should not be indented at all, i.e. the indentation of the first - // non-empty line should be treated as the 'common' indentation and thus - // should also be removed from all subsequent lines in the same template string. - // - // See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals - function rmCommonWS(strings, ...values) { - // as `strings[]` is an array of strings, each potentially consisting - // of multiple lines, followed by one(1) value, we have to split each - // individual string into lines to keep that bit of information intact. - var src = strings.map(function splitIntoLines(s) { - return s.split("\n"); - }); - // fetch the first line of content which is expected to exhibit the common indent: - // that would be the SECOND line of input, always, as the FIRST line won't - // have any indentation at all! - var s0 = ""; - for (var i = 0, len = src.length; i < len; i++) { - if (src[i].length > 1) { - s0 = src[i][1]; - break; - } - } - var indent = s0.replace(/^(\s+)[^\s]*.*$/, "$1"); - // we assume clean code style, hence no random mix of tabs and spaces, so every - // line MUST have the same indent style as all others, so `length` of indent - // should suffice, but the way we coded this is stricter checking when we apply - // a find-and-replace regex instead: - var indent_re = new RegExp("^" + indent); - - // process template string partials now: - for (var i = 0, len = src.length; i < len; i++) { - // start-of-lines always end up at index 1 and above (for each template string partial): - for (var j = 1, linecnt = src[i].length; j < linecnt; j++) { - src[i][j] = src[i][j].replace(indent_re, ""); - } - } - - // now merge everything to construct the template result: - var rv = []; - for (var i = 0, len = src.length, klen = values.length; i < len; i++) { - rv.push(src[i].join("\n")); - // all but the last partial are followed by a template value: - if (i < klen) { - rv.push(values[i]); - } - } - var sv = rv.join(""); - return sv; - } - lexer.warn = function l_warn() { if ( this.yy && diff --git a/lex.l b/lex.l index f16e920..ba0653f 100644 --- a/lex.l +++ b/lex.l @@ -438,6 +438,9 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] %% +var helpers = require('../../modules/helpers-lib'); +var rmCommonWS = helpers.rmCommonWS; + function indent(s, i) { var a = s.split('\n'); var pf = (new Array(i + 1)).join(' '); @@ -472,63 +475,6 @@ function dquote(s) { return s; } -// tagged template string helper which removes the indentation common to all -// non-empty lines: that indentation was added as part of the source code -// formatting of this lexer spec file and must be removed to produce what -// we were aiming for. -// -// Each template string starts with an optional empty line, which should be -// removed entirely, followed by a first line of error reporting content text, -// which should not be indented at all, i.e. the indentation of the first -// non-empty line should be treated as the 'common' indentation and thus -// should also be removed from all subsequent lines in the same template string. -// -// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals -function rmCommonWS(strings, ...values) { - // as `strings[]` is an array of strings, each potentially consisting - // of multiple lines, followed by one(1) value, we have to split each - // individual string into lines to keep that bit of information intact. - var src = strings.map(function splitIntoLines(s) { - return s.split('\n'); - }); - // fetch the first line of content which is expected to exhibit the common indent: - // that would be the SECOND line of input, always, as the FIRST line won't - // have any indentation at all! - var s0 = ''; - for (var i = 0, len = src.length; i < len; i++) { - if (src[i].length > 1) { - s0 = src[i][1]; - break; - } - } - var indent = s0.replace(/^(\s+)[^\s]*.*$/, '$1'); - // we assume clean code style, hence no random mix of tabs and spaces, so every - // line MUST have the same indent style as all others, so `length` of indent - // should suffice, but the way we coded this is stricter checking when we apply - // a find-and-replace regex instead: - var indent_re = new RegExp('^' + indent); - - // process template string partials now: - for (var i = 0, len = src.length; i < len; i++) { - // start-of-lines always end up at index 1 and above (for each template string partial): - for (var j = 1, linecnt = src[i].length; j < linecnt; j++) { - src[i][j] = src[i][j].replace(indent_re, ''); - } - } - - // now merge everything to construct the template result: - var rv = []; - for (var i = 0, len = src.length, klen = values.length; i < len; i++) { - rv.push(src[i].join('\n')); - // all but the last partial are followed by a template value: - if (i < klen) { - rv.push(values[i]); - } - } - var sv = rv.join(''); - return sv; -} - lexer.warn = function l_warn() { if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { diff --git a/lex.y b/lex.y index 00f5a01..daaa5ec 100644 --- a/lex.y +++ b/lex.y @@ -581,7 +581,9 @@ optional_module_code_chunk %% -var XRegExp = require('@gerhobbelt/xregexp'); // for helping out the `%options xregexp` in the lexer +var XRegExp = require('@gerhobbelt/xregexp'); +var helpers = require('../../modules/helpers-lib'); +var rmCommonWS = helpers.rmCommonWS; function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); @@ -615,63 +617,6 @@ function parseValue(v) { return v; } -// tagged template string helper which removes the indentation common to all -// non-empty lines: that indentation was added as part of the source code -// formatting of this lexer spec file and must be removed to produce what -// we were aiming for. -// -// Each template string starts with an optional empty line, which should be -// removed entirely, followed by a first line of error reporting content text, -// which should not be indented at all, i.e. the indentation of the first -// non-empty line should be treated as the 'common' indentation and thus -// should also be removed from all subsequent lines in the same template string. -// -// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals -function rmCommonWS(strings, ...values) { - // as `strings[]` is an array of strings, each potentially consisting - // of multiple lines, followed by one(1) value, we have to split each - // individual string into lines to keep that bit of information intact. - var src = strings.map(function splitIntoLines(s) { - return s.split('\n'); - }); - // fetch the first line of content which is expected to exhibit the common indent: - // that would be the SECOND line of input, always, as the FIRST line won't - // have any indentation at all! - var s0 = ''; - for (var i = 0, len = src.length; i < len; i++) { - if (src[i].length > 1) { - s0 = src[i][1]; - break; - } - } - var indent = s0.replace(/^(\s+)[^\s]*.*$/, '$1'); - // we assume clean code style, hence no random mix of tabs and spaces, so every - // line MUST have the same indent style as all others, so `length` of indent - // should suffice, but the way we coded this is stricter checking when we apply - // a find-and-replace regex instead: - var indent_re = new RegExp('^' + indent); - - // process template string partials now: - for (var i = 0, len = src.length; i < len; i++) { - // start-of-lines always end up at index 1 and above (for each template string partial): - for (var j = 1, linecnt = src[i].length; j < linecnt; j++) { - src[i][j] = src[i][j].replace(indent_re, ''); - } - } - - // now merge everything to construct the template result: - var rv = []; - for (var i = 0, len = src.length, klen = values.length; i < len; i++) { - rv.push(src[i].join('\n')); - // all but the last partial are followed by a template value: - if (i < klen) { - rv.push(values[i]); - } - } - var sv = rv.join(''); - return sv; -} - parser.warn = function p_warn() { console.warn.apply(console, arguments); From a4596a70e4aa079009f5d2b95fb628e2329c14c8 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 29 Sep 2017 22:07:16 +0200 Subject: [PATCH 382/417] regenerated library files --- lex-parser.js | 2 +- package-lock.json | 1434 +-------------------------------------------- 2 files changed, 28 insertions(+), 1408 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index ee9e277..89ad015 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -4609,7 +4609,7 @@ parse: function parse(input) { }); console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); } - } + } // /finally return retval; }, diff --git a/package-lock.json b/package-lock.json index 69b57ba..160dec0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,7 +6,8 @@ "@gerhobbelt/ast-types": { "version": "0.9.13-4", "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.13-4.tgz", - "integrity": "sha512-V8UIj1XN6XOP014fPpecxEa7AlAB9kaTOB/wF9UbguuwIMWCHDmdA9i03JDK9zXyVDVaLWCYh42JK8F9f27AtA==" + "integrity": "sha512-V8UIj1XN6XOP014fPpecxEa7AlAB9kaTOB/wF9UbguuwIMWCHDmdA9i03JDK9zXyVDVaLWCYh42JK8F9f27AtA==", + "dev": true }, "@gerhobbelt/ast-util": { "version": "0.6.1-4", @@ -61,538 +62,24 @@ "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", "dev": true }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, "assertion-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", "dev": true }, - "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", - "dev": true - }, - "atob": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", - "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", - "dev": true - }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "babel-core": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", - "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", - "dev": true, - "dependencies": { - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - } - } - }, - "babel-generator": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", - "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", - "dev": true - }, - "babel-helper-bindify-decorators": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz", - "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", - "dev": true - }, - "babel-helper-builder-binary-assignment-operator-visitor": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", - "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", - "dev": true - }, - "babel-helper-call-delegate": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", - "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", - "dev": true - }, - "babel-helper-define-map": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", - "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", - "dev": true - }, - "babel-helper-explode-assignable-expression": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", - "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", - "dev": true - }, - "babel-helper-explode-class": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz", - "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", - "dev": true - }, - "babel-helper-function-name": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", - "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", - "dev": true - }, - "babel-helper-get-function-arity": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", - "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", - "dev": true - }, - "babel-helper-hoist-variables": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", - "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", - "dev": true - }, - "babel-helper-optimise-call-expression": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", - "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", - "dev": true - }, - "babel-helper-regex": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", - "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", - "dev": true - }, - "babel-helper-remap-async-to-generator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", - "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", - "dev": true - }, - "babel-helper-replace-supers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", - "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", - "dev": true - }, - "babel-helpers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", - "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", - "dev": true - }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "dev": true - }, - "babel-plugin-check-es2015-constants": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", - "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", - "dev": true - }, - "babel-plugin-syntax-async-functions": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", - "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", - "dev": true - }, - "babel-plugin-syntax-async-generators": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", - "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", - "dev": true - }, - "babel-plugin-syntax-class-constructor-call": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", - "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=", - "dev": true - }, - "babel-plugin-syntax-class-properties": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", - "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", - "dev": true - }, - "babel-plugin-syntax-decorators": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", - "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", - "dev": true - }, - "babel-plugin-syntax-dynamic-import": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", - "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", - "dev": true - }, - "babel-plugin-syntax-exponentiation-operator": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", - "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", - "dev": true - }, - "babel-plugin-syntax-export-extensions": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", - "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=", - "dev": true - }, - "babel-plugin-syntax-flow": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", - "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", - "dev": true - }, - "babel-plugin-syntax-object-rest-spread": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", - "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", - "dev": true - }, - "babel-plugin-syntax-trailing-function-commas": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", - "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", - "dev": true - }, - "babel-plugin-transform-async-generator-functions": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", - "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", - "dev": true - }, - "babel-plugin-transform-async-to-generator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", - "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", - "dev": true - }, - "babel-plugin-transform-class-constructor-call": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.24.1.tgz", - "integrity": "sha1-gNwoVQWsBn3LjWxl4vbxGrd2Xvk=", - "dev": true - }, - "babel-plugin-transform-class-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", - "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", - "dev": true - }, - "babel-plugin-transform-decorators": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz", - "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", - "dev": true - }, - "babel-plugin-transform-es2015-arrow-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", - "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", - "dev": true - }, - "babel-plugin-transform-es2015-block-scoped-functions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", - "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", - "dev": true - }, - "babel-plugin-transform-es2015-block-scoping": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", - "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", - "dev": true - }, - "babel-plugin-transform-es2015-classes": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", - "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", - "dev": true - }, - "babel-plugin-transform-es2015-computed-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", - "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", - "dev": true - }, - "babel-plugin-transform-es2015-destructuring": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", - "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", - "dev": true - }, - "babel-plugin-transform-es2015-duplicate-keys": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", - "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", - "dev": true - }, - "babel-plugin-transform-es2015-for-of": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", - "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", - "dev": true - }, - "babel-plugin-transform-es2015-function-name": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", - "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", - "dev": true - }, - "babel-plugin-transform-es2015-literals": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", - "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", - "dev": true - }, - "babel-plugin-transform-es2015-modules-amd": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", - "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", - "dev": true - }, - "babel-plugin-transform-es2015-modules-commonjs": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz", - "integrity": "sha1-DYOUApt9xqvhqX7xgeAHWN0uXYo=", - "dev": true - }, - "babel-plugin-transform-es2015-modules-systemjs": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", - "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", - "dev": true - }, - "babel-plugin-transform-es2015-modules-umd": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", - "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", - "dev": true - }, - "babel-plugin-transform-es2015-object-super": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", - "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", - "dev": true - }, - "babel-plugin-transform-es2015-parameters": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", - "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", - "dev": true - }, - "babel-plugin-transform-es2015-shorthand-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", - "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", - "dev": true - }, - "babel-plugin-transform-es2015-spread": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", - "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", - "dev": true - }, - "babel-plugin-transform-es2015-sticky-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", - "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", - "dev": true - }, - "babel-plugin-transform-es2015-template-literals": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", - "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", - "dev": true - }, - "babel-plugin-transform-es2015-typeof-symbol": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", - "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", - "dev": true - }, - "babel-plugin-transform-es2015-unicode-regex": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", - "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", - "dev": true - }, - "babel-plugin-transform-exponentiation-operator": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", - "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", - "dev": true - }, - "babel-plugin-transform-export-extensions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz", - "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", - "dev": true - }, - "babel-plugin-transform-flow-strip-types": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", - "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", - "dev": true - }, - "babel-plugin-transform-object-rest-spread": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz", - "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", - "dev": true - }, - "babel-plugin-transform-regenerator": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", - "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", - "dev": true - }, - "babel-plugin-transform-strict-mode": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", - "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", - "dev": true - }, - "babel-preset-es2015": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", - "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", - "dev": true - }, - "babel-preset-stage-1": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", - "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", - "dev": true - }, - "babel-preset-stage-2": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", - "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", - "dev": true - }, - "babel-preset-stage-3": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", - "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", - "dev": true - }, - "babel-register": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", - "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", - "dev": true - }, - "babel-runtime": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", - "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", - "dev": true - }, - "babel-template": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", - "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", - "dev": true - }, - "babel-traverse": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", - "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", - "dev": true - }, - "babel-types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", - "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", - "dev": true - }, - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true - }, "brace-expansion": { "version": "1.1.8", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true }, - "braces": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.2.2.tgz", - "integrity": "sha1-JB+GjCsmkNn+vu5afIP7vyXQCxs=", - "dev": true - }, "browser-stdout": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", @@ -605,12 +92,6 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true - }, "camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -635,32 +116,6 @@ "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, - "class-utils": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.5.tgz", - "integrity": "sha1-F+eTEDdQ+WJ7IXbqNM/RtWWQPIA=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } - }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -681,12 +136,6 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true - }, "color-convert": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", @@ -699,46 +148,23 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, "commander": { "version": "2.9.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", "dev": true }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, - "convert-source-map": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", - "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", - "dev": true - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, "core-js": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", - "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=" + "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=", + "dev": true }, "cross-spawn": { "version": "5.1.0", @@ -746,12 +172,6 @@ "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", "dev": true }, - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true - }, "decamelize": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", @@ -764,18 +184,6 @@ "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true }, - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true - }, - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true - }, "diff": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", @@ -797,12 +205,7 @@ "esprima": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", "dev": true }, "execa": { @@ -817,108 +220,12 @@ "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", "dev": true }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true - }, - "extglob": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-1.1.0.tgz", - "integrity": "sha1-Bni04s5FwOTlD15er7Gw2rW05CQ=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - }, - "to-regex": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-2.1.0.tgz", - "integrity": "sha1-4606QM/hGVWaBa6kPkyu+sxekB0=", - "dev": true, - "dependencies": { - "regex-not": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-0.1.2.tgz", - "integrity": "sha1-vH8cSUSxGINT0H3uuRK5TgreJds=", - "dev": true - } - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true - }, "find-up": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true }, - "flow-parser": { - "version": "0.53.1", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.53.1.tgz", - "integrity": "sha1-a8lrbQGmlXG+ounKU/T/MY2YtD8=", - "dev": true - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", @@ -943,24 +250,12 @@ "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, "glob": { "version": "7.1.1", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", "dev": true }, - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -979,186 +274,58 @@ "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", "dev": true }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true - }, - "has-color": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", - "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", - "dev": true - }, "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, - "home-or-tmp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", - "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", - "dev": true - }, "hosted-git-info": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", "dev": true }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "invariant": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", - "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", - "dev": true - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } - }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", - "dev": true - }, - "is-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", - "dev": true - }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", - "dev": true - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } - }, - "is-descriptor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.1.tgz", - "integrity": "sha512-G3fFVFTqfaqu7r4YuSBHKBAuOaLz8Sy7ekklUpFEliaLMP1Y2ZjoN9jS62YWCAPQrQpMUQSitRlrzibbuCZjdA==", - "dev": true, - "dependencies": { - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-finite": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", - "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, - "is-fullwidth-code-point": { + "invert-kv": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true }, - "is-odd": { + "is-builtin-module": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", - "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true }, "is-stream": { @@ -1167,69 +334,24 @@ "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", "dev": true }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", "dev": true }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, "jison-gho": { "version": "0.6.0-193", "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-193.tgz", "integrity": "sha512-7aud9KQ8Ka2usOtisRk6nvoFoIzfhMBsztVoD5pEN4faMgJzNCuFNCUVJ098OPWE+SwtveONJf6x1Qe2aKrmmg==", "dev": true }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "jscodeshift": { - "version": "github:GerHobbelt/jscodeshift#cebef559cde6c7402e3f96c8d606bf49d46adae1", - "dev": true, - "dependencies": { - "@gerhobbelt/recast": { - "version": "github:GerHobbelt/recast#d724957cde9dc08583382f7256eb3ffa52ea681a" - } - } - }, - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", - "dev": true - }, "json3": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", "dev": true }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true - }, - "lazy-cache": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", - "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", - "dev": true - }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -1248,12 +370,6 @@ "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", "dev": true }, - "lodash": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", - "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", - "dev": true - }, "lodash._baseassign": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", @@ -1308,42 +424,18 @@ "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true }, - "loose-envify": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", - "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", - "dev": true - }, "lru-cache": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true - }, "mem": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", "dev": true }, - "micromatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.0.4.tgz", - "integrity": "sha1-FUPx0EgTRHrIUgAcX1qTNAF4bR0=", - "dev": true - }, "mimic-fn": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", @@ -1362,12 +454,6 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, - "mixin-deep": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.2.0.tgz", - "integrity": "sha1-0CuMb4ttS49ZgtP9AJxJGYUcP+I=", - "dev": true - }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -1406,58 +492,6 @@ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "nanomatch": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.3.tgz", - "integrity": "sha512-HqDMQWJlwpXbfKDpAnkc6AJQh5PFqVlrjYbruDjYVAS+05TQUb1qhIde4G9jMzHbs/u6bgEok1jMAV4yJzoh+w==", - "dev": true, - "dependencies": { - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } - }, - "node-dir": { - "version": "0.1.17", - "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz", - "integrity": "sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU=", - "dev": true - }, - "nomnom": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", - "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", - "dev": true, - "dependencies": { - "ansi-styles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", - "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", - "dev": true - }, - "chalk": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", - "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", - "dev": true - }, - "strip-ansi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", - "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", - "dev": true - }, - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -1476,76 +510,18 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "dependencies": { - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true - }, "os-locale": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -1570,12 +546,6 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -1612,16 +582,11 @@ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, "private": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", + "dev": true }, "pseudomap": { "version": "1.0.2", @@ -1641,74 +606,6 @@ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true }, - "regenerate": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz", - "integrity": "sha512-jVpo1GadrDAK59t/0jRx5VxYWQEDkkEKi6+HjE3joFVLfDOh9Xrdh0dF1eSq+BI/SwvTQ44gSscJ8N5zYL61sg==", - "dev": true - }, - "regenerator-runtime": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", - "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", - "dev": true - }, - "regenerator-transform": { - "version": "0.10.1", - "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", - "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", - "dev": true - }, - "regex-not": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", - "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", - "dev": true - }, - "regexpu-core": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", - "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", - "dev": true - }, - "regjsgen": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", - "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", - "dev": true - }, - "regjsparser": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", - "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", - "dev": true, - "dependencies": { - "jsesc": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", - "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", - "dev": true - } - } - }, - "repeat-element": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "repeating": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", - "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", - "dev": true - }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -1721,18 +618,6 @@ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", - "dev": true - }, "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", @@ -1745,26 +630,6 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, - "set-getter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", - "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", - "dev": true - }, - "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", - "dev": true, - "dependencies": { - "split-string": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.0.2.tgz", - "integrity": "sha512-d6myUSfwmBz1izkY4r7r7I0PL41rh21qUDYK1OgclmGHeoqQoujduGxMbzw6BlF3HKmJR4sMpbWVo7/Xzg4YBQ==", - "dev": true - } - } - }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -1783,79 +648,10 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - }, - "snapdragon": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", - "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } - }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=" - }, - "source-map-resolve": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.0.tgz", - "integrity": "sha1-/K0LZLcK+ydpnkJZUMtevNQQvCA=", - "dev": true - }, - "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "dev": true - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, "spdx-correct": { @@ -1876,38 +672,6 @@ "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, - "split-string": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-2.1.1.tgz", - "integrity": "sha1-r0sG2CFWBCZEbDzZMc2mGJQNN9A=", - "dev": true - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } - }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -1958,70 +722,6 @@ "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", "dev": true }, - "temp": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", - "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", - "dev": true - }, - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } - }, - "to-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", - "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true - }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, "type-detect": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", @@ -2034,80 +734,6 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, - "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", - "dev": true, - "dependencies": { - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true - } - } - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - } - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "use": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", - "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", - "dev": true - } - } - }, "validate-npm-package-license": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", @@ -2146,12 +772,6 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "write-file-atomic": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", - "dev": true - }, "y18n": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", From 23bc4982b6c83a4746133e03d7f6965b6fadf0d6 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sat, 30 Sep 2017 00:41:04 +0200 Subject: [PATCH 383/417] - tightening the test rig: it turns out you must spec `--check-leaks` for mocha to perform leak detection. - working on adding named `%code` and `%import` statements in the lexer, similar to those in the parser. This is useful when you produce stand-alone lexers or have special lexer requirements. - advanced error reporting: now the classical error report is included in the yyerror-hint message to prevent error reports missing the mark. - simplified a few lexer rules --- Makefile | 2 +- lex-parser.js | 2636 ++++++++++++++++++++++++++++--------------------- lex.l | 12 +- lex.y | 245 ++++- 4 files changed, 1712 insertions(+), 1183 deletions(-) diff --git a/Makefile b/Makefile index cb6d125..91ebccd 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,7 @@ endif $(JISON) -o lex-parser.js lex.y lex.l test: - node_modules/.bin/mocha --timeout 18000 tests/ + node_modules/.bin/mocha --timeout 18000 --check-leaks --globals assert tests/ # increment the XXX number in the package.json file: version ..- diff --git a/lex-parser.js b/lex-parser.js index 89ad015..0bc0e5d 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -569,7 +569,7 @@ var parser = { // .................................. false // uses yyleng: ..................... false // uses yylineno: ................... false - // uses yytext: ..................... true + // uses yytext: ..................... false // uses yylloc: ..................... false // uses ParseError API: ............. false // uses YYERROR: .................... true @@ -580,10 +580,10 @@ var parser = { // assigns rule values: ............. true // uses location tracking: .......... true // assigns location: ................ true - // uses yystack: .................... true - // uses yysstack: ................... true + // uses yystack: .................... false + // uses yysstack: ................... false // uses yysp: ....................... true - // uses yyrulelength: ............... true + // uses yyrulelength: ............... false // uses yyMergeLocationInfo API: .... true // has error recovery: .............. true // has error reporting: ............. true @@ -610,79 +610,84 @@ symbols_: { ",": 8, ".": 15, "/": 14, - "/!": 36, + "/!": 39, "<": 5, "=": 18, ">": 6, "?": 13, - "ACTION": 29, - "ACTION_BODY": 30, - "ACTION_BODY_CPP_COMMENT": 32, - "ACTION_BODY_C_COMMENT": 31, - "ACTION_BODY_WHITESPACE": 33, - "ACTION_END": 28, - "ACTION_START": 25, - "BRACKET_MISSING": 26, - "BRACKET_SURPLUS": 27, - "CHARACTER_LIT": 44, - "CODE": 51, + "ACTION": 32, + "ACTION_BODY": 33, + "ACTION_BODY_CPP_COMMENT": 35, + "ACTION_BODY_C_COMMENT": 34, + "ACTION_BODY_WHITESPACE": 36, + "ACTION_END": 31, + "ACTION_START": 28, + "BRACKET_MISSING": 29, + "BRACKET_SURPLUS": 30, + "CHARACTER_LIT": 46, + "CODE": 53, "EOF": 1, - "ESCAPE_CHAR": 41, - "INCLUDE": 49, - "INCLUDE_PLACEMENT_ERROR": 34, + "ESCAPE_CHAR": 44, + "IMPORT": 24, + "INCLUDE": 51, + "INCLUDE_PLACEMENT_ERROR": 37, + "INIT_CODE": 25, "NAME": 20, - "NAME_BRACE": 37, - "OPTIONS": 45, - "OPTIONS_END": 46, - "OPTION_STRING_VALUE": 47, - "OPTION_VALUE": 48, - "PATH": 50, - "RANGE_REGEX": 42, - "REGEX_SET": 40, - "REGEX_SET_END": 39, - "REGEX_SET_START": 38, - "SPECIAL_GROUP": 35, - "START_COND": 24, + "NAME_BRACE": 40, + "OPTIONS": 47, + "OPTIONS_END": 48, + "OPTION_STRING_VALUE": 49, + "OPTION_VALUE": 50, + "PATH": 52, + "RANGE_REGEX": 45, + "REGEX_SET": 43, + "REGEX_SET_END": 42, + "REGEX_SET_START": 41, + "SPECIAL_GROUP": 38, + "START_COND": 27, "START_EXC": 22, "START_INC": 21, - "STRING_LIT": 43, + "STRING_LIT": 26, "UNKNOWN_DECL": 23, "^": 16, - "action": 63, - "action_body": 64, - "any_group_regex": 73, - "definition": 56, - "definitions": 55, + "action": 68, + "action_body": 69, + "any_group_regex": 78, + "definition": 58, + "definitions": 57, "error": 2, - "escape_char": 76, - "extra_lexer_module_code": 82, - "include_macro_code": 83, - "init": 54, - "lex": 52, - "module_code_chunk": 84, - "name_expansion": 72, - "name_list": 66, - "names_exclusive": 58, - "names_inclusive": 57, - "nonempty_regex_list": 69, - "option": 81, - "option_list": 80, - "optional_module_code_chunk": 85, - "options": 79, - "range_regex": 77, - "regex": 67, - "regex_base": 71, - "regex_concat": 70, - "regex_list": 68, - "regex_set": 74, - "regex_set_atom": 75, - "rule": 62, - "rule_block": 61, - "rules": 59, - "rules_and_epilogue": 53, - "rules_collective": 60, - "start_conditions": 65, - "string": 78, + "escape_char": 81, + "extra_lexer_module_code": 87, + "import_name": 60, + "import_path": 61, + "include_macro_code": 88, + "init": 56, + "init_code_name": 59, + "lex": 54, + "module_code_chunk": 89, + "name_expansion": 77, + "name_list": 71, + "names_exclusive": 63, + "names_inclusive": 62, + "nonempty_regex_list": 74, + "option": 86, + "option_list": 85, + "optional_module_code_chunk": 90, + "options": 84, + "range_regex": 82, + "regex": 72, + "regex_base": 76, + "regex_concat": 75, + "regex_list": 73, + "regex_set": 79, + "regex_set_atom": 80, + "rule": 67, + "rule_block": 66, + "rules": 64, + "rules_and_epilogue": 55, + "rules_collective": 65, + "start_conditions": 70, + "string": 83, "{": 3, "|": 9, "}": 4 @@ -711,34 +716,36 @@ terminals_: { 21: "START_INC", 22: "START_EXC", 23: "UNKNOWN_DECL", - 24: "START_COND", - 25: "ACTION_START", - 26: "BRACKET_MISSING", - 27: "BRACKET_SURPLUS", - 28: "ACTION_END", - 29: "ACTION", - 30: "ACTION_BODY", - 31: "ACTION_BODY_C_COMMENT", - 32: "ACTION_BODY_CPP_COMMENT", - 33: "ACTION_BODY_WHITESPACE", - 34: "INCLUDE_PLACEMENT_ERROR", - 35: "SPECIAL_GROUP", - 36: "/!", - 37: "NAME_BRACE", - 38: "REGEX_SET_START", - 39: "REGEX_SET_END", - 40: "REGEX_SET", - 41: "ESCAPE_CHAR", - 42: "RANGE_REGEX", - 43: "STRING_LIT", - 44: "CHARACTER_LIT", - 45: "OPTIONS", - 46: "OPTIONS_END", - 47: "OPTION_STRING_VALUE", - 48: "OPTION_VALUE", - 49: "INCLUDE", - 50: "PATH", - 51: "CODE" + 24: "IMPORT", + 25: "INIT_CODE", + 26: "STRING_LIT", + 27: "START_COND", + 28: "ACTION_START", + 29: "BRACKET_MISSING", + 30: "BRACKET_SURPLUS", + 31: "ACTION_END", + 32: "ACTION", + 33: "ACTION_BODY", + 34: "ACTION_BODY_C_COMMENT", + 35: "ACTION_BODY_CPP_COMMENT", + 36: "ACTION_BODY_WHITESPACE", + 37: "INCLUDE_PLACEMENT_ERROR", + 38: "SPECIAL_GROUP", + 39: "/!", + 40: "NAME_BRACE", + 41: "REGEX_SET_START", + 42: "REGEX_SET_END", + 43: "REGEX_SET", + 44: "ESCAPE_CHAR", + 45: "RANGE_REGEX", + 46: "CHARACTER_LIT", + 47: "OPTIONS", + 48: "OPTIONS_END", + 49: "OPTION_STRING_VALUE", + 50: "OPTION_VALUE", + 51: "INCLUDE", + 52: "PATH", + 53: "CODE" }, TERROR: 2, EOF: 1, @@ -844,66 +851,72 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do }, productions_: bp({ pop: u([ - 52, - 52, - s, - [53, 3], 54, - 55, - 55, + 54, s, - [56, 6], + [55, 3], + 56, 57, 57, - 58, - 58, + s, + [58, 11], 59, 59, - s, - [60, 4], + 60, + 60, 61, 61, 62, 62, - s, - [63, 3], - s, - [64, 9], + 63, + 63, + 64, + 64, s, [65, 4], 66, 66, 67, + 67, s, - [68, 4], + [68, 3], s, - [69, 4], - 70, - 70, + [69, 9], s, - [71, 17], + [70, 4], + 71, + 71, 72, - 73, - 73, - 74, - 74, + s, + [73, 4], + s, + [74, 4], + 75, 75, s, - [75, 4, 1], + [76, 17], + 77, + 78, 78, 79, - 80, + 79, 80, s, - [81, 6], - 82, - 82, + [80, 4, 1], 83, - 83, - s, - [84, 3], + 84, + 85, 85, - 85 + s, + [86, 6], + 87, + 87, + 88, + 88, + s, + [89, 3], + 90, + 90 ]), rule: u([ s, @@ -916,17 +929,24 @@ productions_: bp({ s, [2, 3], s, - [1, 4], + [1, 3], + 3, + 3, + 2, + 3, + 3, + s, + [1, 7], 2, 1, 2, c, - [12, 3], + [23, 3], 4, 4, 3, c, - [18, 4], + [29, 4], s, [3, 3], s, @@ -967,7 +987,7 @@ productions_: bp({ 0 ]) }), -performAction: function parser__PerformAction(yytext, yyloc, yystate /* action[1] */, yysp, yyrulelength, yyvstack, yylstack, yystack, yysstack) { +performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyvstack, yylstack) { /* this == yyval */ @@ -1031,21 +1051,21 @@ case 2: yyparser.yyError(rmCommonWS` - Maybe you did not correctly separate the lexer sections with a '%%' - on an otherwise empty line? - The lexer spec file should have this structure: + Maybe you did not correctly separate the lexer sections with a '%%' + on an otherwise empty line? + The lexer spec file should have this structure: - definitions - %% - rules - %% // <-- optional! - extra_module_code // <-- optional! + definitions + %% + rules + %% // <-- optional! + extra_module_code // <-- optional! - Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} - Technical error report: - ${yyvstack[yysp - 1].errStr} + Technical error report: + ${yyvstack[yysp - 1].errStr} `); break; @@ -1138,7 +1158,7 @@ case 8: case 9: /*! Production:: definition : NAME regex */ -case 27: +case 38: /*! Production:: rule : regex action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1175,7 +1195,7 @@ case 12: case 13: /*! Production:: definition : options */ -case 88: +case 99: /*! Production:: option_list : option */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1198,6 +1218,134 @@ case 14: break; case 15: + /*! Production:: definition : IMPORT import_name import_path */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp]}; + break; + +case 16: + /*! Production:: definition : IMPORT import_name error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + You did not specify a legal file path for the '%import' initialization code statement, which must have the format: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 17: + /*! Production:: definition : IMPORT error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + %import name or source filename missing maybe? + + Note: each '%import'-ed initialization code section must be qualified by a name, e.g. 'required' before the import path itself: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 18: + /*! Production:: definition : INIT_CODE init_code_name action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + type: 'codesection', + qualifier: yyvstack[yysp - 1], + include: yyvstack[yysp] + }; + break; + +case 19: + /*! Production:: definition : INIT_CODE error action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Each '%code' initialization code section must be qualified by a name, e.g. 'required' before the action code itself: + %code qualifier_name {action code} + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 20: + /*! Production:: init_code_name : NAME */ +case 21: + /*! Production:: init_code_name : STRING_LIT */ +case 22: + /*! Production:: import_name : NAME */ +case 23: + /*! Production:: import_name : STRING_LIT */ +case 24: + /*! Production:: import_path : NAME */ +case 25: + /*! Production:: import_path : STRING_LIT */ +case 61: + /*! Production:: regex_list : regex_concat */ +case 66: + /*! Production:: nonempty_regex_list : regex_concat */ +case 68: + /*! Production:: regex_concat : regex_base */ +case 93: + /*! Production:: escape_char : ESCAPE_CHAR */ +case 94: + /*! Production:: range_regex : RANGE_REGEX */ +case 106: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ +case 110: + /*! Production:: module_code_chunk : CODE */ +case 113: + /*! Production:: optional_module_code_chunk : module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + +case 26: /*! Production:: names_inclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1208,7 +1356,7 @@ case 15: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; break; -case 16: +case 27: /*! Production:: names_inclusive : names_inclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1219,7 +1367,7 @@ case 16: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; break; -case 17: +case 28: /*! Production:: names_exclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1230,7 +1378,7 @@ case 17: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; break; -case 18: +case 29: /*! Production:: names_exclusive : names_exclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1241,7 +1389,7 @@ case 18: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; break; -case 19: +case 30: /*! Production:: rules : rules rules_collective */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1252,9 +1400,9 @@ case 19: this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; -case 20: +case 31: /*! Production:: rules : %epsilon */ -case 26: +case 37: /*! Production:: rule_block : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1265,7 +1413,7 @@ case 26: this.$ = []; break; -case 21: +case 32: /*! Production:: rules_collective : start_conditions rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1279,7 +1427,7 @@ case 21: this.$ = [yyvstack[yysp]]; break; -case 22: +case 33: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1295,7 +1443,7 @@ case 22: this.$ = yyvstack[yysp - 1]; break; -case 23: +case 34: /*! Production:: rules_collective : start_conditions "{" error "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1305,16 +1453,20 @@ case 23: yyparser.yyError(rmCommonWS` - Seems you made a mistake while specifying one of the lexer rules inside - the start condition - <${yyvstack[yysp - 3].join(',')}> { rules... } - block. + Seems you made a mistake while specifying one of the lexer rules inside + the start condition + <${yyvstack[yysp - 3].join(',')}> { rules... } + block. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} - Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])); + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); break; -case 24: +case 35: /*! Production:: rules_collective : start_conditions "{" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1324,16 +1476,20 @@ case 24: yyparser.yyError(rmCommonWS` - Seems you did not correctly bracket a lexer rules set inside - the start condition - <${yyvstack[yysp - 2].join(',')}> { rules... } - as a terminating curly brace '}' could not be found. + Seems you did not correctly bracket a lexer rules set inside + the start condition + <${yyvstack[yysp - 2].join(',')}> { rules... } + as a terminating curly brace '}' could not be found. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} - Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 25: +case 36: /*! Production:: rule_block : rule_block rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1344,7 +1500,7 @@ case 25: this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); break; -case 28: +case 39: /*! Production:: rule : regex error */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1353,19 +1509,18 @@ case 28: this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; - console.log('############# DUMP:', { - yysp, - yyrulelength, - yyvstack, - yystack, - yysstack, - error: yyvstack[yysp], - text: yytext - }); - yyparser.yyError("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); + yyparser.yyError(rmCommonWS` + Lexer rule regex action code declaration error? + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 29: +case 40: /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1374,10 +1529,15 @@ case 29: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError(rmCommonWS` + Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + `); break; -case 30: +case 41: /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1386,10 +1546,15 @@ case 30: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError(rmCommonWS` + Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + `); break; -case 31: +case 42: /*! Production:: action : ACTION_START action_body ACTION_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1397,31 +1562,27 @@ case 31: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - if (0) { - this.$ = 'XXX' + yyvstack[yysp - 1] + 'YYY'; + var s = yyvstack[yysp - 1].trim(); + // remove outermost set of braces UNLESS there's + // a curly brace in there anywhere: in that case + // we should leave it up to the sophisticated + // code analyzer to simplify the code! + // + // This is a very rough check as it will also look + // inside code comments, which should not have + // any influence. + // + // Nevertheless: this is a *safe* transform! + if (s[0] === '{' && s.indexOf('}') === s.length - 1) { + this.$ = s.substring(1, s.length - 1).trim(); } else { - var s = yyvstack[yysp - 1].trim(); - // remove outermost set of braces UNLESS there's - // a curly brace in there anywhere: in that case - // we should leave it up to the sophisticated - // code analyzer to simplify the code! - // - // This is a very rough check as it ill also look - // inside code comments, which should not have - // any influence. - // - // Nevertheless: this is a *safe* transform! - if (s[0] === '{' && s.indexOf('}') === s.length - 1) { - this.$ = s.substring(1, s.length - 1).trim(); - } else { - this.$ = s; - } + this.$ = s; } break; -case 32: +case 43: /*! Production:: action_body : action_body ACTION */ -case 37: +case 48: /*! Production:: action_body : action_body include_macro_code */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1432,21 +1593,21 @@ case 37: this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; break; -case 33: +case 44: /*! Production:: action_body : action_body ACTION_BODY */ -case 34: +case 45: /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ -case 35: +case 46: /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ -case 36: +case 47: /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ -case 56: +case 67: /*! Production:: regex_concat : regex_concat regex_base */ -case 68: +case 79: /*! Production:: regex_base : regex_base range_regex */ -case 78: +case 89: /*! Production:: regex_set : regex_set regex_set_atom */ -case 100: +case 111: /*! Production:: module_code_chunk : module_code_chunk CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1457,7 +1618,7 @@ case 100: this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 38: +case 49: /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1466,15 +1627,15 @@ case 38: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("" + - " You may place the '%include' instruction only at the start/front of" + - " a line. " + - "" + - " It's use is not permitted at this position:" + - "" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); + yyparser.yyError(rmCommonWS` + You may place the '%include' instruction only at the start/front of a line. + + It's use is not permitted at this position: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + `); break; -case 39: +case 50: /*! Production:: action_body : action_body error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1483,14 +1644,22 @@ case 39: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); + yyparser.yyError(rmCommonWS` + Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 40: - /*! Production:: action_body : %epsilon */ case 51: + /*! Production:: action_body : %epsilon */ +case 62: /*! Production:: regex_list : %epsilon */ -case 103: +case 114: /*! Production:: optional_module_code_chunk : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1501,7 +1670,7 @@ case 103: this.$ = ''; break; -case 41: +case 52: /*! Production:: start_conditions : "<" name_list ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1512,7 +1681,7 @@ case 41: this.$ = yyvstack[yysp - 1]; break; -case 42: +case 53: /*! Production:: start_conditions : "<" name_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1521,10 +1690,18 @@ case 42: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Seems you did not correctly terminate the start condition set <" + yyvstack[yysp - 1].join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError(rmCommonWS` + Seems you did not correctly terminate the start condition set <${yyvstack[yysp - 1].join(',')},???> with a terminating '>' + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 43: +case 54: /*! Production:: start_conditions : "<" "*" ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1535,7 +1712,7 @@ case 43: this.$ = ['*']; break; -case 44: +case 55: /*! Production:: start_conditions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1544,7 +1721,7 @@ case 44: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 45: +case 56: /*! Production:: name_list : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1555,7 +1732,7 @@ case 45: this.$ = [yyvstack[yysp]]; break; -case 46: +case 57: /*! Production:: name_list : name_list "," NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1566,7 +1743,7 @@ case 46: this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; -case 47: +case 58: /*! Production:: regex : nonempty_regex_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1637,9 +1814,9 @@ case 47: } break; -case 48: +case 59: /*! Production:: regex_list : regex_list "|" regex_concat */ -case 52: +case 63: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1650,9 +1827,9 @@ case 52: this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; -case 49: +case 60: /*! Production:: regex_list : regex_list "|" */ -case 53: +case 64: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1663,32 +1840,7 @@ case 53: this.$ = yyvstack[yysp - 1] + '|'; break; -case 50: - /*! Production:: regex_list : regex_concat */ -case 55: - /*! Production:: nonempty_regex_list : regex_concat */ -case 57: - /*! Production:: regex_concat : regex_base */ -case 82: - /*! Production:: escape_char : ESCAPE_CHAR */ -case 83: - /*! Production:: range_regex : RANGE_REGEX */ -case 95: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 99: - /*! Production:: module_code_chunk : CODE */ -case 102: - /*! Production:: optional_module_code_chunk : module_code_chunk */ - - // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): - this._$ = yylstack[yysp]; - // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - - - this.$ = yyvstack[yysp]; - break; - -case 54: +case 65: /*! Production:: nonempty_regex_list : "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1699,7 +1851,7 @@ case 54: this.$ = '|' + yyvstack[yysp]; break; -case 58: +case 69: /*! Production:: regex_base : "(" regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1710,7 +1862,7 @@ case 58: this.$ = '(' + yyvstack[yysp - 1] + ')'; break; -case 59: +case 70: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1721,9 +1873,9 @@ case 59: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; -case 60: +case 71: /*! Production:: regex_base : "(" regex_list error */ -case 61: +case 72: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1732,10 +1884,18 @@ case 61: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lex rule regex part in '(...)' braces. + + Unterminated regex part: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 62: +case 73: /*! Production:: regex_base : regex_base "+" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1746,7 +1906,7 @@ case 62: this.$ = yyvstack[yysp - 1] + '+'; break; -case 63: +case 74: /*! Production:: regex_base : regex_base "*" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1757,7 +1917,7 @@ case 63: this.$ = yyvstack[yysp - 1] + '*'; break; -case 64: +case 75: /*! Production:: regex_base : regex_base "?" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1768,7 +1928,7 @@ case 64: this.$ = yyvstack[yysp - 1] + '?'; break; -case 65: +case 76: /*! Production:: regex_base : "/" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1779,7 +1939,7 @@ case 65: this.$ = '(?=' + yyvstack[yysp] + ')'; break; -case 66: +case 77: /*! Production:: regex_base : "/!" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1790,21 +1950,21 @@ case 66: this.$ = '(?!' + yyvstack[yysp] + ')'; break; -case 67: +case 78: /*! Production:: regex_base : name_expansion */ -case 69: +case 80: /*! Production:: regex_base : any_group_regex */ -case 73: +case 84: /*! Production:: regex_base : string */ -case 74: +case 85: /*! Production:: regex_base : escape_char */ -case 75: +case 86: /*! Production:: name_expansion : NAME_BRACE */ -case 79: +case 90: /*! Production:: regex_set : regex_set_atom */ -case 80: +case 91: /*! Production:: regex_set_atom : REGEX_SET */ -case 85: +case 96: /*! Production:: string : CHARACTER_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1813,7 +1973,7 @@ case 85: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 70: +case 81: /*! Production:: regex_base : "." */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1824,7 +1984,7 @@ case 70: this.$ = '.'; break; -case 71: +case 82: /*! Production:: regex_base : "^" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1835,7 +1995,7 @@ case 71: this.$ = '^'; break; -case 72: +case 83: /*! Production:: regex_base : "$" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1846,9 +2006,9 @@ case 72: this.$ = '$'; break; -case 76: +case 87: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 96: +case 107: /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1859,7 +2019,7 @@ case 96: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 77: +case 88: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1868,10 +2028,18 @@ case 77: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. + + Unterminated regex set: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 81: +case 92: /*! Production:: regex_set_atom : name_expansion */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1890,7 +2058,7 @@ case 81: //this.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 84: +case 95: /*! Production:: string : STRING_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1901,7 +2069,7 @@ case 84: this.$ = prepareString(yyvstack[yysp]); break; -case 86: +case 97: /*! Production:: options : OPTIONS option_list OPTIONS_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1912,7 +2080,7 @@ case 86: this.$ = null; break; -case 87: +case 98: /*! Production:: option_list : option option_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1923,7 +2091,7 @@ case 87: this.$ = null; break; -case 89: +case 100: /*! Production:: option : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1935,7 +2103,7 @@ case 89: yy.options[yyvstack[yysp]] = true; break; -case 90: +case 101: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1947,9 +2115,9 @@ case 90: yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; -case 91: +case 102: /*! Production:: option : NAME "=" OPTION_VALUE */ -case 92: +case 103: /*! Production:: option : NAME "=" NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1961,7 +2129,7 @@ case 92: yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; -case 93: +case 104: /*! Production:: option : NAME "=" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1972,13 +2140,17 @@ case 93: // TODO ... yyparser.yyError(rmCommonWS` - internal error: option "${$option}" value assignment failure. + Internal error: option "${$option}" value assignment failure. Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])); + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 94: +case 105: /*! Production:: option : error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1989,13 +2161,17 @@ case 94: // TODO ... yyparser.yyError(rmCommonWS` - expected a valid option name (with optional value assignment). + Expected a valid option name (with optional value assignment). Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp])); + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 97: +case 108: /*! Production:: include_macro_code : INCLUDE PATH */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2009,7 +2185,7 @@ case 97: this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; -case 98: +case 109: /*! Production:: include_macro_code : INCLUDE error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2019,13 +2195,17 @@ case 98: yyparser.yyError(rmCommonWS` - %include MUST be followed by a valid file path. + %include MUST be followed by a valid file path. + + Erroneous path: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} - Erroneous path: - ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])); + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 101: +case 112: /*! Production:: module_code_chunk : error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2036,13 +2216,17 @@ case 101: // TODO ... yyparser.yyError(rmCommonWS` - module code declaration error? + Module code declaration error? - Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, yylstack[yysp])); + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); break; -case 129: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! +case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -2054,41 +2238,51 @@ case 129: // === NO_ACTION[1] :: ensures that anyone (but us) using this n }, table: bt({ len: u([ - 11, - 1, - 10, 13, 1, + 12, + 15, + 1, 1, - 9, + 11, 18, 21, 2, 2, s, - [9, 3], + [11, 3], + 4, + 4, 12, 4, 1, 1, 19, - 9, - 10, + 11, + 12, 18, - 27, - 28, + 29, + 30, 22, 22, 17, 17, s, - [27, 7], - 29, + [29, 7], + 31, 5, s, - [27, 3], + [29, 3], s, - [10, 4], + [12, 4], + 4, + 11, + 3, + 3, + 2, + 2, + 1, + 1, 12, 1, 5, @@ -2098,27 +2292,29 @@ table: bt({ 17, 23, 3, - 28, - 27, - 28, + 30, + 29, + 30, s, - [27, 5], + [29, 5], 3, 20, 3, - 28, - 28, + 30, + 30, 6, s, [4, 3], - 10, - 10, + 12, + 12, s, - [25, 3], + [11, 6], + s, + [27, 3], s, [11, 8], 2, - 9, + 11, 1, 4, 3, @@ -2132,10 +2328,10 @@ table: bt({ 1, 3, s, - [27, 3], + [29, 3], 21, s, - [27, 4], + [29, 4], 4, 13, 13, @@ -2161,25 +2357,25 @@ table: bt({ 1, 2, s, - [19, 5, 1], - 25, - 45, - 52, + [19, 7, 1], + 28, + 47, 54, + 56, 1, c, - [12, 9], - 55, + [14, 11], + 57, c, - [10, 9], - 53, - 56, - 63, - 79, + [12, 11], + 55, + 58, + 68, + 84, s, [1, 3], c, - [15, 8], + [17, 10], 1, 3, 5, @@ -2188,112 +2384,137 @@ table: bt({ s, [14, 4, 1], 19, + 26, s, - [35, 4, 1], - 41, - 43, + [38, 4, 1], 44, - 59, + 46, + 64, c, [15, 6], c, [14, 7], - 67, + 72, s, - [69, 5, 1], - 76, - 78, - 24, - 57, - 24, - 58, + [74, 5, 1], + 81, + 83, + 27, + 62, + 27, + 63, + c, + [54, 12], c, - [52, 10], + [11, 21], + 2, + 20, + 26, + 60, c, - [9, 17], + [4, 3], + 59, 2, s, - [26, 9, 1], - 49, - 64, + [29, 9, 1], + 51, + 69, 2, 20, - 80, - 81, + 85, + 86, s, [1, 3], c, - [88, 16], - 60, + [102, 16], 65, + 70, c, - [55, 11], + [67, 13], 9, c, - [10, 7], - c, - [107, 12], + [12, 9], c, - [105, 6], + [125, 12], c, - [28, 3], + [123, 6], c, - [55, 6], + [30, 3], c, - [33, 5], + [59, 6], + s, + [20, 7, 1], + 28, c, - [27, 7], - 45, + [29, 6], + 47, c, - [27, 7], + [29, 7], 7, s, [9, 9, 1], c, - [31, 11], - s, - [42, 4, 1], - 77, + [33, 14], + 45, + 46, + 47, + 82, c, - [54, 3], + [58, 3], 11, c, - [76, 11], - 68, + [80, 11], + 73, c, - [77, 6], + [81, 6], c, [22, 22], c, - [117, 12], + [121, 12], c, [17, 22], c, - [106, 27], + [108, 29], c, - [27, 184], + [29, 199], s, - [39, 7, 1], - 37, + [42, 6, 1], 40, - 72, - 74, - 75, - c, - [115, 83], - s, - [19, 7, 1], + 43, + 77, + 79, + 80, c, - [10, 31], + [123, 89], c, - [551, 11], - 83, - 46, + [19, 7], + 27, + c, + [572, 11], + c, + [12, 27], + c, + [593, 3], + 61, + c, + [612, 14], + c, + [3, 3], + 28, + 68, + 28, + 68, + 28, + 28, + c, + [616, 11], + 88, + 48, 2, 20, - 46, - 80, - 81, + 48, + 85, + 86, 2, 18, 20, @@ -2301,90 +2522,92 @@ table: bt({ [9, 4], 1, 2, - 49, 51, - 82, - 84, - 85, + 53, + 87, + 89, + 90, c, - [565, 17], + [630, 17], 3, c, - [653, 13], - 62, + [732, 13], + 67, c, - [654, 8], + [733, 8], 7, 20, - 66, + 71, c, - [552, 22], + [613, 24], c, - [580, 61], + [643, 65], c, - [448, 135], + [507, 145], 2, 9, 11, c, - [696, 15], + [769, 15], c, - [716, 7], + [789, 7], 11, c, - [189, 55], - 77, + [201, 59], + 82, 2, - 37, - 39, 40, - 72, - 75, + 42, + 43, + 77, + 80, c, [6, 4], c, [4, 8], c, - [423, 22], + [476, 33], + c, + [11, 59], 3, 4, c, - [383, 8], + [473, 8], c, - [313, 13], + [401, 15], c, - [25, 50], + [27, 54], c, - [488, 11], + [584, 11], c, [11, 78], - 50, + 52, c, - [1092, 9], + [182, 11], c, - [566, 3], - 47, - 48, - 1, + [664, 3], 49, - 83, + 50, 1, - 49, + 51, + 88, + 1, + 51, 1, - 49, 51, + 53, c, [3, 7], c, - [574, 16], + [672, 16], 2, 4, c, - [575, 13], - 61, + [673, 13], + 66, 2, - 25, - 63, + 28, + 68, 2, 6, 8, @@ -2392,144 +2615,154 @@ table: bt({ c, [4, 3], c, - [546, 54], + [642, 58], c, - [437, 29], + [525, 31], c, - [434, 13], + [522, 13], c, - [648, 8], + [750, 8], c, - [566, 107], + [662, 115], c, - [470, 5], + [562, 5], c, - [299, 10], - 51, + [315, 10], + 53, c, [13, 13], c, - [867, 3], + [979, 3], c, [3, 9], c, - [876, 4], + [988, 4], c, - [875, 3], - 49, + [987, 3], 51, + 53, c, - [286, 14], + [300, 14], c, - [861, 9], + [973, 9], 1, c, - [469, 10], + [487, 10], c, [27, 7], c, [18, 36], c, - [938, 14], + [1050, 14], c, [14, 14], 20, c, [15, 14], c, - [734, 20], + [830, 20], c, - [455, 3], + [469, 3], c, - [446, 16], + [460, 16], c, [159, 14], c, - [477, 18], + [491, 18], 6, 8 ]), type: u([ s, - [2, 9], + [2, 11], 0, 0, 1, c, - [12, 10], + [14, 12], c, - [22, 11], + [26, 13], 0, c, - [13, 10], + [15, 12], s, [2, 19], c, - [29, 14], + [31, 14], s, [0, 8], c, [23, 3], c, - [54, 29], + [56, 31], + c, + [62, 10], c, - [64, 13], + [112, 13], c, - [97, 21], + [67, 4], c, - [118, 30], + [40, 20], c, - [107, 9], + [78, 36], c, - [28, 27], + [123, 7], c, - [181, 41], + [30, 28], c, - [183, 9], + [203, 43], + c, + [205, 9], c, [22, 34], c, [17, 34], s, - [2, 208], + [2, 224], + c, + [239, 141], c, - [223, 135], + [139, 19], c, - [133, 5], + [655, 16], c, - [139, 13], + [14, 5], c, - [153, 34], + [180, 13], + c, + [194, 34], s, [0, 9], c, - [497, 18], + [98, 21], + c, + [643, 86], c, - [580, 83], + [492, 151], c, - [435, 141], + [494, 34], c, - [284, 32], + [231, 35], c, - [217, 33], + [802, 238], c, - [725, 215], + [716, 74], c, - [214, 44], + [44, 28], c, - [567, 26], + [708, 37], c, - [1020, 81], + [522, 78], c, - [648, 28], + [454, 163], c, - [594, 134], + [164, 19], c, - [861, 28], + [973, 11], c, - [734, 145], + [830, 147], s, - [2, 23] + [2, 21] ]), state: u([ s, @@ -2537,75 +2770,80 @@ table: bt({ 6, 11, 12, - 18, - 19, 20, + 21, 22, - 23, - 28, - 29, - 34, - 33, - 40, + 24, + 25, + 30, + 31, + 36, + 35, 42, 44, - 45, 46, 50, - 51, 54, - c, - [13, 5], 55, + 56, + 60, + 61, + 64, + c, + [15, 5], + 65, c, [5, 4], - 59, - 61, - 62, + 69, + 71, + 72, c, [13, 5], - 63, + 73, c, [7, 6], - 64, + 74, c, [5, 4], - 65, + 75, c, [5, 4], - 69, - 66, - 67, - 80, - 85, - 46, + 79, + 76, + 77, + 82, + 86, 87, - 89, - 88, - 92, - 94, + 96, + 101, + 56, + 103, + 105, + 104, + 108, + 110, c, - [61, 7], - 95, - 98, + [66, 7], + 111, + 114, c, - [55, 11], + [58, 11], c, [6, 6], - 59, 69, - 106, - 113, - 115, - 117, + 79, + 122, + 129, + 131, + 133, c, [12, 5], - 123, + 139, c, [29, 5], - 89, - 124, - 126, + 105, + 140, + 142, c, [47, 8], c, @@ -2613,470 +2851,519 @@ table: bt({ ]), mode: u([ s, - [2, 19], + [2, 23], s, - [1, 10], + [1, 12], s, - [2, 26], + [2, 28], s, [1, 15], s, - [2, 38], + [2, 33], c, - [40, 6], + [39, 17], c, - [45, 7], + [13, 6], c, - [52, 19], + [18, 7], c, - [19, 8], + [64, 21], c, - [90, 15], + [21, 10], c, - [98, 11], + [106, 15], c, - [21, 11], + [75, 12], + 1, c, - [80, 9], + [90, 10], c, - [65, 17], - 1, + [27, 6], c, - [65, 12], + [72, 23], c, - [15, 15], + [40, 8], + c, + [45, 7], + c, + [15, 13], s, [1, 24], s, - [2, 218], + [2, 234], c, - [220, 90], + [236, 98], c, - [89, 20], + [97, 24], c, - [20, 13], + [24, 15], + c, + [374, 20], c, - [355, 16], + [432, 5], c, - [506, 9], + [409, 15], c, - [58, 18], + [568, 9], c, - [400, 19], + [47, 20], c, - [503, 21], + [454, 17], c, - [525, 49], + [561, 23], c, - [388, 135], + [585, 53], c, - [648, 19], + [442, 145], c, - [708, 31], + [718, 19], c, - [27, 23], + [780, 33], + c, + [29, 25], c, - [685, 199], + [759, 238], c, - [197, 12], + [796, 51], c, - [211, 5], + [289, 5], c, - [1051, 12], + [1211, 12], c, - [618, 32], + [722, 35], c, - [947, 12], + [340, 9], c, - [550, 22], + [648, 24], c, - [720, 55], + [854, 59], c, - [1041, 162], + [1199, 170], c, - [297, 6], + [311, 6], c, - [857, 23], + [969, 23], c, - [986, 90], + [1128, 90], c, - [283, 66] + [291, 66] ]), goto: u([ s, - [6, 9], + [6, 11], s, - [8, 9], + [8, 11], 5, 5, s, [7, 4, 1], s, - [13, 5, 1], + [13, 7, 1], s, - [7, 9], + [7, 11], s, - [20, 17], - 21, - 24, + [31, 17], + 23, 26, - 30, - 31, + 28, 32, - 25, - 27, - 35, - 36, + 33, + 34, 39, + 27, + 29, 37, 38, 41, + 40, 43, + 45, s, - [12, 9], - s, - [13, 9], + [12, 11], s, - [14, 9], + [13, 11], s, - [40, 11], - 48, + [14, 11], 47, + 48, + 49, + 51, + 52, + 53, + s, + [51, 11], + 58, + 57, 1, 2, 4, - 44, - 52, + 55, + 62, s, - [44, 6], - 49, + [55, 6], + 59, s, - [44, 7], + [55, 7], s, - [9, 9], - 47, - 47, - 53, + [9, 11], + 58, + 58, + 63, s, - [47, 7], + [58, 9], c, - [92, 12], + [108, 12], s, - [55, 3], + [66, 3], c, [15, 5], s, - [55, 6], + [66, 7], + 39, + 66, c, - [21, 8], - s, - [57, 6], - 56, - 58, + [23, 7], + 68, + 68, + 67, s, - [57, 15], - 60, + [68, 3], + c, + [7, 3], s, - [57, 3], - 51, - 51, - 24, - 51, + [68, 17], + 70, + 68, + 68, + 62, + 62, + 26, + 62, c, - [64, 11], + [68, 11], c, [15, 15], c, - [91, 12], + [95, 12], c, [12, 12], s, - [67, 27], + [78, 29], s, - [69, 27], + [80, 29], s, - [70, 27], + [81, 29], s, - [71, 27], + [82, 29], s, - [72, 27], + [83, 29], s, - [73, 27], + [84, 29], s, - [74, 27], + [85, 29], s, - [75, 29], - 35, - 68, + [86, 31], + 37, + 78, s, - [84, 27], + [95, 29], s, - [85, 27], + [96, 29], s, - [82, 27], + [93, 29], s, - [10, 7], - 70, + [10, 9], + 80, 10, 10, s, - [15, 10], + [26, 12], s, - [11, 7], - 71, + [11, 9], + 81, 11, 11, s, - [17, 10], - 82, - s, - [72, 8, 1], - 81, + [28, 12], 83, 84, - 48, - 47, - 88, - 89, - 86, - 89, - 89, + 85, s, - [94, 3], - 103, - 91, - 103, - 90, + [17, 11], s, - [19, 17], - 93, - c, - [593, 13], - 96, + [22, 3], + s, + [23, 3], + 16, + 16, + 20, + 21, + 98, + s, + [88, 8, 1], 97, + 99, + 100, + 58, + 57, + 99, + 100, + 102, + 100, + 100, + s, + [105, 3], + 114, + 107, + 114, + 106, s, - [53, 3], + [30, 17], + 109, c, - [17, 5], + [667, 13], + 112, + 113, s, - [53, 6], + [64, 3], c, - [23, 7], - 53, + [17, 5], s, - [54, 3], + [64, 7], + 39, + 64, c, - [22, 5], + [25, 6], + 64, s, - [54, 6], + [65, 3], c, - [22, 7], - 54, - 56, - 56, - 57, + [24, 5], s, - [56, 4], - 58, + [65, 7], + 39, + 65, + c, + [24, 6], + 65, s, - [56, 15], - 60, + [67, 6], + 66, + 68, s, - [56, 3], + [67, 18], + 70, + 67, + 67, s, - [62, 27], + [73, 29], s, - [63, 27], + [74, 29], s, - [64, 27], + [75, 29], s, - [68, 27], + [79, 29], s, - [83, 27], - 100, - 101, - 99, - 50, - 50, - 24, - 50, + [94, 29], + 116, + 117, + 115, + 61, + 61, + 26, + 61, c, - [226, 11], - 103, - 101, - 102, - 65, - 65, - 57, + [242, 11], + 119, + 117, + 118, + 76, + 76, + 67, s, - [65, 3], - 56, - 58, + [76, 3], + 66, + 68, s, - [65, 15], - 60, + [76, 18], + 70, + 76, + 76, + 77, + 77, + 67, s, - [65, 3], + [77, 3], 66, - 66, - 57, + 68, s, - [66, 3], - 56, - 58, + [77, 18], + 70, + 77, + 77, + 121, + 37, + 120, + 78, s, - [66, 15], - 60, + [90, 4], s, - [66, 3], - 105, - 35, - 104, - 68, + [91, 4], s, - [79, 4], + [92, 4], s, - [80, 4], + [27, 12], s, - [81, 4], + [29, 12], s, - [16, 10], + [15, 11], s, - [18, 10], + [16, 11], s, - [29, 25], + [24, 11], s, - [30, 25], + [25, 11], s, - [31, 25], + [18, 11], s, - [32, 11], + [19, 11], s, - [33, 11], + [40, 27], s, - [34, 11], + [41, 27], s, - [35, 11], + [42, 27], s, - [36, 11], + [43, 11], s, - [37, 11], + [44, 11], s, - [38, 11], + [45, 11], s, - [39, 11], - 108, - 107, + [46, 11], s, - [86, 9], - 87, - 112, - 111, - 109, - 110, + [47, 11], + s, + [48, 11], + s, + [49, 11], + s, + [50, 11], + 124, + 123, + s, + [97, 11], + 98, + 128, + 127, + 125, + 126, 3, - 83, - 95, - 95, - 102, - 102, - 114, + 99, + 106, + 106, + 113, + 113, + 130, s, - [99, 3], + [110, 3], s, - [101, 3], + [112, 3], s, - [21, 17], - 116, + [32, 17], + 132, s, - [26, 14], - 118, - 14, - 120, - 119, - 121, - 122, + [37, 14], + 134, + 16, + 136, + 135, + 137, + 138, s, - [45, 3], + [56, 3], s, - [52, 3], + [63, 3], c, - [528, 5], + [624, 5], s, - [52, 6], + [63, 7], + 39, + 63, c, - [347, 7], - 52, + [431, 6], + 63, s, - [58, 27], + [69, 29], s, - [60, 27], - 49, - 49, - 24, - 49, + [71, 29], + 60, + 60, + 26, + 60, c, - [417, 11], + [505, 11], s, - [59, 27], + [70, 29], s, - [61, 27], + [72, 29], s, - [76, 27], + [87, 29], s, - [77, 27], + [88, 29], s, - [78, 4], + [89, 4], s, - [97, 13], + [108, 13], s, - [98, 13], + [109, 13], s, - [90, 3], + [101, 3], s, - [91, 3], + [102, 3], s, - [92, 3], + [103, 3], s, - [93, 3], + [104, 3], c, - [828, 4], + [940, 4], s, - [100, 3], - 125, + [111, 3], + 141, c, - [814, 13], - 24, - 24, - 127, + [926, 13], + 35, + 35, + 143, s, - [24, 15], + [35, 15], s, - [27, 18], + [38, 18], s, - [28, 18], + [39, 18], s, - [41, 14], + [52, 14], s, - [42, 14], - 128, + [53, 14], + 144, s, - [43, 14], - 48, - 48, - 24, - 48, + [54, 14], + 59, + 59, + 26, + 59, c, - [926, 12], - 96, + [112, 11], + 107, + 107, s, - [22, 17], + [33, 17], s, - [25, 14], + [36, 14], s, - [23, 17], + [34, 17], s, - [46, 3] + [57, 3] ]) }), defaultActions: bda({ @@ -3085,105 +3372,121 @@ defaultActions: bda({ 2, 6, 7, - s, - [11, 4, 1], + 11, + 12, + 13, 16, - 17, + 18, 19, + 21, s, - [28, 8, 1], - 37, - 38, + [30, 8, 1], 39, - 41, - 43, + 40, + s, + [41, 4, 2], 48, - 50, + 49, + 52, + 53, + 58, + 60, s, - [56, 5, 1], + [66, 5, 1], s, - [67, 16, 1], - 84, - 85, - 88, - 90, - 91, - 92, - 97, - 99, + [77, 22, 1], 100, + 101, + 104, + 106, + 107, + 108, + 113, + 115, + 116, s, - [102, 11, 1], - 114, + [118, 11, 1], + 130, s, - [117, 4, 1], - 122, + [133, 4, 1], + 138, s, - [124, 5, 1] + [140, 5, 1] ]), goto: u([ 6, 8, 7, - 20, + 31, 12, 13, 14, - 40, + 51, 1, 2, 9, - 67, + 78, s, - [69, 7, 1], - 84, - 85, - 82, - 15, + [80, 7, 1], + 95, + 96, + 93, + 26, + 28, 17, - 94, - 19, - 62, - 63, - 64, - 68, - 83, + 22, + 23, + 20, + 21, + 105, + 30, + 73, + 74, + 75, 79, - 80, - 81, + 94, + 90, + 91, + 92, + 27, + 29, + 15, 16, + 24, + 25, 18, + 19, s, - [29, 11, 1], - 86, - 87, - 95, - 99, - 101, - 21, - 45, - 58, - 60, - 59, - 61, - 76, - 77, - 78, + [40, 11, 1], 97, 98, + 106, + 110, + 112, + 32, + 56, + 69, + 71, + 70, + 72, + 87, + 88, + 89, + 108, + 109, s, - [90, 4, 1], - 100, - 27, - 28, - 41, - 42, - 43, - 96, - 22, - 25, - 23, - 46 + [101, 4, 1], + 111, + 38, + 39, + 52, + 53, + 54, + 107, + 33, + 36, + 34, + 57 ]) }), parseError: function parseError(str, hash, ExceptionClass) { @@ -3207,7 +3510,7 @@ parse: function parse(input) { var table = this.table; var sp = 0; // 'stack pointer': index into the stacks var yyloc; - var yytext; + var yylineno; @@ -3219,7 +3522,7 @@ parse: function parse(input) { var TERROR = this.TERROR; var EOF = this.EOF; var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; - var NO_ACTION = [0, 129 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -3884,7 +4187,7 @@ parse: function parse(input) { stack[sp] = 0; ++sp; - yytext = lexer.yytext; + @@ -4003,7 +4306,7 @@ parse: function parse(input) { // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: - yytext = lexer.yytext; + yyloc = lexer.yylloc; @@ -4089,7 +4392,7 @@ parse: function parse(input) { - r = this.performAction.call(yyval, yytext, yyloc, NO_ACTION[1], sp - 1, yyrulelen, vstack, lstack, stack, sstack); + r = this.performAction.call(yyval, yyloc, NO_ACTION[1], sp - 1, vstack, lstack); if (typeof r !== 'undefined') { retval = r; @@ -4222,7 +4525,7 @@ parse: function parse(input) { if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: - yytext = lexer.yytext; + yyloc = lexer.yylloc; @@ -4292,7 +4595,7 @@ parse: function parse(input) { - r = this.performAction.call(yyval, yytext, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack); + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); if (typeof r !== 'undefined') { // signal end of error recovery loop AND end of outer parse loop @@ -4421,7 +4724,7 @@ parse: function parse(input) { if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: - yytext = lexer.yytext; + yyloc = lexer.yylloc; @@ -4490,7 +4793,7 @@ parse: function parse(input) { - r = this.performAction.call(yyval, yytext, yyloc, newState, sp - 1, yyrulelen, vstack, lstack, stack, sstack); + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { var prereduceValue = vstack.slice(sp - yyrulelen, sp); @@ -4961,7 +5264,7 @@ var lexer = (function() { // // uses yyleng: ..................... false // uses yylineno: ................... false - // uses yytext: ..................... true + // uses yytext: ..................... false // uses yylloc: ..................... false // uses lexer values: ............... true/ true // location tracking: ............... true @@ -6113,7 +6416,7 @@ var lexer = (function() { var YYSTATE = YY_START; switch (yyrulenumber) { case 0: - /*! Conditions:: rules macro INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %\{ */ @@ -6122,7 +6425,7 @@ var lexer = (function() { this.pushState("action"); this.unput(yy_.yytext); yy_.yytext = ""; - return 25; + return 28; break; case 1: /*! Conditions:: action */ @@ -6131,7 +6434,7 @@ var lexer = (function() { yy_.yytext = this.matches[1]; yy.include_command_allowed = true; - return 29; + return 32; break; case 2: /*! Conditions:: action */ @@ -6144,11 +6447,11 @@ var lexer = (function() { // - one %include per action chunk // - one %include replaces an entire action chunk this.pushState("path"); - return 49; + return 51; } else { // TODO yy_.yyerror("oops!"); - return 34; + return 37; } break; case 3: @@ -6157,7 +6460,7 @@ var lexer = (function() { /*! Rule:: {WS}*\/\*[^]*?\*\/ */ //yy.include_command_allowed = false; -- doesn't impact include-allowed state - return 31; + return 34; break; case 4: /*! Conditions:: action */ @@ -6165,7 +6468,7 @@ var lexer = (function() { /*! Rule:: {WS}*\/\/.* */ yy.include_command_allowed = false; - return 32; + return 35; break; case 6: /*! Conditions:: action */ @@ -6176,9 +6479,9 @@ var lexer = (function() { this.popState(); this.unput(yy_.yytext); yy_.yytext = ""; - return 28; + return 31; } else { - return 30; + return 33; } break; case 7: @@ -6190,9 +6493,9 @@ var lexer = (function() { this.popState(); this.unput(yy_.yytext); yy_.yytext = ""; - return 28; + return 31; } else { - return 30; + return 33; } break; case 9: @@ -6201,7 +6504,7 @@ var lexer = (function() { /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ yy.include_command_allowed = false; - return 30; + return 33; break; case 10: /*! Conditions:: action */ @@ -6209,7 +6512,7 @@ var lexer = (function() { /*! Rule:: \/[^}{BR}]* */ yy.include_command_allowed = false; - return 30; + return 33; break; case 11: /*! Conditions:: action */ @@ -6217,7 +6520,7 @@ var lexer = (function() { /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ yy.include_command_allowed = false; - return 30; + return 33; break; case 12: /*! Conditions:: action */ @@ -6225,7 +6528,7 @@ var lexer = (function() { /*! Rule:: '{QUOTED_STRING_CONTENT}' */ yy.include_command_allowed = false; - return 30; + return 33; break; case 13: /*! Conditions:: action */ @@ -6233,7 +6536,7 @@ var lexer = (function() { /*! Rule:: `{ES2017_STRING_CONTENT}` */ yy.include_command_allowed = false; - return 30; + return 33; break; case 14: /*! Conditions:: action */ @@ -6241,7 +6544,7 @@ var lexer = (function() { /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ yy.include_command_allowed = false; - return 30; + return 33; break; case 15: /*! Conditions:: action */ @@ -6250,7 +6553,7 @@ var lexer = (function() { yy.depth++; yy.include_command_allowed = false; - return 30; + return 33; break; case 16: /*! Conditions:: action */ @@ -6275,7 +6578,7 @@ var lexer = (function() { } else { yy.depth--; } - return 30; + return 33; break; case 17: /*! Conditions:: action */ @@ -6283,7 +6586,7 @@ var lexer = (function() { /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|]) */ yy.include_command_allowed = true; - return 33; // keep empty lines as-is inside action code blocks. + return 36; // keep empty lines as-is inside action code blocks. break; case 18: /*! Conditions:: action */ @@ -6292,13 +6595,13 @@ var lexer = (function() { if (yy.depth > 0) { yy.include_command_allowed = true; - return 33; // keep empty lines as-is inside action code blocks. + return 36; // keep empty lines as-is inside action code blocks. } else { // end of action code chunk this.popState(); this.unput(yy_.yytext); yy_.yytext = ""; - return 28; + return 31; } break; case 19: @@ -6325,7 +6628,7 @@ var lexer = (function() { } this.popState(); yy_.yytext = ""; - return 28; + return 31; break; case 21: /*! Conditions:: conditions */ @@ -6346,7 +6649,7 @@ var lexer = (function() { case 25: /*! Conditions:: INITIAL start_condition macro path options */ - /*! Rule:: {WS}*\/\*(.|\n|\r)*?\*\/ */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ /* skip multi-line comment */ @@ -6378,7 +6681,7 @@ var lexer = (function() { case 29: /*! Conditions:: rules */ - /*! Rule:: \/\*(.|\n|\r)*?\*\/ */ + /*! Rule:: \/\*[^]*?\*\/ */ /* skip multi-line comment */ @@ -6391,7 +6694,7 @@ var lexer = (function() { yy.depth = 0; yy.include_command_allowed = true; this.pushState("action"); - return 25; + return 28; break; case 31: /*! Conditions:: rules */ @@ -6409,7 +6712,7 @@ var lexer = (function() { // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 44; + return 46; break; case 35: /*! Conditions:: options */ @@ -6417,7 +6720,7 @@ var lexer = (function() { /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ yy_.yytext = unescQuote(this.matches[1], /\\"/g); - return 47; // value is always a string type + return 49; // value is always a string type break; case 36: /*! Conditions:: options */ @@ -6425,7 +6728,7 @@ var lexer = (function() { /*! Rule:: '{QUOTED_STRING_CONTENT}' */ yy_.yytext = unescQuote(this.matches[1], /\\'/g); - return 47; // value is always a string type + return 49; // value is always a string type break; case 37: /*! Conditions:: options */ @@ -6433,7 +6736,7 @@ var lexer = (function() { /*! Rule:: `{ES2017_STRING_CONTENT}` */ yy_.yytext = unescQuote(this.matches[1], /\\`/g); - return 47; // value is always a string type + return 49; // value is always a string type break; case 39: /*! Conditions:: options */ @@ -6449,7 +6752,7 @@ var lexer = (function() { /*! Rule:: {BR} */ this.popState(); - return 46; + return 48; break; case 41: /*! Conditions:: options */ @@ -6474,7 +6777,7 @@ var lexer = (function() { /* empty */ break; - case 45: + case 46: /*! Conditions:: INITIAL */ /*! Rule:: {ID} */ @@ -6482,118 +6785,134 @@ var lexer = (function() { this.pushState("macro"); return 20; break; - case 46: - /*! Conditions:: macro */ + case 47: + /*! Conditions:: macro named_chunk */ /*! Rule:: {BR}+ */ this.popState(); break; - case 47: + case 48: /*! Conditions:: macro */ /*! Rule:: {ANY_LITERAL_CHAR}+ */ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is - return 44; + return 46; break; - case 48: - /*! Conditions:: rules macro INITIAL */ + case 49: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: {BR}+ */ /* empty */ break; - case 49: - /*! Conditions:: rules macro INITIAL */ + case 50: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \s+ */ /* empty */ break; - case 50: - /*! Conditions:: rules macro INITIAL */ + case 51: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ yy_.yytext = unescQuote(this.matches[1], /\\"/g); - return 43; + return 26; break; - case 51: - /*! Conditions:: rules macro INITIAL */ + case 52: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ yy_.yytext = unescQuote(this.matches[1], /\\'/g); - return 43; + return 26; break; - case 52: - /*! Conditions:: rules macro INITIAL */ + case 53: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \[ */ this.pushState("set"); - return 38; + return 41; break; - case 65: - /*! Conditions:: rules macro INITIAL */ + case 66: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: < */ this.pushState("conditions"); return 5; break; - case 66: - /*! Conditions:: rules macro INITIAL */ + case 67: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \/! */ - return 36; // treated as `(?!atom)` + return 39; // treated as `(?!atom)` break; - case 67: - /*! Conditions:: rules macro INITIAL */ + case 68: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \/ */ return 14; // treated as `(?=atom)` break; - case 69: - /*! Conditions:: rules macro INITIAL */ + case 70: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \\. */ yy_.yytext = yy_.yytext.replace(/^\\/g, ""); - return 41; + return 44; break; - case 72: - /*! Conditions:: rules macro INITIAL */ + case 73: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %options\b */ this.pushState("options"); - return 45; + return 47; break; - case 73: - /*! Conditions:: rules macro INITIAL */ + case 74: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %s\b */ this.pushState("start_condition"); return 21; break; - case 74: - /*! Conditions:: rules macro INITIAL */ + case 75: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %x\b */ this.pushState("start_condition"); return 22; break; - case 75: - /*! Conditions:: rules macro INITIAL */ + case 76: + /*! Conditions:: rules macro named_chunk INITIAL */ + + /*! Rule:: %code\b */ + + this.pushState("named_chunk"); + return 25; + break; + case 77: + /*! Conditions:: rules macro named_chunk INITIAL */ + + /*! Rule:: %import\b */ + + this.pushState("named_chunk"); + return 24; + break; + case 78: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %include\b */ @@ -6602,17 +6921,17 @@ var lexer = (function() { this.pushState("action"); this.unput(yy_.yytext); yy_.yytext = ""; - return 25; + return 28; break; - case 76: + case 79: /*! Conditions:: code */ /*! Rule:: %include\b */ this.pushState("path"); - return 49; + return 51; break; - case 77: + case 80: /*! Conditions:: INITIAL rules code */ /*! Rule:: %{NAME}([^\r\n]*) */ @@ -6637,30 +6956,30 @@ var lexer = (function() { ]; return 23; break; - case 78: - /*! Conditions:: rules macro INITIAL */ + case 81: + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %% */ this.pushState("rules"); return 19; break; - case 86: + case 89: /*! Conditions:: set */ /*! Rule:: \] */ this.popState(); - return 39; + return 42; break; - case 88: + case 91: /*! Conditions:: code */ /*! Rule:: [^\r\n]+ */ - return 51; // the bit of CODE just before EOF... + return 53; // the bit of CODE just before EOF... break; - case 89: + case 92: /*! Conditions:: path */ /*! Rule:: {BR} */ @@ -6668,40 +6987,40 @@ var lexer = (function() { this.popState(); this.unput(yy_.yytext); break; - case 90: + case 93: /*! Conditions:: path */ /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ yy_.yytext = unescQuote(this.matches[1]); this.popState(); - return 50; + return 52; break; - case 91: + case 94: /*! Conditions:: path */ /*! Rule:: '{QUOTED_STRING_CONTENT}' */ yy_.yytext = unescQuote(this.matches[1]); this.popState(); - return 50; + return 52; break; - case 92: + case 95: /*! Conditions:: path */ /*! Rule:: {WS}+ */ // skip whitespace in the line break; - case 93: + case 96: /*! Conditions:: path */ /*! Rule:: [^\s\r\n]+ */ this.popState(); - return 50; + return 52; break; - case 94: + case 97: /*! Conditions:: action */ /*! Rule:: " */ @@ -6716,7 +7035,7 @@ var lexer = (function() { ); return 2; break; - case 95: + case 98: /*! Conditions:: action */ /*! Rule:: ' */ @@ -6731,7 +7050,7 @@ var lexer = (function() { ); return 2; break; - case 96: + case 99: /*! Conditions:: action */ /*! Rule:: ` */ @@ -6746,7 +7065,7 @@ var lexer = (function() { ); return 2; break; - case 97: + case 100: /*! Conditions:: options */ /*! Rule:: " */ @@ -6761,7 +7080,7 @@ var lexer = (function() { ); return 2; break; - case 98: + case 101: /*! Conditions:: options */ /*! Rule:: ' */ @@ -6776,7 +7095,7 @@ var lexer = (function() { ); return 2; break; - case 99: + case 102: /*! Conditions:: options */ /*! Rule:: ` */ @@ -6791,7 +7110,7 @@ var lexer = (function() { ); return 2; break; - case 100: + case 103: /*! Conditions:: * */ /*! Rule:: " */ @@ -6808,7 +7127,7 @@ var lexer = (function() { ); return 2; break; - case 101: + case 104: /*! Conditions:: * */ /*! Rule:: ' */ @@ -6825,7 +7144,7 @@ var lexer = (function() { ); return 2; break; - case 102: + case 105: /*! Conditions:: * */ /*! Rule:: ` */ @@ -6842,7 +7161,7 @@ var lexer = (function() { ); return 2; break; - case 103: + case 106: /*! Conditions:: macro rules */ /*! Rule:: . */ @@ -6866,7 +7185,7 @@ var lexer = (function() { this.prettyPrintRange(this, yy_.yylloc) ); break; - case 104: + case 107: /*! Conditions:: * */ /*! Rule:: . */ @@ -6892,12 +7211,12 @@ var lexer = (function() { /*! Rule:: {WS}+ */ - 5: 33, + 5: 36, /*! Conditions:: action */ /*! Rule:: % */ - 8: 30, + 8: 33, /*! Conditions:: conditions */ /*! Rule:: {NAME} */ @@ -6927,132 +7246,137 @@ var lexer = (function() { /*! Rule:: [^\s\r\n]+ */ - 38: 48, + 38: 50, /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 42: 24, - /*! Conditions:: rules macro INITIAL */ + 42: 27, + /*! Conditions:: named_chunk */ + + /*! Rule:: {ID} */ + + 45: 20, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \| */ - 53: 9, - /*! Conditions:: rules macro INITIAL */ + 54: 9, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \(\?: */ - 54: 35, - /*! Conditions:: rules macro INITIAL */ + 55: 38, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \(\?= */ - 55: 35, - /*! Conditions:: rules macro INITIAL */ + 56: 38, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \(\?! */ - 56: 35, - /*! Conditions:: rules macro INITIAL */ + 57: 38, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \( */ - 57: 10, - /*! Conditions:: rules macro INITIAL */ + 58: 10, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \) */ - 58: 11, - /*! Conditions:: rules macro INITIAL */ + 59: 11, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \+ */ - 59: 12, - /*! Conditions:: rules macro INITIAL */ + 60: 12, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \* */ - 60: 7, - /*! Conditions:: rules macro INITIAL */ + 61: 7, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \? */ - 61: 13, - /*! Conditions:: rules macro INITIAL */ + 62: 13, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \^ */ - 62: 16, - /*! Conditions:: rules macro INITIAL */ + 63: 16, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: , */ - 63: 8, - /*! Conditions:: rules macro INITIAL */ + 64: 8, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: <> */ - 64: 17, - /*! Conditions:: rules macro INITIAL */ + 65: 17, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 68: 41, - /*! Conditions:: rules macro INITIAL */ + 69: 44, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \$ */ - 70: 17, - /*! Conditions:: rules macro INITIAL */ + 71: 17, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \. */ - 71: 15, - /*! Conditions:: rules macro INITIAL */ + 72: 15, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \{\d+(,\s*\d+|,)?\} */ - 79: 42, - /*! Conditions:: rules macro INITIAL */ + 82: 45, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \{{ID}\} */ - 80: 37, + 83: 40, /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 81: 37, - /*! Conditions:: rules macro INITIAL */ + 84: 40, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \{ */ - 82: 3, - /*! Conditions:: rules macro INITIAL */ + 85: 3, + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \} */ - 83: 4, + 86: 4, /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 84: 40, + 87: 43, /*! Conditions:: set */ /*! Rule:: \{ */ - 85: 40, + 88: 43, /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 87: 51, + 90: 53, /*! Conditions:: * */ /*! Rule:: $ */ - 105: 1 + 108: 1 }, rules: [ /* 0: */ /^(?:%\{)/, @@ -7083,11 +7407,11 @@ var lexer = (function() { /* 22: */ /^(?:,)/, /* 23: */ /^(?:\*)/, /* 24: */ /^(?:([^\S\n\r])*\/\/[^\n\r]*)/, - /* 25: */ /^(?:([^\S\n\r])*\/\*(.|\n|\r)*?\*\/)/, + /* 25: */ new XRegExp("^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)", ""), /* 26: */ /^(?:(\r\n|\n|\r)+)/, /* 27: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, /* 28: */ /^(?:\/\/[^\r\n]*)/, - /* 29: */ /^(?:\/\*(.|\n|\r)*?\*\/)/, + /* 29: */ new XRegExp("^(?:\\/\\*[^]*?\\*\\/)", ""), /* 30: */ /^(?:([^\S\n\r])+(?=[^\s%|]))/, /* 31: */ /^(?:%%)/, /* 32: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, @@ -7113,75 +7437,81 @@ var lexer = (function() { "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", "" ), - /* 46: */ /^(?:(\r\n|\n|\r)+)/, - /* 47: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, - /* 48: */ /^(?:(\r\n|\n|\r)+)/, - /* 49: */ /^(?:\s+)/, - /* 50: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 51: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 52: */ /^(?:\[)/, - /* 53: */ /^(?:\|)/, - /* 54: */ /^(?:\(\?:)/, - /* 55: */ /^(?:\(\?=)/, - /* 56: */ /^(?:\(\?!)/, - /* 57: */ /^(?:\()/, - /* 58: */ /^(?:\))/, - /* 59: */ /^(?:\+)/, - /* 60: */ /^(?:\*)/, - /* 61: */ /^(?:\?)/, - /* 62: */ /^(?:\^)/, - /* 63: */ /^(?:,)/, - /* 64: */ /^(?:<>)/, - /* 65: */ /^(?:<)/, - /* 66: */ /^(?:\/!)/, - /* 67: */ /^(?:\/)/, - /* 68: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, - /* 69: */ /^(?:\\.)/, - /* 70: */ /^(?:\$)/, - /* 71: */ /^(?:\.)/, - /* 72: */ /^(?:%options\b)/, - /* 73: */ /^(?:%s\b)/, - /* 74: */ /^(?:%x\b)/, - /* 75: */ /^(?:%include\b)/, - /* 76: */ /^(?:%include\b)/, - /* 77: */ new XRegExp( - "^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))", + /* 46: */ new XRegExp( + "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", "" ), - /* 78: */ /^(?:%%)/, - /* 79: */ /^(?:\{\d+(,\s*\d+|,)?\})/, + /* 47: */ /^(?:(\r\n|\n|\r)+)/, + /* 48: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 49: */ /^(?:(\r\n|\n|\r)+)/, + /* 50: */ /^(?:\s+)/, + /* 51: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 52: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 53: */ /^(?:\[)/, + /* 54: */ /^(?:\|)/, + /* 55: */ /^(?:\(\?:)/, + /* 56: */ /^(?:\(\?=)/, + /* 57: */ /^(?:\(\?!)/, + /* 58: */ /^(?:\()/, + /* 59: */ /^(?:\))/, + /* 60: */ /^(?:\+)/, + /* 61: */ /^(?:\*)/, + /* 62: */ /^(?:\?)/, + /* 63: */ /^(?:\^)/, + /* 64: */ /^(?:,)/, + /* 65: */ /^(?:<>)/, + /* 66: */ /^(?:<)/, + /* 67: */ /^(?:\/!)/, + /* 68: */ /^(?:\/)/, + /* 69: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 70: */ /^(?:\\.)/, + /* 71: */ /^(?:\$)/, + /* 72: */ /^(?:\.)/, + /* 73: */ /^(?:%options\b)/, + /* 74: */ /^(?:%s\b)/, + /* 75: */ /^(?:%x\b)/, + /* 76: */ /^(?:%code\b)/, + /* 77: */ /^(?:%import\b)/, + /* 78: */ /^(?:%include\b)/, + /* 79: */ /^(?:%include\b)/, /* 80: */ new XRegExp( + "^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))", + "" + ), + /* 81: */ /^(?:%%)/, + /* 82: */ /^(?:\{\d+(,\s*\d+|,)?\})/, + /* 83: */ new XRegExp( "^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", "" ), - /* 81: */ new XRegExp( + /* 84: */ new XRegExp( "^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", "" ), - /* 82: */ /^(?:\{)/, - /* 83: */ /^(?:\})/, - /* 84: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, /* 85: */ /^(?:\{)/, - /* 86: */ /^(?:\])/, - /* 87: */ /^(?:[^\r\n]*(\r|\n)+)/, - /* 88: */ /^(?:[^\r\n]+)/, - /* 89: */ /^(?:(\r\n|\n|\r))/, - /* 90: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 91: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 92: */ /^(?:([^\S\n\r])+)/, - /* 93: */ /^(?:\S+)/, - /* 94: */ /^(?:")/, - /* 95: */ /^(?:')/, - /* 96: */ /^(?:`)/, + /* 86: */ /^(?:\})/, + /* 87: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 88: */ /^(?:\{)/, + /* 89: */ /^(?:\])/, + /* 90: */ /^(?:[^\r\n]*(\r|\n)+)/, + /* 91: */ /^(?:[^\r\n]+)/, + /* 92: */ /^(?:(\r\n|\n|\r))/, + /* 93: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 94: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 95: */ /^(?:([^\S\n\r])+)/, + /* 96: */ /^(?:\S+)/, /* 97: */ /^(?:")/, /* 98: */ /^(?:')/, /* 99: */ /^(?:`)/, /* 100: */ /^(?:")/, /* 101: */ /^(?:')/, /* 102: */ /^(?:`)/, - /* 103: */ /^(?:.)/, - /* 104: */ /^(?:.)/, - /* 105: */ /^(?:$)/ + /* 103: */ /^(?:")/, + /* 104: */ /^(?:')/, + /* 105: */ /^(?:`)/, + /* 106: */ /^(?:.)/, + /* 107: */ /^(?:.)/, + /* 108: */ /^(?:$)/ ], conditions: { rules: { @@ -7194,7 +7524,6 @@ var lexer = (function() { 30, 31, 32, - 48, 49, 50, 51, @@ -7222,18 +7551,21 @@ var lexer = (function() { 73, 74, 75, + 76, 77, 78, - 79, 80, + 81, 82, 83, - 100, - 101, - 102, + 85, + 86, 103, 104, - 105 + 105, + 106, + 107, + 108 ], inclusive: true }, @@ -7242,7 +7574,6 @@ var lexer = (function() { 0, 24, 25, - 46, 47, 48, 49, @@ -7272,26 +7603,77 @@ var lexer = (function() { 73, 74, 75, + 76, + 77, 78, - 79, - 80, + 81, 82, 83, - 100, - 101, - 102, + 85, + 86, + 103, + 104, + 105, + 106, + 107, + 108 + ], + inclusive: true + }, + named_chunk: { + rules: [ + 0, + 45, + 47, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 81, + 82, + 83, + 85, + 86, 103, 104, - 105 + 105, + 107, + 108 ], inclusive: true }, code: { - rules: [76, 77, 87, 88, 100, 101, 102, 104, 105], + rules: [79, 80, 90, 91, 103, 104, 105, 107, 108], inclusive: false }, start_condition: { - rules: [24, 25, 42, 43, 44, 100, 101, 102, 104, 105], + rules: [24, 25, 42, 43, 44, 103, 104, 105, 107, 108], inclusive: false }, options: { @@ -7307,20 +7689,20 @@ var lexer = (function() { 39, 40, 41, - 81, - 97, - 98, - 99, + 84, 100, 101, 102, + 103, 104, - 105 + 105, + 107, + 108 ], inclusive: false }, conditions: { - rules: [20, 21, 22, 23, 100, 101, 102, 104, 105], + rules: [20, 21, 22, 23, 103, 104, 105, 107, 108], inclusive: false }, action: { @@ -7344,23 +7726,23 @@ var lexer = (function() { 17, 18, 19, - 94, - 95, - 96, - 100, - 101, - 102, + 97, + 98, + 99, + 103, 104, - 105 + 105, + 107, + 108 ], inclusive: false }, path: { - rules: [24, 25, 89, 90, 91, 92, 93, 100, 101, 102, 104, 105], + rules: [24, 25, 92, 93, 94, 95, 96, 103, 104, 105, 107, 108], inclusive: false }, set: { - rules: [81, 84, 85, 86, 100, 101, 102, 104, 105], + rules: [84, 87, 88, 89, 103, 104, 105, 107, 108], inclusive: false }, INITIAL: { @@ -7368,8 +7750,7 @@ var lexer = (function() { 0, 24, 25, - 45, - 48, + 46, 49, 50, 51, @@ -7397,17 +7778,20 @@ var lexer = (function() { 73, 74, 75, + 76, 77, 78, - 79, 80, + 81, 82, 83, - 100, - 101, - 102, + 85, + 86, + 103, 104, - 105 + 105, + 107, + 108 ], inclusive: true } diff --git a/lex.l b/lex.l index ba0653f..d02e78e 100644 --- a/lex.l +++ b/lex.l @@ -29,7 +29,7 @@ ES2017_STRING_CONTENT (?:\\\`|\\[^\`]|[^\\\`])* ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] -%s rules macro +%s rules macro named_chunk %x code start_condition options conditions action path set @@ -182,14 +182,14 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] // *except* the code/action blocks: {WS}*"//"[^\r\n]* /* skip single-line comment */ -{WS}*"/*"(.|\n|\r)*?"*/" +{WS}*"/*"[^]*?"*/" /* skip multi-line comment */ {BR}+ /* empty */ {WS}+{BR}+ /* empty */ "//"[^\r\n]* /* skip single-line comment */ -"/*"(.|\n|\r)*?"*/" +"/*"[^]*?"*/" /* skip multi-line comment */ // ACTION code chunks follow rules and are generally indented, but // never start with characters special to the lex language itself: @@ -229,8 +229,9 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR}+ this.popState(); {WS}+ /* empty */ +{ID} return 'NAME'; {ID} this.pushState('macro'); return 'NAME'; -{BR}+ this.popState(); +{BR}+ this.popState(); // Accept any non-regex-special character as a direct literal without // the need to put quotes around it: @@ -276,6 +277,9 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "%s" this.pushState('start_condition'); return 'START_INC'; "%x" this.pushState('start_condition'); return 'START_EXC'; +"%code" this.pushState('named_chunk'); return 'INIT_CODE'; +"%import" this.pushState('named_chunk'); return 'IMPORT'; + "%include" yy.depth = 0; yy.include_command_allowed = true; this.pushState('action'); diff --git a/lex.y b/lex.y index daaa5ec..8127552 100644 --- a/lex.y +++ b/lex.y @@ -57,7 +57,7 @@ lex Technical error report: ${$error.errStr} - `); + `); } ; @@ -131,6 +131,78 @@ definition { $$ = null; } | UNKNOWN_DECL { $$ = {type: 'unknown', body: $1}; } + | IMPORT import_name import_path + { $$ = {type: 'imports', name: $import_name, path: $import_path}; } + | IMPORT import_name error + { + yyerror(rmCommonWS` + You did not specify a legal file path for the '%import' initialization code statement, which must have the format: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, @error, @IMPORT)} + + Technical error report: + ${$error.errStr} + `); + } + | IMPORT error + { + yyerror(rmCommonWS` + %import name or source filename missing maybe? + + Note: each '%import'-ed initialization code section must be qualified by a name, e.g. 'required' before the import path itself: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, @error, @IMPORT)} + + Technical error report: + ${$error.errStr} + `); + } + | INIT_CODE init_code_name action + { + $$ = { + type: 'codesection', + qualifier: $init_code_name, + include: $action + }; + } + | INIT_CODE error action + { + yyerror(rmCommonWS` + Each '%code' initialization code section must be qualified by a name, e.g. 'required' before the action code itself: + %code qualifier_name {action code} + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, @error, @INIT_CODE, @action)} + + Technical error report: + ${$error.errStr} + `); + } + ; + +init_code_name + : NAME + { $$ = $NAME; } + | STRING_LIT + { $$ = $STRING_LIT; } + ; + +import_name + : NAME + { $$ = $NAME; } + | STRING_LIT + { $$ = $STRING_LIT; } + ; + +import_path + : NAME + { $$ = $NAME; } + | STRING_LIT + { $$ = $STRING_LIT; } ; names_inclusive @@ -180,7 +252,11 @@ rules_collective block. Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo(##start_conditions, ##4), @start_conditions)); + ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo(##start_conditions, ##4), @start_conditions)} + + Technical error report: + ${$error.errStr} + `); } | start_conditions '{' error { @@ -191,7 +267,11 @@ rules_collective as a terminating curly brace '}' could not be found. Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, @error, @start_conditions)); + ${yylexer.prettyPrintRange(yylexer, @error, @start_conditions)} + + Technical error report: + ${$error.errStr} + `); } ; @@ -210,49 +290,54 @@ rule | regex error { $$ = [$regex, $error]; - console.log('############# DUMP:', { - yysp, - yyrulelength, - yyvstack, - yystack, - yysstack, - error: $error, - text: yytext - }); - yyerror("lexer rule regex action code declaration error?\n\n Erroneous area:\n" + yylexer.prettyPrintRange(yylexer, @error, @regex)); + yyerror(rmCommonWS` + Lexer rule regex action code declaration error? + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, @error, @regex)} + + Technical error report: + ${$error.errStr} + `); } ; action : ACTION_START action_body BRACKET_MISSING { - yyerror("Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + yylexer.prettyPrintRange(yylexer, @BRACKET_MISSING, @1)); + yyerror(rmCommonWS` + Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, @BRACKET_MISSING, @1)} + `); } | ACTION_START action_body BRACKET_SURPLUS { - yyerror("Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'.\n\n Offending action body:\n" + yylexer.prettyPrintRange(yylexer, @BRACKET_SURPLUS, @1)); + yyerror(rmCommonWS` + Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, @BRACKET_SURPLUS, @1)} + `); } | ACTION_START action_body ACTION_END { - if (0) { - $$ = 'XXX' + $action_body + 'YYY'; + var s = $action_body.trim(); + // remove outermost set of braces UNLESS there's + // a curly brace in there anywhere: in that case + // we should leave it up to the sophisticated + // code analyzer to simplify the code! + // + // This is a very rough check as it will also look + // inside code comments, which should not have + // any influence. + // + // Nevertheless: this is a *safe* transform! + if (s[0] === '{' && s.indexOf('}') === s.length - 1) { + $$ = s.substring(1, s.length - 1).trim(); } else { - var s = $action_body.trim(); - // remove outermost set of braces UNLESS there's - // a curly brace in there anywhere: in that case - // we should leave it up to the sophisticated - // code analyzer to simplify the code! - // - // This is a very rough check as it ill also look - // inside code comments, which should not have - // any influence. - // - // Nevertheless: this is a *safe* transform! - if (s[0] === '{' && s.indexOf('}') === s.length - 1) { - $$ = s.substring(1, s.length - 1).trim(); - } else { - $$ = s; - } + $$ = s; } } ; @@ -272,16 +357,24 @@ action_body { $$ = $action_body + '\n\n' + $include_macro_code + '\n\n'; } | action_body INCLUDE_PLACEMENT_ERROR { - yyerror("" + - " You may place the '%include' instruction only at the start/front of" + - " a line. " + -"" + - " It's use is not permitted at this position:" + - "" + yylexer.prettyPrintRange(yylexer, @INCLUDE_PLACEMENT_ERROR, @action_body)); + yyerror(rmCommonWS` + You may place the '%include' instruction only at the start/front of a line. + + It's use is not permitted at this position: + ${yylexer.prettyPrintRange(yylexer, @INCLUDE_PLACEMENT_ERROR, @action_body)} + `); } | action_body error { - yyerror("Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block.\n\n Offending action body part:\n" + yylexer.prettyPrintRange(yylexer, @error, @action_body)); + yyerror(rmCommonWS` + Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, @error, @action_body)} + + Technical error report: + ${$error.errStr} + `); } | ε { $$ = ''; } @@ -292,7 +385,15 @@ start_conditions { $$ = $name_list; } | '<' name_list error { - yyerror("Seems you did not correctly terminate the start condition set <" + $name_list.join(',') + ",???> with a terminating '>'\n\n Erroneous area:\n" + yylexer.prettyPrintRange(yylexer, @error, @1)); + yyerror(rmCommonWS` + Seems you did not correctly terminate the start condition set <${$name_list.join(',')},???> with a terminating '>' + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, @error, @1)} + + Technical error report: + ${$error.errStr} + `); } | '<' '*' '>' { $$ = ['*']; } @@ -409,11 +510,27 @@ regex_base { $$ = $SPECIAL_GROUP + $regex_list + ')'; } | '(' regex_list error { - yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + yylexer.prettyPrintRange(yylexer, @error, @1)); + yyerror(rmCommonWS` + Seems you did not correctly bracket a lex rule regex part in '(...)' braces. + + Unterminated regex part: + ${yylexer.prettyPrintRange(yylexer, @error, @1)} + + Technical error report: + ${$error.errStr} + `); } | SPECIAL_GROUP regex_list error { - yyerror("Seems you did not correctly bracket a lex rule regex part in '(...)' braces.\n\n Unterminated regex part:\n" + yylexer.prettyPrintRange(yylexer, @error, @SPECIAL_GROUP)); + yyerror(rmCommonWS` + Seems you did not correctly bracket a lex rule regex part in '(...)' braces. + + Unterminated regex part: + ${yylexer.prettyPrintRange(yylexer, @error, @SPECIAL_GROUP)} + + Technical error report: + ${$error.errStr} + `); } | regex_base '+' { $$ = $regex_base + '+'; } @@ -448,7 +565,15 @@ any_group_regex { $$ = $REGEX_SET_START + $regex_set + $REGEX_SET_END; } | REGEX_SET_START regex_set error { - yyerror("Seems you did not correctly bracket a lex rule regex set in '[...]' brackets.\n\n Unterminated regex set:\n" + yylexer.prettyPrintRange(yylexer, @error, @REGEX_SET_START)); + yyerror(rmCommonWS` + Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. + + Unterminated regex set: + ${yylexer.prettyPrintRange(yylexer, @error, @REGEX_SET_START)} + + Technical error report: + ${$error.errStr} + `); } ; @@ -515,19 +640,27 @@ option { // TODO ... yyerror(rmCommonWS` - internal error: option "${$option}" value assignment failure. + Internal error: option "${$option}" value assignment failure. Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, @error, @option)); + ${yylexer.prettyPrintRange(yylexer, @error, @option)} + + Technical error report: + ${$error.errStr} + `); } | error { // TODO ... yyerror(rmCommonWS` - expected a valid option name (with optional value assignment). + Expected a valid option name (with optional value assignment). Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, @error)); + ${yylexer.prettyPrintRange(yylexer, @error)} + + Technical error report: + ${$error.errStr} + `); } ; @@ -552,7 +685,11 @@ include_macro_code %include MUST be followed by a valid file path. Erroneous path: - ` + yylexer.prettyPrintRange(yylexer, @error, @INCLUDE)); + ${yylexer.prettyPrintRange(yylexer, @error, @INCLUDE)} + + Technical error report: + ${$error.errStr} + `); } ; @@ -565,10 +702,14 @@ module_code_chunk { // TODO ... yyerror(rmCommonWS` - module code declaration error? + Module code declaration error? - Erroneous area: - ` + yylexer.prettyPrintRange(yylexer, @error)); + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, @error)} + + Technical error report: + ${$error.errStr} + `); } ; From 840364b642f6571d270ebbfc9ec930bafaa5016f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 3 Oct 2017 06:17:06 +0200 Subject: [PATCH 384/417] moved the `dquote()` function to the jison-helpers-lib module as it's used (and duplicated) all over the place. --- Makefile | 12 +- lex-parser.js | 2699 ++++++++++++++++++++++++------------------------- lex.l | 20 +- 3 files changed, 1322 insertions(+), 1409 deletions(-) diff --git a/Makefile b/Makefile index 91ebccd..bf25adb 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,11 @@ JISON_VERSION := $(shell node ../../lib/cli.js -V 2> /dev/null ) -ifndef JISON_VERSION +ifndef JISON_VERSION JISON = sh node_modules/.bin/jison -else +else JISON = node ../../lib/cli.js -endif +endif @@ -21,7 +21,7 @@ npm-update: ncu -a --packageFile=package.json build: -ifeq ($(wildcard ./node_modules/.bin/jison),) +ifeq ($(wildcard ./node_modules/.bin/jison),) $(error "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###") endif $(JISON) -o lex-parser.js lex.y lex.l @@ -37,8 +37,8 @@ bump: git-tag: node -e 'var pkg = require("./package.json"); console.log(pkg.version);' | xargs git tag -publish: - npm run pub +publish: + npm run pub diff --git a/lex-parser.js b/lex-parser.js index 0bc0e5d..fabd91c 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -4980,259 +4980,263 @@ parser.yy.post_lex = function p_lex() { /* lexer generated by jison-lex 0.6.0-194*/ /* - * Returns a Lexer object of the following structure: - * - * Lexer: { - * yy: {} The so-called "shared state" or rather the *source* of it; - * the real "shared state" `yy` passed around to - * the rule actions, etc. is a direct reference! - * - * This "shared context" object was passed to the lexer by way of - * the `lexer.setInput(str, yy)` API before you may use it. - * - * This "shared context" object is passed to the lexer action code in `performAction()` - * so userland code in the lexer actions may communicate with the outside world - * and/or other lexer rules' actions in more or less complex ways. - * - * } - * - * Lexer.prototype: { - * EOF: 1, - * ERROR: 2, - * - * yy: The overall "shared context" object reference. - * - * JisonLexerError: function(msg, hash), - * - * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), - * - * The function parameters and `this` have the following value/meaning: - * - `this` : reference to the `lexer` instance. - * `yy_` is an alias for `this` lexer instance reference used internally. - * - * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer - * by way of the `lexer.setInput(str, yy)` API before. - * - * Note: - * The extra arguments you specified in the `%parse-param` statement in your - * **parser** grammar definition file are passed to the lexer via this object - * reference as member variables. - * - * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. - * - * - `YY_START`: the current lexer "start condition" state. - * - * parseError: function(str, hash, ExceptionClass), - * - * constructLexErrorInfo: function(error_message, is_recoverable), - * Helper function. - * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. - * See it's use in this lexer kernel in many places; example usage: - * - * var infoObj = lexer.constructParseErrorInfo('fail!', true); - * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); - * - * options: { ... lexer %options ... }, - * - * lex: function(), - * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. - * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: - * these extra `args...` are added verbatim to the `yy` object reference as member variables. - * - * WARNING: - * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with - * any attributes already added to `yy` by the **parser** or the jison run-time; - * when such a collision is detected an exception is thrown to prevent the generated run-time - * from silently accepting this confusing and potentially hazardous situation! - * - * cleanupAfterLex: function(do_not_nuke_errorinfos), - * Helper function. - * - * This helper API is invoked when the **parse process** has completed: it is the responsibility - * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. - * - * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. - * - * setInput: function(input, [yy]), - * - * - * input: function(), - * - * - * unput: function(str), - * - * - * more: function(), - * - * - * reject: function(), - * - * - * less: function(n), - * - * - * pastInput: function(n), - * - * - * upcomingInput: function(n), - * - * - * showPosition: function(), - * - * - * test_match: function(regex_match_array, rule_index), - * - * - * next: function(), - * - * - * begin: function(condition), - * - * - * pushState: function(condition), - * - * - * popState: function(), - * - * - * topState: function(), - * - * - * _currentRules: function(), - * - * - * stateStackSize: function(), - * - * - * performAction: function(yy, yy_, yyrulenumber, YY_START), - * - * - * rules: [...], - * - * - * conditions: {associative list: name ==> set}, - * } - * - * - * token location info (`yylloc`): { - * first_line: n, - * last_line: n, - * first_column: n, - * last_column: n, - * range: [start_number, end_number] - * (where the numbers are indexes into the input string, zero-based) - * } - * - * --- - * - * The `parseError` function receives a 'hash' object with these members for lexer errors: - * - * { - * text: (matched text) - * token: (the produced terminal token, if any) - * token_id: (the produced terminal token numeric ID, if any) - * line: (yylineno) - * loc: (yylloc) - * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule - * available for this particular error) - * yy: (object: the current parser internal "shared state" `yy` - * as is also available in the rule actions; this can be used, - * for instance, for advanced error analysis and reporting) - * lexer: (reference to the current lexer instance used by the parser) - * } - * - * while `this` will reference the current lexer instance. - * - * When `parseError` is invoked by the lexer, the default implementation will - * attempt to invoke `yy.parser.parseError()`; when this callback is not provided - * it will try to invoke `yy.parseError()` instead. When that callback is also not - * provided, a `JisonLexerError` exception will be thrown containing the error - * message and `hash`, as constructed by the `constructLexErrorInfo()` API. - * - * Note that the lexer's `JisonLexerError` error class is passed via the - * `ExceptionClass` argument, which is invoked to construct the exception - * instance to be thrown, so technically `parseError` will throw the object - * produced by the `new ExceptionClass(str, hash)` JavaScript expression. - * - * --- - * - * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. - * These options are available: - * - * (Options are permanent.) - * - * yy: { - * parseError: function(str, hash, ExceptionClass) - * optional: overrides the default `parseError` function. - * } - * - * lexer.options: { - * pre_lex: function() - * optional: is invoked before the lexer is invoked to produce another token. - * `this` refers to the Lexer object. - * post_lex: function(token) { return token; } - * optional: is invoked when the lexer has produced a token `token`; - * this function can override the returned token value by returning another. - * When it does not return any (truthy) value, the lexer will return - * the original `token`. - * `this` refers to the Lexer object. - * - * WARNING: the next set of options are not meant to be changed. They echo the abilities of - * the lexer as per when it was compiled! - * - * ranges: boolean - * optional: `true` ==> token location info will include a .range[] member. - * flex: boolean - * optional: `true` ==> flex-like lexing behaviour where the rules are tested - * exhaustively to find the longest match. - * backtrack_lexer: boolean - * optional: `true` ==> lexer regexes are tested in order and for invoked; - * the lexer terminates the scan when a token is returned by the action code. - * xregexp: boolean - * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the - * `XRegExp` library. When this %option has not been specified at compile time, all lexer - * rule regexes have been written as standard JavaScript RegExp expressions. - * } - */ - -var lexer = (function() { + * Returns a Lexer object of the following structure: + * + * Lexer: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a direct reference! + * + * This "shared context" object was passed to the lexer by way of + * the `lexer.setInput(str, yy)` API before you may use it. + * + * This "shared context" object is passed to the lexer action code in `performAction()` + * so userland code in the lexer actions may communicate with the outside world + * and/or other lexer rules' actions in more or less complex ways. + * + * } + * + * Lexer.prototype: { + * EOF: 1, + * ERROR: 2, + * + * yy: The overall "shared context" object reference. + * + * JisonLexerError: function(msg, hash), + * + * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `lexer` instance. + * `yy_` is an alias for `this` lexer instance reference used internally. + * + * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer + * by way of the `lexer.setInput(str, yy)` API before. + * + * Note: + * The extra arguments you specified in the `%parse-param` statement in your + * **parser** grammar definition file are passed to the lexer via this object + * reference as member variables. + * + * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. + * + * - `YY_START`: the current lexer "start condition" state. + * + * parseError: function(str, hash, ExceptionClass), + * + * constructLexErrorInfo: function(error_message, is_recoverable), + * Helper function. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this lexer kernel in many places; example usage: + * + * var infoObj = lexer.constructParseErrorInfo('fail!', true); + * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); + * + * options: { ... lexer %options ... }, + * + * lex: function(), + * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. + * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the **parser** or the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * cleanupAfterLex: function(do_not_nuke_errorinfos), + * Helper function. + * + * This helper API is invoked when the **parse process** has completed: it is the responsibility + * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. + * + * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. + * + * setInput: function(input, [yy]), + * + * + * input: function(), + * + * + * unput: function(str), + * + * + * more: function(), + * + * + * reject: function(), + * + * + * less: function(n), + * + * + * pastInput: function(n), + * + * + * upcomingInput: function(n), + * + * + * showPosition: function(), + * + * + * test_match: function(regex_match_array, rule_index), + * + * + * next: function(), + * + * + * begin: function(condition), + * + * + * pushState: function(condition), + * + * + * popState: function(), + * + * + * topState: function(), + * + * + * _currentRules: function(), + * + * + * stateStackSize: function(), + * + * + * performAction: function(yy, yy_, yyrulenumber, YY_START), + * + * + * rules: [...], + * + * + * conditions: {associative list: name ==> set}, + * } + * + * + * token location info (`yylloc`): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * } + * + * while `this` will reference the current lexer instance. + * + * When `parseError` is invoked by the lexer, the default implementation will + * attempt to invoke `yy.parser.parseError()`; when this callback is not provided + * it will try to invoke `yy.parseError()` instead. When that callback is also not + * provided, a `JisonLexerError` exception will be thrown containing the error + * message and `hash`, as constructed by the `constructLexErrorInfo()` API. + * + * Note that the lexer's `JisonLexerError` error class is passed via the + * `ExceptionClass` argument, which is invoked to construct the exception + * instance to be thrown, so technically `parseError` will throw the object + * produced by the `new ExceptionClass(str, hash)` JavaScript expression. + * + * --- + * + * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. + * These options are available: + * + * (Options are permanent.) + * + * yy: { + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * } + * + * lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * WARNING: the next set of options are not meant to be changed. They echo the abilities of + * the lexer as per when it was compiled! + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + +var lexer = function() { // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility // with userland code which might access the derived class in a 'classic' way. function JisonLexerError(msg, hash) { - Object.defineProperty(this, "name", { + Object.defineProperty(this, 'name', { enumerable: false, writable: false, - value: "JisonLexerError" + value: 'JisonLexerError' }); - if (msg == null) msg = "???"; + if (msg == null) + msg = '???'; - Object.defineProperty(this, "message", { + Object.defineProperty(this, 'message', { enumerable: false, writable: true, value: msg }); this.hash = hash; - var stacktrace; + if (hash && hash.exception instanceof Error) { var ex2 = hash.exception; this.message = ex2.message || msg; stacktrace = ex2.stack; } + if (!stacktrace) { - if (Error.hasOwnProperty("captureStackTrace")) { + if (Error.hasOwnProperty('captureStackTrace')) { // V8 Error.captureStackTrace(this, this.constructor); } else { stacktrace = new Error(msg).stack; } } + if (stacktrace) { - Object.defineProperty(this, "stack", { + Object.defineProperty(this, 'stack', { enumerable: false, writable: false, value: stacktrace @@ -5240,13 +5244,14 @@ var lexer = (function() { } } - if (typeof Object.setPrototypeOf === "function") { + if (typeof Object.setPrototypeOf === 'function') { Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); } else { JisonLexerError.prototype = Object.create(Error.prototype); } + JisonLexerError.prototype.constructor = JisonLexerError; - JisonLexerError.prototype.name = "JisonLexerError"; + JisonLexerError.prototype.name = 'JisonLexerError'; var lexer = { @@ -5292,6 +5297,7 @@ var lexer = (function() { EOF: 1, + ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator @@ -5300,28 +5306,24 @@ var lexer = (function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// <-- internal rule set cache for the current lexer state - - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: "", /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY - - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - - match: "", /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: "", /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: "", /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + __currentRuleSet__: null, /// <-- internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -5329,15 +5331,12 @@ var lexer = (function() { * @public * @this {RegExpLexer} */ - constructLexErrorInfo: function lexer_constructLexErrorInfo( - msg, - recoverable - ) { + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { /** @constructor */ var pei = { errStr: msg, recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -5345,33 +5344,37 @@ var lexer = (function() { lexer: this, /** - * and make sure the error info doesn't stay due to potential - * ref cycle via userland code manipulations. - * These would otherwise all be memory leak opportunities! - * - * Note that only array and object references are nuked as those - * constitute the set of elements which can produce a cyclic ref. - * The rest of the members is kept intact as they are harmless. - * - * @public - * @this {LexErrorInfo} - */ + * and make sure the error info doesn't stay due to potential + * ref cycle via userland code manipulations. + * These would otherwise all be memory leak opportunities! + * + * Note that only array and object references are nuked as those + * constitute the set of elements which can produce a cyclic ref. + * The rest of the members is kept intact as they are harmless. + * + * @public + * @this {LexErrorInfo} + */ destroy: function destructLexErrorInfo() { // remove cyclic references added to error info: // info.yy = null; // info.lexer = null; // ... var rec = !!this.recoverable; + for (var key in this) { - if (this.hasOwnProperty(key) && typeof key === "object") { + if (this.hasOwnProperty(key) && typeof key === 'object') { this[key] = undefined; } } + this.recoverable = rec; } }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! this.__error_infos.push(pei); + return pei; }, @@ -5385,19 +5388,15 @@ var lexer = (function() { if (!ExceptionClass) { ExceptionClass = this.JisonLexerError; } + if (this.yy) { - if (this.yy.parser && typeof this.yy.parser.parseError === "function") { - return ( - this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || - this.ERROR - ); - } else if (typeof this.yy.parseError === "function") { - return ( - this.yy.parseError.call(this, str, hash, ExceptionClass) || - this.ERROR - ); + if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { + return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } else if (typeof this.yy.parseError === 'function') { + return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; } } + throw new ExceptionClass(str, hash); }, @@ -5408,17 +5407,20 @@ var lexer = (function() { * @this {RegExpLexer} */ yyerror: function yyError(str /*, ...args */) { - var lineno_msg = ""; + var lineno_msg = ''; + if (this.options.trackPosition) { - lineno_msg = " on line " + (this.yylineno + 1); + lineno_msg = ' on line ' + (this.yylineno + 1); } + var p = this.constructLexErrorInfo( - "Lexical error" + lineno_msg + ": " + str, + 'Lexical error' + lineno_msg + ': ' + str, this.options.lexerErrorsAreRecoverable ); // Add any extra args to the hash under the name `extra_error_attributes`: var args = Array.prototype.slice.call(arguments, 1); + if (args.length) { p.extra_error_attributes = args; } @@ -5442,7 +5444,7 @@ var lexer = (function() { var rv; // prevent lingering circular references from causing memory leaks: - this.setInput("", {}); + this.setInput('', {}); // nuke the error hash info instances created during this run. // Userland code must COPY any data/references @@ -5450,10 +5452,12 @@ var lexer = (function() { if (!do_not_nuke_errorinfos) { for (var i = this.__error_infos.length - 1; i >= 0; i--) { var el = this.__error_infos[i]; - if (el && typeof el.destroy === "function") { + + if (el && typeof el.destroy === 'function') { el.destroy(); } } + this.__error_infos.length = 0; } @@ -5467,20 +5471,19 @@ var lexer = (function() { * @this {RegExpLexer} */ clear: function lexer_clear() { - this.yytext = ""; + this.yytext = ''; this.yyleng = 0; - this.match = ""; + this.match = ''; this.matches = false; this._more = false; this._backtrack = false; + var col = (this.yylloc ? this.yylloc.last_column : 0); - var col = this.yylloc ? this.yylloc.last_column : 0; this.yylloc = { first_line: this.yylineno + 1, first_column: col, last_line: this.yylineno + 1, last_column: col, - range: [this.offset, this.offset] }; }, @@ -5500,24 +5503,24 @@ var lexer = (function() { if (!this.__decompressed) { // step 1: decompress the regex list: var rules = this.rules; + for (var i = 0, len = rules.length; i < len; i++) { var rule_re = rules[i]; // compression: is the RE an xref to another RE slot in the rules[] table? - if (typeof rule_re === "number") { + if (typeof rule_re === 'number') { rules[i] = rules[rule_re]; } } // step 2: unfold the conditions[] set to make these ready for use: var conditions = this.conditions; + for (var k in conditions) { var spec = conditions[k]; - var rule_ids = spec.rules; - var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -5535,22 +5538,23 @@ var lexer = (function() { this.__decompressed = true; } - this._input = input || ""; + this._input = input || ''; this.clear(); this._signaled_error_token = false; this.done = false; this.yylineno = 0; - this.matched = ""; - this.conditionStack = ["INITIAL"]; + this.matched = ''; + this.conditionStack = ['INITIAL']; this.__currentRuleSet__ = null; + this.yylloc = { first_line: 1, first_column: 0, last_line: 1, last_column: 0, - range: [0, 0] }; + this.offset = 0; return this; }, @@ -5578,13 +5582,15 @@ var lexer = (function() { */ pushInput: function lexer_pushInput(input, label, options) { options = options || {}; - - this._input = input || ""; + this._input = input || ''; this.clear(); + // this._signaled_error_token = false; this.done = false; + this.yylineno = 0; - this.matched = ""; + this.matched = ''; + // this.conditionStack = ['INITIAL']; // this.__currentRuleSet__ = null; this.yylloc = { @@ -5592,9 +5598,9 @@ var lexer = (function() { first_column: 0, last_line: 1, last_column: 0, - range: [0, 0] }; + this.offset = 0; return this; }, @@ -5610,24 +5616,29 @@ var lexer = (function() { //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) return null; } + var ch = this._input[0]; this.yytext += ch; this.yyleng++; this.offset++; this.match += ch; this.matched += ch; + // Count the linenumber up when we hit the LF (or a stand-alone CR). // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo // and we advance immediately past the LF as well, returning both together as if // it was all a single 'character' only. var slice_len = 1; + var lines = false; - if (ch === "\n") { + + if (ch === '\n') { lines = true; - } else if (ch === "\r") { + } else if (ch === '\r') { lines = true; var ch2 = this._input[1]; - if (ch2 === "\n") { + + if (ch2 === '\n') { slice_len++; ch += ch2; this.yytext += ch2; @@ -5638,6 +5649,7 @@ var lexer = (function() { this.yylloc.range[1]++; } } + if (lines) { this.yylineno++; this.yylloc.last_line++; @@ -5645,8 +5657,8 @@ var lexer = (function() { } else { this.yylloc.last_column++; } - this.yylloc.range[1]++; + this.yylloc.range[1]++; this._input = this._input.slice(slice_len); return ch; }, @@ -5660,7 +5672,6 @@ var lexer = (function() { unput: function lexer_unput(ch) { var len = ch.length; var lines = ch.split(/(?:\r\n?|\n)/g); - this._input = ch + this._input; this.yytext = this.yytext.substr(0, this.yytext.length - len); this.yyleng = this.yytext.length; @@ -5670,21 +5681,21 @@ var lexer = (function() { if (lines.length > 1) { this.yylineno -= lines.length - 1; - this.yylloc.last_line = this.yylineno + 1; var pre = this.match; var pre_lines = pre.split(/(?:\r\n?|\n)/g); + if (pre_lines.length === 1) { pre = this.matched; pre_lines = pre.split(/(?:\r\n?|\n)/g); } + this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; } else { this.yylloc.last_column -= len; } this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; - this.done = false; return this; }, @@ -5714,27 +5725,30 @@ var lexer = (function() { // when the `parseError()` call returns, we MUST ensure that the error is registered. // We accomplish this by signaling an 'error' token to be produced for the current // `.lex()` run. - var lineno_msg = ""; + var lineno_msg = ''; + if (this.options.trackPosition) { - lineno_msg = " on line " + (this.yylineno + 1); + lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ""; - if (typeof this.showPosition === "function") { + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== "\n") { - pos_str = "\n" + pos_str; + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; } } + var p = this.constructLexErrorInfo( - "Lexical error" + - lineno_msg + - ": You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true)." + - pos_str, + 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, false ); - this._signaled_error_token = - this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + + this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; } + return this; }, @@ -5763,30 +5777,36 @@ var lexer = (function() { * @this {RegExpLexer} */ pastInput: function lexer_pastInput(maxSize, maxLines) { - var past = this.matched.substring( - 0, - this.matched.length - this.match.length - ); - if (maxSize < 0) maxSize = past.length; - else if (!maxSize) maxSize = 20; - if (maxLines < 0) maxLines = past.length; + var past = this.matched.substring(0, this.matched.length - this.match.length); + + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) - // can't ever have more input lines than this! maxLines = 1; + // `substr` anticipation: treat \r\n as a single character and take a little // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: past = past.substr(-maxSize * 2 - 2); + // now that we have a significantly reduced string to process, transform the newlines // and chop them, then limit them: - var a = past.replace(/\r\n|\r/g, "\n").split("\n"); + var a = past.replace(/\r\n|\r/g, '\n').split('\n'); + a = a.slice(-maxLines); - past = a.join("\n"); + past = a.join('\n'); + // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis prefix... if (past.length > maxSize) { - past = "..." + past.substr(-maxSize); + past = '...' + past.substr(-maxSize); } + return past; }, @@ -5804,28 +5824,37 @@ var lexer = (function() { */ upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { var next = this.match; - if (maxSize < 0) maxSize = next.length + this._input.length; - else if (!maxSize) maxSize = 20; - if (maxLines < 0) maxLines = maxSize; + + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) - // can't ever have more input lines than this! maxLines = 1; + // `substring` anticipation: treat \r\n as a single character and take a little // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } + // now that we have a significantly reduced string to process, transform the newlines // and chop them, then limit them: - var a = next.replace(/\r\n|\r/g, "\n").split("\n"); + var a = next.replace(/\r\n|\r/g, '\n').split('\n'); + a = a.slice(0, maxLines); - next = a.join("\n"); + next = a.join('\n'); + // When, after limiting to maxLines, we still have too much to return, // do add an ellipsis postfix... if (next.length > maxSize) { - next = next.substring(0, maxSize) + "..."; + next = next.substring(0, maxSize) + '...'; } + return next; }, @@ -5837,15 +5866,9 @@ var lexer = (function() { * @this {RegExpLexer} */ showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { - var pre = this.pastInput(maxPrefix).replace(/\s/g, " "); - var c = new Array(pre.length + 1).join("-"); - return ( - pre + - this.upcomingInput(maxPostfix).replace(/\s/g, " ") + - "\n" + - c + - "^" - ); + var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; }, /** @@ -5893,100 +5916,89 @@ var lexer = (function() { * @public * @this {RegExpLexer} */ - prettyPrintRange: function lexer_prettyPrintRange( - loc, - context_loc, - context_loc2 - ) { + prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { var error_size = loc.last_line - loc.first_line; const CONTEXT = 3; const CONTEXT_TAIL = 1; const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; - var lines = input.split("\n"); + var lines = input.split('\n'); + //var show_context = (error_size < 5 || context_loc); - var l0 = Math.max( - 1, - context_loc ? context_loc.first_line : loc.first_line - CONTEXT - ); - var l1 = Math.max( - 1, - context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL - ); - var lineno_display_width = (1 + Math.log10(l1 | 1)) | 0; - var ws_prefix = new Array(lineno_display_width).join(" "); + var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); + + var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); + var lineno_display_width = 1 + Math.log10(l1 | 1) | 0; + var ws_prefix = new Array(lineno_display_width).join(' '); var nonempty_line_indexes = []; - var rv = lines - .slice(l0 - 1, l1 + 1) - .map(function injectLineNumber(line, index) { - var lno = index + l0; - var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); - var rv = lno_pfx + ": " + line; - var errpfx = new Array(lineno_display_width + 1).join("^"); - if (lno === loc.first_line) { - var offset = loc.first_column + 2; - var len = Math.max( - 2, - (lno === loc.last_line ? loc.last_column : line.length) - - loc.first_column + - 1 - ); - var lead = new Array(offset).join("."); - var mark = new Array(len).join("^"); - rv += "\n" + errpfx + lead + mark; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join("."); - var mark = new Array(len).join("^"); - rv += "\n" + errpfx + lead + mark; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } - } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); - var lead = new Array(offset).join("."); - var mark = new Array(len).join("^"); - rv += "\n" + errpfx + lead + mark; - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } + + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ': ' + line; + var errpfx = new Array(lineno_display_width + 1).join('^'); + + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + + var len = Math.max( + 2, + ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 + ); + + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); } - rv = rv.replace(/\t/g, " "); - return rv; - }); - // now make sure we don't print an overly large amount of error area: limit it + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } + + rv = rv.replace(/\t/g, ' '); + return rv; + }); + + // now make sure we don't print an overly large amount of error area: limit it // to the top and bottom line count: - if ( - nonempty_line_indexes.length > - 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - ) { - var clip_start = - nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; - var clip_end = - nonempty_line_indexes[ - nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - ] - 1; - console.log("clip off: ", { + if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { + var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; + + console.log('clip off: ', { start: clip_start, end: clip_end, len: clip_end - clip_start + 1, arr: nonempty_line_indexes, rv }); - var intermediate_line = - new Array(lineno_display_width + 1).join(" ") + " (...continued...)"; - intermediate_line += - "\n" + - new Array(lineno_display_width + 1).join("-") + - " (---------------)"; + + var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; + intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); } - return rv.join("\n"); + + return rv.join('\n'); }, /** @@ -6007,34 +6019,30 @@ var lexer = (function() { var dl = l2 - l1; var dc = c2 - c1; var rv; + if (dl === 0) { - rv = "line " + l1 + ", "; + rv = 'line ' + l1 + ', '; + if (dc <= 1) { - rv += "column " + c1; + rv += 'column ' + c1; } else { - rv += "columns " + c1 + " .. " + c2; + rv += 'columns ' + c1 + ' .. ' + c2; } } else { - rv = - "lines " + - l1 + - "(column " + - c1 + - ") .. " + - l2 + - "(column " + - c2 + - ")"; + rv = 'lines ' + l1 + '(column ' + c1 + ') .. ' + l2 + '(column ' + c2 + ')'; } + if (yylloc.range && display_range_too) { var r1 = yylloc.range[0]; var r2 = yylloc.range[1] - 1; + if (r2 <= r1) { - rv += " {String Offset: " + r1 + "}"; + rv += ' {String Offset: ' + r1 + '}'; } else { - rv += " {String Offset range: " + r1 + " .. " + r2 + "}"; + rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; } } + return rv; }, @@ -6063,14 +6071,15 @@ var lexer = (function() { // save context backup = { yylineno: this.yylineno, + yylloc: { first_line: this.yylloc.first_line, last_line: this.yylloc.last_line, first_column: this.yylloc.first_column, last_column: this.yylloc.last_column, - range: this.yylloc.range.slice(0) }, + yytext: this.yytext, match: this.match, matches: this.matches, @@ -6079,8 +6088,10 @@ var lexer = (function() { offset: this.offset, _more: this._more, _input: this._input, + //_signaled_error_token: this._signaled_error_token, yy: this.yy, + conditionStack: this.conditionStack.slice(0), done: this.done }; @@ -6088,18 +6099,21 @@ var lexer = (function() { match_str = match[0]; match_str_len = match_str.length; + // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { lines = match_str.split(/(?:\r\n?|\n)/g); + if (lines.length > 1) { this.yylineno += lines.length - 1; - this.yylloc.last_line = this.yylineno + 1; this.yylloc.last_column = lines[lines.length - 1].length; } else { this.yylloc.last_column += match_str_len; } + // } this.yytext += match_str; + this.match += match_str; this.matches = match; this.yyleng = this.yytext.length; @@ -6109,6 +6123,7 @@ var lexer = (function() { // those rules will already have moved this `offset` forward matching their match lengths, // hence we must only add our own match length now: this.offset += match_str_len; + this._more = false; this._backtrack = false; this._input = this._input.slice(match_str_len); @@ -6123,12 +6138,14 @@ var lexer = (function() { indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ ); + // otherwise, when the action codes are all simple return token statements: //token = this.simpleCaseActionClusters[indexed_rule]; if (this.done && this._input) { this.done = false; } + if (token) { return token; } else if (this._backtrack) { @@ -6136,15 +6153,18 @@ var lexer = (function() { for (var k in backup) { this[k] = backup[k]; } + this.__currentRuleSet__ = null; - return false; // rule action called reject() implying the next rule should be tested instead. + return false; // rule action called reject() implying the next rule should be tested instead. } else if (this._signaled_error_token) { // produce one 'error' token as `.parseError()` in `reject()` // did not guarantee a failure signal by throwing an exception! token = this._signaled_error_token; + this._signaled_error_token = false; return token; } + return false; }, @@ -6159,70 +6179,79 @@ var lexer = (function() { this.clear(); return this.EOF; } + if (!this._input) { this.done = true; } var token, match, tempMatch, index; + if (!this._more) { this.clear(); } + var spec = this.__currentRuleSet__; + if (!spec) { // Update the ruleset cache as we apparently encountered a state change or just started lexing. // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps // speed up those activities a tiny bit. spec = this.__currentRuleSet__ = this._currentRules(); + // Check whether a *sane* condition has been pushed before: this makes the lexer robust against // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 if (!spec || !spec.rules) { - var lineno_msg = ""; + var lineno_msg = ''; + if (this.options.trackPosition) { - lineno_msg = " on line " + (this.yylineno + 1); + lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ""; - if (typeof this.showPosition === "function") { + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== "\n") { - pos_str = "\n" + pos_str; + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; } } + var p = this.constructLexErrorInfo( - "Internal lexer engine error" + - lineno_msg + - ': The lex grammar programmer pushed a non-existing condition name "' + - this.topState() + - '"; this is a fatal error and should be reported to the application programmer team!' + - pos_str, + 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, false ); + // produce one 'error' token until this situation has been resolved, most probably by parse termination! - return ( - this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR - ); + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; } } var rule_ids = spec.rules; + //var dispatch = spec.__dispatch_lut; var regexes = spec.__rule_regexes; + var len = spec.__rule_count; // Note: the arrays are 1-based, while `len` itself is a valid index, // hence the non-standard less-or-equal check in the next loop condition! for (var i = 1; i <= len; i++) { tempMatch = this._input.match(regexes[i]); + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { match = tempMatch; index = i; + if (this.options.backtrack_lexer) { token = this.test_match(tempMatch, rule_ids[i]); + if (token !== false) { return token; } else if (this._backtrack) { match = undefined; - continue; // rule action called reject() implying a rule MISmatch. + continue; // rule action called reject() implying a rule MISmatch. } else { // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; @@ -6232,36 +6261,46 @@ var lexer = (function() { } } } + if (match) { token = this.test_match(match, rule_ids[index]); + if (token !== false) { return token; } + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) return false; } + if (!this._input) { this.done = true; this.clear(); return this.EOF; } else { - var lineno_msg = ""; + var lineno_msg = ''; + if (this.options.trackPosition) { - lineno_msg = " on line " + (this.yylineno + 1); + lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ""; - if (typeof this.showPosition === "function") { + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { pos_str = this.showPosition(); - if (pos_str && pos_str[0] !== "\n") { - pos_str = "\n" + pos_str; + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; } } + var p = this.constructLexErrorInfo( - "Lexical error" + lineno_msg + ": Unrecognized text." + pos_str, + 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, this.options.lexerErrorsAreRecoverable ); - token = - this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + + token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us // by moving forward at least one character at a time: @@ -6269,6 +6308,7 @@ var lexer = (function() { this.input(); } } + return token; } }, @@ -6281,36 +6321,31 @@ var lexer = (function() { */ lex: function lexer_lex() { var r; + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: - if (typeof this.options.pre_lex === "function") { + if (typeof this.options.pre_lex === 'function') { r = this.options.pre_lex.call(this); } + while (!r) { r = this.next(); } if (0) { - console.log( - "@@@@@@@@@ lex: ", - { - token: r, - sym: - this.yy.parser && - typeof this.yy.parser.describeSymbol === "function" && - this.yy.parser.describeSymbol(r), - describeTypeFunc: - this.yy.parser && typeof this.yy.parser.describeSymbol, - condition: this.conditionStack, - text: this.yytext - }, - "\n" + (this.showPosition ? this.showPosition() : "???") - ); + console.log('@@@@@@@@@ lex: ', { + token: r, + sym: this.yy.parser && typeof this.yy.parser.describeSymbol === 'function' && this.yy.parser.describeSymbol(r), + describeTypeFunc: this.yy.parser && typeof this.yy.parser.describeSymbol, + condition: this.conditionStack, + text: this.yytext + }, '\n' + ((this.showPosition ? this.showPosition() : '???'))); } - if (typeof this.options.post_lex === "function") { + if (typeof this.options.post_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.options.post_lex.call(this, r) || r; } + return r; }, @@ -6348,6 +6383,7 @@ var lexer = (function() { */ popState: function lexer_popState() { var n = this.conditionStack.length - 1; + if (n > 0) { this.__currentRuleSet__ = null; return this.conditionStack.pop(); @@ -6366,10 +6402,11 @@ var lexer = (function() { */ topState: function lexer_topState(n) { n = this.conditionStack.length - 1 - Math.abs(n || 0); + if (n >= 0) { return this.conditionStack[n]; } else { - return "INITIAL"; + return 'INITIAL'; } }, @@ -6381,15 +6418,10 @@ var lexer = (function() { * @this {RegExpLexer} */ _currentRules: function lexer__currentRules() { - if ( - this.conditionStack.length && - this.conditionStack[this.conditionStack.length - 1] - ) { - return this.conditions[ - this.conditionStack[this.conditionStack.length - 1] - ]; + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; } else { - return this.conditions["INITIAL"]; + return this.conditions['INITIAL']; } }, @@ -6402,6 +6434,7 @@ var lexer = (function() { stateStackSize: function lexer_stateStackSize() { return this.conditionStack.length; }, + options: { xregexp: true, ranges: true, @@ -6409,767 +6442,715 @@ var lexer = (function() { parseActionsUseYYMERGELOCATIONINFO: true, easy_keyword_rules: true }, + JisonLexerError: JisonLexerError, + performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { var yy_ = this; - var YYSTATE = YY_START; + switch (yyrulenumber) { - case 0: - /*! Conditions:: rules macro named_chunk INITIAL */ + case 0: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %\{ */ + yy.dept = 0; + + yy.include_command_allowed = false; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 1: + /*! Conditions:: action */ + /*! Rule:: %\{([^]*?)%\} */ + yy_.yytext = this.matches[1]; + + yy.include_command_allowed = true; + return 32; + break; + + case 2: + /*! Conditions:: action */ + /*! Rule:: %include\b */ + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState('path'); - /*! Rule:: %\{ */ + return 51; + } else { + // TODO + yy_.yyerror('oops!'); - yy.dept = 0; - yy.include_command_allowed = false; - this.pushState("action"); - this.unput(yy_.yytext); - yy_.yytext = ""; - return 28; - break; - case 1: - /*! Conditions:: action */ + return 37; + } - /*! Rule:: %\{([^]*?)%\} */ + break; - yy_.yytext = this.matches[1]; - yy.include_command_allowed = true; - return 32; - break; - case 2: - /*! Conditions:: action */ + case 3: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 34; - /*! Rule:: %include\b */ + break; - if (yy.include_command_allowed) { - // This is an include instruction in place of an action: - // - // - one %include per action chunk - // - one %include replaces an entire action chunk - this.pushState("path"); - return 51; - } else { - // TODO - yy_.yyerror("oops!"); - return 37; - } - break; - case 3: - /*! Conditions:: action */ - - /*! Rule:: {WS}*\/\*[^]*?\*\/ */ - - //yy.include_command_allowed = false; -- doesn't impact include-allowed state - return 34; - break; - case 4: - /*! Conditions:: action */ - - /*! Rule:: {WS}*\/\/.* */ - - yy.include_command_allowed = false; - return 35; - break; - case 6: - /*! Conditions:: action */ - - /*! Rule:: \| */ - - if (yy.include_command_allowed) { - this.popState(); - this.unput(yy_.yytext); - yy_.yytext = ""; - return 31; - } else { - return 33; - } - break; - case 7: - /*! Conditions:: action */ - - /*! Rule:: %% */ - - if (yy.include_command_allowed) { - this.popState(); - this.unput(yy_.yytext); - yy_.yytext = ""; - return 31; - } else { - return 33; - } - break; - case 9: - /*! Conditions:: action */ + case 4: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\/.* */ + yy.include_command_allowed = false; - /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ + return 35; + break; - yy.include_command_allowed = false; + case 6: + /*! Conditions:: action */ + /*! Rule:: \| */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { return 33; - break; - case 10: - /*! Conditions:: action */ + } - /*! Rule:: \/[^}{BR}]* */ + break; - yy.include_command_allowed = false; + case 7: + /*! Conditions:: action */ + /*! Rule:: %% */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { return 33; - break; - case 11: - /*! Conditions:: action */ + } - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + break; - yy.include_command_allowed = false; - return 33; - break; - case 12: - /*! Conditions:: action */ + case 9: + /*! Conditions:: action */ + /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ + yy.include_command_allowed = false; - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + return 33; + break; - yy.include_command_allowed = false; - return 33; - break; - case 13: - /*! Conditions:: action */ + case 10: + /*! Conditions:: action */ + /*! Rule:: \/[^}{BR}]* */ + yy.include_command_allowed = false; - /*! Rule:: `{ES2017_STRING_CONTENT}` */ + return 33; + break; - yy.include_command_allowed = false; - return 33; - break; - case 14: - /*! Conditions:: action */ + case 11: + /*! Conditions:: action */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy.include_command_allowed = false; - /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ + return 33; + break; - yy.include_command_allowed = false; - return 33; - break; - case 15: - /*! Conditions:: action */ + case 12: + /*! Conditions:: action */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy.include_command_allowed = false; - /*! Rule:: \{ */ + return 33; + break; - yy.depth++; - yy.include_command_allowed = false; - return 33; - break; - case 16: - /*! Conditions:: action */ + case 13: + /*! Conditions:: action */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy.include_command_allowed = false; - /*! Rule:: \} */ + return 33; + break; - yy.include_command_allowed = false; - if (yy.depth <= 0) { - yy_.yyerror( - rmCommonWS` - too many closing curly braces in lexer rule action block. + case 14: + /*! Conditions:: action */ + /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ + yy.include_command_allowed = false; - Note: the action code chunk may be too complex for jison to parse - easily; we suggest you wrap the action code chunk in '%{...%\}' - to help jison grok more or less complex action code chunks. + return 33; + break; - Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return "BRACKETS_SURPLUS"; - } else { - yy.depth--; - } - return 33; - break; - case 17: - /*! Conditions:: action */ - - /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|]) */ + case 15: + /*! Conditions:: action */ + /*! Rule:: \{ */ + yy.depth++; - yy.include_command_allowed = true; - return 36; // keep empty lines as-is inside action code blocks. - break; - case 18: - /*! Conditions:: action */ - - /*! Rule:: {BR} */ - - if (yy.depth > 0) { - yy.include_command_allowed = true; - return 36; // keep empty lines as-is inside action code blocks. - } else { - // end of action code chunk - this.popState(); - this.unput(yy_.yytext); - yy_.yytext = ""; - return 31; - } - break; - case 19: - /*! Conditions:: action */ + yy.include_command_allowed = false; + return 33; + break; - /*! Rule:: $ */ + case 16: + /*! Conditions:: action */ + /*! Rule:: \} */ + yy.include_command_allowed = false; - yy.include_command_allowed = false; - if (yy.depth !== 0) { - yy_.yyerror( - rmCommonWS` - missing ${yy.depth} closing curly braces in lexer rule action block. + if (yy.depth <= 0) { + yy_.yyerror(rmCommonWS` + too many closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse easily; we suggest you wrap the action code chunk in '%{...%\}' to help jison grok more or less complex action code chunks. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - yy_.yytext = ""; - return "BRACKETS_MISSING"; - } - this.popState(); - yy_.yytext = ""; - return 31; - break; - case 21: - /*! Conditions:: conditions */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: > */ - - this.popState(); - return 6; - break; - case 24: - /*! Conditions:: INITIAL start_condition macro path options */ - - /*! Rule:: {WS}*\/\/[^\r\n]* */ - - /* skip single-line comment */ - - break; - case 25: - /*! Conditions:: INITIAL start_condition macro path options */ - - /*! Rule:: {WS}*\/\*[^]*?\*\/ */ - - /* skip multi-line comment */ - - break; - case 26: - /*! Conditions:: rules */ - - /*! Rule:: {BR}+ */ - - /* empty */ - - break; - case 27: - /*! Conditions:: rules */ - - /*! Rule:: {WS}+{BR}+ */ - - /* empty */ - - break; - case 28: - /*! Conditions:: rules */ - - /*! Rule:: \/\/[^\r\n]* */ - - /* skip single-line comment */ - - break; - case 29: - /*! Conditions:: rules */ - - /*! Rule:: \/\*[^]*?\*\/ */ + return 'BRACKETS_SURPLUS'; + } else { + yy.depth--; + } - /* skip multi-line comment */ + return 33; + break; - break; - case 30: - /*! Conditions:: rules */ + case 17: + /*! Conditions:: action */ + /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|]) */ + yy.include_command_allowed = true; - /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ + return 36; // keep empty lines as-is inside action code blocks. + break; - yy.depth = 0; + case 18: + /*! Conditions:: action */ + /*! Rule:: {BR} */ + if (yy.depth > 0) { yy.include_command_allowed = true; - this.pushState("action"); - return 28; - break; - case 31: - /*! Conditions:: rules */ - - /*! Rule:: %% */ - - this.popState(); - this.pushState("code"); - return 19; - break; - case 32: - /*! Conditions:: rules */ - - /*! Rule:: {ANY_LITERAL_CHAR}+ */ - - // accept any non-regex, non-lex, non-string-delim, - // non-escape-starter, non-space character as-is - return 46; - break; - case 35: - /*! Conditions:: options */ - - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - - yy_.yytext = unescQuote(this.matches[1], /\\"/g); - return 49; // value is always a string type - break; - case 36: - /*! Conditions:: options */ - - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - - yy_.yytext = unescQuote(this.matches[1], /\\'/g); - return 49; // value is always a string type - break; - case 37: - /*! Conditions:: options */ - - /*! Rule:: `{ES2017_STRING_CONTENT}` */ - - yy_.yytext = unescQuote(this.matches[1], /\\`/g); - return 49; // value is always a string type - break; - case 39: - /*! Conditions:: options */ - - /*! Rule:: {BR}{WS}+(?=\S) */ - - /* skip leading whitespace on the next line of input, when followed by more options */ - - break; - case 40: - /*! Conditions:: options */ - - /*! Rule:: {BR} */ - - this.popState(); - return 48; - break; - case 41: - /*! Conditions:: options */ - - /*! Rule:: {WS}+ */ - - /* skip whitespace */ - - break; - case 43: - /*! Conditions:: start_condition */ - - /*! Rule:: {BR}+ */ - - this.popState(); - break; - case 44: - /*! Conditions:: start_condition */ - - /*! Rule:: {WS}+ */ - - /* empty */ - - break; - case 46: - /*! Conditions:: INITIAL */ - - /*! Rule:: {ID} */ - - this.pushState("macro"); - return 20; - break; - case 47: - /*! Conditions:: macro named_chunk */ - - /*! Rule:: {BR}+ */ - + return 36; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk this.popState(); - break; - case 48: - /*! Conditions:: macro */ - - /*! Rule:: {ANY_LITERAL_CHAR}+ */ - - // accept any non-regex, non-lex, non-string-delim, - // non-escape-starter, non-space character as-is - return 46; - break; - case 49: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: {BR}+ */ - - /* empty */ - - break; - case 50: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: \s+ */ - - /* empty */ - - break; - case 51: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ - - yy_.yytext = unescQuote(this.matches[1], /\\"/g); - return 26; - break; - case 52: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ - - yy_.yytext = unescQuote(this.matches[1], /\\'/g); - return 26; - break; - case 53: - /*! Conditions:: rules macro named_chunk INITIAL */ - /*! Rule:: \[ */ - - this.pushState("set"); - return 41; - break; - case 66: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: < */ - - this.pushState("conditions"); - return 5; - break; - case 67: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: \/! */ - - return 39; // treated as `(?!atom)` - break; - case 68: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: \/ */ - - return 14; // treated as `(?=atom)` - break; - case 70: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: \\. */ - - yy_.yytext = yy_.yytext.replace(/^\\/g, ""); - return 44; - break; - case 73: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: %options\b */ - - this.pushState("options"); - return 47; - break; - case 74: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: %s\b */ - - this.pushState("start_condition"); - return 21; - break; - case 75: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: %x\b */ - - this.pushState("start_condition"); - return 22; - break; - case 76: - /*! Conditions:: rules macro named_chunk INITIAL */ - - /*! Rule:: %code\b */ + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } - this.pushState("named_chunk"); - return 25; - break; - case 77: - /*! Conditions:: rules macro named_chunk INITIAL */ + break; - /*! Rule:: %import\b */ + case 19: + /*! Conditions:: action */ + /*! Rule:: $ */ + yy.include_command_allowed = false; - this.pushState("named_chunk"); - return 24; - break; - case 78: - /*! Conditions:: rules macro named_chunk INITIAL */ + if (yy.depth !== 0) { + yy_.yyerror(rmCommonWS` + missing ${yy.depth} closing curly braces in lexer rule action block. - /*! Rule:: %include\b */ + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. - yy.depth = 0; - yy.include_command_allowed = true; - this.pushState("action"); - this.unput(yy_.yytext); - yy_.yytext = ""; - return 28; - break; - case 79: - /*! Conditions:: code */ + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: %include\b */ + yy_.yytext = ''; + return 'BRACKETS_MISSING'; + } - this.pushState("path"); - return 51; - break; - case 80: - /*! Conditions:: INITIAL rules code */ - - /*! Rule:: %{NAME}([^\r\n]*) */ - - /* ignore unrecognized decl */ - this.warn( - rmCommonWS` - LEX: ignoring unsupported lexer option ${dquote( - yy_.yytext - )} - while lexing in ${dquote( - this.topState() - )} state. + this.popState(); + yy_.yytext = ''; + return 31; + break; + + case 21: + /*! Conditions:: conditions */ + /*! Rule:: > */ + this.popState(); + + return 6; + break; + + case 24: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 25: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 26: + /*! Conditions:: rules */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 27: + /*! Conditions:: rules */ + /*! Rule:: {WS}+{BR}+ */ + /* empty */ + break; + + case 28: + /*! Conditions:: rules */ + /*! Rule:: \/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 29: + /*! Conditions:: rules */ + /*! Rule:: \/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 30: + /*! Conditions:: rules */ + /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + return 28; + break; + + case 31: + /*! Conditions:: rules */ + /*! Rule:: %% */ + this.popState(); + + this.pushState('code'); + return 19; + break; + + case 32: + /*! Conditions:: rules */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 35: + /*! Conditions:: options */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 49; // value is always a string type + break; + + case 36: + /*! Conditions:: options */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 49; // value is always a string type + break; + + case 37: + /*! Conditions:: options */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy_.yytext = unescQuote(this.matches[1], /\\`/g); + + return 49; // value is always a string type + break; + + case 39: + /*! Conditions:: options */ + /*! Rule:: {BR}{WS}+(?=\S) */ + /* skip leading whitespace on the next line of input, when followed by more options */ + break; + + case 40: + /*! Conditions:: options */ + /*! Rule:: {BR} */ + this.popState(); + + return 48; + break; + + case 41: + /*! Conditions:: options */ + /*! Rule:: {WS}+ */ + /* skip whitespace */ + break; + + case 43: + /*! Conditions:: start_condition */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 44: + /*! Conditions:: start_condition */ + /*! Rule:: {WS}+ */ + /* empty */ + break; + + case 46: + /*! Conditions:: INITIAL */ + /*! Rule:: {ID} */ + this.pushState('macro'); + + return 20; + break; + + case 47: + /*! Conditions:: macro named_chunk */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 48: + /*! Conditions:: macro */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 49: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 50: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \s+ */ + /* empty */ + break; + + case 51: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 26; + break; + + case 52: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 26; + break; + + case 53: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \[ */ + this.pushState('set'); + + return 41; + break; + + case 66: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: < */ + this.pushState('conditions'); + + return 5; + break; + + case 67: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/! */ + return 39; // treated as `(?!atom)` + + break; + + case 68: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/ */ + return 14; // treated as `(?=atom)` + + break; + + case 70: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); + + return 44; + break; + + case 73: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %options\b */ + this.pushState('options'); + + return 47; + break; + + case 74: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %s\b */ + this.pushState('start_condition'); + + return 21; + break; + + case 75: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %x\b */ + this.pushState('start_condition'); + + return 22; + break; + + case 76: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %code\b */ + this.pushState('named_chunk'); + + return 25; + break; + + case 77: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %import\b */ + this.pushState('named_chunk'); + + return 24; + break; + + case 78: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %include\b */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 79: + /*! Conditions:: code */ + /*! Rule:: %include\b */ + this.pushState('path'); + + return 51; + break; + + case 80: + /*! Conditions:: INITIAL rules code */ + /*! Rule:: %{NAME}([^\r\n]*) */ + /* ignore unrecognized decl */ + this.warn(rmCommonWS` + LEX: ignoring unsupported lexer option ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - yy_.yytext = [ - this.matches[1], // {NAME} - this.matches[2].trim() // optional value/parameters - ]; - return 23; - break; - case 81: - /*! Conditions:: rules macro named_chunk INITIAL */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: %% */ + yy_.yytext = [ + this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; - this.pushState("rules"); - return 19; - break; - case 89: - /*! Conditions:: set */ + return 23; + break; - /*! Rule:: \] */ + case 81: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %% */ + this.pushState('rules'); - this.popState(); - return 42; - break; - case 91: - /*! Conditions:: code */ + return 19; + break; - /*! Rule:: [^\r\n]+ */ + case 89: + /*! Conditions:: set */ + /*! Rule:: \] */ + this.popState(); - return 53; // the bit of CODE just before EOF... - break; - case 92: - /*! Conditions:: path */ + return 42; + break; - /*! Rule:: {BR} */ + case 91: + /*! Conditions:: code */ + /*! Rule:: [^\r\n]+ */ + return 53; // the bit of CODE just before EOF... - this.popState(); - this.unput(yy_.yytext); - break; - case 93: - /*! Conditions:: path */ + break; - /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + case 92: + /*! Conditions:: path */ + /*! Rule:: {BR} */ + this.popState(); - yy_.yytext = unescQuote(this.matches[1]); - this.popState(); - return 52; - break; - case 94: - /*! Conditions:: path */ + this.unput(yy_.yytext); + break; - /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + case 93: + /*! Conditions:: path */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1]); - yy_.yytext = unescQuote(this.matches[1]); - this.popState(); - return 52; - break; - case 95: - /*! Conditions:: path */ + this.popState(); + return 52; + break; - /*! Rule:: {WS}+ */ + case 94: + /*! Conditions:: path */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1]); - // skip whitespace in the line - break; - case 96: - /*! Conditions:: path */ + this.popState(); + return 52; + break; - /*! Rule:: [^\s\r\n]+ */ + case 95: + /*! Conditions:: path */ + /*! Rule:: {WS}+ */ + // skip whitespace in the line + break; - this.popState(); - return 52; - break; - case 97: - /*! Conditions:: action */ + case 96: + /*! Conditions:: path */ + /*! Rule:: [^\s\r\n]+ */ + this.popState(); - /*! Rule:: " */ + return 52; + break; - yy_.yyerror( - rmCommonWS` + case 97: + /*! Conditions:: action */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` unterminated string constant in lexer rule action block. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return 2; - break; - case 98: - /*! Conditions:: action */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: ' */ + return 2; + break; - yy_.yyerror( - rmCommonWS` + case 98: + /*! Conditions:: action */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` unterminated string constant in lexer rule action block. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return 2; - break; - case 99: - /*! Conditions:: action */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: ` */ + return 2; + break; - yy_.yyerror( - rmCommonWS` + case 99: + /*! Conditions:: action */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` unterminated string constant in lexer rule action block. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return 2; - break; - case 100: - /*! Conditions:: options */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: " */ + return 2; + break; - yy_.yyerror( - rmCommonWS` + case 100: + /*! Conditions:: options */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` unterminated string constant in %options entry. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return 2; - break; - case 101: - /*! Conditions:: options */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: ' */ + return 2; + break; - yy_.yyerror( - rmCommonWS` + case 101: + /*! Conditions:: options */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` unterminated string constant in %options entry. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return 2; - break; - case 102: - /*! Conditions:: options */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: ` */ + return 2; + break; - yy_.yyerror( - rmCommonWS` + case 102: + /*! Conditions:: options */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` unterminated string constant in %options entry. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return 2; - break; - case 103: - /*! Conditions:: * */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: " */ + return 2; + break; - var rules = this.topState() === "macro" ? "macro's" : this.topState(); - yy_.yyerror( - rmCommonWS` + case 103: + /*! Conditions:: * */ + /*! Rule:: " */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` unterminated string constant encountered while lexing ${rules}. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return 2; - break; - case 104: - /*! Conditions:: * */ + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; - /*! Rule:: ' */ + case 104: + /*! Conditions:: * */ + /*! Rule:: ' */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); - var rules = this.topState() === "macro" ? "macro's" : this.topState(); - yy_.yyerror( - rmCommonWS` + yy_.yyerror(rmCommonWS` unterminated string constant encountered while lexing ${rules}. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return 2; - break; - case 105: - /*! Conditions:: * */ + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; - /*! Rule:: ` */ + case 105: + /*! Conditions:: * */ + /*! Rule:: ` */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); - var rules = this.topState() === "macro" ? "macro's" : this.topState(); - yy_.yyerror( - rmCommonWS` + yy_.yyerror(rmCommonWS` unterminated string constant encountered while lexing ${rules}. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - return 2; - break; - case 106: - /*! Conditions:: macro rules */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: . */ + return 2; + break; - /* b0rk on bad characters */ - var rules = this.topState() === "macro" ? "macro's" : this.topState(); - yy_.yyerror( - rmCommonWS` + case 106: + /*! Conditions:: macro rules */ + /*! Rule:: . */ + /* b0rk on bad characters */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` unsupported lexer input encountered while lexing ${rules} (i.e. jison lex regexes). @@ -7181,340 +7162,288 @@ var lexer = (function() { regex expression here in jison-lex ${rules}. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - break; - case 107: - /*! Conditions:: * */ + ` + this.prettyPrintRange(this, yy_.yylloc)); - /*! Rule:: . */ + break; - yy_.yyerror( - rmCommonWS` - unsupported lexer input: ${dquote( - yy_.yytext - )} - while lexing in ${dquote(this.topState())} state. + case 107: + /*! Conditions:: * */ + /*! Rule:: . */ + yy_.yyerror(rmCommonWS` + unsupported lexer input: ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + - this.prettyPrintRange(this, yy_.yylloc) - ); - break; - default: - return this.simpleCaseActionClusters[yyrulenumber]; + ` + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + default: + return this.simpleCaseActionClusters[yyrulenumber]; } }, + simpleCaseActionClusters: { /*! Conditions:: action */ - /*! Rule:: {WS}+ */ - 5: 36, - /*! Conditions:: action */ + /*! Conditions:: action */ /*! Rule:: % */ - 8: 33, - /*! Conditions:: conditions */ + /*! Conditions:: conditions */ /*! Rule:: {NAME} */ - 20: 20, - /*! Conditions:: conditions */ + /*! Conditions:: conditions */ /*! Rule:: , */ - 22: 8, - /*! Conditions:: conditions */ + /*! Conditions:: conditions */ /*! Rule:: \* */ - 23: 7, - /*! Conditions:: options */ + /*! Conditions:: options */ /*! Rule:: {NAME} */ - 33: 20, - /*! Conditions:: options */ + /*! Conditions:: options */ /*! Rule:: = */ - 34: 18, - /*! Conditions:: options */ + /*! Conditions:: options */ /*! Rule:: [^\s\r\n]+ */ - 38: 50, - /*! Conditions:: start_condition */ + /*! Conditions:: start_condition */ /*! Rule:: {ID} */ - 42: 27, - /*! Conditions:: named_chunk */ + /*! Conditions:: named_chunk */ /*! Rule:: {ID} */ - 45: 20, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \| */ - 54: 9, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \(\?: */ - 55: 38, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \(\?= */ - 56: 38, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \(\?! */ - 57: 38, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \( */ - 58: 10, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \) */ - 59: 11, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \+ */ - 60: 12, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \* */ - 61: 7, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \? */ - 62: 13, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \^ */ - 63: 16, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: , */ - 64: 8, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: <> */ - 65: 17, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ - 69: 44, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \$ */ - 71: 17, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \. */ - 72: 15, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \{\d+(,\s*\d+|,)?\} */ - 82: 45, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \{{ID}\} */ - 83: 40, - /*! Conditions:: set options */ + /*! Conditions:: set options */ /*! Rule:: \{{ID}\} */ - 84: 40, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \{ */ - 85: 3, - /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: \} */ - 86: 4, - /*! Conditions:: set */ + /*! Conditions:: set */ /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ - 87: 43, - /*! Conditions:: set */ + /*! Conditions:: set */ /*! Rule:: \{ */ - 88: 43, - /*! Conditions:: code */ + /*! Conditions:: code */ /*! Rule:: [^\r\n]*(\r|\n)+ */ - 90: 53, - /*! Conditions:: * */ + /*! Conditions:: * */ /*! Rule:: $ */ - 108: 1 }, + rules: [ - /* 0: */ /^(?:%\{)/, - /* 1: */ new XRegExp("^(?:%\\{([^]*?)%\\})", ""), - /* 2: */ /^(?:%include\b)/, - /* 3: */ new XRegExp("^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)", ""), - /* 4: */ /^(?:([^\S\n\r])*\/\/.*)/, - /* 5: */ /^(?:([^\S\n\r])+)/, - /* 6: */ /^(?:\|)/, - /* 7: */ /^(?:%%)/, - /* 8: */ /^(?:%)/, - /* 9: */ /^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, - /* 10: */ /^(?:\/[^\n\r}]*)/, - /* 11: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 12: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 13: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, - /* 14: */ /^(?:[^\s"%'\/`{-}]+)/, - /* 15: */ /^(?:\{)/, - /* 16: */ /^(?:\})/, - /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s|]))/, - /* 18: */ /^(?:(\r\n|\n|\r))/, - /* 19: */ /^(?:$)/, - /* 20: */ new XRegExp( - "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", - "" - ), - /* 21: */ /^(?:>)/, - /* 22: */ /^(?:,)/, - /* 23: */ /^(?:\*)/, - /* 24: */ /^(?:([^\S\n\r])*\/\/[^\n\r]*)/, - /* 25: */ new XRegExp("^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)", ""), - /* 26: */ /^(?:(\r\n|\n|\r)+)/, - /* 27: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, - /* 28: */ /^(?:\/\/[^\r\n]*)/, - /* 29: */ new XRegExp("^(?:\\/\\*[^]*?\\*\\/)", ""), - /* 30: */ /^(?:([^\S\n\r])+(?=[^\s%|]))/, - /* 31: */ /^(?:%%)/, - /* 32: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, - /* 33: */ new XRegExp( - "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))", - "" - ), - /* 34: */ /^(?:=)/, - /* 35: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 36: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 37: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, - /* 38: */ /^(?:\S+)/, - /* 39: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, - /* 40: */ /^(?:(\r\n|\n|\r))/, - /* 41: */ /^(?:([^\S\n\r])+)/, - /* 42: */ new XRegExp( - "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", - "" + /* 0: */ /^(?:%\{)/, + /* 1: */ new XRegExp('^(?:%\\{([^]*?)%\\})', ''), + /* 2: */ /^(?:%include\b)/, + /* 3: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 4: */ /^(?:([^\S\n\r])*\/\/.*)/, + /* 5: */ /^(?:([^\S\n\r])+)/, + /* 6: */ /^(?:\|)/, + /* 7: */ /^(?:%%)/, + /* 8: */ /^(?:%)/, + /* 9: */ /^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, + /* 10: */ /^(?:\/[^\n\r}]*)/, + /* 11: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 12: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 13: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 14: */ /^(?:[^\s"%'\/`{-}]+)/, + /* 15: */ /^(?:\{)/, + /* 16: */ /^(?:\})/, + /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s|]))/, + /* 18: */ /^(?:(\r\n|\n|\r))/, + /* 19: */ /^(?:$)/, + /* 20: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' ), - /* 43: */ /^(?:(\r\n|\n|\r)+)/, - /* 44: */ /^(?:([^\S\n\r])+)/, - /* 45: */ new XRegExp( - "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", - "" + /* 21: */ /^(?:>)/, + /* 22: */ /^(?:,)/, + /* 23: */ /^(?:\*)/, + /* 24: */ /^(?:([^\S\n\r])*\/\/[^\n\r]*)/, + /* 25: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 26: */ /^(?:(\r\n|\n|\r)+)/, + /* 27: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, + /* 28: */ /^(?:\/\/[^\r\n]*)/, + /* 29: */ new XRegExp('^(?:\\/\\*[^]*?\\*\\/)', ''), + /* 30: */ /^(?:([^\S\n\r])+(?=[^\s%|]))/, + /* 31: */ /^(?:%%)/, + /* 32: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 33: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' ), - /* 46: */ new XRegExp( - "^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))", - "" + /* 34: */ /^(?:=)/, + /* 35: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 36: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 37: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 38: */ /^(?:\S+)/, + /* 39: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, + /* 40: */ /^(?:(\r\n|\n|\r))/, + /* 41: */ /^(?:([^\S\n\r])+)/, + /* 42: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 43: */ /^(?:(\r\n|\n|\r)+)/, + /* 44: */ /^(?:([^\S\n\r])+)/, + /* 45: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 46: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 47: */ /^(?:(\r\n|\n|\r)+)/, + /* 48: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 49: */ /^(?:(\r\n|\n|\r)+)/, + /* 50: */ /^(?:\s+)/, + /* 51: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 52: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 53: */ /^(?:\[)/, + /* 54: */ /^(?:\|)/, + /* 55: */ /^(?:\(\?:)/, + /* 56: */ /^(?:\(\?=)/, + /* 57: */ /^(?:\(\?!)/, + /* 58: */ /^(?:\()/, + /* 59: */ /^(?:\))/, + /* 60: */ /^(?:\+)/, + /* 61: */ /^(?:\*)/, + /* 62: */ /^(?:\?)/, + /* 63: */ /^(?:\^)/, + /* 64: */ /^(?:,)/, + /* 65: */ /^(?:<>)/, + /* 66: */ /^(?:<)/, + /* 67: */ /^(?:\/!)/, + /* 68: */ /^(?:\/)/, + /* 69: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 70: */ /^(?:\\.)/, + /* 71: */ /^(?:\$)/, + /* 72: */ /^(?:\.)/, + /* 73: */ /^(?:%options\b)/, + /* 74: */ /^(?:%s\b)/, + /* 75: */ /^(?:%x\b)/, + /* 76: */ /^(?:%code\b)/, + /* 77: */ /^(?:%import\b)/, + /* 78: */ /^(?:%include\b)/, + /* 79: */ /^(?:%include\b)/, + /* 80: */ new XRegExp( + '^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))', + '' ), - /* 47: */ /^(?:(\r\n|\n|\r)+)/, - /* 48: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, - /* 49: */ /^(?:(\r\n|\n|\r)+)/, - /* 50: */ /^(?:\s+)/, - /* 51: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 52: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 53: */ /^(?:\[)/, - /* 54: */ /^(?:\|)/, - /* 55: */ /^(?:\(\?:)/, - /* 56: */ /^(?:\(\?=)/, - /* 57: */ /^(?:\(\?!)/, - /* 58: */ /^(?:\()/, - /* 59: */ /^(?:\))/, - /* 60: */ /^(?:\+)/, - /* 61: */ /^(?:\*)/, - /* 62: */ /^(?:\?)/, - /* 63: */ /^(?:\^)/, - /* 64: */ /^(?:,)/, - /* 65: */ /^(?:<>)/, - /* 66: */ /^(?:<)/, - /* 67: */ /^(?:\/!)/, - /* 68: */ /^(?:\/)/, - /* 69: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, - /* 70: */ /^(?:\\.)/, - /* 71: */ /^(?:\$)/, - /* 72: */ /^(?:\.)/, - /* 73: */ /^(?:%options\b)/, - /* 74: */ /^(?:%s\b)/, - /* 75: */ /^(?:%x\b)/, - /* 76: */ /^(?:%code\b)/, - /* 77: */ /^(?:%import\b)/, - /* 78: */ /^(?:%include\b)/, - /* 79: */ /^(?:%include\b)/, - /* 80: */ new XRegExp( - "^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))", - "" - ), - /* 81: */ /^(?:%%)/, - /* 82: */ /^(?:\{\d+(,\s*\d+|,)?\})/, - /* 83: */ new XRegExp( - "^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", - "" - ), - /* 84: */ new XRegExp( - "^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})", - "" - ), - /* 85: */ /^(?:\{)/, - /* 86: */ /^(?:\})/, - /* 87: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, - /* 88: */ /^(?:\{)/, - /* 89: */ /^(?:\])/, - /* 90: */ /^(?:[^\r\n]*(\r|\n)+)/, - /* 91: */ /^(?:[^\r\n]+)/, - /* 92: */ /^(?:(\r\n|\n|\r))/, - /* 93: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, - /* 94: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, - /* 95: */ /^(?:([^\S\n\r])+)/, - /* 96: */ /^(?:\S+)/, - /* 97: */ /^(?:")/, - /* 98: */ /^(?:')/, - /* 99: */ /^(?:`)/, - /* 100: */ /^(?:")/, - /* 101: */ /^(?:')/, - /* 102: */ /^(?:`)/, - /* 103: */ /^(?:")/, - /* 104: */ /^(?:')/, - /* 105: */ /^(?:`)/, - /* 106: */ /^(?:.)/, - /* 107: */ /^(?:.)/, - /* 108: */ /^(?:$)/ + /* 81: */ /^(?:%%)/, + /* 82: */ /^(?:\{\d+(,\s*\d+|,)?\})/, + /* 83: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 84: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 85: */ /^(?:\{)/, + /* 86: */ /^(?:\})/, + /* 87: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 88: */ /^(?:\{)/, + /* 89: */ /^(?:\])/, + /* 90: */ /^(?:[^\r\n]*(\r|\n)+)/, + /* 91: */ /^(?:[^\r\n]+)/, + /* 92: */ /^(?:(\r\n|\n|\r))/, + /* 93: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 94: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 95: */ /^(?:([^\S\n\r])+)/, + /* 96: */ /^(?:\S+)/, + /* 97: */ /^(?:")/, + /* 98: */ /^(?:')/, + /* 99: */ /^(?:`)/, + /* 100: */ /^(?:")/, + /* 101: */ /^(?:')/, + /* 102: */ /^(?:`)/, + /* 103: */ /^(?:")/, + /* 104: */ /^(?:')/, + /* 105: */ /^(?:`)/, + /* 106: */ /^(?:.)/, + /* 107: */ /^(?:.)/, + /* 108: */ /^(?:$)/ ], + conditions: { - rules: { + 'rules': { rules: [ 0, 26, @@ -7567,9 +7496,11 @@ var lexer = (function() { 107, 108 ], + inclusive: true }, - macro: { + + 'macro': { rules: [ 0, 24, @@ -7618,9 +7549,11 @@ var lexer = (function() { 107, 108 ], + inclusive: true }, - named_chunk: { + + 'named_chunk': { rules: [ 0, 45, @@ -7666,17 +7599,21 @@ var lexer = (function() { 107, 108 ], + inclusive: true }, - code: { + + 'code': { rules: [79, 80, 90, 91, 103, 104, 105, 107, 108], inclusive: false }, - start_condition: { + + 'start_condition': { rules: [24, 25, 42, 43, 44, 103, 104, 105, 107, 108], inclusive: false }, - options: { + + 'options': { rules: [ 24, 25, @@ -7699,13 +7636,16 @@ var lexer = (function() { 107, 108 ], + inclusive: false }, - conditions: { + + 'conditions': { rules: [20, 21, 22, 23, 103, 104, 105, 107, 108], inclusive: false }, - action: { + + 'action': { rules: [ 1, 2, @@ -7735,17 +7675,21 @@ var lexer = (function() { 107, 108 ], + inclusive: false }, - path: { + + 'path': { rules: [24, 25, 92, 93, 94, 95, 96, 103, 104, 105, 107, 108], inclusive: false }, - set: { + + 'set': { rules: [84, 87, 88, 89, 103, 104, 105, 107, 108], inclusive: false }, - INITIAL: { + + 'INITIAL': { rules: [ 0, 24, @@ -7793,53 +7737,37 @@ var lexer = (function() { 107, 108 ], + inclusive: true } } }; - var helpers = require("../../modules/helpers-lib"); + var helpers = require('../../modules/helpers-lib'); var rmCommonWS = helpers.rmCommonWS; + var dquote = helpers.dquote; function indent(s, i) { - var a = s.split("\n"); - var pf = new Array(i + 1).join(" "); - return pf + a.join("\n" + pf); + var a = s.split('\n'); + var pf = new Array(i + 1).join(' '); + return pf + a.join('\n' + pf); } // unescape a string value which is wrapped in quotes/doublequotes function unescQuote(str) { - str = "" + str; - var a = str.split("\\\\"); + str = '' + str; + var a = str.split('\\\\'); + a = a.map(function(s) { - return s.replace(/\\'/g, "'").replace(/\\"/g, '"'); + return s.replace(/\\'/g, '\'').replace(/\\"/g, '"'); }); - str = a.join("\\\\"); - return str; - } - // properly quote and escape the given input string - function dquote(s) { - var sq = s.indexOf("'") >= 0; - var dq = s.indexOf('"') >= 0; - if (sq && dq) { - s = s.replace(/"/g, '\\"'); - dq = false; - } - if (dq) { - s = "'" + s + "'"; - } else { - s = '"' + s + '"'; - } - return s; + str = a.join('\\\\'); + return str; } lexer.warn = function l_warn() { - if ( - this.yy && - this.yy.parser && - typeof this.yy.parser.warn === "function" - ) { + if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { return this.yy.parser.warn.apply(this, arguments); } else { console.warn.apply(console, arguments); @@ -7847,7 +7775,7 @@ var lexer = (function() { }; lexer.log = function l_log() { - if (this.yy && this.yy.parser && typeof this.yy.parser.log === "function") { + if (this.yy && this.yy.parser && typeof this.yy.parser.log === 'function') { return this.yy.parser.log.apply(this, arguments); } else { console.log.apply(console, arguments); @@ -7855,8 +7783,7 @@ var lexer = (function() { }; return lexer; -})(); - +}(); parser.lexer = lexer; function Parser() { diff --git a/lex.l b/lex.l index d02e78e..3cceb2e 100644 --- a/lex.l +++ b/lex.l @@ -442,8 +442,11 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] %% + var helpers = require('../../modules/helpers-lib'); var rmCommonWS = helpers.rmCommonWS; +var dquote = helpers.dquote; + function indent(s, i) { var a = s.split('\n'); @@ -462,23 +465,6 @@ function unescQuote(str) { return str; } -// properly quote and escape the given input string -function dquote(s) { - var sq = (s.indexOf('\'') >= 0); - var dq = (s.indexOf('"') >= 0); - if (sq && dq) { - s = s.replace(/"/g, '\\"'); - dq = false; - } - if (dq) { - s = '\'' + s + '\''; - } - else { - s = '"' + s + '"'; - } - return s; -} - lexer.warn = function l_warn() { if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { From ff3149f4931a6a433027aab67fa8a7f4f2a1c042 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 3 Oct 2017 06:17:19 +0200 Subject: [PATCH 385/417] updated NPM packages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 3b8a231..3e253c3 100644 --- a/package.json +++ b/package.json @@ -32,6 +32,6 @@ "devDependencies": { "chai": "4.1.2", "jison-gho": "0.6.0-193", - "mocha": "3.5.3" + "mocha": "4.0.0" } } From bd457ab34b3480eeabb9ce192fae3764730d5a21 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 12 Oct 2017 21:05:59 +0200 Subject: [PATCH 386/417] fix bug: `warn()` and `log()` APIs are from `yyparser`, **NOT** from `this`, which references the `yyval` object instead! Relevant action code chunks have been corrected. --- lex.y | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lex.y b/lex.y index 8127552..39d9f61 100644 --- a/lex.y +++ b/lex.y @@ -10,6 +10,7 @@ %left '(' + %% lex @@ -457,7 +458,7 @@ regex $$ = eval('"' + $$ + '"'); } catch (ex) { - this.warn('easy-keyword-rule FAIL on eval: ', ex); + yyparser.warn('easy-keyword-rule FAIL on eval: ', ex); // make the next keyword test fail: $$ = '.'; @@ -595,7 +596,7 @@ regex_set_atom } else { $$ = $name_expansion; } - //this.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); } ; From 833ee60fa543ef8b76961edabe4ed551cce5071f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 12 Oct 2017 21:07:41 +0200 Subject: [PATCH 387/417] updated NPM packages and added rollup+babel dev deps for move towards compiling the lexer generator in ES2015 mode. --- package-lock.json | 3070 ++++++++++++++++++++++++++++++++++++++++----- package.json | 12 +- 2 files changed, 2776 insertions(+), 306 deletions(-) diff --git a/package-lock.json b/package-lock.json index 160dec0..62c445b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,12 +15,6 @@ "integrity": "sha512-NP7YZh7rR6CNiMLyKTF+qb2Epx0r5x/zKQ3Z14TgXl73YJurC8WkMkFM9nDj8cRXb6R+f+BEu4DqAvvYKMxbqg==", "dev": true }, - "@gerhobbelt/json5": { - "version": "0.5.1-19", - "resolved": "https://registry.npmjs.org/@gerhobbelt/json5/-/json5-0.5.1-19.tgz", - "integrity": "sha512-TDAMTzjDUosbRbkz/l+wzARC3XYPU6bzMJA2WBmd2fIqKUHixg42fp04fX06aYyyDzM0noxSugl6Z0+l+N29mw==", - "dev": true - }, "@gerhobbelt/linewrap": { "version": "0.2.2-2", "resolved": "https://registry.npmjs.org/@gerhobbelt/linewrap/-/linewrap-0.2.2-2.tgz", @@ -31,7 +25,27 @@ "version": "1.8.4-21", "resolved": "https://registry.npmjs.org/@gerhobbelt/nomnom/-/nomnom-1.8.4-21.tgz", "integrity": "sha512-45Cy1g0RG2ZB99VFXmRmmcDlnQOAm2Z5FOKbfnJjRKBpCgxZYwDPAn/X6ewbjYk5j3ww1abMJZ26pSEFqcgIQg==", - "dev": true + "dev": true, + "dependencies": { + "ansi-styles": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", + "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "dev": true + }, + "chalk": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", + "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true + } + } }, "@gerhobbelt/prettier-miscellaneous": { "version": "1.6.2-5", @@ -43,7 +57,15 @@ "version": "0.12.7-7", "resolved": "https://registry.npmjs.org/@gerhobbelt/recast/-/recast-0.12.7-7.tgz", "integrity": "sha512-rGQfklyX1CV5wj3o8/4QvjdFYXqrAkBJffAa1cilxEPjZTEaMP86CjM6o+B4EpoY8AwzxuUnawPQiARhTphLMQ==", - "dev": true + "dev": true, + "dependencies": { + "core-js": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", + "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=", + "dev": true + } + } }, "@gerhobbelt/xregexp": { "version": "3.2.0-21", @@ -57,447 +79,2308 @@ "dev": true }, "ansi-styles": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.0.tgz", - "integrity": "sha512-NnSOmMEYtVR2JVMIGTzynRkkaxtiq1xnFBcdQD/DnNCYPoEPsVJhM98BDyaoNOQIi7p4okdi3E27eN7GQbsUug==", + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", + "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", + "dev": true + }, + "anymatch": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-1.3.2.tgz", + "integrity": "sha512-0XNayC8lTHQ2OI8aljNCN3sSx6hsr/1+rlcDAotXJR7C1oZZHCNsfpbKwMjRA3Uqb5tF1Rae2oloTr4xpq+WjA==", + "dev": true, + "optional": true + }, + "arr-diff": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-2.0.0.tgz", + "integrity": "sha1-jzuCf5Vai9ZpaX5KQlasPOrjVs8=", + "dev": true, + "optional": true + }, + "arr-flatten": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", + "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", "dev": true }, + "arr-union": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", + "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "dev": true + }, + "array-unique": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.2.1.tgz", + "integrity": "sha1-odl8yvy8JiXMcPrc6zalDFiwGlM=", + "dev": true, + "optional": true + }, "assertion-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", "dev": true }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "async": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", + "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", "dev": true }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "async-each": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", + "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "dev": true, + "optional": true + }, + "atob": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", + "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", "dev": true }, - "browser-stdout": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", - "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "babel-cli": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-cli/-/babel-cli-6.26.0.tgz", + "integrity": "sha1-UCq1SHTX24itALiHoGODzgPQAvE=", "dev": true }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "babel-code-frame": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", + "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", "dev": true }, - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "babel-core": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", + "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", "dev": true }, - "chai": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", - "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "babel-generator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", + "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", "dev": true }, - "chalk": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.1.0.tgz", - "integrity": "sha512-LUHGS/dge4ujbXMJrnihYMcL4AoOweGnw9Tp3kQuqy1Kx5c1qKjqvMJZ6nVJPMWJtKCTN72ZogH3oeSO9g9rXQ==", + "babel-helper-bindify-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz", + "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", "dev": true }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "babel-helper-builder-binary-assignment-operator-visitor": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", "dev": true }, - "cliui": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", - "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", - "dev": true, - "dependencies": { - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true - } - } + "babel-helper-call-delegate": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", + "integrity": "sha1-7Oaqzdx25Bw0YfiL/Fdb0Nqi340=", + "dev": true }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "babel-helper-define-map": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-define-map/-/babel-helper-define-map-6.26.0.tgz", + "integrity": "sha1-pfVtq0GiX5fstJjH66ypgZ+Vvl8=", "dev": true }, - "color-convert": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", - "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "babel-helper-explode-assignable-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", "dev": true }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "babel-helper-explode-class": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz", + "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", "dev": true }, - "commander": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", - "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "babel-helper-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", + "integrity": "sha1-00dbjAPtmCQqJbSDUasYOZ01gKk=", "dev": true }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "babel-helper-get-function-arity": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-get-function-arity/-/babel-helper-get-function-arity-6.24.1.tgz", + "integrity": "sha1-j3eCqpNAfEHTqlCQj4mwMbG2hT0=", "dev": true }, - "core-js": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", - "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=", + "babel-helper-hoist-variables": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-hoist-variables/-/babel-helper-hoist-variables-6.24.1.tgz", + "integrity": "sha1-HssnaJydJVE+rbyZFKc/VAi+enY=", "dev": true }, - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "babel-helper-optimise-call-expression": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-optimise-call-expression/-/babel-helper-optimise-call-expression-6.24.1.tgz", + "integrity": "sha1-96E0J7qfc/j0+pk8VKl4gtEkQlc=", "dev": true }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "babel-helper-regex": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-helper-regex/-/babel-helper-regex-6.26.0.tgz", + "integrity": "sha1-MlxZ+QL4LyS3T6zu0DY5VPZJXnI=", "dev": true }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "babel-helper-remap-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", "dev": true }, - "diff": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", - "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "babel-helper-replace-supers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", + "integrity": "sha1-v22/5Dk40XNpohPKiov3S2qQqxo=", "dev": true }, - "error-ex": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", - "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "babel-helpers": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", + "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", "dev": true }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "babel-messages": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", + "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", "dev": true }, - "esprima": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", - "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==", + "babel-plugin-check-es2015-constants": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-check-es2015-constants/-/babel-plugin-check-es2015-constants-6.22.0.tgz", + "integrity": "sha1-NRV7EBQm/S/9PaP3XH0ekYNbv4o=", "dev": true }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "babel-plugin-syntax-async-functions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", "dev": true }, - "exit": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", - "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "babel-plugin-syntax-async-generators": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", + "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", "dev": true }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "babel-plugin-syntax-class-constructor-call": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", + "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=", "dev": true }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "babel-plugin-syntax-class-properties": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", + "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", "dev": true }, - "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "babel-plugin-syntax-decorators": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", + "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", "dev": true }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "babel-plugin-syntax-dynamic-import": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", + "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", "dev": true }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "babel-plugin-syntax-exponentiation-operator": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", "dev": true }, - "glob": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", - "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "babel-plugin-syntax-export-extensions": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", + "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=", "dev": true }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "babel-plugin-syntax-flow": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", + "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", "dev": true }, - "graceful-readlink": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", - "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", "dev": true }, - "growl": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", - "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "babel-plugin-syntax-trailing-function-commas": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", "dev": true }, - "has-flag": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", - "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "babel-plugin-transform-async-generator-functions": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", + "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", "dev": true }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "babel-plugin-transform-async-to-generator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", "dev": true }, - "hosted-git-info": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", - "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "babel-plugin-transform-class-constructor-call": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.24.1.tgz", + "integrity": "sha1-gNwoVQWsBn3LjWxl4vbxGrd2Xvk=", "dev": true }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "babel-plugin-transform-class-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", + "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", "dev": true }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "babel-plugin-transform-decorators": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz", + "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", "dev": true }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "babel-plugin-transform-es2015-arrow-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", + "integrity": "sha1-RSaSy3EdX3ncf4XkQM5BufJE0iE=", "dev": true }, - "is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "babel-plugin-transform-es2015-block-scoped-functions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoped-functions/-/babel-plugin-transform-es2015-block-scoped-functions-6.22.0.tgz", + "integrity": "sha1-u8UbSflk1wy42OC5ToICRs46YUE=", "dev": true }, - "is-builtin-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", - "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "babel-plugin-transform-es2015-block-scoping": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-block-scoping/-/babel-plugin-transform-es2015-block-scoping-6.26.0.tgz", + "integrity": "sha1-1w9SmcEwjQXBL0Y4E7CgnnOxiV8=", "dev": true }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "babel-plugin-transform-es2015-classes": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-classes/-/babel-plugin-transform-es2015-classes-6.24.1.tgz", + "integrity": "sha1-WkxYpQyclGHlZLSyo7+ryXolhNs=", "dev": true }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "babel-plugin-transform-es2015-computed-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-computed-properties/-/babel-plugin-transform-es2015-computed-properties-6.24.1.tgz", + "integrity": "sha1-b+Ko0WiV1WNPTNmZttNICjCBWbM=", "dev": true }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "babel-plugin-transform-es2015-destructuring": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-destructuring/-/babel-plugin-transform-es2015-destructuring-6.23.0.tgz", + "integrity": "sha1-mXux8auWf2gtKwh2/jWNYOdlxW0=", "dev": true }, - "jison-gho": { - "version": "0.6.0-193", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-193.tgz", - "integrity": "sha512-7aud9KQ8Ka2usOtisRk6nvoFoIzfhMBsztVoD5pEN4faMgJzNCuFNCUVJ098OPWE+SwtveONJf6x1Qe2aKrmmg==", + "babel-plugin-transform-es2015-duplicate-keys": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-duplicate-keys/-/babel-plugin-transform-es2015-duplicate-keys-6.24.1.tgz", + "integrity": "sha1-c+s9MQypaePvnskcU3QabxV2Qj4=", "dev": true }, - "json3": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", - "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "babel-plugin-transform-es2015-for-of": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-for-of/-/babel-plugin-transform-es2015-for-of-6.23.0.tgz", + "integrity": "sha1-9HyVsrYT3x0+zC/bdXNiPHUkhpE=", "dev": true }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "babel-plugin-transform-es2015-function-name": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-function-name/-/babel-plugin-transform-es2015-function-name-6.24.1.tgz", + "integrity": "sha1-g0yJhTvDaxrw86TF26qU/Y6sqos=", "dev": true }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "babel-plugin-transform-es2015-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-literals/-/babel-plugin-transform-es2015-literals-6.22.0.tgz", + "integrity": "sha1-T1SgLWzWbPkVKAAZox0xklN3yi4=", "dev": true }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "babel-plugin-transform-es2015-modules-amd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-amd/-/babel-plugin-transform-es2015-modules-amd-6.24.1.tgz", + "integrity": "sha1-Oz5UAXI5hC1tGcMBHEvS8AoA0VQ=", "dev": true }, - "lodash._baseassign": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", - "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "babel-plugin-transform-es2015-modules-commonjs": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-commonjs/-/babel-plugin-transform-es2015-modules-commonjs-6.26.0.tgz", + "integrity": "sha1-DYOUApt9xqvhqX7xgeAHWN0uXYo=", "dev": true }, - "lodash._basecopy": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", - "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "babel-plugin-transform-es2015-modules-systemjs": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-systemjs/-/babel-plugin-transform-es2015-modules-systemjs-6.24.1.tgz", + "integrity": "sha1-/4mhQrkRmpBhlfXxBuzzBdlAfSM=", "dev": true }, - "lodash._basecreate": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", - "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "babel-plugin-transform-es2015-modules-umd": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-modules-umd/-/babel-plugin-transform-es2015-modules-umd-6.24.1.tgz", + "integrity": "sha1-rJl+YoXNGO1hdq22B9YCNErThGg=", "dev": true }, - "lodash._getnative": { - "version": "3.9.1", - "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", - "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "babel-plugin-transform-es2015-object-super": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-object-super/-/babel-plugin-transform-es2015-object-super-6.24.1.tgz", + "integrity": "sha1-JM72muIcuDp/hgPa0CH1cusnj40=", "dev": true }, - "lodash._isiterateecall": { - "version": "3.0.9", - "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", - "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "babel-plugin-transform-es2015-parameters": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-parameters/-/babel-plugin-transform-es2015-parameters-6.24.1.tgz", + "integrity": "sha1-V6w1GrScrxSpfNE7CfZv3wpiXys=", "dev": true }, - "lodash.create": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", - "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "babel-plugin-transform-es2015-shorthand-properties": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-shorthand-properties/-/babel-plugin-transform-es2015-shorthand-properties-6.24.1.tgz", + "integrity": "sha1-JPh11nIch2YbvZmkYi5R8U3jiqA=", "dev": true }, - "lodash.isarguments": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", - "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "babel-plugin-transform-es2015-spread": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-spread/-/babel-plugin-transform-es2015-spread-6.22.0.tgz", + "integrity": "sha1-1taKmfia7cRTbIGlQujdnxdG+NE=", "dev": true }, - "lodash.isarray": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", - "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "babel-plugin-transform-es2015-sticky-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-sticky-regex/-/babel-plugin-transform-es2015-sticky-regex-6.24.1.tgz", + "integrity": "sha1-AMHNsaynERLN8M9hJsLta0V8zbw=", "dev": true }, - "lodash.keys": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", - "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "babel-plugin-transform-es2015-template-literals": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-template-literals/-/babel-plugin-transform-es2015-template-literals-6.22.0.tgz", + "integrity": "sha1-qEs0UPfp+PH2g51taH2oS7EjbY0=", "dev": true }, - "lru-cache": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", - "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "babel-plugin-transform-es2015-typeof-symbol": { + "version": "6.23.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-typeof-symbol/-/babel-plugin-transform-es2015-typeof-symbol-6.23.0.tgz", + "integrity": "sha1-3sCfHN3/lLUqxz1QXITfWdzOs3I=", "dev": true }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "babel-plugin-transform-es2015-unicode-regex": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-unicode-regex/-/babel-plugin-transform-es2015-unicode-regex-6.24.1.tgz", + "integrity": "sha1-04sS9C6nMj9yk4fxinxa4frrNek=", "dev": true }, - "mimic-fn": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", - "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "babel-plugin-transform-exponentiation-operator": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", "dev": true }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "babel-plugin-transform-export-extensions": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz", + "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", "dev": true }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "babel-plugin-transform-flow-strip-types": { + "version": "6.22.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", + "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", + "dev": true + }, + "babel-plugin-transform-object-rest-spread": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz", + "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", "dev": true }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "babel-plugin-transform-regenerator": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", + "integrity": "sha1-4HA2lvveJ/Cj78rPi03KL3s6jy8=", + "dev": true + }, + "babel-plugin-transform-strict-mode": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-strict-mode/-/babel-plugin-transform-strict-mode-6.24.1.tgz", + "integrity": "sha1-1fr3qleKZbvlkc9e2uBKDGcCB1g=", + "dev": true + }, + "babel-polyfill": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-polyfill/-/babel-polyfill-6.26.0.tgz", + "integrity": "sha1-N5k3q8Z9eJWXCtxiHyhM2WbPIVM=", + "dev": true, + "dependencies": { + "regenerator-runtime": { + "version": "0.10.5", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.10.5.tgz", + "integrity": "sha1-M2w+/BIgrc7dosn6tntaeVWjNlg=", + "dev": true + } + } + }, + "babel-preset-env": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", + "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "dev": true + }, + "babel-preset-es2015": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", + "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", + "dev": true + }, + "babel-preset-modern-browsers": { + "version": "9.0.2", + "resolved": "https://registry.npmjs.org/babel-preset-modern-browsers/-/babel-preset-modern-browsers-9.0.2.tgz", + "integrity": "sha1-/YvgliILIM4jH8f8ZZ0v7Ehs/gQ=", + "dev": true + }, + "babel-preset-stage-1": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", + "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", + "dev": true + }, + "babel-preset-stage-2": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", + "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", + "dev": true + }, + "babel-preset-stage-3": { + "version": "6.24.1", + "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", + "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", + "dev": true + }, + "babel-register": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", + "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", + "dev": true + }, + "babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", + "dev": true + }, + "babel-template": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", + "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", + "dev": true + }, + "babel-traverse": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", + "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", + "dev": true + }, + "babel-types": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", + "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", + "dev": true + }, + "babylon": { + "version": "6.18.0", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", + "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", + "dev": true + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "base": { + "version": "0.11.2", + "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", + "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", + "dev": true, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "binary-extensions": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.10.0.tgz", + "integrity": "sha1-muuabF6IY4qtFx4Wf1kAq+JINdA=", + "dev": true, + "optional": true + }, + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", + "dev": true + }, + "braces": { + "version": "1.8.5", + "resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz", + "integrity": "sha1-uneWLhLf+WnWt2cR6RS3N4V79qc=", + "dev": true, + "optional": true + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "browserslist": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-2.5.1.tgz", + "integrity": "sha512-jAvM2ku7YDJ+leAq3bFH1DE0Ylw+F+EQDq4GkqZfgPEqpWYw9ofQH85uKSB9r3Tv7XDbfqVtE+sdvKJW7IlPJA==", + "dev": true + }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "cache-base": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", + "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", + "dev": true, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "camelcase": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", + "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30000746", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", + "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=", + "dev": true + }, + "chai": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.2.tgz", + "integrity": "sha1-D2RYS6ZC8PKs4oBiefTwbKI61zw=", + "dev": true + }, + "chalk": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", + "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", + "dev": true + }, + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "dev": true + }, + "chokidar": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-1.7.0.tgz", + "integrity": "sha1-eY5ol3gVHIB2tLNg5e3SjNortGg=", + "dev": true, + "optional": true + }, + "class-utils": { + "version": "0.3.5", + "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.5.tgz", + "integrity": "sha1-F+eTEDdQ+WJ7IXbqNM/RtWWQPIA=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "cliui": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", + "integrity": "sha1-EgYBU3qRbSmUD5NNo7SNWFo5IT0=", + "dev": true, + "dependencies": { + "string-width": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "dev": true + } + } + }, + "code-point-at": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "dev": true + }, + "collection-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", + "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", + "dev": true + }, + "color-convert": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", + "integrity": "sha1-Gsz5fdc5uYO/mU1W/sj5WFNkG3o=", + "dev": true + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, + "colors": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", + "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", + "dev": true + }, + "commander": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", + "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", + "dev": true + }, + "component-emitter": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", + "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "convert-source-map": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.0.tgz", + "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", + "dev": true + }, + "copy-descriptor": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", + "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", + "dev": true + }, + "core-js": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=" + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true, + "optional": true + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true + }, + "debug": { + "version": "2.6.9", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", + "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", + "dev": true + }, + "decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true + }, + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", + "dev": true + }, + "define-property": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", + "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", + "dev": true + }, + "detect-indent": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", + "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", + "dev": true + }, + "diff": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.1.tgz", + "integrity": "sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.3.26", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.26.tgz", + "integrity": "sha1-mWQnKUhhp02cfIK5Jg6jAejALWY=", + "dev": true + }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true + }, + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" + }, + "esutils": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "execa": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", + "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", + "dev": true + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha1-BjJjj42HfMghB9MKD/8aF8uhzQw=", + "dev": true + }, + "expand-brackets": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-0.1.5.tgz", + "integrity": "sha1-3wcoTjQqgHzXM6xa9yQR5YHRF3s=", + "dev": true, + "optional": true + }, + "expand-range": { + "version": "1.8.2", + "resolved": "https://registry.npmjs.org/expand-range/-/expand-range-1.8.2.tgz", + "integrity": "sha1-opnv/TNf4nIeuujiV+x5ZE/IUzc=", + "dev": true, + "optional": true + }, + "extend-shallow": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", + "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", + "dev": true + }, + "extglob": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", + "integrity": "sha1-Lhj/PS9JqydlzskCPwEdqo2DSaE=", + "dev": true, + "optional": true + }, + "filename-regex": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/filename-regex/-/filename-regex-2.0.1.tgz", + "integrity": "sha1-wcS5vuPglyXdsQa3XB4wH+LxiyY=", + "dev": true, + "optional": true + }, + "fill-range": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-2.2.3.tgz", + "integrity": "sha1-ULd9/X5Gm8dJJHCWNpn+eoSFpyM=", + "dev": true, + "optional": true + }, + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true + }, + "flow-parser": { + "version": "0.53.1", + "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.53.1.tgz", + "integrity": "sha1-a8lrbQGmlXG+ounKU/T/MY2YtD8=", + "dev": true + }, + "for-in": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", + "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", + "dev": true + }, + "for-own": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/for-own/-/for-own-0.1.5.tgz", + "integrity": "sha1-UmXGgaTylNq78XyVCbZ2OqhFEM4=", + "dev": true, + "optional": true + }, + "fragment-cache": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", + "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", + "dev": true + }, + "fs-readdir-recursive": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz", + "integrity": "sha1-jNF0XItPiinIyuw5JHaSG6GV9WA=", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "fsevents": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.1.2.tgz", + "integrity": "sha512-Sn44E5wQW4bTHXvQmvSHwqbuiXtduD6Rrjm2ZtUEGbyrig+nUH3t/QD4M4/ZXViY556TBpRgZkHLDx3JxPwxiw==", + "dev": true, + "optional": true, + "dependencies": { + "abbrev": { + "version": "1.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "ajv": { + "version": "4.11.8", + "bundled": true, + "dev": true, + "optional": true + }, + "ansi-regex": { + "version": "2.1.1", + "bundled": true, + "dev": true + }, + "aproba": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "are-we-there-yet": { + "version": "1.1.4", + "bundled": true, + "dev": true, + "optional": true + }, + "asn1": { + "version": "0.2.3", + "bundled": true, + "dev": true, + "optional": true + }, + "assert-plus": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "asynckit": { + "version": "0.4.0", + "bundled": true, + "dev": true, + "optional": true + }, + "aws-sign2": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "aws4": { + "version": "1.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "balanced-match": { + "version": "0.4.2", + "bundled": true, + "dev": true + }, + "bcrypt-pbkdf": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "block-stream": { + "version": "0.0.9", + "bundled": true, + "dev": true + }, + "boom": { + "version": "2.10.1", + "bundled": true, + "dev": true + }, + "brace-expansion": { + "version": "1.1.7", + "bundled": true, + "dev": true + }, + "buffer-shims": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "caseless": { + "version": "0.12.0", + "bundled": true, + "dev": true, + "optional": true + }, + "co": { + "version": "4.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "code-point-at": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "combined-stream": { + "version": "1.0.5", + "bundled": true, + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "bundled": true, + "dev": true + }, + "console-control-strings": { + "version": "1.1.0", + "bundled": true, + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "cryptiles": { + "version": "2.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "dashdash": { + "version": "1.14.1", + "bundled": true, + "dev": true, + "optional": true, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "debug": { + "version": "2.6.8", + "bundled": true, + "dev": true, + "optional": true + }, + "deep-extend": { + "version": "0.4.2", + "bundled": true, + "dev": true, + "optional": true + }, + "delayed-stream": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "delegates": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "ecc-jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "extend": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "extsprintf": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "forever-agent": { + "version": "0.6.1", + "bundled": true, + "dev": true, + "optional": true + }, + "form-data": { + "version": "2.1.4", + "bundled": true, + "dev": true, + "optional": true + }, + "fs.realpath": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "fstream": { + "version": "1.0.11", + "bundled": true, + "dev": true + }, + "fstream-ignore": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "gauge": { + "version": "2.7.4", + "bundled": true, + "dev": true, + "optional": true + }, + "getpass": { + "version": "0.1.7", + "bundled": true, + "dev": true, + "optional": true, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "glob": { + "version": "7.1.2", + "bundled": true, + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "bundled": true, + "dev": true + }, + "har-schema": { + "version": "1.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "har-validator": { + "version": "4.2.1", + "bundled": true, + "dev": true, + "optional": true + }, + "has-unicode": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "hawk": { + "version": "3.1.3", + "bundled": true, + "dev": true, + "optional": true + }, + "hoek": { + "version": "2.16.3", + "bundled": true, + "dev": true + }, + "http-signature": { + "version": "1.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "inflight": { + "version": "1.0.6", + "bundled": true, + "dev": true + }, + "inherits": { + "version": "2.0.3", + "bundled": true, + "dev": true + }, + "ini": { + "version": "1.3.4", + "bundled": true, + "dev": true, + "optional": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "is-typedarray": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "isarray": { + "version": "1.0.0", + "bundled": true, + "dev": true + }, + "isstream": { + "version": "0.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "jodid25519": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "jsbn": { + "version": "0.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "json-schema": { + "version": "0.2.3", + "bundled": true, + "dev": true, + "optional": true + }, + "json-stable-stringify": { + "version": "1.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "json-stringify-safe": { + "version": "5.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "jsonify": { + "version": "0.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "jsprim": { + "version": "1.4.0", + "bundled": true, + "dev": true, + "optional": true, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "mime-db": { + "version": "1.27.0", + "bundled": true, + "dev": true + }, + "mime-types": { + "version": "2.1.15", + "bundled": true, + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "bundled": true, + "dev": true + }, + "minimist": { + "version": "0.0.8", + "bundled": true, + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "bundled": true, + "dev": true + }, + "ms": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "node-pre-gyp": { + "version": "0.6.36", + "bundled": true, + "dev": true, + "optional": true + }, + "nopt": { + "version": "4.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "npmlog": { + "version": "4.1.0", + "bundled": true, + "dev": true, + "optional": true + }, + "number-is-nan": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "oauth-sign": { + "version": "0.8.2", + "bundled": true, + "dev": true, + "optional": true + }, + "object-assign": { + "version": "4.1.1", + "bundled": true, + "dev": true, + "optional": true + }, + "once": { + "version": "1.4.0", + "bundled": true, + "dev": true + }, + "os-homedir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "os-tmpdir": { + "version": "1.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "osenv": { + "version": "0.1.4", + "bundled": true, + "dev": true, + "optional": true + }, + "path-is-absolute": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "performance-now": { + "version": "0.2.0", + "bundled": true, + "dev": true, + "optional": true + }, + "process-nextick-args": { + "version": "1.0.7", + "bundled": true, + "dev": true + }, + "punycode": { + "version": "1.4.1", + "bundled": true, + "dev": true, + "optional": true + }, + "qs": { + "version": "6.4.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rc": { + "version": "1.2.1", + "bundled": true, + "dev": true, + "optional": true, + "dependencies": { + "minimist": { + "version": "1.2.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "readable-stream": { + "version": "2.2.9", + "bundled": true, + "dev": true + }, + "request": { + "version": "2.81.0", + "bundled": true, + "dev": true, + "optional": true + }, + "rimraf": { + "version": "2.6.1", + "bundled": true, + "dev": true + }, + "safe-buffer": { + "version": "5.0.1", + "bundled": true, + "dev": true + }, + "semver": { + "version": "5.3.0", + "bundled": true, + "dev": true, + "optional": true + }, + "set-blocking": { + "version": "2.0.0", + "bundled": true, + "dev": true, + "optional": true + }, + "signal-exit": { + "version": "3.0.2", + "bundled": true, + "dev": true, + "optional": true + }, + "sntp": { + "version": "1.0.9", + "bundled": true, + "dev": true, + "optional": true + }, + "sshpk": { + "version": "1.13.0", + "bundled": true, + "dev": true, + "optional": true, + "dependencies": { + "assert-plus": { + "version": "1.0.0", + "bundled": true, + "dev": true, + "optional": true + } + } + }, + "string_decoder": { + "version": "1.0.1", + "bundled": true, + "dev": true + }, + "string-width": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "stringstream": { + "version": "0.0.5", + "bundled": true, + "dev": true, + "optional": true + }, + "strip-ansi": { + "version": "3.0.1", + "bundled": true, + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "tar": { + "version": "2.2.1", + "bundled": true, + "dev": true + }, + "tar-pack": { + "version": "3.4.0", + "bundled": true, + "dev": true, + "optional": true + }, + "tough-cookie": { + "version": "2.3.2", + "bundled": true, + "dev": true, + "optional": true + }, + "tunnel-agent": { + "version": "0.6.0", + "bundled": true, + "dev": true, + "optional": true + }, + "tweetnacl": { + "version": "0.14.5", + "bundled": true, + "dev": true, + "optional": true + }, + "uid-number": { + "version": "0.0.6", + "bundled": true, + "dev": true, + "optional": true + }, + "util-deprecate": { + "version": "1.0.2", + "bundled": true, + "dev": true + }, + "uuid": { + "version": "3.0.1", + "bundled": true, + "dev": true, + "optional": true + }, + "verror": { + "version": "1.3.6", + "bundled": true, + "dev": true, + "optional": true + }, + "wide-align": { + "version": "1.1.2", + "bundled": true, + "dev": true, + "optional": true + }, + "wrappy": { + "version": "1.0.2", + "bundled": true, + "dev": true + } + } + }, + "get-caller-file": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", + "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", + "dev": true + }, + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "dev": true + }, + "get-stream": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", + "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", + "dev": true + }, + "get-value": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", + "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", + "dev": true + }, + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "dev": true + }, + "glob-base": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/glob-base/-/glob-base-0.3.0.tgz", + "integrity": "sha1-27Fk9iIbHAscz4Kuoyi0l98Oo8Q=", + "dev": true, + "optional": true + }, + "glob-parent": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", + "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", + "dev": true + }, + "globals": { + "version": "9.18.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", + "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", + "dev": true + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "growl": { + "version": "1.10.3", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.3.tgz", + "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", + "dev": true + }, + "has-ansi": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", + "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", + "dev": true + }, + "has-color": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", + "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", + "dev": true + }, + "has-flag": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", + "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", + "dev": true + }, + "has-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", + "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", + "dev": true, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "has-values": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", + "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", + "dev": true, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true + } + } + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "home-or-tmp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", + "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", + "dev": true + }, + "hosted-git-info": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.5.0.tgz", + "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "invariant": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", + "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", + "dev": true + }, + "invert-kv": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", + "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", + "dev": true + }, + "is-accessor-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", + "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", + "dev": true + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-binary-path": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", + "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", + "dev": true, + "optional": true + }, + "is-buffer": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true + }, + "is-data-descriptor": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", + "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", + "dev": true + }, + "is-descriptor": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.1.tgz", + "integrity": "sha512-G3fFVFTqfaqu7r4YuSBHKBAuOaLz8Sy7ekklUpFEliaLMP1Y2ZjoN9jS62YWCAPQrQpMUQSitRlrzibbuCZjdA==", + "dev": true, + "dependencies": { + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "is-dotfile": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", + "integrity": "sha1-pqLzL/0t+wT1yiXs0Pa4PPeYoeE=", + "dev": true, + "optional": true + }, + "is-equal-shallow": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/is-equal-shallow/-/is-equal-shallow-0.1.3.tgz", + "integrity": "sha1-IjgJj8Ih3gvPpdnqxMRdY4qhxTQ=", + "dev": true, + "optional": true + }, + "is-extendable": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", + "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", + "dev": true + }, + "is-extglob": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", + "dev": true + }, + "is-finite": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/is-finite/-/is-finite-1.0.2.tgz", + "integrity": "sha1-zGZ3aVYCvlUO8R6LSqYwU0K20Ko=", + "dev": true + }, + "is-fullwidth-code-point": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "dev": true + }, + "is-glob": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", + "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", + "dev": true + }, + "is-number": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", + "integrity": "sha1-Afy7s5NGOlSPL0ZszhbezknbkI8=", + "dev": true, + "optional": true + }, + "is-odd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", + "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", + "dev": true, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true + } + } + }, + "is-plain-object": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", + "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", + "dev": true, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "is-posix-bracket": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", + "integrity": "sha1-MzTceXdDaOkvAW5vvAqI9c1ua8Q=", + "dev": true, + "optional": true + }, + "is-primitive": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", + "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=", + "dev": true, + "optional": true + }, + "is-stream": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true, + "optional": true + }, + "jison-gho": { + "version": "0.6.0-193", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-193.tgz", + "integrity": "sha512-7aud9KQ8Ka2usOtisRk6nvoFoIzfhMBsztVoD5pEN4faMgJzNCuFNCUVJ098OPWE+SwtveONJf6x1Qe2aKrmmg==", + "dev": true, + "dependencies": { + "@gerhobbelt/json5": { + "version": "0.5.1-19", + "resolved": "https://registry.npmjs.org/@gerhobbelt/json5/-/json5-0.5.1-19.tgz", + "integrity": "sha512-TDAMTzjDUosbRbkz/l+wzARC3XYPU6bzMJA2WBmd2fIqKUHixg42fp04fX06aYyyDzM0noxSugl6Z0+l+N29mw==", + "dev": true + } + } + }, + "jison-helpers-lib": { + "version": "0.1.0-194", + "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.1.0-194.tgz", + "integrity": "sha512-+Wo5ycNZw6cPXATbfnkEzbbt0Rmh3sqSl6aKW5tyB/e39ONLhxceutrl1tsJP2EqpxllruoM9soELt649IWVUw==" + }, + "js-tokens": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", + "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", + "dev": true + }, + "jscodeshift": { + "version": "github:GerHobbelt/jscodeshift#cebef559cde6c7402e3f96c8d606bf49d46adae1", + "dev": true, + "dependencies": { + "@gerhobbelt/ast-types": { + "version": "0.9.13-7", + "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.13-7.tgz", + "integrity": "sha512-OKLyvezcD1X9WHXsKfDm2nLhwt1ybNRvErTqVeM5wlq6vQvNMkWKG6SLwG3Y08gkseZWKfe7enhPiJWoJORf3A==" + }, + "@gerhobbelt/recast": { + "version": "github:GerHobbelt/recast#f812f6b96d76dacbe8645e47b0e26d8960997a27" + }, + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "braces": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/braces/-/braces-2.2.2.tgz", + "integrity": "sha1-JB+GjCsmkNn+vu5afIP7vyXQCxs=", + "dev": true + }, + "expand-brackets": { + "version": "2.1.4", + "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", + "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + } + } + }, + "extglob": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/extglob/-/extglob-1.1.0.tgz", + "integrity": "sha1-Bni04s5FwOTlD15er7Gw2rW05CQ=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "to-regex": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-2.1.0.tgz", + "integrity": "sha1-4606QM/hGVWaBa6kPkyu+sxekB0=", + "dev": true, + "dependencies": { + "regex-not": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-0.1.2.tgz", + "integrity": "sha1-vH8cSUSxGINT0H3uuRK5TgreJds=", + "dev": true + } + } + } + } + }, + "fill-range": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", + "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "dependencies": { + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + } + } + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true + }, + "micromatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.0.4.tgz", + "integrity": "sha1-FUPx0EgTRHrIUgAcX1qTNAF4bR0=", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } + }, + "jsesc": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", + "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", + "dev": true + }, + "json5": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", + "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", + "dev": true + }, + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true + }, + "lazy-cache": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", + "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", + "dev": true + }, + "lcid": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", + "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", + "dev": true + }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true + }, + "lodash": { + "version": "4.17.4", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", + "integrity": "sha1-eCA6TRwyiuHYbcpkYONptX9AVa4=", + "dev": true + }, + "loose-envify": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.3.1.tgz", + "integrity": "sha1-0aitM/qc4OcT1l/dCsi3SNR4yEg=", + "dev": true + }, + "lru-cache": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz", + "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", + "dev": true + }, + "map-cache": { + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", + "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", + "dev": true + }, + "map-visit": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", + "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", + "dev": true + }, + "mem": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", + "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", + "dev": true + }, + "micromatch": { + "version": "2.3.11", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-2.3.11.tgz", + "integrity": "sha1-hmd8l9FyCzY0MdBNDRUpO9OMFWU=", + "dev": true, + "optional": true + }, + "mimic-fn": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.1.0.tgz", + "integrity": "sha1-5md4PZLonb00KBi1IwudYqZyrRg=", + "dev": true + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mixin-deep": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.2.0.tgz", + "integrity": "sha1-0CuMb4ttS49ZgtP9AJxJGYUcP+I=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true + }, + "mocha": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-4.0.1.tgz", + "integrity": "sha512-evDmhkoA+cBNiQQQdSKZa2b9+W2mpLoj50367lhy+Klnx9OV8XlCIhigUnn1gaTFLQCa0kdNhEGDr0hCXOQFDw==", + "dev": true, + "dependencies": { + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true + }, + "supports-color": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", + "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "dev": true + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "nan": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.7.0.tgz", + "integrity": "sha1-2Vv3IeyHfgjbJ27T/G63j5CDrUY=", + "dev": true, + "optional": true + }, + "nanomatch": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.3.tgz", + "integrity": "sha512-HqDMQWJlwpXbfKDpAnkc6AJQh5PFqVlrjYbruDjYVAS+05TQUb1qhIde4G9jMzHbs/u6bgEok1jMAV4yJzoh+w==", + "dev": true, + "dependencies": { + "arr-diff": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", + "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "dev": true + }, + "array-unique": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", + "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "node-dir": { + "version": "0.1.17", + "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz", + "integrity": "sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU=", "dev": true }, - "mocha": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", - "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", + "nomnom": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", + "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", "dev": true, "dependencies": { - "debug": { - "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "ansi-styles": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", + "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", "dev": true }, - "has-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", - "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "chalk": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", + "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", "dev": true }, - "supports-color": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", - "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "strip-ansi": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", + "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", + "dev": true + }, + "underscore": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", + "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", "dev": true } } }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", - "dev": true - }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", "dev": true }, + "normalize-path": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", + "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", + "dev": true + }, "npm-run-path": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", @@ -510,18 +2393,105 @@ "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "object-copy": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", + "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true, + "dependencies": { + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + } + } + }, + "object-visit": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", + "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", + "dev": true, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "object.omit": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", + "integrity": "sha1-Gpx0SCnznbuFjHbKNXmuKlTr0fo=", + "dev": true, + "optional": true + }, + "object.pick": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", + "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", + "dev": true, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true }, + "os-homedir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "dev": true + }, "os-locale": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", "dev": true }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, + "output-file-sync": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/output-file-sync/-/output-file-sync-1.1.2.tgz", + "integrity": "sha1-0KM+7+YaIF+suQCS6CZZjVJFznY=", + "dev": true + }, "p-finally": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", @@ -540,12 +2510,25 @@ "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", "dev": true }, + "parse-glob": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/parse-glob/-/parse-glob-3.0.4.tgz", + "integrity": "sha1-ssN2z7EfNVE7rdFz7wu246OIORw=", + "dev": true, + "optional": true + }, "parse-json": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true }, + "pascalcase": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", + "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", + "dev": true + }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -582,11 +2565,30 @@ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, + "posix-character-classes": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", + "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", + "dev": true + }, + "preserve": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", + "integrity": "sha1-gV7R9uvGWSb4ZbMQwHE7yzMVzks=", + "dev": true, + "optional": true + }, "private": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", - "dev": true + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + }, + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "dev": true, + "optional": true }, "pseudomap": { "version": "1.0.2", @@ -594,6 +2596,38 @@ "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "dev": true }, + "randomatic": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/randomatic/-/randomatic-1.1.7.tgz", + "integrity": "sha512-D5JUjPyJbaJDkuAazpVnSfVkLlpeO3wDlPROTMLGKG1zMFNFRgrciKo1ltz/AzNTkqE0HzDx655QOL51N06how==", + "dev": true, + "optional": true, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true, + "optional": true, + "dependencies": { + "kind-of": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", + "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", + "dev": true, + "optional": true + } + } + }, + "kind-of": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", + "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", + "dev": true, + "optional": true + } + } + }, "read-pkg": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", @@ -606,6 +2640,101 @@ "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", "dev": true }, + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha512-m+qzzcn7KUxEmd1gMbchF+Y2eIUbieUaxkWtptyHywrX0rE8QEYqPC07Vuy4Wm32/xE16NcdBctb8S0Xe/5IeQ==", + "dev": true, + "optional": true + }, + "readdirp": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", + "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", + "dev": true, + "optional": true + }, + "regenerate": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.3.3.tgz", + "integrity": "sha512-jVpo1GadrDAK59t/0jRx5VxYWQEDkkEKi6+HjE3joFVLfDOh9Xrdh0dF1eSq+BI/SwvTQ44gSscJ8N5zYL61sg==", + "dev": true + }, + "regenerator-runtime": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", + "dev": true + }, + "regenerator-transform": { + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.10.1.tgz", + "integrity": "sha512-PJepbvDbuK1xgIgnau7Y90cwaAmO/LCLMI2mPvaXq2heGMR3aWW5/BQvYrhJ8jgmQjXewXvBjzfqKcVOmhjZ6Q==", + "dev": true + }, + "regex-cache": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/regex-cache/-/regex-cache-0.4.4.tgz", + "integrity": "sha512-nVIZwtCjkC9YgvWkpM55B5rBhBYRZhAaJbgcFYXXsHnbZ9UZI9nnVWYZpBlCqv9ho2eZryPnWrZGsOdPwVWXWQ==", + "dev": true, + "optional": true + }, + "regex-not": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", + "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", + "dev": true + }, + "regexpu-core": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", + "integrity": "sha1-SdA4g3uNz4v6W5pCE5k45uoq4kA=", + "dev": true + }, + "regjsgen": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/regjsgen/-/regjsgen-0.2.0.tgz", + "integrity": "sha1-bAFq3qxVT3WCP+N6wFuS1aTtsfc=", + "dev": true + }, + "regjsparser": { + "version": "0.1.5", + "resolved": "https://registry.npmjs.org/regjsparser/-/regjsparser-0.1.5.tgz", + "integrity": "sha1-fuj4Tcb6eS0/0K4ijSS9lJ6tIFw=", + "dev": true, + "dependencies": { + "jsesc": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-0.5.0.tgz", + "integrity": "sha1-597mbjXW/Bb3EP6R1c9p9w8IkR0=", + "dev": true + } + } + }, + "remove-trailing-separator": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", + "dev": true + }, + "repeat-element": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", + "dev": true + }, + "repeat-string": { + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", + "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", + "dev": true + }, + "repeating": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/repeating/-/repeating-2.0.1.tgz", + "integrity": "sha1-UhTFOpJtNVJwdSf7q0FdvAjQbdo=", + "dev": true + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", @@ -618,6 +2747,30 @@ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, + "resolve-url": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", + "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", + "dev": true + }, + "rimraf": { + "version": "2.2.8", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", + "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", + "dev": true + }, + "rollup": { + "version": "0.50.0", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.50.0.tgz", + "integrity": "sha512-7RqCBQ9iwsOBPkjYgoIaeUij606mSkDMExP0NT7QDI3bqkHYQHrQ83uoNIXwPcQm/vP2VbsUz3kiyZZ1qPlLTQ==", + "dev": true + }, + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", + "dev": true + }, "semver": { "version": "5.4.1", "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", @@ -630,6 +2783,33 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, + "set-getter": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", + "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", + "dev": true + }, + "set-immediate-shim": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", + "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "dev": true, + "optional": true + }, + "set-value": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", + "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "dev": true, + "dependencies": { + "split-string": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.0.2.tgz", + "integrity": "sha512-d6myUSfwmBz1izkY4r7r7I0PL41rh21qUDYK1OgclmGHeoqQoujduGxMbzw6BlF3HKmJR4sMpbWVo7/Xzg4YBQ==", + "dev": true + } + } + }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -648,12 +2828,82 @@ "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true }, + "slash": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", + "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", + "dev": true + }, + "snapdragon": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", + "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "snapdragon-node": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", + "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "dev": true, + "dependencies": { + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "snapdragon-util": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", + "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "dev": true + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", "dev": true }, + "source-map-resolve": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.0.tgz", + "integrity": "sha1-/K0LZLcK+ydpnkJZUMtevNQQvCA=", + "dev": true + }, + "source-map-support": { + "version": "0.4.18", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", + "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", + "dev": true + }, + "source-map-url": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", + "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", + "dev": true + }, "spdx-correct": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-1.0.2.tgz", @@ -672,6 +2922,45 @@ "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, + "split-string": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/split-string/-/split-string-2.1.1.tgz", + "integrity": "sha1-r0sG2CFWBCZEbDzZMc2mGJQNN9A=", + "dev": true + }, + "static-extend": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", + "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "string_decoder": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", + "integrity": "sha512-4AH6Z5fzNNBcH+6XDMfA/BTt87skxqJlO0lAh3Dker5zThcAxG6mKz+iGu308UKoPPQ8Dcqx/4JhujzltRa+hQ==", + "dev": true, + "optional": true + }, "string-width": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", @@ -717,9 +3006,73 @@ "dev": true }, "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", + "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", + "dev": true + }, + "temp": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", + "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", + "dev": true + }, + "to-fast-properties": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", + "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", + "dev": true + }, + "to-object-path": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", + "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", + "dev": true + }, + "to-regex": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", + "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "to-regex-range": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", + "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", + "dev": true, + "dependencies": { + "is-number": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", + "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", + "dev": true + } + } + }, + "trim-right": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", + "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", "dev": true }, "type-detect": { @@ -734,6 +3087,111 @@ "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", "dev": true }, + "union-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", + "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "dev": true, + "dependencies": { + "set-value": { + "version": "0.4.3", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", + "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", + "dev": true + } + } + }, + "unset-value": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", + "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", + "dev": true, + "dependencies": { + "has-value": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", + "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", + "dev": true, + "dependencies": { + "isobject": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", + "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", + "dev": true + } + } + }, + "has-values": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", + "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + } + } + }, + "urix": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", + "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", + "dev": true + }, + "use": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", + "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", + "dev": true, + "dependencies": { + "define-property": { + "version": "0.2.5", + "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", + "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "dev": true + }, + "is-descriptor": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", + "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", + "dev": true + }, + "isobject": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", + "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", + "dev": true + }, + "kind-of": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", + "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "dev": true + } + } + }, + "user-home": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", + "integrity": "sha1-K1viOjK2Onyd640PKNSFcko98ZA=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true, + "optional": true + }, + "v8flags": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/v8flags/-/v8flags-2.1.1.tgz", + "integrity": "sha1-qrGh+jDUX4jdMhFIh1rALAtV5bQ=", + "dev": true + }, "validate-npm-package-license": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.1.tgz", @@ -772,6 +3230,12 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, + "write-file-atomic": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", + "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", + "dev": true + }, "y18n": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", diff --git a/package.json b/package.json index 3e253c3..051acb1 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "name": "@gerhobbelt/lex-parser", "version": "0.6.0-194", "description": "A parser for lexical grammars used by jison", - "main": "lex-parser.js", + "main": "dist/lex-parser-cjs-es5.js", + "module": "lex-parser.js", "scripts": { "test": "make test", "pub": "npm publish --access public" @@ -27,11 +28,16 @@ "node": ">=4.0" }, "dependencies": { - "@gerhobbelt/xregexp": "3.2.0-21" + "@gerhobbelt/xregexp": "3.2.0-21", + "jison-helpers-lib": "0.1.0-194" }, "devDependencies": { + "babel-cli": "6.26.0", + "babel-preset-env": "1.6.0", + "babel-preset-modern-browsers": "9.0.2", "chai": "4.1.2", "jison-gho": "0.6.0-193", - "mocha": "4.0.0" + "mocha": "4.0.1", + "rollup": "0.50.0" } } From 8271fdddae5b1b099b4b719d2a15abf2bdb6c393 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 12 Oct 2017 21:52:23 +0200 Subject: [PATCH 388/417] security fix: use safe `JSON.parse()` instead of unsafe `eval()` to check if a user-specified lexer rule is eligible for `easy_keyword_rules` processing mode. --- lex.y | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lex.y b/lex.y index 39d9f61..e216a2b 100644 --- a/lex.y +++ b/lex.y @@ -455,7 +455,7 @@ regex // Convert Unicode escapes and other escapes to their literal characters // BEFORE we go and check whether this item is subject to the // `easy_keyword_rules` option. - $$ = eval('"' + $$ + '"'); + $$ = JSON.parse('"' + $$ + '"'); } catch (ex) { yyparser.warn('easy-keyword-rule FAIL on eval: ', ex); From 073cda183f98af165f3ada1d08e5aa6c30546363 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 12 Oct 2017 21:56:22 +0200 Subject: [PATCH 389/417] using rollup+babel to move towards using a ES2015 codebase for the lexer generator. (Aparently nobody ever used jison ES6 output mode as there were a few fatal API problems in there too. These have been fixed provisionally) The generated code is `import`-patched in a rather hacky way as jison doesn't yet correctly support the desirable `%code imports %{...%}` feature... --- Makefile | 15 +++- lex-parser-prelude.js | 9 +++ lex-parser.js | 159 +++++++++++++++++++++++------------------- lex.l | 7 +- lex.y | 12 +++- rollup.config.js | 19 +++++ tests/all-tests.js | 2 +- 7 files changed, 146 insertions(+), 77 deletions(-) create mode 100644 lex-parser-prelude.js create mode 100644 rollup.config.js diff --git a/Makefile b/Makefile index bf25adb..a2f0a88 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,10 @@ else JISON = node ../../lib/cli.js endif +ROLLUP = node_modules/.bin/rollup +BABEL = node_modules/.bin/babel +MOCHA = node_modules/.bin/mocha + @@ -24,10 +28,17 @@ build: ifeq ($(wildcard ./node_modules/.bin/jison),) $(error "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###") endif - $(JISON) -o lex-parser.js lex.y lex.l + $(JISON) -m es -o lex-parser.js lex.y lex.l + -mkdir -p dist + cat lex-parser-prelude.js > lex-parser-base.js + cat lex-parser.js >> lex-parser-base.js + cat lex-parser-base.js > lex-parser.js + $(ROLLUP) -c + $(BABEL) dist/lex-parser-cjs.js -o dist/lex-parser-cjs-es5.js + $(BABEL) dist/lex-parser-umd.js -o dist/lex-parser-umd-es5.js test: - node_modules/.bin/mocha --timeout 18000 --check-leaks --globals assert tests/ + $(MOCHA) --timeout 18000 --check-leaks --globals assert tests/ # increment the XXX number in the package.json file: version ..- diff --git a/lex-parser-prelude.js b/lex-parser-prelude.js new file mode 100644 index 0000000..0a54bb7 --- /dev/null +++ b/lex-parser-prelude.js @@ -0,0 +1,9 @@ + +import fs from 'fs'; + +import XRegExp from '@gerhobbelt/xregexp'; +import helpers from 'jison-helpers-lib'; + +// hack: +var assert; + diff --git a/lex-parser.js b/lex-parser.js index fabd91c..67f49a2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,4 +1,13 @@ +import fs from 'fs'; + +import XRegExp from '@gerhobbelt/xregexp'; +import helpers from 'jison-helpers-lib'; + +// hack: +var assert; + + /* parser generated by jison 0.6.0-194 */ /* @@ -375,7 +384,8 @@ * rule regexes have been written as standard JavaScript RegExp expressions. * } */ -var lexParser = (function () { + + // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 @@ -429,6 +439,9 @@ JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; +// import XRegExp from '@gerhobbelt/xregexp'; +// import helpers from 'jison-helpers-lib'; +// import fs from 'fs'; // helper: reconstruct the productions[] table @@ -557,7 +570,7 @@ var parser = { // parser table compression mode: ... 2 // export debug tables: ............. false // export *all* tables: ............. false - // module type: ..................... commonjs + // module type: ..................... es // parser engine type: .............. lalr // output main() in the module: ..... true // number of expected conflicts: .... 0 @@ -1795,10 +1808,10 @@ case 58: // Convert Unicode escapes and other escapes to their literal characters // BEFORE we go and check whether this item is subject to the // `easy_keyword_rules` option. - this.$ = eval('"' + this.$ + '"'); + this.$ = JSON.parse('"' + this.$ + '"'); } catch (ex) { - this.warn('easy-keyword-rule FAIL on eval: ', ex); + yyparser.warn('easy-keyword-rule FAIL on eval: ', ex); // make the next keyword test fail: this.$ = '.'; @@ -2055,7 +2068,7 @@ case 92: } else { this.$ = yyvstack[yysp]; } - //this.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; case 95: @@ -2179,7 +2192,6 @@ case 108: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - var fs = require('fs'); var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); // And no, we don't support nested '%include': this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; @@ -4921,8 +4933,6 @@ yyError: 1 parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; -var XRegExp = require('@gerhobbelt/xregexp'); -var helpers = require('../../modules/helpers-lib'); var rmCommonWS = helpers.rmCommonWS; function encodeRE(s) { @@ -5306,7 +5316,7 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// <-- internal rule set cache for the current lexer state + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use @@ -5474,7 +5484,10 @@ var lexer = function() { this.yytext = ''; this.yyleng = 0; this.match = ''; + + // - DO NOT reset `this.matched` this.matches = false; + this._more = false; this._backtrack = false; var col = (this.yylloc ? this.yylloc.last_column : 0); @@ -5560,48 +5573,61 @@ var lexer = function() { }, /** - * push a new input into the lexer and activate it: - * the old input position is stored and will be resumed - * once this new input has been consumed. + * edit the remaining input via user-specified callback. + * This can be used to forward-adjust the input-to-parse, + * e.g. inserting macro expansions and alike in the + * input which has yet to be lexed. + * The behaviour of this API contrasts the `unput()` et al + * APIs as those act on the *consumed* input, while this + * one allows one to manipulate the future, without impacting + * the current `yyloc` cursor location or any history. * * Use this API to help implement C-preprocessor-like - * `#include` statements. + * `#include` statements, etc. * - * Available options: + * The provided callback must be synchronous and is + * expected to return the edited input (string). + * + * The `cpsArg` argument value is passed to the callback + * as-is. + * + * `callback` interface: + * `function callback(input, cpsArg)` * - * - `emit_EOF_at_end` : {int} the `EOF`-like token to emit - * when the new input is consumed: use - * this to mark the end of the new input - * in the parser grammar. zero/falsey - * token value means no end marker token - * will be emitted before the lexer - * resumes reading from the previous input. + * - `input` will carry the remaining-input-to-lex string + * from the lexer. + * - `cpsArg` is `cpsArg` passed into this API. + * + * The `this` reference for the callback will be set to + * reference this lexer instance so that userland code + * in the callback can easily and quickly access any lexer + * API. + * + * When the callback returns a non-string-type falsey value, + * we assume the callback did not edit the input and we + * will using the input as-is. + * + * When the callback returns a non-string-type value, it + * is converted to a string for lexing via the `"" + retval` + * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html + * -- that way any returned object's `toValue()` and `toString()` + * methods will be invoked in a proper/desirable order.) * * @public * @this {RegExpLexer} */ - pushInput: function lexer_pushInput(input, label, options) { - options = options || {}; - this._input = input || ''; - this.clear(); - - // this._signaled_error_token = false; - this.done = false; - - this.yylineno = 0; - this.matched = ''; - - // this.conditionStack = ['INITIAL']; - // this.__currentRuleSet__ = null; - this.yylloc = { - first_line: 1, - first_column: 0, - last_line: 1, - last_column: 0, - range: [0, 0] - }; + editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) { + var rv = callback.call(this, this._input, cpsArg); + + if (typeof rv !== 'string') { + if (rv) { + this._input = '' + rv; + } + // else: keep `this._input` as is. + } else { + this._input = rv; + } - this.offset = 0; return this; }, @@ -5818,6 +5844,16 @@ var lexer = function() { * Limit the returned string to the `maxLines` number of lines of input (default: 1). * * Negative limit values equal *unlimited*. + * + * > ### NOTE ### + * > + * > *"upcoming input"* is defined as the whole of the both + * > the *currently lexed* input, together with any remaining input + * > following that. *"currently lexed"* input is the input + * > already recognized by the lexer but not yet returned with + * > the lexer token. This happens when you are invoking this API + * > from inside any lexer rule action code block. + * > * * @public * @this {RegExpLexer} @@ -6115,6 +6151,7 @@ var lexer = function() { this.yytext += match_str; this.match += match_str; + this.matched += match_str; this.matches = match; this.yyleng = this.yytext.length; this.yylloc.range[1] += match_str_len; @@ -6127,7 +6164,6 @@ var lexer = function() { this._more = false; this._backtrack = false; this._input = this._input.slice(match_str_len); - this.matched += match_str; // calling this method: // @@ -6229,10 +6265,7 @@ var lexer = function() { } var rule_ids = spec.rules; - - //var dispatch = spec.__dispatch_lut; var regexes = spec.__rule_regexes; - var len = spec.__rule_count; // Note: the arrays are 1-based, while `len` itself is a valid index, @@ -6331,16 +6364,6 @@ var lexer = function() { r = this.next(); } - if (0) { - console.log('@@@@@@@@@ lex: ', { - token: r, - sym: this.yy.parser && typeof this.yy.parser.describeSymbol === 'function' && this.yy.parser.describeSymbol(r), - describeTypeFunc: this.yy.parser && typeof this.yy.parser.describeSymbol, - condition: this.conditionStack, - text: this.yytext - }, '\n' + ((this.showPosition ? this.showPosition() : '???'))); - } - if (typeof this.options.post_lex === 'function') { // (also account for a userdef function which does not return any value: keep the token as is) r = this.options.post_lex.call(this, r) || r; @@ -7743,7 +7766,6 @@ var lexer = function() { } }; - var helpers = require('../../modules/helpers-lib'); var rmCommonWS = helpers.rmCommonWS; var dquote = helpers.dquote; @@ -7787,22 +7809,19 @@ var lexer = function() { parser.lexer = lexer; function Parser() { - this.yy = {}; + this.yy = {}; } Parser.prototype = parser; parser.Parser = Parser; -return new Parser(); -})(); - - +function yyparse() { + return parser.parse.apply(parser, arguments); +} +export { + parser, + Parser, + yyparse as parse, + +}; -if (typeof require !== 'undefined' && typeof exports !== 'undefined') { - exports.parser = lexParser; - exports.Parser = lexParser.Parser; - exports.parse = function () { - return lexParser.parse.apply(lexParser, arguments); - }; - -} diff --git a/lex.l b/lex.l index 3cceb2e..089c128 100644 --- a/lex.l +++ b/lex.l @@ -1,4 +1,10 @@ +%code imports %{ +// import helpers from 'jison-helpers-lib'; +%} + + + ASCII_LETTER [a-zA-z] // \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge // with {UNICODE_LETTER} (though jison has code to optimize if you *did* @@ -443,7 +449,6 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] %% -var helpers = require('../../modules/helpers-lib'); var rmCommonWS = helpers.rmCommonWS; var dquote = helpers.dquote; diff --git a/lex.y b/lex.y index e216a2b..374c8ea 100644 --- a/lex.y +++ b/lex.y @@ -1,4 +1,12 @@ +%code imports %{ +// import XRegExp from '@gerhobbelt/xregexp'; +// import helpers from 'jison-helpers-lib'; +// import fs from 'fs'; +%} + + + %start lex /* Jison lexer file format grammar */ @@ -675,7 +683,6 @@ extra_lexer_module_code include_macro_code : INCLUDE PATH { - var fs = require('fs'); var fileContent = fs.readFileSync($PATH, { encoding: 'utf-8' }); // And no, we don't support nested '%include': $$ = '\n// Included by Jison: ' + $PATH + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + $PATH + '\n\n'; @@ -723,8 +730,7 @@ optional_module_code_chunk %% -var XRegExp = require('@gerhobbelt/xregexp'); -var helpers = require('../../modules/helpers-lib'); + var rmCommonWS = helpers.rmCommonWS; function encodeRE(s) { diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..16957ca --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,19 @@ +// rollup.config.js +export default { + input: 'lex-parser.js', + output: [ + { + file: 'dist/lex-parser-cjs.js', + format: 'cjs' + }, + { + file: 'dist/lex-parser-es6.js', + format: 'es' + }, + { + file: 'dist/lex-parser-umd.js', + name: 'lex-parser', + format: 'umd' + } + ] +}; diff --git a/tests/all-tests.js b/tests/all-tests.js index 562422a..b945311 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -1,5 +1,5 @@ var assert = require("chai").assert; -var lex = require("../lex-parser"); +var lex = require("../dist/lex-parser-cjs-es5"); var fs = require('fs'); var path = require('path'); From 9825902112ef4ccbf01b56f8b035e9c20e866f6c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Thu, 12 Oct 2017 21:57:44 +0200 Subject: [PATCH 390/417] kill scratch files in the build process and include the ES5, etc. generated "distribution" library files. --- Makefile | 1 + dist/lex-parser-cjs-es5.js | 5687 ++++++++++++++++++++++++++ dist/lex-parser-cjs.js | 7809 +++++++++++++++++++++++++++++++++++ dist/lex-parser-es6.js | 7801 +++++++++++++++++++++++++++++++++++ dist/lex-parser-umd-es5.js | 5689 ++++++++++++++++++++++++++ dist/lex-parser-umd.js | 7813 ++++++++++++++++++++++++++++++++++++ 6 files changed, 34800 insertions(+) create mode 100644 dist/lex-parser-cjs-es5.js create mode 100644 dist/lex-parser-cjs.js create mode 100644 dist/lex-parser-es6.js create mode 100644 dist/lex-parser-umd-es5.js create mode 100644 dist/lex-parser-umd.js diff --git a/Makefile b/Makefile index a2f0a88..372d767 100644 --- a/Makefile +++ b/Makefile @@ -33,6 +33,7 @@ endif cat lex-parser-prelude.js > lex-parser-base.js cat lex-parser.js >> lex-parser-base.js cat lex-parser-base.js > lex-parser.js + -rm lex-parser-base.js $(ROLLUP) -c $(BABEL) dist/lex-parser-cjs.js -o dist/lex-parser-cjs-es5.js $(BABEL) dist/lex-parser-umd.js -o dist/lex-parser-umd-es5.js diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js new file mode 100644 index 0000000..17828ef --- /dev/null +++ b/dist/lex-parser-cjs-es5.js @@ -0,0 +1,5687 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject2 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject3 = _taggedTemplateLiteral(['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject4 = _taggedTemplateLiteral(['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject5 = _taggedTemplateLiteral(['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject6 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject7 = _taggedTemplateLiteral(['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject8 = _taggedTemplateLiteral(['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), + _templateObject9 = _taggedTemplateLiteral(['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), + _templateObject10 = _taggedTemplateLiteral(['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n '], ['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n ']), + _templateObject11 = _taggedTemplateLiteral(['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject12 = _taggedTemplateLiteral(['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject13 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject14 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject15 = _taggedTemplateLiteral(['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject16 = _taggedTemplateLiteral(['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject17 = _taggedTemplateLiteral(['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject18 = _taggedTemplateLiteral(['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject19 = _taggedTemplateLiteral(['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%\\}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), + _templateObject20 = _taggedTemplateLiteral(['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%\\}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), + _templateObject21 = _taggedTemplateLiteral(['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n ']), + _templateObject22 = _taggedTemplateLiteral(['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n '], ['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n ']), + _templateObject23 = _taggedTemplateLiteral(['\n unterminated string constant in %options entry.\n\n Erroneous area:\n '], ['\n unterminated string constant in %options entry.\n\n Erroneous area:\n ']), + _templateObject24 = _taggedTemplateLiteral(['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n '], ['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n ']), + _templateObject25 = _taggedTemplateLiteral(['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n '], ['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n ']), + _templateObject26 = _taggedTemplateLiteral(['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n ']); + +function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault(ex) { + return ex && (typeof ex === 'undefined' ? 'undefined' : _typeof(ex)) === 'object' && 'default' in ex ? ex['default'] : ex; +} + +var fs = _interopDefault(require('fs')); +var XRegExp = _interopDefault(require('@gerhobbelt/xregexp')); +var helpers = _interopDefault(require('jison-helpers-lib')); + +// hack: +var assert; + +/* parser generated by jison 0.6.0-194 */ + +/* + * Returns a Parser object of the following structure: + * + * Parser: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a derivative/copy of this one, + * not a direct reference! + * } + * + * Parser.prototype: { + * yy: {}, + * EOF: 1, + * TERROR: 2, + * + * trace: function(errorMessage, ...), + * + * JisonParserError: function(msg, hash), + * + * quoteName: function(name), + * Helper function which can be overridden by user code later on: put suitable + * quotes around literal IDs in a description string. + * + * originalQuoteName: function(name), + * The basic quoteName handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function + * at the end of the `parse()`. + * + * describeSymbol: function(symbol), + * Return a more-or-less human-readable description of the given symbol, when + * available, or the symbol itself, serving as its own 'description' for lack + * of something better to serve up. + * + * Return NULL when the symbol is unknown to the parser. + * + * symbols_: {associative list: name ==> number}, + * terminals_: {associative list: number ==> name}, + * nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}}, + * terminal_descriptions_: (if there are any) {associative list: number ==> description}, + * productions_: [...], + * + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) + * to store/reference the rule value `$$` and location info `@$`. + * + * One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets + * to see the same object via the `this` reference, i.e. if you wish to carry custom + * data from one reduce action through to the next within a single parse run, then you + * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. + * + * `this.yy` is a direct reference to the `yy` shared state object. + * + * `%parse-param`-specified additional `parse()` arguments have been added to this `yy` + * object at `parse()` start and are therefore available to the action code via the + * same named `yy.xxxx` attributes (where `xxxx` represents a identifier name from + * the %parse-param` list. + * + * - `yytext` : reference to the lexer value which belongs to the last lexer token used + * to match this rule. This is *not* the look-ahead token, but the last token + * that's actually part of this rule. + * + * Formulated another way, `yytext` is the value of the token immediately preceeding + * the current look-ahead token. + * Caveats apply for rules which don't require look-ahead, such as epsilon rules. + * + * - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value. + * + * - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value. + * + * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. + * + * WARNING: since jison 0.4.18-186 this entry may be NULL/UNDEFINED instead + * of an empty object when no suitable location info can be provided. + * + * - `yystate` : the current parser state number, used internally for dispatching and + * executing the action code chunk matching the rule currently being reduced. + * + * - `yysp` : the current state stack position (a.k.a. 'stack pointer') + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * Also note that you can access this and other stack index values using the new double-hash + * syntax, i.e. `##$ === ##0 === yysp`, while `##1` is the stack index for all things + * related to the first rule term, just like you have `$1`, `@1` and `#1`. + * This is made available to write very advanced grammar action rules, e.g. when you want + * to investigate the parse state stack in your action code, which would, for example, + * be relevant when you wish to implement error diagnostics and reporting schemes similar + * to the work described here: + * + * + Pottier, F., 2016. Reachability and error diagnosis in LR(1) automata. + * In Journées Francophones des Languages Applicatifs. + * + * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. + * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. + * + * - `yyrulelength`: the current rule's term count, i.e. the number of entries occupied on the stack. + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. + * constructs. + * + * - `yylstack`: reference to the parser token location stack. Also accessed via + * the `@1` etc. constructs. + * + * WARNING: since jison 0.4.18-186 this array MAY contain slots which are + * UNDEFINED rather than an empty (location) object, when the lexer/parser + * action code did not provide a suitable location info object when such a + * slot was filled! + * + * - `yystack` : reference to the parser token id stack. Also accessed via the + * `#1` etc. constructs. + * + * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to + * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might + * want access this array for your own purposes, such as error analysis as mentioned above! + * + * Note that this stack stores the current stack of *tokens*, that is the sequence of + * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* + * (lexer tokens *shifted* onto the stack until the rule they belong to is found and + * *reduced*. + * + * - `yysstack`: reference to the parser state stack. This one carries the internal parser + * *states* such as the one in `yystate`, which are used to represent + * the parser state machine in the *parse table*. *Very* *internal* stuff, + * what can I say? If you access this one, you're clearly doing wicked things + * + * - `...` : the extra arguments you specified in the `%parse-param` statement in your + * grammar definition file. + * + * table: [...], + * State transition table + * ---------------------- + * + * index levels are: + * - `state` --> hash table + * - `symbol` --> action (number or array) + * + * If the `action` is an array, these are the elements' meaning: + * - index [0]: 1 = shift, 2 = reduce, 3 = accept + * - index [1]: GOTO `state` + * + * If the `action` is a number, it is the GOTO `state` + * + * defaultActions: {...}, + * + * parseError: function(str, hash, ExceptionClass), + * yyError: function(str, ...), + * yyRecovering: function(), + * yyErrOk: function(), + * yyClearIn: function(), + * + * constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this parser kernel in many places; example usage: + * + * var infoObj = parser.constructParseErrorInfo('fail!', null, + * parser.collect_expected_token_set(state), true); + * var retVal = parser.parseError(infoObj.errStr, infoObj, parser.JisonParserError); + * + * originalParseError: function(str, hash, ExceptionClass), + * The basic `parseError` handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function + * at the end of the `parse()`. + * + * options: { ... parser %options ... }, + * + * parse: function(input[, args...]), + * Parse the given `input` and return the parsed value (or `true` when none was provided by + * the root action, in which case the parser is acting as a *matcher*). + * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * the lexer section of the grammar spec): these will be inserted in the `yy` shared state + * object and any collision with those will be reported by the lexer via a thrown exception. + * + * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown + * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY + * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and + * the internal parser gets properly garbage collected under these particular circumstances. + * + * yyMergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API can be invoked to calculate a spanning `yylloc` location info object. + * + * Note: %epsilon rules MAY specify no `first_index` and `first_yylloc`, in which case + * this function will attempt to obtain a suitable location marker by inspecting the location stack + * backwards. + * + * For more info see the documentation comment further below, immediately above this function's + * implementation. + * + * lexer: { + * yy: {...}, A reference to the so-called "shared state" `yy` once + * received via a call to the `.setInput(input, yy)` lexer API. + * EOF: 1, + * ERROR: 2, + * JisonLexerError: function(msg, hash), + * parseError: function(str, hash, ExceptionClass), + * setInput: function(input, [yy]), + * input: function(), + * unput: function(str), + * more: function(), + * reject: function(), + * less: function(n), + * pastInput: function(n), + * upcomingInput: function(n), + * showPosition: function(), + * test_match: function(regex_match_array, rule_index, ...), + * next: function(...), + * lex: function(...), + * begin: function(condition), + * pushState: function(condition), + * popState: function(), + * topState: function(), + * _currentRules: function(), + * stateStackSize: function(), + * cleanupAfterLex: function() + * + * options: { ... lexer %options ... }, + * + * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...), + * rules: [...], + * conditions: {associative list: name ==> set}, + * } + * } + * + * + * token location info (@$, _$, etc.): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer and + * parser errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * } + * + * parser (grammar) errors will also provide these additional members: + * + * { + * expected: (array describing the set of expected tokens; + * may be UNDEFINED when we cannot easily produce such a set) + * state: (integer (or array when the table includes grammar collisions); + * represents the current internal state of the parser kernel. + * can, for example, be used to pass to the `collect_expected_token_set()` + * API to obtain the expected token set) + * action: (integer; represents the current internal action which will be executed) + * new_state: (integer; represents the next/planned internal state, once the current + * action has executed) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, + * for instance, for advanced error analysis and reporting) + * value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used, + * for instance, for advanced error analysis and reporting) + * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, + * for instance, for advanced error analysis and reporting) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * parser: (reference to the current parser instance) + * } + * + * while `this` will reference the current parser instance. + * + * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * lexer: (reference to the current lexer instance which reported the error) + * } + * + * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired + * from either the parser or lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * exception: (reference to the exception thrown) + * } + * + * Please do note that in the latter situation, the `expected` field will be omitted as + * this type of failure is assumed not to be due to *parse errors* but rather due to user + * action code in either parser or lexer failing unexpectedly. + * + * --- + * + * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + * These options are available: + * + * ### options which are global for all parser instances + * + * Parser.pre_parse: function(yy) + * optional: you can specify a pre_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. + * Parser.post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: you can specify a post_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. When it does not return any value, + * the parser will return the original `retval`. + * + * ### options which can be set up per parser instance + * + * yy: { + * pre_parse: function(yy) + * optional: is invoked before the parse cycle starts (and before the first + * invocation of `lex()`) but immediately after the invocation of + * `parser.pre_parse()`). + * post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: is invoked when the parse terminates due to success ('accept') + * or failure (even when exceptions are thrown). + * `retval` contains the return value to be produced by `Parser.parse()`; + * this function can override the return value by returning another. + * When it does not return any value, the parser will return the original + * `retval`. + * This function is invoked immediately before `parser.post_parse()`. + * + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * quoteName: function(name), + * optional: overrides the default `quoteName` function. + * } + * + * parser.lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this `%option` has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + +// See also: +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 +// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility +// with userland code which might access the derived class in a 'classic' way. +function JisonParserError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonParserError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + + var stacktrace; + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = new Error(msg).stack; + } + } + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } +} + +if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonParserError.prototype, Error.prototype); +} else { + JisonParserError.prototype = Object.create(Error.prototype); +} +JisonParserError.prototype.constructor = JisonParserError; +JisonParserError.prototype.name = 'JisonParserError'; + +// import XRegExp from '@gerhobbelt/xregexp'; +// import helpers from 'jison-helpers-lib'; +// import fs from 'fs'; + + +// helper: reconstruct the productions[] table +function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([p[i], r[i]]); + } + return rv; +} + +// helper: reconstruct the defaultActions[] table +function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; +} + +// helper: reconstruct the 'goto' table +function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [m.shift(), g.shift()]; + break; + + case 0: + q[z] = a.shift(); + break; + + default: + // type === 1: accept + q[z] = [3]; + } + } + rv.push(q); + } + return rv; +} + +// helper: runlength encoding with increment step: code, length: step (default step = 0) +// `this` references an array +function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } +} + +// helper: duplicate sequence from *relative* offset and length. +// `this` references an array +function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } +} + +// helper: unpack an array using helpers and data, all passed in an array argument 'a'. +function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; +} + +var parser = { + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // default action mode: ............. classic,merge + // no try..catch: ................... false + // no default resolve on conflict: false + // on-demand look-ahead: ............ false + // error recovery token skip maximum: 3 + // yyerror in parse actions is: ..... NOT recoverable, + // yyerror in lexer actions and other non-fatal lexer are: + // .................................. NOT recoverable, + // debug grammar/output: ............ false + // has partial LR conflict upgrade: true + // rudimentary token-stack support: false + // parser table compression mode: ... 2 + // export debug tables: ............. false + // export *all* tables: ............. false + // module type: ..................... es + // parser engine type: .............. lalr + // output main() in the module: ..... true + // number of expected conflicts: .... 0 + // + // + // Parser Analysis flags: + // + // no significant actions (parser is a language matcher only): + // .................................. false + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses ParseError API: ............. false + // uses YYERROR: .................... true + // uses YYRECOVERING: ............... false + // uses YYERROK: .................... false + // uses YYCLEARIN: .................. false + // tracks rule values: .............. true + // assigns rule values: ............. true + // uses location tracking: .......... true + // assigns location: ................ true + // uses yystack: .................... false + // uses yysstack: ................... false + // uses yysp: ....................... true + // uses yyrulelength: ............... false + // uses yyMergeLocationInfo API: .... true + // has error recovery: .............. true + // has error reporting: ............. true + // + // --------- END OF REPORT ----------- + + trace: function no_op_trace() {}, + JisonParserError: JisonParserError, + yy: {}, + options: { + type: "lalr", + hasPartialLrUpgradeOnConflict: true, + errorRecoveryTokenDiscardCount: 3 + }, + symbols_: { + "$": 17, + "$accept": 0, + "$end": 1, + "%%": 19, + "(": 10, + ")": 11, + "*": 7, + "+": 12, + ",": 8, + ".": 15, + "/": 14, + "/!": 39, + "<": 5, + "=": 18, + ">": 6, + "?": 13, + "ACTION": 32, + "ACTION_BODY": 33, + "ACTION_BODY_CPP_COMMENT": 35, + "ACTION_BODY_C_COMMENT": 34, + "ACTION_BODY_WHITESPACE": 36, + "ACTION_END": 31, + "ACTION_START": 28, + "BRACKET_MISSING": 29, + "BRACKET_SURPLUS": 30, + "CHARACTER_LIT": 46, + "CODE": 53, + "EOF": 1, + "ESCAPE_CHAR": 44, + "IMPORT": 24, + "INCLUDE": 51, + "INCLUDE_PLACEMENT_ERROR": 37, + "INIT_CODE": 25, + "NAME": 20, + "NAME_BRACE": 40, + "OPTIONS": 47, + "OPTIONS_END": 48, + "OPTION_STRING_VALUE": 49, + "OPTION_VALUE": 50, + "PATH": 52, + "RANGE_REGEX": 45, + "REGEX_SET": 43, + "REGEX_SET_END": 42, + "REGEX_SET_START": 41, + "SPECIAL_GROUP": 38, + "START_COND": 27, + "START_EXC": 22, + "START_INC": 21, + "STRING_LIT": 26, + "UNKNOWN_DECL": 23, + "^": 16, + "action": 68, + "action_body": 69, + "any_group_regex": 78, + "definition": 58, + "definitions": 57, + "error": 2, + "escape_char": 81, + "extra_lexer_module_code": 87, + "import_name": 60, + "import_path": 61, + "include_macro_code": 88, + "init": 56, + "init_code_name": 59, + "lex": 54, + "module_code_chunk": 89, + "name_expansion": 77, + "name_list": 71, + "names_exclusive": 63, + "names_inclusive": 62, + "nonempty_regex_list": 74, + "option": 86, + "option_list": 85, + "optional_module_code_chunk": 90, + "options": 84, + "range_regex": 82, + "regex": 72, + "regex_base": 76, + "regex_concat": 75, + "regex_list": 73, + "regex_set": 79, + "regex_set_atom": 80, + "rule": 67, + "rule_block": 66, + "rules": 64, + "rules_and_epilogue": 55, + "rules_collective": 65, + "start_conditions": 70, + "string": 83, + "{": 3, + "|": 9, + "}": 4 + }, + terminals_: { + 1: "EOF", + 2: "error", + 3: "{", + 4: "}", + 5: "<", + 6: ">", + 7: "*", + 8: ",", + 9: "|", + 10: "(", + 11: ")", + 12: "+", + 13: "?", + 14: "/", + 15: ".", + 16: "^", + 17: "$", + 18: "=", + 19: "%%", + 20: "NAME", + 21: "START_INC", + 22: "START_EXC", + 23: "UNKNOWN_DECL", + 24: "IMPORT", + 25: "INIT_CODE", + 26: "STRING_LIT", + 27: "START_COND", + 28: "ACTION_START", + 29: "BRACKET_MISSING", + 30: "BRACKET_SURPLUS", + 31: "ACTION_END", + 32: "ACTION", + 33: "ACTION_BODY", + 34: "ACTION_BODY_C_COMMENT", + 35: "ACTION_BODY_CPP_COMMENT", + 36: "ACTION_BODY_WHITESPACE", + 37: "INCLUDE_PLACEMENT_ERROR", + 38: "SPECIAL_GROUP", + 39: "/!", + 40: "NAME_BRACE", + 41: "REGEX_SET_START", + 42: "REGEX_SET_END", + 43: "REGEX_SET", + 44: "ESCAPE_CHAR", + 45: "RANGE_REGEX", + 46: "CHARACTER_LIT", + 47: "OPTIONS", + 48: "OPTIONS_END", + 49: "OPTION_STRING_VALUE", + 50: "OPTION_VALUE", + 51: "INCLUDE", + 52: "PATH", + 53: "CODE" + }, + TERROR: 2, + EOF: 1, + + // internals: defined here so the object *structure* doesn't get modified by parse() et al, + // thus helping JIT compilers like Chrome V8. + originalQuoteName: null, + originalParseError: null, + cleanupAfterParse: null, + constructParseErrorInfo: null, + yyMergeLocationInfo: null, + + __reentrant_call_depth: 0, // INTERNAL USE ONLY + __error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup + __error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup + + // APIs which will be set up depending on user action code analysis: + //yyRecovering: 0, + //yyErrOk: 0, + //yyClearIn: 0, + + // Helper APIs + // ----------- + + // Helper function which can be overridden by user code later on: put suitable quotes around + // literal IDs in a description string. + quoteName: function parser_quoteName(id_str) { + return '"' + id_str + '"'; + }, + + // Return the name of the given symbol (terminal or non-terminal) as a string, when available. + // + // Return NULL when the symbol is unknown to the parser. + getSymbolName: function parser_getSymbolName(symbol) { + if (this.terminals_[symbol]) { + return this.terminals_[symbol]; + } + + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. + // + // An example of this may be where a rule's action code contains a call like this: + // + // parser.getSymbolName(#$) + // + // to obtain a human-readable name of the current grammar rule. + var s = this.symbols_; + for (var key in s) { + if (s[key] === symbol) { + return key; + } + } + return null; + }, + + // Return a more-or-less human-readable description of the given symbol, when available, + // or the symbol itself, serving as its own 'description' for lack of something better to serve up. + // + // Return NULL when the symbol is unknown to the parser. + describeSymbol: function parser_describeSymbol(symbol) { + if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { + return this.terminal_descriptions_[symbol]; + } else if (symbol === this.EOF) { + return 'end of input'; + } + var id = this.getSymbolName(symbol); + if (id) { + return this.quoteName(id); + } + return null; + }, + + // Produce a (more or less) human-readable list of expected tokens at the point of failure. + // + // The produced list may contain token or token set descriptions instead of the tokens + // themselves to help turning this output into something that easier to read by humans + // unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*, + // expected terminals and nonterminals is produced. + // + // The returned list (array) will not contain any duplicate entries. + collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) { + var TERROR = this.TERROR; + var tokenset = []; + var check = {}; + // Has this (error?) state been outfitted with a custom expectations description text for human consumption? + // If so, use that one instead of the less palatable token set. + if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { + return [this.state_descriptions_[state]]; + } + for (var p in this.table[state]) { + p = +p; + if (p !== TERROR) { + var d = do_not_describe ? p : this.describeSymbol(p); + if (d && !check[d]) { + tokenset.push(d); + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + } + } + } + return tokenset; + }, + productions_: bp({ + pop: u([54, 54, s, [55, 3], 56, 57, 57, s, [58, 11], 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, s, [65, 4], 66, 66, 67, 67, s, [68, 3], s, [69, 9], s, [70, 4], 71, 71, 72, s, [73, 4], s, [74, 4], 75, 75, s, [76, 17], 77, 78, 78, 79, 79, 80, s, [80, 4, 1], 83, 84, 85, 85, s, [86, 6], 87, 87, 88, 88, s, [89, 3], 90, 90]), + rule: u([s, [4, 3], 2, 0, 0, 2, 0, s, [2, 3], s, [1, 3], 3, 3, 2, 3, 3, s, [1, 7], 2, 1, 2, c, [23, 3], 4, 4, 3, c, [29, 4], s, [3, 3], s, [2, 8], 0, s, [3, 3], 0, 1, 3, 1, s, [3, 4, -1], c, [21, 3], c, [40, 3], s, [3, 4], s, [2, 5], c, [12, 3], s, [1, 6], c, [16, 3], c, [10, 8], c, [9, 3], s, [3, 4], c, [10, 4], c, [32, 5], 0]) + }), + performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyvstack, yylstack) { + + /* this == yyval */ + + // the JS engine itself can go and remove these statements when `yy` turns out to be unused in any action code! + var yy = this.yy; + var yyparser = yy.parser; + var yylexer = yy.lexer; + + switch (yystate) { + case 0: + /*! Production:: $accept : lex $end */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yylstack[yysp - 1]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + + case 1: + /*! Production:: lex : init definitions rules_and_epilogue EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + this.$.macros = yyvstack[yysp - 2].macros; + this.$.startConditions = yyvstack[yysp - 2].startConditions; + this.$.unknownDecls = yyvstack[yysp - 2].unknownDecls; + + // if there are any options, add them all, otherwise set options to NULL: + // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: + for (var k in yy.options) { + this.$.options = yy.options; + break; + } + + if (yy.actionInclude) { + var asrc = yy.actionInclude.join('\n\n'); + // Only a non-empty action code chunk should actually make it through: + if (asrc.trim() !== '') { + this.$.actionInclude = asrc; + } + } + + delete yy.options; + delete yy.actionInclude; + return this.$; + break; + + case 2: + /*! Production:: lex : init definitions error EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject, yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); + break; + + case 3: + /*! Production:: rules_and_epilogue : "%%" rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; + } else { + this.$ = { rules: yyvstack[yysp - 2] }; + } + break; + + case 4: + /*! Production:: rules_and_epilogue : "%%" rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: yyvstack[yysp] }; + break; + + case 5: + /*! Production:: rules_and_epilogue : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: [] }; + break; + + case 6: + /*! Production:: init : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.actionInclude = []; + if (!yy.options) yy.options = {}; + break; + + case 7: + /*! Production:: definitions : definitions definition */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + if (yyvstack[yysp] != null) { + if ('length' in yyvstack[yysp]) { + this.$.macros[yyvstack[yysp][0]] = yyvstack[yysp][1]; + } else if (yyvstack[yysp].type === 'names') { + for (var name in yyvstack[yysp].names) { + this.$.startConditions[name] = yyvstack[yysp].names[name]; + } + } else if (yyvstack[yysp].type === 'unknown') { + this.$.unknownDecls.push(yyvstack[yysp].body); + } + } + break; + + case 8: + /*! Production:: definitions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + macros: {}, // { hash table } + startConditions: {}, // { hash table } + unknownDecls: [] // [ array of [key,value] pairs } + }; + break; + + case 9: + /*! Production:: definition : NAME regex */ + case 38: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + + case 10: + /*! Production:: definition : START_INC names_inclusive */ + case 11: + /*! Production:: definition : START_EXC names_exclusive */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + + case 12: + /*! Production:: definition : action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + yy.actionInclude.push(yyvstack[yysp]);this.$ = null; + break; + + case 13: + /*! Production:: definition : options */ + case 99: + /*! Production:: option_list : option */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + + case 14: + /*! Production:: definition : UNKNOWN_DECL */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { type: 'unknown', body: yyvstack[yysp] }; + break; + + case 15: + /*! Production:: definition : IMPORT import_name import_path */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp] }; + break; + + case 16: + /*! Production:: definition : IMPORT import_name error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject2, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 17: + /*! Production:: definition : IMPORT error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject3, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + break; + + case 18: + /*! Production:: definition : INIT_CODE init_code_name action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + type: 'codesection', + qualifier: yyvstack[yysp - 1], + include: yyvstack[yysp] + }; + break; + + case 19: + /*! Production:: definition : INIT_CODE error action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject4, yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp]), yyvstack[yysp - 1].errStr)); + break; + + case 20: + /*! Production:: init_code_name : NAME */ + case 21: + /*! Production:: init_code_name : STRING_LIT */ + case 22: + /*! Production:: import_name : NAME */ + case 23: + /*! Production:: import_name : STRING_LIT */ + case 24: + /*! Production:: import_path : NAME */ + case 25: + /*! Production:: import_path : STRING_LIT */ + case 61: + /*! Production:: regex_list : regex_concat */ + case 66: + /*! Production:: nonempty_regex_list : regex_concat */ + case 68: + /*! Production:: regex_concat : regex_base */ + case 93: + /*! Production:: escape_char : ESCAPE_CHAR */ + case 94: + /*! Production:: range_regex : RANGE_REGEX */ + case 106: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + case 110: + /*! Production:: module_code_chunk : CODE */ + case 113: + /*! Production:: optional_module_code_chunk : module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + + case 26: + /*! Production:: names_inclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { type: 'names', names: {} };this.$.names[yyvstack[yysp]] = 0; + break; + + case 27: + /*! Production:: names_inclusive : names_inclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1];this.$.names[yyvstack[yysp]] = 0; + break; + + case 28: + /*! Production:: names_exclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { type: 'names', names: {} };this.$.names[yyvstack[yysp]] = 1; + break; + + case 29: + /*! Production:: names_exclusive : names_exclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1];this.$.names[yyvstack[yysp]] = 1; + break; + + case 30: + /*! Production:: rules : rules rules_collective */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); + break; + + case 31: + /*! Production:: rules : %epsilon */ + case 37: + /*! Production:: rule_block : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = []; + break; + + case 32: + /*! Production:: rules_collective : start_conditions rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 1]) { + yyvstack[yysp].unshift(yyvstack[yysp - 1]); + } + this.$ = [yyvstack[yysp]]; + break; + + case 33: + /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 3]) { + yyvstack[yysp - 1].forEach(function (d) { + d.unshift(yyvstack[yysp - 3]); + }); + } + this.$ = yyvstack[yysp - 1]; + break; + + case 34: + /*! Production:: rules_collective : start_conditions "{" error "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject5, yyvstack[yysp - 3].join(','), yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo(yysp - 3, yysp), yylstack[yysp - 3]), yyvstack[yysp - 1].errStr)); + break; + + case 35: + /*! Production:: rules_collective : start_conditions "{" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject6, yyvstack[yysp - 2].join(','), yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 36: + /*! Production:: rule_block : rule_block rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1];this.$.push(yyvstack[yysp]); + break; + + case 39: + /*! Production:: rule : regex error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + yyparser.yyError(rmCommonWS(_templateObject7, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + break; + + case 40: + /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject8, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]))); + break; + + case 41: + /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject9, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]))); + break; + + case 42: + /*! Production:: action : ACTION_START action_body ACTION_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var s = yyvstack[yysp - 1].trim(); + // remove outermost set of braces UNLESS there's + // a curly brace in there anywhere: in that case + // we should leave it up to the sophisticated + // code analyzer to simplify the code! + // + // This is a very rough check as it will also look + // inside code comments, which should not have + // any influence. + // + // Nevertheless: this is a *safe* transform! + if (s[0] === '{' && s.indexOf('}') === s.length - 1) { + this.$ = s.substring(1, s.length - 1).trim(); + } else { + this.$ = s; + } + break; + + case 43: + /*! Production:: action_body : action_body ACTION */ + case 48: + /*! Production:: action_body : action_body include_macro_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; + break; + + case 44: + /*! Production:: action_body : action_body ACTION_BODY */ + case 45: + /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ + case 46: + /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ + case 47: + /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ + case 67: + /*! Production:: regex_concat : regex_concat regex_base */ + case 79: + /*! Production:: regex_base : regex_base range_regex */ + case 89: + /*! Production:: regex_set : regex_set regex_set_atom */ + case 111: + /*! Production:: module_code_chunk : module_code_chunk CODE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; + break; + + case 49: + /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject10, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]))); + break; + + case 50: + /*! Production:: action_body : action_body error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject11, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + break; + + case 51: + /*! Production:: action_body : %epsilon */ + case 62: + /*! Production:: regex_list : %epsilon */ + case 114: + /*! Production:: optional_module_code_chunk : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ''; + break; + + case 52: + /*! Production:: start_conditions : "<" name_list ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + break; + + case 53: + /*! Production:: start_conditions : "<" name_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject12, yyvstack[yysp - 1].join(','), yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 54: + /*! Production:: start_conditions : "<" "*" ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ['*']; + break; + + case 55: + /*! Production:: start_conditions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + + case 56: + /*! Production:: name_list : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp]]; + break; + + case 57: + /*! Production:: name_list : name_list "," NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2];this.$.push(yyvstack[yysp]); + break; + + case 58: + /*! Production:: regex : nonempty_regex_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Detect if the regex ends with a pure (Unicode) word; + // we *do* consider escaped characters which are 'alphanumeric' + // to be equivalent to their non-escaped version, hence these are + // all valid 'words' for the 'easy keyword rules' option: + // + // - hello_kitty + // - γεια_σου_γατοÏλα + // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 + // + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // + // As we only check the *tail*, we also accept these as + // 'easy keywords': + // + // - %options + // - %foo-bar + // - +++a:b:c1 + // + // Note the dash in that last example: there the code will consider + // `bar` to be the keyword, which is fine with us as we're only + // interested in the trailing boundary and patching that one for + // the `easy_keyword_rules` option. + this.$ = yyvstack[yysp]; + if (yy.options.easy_keyword_rules) { + // We need to 'protect' `eval` here as keywords are allowed + // to contain double-quotes and other leading cruft. + // `eval` *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `eval(str)` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. + this.$ = this.$.replace(/\\\\/g, '.').replace(/"/g, '.').replace(/\\c[A-Z]/g, '.').replace(/\\[^xu0-9]/g, '.'); + + try { + // Convert Unicode escapes and other escapes to their literal characters + // BEFORE we go and check whether this item is subject to the + // `easy_keyword_rules` option. + this.$ = JSON.parse('"' + this.$ + '"'); + } catch (ex) { + yyparser.warn('easy-keyword-rule FAIL on eval: ', ex); + + // make the next keyword test fail: + this.$ = '.'; + } + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: + var re = new XRegExp('\\w[\\w\\d]*$'); + if (XRegExp.match(this.$, re)) { + this.$ = yyvstack[yysp] + "\\b"; + } else { + this.$ = yyvstack[yysp]; + } + } + break; + + case 59: + /*! Production:: regex_list : regex_list "|" regex_concat */ + case 63: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; + break; + + case 60: + /*! Production:: regex_list : regex_list "|" */ + case 64: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '|'; + break; + + case 65: + /*! Production:: nonempty_regex_list : "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '|' + yyvstack[yysp]; + break; + + case 69: + /*! Production:: regex_base : "(" regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(' + yyvstack[yysp - 1] + ')'; + break; + + case 70: + /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; + break; + + case 71: + /*! Production:: regex_base : "(" regex_list error */ + case 72: + /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject13, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 73: + /*! Production:: regex_base : regex_base "+" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '+'; + break; + + case 74: + /*! Production:: regex_base : regex_base "*" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '*'; + break; + + case 75: + /*! Production:: regex_base : regex_base "?" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '?'; + break; + + case 76: + /*! Production:: regex_base : "/" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?=' + yyvstack[yysp] + ')'; + break; + + case 77: + /*! Production:: regex_base : "/!" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?!' + yyvstack[yysp] + ')'; + break; + + case 78: + /*! Production:: regex_base : name_expansion */ + case 80: + /*! Production:: regex_base : any_group_regex */ + case 84: + /*! Production:: regex_base : string */ + case 85: + /*! Production:: regex_base : escape_char */ + case 86: + /*! Production:: name_expansion : NAME_BRACE */ + case 90: + /*! Production:: regex_set : regex_set_atom */ + case 91: + /*! Production:: regex_set_atom : REGEX_SET */ + case 96: + /*! Production:: string : CHARACTER_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + + case 81: + /*! Production:: regex_base : "." */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '.'; + break; + + case 82: + /*! Production:: regex_base : "^" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '^'; + break; + + case 83: + /*! Production:: regex_base : "$" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '$'; + break; + + case 87: + /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ + case 107: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + + case 88: + /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject14, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 92: + /*! Production:: regex_set_atom : name_expansion */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) && yyvstack[yysp].toUpperCase() !== yyvstack[yysp]) { + // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories + this.$ = yyvstack[yysp]; + } else { + this.$ = yyvstack[yysp]; + } + //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + break; + + case 95: + /*! Production:: string : STRING_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = prepareString(yyvstack[yysp]); + break; + + case 97: + /*! Production:: options : OPTIONS option_list OPTIONS_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + + case 98: + /*! Production:: option_list : option option_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + + case 100: + /*! Production:: option : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp]] = true; + break; + + case 101: + /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; + break; + + case 102: + /*! Production:: option : NAME "=" OPTION_VALUE */ + case 103: + /*! Production:: option : NAME "=" NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); + break; + + case 104: + /*! Production:: option : NAME "=" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS(_templateObject15, $option, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 105: + /*! Production:: option : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS(_templateObject16, yylexer.prettyPrintRange(yylexer, yylstack[yysp]), yyvstack[yysp].errStr)); + break; + + case 108: + /*! Production:: include_macro_code : INCLUDE PATH */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); + // And no, we don't support nested '%include': + this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; + break; + + case 109: + /*! Production:: include_macro_code : INCLUDE error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject17, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + break; + + case 112: + /*! Production:: module_code_chunk : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS(_templateObject18, yylexer.prettyPrintRange(yylexer, yylstack[yysp]), yyvstack[yysp].errStr)); + break; + + case 145: + // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! + // error recovery reduction action (action generated by jison, + // using the user-specified `%code error_recovery_reduction` %{...%} + // code chunk below. + + + break; + + } + }, + table: bt({ + len: u([13, 1, 12, 15, 1, 1, 11, 18, 21, 2, 2, s, [11, 3], 4, 4, 12, 4, 1, 1, 19, 11, 12, 18, 29, 30, 22, 22, 17, 17, s, [29, 7], 31, 5, s, [29, 3], s, [12, 4], 4, 11, 3, 3, 2, 2, 1, 1, 12, 1, 5, 4, 3, 7, 17, 23, 3, 30, 29, 30, s, [29, 5], 3, 20, 3, 30, 30, 6, s, [4, 3], 12, 12, s, [11, 6], s, [27, 3], s, [11, 8], 2, 11, 1, 4, 3, 2, s, [3, 3], 17, 16, 3, 3, 1, 3, s, [29, 3], 21, s, [29, 4], 4, 13, 13, s, [3, 4], 6, 3, 23, s, [18, 3], 14, 14, 1, 14, 20, 2, 17, 14, 17, 3]), + symbol: u([1, 2, s, [19, 7, 1], 28, 47, 54, 56, 1, c, [14, 11], 57, c, [12, 11], 55, 58, 68, 84, s, [1, 3], c, [17, 10], 1, 3, 5, 9, 10, s, [14, 4, 1], 19, 26, s, [38, 4, 1], 44, 46, 64, c, [15, 6], c, [14, 7], 72, s, [74, 5, 1], 81, 83, 27, 62, 27, 63, c, [54, 12], c, [11, 21], 2, 20, 26, 60, c, [4, 3], 59, 2, s, [29, 9, 1], 51, 69, 2, 20, 85, 86, s, [1, 3], c, [102, 16], 65, 70, c, [67, 13], 9, c, [12, 9], c, [125, 12], c, [123, 6], c, [30, 3], c, [59, 6], s, [20, 7, 1], 28, c, [29, 6], 47, c, [29, 7], 7, s, [9, 9, 1], c, [33, 14], 45, 46, 47, 82, c, [58, 3], 11, c, [80, 11], 73, c, [81, 6], c, [22, 22], c, [121, 12], c, [17, 22], c, [108, 29], c, [29, 199], s, [42, 6, 1], 40, 43, 77, 79, 80, c, [123, 89], c, [19, 7], 27, c, [572, 11], c, [12, 27], c, [593, 3], 61, c, [612, 14], c, [3, 3], 28, 68, 28, 68, 28, 28, c, [616, 11], 88, 48, 2, 20, 48, 85, 86, 2, 18, 20, c, [9, 4], 1, 2, 51, 53, 87, 89, 90, c, [630, 17], 3, c, [732, 13], 67, c, [733, 8], 7, 20, 71, c, [613, 24], c, [643, 65], c, [507, 145], 2, 9, 11, c, [769, 15], c, [789, 7], 11, c, [201, 59], 82, 2, 40, 42, 43, 77, 80, c, [6, 4], c, [4, 8], c, [476, 33], c, [11, 59], 3, 4, c, [473, 8], c, [401, 15], c, [27, 54], c, [584, 11], c, [11, 78], 52, c, [182, 11], c, [664, 3], 49, 50, 1, 51, 88, 1, 51, 1, 51, 53, c, [3, 7], c, [672, 16], 2, 4, c, [673, 13], 66, 2, 28, 68, 2, 6, 8, 6, c, [4, 3], c, [642, 58], c, [525, 31], c, [522, 13], c, [750, 8], c, [662, 115], c, [562, 5], c, [315, 10], 53, c, [13, 13], c, [979, 3], c, [3, 9], c, [988, 4], c, [987, 3], 51, 53, c, [300, 14], c, [973, 9], 1, c, [487, 10], c, [27, 7], c, [18, 36], c, [1050, 14], c, [14, 14], 20, c, [15, 14], c, [830, 20], c, [469, 3], c, [460, 16], c, [159, 14], c, [491, 18], 6, 8]), + type: u([s, [2, 11], 0, 0, 1, c, [14, 12], c, [26, 13], 0, c, [15, 12], s, [2, 19], c, [31, 14], s, [0, 8], c, [23, 3], c, [56, 31], c, [62, 10], c, [112, 13], c, [67, 4], c, [40, 20], c, [78, 36], c, [123, 7], c, [30, 28], c, [203, 43], c, [205, 9], c, [22, 34], c, [17, 34], s, [2, 224], c, [239, 141], c, [139, 19], c, [655, 16], c, [14, 5], c, [180, 13], c, [194, 34], s, [0, 9], c, [98, 21], c, [643, 86], c, [492, 151], c, [494, 34], c, [231, 35], c, [802, 238], c, [716, 74], c, [44, 28], c, [708, 37], c, [522, 78], c, [454, 163], c, [164, 19], c, [973, 11], c, [830, 147], s, [2, 21]]), + state: u([s, [1, 4, 1], 6, 11, 12, 20, 21, 22, 24, 25, 30, 31, 36, 35, 42, 44, 46, 50, 54, 55, 56, 60, 61, 64, c, [15, 5], 65, c, [5, 4], 69, 71, 72, c, [13, 5], 73, c, [7, 6], 74, c, [5, 4], 75, c, [5, 4], 79, 76, 77, 82, 86, 87, 96, 101, 56, 103, 105, 104, 108, 110, c, [66, 7], 111, 114, c, [58, 11], c, [6, 6], 69, 79, 122, 129, 131, 133, c, [12, 5], 139, c, [29, 5], 105, 140, 142, c, [47, 8], c, [22, 5]]), + mode: u([s, [2, 23], s, [1, 12], s, [2, 28], s, [1, 15], s, [2, 33], c, [39, 17], c, [13, 6], c, [18, 7], c, [64, 21], c, [21, 10], c, [106, 15], c, [75, 12], 1, c, [90, 10], c, [27, 6], c, [72, 23], c, [40, 8], c, [45, 7], c, [15, 13], s, [1, 24], s, [2, 234], c, [236, 98], c, [97, 24], c, [24, 15], c, [374, 20], c, [432, 5], c, [409, 15], c, [568, 9], c, [47, 20], c, [454, 17], c, [561, 23], c, [585, 53], c, [442, 145], c, [718, 19], c, [780, 33], c, [29, 25], c, [759, 238], c, [796, 51], c, [289, 5], c, [1211, 12], c, [722, 35], c, [340, 9], c, [648, 24], c, [854, 59], c, [1199, 170], c, [311, 6], c, [969, 23], c, [1128, 90], c, [291, 66]]), + goto: u([s, [6, 11], s, [8, 11], 5, 5, s, [7, 4, 1], s, [13, 7, 1], s, [7, 11], s, [31, 17], 23, 26, 28, 32, 33, 34, 39, 27, 29, 37, 38, 41, 40, 43, 45, s, [12, 11], s, [13, 11], s, [14, 11], 47, 48, 49, 51, 52, 53, s, [51, 11], 58, 57, 1, 2, 4, 55, 62, s, [55, 6], 59, s, [55, 7], s, [9, 11], 58, 58, 63, s, [58, 9], c, [108, 12], s, [66, 3], c, [15, 5], s, [66, 7], 39, 66, c, [23, 7], 68, 68, 67, s, [68, 3], c, [7, 3], s, [68, 17], 70, 68, 68, 62, 62, 26, 62, c, [68, 11], c, [15, 15], c, [95, 12], c, [12, 12], s, [78, 29], s, [80, 29], s, [81, 29], s, [82, 29], s, [83, 29], s, [84, 29], s, [85, 29], s, [86, 31], 37, 78, s, [95, 29], s, [96, 29], s, [93, 29], s, [10, 9], 80, 10, 10, s, [26, 12], s, [11, 9], 81, 11, 11, s, [28, 12], 83, 84, 85, s, [17, 11], s, [22, 3], s, [23, 3], 16, 16, 20, 21, 98, s, [88, 8, 1], 97, 99, 100, 58, 57, 99, 100, 102, 100, 100, s, [105, 3], 114, 107, 114, 106, s, [30, 17], 109, c, [667, 13], 112, 113, s, [64, 3], c, [17, 5], s, [64, 7], 39, 64, c, [25, 6], 64, s, [65, 3], c, [24, 5], s, [65, 7], 39, 65, c, [24, 6], 65, s, [67, 6], 66, 68, s, [67, 18], 70, 67, 67, s, [73, 29], s, [74, 29], s, [75, 29], s, [79, 29], s, [94, 29], 116, 117, 115, 61, 61, 26, 61, c, [242, 11], 119, 117, 118, 76, 76, 67, s, [76, 3], 66, 68, s, [76, 18], 70, 76, 76, 77, 77, 67, s, [77, 3], 66, 68, s, [77, 18], 70, 77, 77, 121, 37, 120, 78, s, [90, 4], s, [91, 4], s, [92, 4], s, [27, 12], s, [29, 12], s, [15, 11], s, [16, 11], s, [24, 11], s, [25, 11], s, [18, 11], s, [19, 11], s, [40, 27], s, [41, 27], s, [42, 27], s, [43, 11], s, [44, 11], s, [45, 11], s, [46, 11], s, [47, 11], s, [48, 11], s, [49, 11], s, [50, 11], 124, 123, s, [97, 11], 98, 128, 127, 125, 126, 3, 99, 106, 106, 113, 113, 130, s, [110, 3], s, [112, 3], s, [32, 17], 132, s, [37, 14], 134, 16, 136, 135, 137, 138, s, [56, 3], s, [63, 3], c, [624, 5], s, [63, 7], 39, 63, c, [431, 6], 63, s, [69, 29], s, [71, 29], 60, 60, 26, 60, c, [505, 11], s, [70, 29], s, [72, 29], s, [87, 29], s, [88, 29], s, [89, 4], s, [108, 13], s, [109, 13], s, [101, 3], s, [102, 3], s, [103, 3], s, [104, 3], c, [940, 4], s, [111, 3], 141, c, [926, 13], 35, 35, 143, s, [35, 15], s, [38, 18], s, [39, 18], s, [52, 14], s, [53, 14], 144, s, [54, 14], 59, 59, 26, 59, c, [112, 11], 107, 107, s, [33, 17], s, [36, 14], s, [34, 17], s, [57, 3]]) + }), + defaultActions: bda({ + idx: u([0, 2, 6, 7, 11, 12, 13, 16, 18, 19, 21, s, [30, 8, 1], 39, 40, s, [41, 4, 2], 48, 49, 52, 53, 58, 60, s, [66, 5, 1], s, [77, 22, 1], 100, 101, 104, 106, 107, 108, 113, 115, 116, s, [118, 11, 1], 130, s, [133, 4, 1], 138, s, [140, 5, 1]]), + goto: u([6, 8, 7, 31, 12, 13, 14, 51, 1, 2, 9, 78, s, [80, 7, 1], 95, 96, 93, 26, 28, 17, 22, 23, 20, 21, 105, 30, 73, 74, 75, 79, 94, 90, 91, 92, 27, 29, 15, 16, 24, 25, 18, 19, s, [40, 11, 1], 97, 98, 106, 110, 112, 32, 56, 69, 71, 70, 72, 87, 88, 89, 108, 109, s, [101, 4, 1], 111, 38, 39, 52, 53, 54, 107, 33, 36, 34, 57]) + }), + parseError: function parseError(str, hash, ExceptionClass) { + if (hash.recoverable && typeof this.trace === 'function') { + this.trace(str); + hash.destroy(); // destroy... well, *almost*! + } else { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + throw new ExceptionClass(str, hash); + } + }, + parse: function parse(input) { + var self = this; + var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage) + var sstack = new Array(128); // state stack: stores states (column storage) + + var vstack = new Array(128); // semantic value stack + var lstack = new Array(128); // location stack + var table = this.table; + var sp = 0; // 'stack pointer': index into the stacks + var yyloc; + + var symbol = 0; + var preErrorSymbol = 0; + var lastEofErrorStateDepth = 0; + var recoveringErrorInfo = null; + var recovering = 0; // (only used when the grammar contains error recovery rules) + var TERROR = this.TERROR; + var EOF = this.EOF; + var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = this.options.errorRecoveryTokenDiscardCount | 0 || 3; + var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + + var lexer; + if (this.__lexer__) { + lexer = this.__lexer__; + } else { + lexer = this.__lexer__ = Object.create(this.lexer); + } + + var sharedState_yy = { + parseError: undefined, + quoteName: undefined, + lexer: undefined, + parser: undefined, + pre_parse: undefined, + post_parse: undefined, + pre_lex: undefined, + post_lex: undefined + }; + + if (typeof assert !== 'function') { + assert = function JisonAssert(cond, msg) { + if (!cond) { + throw new Error('assertion failed: ' + (msg || '***')); + } + }; + } + + this.yyGetSharedState = function yyGetSharedState() { + return sharedState_yy; + }; + + this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() { + return recoveringErrorInfo; + }; + + // shallow clone objects, straight copy of simple `src` values + // e.g. `lexer.yytext` MAY be a complex value object, + // rather than a simple string/value. + function shallow_copy(src) { + if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) === 'object') { + var dst = {}; + for (var k in src) { + if (Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + return dst; + } + return src; + } + function shallow_copy_noclobber(dst, src) { + for (var k in src) { + if (typeof dst[k] === 'undefined' && Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + } + function copy_yylloc(loc) { + var rv = shallow_copy(loc); + if (rv && rv.range) { + rv.range = rv.range.slice(0); + } + return rv; + } + + // copy state + shallow_copy_noclobber(sharedState_yy, this.yy); + + sharedState_yy.lexer = lexer; + sharedState_yy.parser = this; + + // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount + // to have *their* closure match ours -- if we only set them up once, + // any subsequent `parse()` runs will fail in very obscure ways when + // these functions are invoked in the user action code block(s) as + // their closure will still refer to the `parse()` instance which set + // them up. Hence we MUST set them up at the start of every `parse()` run! + if (this.yyError) { + this.yyError = function yyError(str /*, ...args */) { + + var error_rule_depth = this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1; + var expected = this.collect_expected_token_set(state); + var hash = this.constructParseErrorInfo(str, null, expected, error_rule_depth >= 0); + // append to the old one? + if (recoveringErrorInfo) { + var esp = recoveringErrorInfo.info_stack_pointer; + + recoveringErrorInfo.symbol_stack[esp] = symbol; + var v = this.shallowCopyErrorInfo(hash); + v.yyError = true; + v.errorRuleDepth = error_rule_depth; + v.recovering = recovering; + // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH; + + recoveringErrorInfo.value_stack[esp] = v; + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + } else { + recoveringErrorInfo = this.shallowCopyErrorInfo(hash); + recoveringErrorInfo.yyError = true; + recoveringErrorInfo.errorRuleDepth = error_rule_depth; + recoveringErrorInfo.recovering = recovering; + } + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + if (args.length) { + hash.extra_error_attributes = args; + } + + var r = this.parseError(str, hash, this.JisonParserError); + return r; + }; + } + + // Does the shared state override the default `parseError` that already comes with this instance? + if (typeof sharedState_yy.parseError === 'function') { + this.parseError = function parseErrorAlt(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + return sharedState_yy.parseError.call(this, str, hash, ExceptionClass); + }; + } else { + this.parseError = this.originalParseError; + } + + // Does the shared state override the default `quoteName` that already comes with this instance? + if (typeof sharedState_yy.quoteName === 'function') { + this.quoteName = function quoteNameAlt(id_str) { + return sharedState_yy.quoteName.call(this, id_str); + }; + } else { + this.quoteName = this.originalQuoteName; + } + + // set up the cleanup function; make it an API so that external code can re-use this one in case of + // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which + // case this parse() API method doesn't come with a `finally { ... }` block any more! + // + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `sharedState`, etc. references will be *wrong*! + this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) { + var rv; + + if (invoke_post_methods) { + var hash; + + if (sharedState_yy.post_parse || this.post_parse) { + // create an error hash info instance: we re-use this API in a **non-error situation** + // as this one delivers all parser internals ready for access by userland code. + hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false); + } + + if (sharedState_yy.post_parse) { + rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + if (this.post_parse) { + rv = this.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + + // cleanup: + if (hash && hash.destroy) { + hash.destroy(); + } + } + + if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. + + // clean up the lingering lexer structures as well: + if (lexer.cleanupAfterLex) { + lexer.cleanupAfterLex(do_not_nuke_errorinfos); + } + + // prevent lingering circular references from causing memory leaks: + if (sharedState_yy) { + sharedState_yy.lexer = undefined; + sharedState_yy.parser = undefined; + if (lexer.yy === sharedState_yy) { + lexer.yy = undefined; + } + } + sharedState_yy = undefined; + this.parseError = this.originalParseError; + this.quoteName = this.originalQuoteName; + + // nuke the vstack[] array at least as that one will still reference obsoleted user values. + // To be safe, we nuke the other internal stack columns as well... + stack.length = 0; // fastest way to nuke an array without overly bothering the GC + sstack.length = 0; + lstack.length = 0; + vstack.length = 0; + sp = 0; + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_infos.length = 0; + + for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) { + var el = this.__error_recovery_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_recovery_infos.length = 0; + + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + recoveringErrorInfo = undefined; + } + } + + return resultValue; + }; + + // merge yylloc info into a new yylloc instance. + // + // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array. + // + // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which + // case these override the corresponding first/last indexes. + // + // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search + // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!) + // yylloc info. + // + // Note: epsilon rule's yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL. + this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) { + var i1 = first_index | 0, + i2 = last_index | 0; + var l1 = first_yylloc, + l2 = last_yylloc; + var rv; + + // rules: + // - first/last yylloc entries override first/last indexes + + if (!l1) { + if (first_index != null) { + for (var i = i1; i <= i2; i++) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + } + + if (!l2) { + if (last_index != null) { + for (var i = i2; i >= i1; i--) { + l2 = lstack[i]; + if (l2) { + break; + } + } + } + } + + // - detect if an epsilon rule is being processed and act accordingly: + if (!l1 && first_index == null) { + // epsilon rule span merger. With optional look-ahead in l2. + if (!dont_look_back) { + for (var i = (i1 || sp) - 1; i >= 0; i--) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + if (!l1) { + if (!l2) { + // when we still don't have any valid yylloc info, we're looking at an epsilon rule + // without look-ahead and no preceding terms and/or `dont_look_back` set: + // in that case we ca do nothing but return NULL/UNDEFINED: + return undefined; + } else { + // shallow-copy L2: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l2); + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + return rv; + } + } else { + // shallow-copy L1, then adjust first col/row 1 column past the end. + rv = shallow_copy(l1); + rv.first_line = rv.last_line; + rv.first_column = rv.last_column; + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + rv.range[0] = rv.range[1]; + } + + if (l2) { + // shallow-mixin L2, then adjust last col/row accordingly. + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + return rv; + } + } + + if (!l1) { + l1 = l2; + l2 = null; + } + if (!l1) { + return undefined; + } + + // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l1); + + // first_line: ..., + // first_column: ..., + // last_line: ..., + // last_column: ..., + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + + if (l2) { + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + + return rv; + }; + + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `lexer`, `sharedState`, etc. references will be *wrong*! + this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { + var pei = { + errStr: msg, + exception: ex, + text: lexer.match, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, + token_id: symbol, + line: lexer.yylineno, + loc: copy_yylloc(lexer.yylloc), + expected: expected, + recoverable: recoverable, + state: state, + action: action, + new_state: newState, + symbol_stack: stack, + state_stack: sstack, + value_stack: vstack, + location_stack: lstack, + stack_pointer: sp, + yy: sharedState_yy, + lexer: lexer, + parser: this, + + // and make sure the error info doesn't stay due to potential + // ref cycle via userland code manipulations. + // These would otherwise all be memory leak opportunities! + // + // Note that only array and object references are nuked as those + // constitute the set of elements which can produce a cyclic ref. + // The rest of the members is kept intact as they are harmless. + destroy: function destructParseErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // info.value = null; + // info.value_stack = null; + // ... + var rec = !!this.recoverable; + for (var key in this) { + if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { + this[key] = undefined; + } + } + this.recoverable = rec; + } + }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + return pei; + }; + + // clone some parts of the (possibly enhanced!) errorInfo object + // to give them some persistence. + this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) { + var rv = shallow_copy(p); + + // remove the large parts which can only cause cyclic references + // and are otherwise available from the parser kernel anyway. + delete rv.sharedState_yy; + delete rv.parser; + delete rv.lexer; + + // lexer.yytext MAY be a complex value object, rather than a simple string/value: + rv.value = shallow_copy(rv.value); + + // yylloc info: + rv.loc = copy_yylloc(rv.loc); + + // the 'expected' set won't be modified, so no need to clone it: + //rv.expected = rv.expected.slice(0); + + //symbol stack is a simple array: + rv.symbol_stack = rv.symbol_stack.slice(0); + // ditto for state stack: + rv.state_stack = rv.state_stack.slice(0); + // clone the yylloc's in the location stack?: + rv.location_stack = rv.location_stack.map(copy_yylloc); + // and the value stack may carry both simple and complex values: + // shallow-copy the latter. + rv.value_stack = rv.value_stack.map(shallow_copy); + + // and we don't bother with the sharedState_yy reference: + //delete rv.yy; + + // now we prepare for tracking the COMBINE actions + // in the error recovery code path: + // + // as we want to keep the maximum error info context, we + // *scan* the state stack to find the first *empty* slot. + // This position will surely be AT OR ABOVE the current + // stack pointer, but we want to keep the 'used but discarded' + // part of the parse stacks *intact* as those slots carry + // error context that may be useful when you want to produce + // very detailed error diagnostic reports. + // + // ### Purpose of each stack pointer: + // + // - stack_pointer: points at the top of the parse stack + // **as it existed at the time of the error + // occurrence, i.e. at the time the stack + // snapshot was taken and copied into the + // errorInfo object.** + // - base_pointer: the bottom of the **empty part** of the + // stack, i.e. **the start of the rest of + // the stack space /above/ the existing + // parse stack. This section will be filled + // by the error recovery process as it + // travels the parse state machine to + // arrive at the resolving error recovery rule.** + // - info_stack_pointer: + // this stack pointer points to the **top of + // the error ecovery tracking stack space**, i.e. + // this stack pointer takes up the role of + // the `stack_pointer` for the error recovery + // process. Any mutations in the **parse stack** + // are **copy-appended** to this part of the + // stack space, keeping the bottom part of the + // stack (the 'snapshot' part where the parse + // state at the time of error occurrence was kept) + // intact. + // - root_failure_pointer: + // copy of the `stack_pointer`... + // + for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== 'undefined'; i++) { + // empty + } + rv.base_pointer = i; + rv.info_stack_pointer = i; + + rv.root_failure_pointer = rv.stack_pointer; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_recovery_infos.push(rv); + + return rv; + }; + + function getNonTerminalFromCode(symbol) { + var tokenName = self.getSymbolName(symbol); + if (!tokenName) { + tokenName = symbol; + } + return tokenName; + } + + function lex() { + var token = lexer.lex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + if (typeof Jison !== 'undefined' && Jison.lexDebugger) { + var tokenName = self.getSymbolName(token || EOF); + if (!tokenName) { + tokenName = token; + } + + Jison.lexDebugger.push({ + tokenName: tokenName, + tokenText: lexer.match, + tokenValue: lexer.yytext + }); + } + + return token || EOF; + } + + var state, action, r, t; + var yyval = { + $: true, + _$: undefined, + yy: sharedState_yy + }; + var p; + var yyrulelen; + var this_production; + var newState; + var retval = false; + + // Return the rule stack depth where the nearest error rule can be found. + // Return -1 when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = sp - 1; + var depth = 0; + + // try to recover from error + for (;;) { + // check for error recovery rule in this state + + + var t = table[state][TERROR] || NO_ACTION; + if (t[0]) { + // We need to make sure we're not cycling forever: + // once we hit EOF, even when we `yyerrok()` an error, we must + // prevent the core from running forever, + // e.g. when parent rules are still expecting certain input to + // follow after this, for example when you handle an error inside a set + // of braces which are matched by a parent rule in your grammar. + // + // Hence we require that every error handling/recovery attempt + // *after we've hit EOF* has a diminishing state stack: this means + // we will ultimately have unwound the state stack entirely and thus + // terminate the parse in a controlled fashion even when we have + // very complex error/recovery code interplay in the core + user + // action code blocks: + + + if (symbol === EOF) { + if (!lastEofErrorStateDepth) { + lastEofErrorStateDepth = sp - 1 - depth; + } else if (lastEofErrorStateDepth <= sp - 1 - depth) { + + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + continue; + } + } + return depth; + } + if (state === 0 /* $accept rule */ || stack_probe < 1) { + + return -1; // No suitable error recovery rule available. + } + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + } + } + + try { + this.__reentrant_call_depth++; + + lexer.setInput(input, sharedState_yy); + + yyloc = lexer.yylloc; + lstack[sp] = yyloc; + vstack[sp] = null; + sstack[sp] = 0; + stack[sp] = 0; + ++sp; + + if (this.pre_parse) { + this.pre_parse.call(this, sharedState_yy); + } + if (sharedState_yy.pre_parse) { + sharedState_yy.pre_parse.call(this, sharedState_yy); + } + + newState = sstack[sp - 1]; + for (;;) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // The single `==` condition below covers both these `===` comparisons in a single + // operation: + // + // if (symbol === null || typeof symbol === 'undefined') ... + if (!symbol) { + symbol = lex(); + } + // read action for current state and first input + t = table[state] && table[state][symbol] || NO_ACTION; + newState = t[1]; + action = t[0]; + + // handle parse error + if (!action) { + // first see if there's any chance at hitting an error recovery rule: + var error_rule_depth = locateNearestErrorRecoveryRule(state); + var errStr = null; + var errSymbolDescr = this.describeSymbol(symbol) || symbol; + var expected = this.collect_expected_token_set(state); + + if (!recovering) { + // Report error + if (typeof lexer.yylineno === 'number') { + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; + } else { + errStr = 'Parse error: '; + } + + if (typeof lexer.showPosition === 'function') { + errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; + } + if (expected.length) { + errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; + } else { + errStr += 'Unexpected ' + errSymbolDescr; + } + + p = this.constructParseErrorInfo(errStr, null, expected, error_rule_depth >= 0); + + // cleanup the old one before we start the new error info track: + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + } + recoveringErrorInfo = this.shallowCopyErrorInfo(p); + + r = this.parseError(p.errStr, p, this.JisonParserError); + + // Protect against overly blunt userland `parseError` code which *sets* + // the `recoverable` flag without properly checking first: + // we always terminate the parse when there's no recovery rule available anyhow! + if (!p.recoverable || error_rule_depth < 0) { + retval = r; + break; + } else { + // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process... + } + } + + var esp = recoveringErrorInfo.info_stack_pointer; + + // just recovered from another error + if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { + // SHIFT current lookahead and grab another + recoveringErrorInfo.symbol_stack[esp] = symbol; + recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState; // push state + ++esp; + + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + yyloc = lexer.yylloc; + + preErrorSymbol = 0; + symbol = lex(); + } + + // try to recover from error + if (error_rule_depth < 0) { + assert(recovering > 0); + recoveringErrorInfo.info_stack_pointer = esp; + + // barf a fatal hairball when we're out of look-ahead symbols and none hit a match + // while we are still busy recovering from another error: + var po = this.__error_infos[this.__error_infos.length - 1]; + if (!po) { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error.', null, expected, false); + } else { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error. Previous error which resulted in this fatal result: ' + po.errStr, null, expected, false); + p.extra_error_attributes = po; + } + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + + preErrorSymbol = symbol === TERROR ? 0 : symbol; // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + + var EXTRA_STACK_SAMPLE_DEPTH = 3; + + // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token: + recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol; + if (errStr) { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + errorStr: errStr, + errorSymbolDescr: errSymbolDescr, + expectedStr: expected, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + } else { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + } + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + yyval.$ = recoveringErrorInfo; + yyval._$ = undefined; + + yyrulelen = error_rule_depth; + + r = this.performAction.call(yyval, yyloc, NO_ACTION[1], sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // and move the top entries + discarded part of the parse stacks onto the error info stack: + for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) { + recoveringErrorInfo.symbol_stack[esp] = stack[idx]; + recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]); + recoveringErrorInfo.state_stack[esp] = sstack[idx]; + } + + recoveringErrorInfo.symbol_stack[esp] = TERROR; + recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$); + + // goto new state = table[STATE][NONTERMINAL] + newState = sstack[sp - 1]; + + if (this.defaultActions[newState]) { + recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState]; + } else { + t = table[newState] && table[newState][symbol] || NO_ACTION; + recoveringErrorInfo.state_stack[esp] = t[1]; + } + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + // allow N (default: 3) real symbols to be shifted before reporting a new error + recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; + + // Now duplicate the standard parse machine here, at least its initial + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // as we wish to push something special then! + + + // Run the state machine in this copy of the parser state machine + // until we *either* consume the error symbol (and its related information) + // *or* we run into another error while recovering from this one + // *or* we execute a `reduce` action which outputs a final parse + // result (yes, that MAY happen!)... + + assert(recoveringErrorInfo); + assert(symbol === TERROR); + while (symbol) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // read action for current state and first input + t = table[state] && table[state][symbol] || NO_ACTION; + newState = t[1]; + action = t[0]; + + // encountered another parse error? If so, break out to main loop + // and take it from there! + if (!action) { + newState = state; + break; + } + } + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + + // shift: + case 1: + stack[sp] = symbol; + //vstack[sp] = lexer.yytext; + assert(recoveringErrorInfo); + vstack[sp] = recoveringErrorInfo; + //lstack[sp] = copy_yylloc(lexer.yylloc); + lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); + sstack[sp] = newState; // push state + ++sp; + symbol = 0; + if (!preErrorSymbol) { + // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + // read action for current state and first input + t = table[newState] && table[newState][symbol] || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + symbol = 0; + } + } + + // once we have pushed the special ERROR token value, we're done in this inner loop! + break; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + // signal end of error recovery loop AND end of outer parse loop + action = 3; + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + break; + } + + // break out of loop: we accept or fail with error + break; + } + + // should we also break out of the regular/outer parse loop, + // i.e. did the parser already produce a parse result in here?! + if (action === 3) { + break; + } + continue; + } + } + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + + // shift: + case 1: + stack[sp] = symbol; + vstack[sp] = lexer.yytext; + lstack[sp] = copy_yylloc(lexer.yylloc); + sstack[sp] = newState; // push state + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + var tokenName = self.getSymbolName(symbol || EOF); + if (!tokenName) { + tokenName = symbol; + } + + Jison.parserDebugger.push({ + action: 'shift', + text: lexer.yytext, + terminal: tokenName, + terminal_id: symbol + }); + } + + ++sp; + symbol = 0; + assert(preErrorSymbol === 0); + if (!preErrorSymbol) { + // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + // read action for current state and first input + t = table[newState] && table[newState][symbol] || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + symbol = 0; + } + } + + continue; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { + var prereduceValue = vstack.slice(sp - yyrulelen, sp); + var debuggableProductions = []; + for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { + var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); + debuggableProductions.push(debuggableProduction); + } + // find the current nonterminal name (- nolan) + var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; + var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); + + Jison.parserDebugger.push({ + action: 'reduce', + nonterminal: currentNonterminal, + nonterminal_id: currentNonterminalCode, + prereduce: prereduceValue, + result: r, + productions: debuggableProductions, + text: yyval.$ + }); + } + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'accept', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + + break; + } + + // break out of loop: we accept or fail with error + break; + } + } catch (ex) { + // report exceptions through the parseError callback too, but keep the exception intact + // if it is a known parser or lexer error which has been thrown by parseError() already: + if (ex instanceof this.JisonParserError) { + throw ex; + } else if (lexer && typeof lexer.JisonLexerError === 'function' && ex instanceof lexer.JisonLexerError) { + throw ex; + } else { + p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + } + } finally { + retval = this.cleanupAfterParse(retval, true, true); + this.__reentrant_call_depth--; + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'return', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + } // /finally + + return retval; + }, + yyError: 1 +}; +parser.originalParseError = parser.parseError; +parser.originalQuoteName = parser.quoteName; + +var rmCommonWS = helpers.rmCommonWS; + +function encodeRE(s) { + return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); +} + +function prepareString(s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; +} + +// convert string value to number or boolean value, when possible +// (and when this is more or less obviously the intent) +// otherwise produce the string itself as value. +function parseValue(v) { + if (v === 'false') { + return false; + } + if (v === 'true') { + return true; + } + // http://stackoverflow.com/questions/175739/is-there-a-built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number + // Note that the `v` check ensures that we do not convert `undefined`, `null` and `''` (empty string!) + if (v && !isNaN(v)) { + var rv = +v; + if (isFinite(rv)) { + return rv; + } + } + return v; +} + +parser.warn = function p_warn() { + console.warn.apply(console, arguments); +}; + +parser.log = function p_log() { + console.log.apply(console, arguments); +}; + +parser.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse:', arguments); +}; + +parser.yy.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse YY:', arguments); +}; + +parser.yy.post_lex = function p_lex() { + if (parser.yydebug) parser.log('post_lex:', arguments); +}; +/* lexer generated by jison-lex 0.6.0-194*/ + +/* + * Returns a Lexer object of the following structure: + * + * Lexer: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a direct reference! + * + * This "shared context" object was passed to the lexer by way of + * the `lexer.setInput(str, yy)` API before you may use it. + * + * This "shared context" object is passed to the lexer action code in `performAction()` + * so userland code in the lexer actions may communicate with the outside world + * and/or other lexer rules' actions in more or less complex ways. + * + * } + * + * Lexer.prototype: { + * EOF: 1, + * ERROR: 2, + * + * yy: The overall "shared context" object reference. + * + * JisonLexerError: function(msg, hash), + * + * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `lexer` instance. + * `yy_` is an alias for `this` lexer instance reference used internally. + * + * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer + * by way of the `lexer.setInput(str, yy)` API before. + * + * Note: + * The extra arguments you specified in the `%parse-param` statement in your + * **parser** grammar definition file are passed to the lexer via this object + * reference as member variables. + * + * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. + * + * - `YY_START`: the current lexer "start condition" state. + * + * parseError: function(str, hash, ExceptionClass), + * + * constructLexErrorInfo: function(error_message, is_recoverable), + * Helper function. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this lexer kernel in many places; example usage: + * + * var infoObj = lexer.constructParseErrorInfo('fail!', true); + * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); + * + * options: { ... lexer %options ... }, + * + * lex: function(), + * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. + * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the **parser** or the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * cleanupAfterLex: function(do_not_nuke_errorinfos), + * Helper function. + * + * This helper API is invoked when the **parse process** has completed: it is the responsibility + * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. + * + * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. + * + * setInput: function(input, [yy]), + * + * + * input: function(), + * + * + * unput: function(str), + * + * + * more: function(), + * + * + * reject: function(), + * + * + * less: function(n), + * + * + * pastInput: function(n), + * + * + * upcomingInput: function(n), + * + * + * showPosition: function(), + * + * + * test_match: function(regex_match_array, rule_index), + * + * + * next: function(), + * + * + * begin: function(condition), + * + * + * pushState: function(condition), + * + * + * popState: function(), + * + * + * topState: function(), + * + * + * _currentRules: function(), + * + * + * stateStackSize: function(), + * + * + * performAction: function(yy, yy_, yyrulenumber, YY_START), + * + * + * rules: [...], + * + * + * conditions: {associative list: name ==> set}, + * } + * + * + * token location info (`yylloc`): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * } + * + * while `this` will reference the current lexer instance. + * + * When `parseError` is invoked by the lexer, the default implementation will + * attempt to invoke `yy.parser.parseError()`; when this callback is not provided + * it will try to invoke `yy.parseError()` instead. When that callback is also not + * provided, a `JisonLexerError` exception will be thrown containing the error + * message and `hash`, as constructed by the `constructLexErrorInfo()` API. + * + * Note that the lexer's `JisonLexerError` error class is passed via the + * `ExceptionClass` argument, which is invoked to construct the exception + * instance to be thrown, so technically `parseError` will throw the object + * produced by the `new ExceptionClass(str, hash)` JavaScript expression. + * + * --- + * + * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. + * These options are available: + * + * (Options are permanent.) + * + * yy: { + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * } + * + * lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * WARNING: the next set of options are not meant to be changed. They echo the abilities of + * the lexer as per when it was compiled! + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + +var lexer = function () { + // See also: + // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + // with userland code which might access the derived class in a 'classic' way. + function JisonLexerError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonLexerError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + var stacktrace; + + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = new Error(msg).stack; + } + } + + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } + } + + if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); + } else { + JisonLexerError.prototype = Object.create(Error.prototype); + } + + JisonLexerError.prototype.constructor = JisonLexerError; + JisonLexerError.prototype.name = 'JisonLexerError'; + + var lexer = { + + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // backtracking: .................... false + // location.ranges: ................. true + // location line+column tracking: ... true + // + // + // Forwarded Parser Analysis flags: + // + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses lexer values: ............... true/ true + // location tracking: ............... true + // location assignment: ............. true + // + // + // Lexer Analysis flags: + // + // uses yyleng: ..................... ??? + // uses yylineno: ................... ??? + // uses yytext: ..................... ??? + // uses yylloc: ..................... ??? + // uses ParseError API: ............. ??? + // uses yyerror: .................... ??? + // uses location tracking & editing: ??? + // uses more() API: ................. ??? + // uses unput() API: ................ ??? + // uses reject() API: ............... ??? + // uses less() API: ................. ??? + // uses display APIs pastInput(), upcomingInput(), showPosition(): + // ............................. ??? + // uses describeYYLLOC() API: ....... ??? + // + // --------- END OF REPORT ----------- + + + EOF: 1, + + ERROR: 2, + + // JisonLexerError: JisonLexerError, /// <-- injected by the code generator + + // options: {}, /// <-- injected by the code generator + + // yy: ..., /// <-- injected by setInput() + + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + + /** + * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + * + * @public + * @this {RegExpLexer} + */ + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + /** @constructor */ + var pei = { + errStr: msg, + recoverable: !!recoverable, + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + token: null, + line: this.yylineno, + loc: this.yylloc, + yy: this.yy, + lexer: this, + + /** + * and make sure the error info doesn't stay due to potential + * ref cycle via userland code manipulations. + * These would otherwise all be memory leak opportunities! + * + * Note that only array and object references are nuked as those + * constitute the set of elements which can produce a cyclic ref. + * The rest of the members is kept intact as they are harmless. + * + * @public + * @this {LexErrorInfo} + */ + destroy: function destructLexErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // ... + var rec = !!this.recoverable; + + for (var key in this) { + if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { + this[key] = undefined; + } + } + + this.recoverable = rec; + } + }; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + + return pei; + }, + + /** + * handler which is invoked when a lexer error occurs. + * + * @public + * @this {RegExpLexer} + */ + parseError: function lexer_parseError(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonLexerError; + } + + if (this.yy) { + if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { + return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } else if (typeof this.yy.parseError === 'function') { + return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } + } + + throw new ExceptionClass(str, hash); + }, + + /** + * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions. + * + * @public + * @this {RegExpLexer} + */ + yyerror: function yyError(str /*, ...args */) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': ' + str, this.options.lexerErrorsAreRecoverable); + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + + if (args.length) { + p.extra_error_attributes = args; + } + + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + }, + + /** + * final cleanup function for when we have completed lexing the input; + * make it an API so that external code can use this one once userland + * code has decided it's time to destroy any lingering lexer error + * hash object instances and the like: this function helps to clean + * up these constructs, which *may* carry cyclic references which would + * otherwise prevent the instances from being properly and timely + * garbage-collected, i.e. this function helps prevent memory leaks! + * + * @public + * @this {RegExpLexer} + */ + cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + this.setInput('', {}); + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + + this.__error_infos.length = 0; + } + + return this; + }, + + /** + * clear the lexer token context; intended for internal use only + * + * @public + * @this {RegExpLexer} + */ + clear: function lexer_clear() { + this.yytext = ''; + this.yyleng = 0; + this.match = ''; + + // - DO NOT reset `this.matched` + this.matches = false; + + this._more = false; + this._backtrack = false; + var col = this.yylloc ? this.yylloc.last_column : 0; + + this.yylloc = { + first_line: this.yylineno + 1, + first_column: col, + last_line: this.yylineno + 1, + last_column: col, + range: [this.offset, this.offset] + }; + }, + + /** + * resets the lexer, sets new input + * + * @public + * @this {RegExpLexer} + */ + setInput: function lexer_setInput(input, yy) { + this.yy = yy || this.yy || {}; + + // also check if we've fully initialized the lexer instance, + // including expansion work to be done to go from a loaded + // lexer to a usable lexer: + if (!this.__decompressed) { + // step 1: decompress the regex list: + var rules = this.rules; + + for (var i = 0, len = rules.length; i < len; i++) { + var rule_re = rules[i]; + + // compression: is the RE an xref to another RE slot in the rules[] table? + if (typeof rule_re === 'number') { + rules[i] = rules[rule_re]; + } + } + + // step 2: unfold the conditions[] set to make these ready for use: + var conditions = this.conditions; + + for (var k in conditions) { + var spec = conditions[k]; + var rule_ids = spec.rules; + var len = rule_ids.length; + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_new_ids = new Array(len + 1); + + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; + } + + spec.rules = rule_new_ids; + spec.__rule_regexes = rule_regexes; + spec.__rule_count = len; + } + + this.__decompressed = true; + } + + this._input = input || ''; + this.clear(); + this._signaled_error_token = false; + this.done = false; + this.yylineno = 0; + this.matched = ''; + this.conditionStack = ['INITIAL']; + this.__currentRuleSet__ = null; + + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0, + range: [0, 0] + }; + + this.offset = 0; + return this; + }, + + /** + * edit the remaining input via user-specified callback. + * This can be used to forward-adjust the input-to-parse, + * e.g. inserting macro expansions and alike in the + * input which has yet to be lexed. + * The behaviour of this API contrasts the `unput()` et al + * APIs as those act on the *consumed* input, while this + * one allows one to manipulate the future, without impacting + * the current `yyloc` cursor location or any history. + * + * Use this API to help implement C-preprocessor-like + * `#include` statements, etc. + * + * The provided callback must be synchronous and is + * expected to return the edited input (string). + * + * The `cpsArg` argument value is passed to the callback + * as-is. + * + * `callback` interface: + * `function callback(input, cpsArg)` + * + * - `input` will carry the remaining-input-to-lex string + * from the lexer. + * - `cpsArg` is `cpsArg` passed into this API. + * + * The `this` reference for the callback will be set to + * reference this lexer instance so that userland code + * in the callback can easily and quickly access any lexer + * API. + * + * When the callback returns a non-string-type falsey value, + * we assume the callback did not edit the input and we + * will using the input as-is. + * + * When the callback returns a non-string-type value, it + * is converted to a string for lexing via the `"" + retval` + * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html + * -- that way any returned object's `toValue()` and `toString()` + * methods will be invoked in a proper/desirable order.) + * + * @public + * @this {RegExpLexer} + */ + editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) { + var rv = callback.call(this, this._input, cpsArg); + + if (typeof rv !== 'string') { + if (rv) { + this._input = '' + rv; + } + // else: keep `this._input` as is. + } else { + this._input = rv; + } + + return this; + }, + + /** + * consumes and returns one char from the input + * + * @public + * @this {RegExpLexer} + */ + input: function lexer_input() { + if (!this._input) { + //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) + return null; + } + + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + + // Count the linenumber up when we hit the LF (or a stand-alone CR). + // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo + // and we advance immediately past the LF as well, returning both together as if + // it was all a single 'character' only. + var slice_len = 1; + + var lines = false; + + if (ch === '\n') { + lines = true; + } else if (ch === '\r') { + lines = true; + var ch2 = this._input[1]; + + if (ch2 === '\n') { + slice_len++; + ch += ch2; + this.yytext += ch2; + this.yyleng++; + this.offset++; + this.match += ch2; + this.matched += ch2; + this.yylloc.range[1]++; + } + } + + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + this.yylloc.last_column = 0; + } else { + this.yylloc.last_column++; + } + + this.yylloc.range[1]++; + this._input = this._input.slice(slice_len); + return ch; + }, + + /** + * unshifts one char (or an entire string) into the input + * + * @public + * @this {RegExpLexer} + */ + unput: function lexer_unput(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.yyleng = this.yytext.length; + this.offset -= len; + this.match = this.match.substr(0, this.match.length - len); + this.matched = this.matched.substr(0, this.matched.length - len); + + if (lines.length > 1) { + this.yylineno -= lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); + + if (pre_lines.length === 1) { + pre = this.matched; + pre_lines = pre.split(/(?:\r\n?|\n)/g); + } + + this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; + } else { + this.yylloc.last_column -= len; + } + + this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; + this.done = false; + return this; + }, + + /** + * cache matched text and append it on next action + * + * @public + * @this {RegExpLexer} + */ + more: function lexer_more() { + this._more = true; + return this; + }, + + /** + * signal the lexer that this rule fails to match the input, so the + * next matching rule (regex) should be tested instead. + * + * @public + * @this {RegExpLexer} + */ + reject: function lexer_reject() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + // when the `parseError()` call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // `.lex()` run. + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, false); + + this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + + return this; + }, + + /** + * retain first n characters of the match + * + * @public + * @this {RegExpLexer} + */ + less: function lexer_less(n) { + return this.unput(this.match.slice(n)); + }, + + /** + * return (part of the) already matched input, i.e. for error + * messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of + * input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * @public + * @this {RegExpLexer} + */ + pastInput: function lexer_pastInput(maxSize, maxLines) { + var past = this.matched.substring(0, this.matched.length - this.match.length); + + if (maxSize < 0) maxSize = past.length;else if (!maxSize) maxSize = 20; + + if (maxLines < 0) maxLines = past.length; // can't ever have more input lines than this! + else if (!maxLines) maxLines = 1; + + // `substr` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + past = past.substr(-maxSize * 2 - 2); + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = past.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(-maxLines); + past = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis prefix... + if (past.length > maxSize) { + past = '...' + past.substr(-maxSize); + } + + return past; + }, + + /** + * return (part of the) upcoming input, i.e. for error messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * > ### NOTE ### + * > + * > *"upcoming input"* is defined as the whole of the both + * > the *currently lexed* input, together with any remaining input + * > following that. *"currently lexed"* input is the input + * > already recognized by the lexer but not yet returned with + * > the lexer token. This happens when you are invoking this API + * > from inside any lexer rule action code block. + * > + * + * @public + * @this {RegExpLexer} + */ + upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { + var next = this.match; + + if (maxSize < 0) maxSize = next.length + this._input.length;else if (!maxSize) maxSize = 20; + + if (maxLines < 0) maxLines = maxSize; // can't ever have more input lines than this! + else if (!maxLines) maxLines = 1; + + // `substring` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + if (next.length < maxSize * 2 + 2) { + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + } + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = next.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(0, maxLines); + next = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis postfix... + if (next.length > maxSize) { + next = next.substring(0, maxSize) + '...'; + } + + return next; + }, + + /** + * return a string which displays the character position where the + * lexing error occurred, i.e. for error messages + * + * @public + * @this {RegExpLexer} + */ + showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { + var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; + }, + + /** + * return a string which displays the lines & columns of input which are referenced + * by the given location info range, plus a few lines of context. + * + * This function pretty-prints the indicated section of the input, with line numbers + * and everything! + * + * This function is very useful to provide highly readable error reports, while + * the location range may be specified in various flexible ways: + * + * - `loc` is the location info object which references the area which should be + * displayed and 'marked up': these lines & columns of text are marked up by `^` + * characters below each character in the entire input range. + * + * - `context_loc` is the *optional* location info object which instructs this + * pretty-printer how much *leading* context should be displayed alongside + * the area referenced by `loc`. This can help provide context for the displayed + * error, etc. + * + * When this location info is not provided, a default context of 3 lines is + * used. + * + * - `context_loc2` is another *optional* location info object, which serves + * a similar purpose to `context_loc`: it specifies the amount of *trailing* + * context lines to display in the pretty-print output. + * + * When this location info is not provided, a default context of 1 line only is + * used. + * + * Special Notes: + * + * - when the `loc`-indicated range is very large (about 5 lines or more), then + * only the first and last few lines of this block are printed while a + * `...continued...` message will be printed between them. + * + * This serves the purpose of not printing a huge amount of text when the `loc` + * range happens to be huge: this way a manageable & readable output results + * for arbitrary large ranges. + * + * - this function can display lines of input which whave not yet been lexed. + * `prettyPrintRange()` can access the entire input! + * + * @public + * @this {RegExpLexer} + */ + prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { + var CONTEXT = 3; + var CONTEXT_TAIL = 1; + var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var input = this.matched + this._input; + var lines = input.split('\n'); + + //var show_context = (error_size < 5 || context_loc); + var l0 = Math.max(1, context_loc ? context_loc.first_line : loc.first_line - CONTEXT); + + var l1 = Math.max(1, context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL); + var lineno_display_width = 1 + Math.log10(l1 | 1) | 0; + var ws_prefix = new Array(lineno_display_width).join(' '); + var nonempty_line_indexes = []; + + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ': ' + line; + var errpfx = new Array(lineno_display_width + 1).join('^'); + + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + + var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); + + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } + + rv = rv.replace(/\t/g, ' '); + return rv; + }); + + // now make sure we don't print an overly large amount of error area: limit it + // to the top and bottom line count: + if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { + var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; + + console.log('clip off: ', { + start: clip_start, + end: clip_end, + len: clip_end - clip_start + 1, + arr: nonempty_line_indexes, + rv: rv + }); + + var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; + intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; + rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); + } + + return rv.join('\n'); + }, + + /** + * helper function, used to produce a human readable description as a string, given + * the input `yylloc` location object. + * + * Set `display_range_too` to TRUE to include the string character index position(s) + * in the description if the `yylloc.range` is available. + * + * @public + * @this {RegExpLexer} + */ + describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { + var l1 = yylloc.first_line; + var l2 = yylloc.last_line; + var c1 = yylloc.first_column; + var c2 = yylloc.last_column; + var dl = l2 - l1; + var dc = c2 - c1; + var rv; + + if (dl === 0) { + rv = 'line ' + l1 + ', '; + + if (dc <= 1) { + rv += 'column ' + c1; + } else { + rv += 'columns ' + c1 + ' .. ' + c2; + } + } else { + rv = 'lines ' + l1 + '(column ' + c1 + ') .. ' + l2 + '(column ' + c2 + ')'; + } + + if (yylloc.range && display_range_too) { + var r1 = yylloc.range[0]; + var r2 = yylloc.range[1] - 1; + + if (r2 <= r1) { + rv += ' {String Offset: ' + r1 + '}'; + } else { + rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; + } + } + + return rv; + }, + + /** + * test the lexed token: return FALSE when not a match, otherwise return token. + * + * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + * contains the actually matched text string. + * + * Also move the input cursor forward and update the match collectors: + * + * - `yytext` + * - `yyleng` + * - `match` + * - `matches` + * - `yylloc` + * - `offset` + * + * @public + * @this {RegExpLexer} + */ + test_match: function lexer_test_match(match, indexed_rule) { + var token, lines, backup, match_str, match_str_len; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.yylloc.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column, + range: this.yylloc.range.slice(0) + }, + + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + + //_signaled_error_token: this._signaled_error_token, + yy: this.yy, + + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + } + + match_str = match[0]; + match_str_len = match_str.length; + + // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { + lines = match_str.split(/(?:\r\n?|\n)/g); + + if (lines.length > 1) { + this.yylineno += lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + this.yylloc.last_column = lines[lines.length - 1].length; + } else { + this.yylloc.last_column += match_str_len; + } + + // } + this.yytext += match_str; + + this.match += match_str; + this.matched += match_str; + this.matches = match; + this.yyleng = this.yytext.length; + this.yylloc.range[1] += match_str_len; + + // previous lex rules MAY have invoked the `more()` API rather than producing a token: + // those rules will already have moved this `offset` forward matching their match lengths, + // hence we must only add our own match length now: + this.offset += match_str_len; + + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match_str_len); + + // calling this method: + // + // function lexer__performAction(yy, yyrulenumber, YY_START) {...} + token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ + ); + + // otherwise, when the action codes are all simple return token statements: + //token = this.simpleCaseActionClusters[indexed_rule]; + + if (this.done && this._input) { + this.done = false; + } + + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + + this.__currentRuleSet__ = null; + return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as `.parseError()` in `reject()` + // did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + + this._signaled_error_token = false; + return token; + } + + return false; + }, + + /** + * return next match in input + * + * @public + * @this {RegExpLexer} + */ + next: function lexer_next() { + if (this.done) { + this.clear(); + return this.EOF; + } + + if (!this._input) { + this.done = true; + } + + var token, match, tempMatch, index; + + if (!this._more) { + this.clear(); + } + + var spec = this.__currentRuleSet__; + + if (!spec) { + // Update the ruleset cache as we apparently encountered a state change or just started lexing. + // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will + // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps + // speed up those activities a tiny bit. + spec = this.__currentRuleSet__ = this._currentRules(); + + // Check whether a *sane* condition has been pushed before: this makes the lexer robust against + // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 + if (!spec || !spec.rules) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo('Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, false); + + // produce one 'error' token until this situation has been resolved, most probably by parse termination! + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + } + + var rule_ids = spec.rules; + var regexes = spec.__rule_regexes; + var len = spec.__rule_count; + + // Note: the arrays are 1-based, while `len` itself is a valid index, + // hence the non-standard less-or-equal check in the next loop condition! + for (var i = 1; i <= len; i++) { + tempMatch = this._input.match(regexes[i]); + + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rule_ids[i]); + + if (token !== false) { + return token; + } else if (this._backtrack) { + match = undefined; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + + if (match) { + token = this.test_match(match, rule_ids[index]); + + if (token !== false) { + return token; + } + + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + + if (!this._input) { + this.done = true; + this.clear(); + return this.EOF; + } else { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, this.options.lexerErrorsAreRecoverable); + + token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + + if (token === this.ERROR) { + // we can try to recover from a lexer error that `parseError()` did not 'recover' for us + // by moving forward at least one character at a time: + if (!this.match.length) { + this.input(); + } + } + + return token; + } + }, + + /** + * return next match that has a token + * + * @public + * @this {RegExpLexer} + */ + lex: function lexer_lex() { + var r; + + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + + while (!r) { + r = this.next(); + } + + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + + return r; + }, + + /** + * backwards compatible alias for `pushState()`; + * the latter is symmetrical with `popState()` and we advise to use + * those APIs in any modern lexer code, rather than `begin()`. + * + * @public + * @this {RegExpLexer} + */ + begin: function lexer_begin(condition) { + return this.pushState(condition); + }, + + /** + * activates a new lexer condition state (pushes the new lexer + * condition state onto the condition stack) + * + * @public + * @this {RegExpLexer} + */ + pushState: function lexer_pushState(condition) { + this.conditionStack.push(condition); + this.__currentRuleSet__ = null; + return this; + }, + + /** + * pop the previously active lexer condition state off the condition + * stack + * + * @public + * @this {RegExpLexer} + */ + popState: function lexer_popState() { + var n = this.conditionStack.length - 1; + + if (n > 0) { + this.__currentRuleSet__ = null; + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + + /** + * return the currently active lexer condition state; when an index + * argument is provided it produces the N-th previous condition state, + * if available + * + * @public + * @this {RegExpLexer} + */ + topState: function lexer_topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + + if (n >= 0) { + return this.conditionStack[n]; + } else { + return 'INITIAL'; + } + }, + + /** + * (internal) determine the lexer rule set which is active for the + * currently active lexer condition state + * + * @public + * @this {RegExpLexer} + */ + _currentRules: function lexer__currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; + } else { + return this.conditions['INITIAL']; + } + }, + + /** + * return the number of states currently on the stack + * + * @public + * @this {RegExpLexer} + */ + stateStackSize: function lexer_stateStackSize() { + return this.conditionStack.length; + }, + + options: { + xregexp: true, + ranges: true, + trackPosition: true, + parseActionsUseYYMERGELOCATIONINFO: true, + easy_keyword_rules: true + }, + + JisonLexerError: JisonLexerError, + + performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { + var yy_ = this; + switch (yyrulenumber) { + case 0: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %\{ */ + yy.dept = 0; + + yy.include_command_allowed = false; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 1: + /*! Conditions:: action */ + /*! Rule:: %\{([^]*?)%\} */ + yy_.yytext = this.matches[1]; + + yy.include_command_allowed = true; + return 32; + break; + + case 2: + /*! Conditions:: action */ + /*! Rule:: %include\b */ + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState('path'); + + return 51; + } else { + // TODO + yy_.yyerror('oops!'); + + return 37; + } + + break; + + case 3: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 34; + + break; + + case 4: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\/.* */ + yy.include_command_allowed = false; + + return 35; + break; + + case 6: + /*! Conditions:: action */ + /*! Rule:: \| */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 7: + /*! Conditions:: action */ + /*! Rule:: %% */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 9: + /*! Conditions:: action */ + /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 10: + /*! Conditions:: action */ + /*! Rule:: \/[^}{BR}]* */ + yy.include_command_allowed = false; + + return 33; + break; + + case 11: + /*! Conditions:: action */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy.include_command_allowed = false; + + return 33; + break; + + case 12: + /*! Conditions:: action */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy.include_command_allowed = false; + + return 33; + break; + + case 13: + /*! Conditions:: action */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy.include_command_allowed = false; + + return 33; + break; + + case 14: + /*! Conditions:: action */ + /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 15: + /*! Conditions:: action */ + /*! Rule:: \{ */ + yy.depth++; + + yy.include_command_allowed = false; + return 33; + break; + + case 16: + /*! Conditions:: action */ + /*! Rule:: \} */ + yy.include_command_allowed = false; + + if (yy.depth <= 0) { + yy_.yyerror(rmCommonWS(_templateObject19) + this.prettyPrintRange(this, yy_.yylloc)); + + return 'BRACKETS_SURPLUS'; + } else { + yy.depth--; + } + + return 33; + break; + + case 17: + /*! Conditions:: action */ + /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|]) */ + yy.include_command_allowed = true; + + return 36; // keep empty lines as-is inside action code blocks. + break; + + case 18: + /*! Conditions:: action */ + /*! Rule:: {BR} */ + if (yy.depth > 0) { + yy.include_command_allowed = true; + return 36; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk + this.popState(); + + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } + + break; + + case 19: + /*! Conditions:: action */ + /*! Rule:: $ */ + yy.include_command_allowed = false; + + if (yy.depth !== 0) { + yy_.yyerror(rmCommonWS(_templateObject20, yy.depth) + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = ''; + return 'BRACKETS_MISSING'; + } + + this.popState(); + yy_.yytext = ''; + return 31; + break; + + case 21: + /*! Conditions:: conditions */ + /*! Rule:: > */ + this.popState(); + + return 6; + break; + + case 24: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 25: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 26: + /*! Conditions:: rules */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 27: + /*! Conditions:: rules */ + /*! Rule:: {WS}+{BR}+ */ + /* empty */ + break; + + case 28: + /*! Conditions:: rules */ + /*! Rule:: \/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 29: + /*! Conditions:: rules */ + /*! Rule:: \/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 30: + /*! Conditions:: rules */ + /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + return 28; + break; + + case 31: + /*! Conditions:: rules */ + /*! Rule:: %% */ + this.popState(); + + this.pushState('code'); + return 19; + break; + + case 32: + /*! Conditions:: rules */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 35: + /*! Conditions:: options */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 49; // value is always a string type + break; + + case 36: + /*! Conditions:: options */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 49; // value is always a string type + break; + + case 37: + /*! Conditions:: options */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy_.yytext = unescQuote(this.matches[1], /\\`/g); + + return 49; // value is always a string type + break; + + case 39: + /*! Conditions:: options */ + /*! Rule:: {BR}{WS}+(?=\S) */ + /* skip leading whitespace on the next line of input, when followed by more options */ + break; + + case 40: + /*! Conditions:: options */ + /*! Rule:: {BR} */ + this.popState(); + + return 48; + break; + + case 41: + /*! Conditions:: options */ + /*! Rule:: {WS}+ */ + /* skip whitespace */ + break; + + case 43: + /*! Conditions:: start_condition */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 44: + /*! Conditions:: start_condition */ + /*! Rule:: {WS}+ */ + /* empty */ + break; + + case 46: + /*! Conditions:: INITIAL */ + /*! Rule:: {ID} */ + this.pushState('macro'); + + return 20; + break; + + case 47: + /*! Conditions:: macro named_chunk */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 48: + /*! Conditions:: macro */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 49: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 50: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \s+ */ + /* empty */ + break; + + case 51: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 26; + break; + + case 52: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 26; + break; + + case 53: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \[ */ + this.pushState('set'); + + return 41; + break; + + case 66: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: < */ + this.pushState('conditions'); + + return 5; + break; + + case 67: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/! */ + return 39; // treated as `(?!atom)` + + break; + + case 68: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/ */ + return 14; // treated as `(?=atom)` + + break; + + case 70: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); + + return 44; + break; + + case 73: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %options\b */ + this.pushState('options'); + + return 47; + break; + + case 74: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %s\b */ + this.pushState('start_condition'); + + return 21; + break; + + case 75: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %x\b */ + this.pushState('start_condition'); + + return 22; + break; + + case 76: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %code\b */ + this.pushState('named_chunk'); + + return 25; + break; + + case 77: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %import\b */ + this.pushState('named_chunk'); + + return 24; + break; + + case 78: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %include\b */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 79: + /*! Conditions:: code */ + /*! Rule:: %include\b */ + this.pushState('path'); + + return 51; + break; + + case 80: + /*! Conditions:: INITIAL rules code */ + /*! Rule:: %{NAME}([^\r\n]*) */ + /* ignore unrecognized decl */ + this.warn(rmCommonWS(_templateObject21, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = [this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; + + return 23; + break; + + case 81: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %% */ + this.pushState('rules'); + + return 19; + break; + + case 89: + /*! Conditions:: set */ + /*! Rule:: \] */ + this.popState(); + + return 42; + break; + + case 91: + /*! Conditions:: code */ + /*! Rule:: [^\r\n]+ */ + return 53; // the bit of CODE just before EOF... + + break; + + case 92: + /*! Conditions:: path */ + /*! Rule:: {BR} */ + this.popState(); + + this.unput(yy_.yytext); + break; + + case 93: + /*! Conditions:: path */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 94: + /*! Conditions:: path */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 95: + /*! Conditions:: path */ + /*! Rule:: {WS}+ */ + // skip whitespace in the line + break; + + case 96: + /*! Conditions:: path */ + /*! Rule:: [^\s\r\n]+ */ + this.popState(); + + return 52; + break; + + case 97: + /*! Conditions:: action */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 98: + /*! Conditions:: action */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 99: + /*! Conditions:: action */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 100: + /*! Conditions:: options */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 101: + /*! Conditions:: options */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 102: + /*! Conditions:: options */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 103: + /*! Conditions:: * */ + /*! Rule:: " */ + var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); + + yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 104: + /*! Conditions:: * */ + /*! Rule:: ' */ + var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); + + yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 105: + /*! Conditions:: * */ + /*! Rule:: ` */ + var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); + + yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 106: + /*! Conditions:: macro rules */ + /*! Rule:: . */ + /* b0rk on bad characters */ + var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); + + yy_.yyerror(rmCommonWS(_templateObject25, rules, rules) + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + case 107: + /*! Conditions:: * */ + /*! Rule:: . */ + yy_.yyerror(rmCommonWS(_templateObject26, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + default: + return this.simpleCaseActionClusters[yyrulenumber]; + } + }, + + simpleCaseActionClusters: { + /*! Conditions:: action */ + /*! Rule:: {WS}+ */ + 5: 36, + + /*! Conditions:: action */ + /*! Rule:: % */ + 8: 33, + + /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ + 20: 20, + + /*! Conditions:: conditions */ + /*! Rule:: , */ + 22: 8, + + /*! Conditions:: conditions */ + /*! Rule:: \* */ + 23: 7, + + /*! Conditions:: options */ + /*! Rule:: {NAME} */ + 33: 20, + + /*! Conditions:: options */ + /*! Rule:: = */ + 34: 18, + + /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ + 38: 50, + + /*! Conditions:: start_condition */ + /*! Rule:: {ID} */ + 42: 27, + + /*! Conditions:: named_chunk */ + /*! Rule:: {ID} */ + 45: 20, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \| */ + 54: 9, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?: */ + 55: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?= */ + 56: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?! */ + 57: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \( */ + 58: 10, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \) */ + 59: 11, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \+ */ + 60: 12, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \* */ + 61: 7, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \? */ + 62: 13, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \^ */ + 63: 16, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: , */ + 64: 8, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: <> */ + 65: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + 69: 44, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \$ */ + 71: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \. */ + 72: 15, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{\d+(,\s*\d+|,)?\} */ + 82: 45, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{{ID}\} */ + 83: 40, + + /*! Conditions:: set options */ + /*! Rule:: \{{ID}\} */ + 84: 40, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{ */ + 85: 3, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \} */ + 86: 4, + + /*! Conditions:: set */ + /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ + 87: 43, + + /*! Conditions:: set */ + /*! Rule:: \{ */ + 88: 43, + + /*! Conditions:: code */ + /*! Rule:: [^\r\n]*(\r|\n)+ */ + 90: 53, + + /*! Conditions:: * */ + /*! Rule:: $ */ + 108: 1 + }, + + rules: [ + /* 0: *//^(?:%\{)/, + /* 1: */new XRegExp('^(?:%\\{([^]*?)%\\})', ''), + /* 2: *//^(?:%include\b)/, + /* 3: */new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 4: *//^(?:([^\S\n\r])*\/\/.*)/, + /* 5: *//^(?:([^\S\n\r])+)/, + /* 6: *//^(?:\|)/, + /* 7: *//^(?:%%)/, + /* 8: *//^(?:%)/, + /* 9: *//^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, + /* 10: *//^(?:\/[^\n\r}]*)/, + /* 11: *//^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 12: *//^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 13: *//^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 14: *//^(?:[^\s"%'\/`{-}]+)/, + /* 15: *//^(?:\{)/, + /* 16: *//^(?:\})/, + /* 17: *//^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s|]))/, + /* 18: *//^(?:(\r\n|\n|\r))/, + /* 19: *//^(?:$)/, + /* 20: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', ''), + /* 21: *//^(?:>)/, + /* 22: *//^(?:,)/, + /* 23: *//^(?:\*)/, + /* 24: *//^(?:([^\S\n\r])*\/\/[^\n\r]*)/, + /* 25: */new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 26: *//^(?:(\r\n|\n|\r)+)/, + /* 27: *//^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, + /* 28: *//^(?:\/\/[^\r\n]*)/, + /* 29: */new XRegExp('^(?:\\/\\*[^]*?\\*\\/)', ''), + /* 30: *//^(?:([^\S\n\r])+(?=[^\s%|]))/, + /* 31: *//^(?:%%)/, + /* 32: *//^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 33: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', ''), + /* 34: *//^(?:=)/, + /* 35: *//^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 36: *//^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 37: *//^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 38: *//^(?:\S+)/, + /* 39: *//^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, + /* 40: *//^(?:(\r\n|\n|\r))/, + /* 41: *//^(?:([^\S\n\r])+)/, + /* 42: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 43: *//^(?:(\r\n|\n|\r)+)/, + /* 44: *//^(?:([^\S\n\r])+)/, + /* 45: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 46: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 47: *//^(?:(\r\n|\n|\r)+)/, + /* 48: *//^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 49: *//^(?:(\r\n|\n|\r)+)/, + /* 50: *//^(?:\s+)/, + /* 51: *//^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 52: *//^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 53: *//^(?:\[)/, + /* 54: *//^(?:\|)/, + /* 55: *//^(?:\(\?:)/, + /* 56: *//^(?:\(\?=)/, + /* 57: *//^(?:\(\?!)/, + /* 58: *//^(?:\()/, + /* 59: *//^(?:\))/, + /* 60: *//^(?:\+)/, + /* 61: *//^(?:\*)/, + /* 62: *//^(?:\?)/, + /* 63: *//^(?:\^)/, + /* 64: *//^(?:,)/, + /* 65: *//^(?:<>)/, + /* 66: *//^(?:<)/, + /* 67: *//^(?:\/!)/, + /* 68: *//^(?:\/)/, + /* 69: *//^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 70: *//^(?:\\.)/, + /* 71: *//^(?:\$)/, + /* 72: *//^(?:\.)/, + /* 73: *//^(?:%options\b)/, + /* 74: *//^(?:%s\b)/, + /* 75: *//^(?:%x\b)/, + /* 76: *//^(?:%code\b)/, + /* 77: *//^(?:%import\b)/, + /* 78: *//^(?:%include\b)/, + /* 79: *//^(?:%include\b)/, + /* 80: */new XRegExp('^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))', ''), + /* 81: *//^(?:%%)/, + /* 82: *//^(?:\{\d+(,\s*\d+|,)?\})/, + /* 83: */new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 84: */new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 85: *//^(?:\{)/, + /* 86: *//^(?:\})/, + /* 87: *//^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 88: *//^(?:\{)/, + /* 89: *//^(?:\])/, + /* 90: *//^(?:[^\r\n]*(\r|\n)+)/, + /* 91: *//^(?:[^\r\n]+)/, + /* 92: *//^(?:(\r\n|\n|\r))/, + /* 93: *//^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 94: *//^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 95: *//^(?:([^\S\n\r])+)/, + /* 96: *//^(?:\S+)/, + /* 97: *//^(?:")/, + /* 98: *//^(?:')/, + /* 99: *//^(?:`)/, + /* 100: *//^(?:")/, + /* 101: *//^(?:')/, + /* 102: *//^(?:`)/, + /* 103: *//^(?:")/, + /* 104: *//^(?:')/, + /* 105: *//^(?:`)/, + /* 106: *//^(?:.)/, + /* 107: *//^(?:.)/, + /* 108: *//^(?:$)/], + + conditions: { + 'rules': { + rules: [0, 26, 27, 28, 29, 30, 31, 32, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 85, 86, 103, 104, 105, 106, 107, 108], + + inclusive: true + }, + + 'macro': { + rules: [0, 24, 25, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 81, 82, 83, 85, 86, 103, 104, 105, 106, 107, 108], + + inclusive: true + }, + + 'named_chunk': { + rules: [0, 45, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 81, 82, 83, 85, 86, 103, 104, 105, 107, 108], + + inclusive: true + }, + + 'code': { + rules: [79, 80, 90, 91, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'start_condition': { + rules: [24, 25, 42, 43, 44, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'options': { + rules: [24, 25, 33, 34, 35, 36, 37, 38, 39, 40, 41, 84, 100, 101, 102, 103, 104, 105, 107, 108], + + inclusive: false + }, + + 'conditions': { + rules: [20, 21, 22, 23, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'action': { + rules: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 97, 98, 99, 103, 104, 105, 107, 108], + + inclusive: false + }, + + 'path': { + rules: [24, 25, 92, 93, 94, 95, 96, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'set': { + rules: [84, 87, 88, 89, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'INITIAL': { + rules: [0, 24, 25, 46, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 85, 86, 103, 104, 105, 107, 108], + + inclusive: true + } + } + }; + + var rmCommonWS = helpers.rmCommonWS; + var dquote = helpers.dquote; + + function unescQuote(str) { + str = '' + str; + var a = str.split('\\\\'); + + a = a.map(function (s) { + return s.replace(/\\'/g, '\'').replace(/\\"/g, '"'); + }); + + str = a.join('\\\\'); + return str; + } + + lexer.warn = function l_warn() { + if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { + return this.yy.parser.warn.apply(this, arguments); + } else { + console.warn.apply(console, arguments); + } + }; + + lexer.log = function l_log() { + if (this.yy && this.yy.parser && typeof this.yy.parser.log === 'function') { + return this.yy.parser.log.apply(this, arguments); + } else { + console.log.apply(console, arguments); + } + }; + + return lexer; +}(); +parser.lexer = lexer; + +function Parser() { + this.yy = {}; +} +Parser.prototype = parser; +parser.Parser = Parser; + +function yyparse() { + return parser.parse.apply(parser, arguments); +} + +exports.parser = parser; +exports.Parser = Parser; +exports.parse = yyparse; diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js new file mode 100644 index 0000000..52afe78 --- /dev/null +++ b/dist/lex-parser-cjs.js @@ -0,0 +1,7809 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } + +var fs = _interopDefault(require('fs')); +var XRegExp = _interopDefault(require('@gerhobbelt/xregexp')); +var helpers = _interopDefault(require('jison-helpers-lib')); + +// hack: +var assert; + + +/* parser generated by jison 0.6.0-194 */ + +/* + * Returns a Parser object of the following structure: + * + * Parser: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a derivative/copy of this one, + * not a direct reference! + * } + * + * Parser.prototype: { + * yy: {}, + * EOF: 1, + * TERROR: 2, + * + * trace: function(errorMessage, ...), + * + * JisonParserError: function(msg, hash), + * + * quoteName: function(name), + * Helper function which can be overridden by user code later on: put suitable + * quotes around literal IDs in a description string. + * + * originalQuoteName: function(name), + * The basic quoteName handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function + * at the end of the `parse()`. + * + * describeSymbol: function(symbol), + * Return a more-or-less human-readable description of the given symbol, when + * available, or the symbol itself, serving as its own 'description' for lack + * of something better to serve up. + * + * Return NULL when the symbol is unknown to the parser. + * + * symbols_: {associative list: name ==> number}, + * terminals_: {associative list: number ==> name}, + * nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}}, + * terminal_descriptions_: (if there are any) {associative list: number ==> description}, + * productions_: [...], + * + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) + * to store/reference the rule value `$$` and location info `@$`. + * + * One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets + * to see the same object via the `this` reference, i.e. if you wish to carry custom + * data from one reduce action through to the next within a single parse run, then you + * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. + * + * `this.yy` is a direct reference to the `yy` shared state object. + * + * `%parse-param`-specified additional `parse()` arguments have been added to this `yy` + * object at `parse()` start and are therefore available to the action code via the + * same named `yy.xxxx` attributes (where `xxxx` represents a identifier name from + * the %parse-param` list. + * + * - `yytext` : reference to the lexer value which belongs to the last lexer token used + * to match this rule. This is *not* the look-ahead token, but the last token + * that's actually part of this rule. + * + * Formulated another way, `yytext` is the value of the token immediately preceeding + * the current look-ahead token. + * Caveats apply for rules which don't require look-ahead, such as epsilon rules. + * + * - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value. + * + * - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value. + * + * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. + * + * WARNING: since jison 0.4.18-186 this entry may be NULL/UNDEFINED instead + * of an empty object when no suitable location info can be provided. + * + * - `yystate` : the current parser state number, used internally for dispatching and + * executing the action code chunk matching the rule currently being reduced. + * + * - `yysp` : the current state stack position (a.k.a. 'stack pointer') + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * Also note that you can access this and other stack index values using the new double-hash + * syntax, i.e. `##$ === ##0 === yysp`, while `##1` is the stack index for all things + * related to the first rule term, just like you have `$1`, `@1` and `#1`. + * This is made available to write very advanced grammar action rules, e.g. when you want + * to investigate the parse state stack in your action code, which would, for example, + * be relevant when you wish to implement error diagnostics and reporting schemes similar + * to the work described here: + * + * + Pottier, F., 2016. Reachability and error diagnosis in LR(1) automata. + * In Journées Francophones des Languages Applicatifs. + * + * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. + * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. + * + * - `yyrulelength`: the current rule's term count, i.e. the number of entries occupied on the stack. + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. + * constructs. + * + * - `yylstack`: reference to the parser token location stack. Also accessed via + * the `@1` etc. constructs. + * + * WARNING: since jison 0.4.18-186 this array MAY contain slots which are + * UNDEFINED rather than an empty (location) object, when the lexer/parser + * action code did not provide a suitable location info object when such a + * slot was filled! + * + * - `yystack` : reference to the parser token id stack. Also accessed via the + * `#1` etc. constructs. + * + * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to + * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might + * want access this array for your own purposes, such as error analysis as mentioned above! + * + * Note that this stack stores the current stack of *tokens*, that is the sequence of + * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* + * (lexer tokens *shifted* onto the stack until the rule they belong to is found and + * *reduced*. + * + * - `yysstack`: reference to the parser state stack. This one carries the internal parser + * *states* such as the one in `yystate`, which are used to represent + * the parser state machine in the *parse table*. *Very* *internal* stuff, + * what can I say? If you access this one, you're clearly doing wicked things + * + * - `...` : the extra arguments you specified in the `%parse-param` statement in your + * grammar definition file. + * + * table: [...], + * State transition table + * ---------------------- + * + * index levels are: + * - `state` --> hash table + * - `symbol` --> action (number or array) + * + * If the `action` is an array, these are the elements' meaning: + * - index [0]: 1 = shift, 2 = reduce, 3 = accept + * - index [1]: GOTO `state` + * + * If the `action` is a number, it is the GOTO `state` + * + * defaultActions: {...}, + * + * parseError: function(str, hash, ExceptionClass), + * yyError: function(str, ...), + * yyRecovering: function(), + * yyErrOk: function(), + * yyClearIn: function(), + * + * constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this parser kernel in many places; example usage: + * + * var infoObj = parser.constructParseErrorInfo('fail!', null, + * parser.collect_expected_token_set(state), true); + * var retVal = parser.parseError(infoObj.errStr, infoObj, parser.JisonParserError); + * + * originalParseError: function(str, hash, ExceptionClass), + * The basic `parseError` handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function + * at the end of the `parse()`. + * + * options: { ... parser %options ... }, + * + * parse: function(input[, args...]), + * Parse the given `input` and return the parsed value (or `true` when none was provided by + * the root action, in which case the parser is acting as a *matcher*). + * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * the lexer section of the grammar spec): these will be inserted in the `yy` shared state + * object and any collision with those will be reported by the lexer via a thrown exception. + * + * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown + * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY + * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and + * the internal parser gets properly garbage collected under these particular circumstances. + * + * yyMergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API can be invoked to calculate a spanning `yylloc` location info object. + * + * Note: %epsilon rules MAY specify no `first_index` and `first_yylloc`, in which case + * this function will attempt to obtain a suitable location marker by inspecting the location stack + * backwards. + * + * For more info see the documentation comment further below, immediately above this function's + * implementation. + * + * lexer: { + * yy: {...}, A reference to the so-called "shared state" `yy` once + * received via a call to the `.setInput(input, yy)` lexer API. + * EOF: 1, + * ERROR: 2, + * JisonLexerError: function(msg, hash), + * parseError: function(str, hash, ExceptionClass), + * setInput: function(input, [yy]), + * input: function(), + * unput: function(str), + * more: function(), + * reject: function(), + * less: function(n), + * pastInput: function(n), + * upcomingInput: function(n), + * showPosition: function(), + * test_match: function(regex_match_array, rule_index, ...), + * next: function(...), + * lex: function(...), + * begin: function(condition), + * pushState: function(condition), + * popState: function(), + * topState: function(), + * _currentRules: function(), + * stateStackSize: function(), + * cleanupAfterLex: function() + * + * options: { ... lexer %options ... }, + * + * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...), + * rules: [...], + * conditions: {associative list: name ==> set}, + * } + * } + * + * + * token location info (@$, _$, etc.): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer and + * parser errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * } + * + * parser (grammar) errors will also provide these additional members: + * + * { + * expected: (array describing the set of expected tokens; + * may be UNDEFINED when we cannot easily produce such a set) + * state: (integer (or array when the table includes grammar collisions); + * represents the current internal state of the parser kernel. + * can, for example, be used to pass to the `collect_expected_token_set()` + * API to obtain the expected token set) + * action: (integer; represents the current internal action which will be executed) + * new_state: (integer; represents the next/planned internal state, once the current + * action has executed) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, + * for instance, for advanced error analysis and reporting) + * value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used, + * for instance, for advanced error analysis and reporting) + * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, + * for instance, for advanced error analysis and reporting) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * parser: (reference to the current parser instance) + * } + * + * while `this` will reference the current parser instance. + * + * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * lexer: (reference to the current lexer instance which reported the error) + * } + * + * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired + * from either the parser or lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * exception: (reference to the exception thrown) + * } + * + * Please do note that in the latter situation, the `expected` field will be omitted as + * this type of failure is assumed not to be due to *parse errors* but rather due to user + * action code in either parser or lexer failing unexpectedly. + * + * --- + * + * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + * These options are available: + * + * ### options which are global for all parser instances + * + * Parser.pre_parse: function(yy) + * optional: you can specify a pre_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. + * Parser.post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: you can specify a post_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. When it does not return any value, + * the parser will return the original `retval`. + * + * ### options which can be set up per parser instance + * + * yy: { + * pre_parse: function(yy) + * optional: is invoked before the parse cycle starts (and before the first + * invocation of `lex()`) but immediately after the invocation of + * `parser.pre_parse()`). + * post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: is invoked when the parse terminates due to success ('accept') + * or failure (even when exceptions are thrown). + * `retval` contains the return value to be produced by `Parser.parse()`; + * this function can override the return value by returning another. + * When it does not return any value, the parser will return the original + * `retval`. + * This function is invoked immediately before `parser.post_parse()`. + * + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * quoteName: function(name), + * optional: overrides the default `quoteName` function. + * } + * + * parser.lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this `%option` has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + + +// See also: +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 +// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility +// with userland code which might access the derived class in a 'classic' way. +function JisonParserError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonParserError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + + var stacktrace; + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = (new Error(msg)).stack; + } + } + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } +} + +if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonParserError.prototype, Error.prototype); +} else { + JisonParserError.prototype = Object.create(Error.prototype); +} +JisonParserError.prototype.constructor = JisonParserError; +JisonParserError.prototype.name = 'JisonParserError'; + + +// import XRegExp from '@gerhobbelt/xregexp'; +// import helpers from 'jison-helpers-lib'; +// import fs from 'fs'; + + +// helper: reconstruct the productions[] table +function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); + } + return rv; +} + + + +// helper: reconstruct the defaultActions[] table +function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; +} + + + +// helper: reconstruct the 'goto' table +function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; + + case 0: + q[z] = a.shift(); + break; + + default: + // type === 1: accept + q[z] = [ + 3 + ]; + } + } + rv.push(q); + } + return rv; +} + + + +// helper: runlength encoding with increment step: code, length: step (default step = 0) +// `this` references an array +function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } +} + +// helper: duplicate sequence from *relative* offset and length. +// `this` references an array +function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } +} + +// helper: unpack an array using helpers and data, all passed in an array argument 'a'. +function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; +} + + +var parser = { + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // default action mode: ............. classic,merge + // no try..catch: ................... false + // no default resolve on conflict: false + // on-demand look-ahead: ............ false + // error recovery token skip maximum: 3 + // yyerror in parse actions is: ..... NOT recoverable, + // yyerror in lexer actions and other non-fatal lexer are: + // .................................. NOT recoverable, + // debug grammar/output: ............ false + // has partial LR conflict upgrade: true + // rudimentary token-stack support: false + // parser table compression mode: ... 2 + // export debug tables: ............. false + // export *all* tables: ............. false + // module type: ..................... es + // parser engine type: .............. lalr + // output main() in the module: ..... true + // number of expected conflicts: .... 0 + // + // + // Parser Analysis flags: + // + // no significant actions (parser is a language matcher only): + // .................................. false + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses ParseError API: ............. false + // uses YYERROR: .................... true + // uses YYRECOVERING: ............... false + // uses YYERROK: .................... false + // uses YYCLEARIN: .................. false + // tracks rule values: .............. true + // assigns rule values: ............. true + // uses location tracking: .......... true + // assigns location: ................ true + // uses yystack: .................... false + // uses yysstack: ................... false + // uses yysp: ....................... true + // uses yyrulelength: ............... false + // uses yyMergeLocationInfo API: .... true + // has error recovery: .............. true + // has error reporting: ............. true + // + // --------- END OF REPORT ----------- + +trace: function no_op_trace() { }, +JisonParserError: JisonParserError, +yy: {}, +options: { + type: "lalr", + hasPartialLrUpgradeOnConflict: true, + errorRecoveryTokenDiscardCount: 3 +}, +symbols_: { + "$": 17, + "$accept": 0, + "$end": 1, + "%%": 19, + "(": 10, + ")": 11, + "*": 7, + "+": 12, + ",": 8, + ".": 15, + "/": 14, + "/!": 39, + "<": 5, + "=": 18, + ">": 6, + "?": 13, + "ACTION": 32, + "ACTION_BODY": 33, + "ACTION_BODY_CPP_COMMENT": 35, + "ACTION_BODY_C_COMMENT": 34, + "ACTION_BODY_WHITESPACE": 36, + "ACTION_END": 31, + "ACTION_START": 28, + "BRACKET_MISSING": 29, + "BRACKET_SURPLUS": 30, + "CHARACTER_LIT": 46, + "CODE": 53, + "EOF": 1, + "ESCAPE_CHAR": 44, + "IMPORT": 24, + "INCLUDE": 51, + "INCLUDE_PLACEMENT_ERROR": 37, + "INIT_CODE": 25, + "NAME": 20, + "NAME_BRACE": 40, + "OPTIONS": 47, + "OPTIONS_END": 48, + "OPTION_STRING_VALUE": 49, + "OPTION_VALUE": 50, + "PATH": 52, + "RANGE_REGEX": 45, + "REGEX_SET": 43, + "REGEX_SET_END": 42, + "REGEX_SET_START": 41, + "SPECIAL_GROUP": 38, + "START_COND": 27, + "START_EXC": 22, + "START_INC": 21, + "STRING_LIT": 26, + "UNKNOWN_DECL": 23, + "^": 16, + "action": 68, + "action_body": 69, + "any_group_regex": 78, + "definition": 58, + "definitions": 57, + "error": 2, + "escape_char": 81, + "extra_lexer_module_code": 87, + "import_name": 60, + "import_path": 61, + "include_macro_code": 88, + "init": 56, + "init_code_name": 59, + "lex": 54, + "module_code_chunk": 89, + "name_expansion": 77, + "name_list": 71, + "names_exclusive": 63, + "names_inclusive": 62, + "nonempty_regex_list": 74, + "option": 86, + "option_list": 85, + "optional_module_code_chunk": 90, + "options": 84, + "range_regex": 82, + "regex": 72, + "regex_base": 76, + "regex_concat": 75, + "regex_list": 73, + "regex_set": 79, + "regex_set_atom": 80, + "rule": 67, + "rule_block": 66, + "rules": 64, + "rules_and_epilogue": 55, + "rules_collective": 65, + "start_conditions": 70, + "string": 83, + "{": 3, + "|": 9, + "}": 4 +}, +terminals_: { + 1: "EOF", + 2: "error", + 3: "{", + 4: "}", + 5: "<", + 6: ">", + 7: "*", + 8: ",", + 9: "|", + 10: "(", + 11: ")", + 12: "+", + 13: "?", + 14: "/", + 15: ".", + 16: "^", + 17: "$", + 18: "=", + 19: "%%", + 20: "NAME", + 21: "START_INC", + 22: "START_EXC", + 23: "UNKNOWN_DECL", + 24: "IMPORT", + 25: "INIT_CODE", + 26: "STRING_LIT", + 27: "START_COND", + 28: "ACTION_START", + 29: "BRACKET_MISSING", + 30: "BRACKET_SURPLUS", + 31: "ACTION_END", + 32: "ACTION", + 33: "ACTION_BODY", + 34: "ACTION_BODY_C_COMMENT", + 35: "ACTION_BODY_CPP_COMMENT", + 36: "ACTION_BODY_WHITESPACE", + 37: "INCLUDE_PLACEMENT_ERROR", + 38: "SPECIAL_GROUP", + 39: "/!", + 40: "NAME_BRACE", + 41: "REGEX_SET_START", + 42: "REGEX_SET_END", + 43: "REGEX_SET", + 44: "ESCAPE_CHAR", + 45: "RANGE_REGEX", + 46: "CHARACTER_LIT", + 47: "OPTIONS", + 48: "OPTIONS_END", + 49: "OPTION_STRING_VALUE", + 50: "OPTION_VALUE", + 51: "INCLUDE", + 52: "PATH", + 53: "CODE" +}, +TERROR: 2, +EOF: 1, + +// internals: defined here so the object *structure* doesn't get modified by parse() et al, +// thus helping JIT compilers like Chrome V8. +originalQuoteName: null, +originalParseError: null, +cleanupAfterParse: null, +constructParseErrorInfo: null, +yyMergeLocationInfo: null, + +__reentrant_call_depth: 0, // INTERNAL USE ONLY +__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup + +// APIs which will be set up depending on user action code analysis: +//yyRecovering: 0, +//yyErrOk: 0, +//yyClearIn: 0, + +// Helper APIs +// ----------- + +// Helper function which can be overridden by user code later on: put suitable quotes around +// literal IDs in a description string. +quoteName: function parser_quoteName(id_str) { + return '"' + id_str + '"'; +}, + +// Return the name of the given symbol (terminal or non-terminal) as a string, when available. +// +// Return NULL when the symbol is unknown to the parser. +getSymbolName: function parser_getSymbolName(symbol) { + if (this.terminals_[symbol]) { + return this.terminals_[symbol]; + } + + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. + // + // An example of this may be where a rule's action code contains a call like this: + // + // parser.getSymbolName(#$) + // + // to obtain a human-readable name of the current grammar rule. + var s = this.symbols_; + for (var key in s) { + if (s[key] === symbol) { + return key; + } + } + return null; +}, + +// Return a more-or-less human-readable description of the given symbol, when available, +// or the symbol itself, serving as its own 'description' for lack of something better to serve up. +// +// Return NULL when the symbol is unknown to the parser. +describeSymbol: function parser_describeSymbol(symbol) { + if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { + return this.terminal_descriptions_[symbol]; + } + else if (symbol === this.EOF) { + return 'end of input'; + } + var id = this.getSymbolName(symbol); + if (id) { + return this.quoteName(id); + } + return null; +}, + +// Produce a (more or less) human-readable list of expected tokens at the point of failure. +// +// The produced list may contain token or token set descriptions instead of the tokens +// themselves to help turning this output into something that easier to read by humans +// unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*, +// expected terminals and nonterminals is produced. +// +// The returned list (array) will not contain any duplicate entries. +collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) { + var TERROR = this.TERROR; + var tokenset = []; + var check = {}; + // Has this (error?) state been outfitted with a custom expectations description text for human consumption? + // If so, use that one instead of the less palatable token set. + if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { + return [ + this.state_descriptions_[state] + ]; + } + for (var p in this.table[state]) { + p = +p; + if (p !== TERROR) { + var d = do_not_describe ? p : this.describeSymbol(p); + if (d && !check[d]) { + tokenset.push(d); + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + } + } + } + return tokenset; +}, +productions_: bp({ + pop: u([ + 54, + 54, + s, + [55, 3], + 56, + 57, + 57, + s, + [58, 11], + 59, + 59, + 60, + 60, + 61, + 61, + 62, + 62, + 63, + 63, + 64, + 64, + s, + [65, 4], + 66, + 66, + 67, + 67, + s, + [68, 3], + s, + [69, 9], + s, + [70, 4], + 71, + 71, + 72, + s, + [73, 4], + s, + [74, 4], + 75, + 75, + s, + [76, 17], + 77, + 78, + 78, + 79, + 79, + 80, + s, + [80, 4, 1], + 83, + 84, + 85, + 85, + s, + [86, 6], + 87, + 87, + 88, + 88, + s, + [89, 3], + 90, + 90 +]), + rule: u([ + s, + [4, 3], + 2, + 0, + 0, + 2, + 0, + s, + [2, 3], + s, + [1, 3], + 3, + 3, + 2, + 3, + 3, + s, + [1, 7], + 2, + 1, + 2, + c, + [23, 3], + 4, + 4, + 3, + c, + [29, 4], + s, + [3, 3], + s, + [2, 8], + 0, + s, + [3, 3], + 0, + 1, + 3, + 1, + s, + [3, 4, -1], + c, + [21, 3], + c, + [40, 3], + s, + [3, 4], + s, + [2, 5], + c, + [12, 3], + s, + [1, 6], + c, + [16, 3], + c, + [10, 8], + c, + [9, 3], + s, + [3, 4], + c, + [10, 4], + c, + [32, 5], + 0 +]) +}), +performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyvstack, yylstack) { + + /* this == yyval */ + + // the JS engine itself can go and remove these statements when `yy` turns out to be unused in any action code! + var yy = this.yy; + var yyparser = yy.parser; + var yylexer = yy.lexer; + + + + switch (yystate) { +case 0: + /*! Production:: $accept : lex $end */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yylstack[yysp - 1]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + +case 1: + /*! Production:: lex : init definitions rules_and_epilogue EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + this.$.macros = yyvstack[yysp - 2].macros; + this.$.startConditions = yyvstack[yysp - 2].startConditions; + this.$.unknownDecls = yyvstack[yysp - 2].unknownDecls; + + // if there are any options, add them all, otherwise set options to NULL: + // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: + for (var k in yy.options) { + this.$.options = yy.options; + break; + } + + if (yy.actionInclude) { + var asrc = yy.actionInclude.join('\n\n'); + // Only a non-empty action code chunk should actually make it through: + if (asrc.trim() !== '') { + this.$.actionInclude = asrc; + } + } + + delete yy.options; + delete yy.actionInclude; + return this.$; + break; + +case 2: + /*! Production:: lex : init definitions error EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Maybe you did not correctly separate the lexer sections with a '%%' + on an otherwise empty line? + The lexer spec file should have this structure: + + definitions + %% + rules + %% // <-- optional! + extra_module_code // <-- optional! + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 3: + /*! Production:: rules_and_epilogue : "%%" rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; + } else { + this.$ = { rules: yyvstack[yysp - 2] }; + } + break; + +case 4: + /*! Production:: rules_and_epilogue : "%%" rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: yyvstack[yysp] }; + break; + +case 5: + /*! Production:: rules_and_epilogue : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: [] }; + break; + +case 6: + /*! Production:: init : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.actionInclude = []; + if (!yy.options) yy.options = {}; + break; + +case 7: + /*! Production:: definitions : definitions definition */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + if (yyvstack[yysp] != null) { + if ('length' in yyvstack[yysp]) { + this.$.macros[yyvstack[yysp][0]] = yyvstack[yysp][1]; + } else if (yyvstack[yysp].type === 'names') { + for (var name in yyvstack[yysp].names) { + this.$.startConditions[name] = yyvstack[yysp].names[name]; + } + } else if (yyvstack[yysp].type === 'unknown') { + this.$.unknownDecls.push(yyvstack[yysp].body); + } + } + break; + +case 8: + /*! Production:: definitions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + macros: {}, // { hash table } + startConditions: {}, // { hash table } + unknownDecls: [] // [ array of [key,value] pairs } + }; + break; + +case 9: + /*! Production:: definition : NAME regex */ +case 38: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + +case 10: + /*! Production:: definition : START_INC names_inclusive */ +case 11: + /*! Production:: definition : START_EXC names_exclusive */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + +case 12: + /*! Production:: definition : action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + yy.actionInclude.push(yyvstack[yysp]); this.$ = null; + break; + +case 13: + /*! Production:: definition : options */ +case 99: + /*! Production:: option_list : option */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 14: + /*! Production:: definition : UNKNOWN_DECL */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'unknown', body: yyvstack[yysp]}; + break; + +case 15: + /*! Production:: definition : IMPORT import_name import_path */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp]}; + break; + +case 16: + /*! Production:: definition : IMPORT import_name error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + You did not specify a legal file path for the '%import' initialization code statement, which must have the format: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 17: + /*! Production:: definition : IMPORT error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + %import name or source filename missing maybe? + + Note: each '%import'-ed initialization code section must be qualified by a name, e.g. 'required' before the import path itself: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 18: + /*! Production:: definition : INIT_CODE init_code_name action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + type: 'codesection', + qualifier: yyvstack[yysp - 1], + include: yyvstack[yysp] + }; + break; + +case 19: + /*! Production:: definition : INIT_CODE error action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Each '%code' initialization code section must be qualified by a name, e.g. 'required' before the action code itself: + %code qualifier_name {action code} + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 20: + /*! Production:: init_code_name : NAME */ +case 21: + /*! Production:: init_code_name : STRING_LIT */ +case 22: + /*! Production:: import_name : NAME */ +case 23: + /*! Production:: import_name : STRING_LIT */ +case 24: + /*! Production:: import_path : NAME */ +case 25: + /*! Production:: import_path : STRING_LIT */ +case 61: + /*! Production:: regex_list : regex_concat */ +case 66: + /*! Production:: nonempty_regex_list : regex_concat */ +case 68: + /*! Production:: regex_concat : regex_base */ +case 93: + /*! Production:: escape_char : ESCAPE_CHAR */ +case 94: + /*! Production:: range_regex : RANGE_REGEX */ +case 106: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ +case 110: + /*! Production:: module_code_chunk : CODE */ +case 113: + /*! Production:: optional_module_code_chunk : module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + +case 26: + /*! Production:: names_inclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; + break; + +case 27: + /*! Production:: names_inclusive : names_inclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; + break; + +case 28: + /*! Production:: names_exclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; + break; + +case 29: + /*! Production:: names_exclusive : names_exclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; + break; + +case 30: + /*! Production:: rules : rules rules_collective */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); + break; + +case 31: + /*! Production:: rules : %epsilon */ +case 37: + /*! Production:: rule_block : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = []; + break; + +case 32: + /*! Production:: rules_collective : start_conditions rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 1]) { + yyvstack[yysp].unshift(yyvstack[yysp - 1]); + } + this.$ = [yyvstack[yysp]]; + break; + +case 33: + /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 3]) { + yyvstack[yysp - 1].forEach(function (d) { + d.unshift(yyvstack[yysp - 3]); + }); + } + this.$ = yyvstack[yysp - 1]; + break; + +case 34: + /*! Production:: rules_collective : start_conditions "{" error "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you made a mistake while specifying one of the lexer rules inside + the start condition + <${yyvstack[yysp - 3].join(',')}> { rules... } + block. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 35: + /*! Production:: rules_collective : start_conditions "{" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lexer rules set inside + the start condition + <${yyvstack[yysp - 2].join(',')}> { rules... } + as a terminating curly brace '}' could not be found. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 36: + /*! Production:: rule_block : rule_block rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); + break; + +case 39: + /*! Production:: rule : regex error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + yyparser.yyError(rmCommonWS` + Lexer rule regex action code declaration error? + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 40: + /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + `); + break; + +case 41: + /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + `); + break; + +case 42: + /*! Production:: action : ACTION_START action_body ACTION_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var s = yyvstack[yysp - 1].trim(); + // remove outermost set of braces UNLESS there's + // a curly brace in there anywhere: in that case + // we should leave it up to the sophisticated + // code analyzer to simplify the code! + // + // This is a very rough check as it will also look + // inside code comments, which should not have + // any influence. + // + // Nevertheless: this is a *safe* transform! + if (s[0] === '{' && s.indexOf('}') === s.length - 1) { + this.$ = s.substring(1, s.length - 1).trim(); + } else { + this.$ = s; + } + break; + +case 43: + /*! Production:: action_body : action_body ACTION */ +case 48: + /*! Production:: action_body : action_body include_macro_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; + break; + +case 44: + /*! Production:: action_body : action_body ACTION_BODY */ +case 45: + /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ +case 46: + /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ +case 47: + /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ +case 67: + /*! Production:: regex_concat : regex_concat regex_base */ +case 79: + /*! Production:: regex_base : regex_base range_regex */ +case 89: + /*! Production:: regex_set : regex_set regex_set_atom */ +case 111: + /*! Production:: module_code_chunk : module_code_chunk CODE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 49: + /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + You may place the '%include' instruction only at the start/front of a line. + + It's use is not permitted at this position: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + `); + break; + +case 50: + /*! Production:: action_body : action_body error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 51: + /*! Production:: action_body : %epsilon */ +case 62: + /*! Production:: regex_list : %epsilon */ +case 114: + /*! Production:: optional_module_code_chunk : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ''; + break; + +case 52: + /*! Production:: start_conditions : "<" name_list ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + break; + +case 53: + /*! Production:: start_conditions : "<" name_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly terminate the start condition set <${yyvstack[yysp - 1].join(',')},???> with a terminating '>' + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 54: + /*! Production:: start_conditions : "<" "*" ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ['*']; + break; + +case 55: + /*! Production:: start_conditions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + +case 56: + /*! Production:: name_list : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp]]; + break; + +case 57: + /*! Production:: name_list : name_list "," NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); + break; + +case 58: + /*! Production:: regex : nonempty_regex_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Detect if the regex ends with a pure (Unicode) word; + // we *do* consider escaped characters which are 'alphanumeric' + // to be equivalent to their non-escaped version, hence these are + // all valid 'words' for the 'easy keyword rules' option: + // + // - hello_kitty + // - γεια_σου_γατοÏλα + // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 + // + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // + // As we only check the *tail*, we also accept these as + // 'easy keywords': + // + // - %options + // - %foo-bar + // - +++a:b:c1 + // + // Note the dash in that last example: there the code will consider + // `bar` to be the keyword, which is fine with us as we're only + // interested in the trailing boundary and patching that one for + // the `easy_keyword_rules` option. + this.$ = yyvstack[yysp]; + if (yy.options.easy_keyword_rules) { + // We need to 'protect' `eval` here as keywords are allowed + // to contain double-quotes and other leading cruft. + // `eval` *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `eval(str)` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. + this.$ = this.$ + .replace(/\\\\/g, '.') + .replace(/"/g, '.') + .replace(/\\c[A-Z]/g, '.') + .replace(/\\[^xu0-9]/g, '.'); + + try { + // Convert Unicode escapes and other escapes to their literal characters + // BEFORE we go and check whether this item is subject to the + // `easy_keyword_rules` option. + this.$ = JSON.parse('"' + this.$ + '"'); + } + catch (ex) { + yyparser.warn('easy-keyword-rule FAIL on eval: ', ex); + + // make the next keyword test fail: + this.$ = '.'; + } + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: + var re = new XRegExp('\\w[\\w\\d]*$'); + if (XRegExp.match(this.$, re)) { + this.$ = yyvstack[yysp] + "\\b"; + } else { + this.$ = yyvstack[yysp]; + } + } + break; + +case 59: + /*! Production:: regex_list : regex_list "|" regex_concat */ +case 63: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; + break; + +case 60: + /*! Production:: regex_list : regex_list "|" */ +case 64: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '|'; + break; + +case 65: + /*! Production:: nonempty_regex_list : "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '|' + yyvstack[yysp]; + break; + +case 69: + /*! Production:: regex_base : "(" regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(' + yyvstack[yysp - 1] + ')'; + break; + +case 70: + /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; + break; + +case 71: + /*! Production:: regex_base : "(" regex_list error */ +case 72: + /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lex rule regex part in '(...)' braces. + + Unterminated regex part: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 73: + /*! Production:: regex_base : regex_base "+" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '+'; + break; + +case 74: + /*! Production:: regex_base : regex_base "*" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '*'; + break; + +case 75: + /*! Production:: regex_base : regex_base "?" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '?'; + break; + +case 76: + /*! Production:: regex_base : "/" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?=' + yyvstack[yysp] + ')'; + break; + +case 77: + /*! Production:: regex_base : "/!" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?!' + yyvstack[yysp] + ')'; + break; + +case 78: + /*! Production:: regex_base : name_expansion */ +case 80: + /*! Production:: regex_base : any_group_regex */ +case 84: + /*! Production:: regex_base : string */ +case 85: + /*! Production:: regex_base : escape_char */ +case 86: + /*! Production:: name_expansion : NAME_BRACE */ +case 90: + /*! Production:: regex_set : regex_set_atom */ +case 91: + /*! Production:: regex_set_atom : REGEX_SET */ +case 96: + /*! Production:: string : CHARACTER_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + +case 81: + /*! Production:: regex_base : "." */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '.'; + break; + +case 82: + /*! Production:: regex_base : "^" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '^'; + break; + +case 83: + /*! Production:: regex_base : "$" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '$'; + break; + +case 87: + /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ +case 107: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 88: + /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. + + Unterminated regex set: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 92: + /*! Production:: regex_set_atom : name_expansion */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) + && yyvstack[yysp].toUpperCase() !== yyvstack[yysp] + ) { + // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories + this.$ = yyvstack[yysp]; + } else { + this.$ = yyvstack[yysp]; + } + //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + break; + +case 95: + /*! Production:: string : STRING_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = prepareString(yyvstack[yysp]); + break; + +case 97: + /*! Production:: options : OPTIONS option_list OPTIONS_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 98: + /*! Production:: option_list : option option_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 100: + /*! Production:: option : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp]] = true; + break; + +case 101: + /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; + break; + +case 102: + /*! Production:: option : NAME "=" OPTION_VALUE */ +case 103: + /*! Production:: option : NAME "=" NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); + break; + +case 104: + /*! Production:: option : NAME "=" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS` + Internal error: option "${$option}" value assignment failure. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 105: + /*! Production:: option : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS` + Expected a valid option name (with optional value assignment). + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 108: + /*! Production:: include_macro_code : INCLUDE PATH */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); + // And no, we don't support nested '%include': + this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; + break; + +case 109: + /*! Production:: include_macro_code : INCLUDE error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + %include MUST be followed by a valid file path. + + Erroneous path: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 112: + /*! Production:: module_code_chunk : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS` + Module code declaration error? + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! + // error recovery reduction action (action generated by jison, + // using the user-specified `%code error_recovery_reduction` %{...%} + // code chunk below. + + + break; + +} +}, +table: bt({ + len: u([ + 13, + 1, + 12, + 15, + 1, + 1, + 11, + 18, + 21, + 2, + 2, + s, + [11, 3], + 4, + 4, + 12, + 4, + 1, + 1, + 19, + 11, + 12, + 18, + 29, + 30, + 22, + 22, + 17, + 17, + s, + [29, 7], + 31, + 5, + s, + [29, 3], + s, + [12, 4], + 4, + 11, + 3, + 3, + 2, + 2, + 1, + 1, + 12, + 1, + 5, + 4, + 3, + 7, + 17, + 23, + 3, + 30, + 29, + 30, + s, + [29, 5], + 3, + 20, + 3, + 30, + 30, + 6, + s, + [4, 3], + 12, + 12, + s, + [11, 6], + s, + [27, 3], + s, + [11, 8], + 2, + 11, + 1, + 4, + 3, + 2, + s, + [3, 3], + 17, + 16, + 3, + 3, + 1, + 3, + s, + [29, 3], + 21, + s, + [29, 4], + 4, + 13, + 13, + s, + [3, 4], + 6, + 3, + 23, + s, + [18, 3], + 14, + 14, + 1, + 14, + 20, + 2, + 17, + 14, + 17, + 3 +]), + symbol: u([ + 1, + 2, + s, + [19, 7, 1], + 28, + 47, + 54, + 56, + 1, + c, + [14, 11], + 57, + c, + [12, 11], + 55, + 58, + 68, + 84, + s, + [1, 3], + c, + [17, 10], + 1, + 3, + 5, + 9, + 10, + s, + [14, 4, 1], + 19, + 26, + s, + [38, 4, 1], + 44, + 46, + 64, + c, + [15, 6], + c, + [14, 7], + 72, + s, + [74, 5, 1], + 81, + 83, + 27, + 62, + 27, + 63, + c, + [54, 12], + c, + [11, 21], + 2, + 20, + 26, + 60, + c, + [4, 3], + 59, + 2, + s, + [29, 9, 1], + 51, + 69, + 2, + 20, + 85, + 86, + s, + [1, 3], + c, + [102, 16], + 65, + 70, + c, + [67, 13], + 9, + c, + [12, 9], + c, + [125, 12], + c, + [123, 6], + c, + [30, 3], + c, + [59, 6], + s, + [20, 7, 1], + 28, + c, + [29, 6], + 47, + c, + [29, 7], + 7, + s, + [9, 9, 1], + c, + [33, 14], + 45, + 46, + 47, + 82, + c, + [58, 3], + 11, + c, + [80, 11], + 73, + c, + [81, 6], + c, + [22, 22], + c, + [121, 12], + c, + [17, 22], + c, + [108, 29], + c, + [29, 199], + s, + [42, 6, 1], + 40, + 43, + 77, + 79, + 80, + c, + [123, 89], + c, + [19, 7], + 27, + c, + [572, 11], + c, + [12, 27], + c, + [593, 3], + 61, + c, + [612, 14], + c, + [3, 3], + 28, + 68, + 28, + 68, + 28, + 28, + c, + [616, 11], + 88, + 48, + 2, + 20, + 48, + 85, + 86, + 2, + 18, + 20, + c, + [9, 4], + 1, + 2, + 51, + 53, + 87, + 89, + 90, + c, + [630, 17], + 3, + c, + [732, 13], + 67, + c, + [733, 8], + 7, + 20, + 71, + c, + [613, 24], + c, + [643, 65], + c, + [507, 145], + 2, + 9, + 11, + c, + [769, 15], + c, + [789, 7], + 11, + c, + [201, 59], + 82, + 2, + 40, + 42, + 43, + 77, + 80, + c, + [6, 4], + c, + [4, 8], + c, + [476, 33], + c, + [11, 59], + 3, + 4, + c, + [473, 8], + c, + [401, 15], + c, + [27, 54], + c, + [584, 11], + c, + [11, 78], + 52, + c, + [182, 11], + c, + [664, 3], + 49, + 50, + 1, + 51, + 88, + 1, + 51, + 1, + 51, + 53, + c, + [3, 7], + c, + [672, 16], + 2, + 4, + c, + [673, 13], + 66, + 2, + 28, + 68, + 2, + 6, + 8, + 6, + c, + [4, 3], + c, + [642, 58], + c, + [525, 31], + c, + [522, 13], + c, + [750, 8], + c, + [662, 115], + c, + [562, 5], + c, + [315, 10], + 53, + c, + [13, 13], + c, + [979, 3], + c, + [3, 9], + c, + [988, 4], + c, + [987, 3], + 51, + 53, + c, + [300, 14], + c, + [973, 9], + 1, + c, + [487, 10], + c, + [27, 7], + c, + [18, 36], + c, + [1050, 14], + c, + [14, 14], + 20, + c, + [15, 14], + c, + [830, 20], + c, + [469, 3], + c, + [460, 16], + c, + [159, 14], + c, + [491, 18], + 6, + 8 +]), + type: u([ + s, + [2, 11], + 0, + 0, + 1, + c, + [14, 12], + c, + [26, 13], + 0, + c, + [15, 12], + s, + [2, 19], + c, + [31, 14], + s, + [0, 8], + c, + [23, 3], + c, + [56, 31], + c, + [62, 10], + c, + [112, 13], + c, + [67, 4], + c, + [40, 20], + c, + [78, 36], + c, + [123, 7], + c, + [30, 28], + c, + [203, 43], + c, + [205, 9], + c, + [22, 34], + c, + [17, 34], + s, + [2, 224], + c, + [239, 141], + c, + [139, 19], + c, + [655, 16], + c, + [14, 5], + c, + [180, 13], + c, + [194, 34], + s, + [0, 9], + c, + [98, 21], + c, + [643, 86], + c, + [492, 151], + c, + [494, 34], + c, + [231, 35], + c, + [802, 238], + c, + [716, 74], + c, + [44, 28], + c, + [708, 37], + c, + [522, 78], + c, + [454, 163], + c, + [164, 19], + c, + [973, 11], + c, + [830, 147], + s, + [2, 21] +]), + state: u([ + s, + [1, 4, 1], + 6, + 11, + 12, + 20, + 21, + 22, + 24, + 25, + 30, + 31, + 36, + 35, + 42, + 44, + 46, + 50, + 54, + 55, + 56, + 60, + 61, + 64, + c, + [15, 5], + 65, + c, + [5, 4], + 69, + 71, + 72, + c, + [13, 5], + 73, + c, + [7, 6], + 74, + c, + [5, 4], + 75, + c, + [5, 4], + 79, + 76, + 77, + 82, + 86, + 87, + 96, + 101, + 56, + 103, + 105, + 104, + 108, + 110, + c, + [66, 7], + 111, + 114, + c, + [58, 11], + c, + [6, 6], + 69, + 79, + 122, + 129, + 131, + 133, + c, + [12, 5], + 139, + c, + [29, 5], + 105, + 140, + 142, + c, + [47, 8], + c, + [22, 5] +]), + mode: u([ + s, + [2, 23], + s, + [1, 12], + s, + [2, 28], + s, + [1, 15], + s, + [2, 33], + c, + [39, 17], + c, + [13, 6], + c, + [18, 7], + c, + [64, 21], + c, + [21, 10], + c, + [106, 15], + c, + [75, 12], + 1, + c, + [90, 10], + c, + [27, 6], + c, + [72, 23], + c, + [40, 8], + c, + [45, 7], + c, + [15, 13], + s, + [1, 24], + s, + [2, 234], + c, + [236, 98], + c, + [97, 24], + c, + [24, 15], + c, + [374, 20], + c, + [432, 5], + c, + [409, 15], + c, + [568, 9], + c, + [47, 20], + c, + [454, 17], + c, + [561, 23], + c, + [585, 53], + c, + [442, 145], + c, + [718, 19], + c, + [780, 33], + c, + [29, 25], + c, + [759, 238], + c, + [796, 51], + c, + [289, 5], + c, + [1211, 12], + c, + [722, 35], + c, + [340, 9], + c, + [648, 24], + c, + [854, 59], + c, + [1199, 170], + c, + [311, 6], + c, + [969, 23], + c, + [1128, 90], + c, + [291, 66] +]), + goto: u([ + s, + [6, 11], + s, + [8, 11], + 5, + 5, + s, + [7, 4, 1], + s, + [13, 7, 1], + s, + [7, 11], + s, + [31, 17], + 23, + 26, + 28, + 32, + 33, + 34, + 39, + 27, + 29, + 37, + 38, + 41, + 40, + 43, + 45, + s, + [12, 11], + s, + [13, 11], + s, + [14, 11], + 47, + 48, + 49, + 51, + 52, + 53, + s, + [51, 11], + 58, + 57, + 1, + 2, + 4, + 55, + 62, + s, + [55, 6], + 59, + s, + [55, 7], + s, + [9, 11], + 58, + 58, + 63, + s, + [58, 9], + c, + [108, 12], + s, + [66, 3], + c, + [15, 5], + s, + [66, 7], + 39, + 66, + c, + [23, 7], + 68, + 68, + 67, + s, + [68, 3], + c, + [7, 3], + s, + [68, 17], + 70, + 68, + 68, + 62, + 62, + 26, + 62, + c, + [68, 11], + c, + [15, 15], + c, + [95, 12], + c, + [12, 12], + s, + [78, 29], + s, + [80, 29], + s, + [81, 29], + s, + [82, 29], + s, + [83, 29], + s, + [84, 29], + s, + [85, 29], + s, + [86, 31], + 37, + 78, + s, + [95, 29], + s, + [96, 29], + s, + [93, 29], + s, + [10, 9], + 80, + 10, + 10, + s, + [26, 12], + s, + [11, 9], + 81, + 11, + 11, + s, + [28, 12], + 83, + 84, + 85, + s, + [17, 11], + s, + [22, 3], + s, + [23, 3], + 16, + 16, + 20, + 21, + 98, + s, + [88, 8, 1], + 97, + 99, + 100, + 58, + 57, + 99, + 100, + 102, + 100, + 100, + s, + [105, 3], + 114, + 107, + 114, + 106, + s, + [30, 17], + 109, + c, + [667, 13], + 112, + 113, + s, + [64, 3], + c, + [17, 5], + s, + [64, 7], + 39, + 64, + c, + [25, 6], + 64, + s, + [65, 3], + c, + [24, 5], + s, + [65, 7], + 39, + 65, + c, + [24, 6], + 65, + s, + [67, 6], + 66, + 68, + s, + [67, 18], + 70, + 67, + 67, + s, + [73, 29], + s, + [74, 29], + s, + [75, 29], + s, + [79, 29], + s, + [94, 29], + 116, + 117, + 115, + 61, + 61, + 26, + 61, + c, + [242, 11], + 119, + 117, + 118, + 76, + 76, + 67, + s, + [76, 3], + 66, + 68, + s, + [76, 18], + 70, + 76, + 76, + 77, + 77, + 67, + s, + [77, 3], + 66, + 68, + s, + [77, 18], + 70, + 77, + 77, + 121, + 37, + 120, + 78, + s, + [90, 4], + s, + [91, 4], + s, + [92, 4], + s, + [27, 12], + s, + [29, 12], + s, + [15, 11], + s, + [16, 11], + s, + [24, 11], + s, + [25, 11], + s, + [18, 11], + s, + [19, 11], + s, + [40, 27], + s, + [41, 27], + s, + [42, 27], + s, + [43, 11], + s, + [44, 11], + s, + [45, 11], + s, + [46, 11], + s, + [47, 11], + s, + [48, 11], + s, + [49, 11], + s, + [50, 11], + 124, + 123, + s, + [97, 11], + 98, + 128, + 127, + 125, + 126, + 3, + 99, + 106, + 106, + 113, + 113, + 130, + s, + [110, 3], + s, + [112, 3], + s, + [32, 17], + 132, + s, + [37, 14], + 134, + 16, + 136, + 135, + 137, + 138, + s, + [56, 3], + s, + [63, 3], + c, + [624, 5], + s, + [63, 7], + 39, + 63, + c, + [431, 6], + 63, + s, + [69, 29], + s, + [71, 29], + 60, + 60, + 26, + 60, + c, + [505, 11], + s, + [70, 29], + s, + [72, 29], + s, + [87, 29], + s, + [88, 29], + s, + [89, 4], + s, + [108, 13], + s, + [109, 13], + s, + [101, 3], + s, + [102, 3], + s, + [103, 3], + s, + [104, 3], + c, + [940, 4], + s, + [111, 3], + 141, + c, + [926, 13], + 35, + 35, + 143, + s, + [35, 15], + s, + [38, 18], + s, + [39, 18], + s, + [52, 14], + s, + [53, 14], + 144, + s, + [54, 14], + 59, + 59, + 26, + 59, + c, + [112, 11], + 107, + 107, + s, + [33, 17], + s, + [36, 14], + s, + [34, 17], + s, + [57, 3] +]) +}), +defaultActions: bda({ + idx: u([ + 0, + 2, + 6, + 7, + 11, + 12, + 13, + 16, + 18, + 19, + 21, + s, + [30, 8, 1], + 39, + 40, + s, + [41, 4, 2], + 48, + 49, + 52, + 53, + 58, + 60, + s, + [66, 5, 1], + s, + [77, 22, 1], + 100, + 101, + 104, + 106, + 107, + 108, + 113, + 115, + 116, + s, + [118, 11, 1], + 130, + s, + [133, 4, 1], + 138, + s, + [140, 5, 1] +]), + goto: u([ + 6, + 8, + 7, + 31, + 12, + 13, + 14, + 51, + 1, + 2, + 9, + 78, + s, + [80, 7, 1], + 95, + 96, + 93, + 26, + 28, + 17, + 22, + 23, + 20, + 21, + 105, + 30, + 73, + 74, + 75, + 79, + 94, + 90, + 91, + 92, + 27, + 29, + 15, + 16, + 24, + 25, + 18, + 19, + s, + [40, 11, 1], + 97, + 98, + 106, + 110, + 112, + 32, + 56, + 69, + 71, + 70, + 72, + 87, + 88, + 89, + 108, + 109, + s, + [101, 4, 1], + 111, + 38, + 39, + 52, + 53, + 54, + 107, + 33, + 36, + 34, + 57 +]) +}), +parseError: function parseError(str, hash, ExceptionClass) { + if (hash.recoverable && typeof this.trace === 'function') { + this.trace(str); + hash.destroy(); // destroy... well, *almost*! + } else { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + throw new ExceptionClass(str, hash); + } +}, +parse: function parse(input) { + var self = this; + var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage) + var sstack = new Array(128); // state stack: stores states (column storage) + + var vstack = new Array(128); // semantic value stack + var lstack = new Array(128); // location stack + var table = this.table; + var sp = 0; // 'stack pointer': index into the stacks + var yyloc; + + var symbol = 0; + var preErrorSymbol = 0; + var lastEofErrorStateDepth = 0; + var recoveringErrorInfo = null; + var recovering = 0; // (only used when the grammar contains error recovery rules) + var TERROR = this.TERROR; + var EOF = this.EOF; + var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; + var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + + var lexer; + if (this.__lexer__) { + lexer = this.__lexer__; + } else { + lexer = this.__lexer__ = Object.create(this.lexer); + } + + var sharedState_yy = { + parseError: undefined, + quoteName: undefined, + lexer: undefined, + parser: undefined, + pre_parse: undefined, + post_parse: undefined, + pre_lex: undefined, + post_lex: undefined + }; + + if (typeof assert !== 'function') { + assert = function JisonAssert(cond, msg) { + if (!cond) { + throw new Error('assertion failed: ' + (msg || '***')); + } + }; + } + + this.yyGetSharedState = function yyGetSharedState() { + return sharedState_yy; + }; + + + this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() { + return recoveringErrorInfo; + }; + + + // shallow clone objects, straight copy of simple `src` values + // e.g. `lexer.yytext` MAY be a complex value object, + // rather than a simple string/value. + function shallow_copy(src) { + if (typeof src === 'object') { + var dst = {}; + for (var k in src) { + if (Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + return dst; + } + return src; + } + function shallow_copy_noclobber(dst, src) { + for (var k in src) { + if (typeof dst[k] === 'undefined' && Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + } + function copy_yylloc(loc) { + var rv = shallow_copy(loc); + if (rv && rv.range) { + rv.range = rv.range.slice(0); + } + return rv; + } + + // copy state + shallow_copy_noclobber(sharedState_yy, this.yy); + + sharedState_yy.lexer = lexer; + sharedState_yy.parser = this; + + + + + + // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount + // to have *their* closure match ours -- if we only set them up once, + // any subsequent `parse()` runs will fail in very obscure ways when + // these functions are invoked in the user action code block(s) as + // their closure will still refer to the `parse()` instance which set + // them up. Hence we MUST set them up at the start of every `parse()` run! + if (this.yyError) { + this.yyError = function yyError(str /*, ...args */) { + + + + + + + + + + + + var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1); + var expected = this.collect_expected_token_set(state); + var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0)); + // append to the old one? + if (recoveringErrorInfo) { + var esp = recoveringErrorInfo.info_stack_pointer; + + recoveringErrorInfo.symbol_stack[esp] = symbol; + var v = this.shallowCopyErrorInfo(hash); + v.yyError = true; + v.errorRuleDepth = error_rule_depth; + v.recovering = recovering; + // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH; + + recoveringErrorInfo.value_stack[esp] = v; + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + } else { + recoveringErrorInfo = this.shallowCopyErrorInfo(hash); + recoveringErrorInfo.yyError = true; + recoveringErrorInfo.errorRuleDepth = error_rule_depth; + recoveringErrorInfo.recovering = recovering; + } + + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + if (args.length) { + hash.extra_error_attributes = args; + } + + var r = this.parseError(str, hash, this.JisonParserError); + return r; + }; + } + + + + + + + + // Does the shared state override the default `parseError` that already comes with this instance? + if (typeof sharedState_yy.parseError === 'function') { + this.parseError = function parseErrorAlt(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + return sharedState_yy.parseError.call(this, str, hash, ExceptionClass); + }; + } else { + this.parseError = this.originalParseError; + } + + // Does the shared state override the default `quoteName` that already comes with this instance? + if (typeof sharedState_yy.quoteName === 'function') { + this.quoteName = function quoteNameAlt(id_str) { + return sharedState_yy.quoteName.call(this, id_str); + }; + } else { + this.quoteName = this.originalQuoteName; + } + + // set up the cleanup function; make it an API so that external code can re-use this one in case of + // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which + // case this parse() API method doesn't come with a `finally { ... }` block any more! + // + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `sharedState`, etc. references will be *wrong*! + this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) { + var rv; + + if (invoke_post_methods) { + var hash; + + if (sharedState_yy.post_parse || this.post_parse) { + // create an error hash info instance: we re-use this API in a **non-error situation** + // as this one delivers all parser internals ready for access by userland code. + hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false); + } + + if (sharedState_yy.post_parse) { + rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + if (this.post_parse) { + rv = this.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + + // cleanup: + if (hash && hash.destroy) { + hash.destroy(); + } + } + + if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. + + // clean up the lingering lexer structures as well: + if (lexer.cleanupAfterLex) { + lexer.cleanupAfterLex(do_not_nuke_errorinfos); + } + + // prevent lingering circular references from causing memory leaks: + if (sharedState_yy) { + sharedState_yy.lexer = undefined; + sharedState_yy.parser = undefined; + if (lexer.yy === sharedState_yy) { + lexer.yy = undefined; + } + } + sharedState_yy = undefined; + this.parseError = this.originalParseError; + this.quoteName = this.originalQuoteName; + + // nuke the vstack[] array at least as that one will still reference obsoleted user values. + // To be safe, we nuke the other internal stack columns as well... + stack.length = 0; // fastest way to nuke an array without overly bothering the GC + sstack.length = 0; + lstack.length = 0; + vstack.length = 0; + sp = 0; + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_infos.length = 0; + + + for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) { + var el = this.__error_recovery_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_recovery_infos.length = 0; + + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + recoveringErrorInfo = undefined; + } + + + } + + return resultValue; + }; + + // merge yylloc info into a new yylloc instance. + // + // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array. + // + // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which + // case these override the corresponding first/last indexes. + // + // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search + // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!) + // yylloc info. + // + // Note: epsilon rule's yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL. + this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) { + var i1 = first_index | 0, + i2 = last_index | 0; + var l1 = first_yylloc, + l2 = last_yylloc; + var rv; + + // rules: + // - first/last yylloc entries override first/last indexes + + if (!l1) { + if (first_index != null) { + for (var i = i1; i <= i2; i++) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + } + + if (!l2) { + if (last_index != null) { + for (var i = i2; i >= i1; i--) { + l2 = lstack[i]; + if (l2) { + break; + } + } + } + } + + // - detect if an epsilon rule is being processed and act accordingly: + if (!l1 && first_index == null) { + // epsilon rule span merger. With optional look-ahead in l2. + if (!dont_look_back) { + for (var i = (i1 || sp) - 1; i >= 0; i--) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + if (!l1) { + if (!l2) { + // when we still don't have any valid yylloc info, we're looking at an epsilon rule + // without look-ahead and no preceding terms and/or `dont_look_back` set: + // in that case we ca do nothing but return NULL/UNDEFINED: + return undefined; + } else { + // shallow-copy L2: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l2); + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + return rv; + } + } else { + // shallow-copy L1, then adjust first col/row 1 column past the end. + rv = shallow_copy(l1); + rv.first_line = rv.last_line; + rv.first_column = rv.last_column; + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + rv.range[0] = rv.range[1]; + } + + if (l2) { + // shallow-mixin L2, then adjust last col/row accordingly. + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + return rv; + } + } + + if (!l1) { + l1 = l2; + l2 = null; + } + if (!l1) { + return undefined; + } + + // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l1); + + // first_line: ..., + // first_column: ..., + // last_line: ..., + // last_column: ..., + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + + if (l2) { + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + + return rv; + }; + + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `lexer`, `sharedState`, etc. references will be *wrong*! + this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { + var pei = { + errStr: msg, + exception: ex, + text: lexer.match, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, + token_id: symbol, + line: lexer.yylineno, + loc: copy_yylloc(lexer.yylloc), + expected: expected, + recoverable: recoverable, + state: state, + action: action, + new_state: newState, + symbol_stack: stack, + state_stack: sstack, + value_stack: vstack, + location_stack: lstack, + stack_pointer: sp, + yy: sharedState_yy, + lexer: lexer, + parser: this, + + // and make sure the error info doesn't stay due to potential + // ref cycle via userland code manipulations. + // These would otherwise all be memory leak opportunities! + // + // Note that only array and object references are nuked as those + // constitute the set of elements which can produce a cyclic ref. + // The rest of the members is kept intact as they are harmless. + destroy: function destructParseErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // info.value = null; + // info.value_stack = null; + // ... + var rec = !!this.recoverable; + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; + } + } + this.recoverable = rec; + } + }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + return pei; + }; + + // clone some parts of the (possibly enhanced!) errorInfo object + // to give them some persistence. + this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) { + var rv = shallow_copy(p); + + // remove the large parts which can only cause cyclic references + // and are otherwise available from the parser kernel anyway. + delete rv.sharedState_yy; + delete rv.parser; + delete rv.lexer; + + // lexer.yytext MAY be a complex value object, rather than a simple string/value: + rv.value = shallow_copy(rv.value); + + // yylloc info: + rv.loc = copy_yylloc(rv.loc); + + // the 'expected' set won't be modified, so no need to clone it: + //rv.expected = rv.expected.slice(0); + + //symbol stack is a simple array: + rv.symbol_stack = rv.symbol_stack.slice(0); + // ditto for state stack: + rv.state_stack = rv.state_stack.slice(0); + // clone the yylloc's in the location stack?: + rv.location_stack = rv.location_stack.map(copy_yylloc); + // and the value stack may carry both simple and complex values: + // shallow-copy the latter. + rv.value_stack = rv.value_stack.map(shallow_copy); + + // and we don't bother with the sharedState_yy reference: + //delete rv.yy; + + // now we prepare for tracking the COMBINE actions + // in the error recovery code path: + // + // as we want to keep the maximum error info context, we + // *scan* the state stack to find the first *empty* slot. + // This position will surely be AT OR ABOVE the current + // stack pointer, but we want to keep the 'used but discarded' + // part of the parse stacks *intact* as those slots carry + // error context that may be useful when you want to produce + // very detailed error diagnostic reports. + // + // ### Purpose of each stack pointer: + // + // - stack_pointer: points at the top of the parse stack + // **as it existed at the time of the error + // occurrence, i.e. at the time the stack + // snapshot was taken and copied into the + // errorInfo object.** + // - base_pointer: the bottom of the **empty part** of the + // stack, i.e. **the start of the rest of + // the stack space /above/ the existing + // parse stack. This section will be filled + // by the error recovery process as it + // travels the parse state machine to + // arrive at the resolving error recovery rule.** + // - info_stack_pointer: + // this stack pointer points to the **top of + // the error ecovery tracking stack space**, i.e. + // this stack pointer takes up the role of + // the `stack_pointer` for the error recovery + // process. Any mutations in the **parse stack** + // are **copy-appended** to this part of the + // stack space, keeping the bottom part of the + // stack (the 'snapshot' part where the parse + // state at the time of error occurrence was kept) + // intact. + // - root_failure_pointer: + // copy of the `stack_pointer`... + // + for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== 'undefined'; i++) { + // empty + } + rv.base_pointer = i; + rv.info_stack_pointer = i; + + rv.root_failure_pointer = rv.stack_pointer; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_recovery_infos.push(rv); + + return rv; + }; + + function getNonTerminalFromCode(symbol) { + var tokenName = self.getSymbolName(symbol); + if (!tokenName) { + tokenName = symbol; + } + return tokenName; + } + + + function lex() { + var token = lexer.lex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + if (typeof Jison !== 'undefined' && Jison.lexDebugger) { + var tokenName = self.getSymbolName(token || EOF); + if (!tokenName) { + tokenName = token; + } + + Jison.lexDebugger.push({ + tokenName: tokenName, + tokenText: lexer.match, + tokenValue: lexer.yytext + }); + } + + return token || EOF; + } + + + var state, action, r, t; + var yyval = { + $: true, + _$: undefined, + yy: sharedState_yy + }; + var p; + var yyrulelen; + var this_production; + var newState; + var retval = false; + + + // Return the rule stack depth where the nearest error rule can be found. + // Return -1 when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = sp - 1; + var depth = 0; + + // try to recover from error + for (;;) { + // check for error recovery rule in this state + + + + + + + + + + var t = table[state][TERROR] || NO_ACTION; + if (t[0]) { + // We need to make sure we're not cycling forever: + // once we hit EOF, even when we `yyerrok()` an error, we must + // prevent the core from running forever, + // e.g. when parent rules are still expecting certain input to + // follow after this, for example when you handle an error inside a set + // of braces which are matched by a parent rule in your grammar. + // + // Hence we require that every error handling/recovery attempt + // *after we've hit EOF* has a diminishing state stack: this means + // we will ultimately have unwound the state stack entirely and thus + // terminate the parse in a controlled fashion even when we have + // very complex error/recovery code interplay in the core + user + // action code blocks: + + + + + + + + + + if (symbol === EOF) { + if (!lastEofErrorStateDepth) { + lastEofErrorStateDepth = sp - 1 - depth; + } else if (lastEofErrorStateDepth <= sp - 1 - depth) { + + + + + + + + + + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + continue; + } + } + return depth; + } + if (state === 0 /* $accept rule */ || stack_probe < 1) { + + + + + + + + + + return -1; // No suitable error recovery rule available. + } + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + } + } + + + try { + this.__reentrant_call_depth++; + + lexer.setInput(input, sharedState_yy); + + yyloc = lexer.yylloc; + lstack[sp] = yyloc; + vstack[sp] = null; + sstack[sp] = 0; + stack[sp] = 0; + ++sp; + + + + + + if (this.pre_parse) { + this.pre_parse.call(this, sharedState_yy); + } + if (sharedState_yy.pre_parse) { + sharedState_yy.pre_parse.call(this, sharedState_yy); + } + + newState = sstack[sp - 1]; + for (;;) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // The single `==` condition below covers both these `===` comparisons in a single + // operation: + // + // if (symbol === null || typeof symbol === 'undefined') ... + if (!symbol) { + symbol = lex(); + } + // read action for current state and first input + t = (table[state] && table[state][symbol]) || NO_ACTION; + newState = t[1]; + action = t[0]; + + + + + + + + + + + + // handle parse error + if (!action) { + // first see if there's any chance at hitting an error recovery rule: + var error_rule_depth = locateNearestErrorRecoveryRule(state); + var errStr = null; + var errSymbolDescr = (this.describeSymbol(symbol) || symbol); + var expected = this.collect_expected_token_set(state); + + if (!recovering) { + // Report error + if (typeof lexer.yylineno === 'number') { + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; + } else { + errStr = 'Parse error: '; + } + + if (typeof lexer.showPosition === 'function') { + errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; + } + if (expected.length) { + errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; + } else { + errStr += 'Unexpected ' + errSymbolDescr; + } + + p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0)); + + // cleanup the old one before we start the new error info track: + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + } + recoveringErrorInfo = this.shallowCopyErrorInfo(p); + + r = this.parseError(p.errStr, p, this.JisonParserError); + + + + + + + + + + // Protect against overly blunt userland `parseError` code which *sets* + // the `recoverable` flag without properly checking first: + // we always terminate the parse when there's no recovery rule available anyhow! + if (!p.recoverable || error_rule_depth < 0) { + retval = r; + break; + } else { + // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process... + } + } + + + + + + + + + + + var esp = recoveringErrorInfo.info_stack_pointer; + + // just recovered from another error + if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { + // SHIFT current lookahead and grab another + recoveringErrorInfo.symbol_stack[esp] = symbol; + recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState; // push state + ++esp; + + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + + yyloc = lexer.yylloc; + + preErrorSymbol = 0; + symbol = lex(); + + + + + + + + + + } + + // try to recover from error + if (error_rule_depth < 0) { + assert(recovering > 0); + recoveringErrorInfo.info_stack_pointer = esp; + + // barf a fatal hairball when we're out of look-ahead symbols and none hit a match + // while we are still busy recovering from another error: + var po = this.__error_infos[this.__error_infos.length - 1]; + if (!po) { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error.', null, expected, false); + } else { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error. Previous error which resulted in this fatal result: ' + po.errStr, null, expected, false); + p.extra_error_attributes = po; + } + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + + preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + + const EXTRA_STACK_SAMPLE_DEPTH = 3; + + // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token: + recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol; + if (errStr) { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + errorStr: errStr, + errorSymbolDescr: errSymbolDescr, + expectedStr: expected, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + + + + + + + + + + } else { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + } + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + yyval.$ = recoveringErrorInfo; + yyval._$ = undefined; + + yyrulelen = error_rule_depth; + + + + + + + + + + r = this.performAction.call(yyval, yyloc, NO_ACTION[1], sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // and move the top entries + discarded part of the parse stacks onto the error info stack: + for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) { + recoveringErrorInfo.symbol_stack[esp] = stack[idx]; + recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]); + recoveringErrorInfo.state_stack[esp] = sstack[idx]; + } + + recoveringErrorInfo.symbol_stack[esp] = TERROR; + recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$); + + // goto new state = table[STATE][NONTERMINAL] + newState = sstack[sp - 1]; + + if (this.defaultActions[newState]) { + recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState]; + } else { + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + recoveringErrorInfo.state_stack[esp] = t[1]; + } + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + // allow N (default: 3) real symbols to be shifted before reporting a new error + recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; + + + + + + + + + + + // Now duplicate the standard parse machine here, at least its initial + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // as we wish to push something special then! + + + // Run the state machine in this copy of the parser state machine + // until we *either* consume the error symbol (and its related information) + // *or* we run into another error while recovering from this one + // *or* we execute a `reduce` action which outputs a final parse + // result (yes, that MAY happen!)... + + assert(recoveringErrorInfo); + assert(symbol === TERROR); + while (symbol) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // read action for current state and first input + t = (table[state] && table[state][symbol]) || NO_ACTION; + newState = t[1]; + action = t[0]; + + + + + + + + + + + // encountered another parse error? If so, break out to main loop + // and take it from there! + if (!action) { + newState = state; + break; + } + } + + + + + + + + + + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + + // shift: + case 1: + stack[sp] = symbol; + //vstack[sp] = lexer.yytext; + assert(recoveringErrorInfo); + vstack[sp] = recoveringErrorInfo; + //lstack[sp] = copy_yylloc(lexer.yylloc); + lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); + sstack[sp] = newState; // push state + ++sp; + symbol = 0; + if (!preErrorSymbol) { // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + + + + + + + + + + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + + + + + + + + + // read action for current state and first input + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + + + + + + + + symbol = 0; + } + } + + // once we have pushed the special ERROR token value, we're done in this inner loop! + break; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + + + + + + + + + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + // signal end of error recovery loop AND end of outer parse loop + action = 3; + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + + + + + + + + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + break; + } + + // break out of loop: we accept or fail with error + break; + } + + // should we also break out of the regular/outer parse loop, + // i.e. did the parser already produce a parse result in here?! + if (action === 3) { + break; + } + continue; + } + + + } + + + + + + + + + + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + + // shift: + case 1: + stack[sp] = symbol; + vstack[sp] = lexer.yytext; + lstack[sp] = copy_yylloc(lexer.yylloc); + sstack[sp] = newState; // push state + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + var tokenName = self.getSymbolName(symbol || EOF); + if (!tokenName) { + tokenName = symbol; + } + + Jison.parserDebugger.push({ + action: 'shift', + text: lexer.yytext, + terminal: tokenName, + terminal_id: symbol + }); + } + + ++sp; + symbol = 0; + assert(preErrorSymbol === 0); + if (!preErrorSymbol) { // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + + + + + + + + + + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + + + + + + + + + // read action for current state and first input + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + + + + + + + + symbol = 0; + } + } + + continue; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + + + + + + + + + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { + var prereduceValue = vstack.slice(sp - yyrulelen, sp); + var debuggableProductions = []; + for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { + var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); + debuggableProductions.push(debuggableProduction); + } + // find the current nonterminal name (- nolan) + var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; + var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); + + Jison.parserDebugger.push({ + action: 'reduce', + nonterminal: currentNonterminal, + nonterminal_id: currentNonterminalCode, + prereduce: prereduceValue, + result: r, + productions: debuggableProductions, + text: yyval.$ + }); + } + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + + + + + + + + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'accept', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + + break; + } + + // break out of loop: we accept or fail with error + break; + } + } catch (ex) { + // report exceptions through the parseError callback too, but keep the exception intact + // if it is a known parser or lexer error which has been thrown by parseError() already: + if (ex instanceof this.JisonParserError) { + throw ex; + } + else if (lexer && typeof lexer.JisonLexerError === 'function' && ex instanceof lexer.JisonLexerError) { + throw ex; + } + else { + p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + } + } finally { + retval = this.cleanupAfterParse(retval, true, true); + this.__reentrant_call_depth--; + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'return', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + } // /finally + + return retval; +}, +yyError: 1 +}; +parser.originalParseError = parser.parseError; +parser.originalQuoteName = parser.quoteName; + +var rmCommonWS = helpers.rmCommonWS; + +function encodeRE(s) { + return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); +} + +function prepareString(s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; +} + +// convert string value to number or boolean value, when possible +// (and when this is more or less obviously the intent) +// otherwise produce the string itself as value. +function parseValue(v) { + if (v === 'false') { + return false; + } + if (v === 'true') { + return true; + } + // http://stackoverflow.com/questions/175739/is-there-a-built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number + // Note that the `v` check ensures that we do not convert `undefined`, `null` and `''` (empty string!) + if (v && !isNaN(v)) { + var rv = +v; + if (isFinite(rv)) { + return rv; + } + } + return v; +} + + +parser.warn = function p_warn() { + console.warn.apply(console, arguments); +}; + +parser.log = function p_log() { + console.log.apply(console, arguments); +}; + +parser.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse:', arguments); +}; + +parser.yy.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse YY:', arguments); +}; + +parser.yy.post_lex = function p_lex() { + if (parser.yydebug) parser.log('post_lex:', arguments); +}; +/* lexer generated by jison-lex 0.6.0-194*/ + +/* + * Returns a Lexer object of the following structure: + * + * Lexer: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a direct reference! + * + * This "shared context" object was passed to the lexer by way of + * the `lexer.setInput(str, yy)` API before you may use it. + * + * This "shared context" object is passed to the lexer action code in `performAction()` + * so userland code in the lexer actions may communicate with the outside world + * and/or other lexer rules' actions in more or less complex ways. + * + * } + * + * Lexer.prototype: { + * EOF: 1, + * ERROR: 2, + * + * yy: The overall "shared context" object reference. + * + * JisonLexerError: function(msg, hash), + * + * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `lexer` instance. + * `yy_` is an alias for `this` lexer instance reference used internally. + * + * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer + * by way of the `lexer.setInput(str, yy)` API before. + * + * Note: + * The extra arguments you specified in the `%parse-param` statement in your + * **parser** grammar definition file are passed to the lexer via this object + * reference as member variables. + * + * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. + * + * - `YY_START`: the current lexer "start condition" state. + * + * parseError: function(str, hash, ExceptionClass), + * + * constructLexErrorInfo: function(error_message, is_recoverable), + * Helper function. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this lexer kernel in many places; example usage: + * + * var infoObj = lexer.constructParseErrorInfo('fail!', true); + * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); + * + * options: { ... lexer %options ... }, + * + * lex: function(), + * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. + * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the **parser** or the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * cleanupAfterLex: function(do_not_nuke_errorinfos), + * Helper function. + * + * This helper API is invoked when the **parse process** has completed: it is the responsibility + * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. + * + * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. + * + * setInput: function(input, [yy]), + * + * + * input: function(), + * + * + * unput: function(str), + * + * + * more: function(), + * + * + * reject: function(), + * + * + * less: function(n), + * + * + * pastInput: function(n), + * + * + * upcomingInput: function(n), + * + * + * showPosition: function(), + * + * + * test_match: function(regex_match_array, rule_index), + * + * + * next: function(), + * + * + * begin: function(condition), + * + * + * pushState: function(condition), + * + * + * popState: function(), + * + * + * topState: function(), + * + * + * _currentRules: function(), + * + * + * stateStackSize: function(), + * + * + * performAction: function(yy, yy_, yyrulenumber, YY_START), + * + * + * rules: [...], + * + * + * conditions: {associative list: name ==> set}, + * } + * + * + * token location info (`yylloc`): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * } + * + * while `this` will reference the current lexer instance. + * + * When `parseError` is invoked by the lexer, the default implementation will + * attempt to invoke `yy.parser.parseError()`; when this callback is not provided + * it will try to invoke `yy.parseError()` instead. When that callback is also not + * provided, a `JisonLexerError` exception will be thrown containing the error + * message and `hash`, as constructed by the `constructLexErrorInfo()` API. + * + * Note that the lexer's `JisonLexerError` error class is passed via the + * `ExceptionClass` argument, which is invoked to construct the exception + * instance to be thrown, so technically `parseError` will throw the object + * produced by the `new ExceptionClass(str, hash)` JavaScript expression. + * + * --- + * + * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. + * These options are available: + * + * (Options are permanent.) + * + * yy: { + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * } + * + * lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * WARNING: the next set of options are not meant to be changed. They echo the abilities of + * the lexer as per when it was compiled! + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + +var lexer = function() { + // See also: + // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + // with userland code which might access the derived class in a 'classic' way. + function JisonLexerError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonLexerError' + }); + + if (msg == null) + msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + var stacktrace; + + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = new Error(msg).stack; + } + } + + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } + } + + if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); + } else { + JisonLexerError.prototype = Object.create(Error.prototype); + } + + JisonLexerError.prototype.constructor = JisonLexerError; + JisonLexerError.prototype.name = 'JisonLexerError'; + + var lexer = { + + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // backtracking: .................... false + // location.ranges: ................. true + // location line+column tracking: ... true + // + // + // Forwarded Parser Analysis flags: + // + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses lexer values: ............... true/ true + // location tracking: ............... true + // location assignment: ............. true + // + // + // Lexer Analysis flags: + // + // uses yyleng: ..................... ??? + // uses yylineno: ................... ??? + // uses yytext: ..................... ??? + // uses yylloc: ..................... ??? + // uses ParseError API: ............. ??? + // uses yyerror: .................... ??? + // uses location tracking & editing: ??? + // uses more() API: ................. ??? + // uses unput() API: ................ ??? + // uses reject() API: ............... ??? + // uses less() API: ................. ??? + // uses display APIs pastInput(), upcomingInput(), showPosition(): + // ............................. ??? + // uses describeYYLLOC() API: ....... ??? + // + // --------- END OF REPORT ----------- + + + EOF: 1, + + ERROR: 2, + + // JisonLexerError: JisonLexerError, /// <-- injected by the code generator + + // options: {}, /// <-- injected by the code generator + + // yy: ..., /// <-- injected by setInput() + + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + + /** + * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + * + * @public + * @this {RegExpLexer} + */ + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + /** @constructor */ + var pei = { + errStr: msg, + recoverable: !!recoverable, + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + token: null, + line: this.yylineno, + loc: this.yylloc, + yy: this.yy, + lexer: this, + + /** + * and make sure the error info doesn't stay due to potential + * ref cycle via userland code manipulations. + * These would otherwise all be memory leak opportunities! + * + * Note that only array and object references are nuked as those + * constitute the set of elements which can produce a cyclic ref. + * The rest of the members is kept intact as they are harmless. + * + * @public + * @this {LexErrorInfo} + */ + destroy: function destructLexErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // ... + var rec = !!this.recoverable; + + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; + } + } + + this.recoverable = rec; + } + }; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + + return pei; + }, + + /** + * handler which is invoked when a lexer error occurs. + * + * @public + * @this {RegExpLexer} + */ + parseError: function lexer_parseError(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonLexerError; + } + + if (this.yy) { + if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { + return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } else if (typeof this.yy.parseError === 'function') { + return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } + } + + throw new ExceptionClass(str, hash); + }, + + /** + * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions. + * + * @public + * @this {RegExpLexer} + */ + yyerror: function yyError(str /*, ...args */) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': ' + str, + this.options.lexerErrorsAreRecoverable + ); + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + + if (args.length) { + p.extra_error_attributes = args; + } + + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + }, + + /** + * final cleanup function for when we have completed lexing the input; + * make it an API so that external code can use this one once userland + * code has decided it's time to destroy any lingering lexer error + * hash object instances and the like: this function helps to clean + * up these constructs, which *may* carry cyclic references which would + * otherwise prevent the instances from being properly and timely + * garbage-collected, i.e. this function helps prevent memory leaks! + * + * @public + * @this {RegExpLexer} + */ + cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + this.setInput('', {}); + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + + this.__error_infos.length = 0; + } + + return this; + }, + + /** + * clear the lexer token context; intended for internal use only + * + * @public + * @this {RegExpLexer} + */ + clear: function lexer_clear() { + this.yytext = ''; + this.yyleng = 0; + this.match = ''; + + // - DO NOT reset `this.matched` + this.matches = false; + + this._more = false; + this._backtrack = false; + var col = (this.yylloc ? this.yylloc.last_column : 0); + + this.yylloc = { + first_line: this.yylineno + 1, + first_column: col, + last_line: this.yylineno + 1, + last_column: col, + range: [this.offset, this.offset] + }; + }, + + /** + * resets the lexer, sets new input + * + * @public + * @this {RegExpLexer} + */ + setInput: function lexer_setInput(input, yy) { + this.yy = yy || this.yy || {}; + + // also check if we've fully initialized the lexer instance, + // including expansion work to be done to go from a loaded + // lexer to a usable lexer: + if (!this.__decompressed) { + // step 1: decompress the regex list: + var rules = this.rules; + + for (var i = 0, len = rules.length; i < len; i++) { + var rule_re = rules[i]; + + // compression: is the RE an xref to another RE slot in the rules[] table? + if (typeof rule_re === 'number') { + rules[i] = rules[rule_re]; + } + } + + // step 2: unfold the conditions[] set to make these ready for use: + var conditions = this.conditions; + + for (var k in conditions) { + var spec = conditions[k]; + var rule_ids = spec.rules; + var len = rule_ids.length; + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_new_ids = new Array(len + 1); + + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; + } + + spec.rules = rule_new_ids; + spec.__rule_regexes = rule_regexes; + spec.__rule_count = len; + } + + this.__decompressed = true; + } + + this._input = input || ''; + this.clear(); + this._signaled_error_token = false; + this.done = false; + this.yylineno = 0; + this.matched = ''; + this.conditionStack = ['INITIAL']; + this.__currentRuleSet__ = null; + + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0, + range: [0, 0] + }; + + this.offset = 0; + return this; + }, + + /** + * edit the remaining input via user-specified callback. + * This can be used to forward-adjust the input-to-parse, + * e.g. inserting macro expansions and alike in the + * input which has yet to be lexed. + * The behaviour of this API contrasts the `unput()` et al + * APIs as those act on the *consumed* input, while this + * one allows one to manipulate the future, without impacting + * the current `yyloc` cursor location or any history. + * + * Use this API to help implement C-preprocessor-like + * `#include` statements, etc. + * + * The provided callback must be synchronous and is + * expected to return the edited input (string). + * + * The `cpsArg` argument value is passed to the callback + * as-is. + * + * `callback` interface: + * `function callback(input, cpsArg)` + * + * - `input` will carry the remaining-input-to-lex string + * from the lexer. + * - `cpsArg` is `cpsArg` passed into this API. + * + * The `this` reference for the callback will be set to + * reference this lexer instance so that userland code + * in the callback can easily and quickly access any lexer + * API. + * + * When the callback returns a non-string-type falsey value, + * we assume the callback did not edit the input and we + * will using the input as-is. + * + * When the callback returns a non-string-type value, it + * is converted to a string for lexing via the `"" + retval` + * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html + * -- that way any returned object's `toValue()` and `toString()` + * methods will be invoked in a proper/desirable order.) + * + * @public + * @this {RegExpLexer} + */ + editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) { + var rv = callback.call(this, this._input, cpsArg); + + if (typeof rv !== 'string') { + if (rv) { + this._input = '' + rv; + } + // else: keep `this._input` as is. + } else { + this._input = rv; + } + + return this; + }, + + /** + * consumes and returns one char from the input + * + * @public + * @this {RegExpLexer} + */ + input: function lexer_input() { + if (!this._input) { + //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) + return null; + } + + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + + // Count the linenumber up when we hit the LF (or a stand-alone CR). + // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo + // and we advance immediately past the LF as well, returning both together as if + // it was all a single 'character' only. + var slice_len = 1; + + var lines = false; + + if (ch === '\n') { + lines = true; + } else if (ch === '\r') { + lines = true; + var ch2 = this._input[1]; + + if (ch2 === '\n') { + slice_len++; + ch += ch2; + this.yytext += ch2; + this.yyleng++; + this.offset++; + this.match += ch2; + this.matched += ch2; + this.yylloc.range[1]++; + } + } + + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + this.yylloc.last_column = 0; + } else { + this.yylloc.last_column++; + } + + this.yylloc.range[1]++; + this._input = this._input.slice(slice_len); + return ch; + }, + + /** + * unshifts one char (or an entire string) into the input + * + * @public + * @this {RegExpLexer} + */ + unput: function lexer_unput(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.yyleng = this.yytext.length; + this.offset -= len; + this.match = this.match.substr(0, this.match.length - len); + this.matched = this.matched.substr(0, this.matched.length - len); + + if (lines.length > 1) { + this.yylineno -= lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); + + if (pre_lines.length === 1) { + pre = this.matched; + pre_lines = pre.split(/(?:\r\n?|\n)/g); + } + + this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; + } else { + this.yylloc.last_column -= len; + } + + this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; + this.done = false; + return this; + }, + + /** + * cache matched text and append it on next action + * + * @public + * @this {RegExpLexer} + */ + more: function lexer_more() { + this._more = true; + return this; + }, + + /** + * signal the lexer that this rule fails to match the input, so the + * next matching rule (regex) should be tested instead. + * + * @public + * @this {RegExpLexer} + */ + reject: function lexer_reject() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + // when the `parseError()` call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // `.lex()` run. + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, + false + ); + + this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + + return this; + }, + + /** + * retain first n characters of the match + * + * @public + * @this {RegExpLexer} + */ + less: function lexer_less(n) { + return this.unput(this.match.slice(n)); + }, + + /** + * return (part of the) already matched input, i.e. for error + * messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of + * input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * @public + * @this {RegExpLexer} + */ + pastInput: function lexer_pastInput(maxSize, maxLines) { + var past = this.matched.substring(0, this.matched.length - this.match.length); + + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = past.length; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + + // `substr` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + past = past.substr(-maxSize * 2 - 2); + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = past.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(-maxLines); + past = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis prefix... + if (past.length > maxSize) { + past = '...' + past.substr(-maxSize); + } + + return past; + }, + + /** + * return (part of the) upcoming input, i.e. for error messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * > ### NOTE ### + * > + * > *"upcoming input"* is defined as the whole of the both + * > the *currently lexed* input, together with any remaining input + * > following that. *"currently lexed"* input is the input + * > already recognized by the lexer but not yet returned with + * > the lexer token. This happens when you are invoking this API + * > from inside any lexer rule action code block. + * > + * + * @public + * @this {RegExpLexer} + */ + upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { + var next = this.match; + + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = maxSize; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + + // `substring` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + if (next.length < maxSize * 2 + 2) { + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + } + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = next.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(0, maxLines); + next = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis postfix... + if (next.length > maxSize) { + next = next.substring(0, maxSize) + '...'; + } + + return next; + }, + + /** + * return a string which displays the character position where the + * lexing error occurred, i.e. for error messages + * + * @public + * @this {RegExpLexer} + */ + showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { + var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; + }, + + /** + * return a string which displays the lines & columns of input which are referenced + * by the given location info range, plus a few lines of context. + * + * This function pretty-prints the indicated section of the input, with line numbers + * and everything! + * + * This function is very useful to provide highly readable error reports, while + * the location range may be specified in various flexible ways: + * + * - `loc` is the location info object which references the area which should be + * displayed and 'marked up': these lines & columns of text are marked up by `^` + * characters below each character in the entire input range. + * + * - `context_loc` is the *optional* location info object which instructs this + * pretty-printer how much *leading* context should be displayed alongside + * the area referenced by `loc`. This can help provide context for the displayed + * error, etc. + * + * When this location info is not provided, a default context of 3 lines is + * used. + * + * - `context_loc2` is another *optional* location info object, which serves + * a similar purpose to `context_loc`: it specifies the amount of *trailing* + * context lines to display in the pretty-print output. + * + * When this location info is not provided, a default context of 1 line only is + * used. + * + * Special Notes: + * + * - when the `loc`-indicated range is very large (about 5 lines or more), then + * only the first and last few lines of this block are printed while a + * `...continued...` message will be printed between them. + * + * This serves the purpose of not printing a huge amount of text when the `loc` + * range happens to be huge: this way a manageable & readable output results + * for arbitrary large ranges. + * + * - this function can display lines of input which whave not yet been lexed. + * `prettyPrintRange()` can access the entire input! + * + * @public + * @this {RegExpLexer} + */ + prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var input = this.matched + this._input; + var lines = input.split('\n'); + + //var show_context = (error_size < 5 || context_loc); + var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); + + var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); + var lineno_display_width = 1 + Math.log10(l1 | 1) | 0; + var ws_prefix = new Array(lineno_display_width).join(' '); + var nonempty_line_indexes = []; + + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ': ' + line; + var errpfx = new Array(lineno_display_width + 1).join('^'); + + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + + var len = Math.max( + 2, + ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 + ); + + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } + + rv = rv.replace(/\t/g, ' '); + return rv; + }); + + // now make sure we don't print an overly large amount of error area: limit it + // to the top and bottom line count: + if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { + var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; + + console.log('clip off: ', { + start: clip_start, + end: clip_end, + len: clip_end - clip_start + 1, + arr: nonempty_line_indexes, + rv + }); + + var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; + intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; + rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); + } + + return rv.join('\n'); + }, + + /** + * helper function, used to produce a human readable description as a string, given + * the input `yylloc` location object. + * + * Set `display_range_too` to TRUE to include the string character index position(s) + * in the description if the `yylloc.range` is available. + * + * @public + * @this {RegExpLexer} + */ + describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { + var l1 = yylloc.first_line; + var l2 = yylloc.last_line; + var c1 = yylloc.first_column; + var c2 = yylloc.last_column; + var dl = l2 - l1; + var dc = c2 - c1; + var rv; + + if (dl === 0) { + rv = 'line ' + l1 + ', '; + + if (dc <= 1) { + rv += 'column ' + c1; + } else { + rv += 'columns ' + c1 + ' .. ' + c2; + } + } else { + rv = 'lines ' + l1 + '(column ' + c1 + ') .. ' + l2 + '(column ' + c2 + ')'; + } + + if (yylloc.range && display_range_too) { + var r1 = yylloc.range[0]; + var r2 = yylloc.range[1] - 1; + + if (r2 <= r1) { + rv += ' {String Offset: ' + r1 + '}'; + } else { + rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; + } + } + + return rv; + }, + + /** + * test the lexed token: return FALSE when not a match, otherwise return token. + * + * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + * contains the actually matched text string. + * + * Also move the input cursor forward and update the match collectors: + * + * - `yytext` + * - `yyleng` + * - `match` + * - `matches` + * - `yylloc` + * - `offset` + * + * @public + * @this {RegExpLexer} + */ + test_match: function lexer_test_match(match, indexed_rule) { + var token, lines, backup, match_str, match_str_len; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.yylloc.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column, + range: this.yylloc.range.slice(0) + }, + + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + + //_signaled_error_token: this._signaled_error_token, + yy: this.yy, + + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + } + + match_str = match[0]; + match_str_len = match_str.length; + + // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { + lines = match_str.split(/(?:\r\n?|\n)/g); + + if (lines.length > 1) { + this.yylineno += lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + this.yylloc.last_column = lines[lines.length - 1].length; + } else { + this.yylloc.last_column += match_str_len; + } + + // } + this.yytext += match_str; + + this.match += match_str; + this.matched += match_str; + this.matches = match; + this.yyleng = this.yytext.length; + this.yylloc.range[1] += match_str_len; + + // previous lex rules MAY have invoked the `more()` API rather than producing a token: + // those rules will already have moved this `offset` forward matching their match lengths, + // hence we must only add our own match length now: + this.offset += match_str_len; + + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match_str_len); + + // calling this method: + // + // function lexer__performAction(yy, yyrulenumber, YY_START) {...} + token = this.performAction.call( + this, + this.yy, + indexed_rule, + this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ + ); + + // otherwise, when the action codes are all simple return token statements: + //token = this.simpleCaseActionClusters[indexed_rule]; + + if (this.done && this._input) { + this.done = false; + } + + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + + this.__currentRuleSet__ = null; + return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as `.parseError()` in `reject()` + // did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + + this._signaled_error_token = false; + return token; + } + + return false; + }, + + /** + * return next match in input + * + * @public + * @this {RegExpLexer} + */ + next: function lexer_next() { + if (this.done) { + this.clear(); + return this.EOF; + } + + if (!this._input) { + this.done = true; + } + + var token, match, tempMatch, index; + + if (!this._more) { + this.clear(); + } + + var spec = this.__currentRuleSet__; + + if (!spec) { + // Update the ruleset cache as we apparently encountered a state change or just started lexing. + // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will + // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps + // speed up those activities a tiny bit. + spec = this.__currentRuleSet__ = this._currentRules(); + + // Check whether a *sane* condition has been pushed before: this makes the lexer robust against + // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 + if (!spec || !spec.rules) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo( + 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, + false + ); + + // produce one 'error' token until this situation has been resolved, most probably by parse termination! + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + } + + var rule_ids = spec.rules; + var regexes = spec.__rule_regexes; + var len = spec.__rule_count; + + // Note: the arrays are 1-based, while `len` itself is a valid index, + // hence the non-standard less-or-equal check in the next loop condition! + for (var i = 1; i <= len; i++) { + tempMatch = this._input.match(regexes[i]); + + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rule_ids[i]); + + if (token !== false) { + return token; + } else if (this._backtrack) { + match = undefined; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + + if (match) { + token = this.test_match(match, rule_ids[index]); + + if (token !== false) { + return token; + } + + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + + if (!this._input) { + this.done = true; + this.clear(); + return this.EOF; + } else { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, + this.options.lexerErrorsAreRecoverable + ); + + token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + + if (token === this.ERROR) { + // we can try to recover from a lexer error that `parseError()` did not 'recover' for us + // by moving forward at least one character at a time: + if (!this.match.length) { + this.input(); + } + } + + return token; + } + }, + + /** + * return next match that has a token + * + * @public + * @this {RegExpLexer} + */ + lex: function lexer_lex() { + var r; + + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + + while (!r) { + r = this.next(); + } + + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + + return r; + }, + + /** + * backwards compatible alias for `pushState()`; + * the latter is symmetrical with `popState()` and we advise to use + * those APIs in any modern lexer code, rather than `begin()`. + * + * @public + * @this {RegExpLexer} + */ + begin: function lexer_begin(condition) { + return this.pushState(condition); + }, + + /** + * activates a new lexer condition state (pushes the new lexer + * condition state onto the condition stack) + * + * @public + * @this {RegExpLexer} + */ + pushState: function lexer_pushState(condition) { + this.conditionStack.push(condition); + this.__currentRuleSet__ = null; + return this; + }, + + /** + * pop the previously active lexer condition state off the condition + * stack + * + * @public + * @this {RegExpLexer} + */ + popState: function lexer_popState() { + var n = this.conditionStack.length - 1; + + if (n > 0) { + this.__currentRuleSet__ = null; + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + + /** + * return the currently active lexer condition state; when an index + * argument is provided it produces the N-th previous condition state, + * if available + * + * @public + * @this {RegExpLexer} + */ + topState: function lexer_topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + + if (n >= 0) { + return this.conditionStack[n]; + } else { + return 'INITIAL'; + } + }, + + /** + * (internal) determine the lexer rule set which is active for the + * currently active lexer condition state + * + * @public + * @this {RegExpLexer} + */ + _currentRules: function lexer__currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; + } else { + return this.conditions['INITIAL']; + } + }, + + /** + * return the number of states currently on the stack + * + * @public + * @this {RegExpLexer} + */ + stateStackSize: function lexer_stateStackSize() { + return this.conditionStack.length; + }, + + options: { + xregexp: true, + ranges: true, + trackPosition: true, + parseActionsUseYYMERGELOCATIONINFO: true, + easy_keyword_rules: true + }, + + JisonLexerError: JisonLexerError, + + performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { + var yy_ = this; + switch (yyrulenumber) { + case 0: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %\{ */ + yy.dept = 0; + + yy.include_command_allowed = false; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 1: + /*! Conditions:: action */ + /*! Rule:: %\{([^]*?)%\} */ + yy_.yytext = this.matches[1]; + + yy.include_command_allowed = true; + return 32; + break; + + case 2: + /*! Conditions:: action */ + /*! Rule:: %include\b */ + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState('path'); + + return 51; + } else { + // TODO + yy_.yyerror('oops!'); + + return 37; + } + + break; + + case 3: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 34; + + break; + + case 4: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\/.* */ + yy.include_command_allowed = false; + + return 35; + break; + + case 6: + /*! Conditions:: action */ + /*! Rule:: \| */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 7: + /*! Conditions:: action */ + /*! Rule:: %% */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 9: + /*! Conditions:: action */ + /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 10: + /*! Conditions:: action */ + /*! Rule:: \/[^}{BR}]* */ + yy.include_command_allowed = false; + + return 33; + break; + + case 11: + /*! Conditions:: action */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy.include_command_allowed = false; + + return 33; + break; + + case 12: + /*! Conditions:: action */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy.include_command_allowed = false; + + return 33; + break; + + case 13: + /*! Conditions:: action */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy.include_command_allowed = false; + + return 33; + break; + + case 14: + /*! Conditions:: action */ + /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 15: + /*! Conditions:: action */ + /*! Rule:: \{ */ + yy.depth++; + + yy.include_command_allowed = false; + return 33; + break; + + case 16: + /*! Conditions:: action */ + /*! Rule:: \} */ + yy.include_command_allowed = false; + + if (yy.depth <= 0) { + yy_.yyerror(rmCommonWS` + too many closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 'BRACKETS_SURPLUS'; + } else { + yy.depth--; + } + + return 33; + break; + + case 17: + /*! Conditions:: action */ + /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|]) */ + yy.include_command_allowed = true; + + return 36; // keep empty lines as-is inside action code blocks. + break; + + case 18: + /*! Conditions:: action */ + /*! Rule:: {BR} */ + if (yy.depth > 0) { + yy.include_command_allowed = true; + return 36; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk + this.popState(); + + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } + + break; + + case 19: + /*! Conditions:: action */ + /*! Rule:: $ */ + yy.include_command_allowed = false; + + if (yy.depth !== 0) { + yy_.yyerror(rmCommonWS` + missing ${yy.depth} closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = ''; + return 'BRACKETS_MISSING'; + } + + this.popState(); + yy_.yytext = ''; + return 31; + break; + + case 21: + /*! Conditions:: conditions */ + /*! Rule:: > */ + this.popState(); + + return 6; + break; + + case 24: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 25: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 26: + /*! Conditions:: rules */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 27: + /*! Conditions:: rules */ + /*! Rule:: {WS}+{BR}+ */ + /* empty */ + break; + + case 28: + /*! Conditions:: rules */ + /*! Rule:: \/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 29: + /*! Conditions:: rules */ + /*! Rule:: \/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 30: + /*! Conditions:: rules */ + /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + return 28; + break; + + case 31: + /*! Conditions:: rules */ + /*! Rule:: %% */ + this.popState(); + + this.pushState('code'); + return 19; + break; + + case 32: + /*! Conditions:: rules */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 35: + /*! Conditions:: options */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 49; // value is always a string type + break; + + case 36: + /*! Conditions:: options */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 49; // value is always a string type + break; + + case 37: + /*! Conditions:: options */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy_.yytext = unescQuote(this.matches[1], /\\`/g); + + return 49; // value is always a string type + break; + + case 39: + /*! Conditions:: options */ + /*! Rule:: {BR}{WS}+(?=\S) */ + /* skip leading whitespace on the next line of input, when followed by more options */ + break; + + case 40: + /*! Conditions:: options */ + /*! Rule:: {BR} */ + this.popState(); + + return 48; + break; + + case 41: + /*! Conditions:: options */ + /*! Rule:: {WS}+ */ + /* skip whitespace */ + break; + + case 43: + /*! Conditions:: start_condition */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 44: + /*! Conditions:: start_condition */ + /*! Rule:: {WS}+ */ + /* empty */ + break; + + case 46: + /*! Conditions:: INITIAL */ + /*! Rule:: {ID} */ + this.pushState('macro'); + + return 20; + break; + + case 47: + /*! Conditions:: macro named_chunk */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 48: + /*! Conditions:: macro */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 49: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 50: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \s+ */ + /* empty */ + break; + + case 51: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 26; + break; + + case 52: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 26; + break; + + case 53: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \[ */ + this.pushState('set'); + + return 41; + break; + + case 66: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: < */ + this.pushState('conditions'); + + return 5; + break; + + case 67: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/! */ + return 39; // treated as `(?!atom)` + + break; + + case 68: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/ */ + return 14; // treated as `(?=atom)` + + break; + + case 70: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); + + return 44; + break; + + case 73: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %options\b */ + this.pushState('options'); + + return 47; + break; + + case 74: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %s\b */ + this.pushState('start_condition'); + + return 21; + break; + + case 75: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %x\b */ + this.pushState('start_condition'); + + return 22; + break; + + case 76: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %code\b */ + this.pushState('named_chunk'); + + return 25; + break; + + case 77: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %import\b */ + this.pushState('named_chunk'); + + return 24; + break; + + case 78: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %include\b */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 79: + /*! Conditions:: code */ + /*! Rule:: %include\b */ + this.pushState('path'); + + return 51; + break; + + case 80: + /*! Conditions:: INITIAL rules code */ + /*! Rule:: %{NAME}([^\r\n]*) */ + /* ignore unrecognized decl */ + this.warn(rmCommonWS` + LEX: ignoring unsupported lexer option ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = [ + this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; + + return 23; + break; + + case 81: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %% */ + this.pushState('rules'); + + return 19; + break; + + case 89: + /*! Conditions:: set */ + /*! Rule:: \] */ + this.popState(); + + return 42; + break; + + case 91: + /*! Conditions:: code */ + /*! Rule:: [^\r\n]+ */ + return 53; // the bit of CODE just before EOF... + + break; + + case 92: + /*! Conditions:: path */ + /*! Rule:: {BR} */ + this.popState(); + + this.unput(yy_.yytext); + break; + + case 93: + /*! Conditions:: path */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 94: + /*! Conditions:: path */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 95: + /*! Conditions:: path */ + /*! Rule:: {WS}+ */ + // skip whitespace in the line + break; + + case 96: + /*! Conditions:: path */ + /*! Rule:: [^\s\r\n]+ */ + this.popState(); + + return 52; + break; + + case 97: + /*! Conditions:: action */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 98: + /*! Conditions:: action */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 99: + /*! Conditions:: action */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 100: + /*! Conditions:: options */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 101: + /*! Conditions:: options */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 102: + /*! Conditions:: options */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 103: + /*! Conditions:: * */ + /*! Rule:: " */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 104: + /*! Conditions:: * */ + /*! Rule:: ' */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 105: + /*! Conditions:: * */ + /*! Rule:: ` */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 106: + /*! Conditions:: macro rules */ + /*! Rule:: . */ + /* b0rk on bad characters */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unsupported lexer input encountered while lexing + ${rules} (i.e. jison lex regexes). + + NOTE: When you want this input to be interpreted as a LITERAL part + of a lex rule regex, you MUST enclose it in double or + single quotes. + + If not, then know that this input is not accepted as a valid + regex expression here in jison-lex ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + case 107: + /*! Conditions:: * */ + /*! Rule:: . */ + yy_.yyerror(rmCommonWS` + unsupported lexer input: ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + default: + return this.simpleCaseActionClusters[yyrulenumber]; + } + }, + + simpleCaseActionClusters: { + /*! Conditions:: action */ + /*! Rule:: {WS}+ */ + 5: 36, + + /*! Conditions:: action */ + /*! Rule:: % */ + 8: 33, + + /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ + 20: 20, + + /*! Conditions:: conditions */ + /*! Rule:: , */ + 22: 8, + + /*! Conditions:: conditions */ + /*! Rule:: \* */ + 23: 7, + + /*! Conditions:: options */ + /*! Rule:: {NAME} */ + 33: 20, + + /*! Conditions:: options */ + /*! Rule:: = */ + 34: 18, + + /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ + 38: 50, + + /*! Conditions:: start_condition */ + /*! Rule:: {ID} */ + 42: 27, + + /*! Conditions:: named_chunk */ + /*! Rule:: {ID} */ + 45: 20, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \| */ + 54: 9, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?: */ + 55: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?= */ + 56: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?! */ + 57: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \( */ + 58: 10, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \) */ + 59: 11, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \+ */ + 60: 12, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \* */ + 61: 7, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \? */ + 62: 13, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \^ */ + 63: 16, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: , */ + 64: 8, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: <> */ + 65: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + 69: 44, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \$ */ + 71: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \. */ + 72: 15, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{\d+(,\s*\d+|,)?\} */ + 82: 45, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{{ID}\} */ + 83: 40, + + /*! Conditions:: set options */ + /*! Rule:: \{{ID}\} */ + 84: 40, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{ */ + 85: 3, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \} */ + 86: 4, + + /*! Conditions:: set */ + /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ + 87: 43, + + /*! Conditions:: set */ + /*! Rule:: \{ */ + 88: 43, + + /*! Conditions:: code */ + /*! Rule:: [^\r\n]*(\r|\n)+ */ + 90: 53, + + /*! Conditions:: * */ + /*! Rule:: $ */ + 108: 1 + }, + + rules: [ + /* 0: */ /^(?:%\{)/, + /* 1: */ new XRegExp('^(?:%\\{([^]*?)%\\})', ''), + /* 2: */ /^(?:%include\b)/, + /* 3: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 4: */ /^(?:([^\S\n\r])*\/\/.*)/, + /* 5: */ /^(?:([^\S\n\r])+)/, + /* 6: */ /^(?:\|)/, + /* 7: */ /^(?:%%)/, + /* 8: */ /^(?:%)/, + /* 9: */ /^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, + /* 10: */ /^(?:\/[^\n\r}]*)/, + /* 11: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 12: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 13: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 14: */ /^(?:[^\s"%'\/`{-}]+)/, + /* 15: */ /^(?:\{)/, + /* 16: */ /^(?:\})/, + /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s|]))/, + /* 18: */ /^(?:(\r\n|\n|\r))/, + /* 19: */ /^(?:$)/, + /* 20: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' + ), + /* 21: */ /^(?:>)/, + /* 22: */ /^(?:,)/, + /* 23: */ /^(?:\*)/, + /* 24: */ /^(?:([^\S\n\r])*\/\/[^\n\r]*)/, + /* 25: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 26: */ /^(?:(\r\n|\n|\r)+)/, + /* 27: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, + /* 28: */ /^(?:\/\/[^\r\n]*)/, + /* 29: */ new XRegExp('^(?:\\/\\*[^]*?\\*\\/)', ''), + /* 30: */ /^(?:([^\S\n\r])+(?=[^\s%|]))/, + /* 31: */ /^(?:%%)/, + /* 32: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 33: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' + ), + /* 34: */ /^(?:=)/, + /* 35: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 36: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 37: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 38: */ /^(?:\S+)/, + /* 39: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, + /* 40: */ /^(?:(\r\n|\n|\r))/, + /* 41: */ /^(?:([^\S\n\r])+)/, + /* 42: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 43: */ /^(?:(\r\n|\n|\r)+)/, + /* 44: */ /^(?:([^\S\n\r])+)/, + /* 45: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 46: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 47: */ /^(?:(\r\n|\n|\r)+)/, + /* 48: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 49: */ /^(?:(\r\n|\n|\r)+)/, + /* 50: */ /^(?:\s+)/, + /* 51: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 52: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 53: */ /^(?:\[)/, + /* 54: */ /^(?:\|)/, + /* 55: */ /^(?:\(\?:)/, + /* 56: */ /^(?:\(\?=)/, + /* 57: */ /^(?:\(\?!)/, + /* 58: */ /^(?:\()/, + /* 59: */ /^(?:\))/, + /* 60: */ /^(?:\+)/, + /* 61: */ /^(?:\*)/, + /* 62: */ /^(?:\?)/, + /* 63: */ /^(?:\^)/, + /* 64: */ /^(?:,)/, + /* 65: */ /^(?:<>)/, + /* 66: */ /^(?:<)/, + /* 67: */ /^(?:\/!)/, + /* 68: */ /^(?:\/)/, + /* 69: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 70: */ /^(?:\\.)/, + /* 71: */ /^(?:\$)/, + /* 72: */ /^(?:\.)/, + /* 73: */ /^(?:%options\b)/, + /* 74: */ /^(?:%s\b)/, + /* 75: */ /^(?:%x\b)/, + /* 76: */ /^(?:%code\b)/, + /* 77: */ /^(?:%import\b)/, + /* 78: */ /^(?:%include\b)/, + /* 79: */ /^(?:%include\b)/, + /* 80: */ new XRegExp( + '^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))', + '' + ), + /* 81: */ /^(?:%%)/, + /* 82: */ /^(?:\{\d+(,\s*\d+|,)?\})/, + /* 83: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 84: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 85: */ /^(?:\{)/, + /* 86: */ /^(?:\})/, + /* 87: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 88: */ /^(?:\{)/, + /* 89: */ /^(?:\])/, + /* 90: */ /^(?:[^\r\n]*(\r|\n)+)/, + /* 91: */ /^(?:[^\r\n]+)/, + /* 92: */ /^(?:(\r\n|\n|\r))/, + /* 93: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 94: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 95: */ /^(?:([^\S\n\r])+)/, + /* 96: */ /^(?:\S+)/, + /* 97: */ /^(?:")/, + /* 98: */ /^(?:')/, + /* 99: */ /^(?:`)/, + /* 100: */ /^(?:")/, + /* 101: */ /^(?:')/, + /* 102: */ /^(?:`)/, + /* 103: */ /^(?:")/, + /* 104: */ /^(?:')/, + /* 105: */ /^(?:`)/, + /* 106: */ /^(?:.)/, + /* 107: */ /^(?:.)/, + /* 108: */ /^(?:$)/ + ], + + conditions: { + 'rules': { + rules: [ + 0, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 80, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 106, + 107, + 108 + ], + + inclusive: true + }, + + 'macro': { + rules: [ + 0, + 24, + 25, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 106, + 107, + 108 + ], + + inclusive: true + }, + + 'named_chunk': { + rules: [ + 0, + 45, + 47, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: true + }, + + 'code': { + rules: [79, 80, 90, 91, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'start_condition': { + rules: [24, 25, 42, 43, 44, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'options': { + rules: [ + 24, + 25, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 84, + 100, + 101, + 102, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: false + }, + + 'conditions': { + rules: [20, 21, 22, 23, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'action': { + rules: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 97, + 98, + 99, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: false + }, + + 'path': { + rules: [24, 25, 92, 93, 94, 95, 96, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'set': { + rules: [84, 87, 88, 89, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'INITIAL': { + rules: [ + 0, + 24, + 25, + 46, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 80, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: true + } + } + }; + + var rmCommonWS = helpers.rmCommonWS; + var dquote = helpers.dquote; + + function unescQuote(str) { + str = '' + str; + var a = str.split('\\\\'); + + a = a.map(function(s) { + return s.replace(/\\'/g, '\'').replace(/\\"/g, '"'); + }); + + str = a.join('\\\\'); + return str; + } + + lexer.warn = function l_warn() { + if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { + return this.yy.parser.warn.apply(this, arguments); + } else { + console.warn.apply(console, arguments); + } + }; + + lexer.log = function l_log() { + if (this.yy && this.yy.parser && typeof this.yy.parser.log === 'function') { + return this.yy.parser.log.apply(this, arguments); + } else { + console.log.apply(console, arguments); + } + }; + + return lexer; +}(); +parser.lexer = lexer; + +function Parser() { + this.yy = {}; +} +Parser.prototype = parser; +parser.Parser = Parser; + +function yyparse() { + return parser.parse.apply(parser, arguments); +} + +exports.parser = parser; +exports.Parser = Parser; +exports.parse = yyparse; diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js new file mode 100644 index 0000000..3d80cf5 --- /dev/null +++ b/dist/lex-parser-es6.js @@ -0,0 +1,7801 @@ +import fs from 'fs'; +import XRegExp from '@gerhobbelt/xregexp'; +import helpers from 'jison-helpers-lib'; + +// hack: +var assert; + + +/* parser generated by jison 0.6.0-194 */ + +/* + * Returns a Parser object of the following structure: + * + * Parser: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a derivative/copy of this one, + * not a direct reference! + * } + * + * Parser.prototype: { + * yy: {}, + * EOF: 1, + * TERROR: 2, + * + * trace: function(errorMessage, ...), + * + * JisonParserError: function(msg, hash), + * + * quoteName: function(name), + * Helper function which can be overridden by user code later on: put suitable + * quotes around literal IDs in a description string. + * + * originalQuoteName: function(name), + * The basic quoteName handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function + * at the end of the `parse()`. + * + * describeSymbol: function(symbol), + * Return a more-or-less human-readable description of the given symbol, when + * available, or the symbol itself, serving as its own 'description' for lack + * of something better to serve up. + * + * Return NULL when the symbol is unknown to the parser. + * + * symbols_: {associative list: name ==> number}, + * terminals_: {associative list: number ==> name}, + * nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}}, + * terminal_descriptions_: (if there are any) {associative list: number ==> description}, + * productions_: [...], + * + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) + * to store/reference the rule value `$$` and location info `@$`. + * + * One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets + * to see the same object via the `this` reference, i.e. if you wish to carry custom + * data from one reduce action through to the next within a single parse run, then you + * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. + * + * `this.yy` is a direct reference to the `yy` shared state object. + * + * `%parse-param`-specified additional `parse()` arguments have been added to this `yy` + * object at `parse()` start and are therefore available to the action code via the + * same named `yy.xxxx` attributes (where `xxxx` represents a identifier name from + * the %parse-param` list. + * + * - `yytext` : reference to the lexer value which belongs to the last lexer token used + * to match this rule. This is *not* the look-ahead token, but the last token + * that's actually part of this rule. + * + * Formulated another way, `yytext` is the value of the token immediately preceeding + * the current look-ahead token. + * Caveats apply for rules which don't require look-ahead, such as epsilon rules. + * + * - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value. + * + * - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value. + * + * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. + * + * WARNING: since jison 0.4.18-186 this entry may be NULL/UNDEFINED instead + * of an empty object when no suitable location info can be provided. + * + * - `yystate` : the current parser state number, used internally for dispatching and + * executing the action code chunk matching the rule currently being reduced. + * + * - `yysp` : the current state stack position (a.k.a. 'stack pointer') + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * Also note that you can access this and other stack index values using the new double-hash + * syntax, i.e. `##$ === ##0 === yysp`, while `##1` is the stack index for all things + * related to the first rule term, just like you have `$1`, `@1` and `#1`. + * This is made available to write very advanced grammar action rules, e.g. when you want + * to investigate the parse state stack in your action code, which would, for example, + * be relevant when you wish to implement error diagnostics and reporting schemes similar + * to the work described here: + * + * + Pottier, F., 2016. Reachability and error diagnosis in LR(1) automata. + * In Journées Francophones des Languages Applicatifs. + * + * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. + * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. + * + * - `yyrulelength`: the current rule's term count, i.e. the number of entries occupied on the stack. + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. + * constructs. + * + * - `yylstack`: reference to the parser token location stack. Also accessed via + * the `@1` etc. constructs. + * + * WARNING: since jison 0.4.18-186 this array MAY contain slots which are + * UNDEFINED rather than an empty (location) object, when the lexer/parser + * action code did not provide a suitable location info object when such a + * slot was filled! + * + * - `yystack` : reference to the parser token id stack. Also accessed via the + * `#1` etc. constructs. + * + * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to + * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might + * want access this array for your own purposes, such as error analysis as mentioned above! + * + * Note that this stack stores the current stack of *tokens*, that is the sequence of + * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* + * (lexer tokens *shifted* onto the stack until the rule they belong to is found and + * *reduced*. + * + * - `yysstack`: reference to the parser state stack. This one carries the internal parser + * *states* such as the one in `yystate`, which are used to represent + * the parser state machine in the *parse table*. *Very* *internal* stuff, + * what can I say? If you access this one, you're clearly doing wicked things + * + * - `...` : the extra arguments you specified in the `%parse-param` statement in your + * grammar definition file. + * + * table: [...], + * State transition table + * ---------------------- + * + * index levels are: + * - `state` --> hash table + * - `symbol` --> action (number or array) + * + * If the `action` is an array, these are the elements' meaning: + * - index [0]: 1 = shift, 2 = reduce, 3 = accept + * - index [1]: GOTO `state` + * + * If the `action` is a number, it is the GOTO `state` + * + * defaultActions: {...}, + * + * parseError: function(str, hash, ExceptionClass), + * yyError: function(str, ...), + * yyRecovering: function(), + * yyErrOk: function(), + * yyClearIn: function(), + * + * constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this parser kernel in many places; example usage: + * + * var infoObj = parser.constructParseErrorInfo('fail!', null, + * parser.collect_expected_token_set(state), true); + * var retVal = parser.parseError(infoObj.errStr, infoObj, parser.JisonParserError); + * + * originalParseError: function(str, hash, ExceptionClass), + * The basic `parseError` handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function + * at the end of the `parse()`. + * + * options: { ... parser %options ... }, + * + * parse: function(input[, args...]), + * Parse the given `input` and return the parsed value (or `true` when none was provided by + * the root action, in which case the parser is acting as a *matcher*). + * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * the lexer section of the grammar spec): these will be inserted in the `yy` shared state + * object and any collision with those will be reported by the lexer via a thrown exception. + * + * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown + * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY + * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and + * the internal parser gets properly garbage collected under these particular circumstances. + * + * yyMergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API can be invoked to calculate a spanning `yylloc` location info object. + * + * Note: %epsilon rules MAY specify no `first_index` and `first_yylloc`, in which case + * this function will attempt to obtain a suitable location marker by inspecting the location stack + * backwards. + * + * For more info see the documentation comment further below, immediately above this function's + * implementation. + * + * lexer: { + * yy: {...}, A reference to the so-called "shared state" `yy` once + * received via a call to the `.setInput(input, yy)` lexer API. + * EOF: 1, + * ERROR: 2, + * JisonLexerError: function(msg, hash), + * parseError: function(str, hash, ExceptionClass), + * setInput: function(input, [yy]), + * input: function(), + * unput: function(str), + * more: function(), + * reject: function(), + * less: function(n), + * pastInput: function(n), + * upcomingInput: function(n), + * showPosition: function(), + * test_match: function(regex_match_array, rule_index, ...), + * next: function(...), + * lex: function(...), + * begin: function(condition), + * pushState: function(condition), + * popState: function(), + * topState: function(), + * _currentRules: function(), + * stateStackSize: function(), + * cleanupAfterLex: function() + * + * options: { ... lexer %options ... }, + * + * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...), + * rules: [...], + * conditions: {associative list: name ==> set}, + * } + * } + * + * + * token location info (@$, _$, etc.): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer and + * parser errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * } + * + * parser (grammar) errors will also provide these additional members: + * + * { + * expected: (array describing the set of expected tokens; + * may be UNDEFINED when we cannot easily produce such a set) + * state: (integer (or array when the table includes grammar collisions); + * represents the current internal state of the parser kernel. + * can, for example, be used to pass to the `collect_expected_token_set()` + * API to obtain the expected token set) + * action: (integer; represents the current internal action which will be executed) + * new_state: (integer; represents the next/planned internal state, once the current + * action has executed) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, + * for instance, for advanced error analysis and reporting) + * value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used, + * for instance, for advanced error analysis and reporting) + * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, + * for instance, for advanced error analysis and reporting) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * parser: (reference to the current parser instance) + * } + * + * while `this` will reference the current parser instance. + * + * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * lexer: (reference to the current lexer instance which reported the error) + * } + * + * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired + * from either the parser or lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * exception: (reference to the exception thrown) + * } + * + * Please do note that in the latter situation, the `expected` field will be omitted as + * this type of failure is assumed not to be due to *parse errors* but rather due to user + * action code in either parser or lexer failing unexpectedly. + * + * --- + * + * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + * These options are available: + * + * ### options which are global for all parser instances + * + * Parser.pre_parse: function(yy) + * optional: you can specify a pre_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. + * Parser.post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: you can specify a post_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. When it does not return any value, + * the parser will return the original `retval`. + * + * ### options which can be set up per parser instance + * + * yy: { + * pre_parse: function(yy) + * optional: is invoked before the parse cycle starts (and before the first + * invocation of `lex()`) but immediately after the invocation of + * `parser.pre_parse()`). + * post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: is invoked when the parse terminates due to success ('accept') + * or failure (even when exceptions are thrown). + * `retval` contains the return value to be produced by `Parser.parse()`; + * this function can override the return value by returning another. + * When it does not return any value, the parser will return the original + * `retval`. + * This function is invoked immediately before `parser.post_parse()`. + * + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * quoteName: function(name), + * optional: overrides the default `quoteName` function. + * } + * + * parser.lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this `%option` has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + + +// See also: +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 +// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility +// with userland code which might access the derived class in a 'classic' way. +function JisonParserError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonParserError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + + var stacktrace; + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = (new Error(msg)).stack; + } + } + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } +} + +if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonParserError.prototype, Error.prototype); +} else { + JisonParserError.prototype = Object.create(Error.prototype); +} +JisonParserError.prototype.constructor = JisonParserError; +JisonParserError.prototype.name = 'JisonParserError'; + + +// import XRegExp from '@gerhobbelt/xregexp'; +// import helpers from 'jison-helpers-lib'; +// import fs from 'fs'; + + +// helper: reconstruct the productions[] table +function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); + } + return rv; +} + + + +// helper: reconstruct the defaultActions[] table +function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; +} + + + +// helper: reconstruct the 'goto' table +function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; + + case 0: + q[z] = a.shift(); + break; + + default: + // type === 1: accept + q[z] = [ + 3 + ]; + } + } + rv.push(q); + } + return rv; +} + + + +// helper: runlength encoding with increment step: code, length: step (default step = 0) +// `this` references an array +function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } +} + +// helper: duplicate sequence from *relative* offset and length. +// `this` references an array +function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } +} + +// helper: unpack an array using helpers and data, all passed in an array argument 'a'. +function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; +} + + +var parser = { + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // default action mode: ............. classic,merge + // no try..catch: ................... false + // no default resolve on conflict: false + // on-demand look-ahead: ............ false + // error recovery token skip maximum: 3 + // yyerror in parse actions is: ..... NOT recoverable, + // yyerror in lexer actions and other non-fatal lexer are: + // .................................. NOT recoverable, + // debug grammar/output: ............ false + // has partial LR conflict upgrade: true + // rudimentary token-stack support: false + // parser table compression mode: ... 2 + // export debug tables: ............. false + // export *all* tables: ............. false + // module type: ..................... es + // parser engine type: .............. lalr + // output main() in the module: ..... true + // number of expected conflicts: .... 0 + // + // + // Parser Analysis flags: + // + // no significant actions (parser is a language matcher only): + // .................................. false + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses ParseError API: ............. false + // uses YYERROR: .................... true + // uses YYRECOVERING: ............... false + // uses YYERROK: .................... false + // uses YYCLEARIN: .................. false + // tracks rule values: .............. true + // assigns rule values: ............. true + // uses location tracking: .......... true + // assigns location: ................ true + // uses yystack: .................... false + // uses yysstack: ................... false + // uses yysp: ....................... true + // uses yyrulelength: ............... false + // uses yyMergeLocationInfo API: .... true + // has error recovery: .............. true + // has error reporting: ............. true + // + // --------- END OF REPORT ----------- + +trace: function no_op_trace() { }, +JisonParserError: JisonParserError, +yy: {}, +options: { + type: "lalr", + hasPartialLrUpgradeOnConflict: true, + errorRecoveryTokenDiscardCount: 3 +}, +symbols_: { + "$": 17, + "$accept": 0, + "$end": 1, + "%%": 19, + "(": 10, + ")": 11, + "*": 7, + "+": 12, + ",": 8, + ".": 15, + "/": 14, + "/!": 39, + "<": 5, + "=": 18, + ">": 6, + "?": 13, + "ACTION": 32, + "ACTION_BODY": 33, + "ACTION_BODY_CPP_COMMENT": 35, + "ACTION_BODY_C_COMMENT": 34, + "ACTION_BODY_WHITESPACE": 36, + "ACTION_END": 31, + "ACTION_START": 28, + "BRACKET_MISSING": 29, + "BRACKET_SURPLUS": 30, + "CHARACTER_LIT": 46, + "CODE": 53, + "EOF": 1, + "ESCAPE_CHAR": 44, + "IMPORT": 24, + "INCLUDE": 51, + "INCLUDE_PLACEMENT_ERROR": 37, + "INIT_CODE": 25, + "NAME": 20, + "NAME_BRACE": 40, + "OPTIONS": 47, + "OPTIONS_END": 48, + "OPTION_STRING_VALUE": 49, + "OPTION_VALUE": 50, + "PATH": 52, + "RANGE_REGEX": 45, + "REGEX_SET": 43, + "REGEX_SET_END": 42, + "REGEX_SET_START": 41, + "SPECIAL_GROUP": 38, + "START_COND": 27, + "START_EXC": 22, + "START_INC": 21, + "STRING_LIT": 26, + "UNKNOWN_DECL": 23, + "^": 16, + "action": 68, + "action_body": 69, + "any_group_regex": 78, + "definition": 58, + "definitions": 57, + "error": 2, + "escape_char": 81, + "extra_lexer_module_code": 87, + "import_name": 60, + "import_path": 61, + "include_macro_code": 88, + "init": 56, + "init_code_name": 59, + "lex": 54, + "module_code_chunk": 89, + "name_expansion": 77, + "name_list": 71, + "names_exclusive": 63, + "names_inclusive": 62, + "nonempty_regex_list": 74, + "option": 86, + "option_list": 85, + "optional_module_code_chunk": 90, + "options": 84, + "range_regex": 82, + "regex": 72, + "regex_base": 76, + "regex_concat": 75, + "regex_list": 73, + "regex_set": 79, + "regex_set_atom": 80, + "rule": 67, + "rule_block": 66, + "rules": 64, + "rules_and_epilogue": 55, + "rules_collective": 65, + "start_conditions": 70, + "string": 83, + "{": 3, + "|": 9, + "}": 4 +}, +terminals_: { + 1: "EOF", + 2: "error", + 3: "{", + 4: "}", + 5: "<", + 6: ">", + 7: "*", + 8: ",", + 9: "|", + 10: "(", + 11: ")", + 12: "+", + 13: "?", + 14: "/", + 15: ".", + 16: "^", + 17: "$", + 18: "=", + 19: "%%", + 20: "NAME", + 21: "START_INC", + 22: "START_EXC", + 23: "UNKNOWN_DECL", + 24: "IMPORT", + 25: "INIT_CODE", + 26: "STRING_LIT", + 27: "START_COND", + 28: "ACTION_START", + 29: "BRACKET_MISSING", + 30: "BRACKET_SURPLUS", + 31: "ACTION_END", + 32: "ACTION", + 33: "ACTION_BODY", + 34: "ACTION_BODY_C_COMMENT", + 35: "ACTION_BODY_CPP_COMMENT", + 36: "ACTION_BODY_WHITESPACE", + 37: "INCLUDE_PLACEMENT_ERROR", + 38: "SPECIAL_GROUP", + 39: "/!", + 40: "NAME_BRACE", + 41: "REGEX_SET_START", + 42: "REGEX_SET_END", + 43: "REGEX_SET", + 44: "ESCAPE_CHAR", + 45: "RANGE_REGEX", + 46: "CHARACTER_LIT", + 47: "OPTIONS", + 48: "OPTIONS_END", + 49: "OPTION_STRING_VALUE", + 50: "OPTION_VALUE", + 51: "INCLUDE", + 52: "PATH", + 53: "CODE" +}, +TERROR: 2, +EOF: 1, + +// internals: defined here so the object *structure* doesn't get modified by parse() et al, +// thus helping JIT compilers like Chrome V8. +originalQuoteName: null, +originalParseError: null, +cleanupAfterParse: null, +constructParseErrorInfo: null, +yyMergeLocationInfo: null, + +__reentrant_call_depth: 0, // INTERNAL USE ONLY +__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup + +// APIs which will be set up depending on user action code analysis: +//yyRecovering: 0, +//yyErrOk: 0, +//yyClearIn: 0, + +// Helper APIs +// ----------- + +// Helper function which can be overridden by user code later on: put suitable quotes around +// literal IDs in a description string. +quoteName: function parser_quoteName(id_str) { + return '"' + id_str + '"'; +}, + +// Return the name of the given symbol (terminal or non-terminal) as a string, when available. +// +// Return NULL when the symbol is unknown to the parser. +getSymbolName: function parser_getSymbolName(symbol) { + if (this.terminals_[symbol]) { + return this.terminals_[symbol]; + } + + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. + // + // An example of this may be where a rule's action code contains a call like this: + // + // parser.getSymbolName(#$) + // + // to obtain a human-readable name of the current grammar rule. + var s = this.symbols_; + for (var key in s) { + if (s[key] === symbol) { + return key; + } + } + return null; +}, + +// Return a more-or-less human-readable description of the given symbol, when available, +// or the symbol itself, serving as its own 'description' for lack of something better to serve up. +// +// Return NULL when the symbol is unknown to the parser. +describeSymbol: function parser_describeSymbol(symbol) { + if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { + return this.terminal_descriptions_[symbol]; + } + else if (symbol === this.EOF) { + return 'end of input'; + } + var id = this.getSymbolName(symbol); + if (id) { + return this.quoteName(id); + } + return null; +}, + +// Produce a (more or less) human-readable list of expected tokens at the point of failure. +// +// The produced list may contain token or token set descriptions instead of the tokens +// themselves to help turning this output into something that easier to read by humans +// unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*, +// expected terminals and nonterminals is produced. +// +// The returned list (array) will not contain any duplicate entries. +collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) { + var TERROR = this.TERROR; + var tokenset = []; + var check = {}; + // Has this (error?) state been outfitted with a custom expectations description text for human consumption? + // If so, use that one instead of the less palatable token set. + if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { + return [ + this.state_descriptions_[state] + ]; + } + for (var p in this.table[state]) { + p = +p; + if (p !== TERROR) { + var d = do_not_describe ? p : this.describeSymbol(p); + if (d && !check[d]) { + tokenset.push(d); + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + } + } + } + return tokenset; +}, +productions_: bp({ + pop: u([ + 54, + 54, + s, + [55, 3], + 56, + 57, + 57, + s, + [58, 11], + 59, + 59, + 60, + 60, + 61, + 61, + 62, + 62, + 63, + 63, + 64, + 64, + s, + [65, 4], + 66, + 66, + 67, + 67, + s, + [68, 3], + s, + [69, 9], + s, + [70, 4], + 71, + 71, + 72, + s, + [73, 4], + s, + [74, 4], + 75, + 75, + s, + [76, 17], + 77, + 78, + 78, + 79, + 79, + 80, + s, + [80, 4, 1], + 83, + 84, + 85, + 85, + s, + [86, 6], + 87, + 87, + 88, + 88, + s, + [89, 3], + 90, + 90 +]), + rule: u([ + s, + [4, 3], + 2, + 0, + 0, + 2, + 0, + s, + [2, 3], + s, + [1, 3], + 3, + 3, + 2, + 3, + 3, + s, + [1, 7], + 2, + 1, + 2, + c, + [23, 3], + 4, + 4, + 3, + c, + [29, 4], + s, + [3, 3], + s, + [2, 8], + 0, + s, + [3, 3], + 0, + 1, + 3, + 1, + s, + [3, 4, -1], + c, + [21, 3], + c, + [40, 3], + s, + [3, 4], + s, + [2, 5], + c, + [12, 3], + s, + [1, 6], + c, + [16, 3], + c, + [10, 8], + c, + [9, 3], + s, + [3, 4], + c, + [10, 4], + c, + [32, 5], + 0 +]) +}), +performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyvstack, yylstack) { + + /* this == yyval */ + + // the JS engine itself can go and remove these statements when `yy` turns out to be unused in any action code! + var yy = this.yy; + var yyparser = yy.parser; + var yylexer = yy.lexer; + + + + switch (yystate) { +case 0: + /*! Production:: $accept : lex $end */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yylstack[yysp - 1]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + +case 1: + /*! Production:: lex : init definitions rules_and_epilogue EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + this.$.macros = yyvstack[yysp - 2].macros; + this.$.startConditions = yyvstack[yysp - 2].startConditions; + this.$.unknownDecls = yyvstack[yysp - 2].unknownDecls; + + // if there are any options, add them all, otherwise set options to NULL: + // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: + for (var k in yy.options) { + this.$.options = yy.options; + break; + } + + if (yy.actionInclude) { + var asrc = yy.actionInclude.join('\n\n'); + // Only a non-empty action code chunk should actually make it through: + if (asrc.trim() !== '') { + this.$.actionInclude = asrc; + } + } + + delete yy.options; + delete yy.actionInclude; + return this.$; + break; + +case 2: + /*! Production:: lex : init definitions error EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Maybe you did not correctly separate the lexer sections with a '%%' + on an otherwise empty line? + The lexer spec file should have this structure: + + definitions + %% + rules + %% // <-- optional! + extra_module_code // <-- optional! + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 3: + /*! Production:: rules_and_epilogue : "%%" rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; + } else { + this.$ = { rules: yyvstack[yysp - 2] }; + } + break; + +case 4: + /*! Production:: rules_and_epilogue : "%%" rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: yyvstack[yysp] }; + break; + +case 5: + /*! Production:: rules_and_epilogue : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: [] }; + break; + +case 6: + /*! Production:: init : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.actionInclude = []; + if (!yy.options) yy.options = {}; + break; + +case 7: + /*! Production:: definitions : definitions definition */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + if (yyvstack[yysp] != null) { + if ('length' in yyvstack[yysp]) { + this.$.macros[yyvstack[yysp][0]] = yyvstack[yysp][1]; + } else if (yyvstack[yysp].type === 'names') { + for (var name in yyvstack[yysp].names) { + this.$.startConditions[name] = yyvstack[yysp].names[name]; + } + } else if (yyvstack[yysp].type === 'unknown') { + this.$.unknownDecls.push(yyvstack[yysp].body); + } + } + break; + +case 8: + /*! Production:: definitions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + macros: {}, // { hash table } + startConditions: {}, // { hash table } + unknownDecls: [] // [ array of [key,value] pairs } + }; + break; + +case 9: + /*! Production:: definition : NAME regex */ +case 38: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + +case 10: + /*! Production:: definition : START_INC names_inclusive */ +case 11: + /*! Production:: definition : START_EXC names_exclusive */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + +case 12: + /*! Production:: definition : action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + yy.actionInclude.push(yyvstack[yysp]); this.$ = null; + break; + +case 13: + /*! Production:: definition : options */ +case 99: + /*! Production:: option_list : option */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 14: + /*! Production:: definition : UNKNOWN_DECL */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'unknown', body: yyvstack[yysp]}; + break; + +case 15: + /*! Production:: definition : IMPORT import_name import_path */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp]}; + break; + +case 16: + /*! Production:: definition : IMPORT import_name error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + You did not specify a legal file path for the '%import' initialization code statement, which must have the format: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 17: + /*! Production:: definition : IMPORT error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + %import name or source filename missing maybe? + + Note: each '%import'-ed initialization code section must be qualified by a name, e.g. 'required' before the import path itself: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 18: + /*! Production:: definition : INIT_CODE init_code_name action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + type: 'codesection', + qualifier: yyvstack[yysp - 1], + include: yyvstack[yysp] + }; + break; + +case 19: + /*! Production:: definition : INIT_CODE error action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Each '%code' initialization code section must be qualified by a name, e.g. 'required' before the action code itself: + %code qualifier_name {action code} + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 20: + /*! Production:: init_code_name : NAME */ +case 21: + /*! Production:: init_code_name : STRING_LIT */ +case 22: + /*! Production:: import_name : NAME */ +case 23: + /*! Production:: import_name : STRING_LIT */ +case 24: + /*! Production:: import_path : NAME */ +case 25: + /*! Production:: import_path : STRING_LIT */ +case 61: + /*! Production:: regex_list : regex_concat */ +case 66: + /*! Production:: nonempty_regex_list : regex_concat */ +case 68: + /*! Production:: regex_concat : regex_base */ +case 93: + /*! Production:: escape_char : ESCAPE_CHAR */ +case 94: + /*! Production:: range_regex : RANGE_REGEX */ +case 106: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ +case 110: + /*! Production:: module_code_chunk : CODE */ +case 113: + /*! Production:: optional_module_code_chunk : module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + +case 26: + /*! Production:: names_inclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; + break; + +case 27: + /*! Production:: names_inclusive : names_inclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; + break; + +case 28: + /*! Production:: names_exclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; + break; + +case 29: + /*! Production:: names_exclusive : names_exclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; + break; + +case 30: + /*! Production:: rules : rules rules_collective */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); + break; + +case 31: + /*! Production:: rules : %epsilon */ +case 37: + /*! Production:: rule_block : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = []; + break; + +case 32: + /*! Production:: rules_collective : start_conditions rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 1]) { + yyvstack[yysp].unshift(yyvstack[yysp - 1]); + } + this.$ = [yyvstack[yysp]]; + break; + +case 33: + /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 3]) { + yyvstack[yysp - 1].forEach(function (d) { + d.unshift(yyvstack[yysp - 3]); + }); + } + this.$ = yyvstack[yysp - 1]; + break; + +case 34: + /*! Production:: rules_collective : start_conditions "{" error "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you made a mistake while specifying one of the lexer rules inside + the start condition + <${yyvstack[yysp - 3].join(',')}> { rules... } + block. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 35: + /*! Production:: rules_collective : start_conditions "{" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lexer rules set inside + the start condition + <${yyvstack[yysp - 2].join(',')}> { rules... } + as a terminating curly brace '}' could not be found. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 36: + /*! Production:: rule_block : rule_block rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); + break; + +case 39: + /*! Production:: rule : regex error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + yyparser.yyError(rmCommonWS` + Lexer rule regex action code declaration error? + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 40: + /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + `); + break; + +case 41: + /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + `); + break; + +case 42: + /*! Production:: action : ACTION_START action_body ACTION_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var s = yyvstack[yysp - 1].trim(); + // remove outermost set of braces UNLESS there's + // a curly brace in there anywhere: in that case + // we should leave it up to the sophisticated + // code analyzer to simplify the code! + // + // This is a very rough check as it will also look + // inside code comments, which should not have + // any influence. + // + // Nevertheless: this is a *safe* transform! + if (s[0] === '{' && s.indexOf('}') === s.length - 1) { + this.$ = s.substring(1, s.length - 1).trim(); + } else { + this.$ = s; + } + break; + +case 43: + /*! Production:: action_body : action_body ACTION */ +case 48: + /*! Production:: action_body : action_body include_macro_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; + break; + +case 44: + /*! Production:: action_body : action_body ACTION_BODY */ +case 45: + /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ +case 46: + /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ +case 47: + /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ +case 67: + /*! Production:: regex_concat : regex_concat regex_base */ +case 79: + /*! Production:: regex_base : regex_base range_regex */ +case 89: + /*! Production:: regex_set : regex_set regex_set_atom */ +case 111: + /*! Production:: module_code_chunk : module_code_chunk CODE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 49: + /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + You may place the '%include' instruction only at the start/front of a line. + + It's use is not permitted at this position: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + `); + break; + +case 50: + /*! Production:: action_body : action_body error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 51: + /*! Production:: action_body : %epsilon */ +case 62: + /*! Production:: regex_list : %epsilon */ +case 114: + /*! Production:: optional_module_code_chunk : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ''; + break; + +case 52: + /*! Production:: start_conditions : "<" name_list ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + break; + +case 53: + /*! Production:: start_conditions : "<" name_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly terminate the start condition set <${yyvstack[yysp - 1].join(',')},???> with a terminating '>' + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 54: + /*! Production:: start_conditions : "<" "*" ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ['*']; + break; + +case 55: + /*! Production:: start_conditions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + +case 56: + /*! Production:: name_list : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp]]; + break; + +case 57: + /*! Production:: name_list : name_list "," NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); + break; + +case 58: + /*! Production:: regex : nonempty_regex_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Detect if the regex ends with a pure (Unicode) word; + // we *do* consider escaped characters which are 'alphanumeric' + // to be equivalent to their non-escaped version, hence these are + // all valid 'words' for the 'easy keyword rules' option: + // + // - hello_kitty + // - γεια_σου_γατοÏλα + // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 + // + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // + // As we only check the *tail*, we also accept these as + // 'easy keywords': + // + // - %options + // - %foo-bar + // - +++a:b:c1 + // + // Note the dash in that last example: there the code will consider + // `bar` to be the keyword, which is fine with us as we're only + // interested in the trailing boundary and patching that one for + // the `easy_keyword_rules` option. + this.$ = yyvstack[yysp]; + if (yy.options.easy_keyword_rules) { + // We need to 'protect' `eval` here as keywords are allowed + // to contain double-quotes and other leading cruft. + // `eval` *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `eval(str)` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. + this.$ = this.$ + .replace(/\\\\/g, '.') + .replace(/"/g, '.') + .replace(/\\c[A-Z]/g, '.') + .replace(/\\[^xu0-9]/g, '.'); + + try { + // Convert Unicode escapes and other escapes to their literal characters + // BEFORE we go and check whether this item is subject to the + // `easy_keyword_rules` option. + this.$ = JSON.parse('"' + this.$ + '"'); + } + catch (ex) { + yyparser.warn('easy-keyword-rule FAIL on eval: ', ex); + + // make the next keyword test fail: + this.$ = '.'; + } + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: + var re = new XRegExp('\\w[\\w\\d]*$'); + if (XRegExp.match(this.$, re)) { + this.$ = yyvstack[yysp] + "\\b"; + } else { + this.$ = yyvstack[yysp]; + } + } + break; + +case 59: + /*! Production:: regex_list : regex_list "|" regex_concat */ +case 63: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; + break; + +case 60: + /*! Production:: regex_list : regex_list "|" */ +case 64: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '|'; + break; + +case 65: + /*! Production:: nonempty_regex_list : "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '|' + yyvstack[yysp]; + break; + +case 69: + /*! Production:: regex_base : "(" regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(' + yyvstack[yysp - 1] + ')'; + break; + +case 70: + /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; + break; + +case 71: + /*! Production:: regex_base : "(" regex_list error */ +case 72: + /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lex rule regex part in '(...)' braces. + + Unterminated regex part: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 73: + /*! Production:: regex_base : regex_base "+" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '+'; + break; + +case 74: + /*! Production:: regex_base : regex_base "*" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '*'; + break; + +case 75: + /*! Production:: regex_base : regex_base "?" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '?'; + break; + +case 76: + /*! Production:: regex_base : "/" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?=' + yyvstack[yysp] + ')'; + break; + +case 77: + /*! Production:: regex_base : "/!" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?!' + yyvstack[yysp] + ')'; + break; + +case 78: + /*! Production:: regex_base : name_expansion */ +case 80: + /*! Production:: regex_base : any_group_regex */ +case 84: + /*! Production:: regex_base : string */ +case 85: + /*! Production:: regex_base : escape_char */ +case 86: + /*! Production:: name_expansion : NAME_BRACE */ +case 90: + /*! Production:: regex_set : regex_set_atom */ +case 91: + /*! Production:: regex_set_atom : REGEX_SET */ +case 96: + /*! Production:: string : CHARACTER_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + +case 81: + /*! Production:: regex_base : "." */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '.'; + break; + +case 82: + /*! Production:: regex_base : "^" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '^'; + break; + +case 83: + /*! Production:: regex_base : "$" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '$'; + break; + +case 87: + /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ +case 107: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 88: + /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. + + Unterminated regex set: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 92: + /*! Production:: regex_set_atom : name_expansion */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) + && yyvstack[yysp].toUpperCase() !== yyvstack[yysp] + ) { + // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories + this.$ = yyvstack[yysp]; + } else { + this.$ = yyvstack[yysp]; + } + //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + break; + +case 95: + /*! Production:: string : STRING_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = prepareString(yyvstack[yysp]); + break; + +case 97: + /*! Production:: options : OPTIONS option_list OPTIONS_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 98: + /*! Production:: option_list : option option_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 100: + /*! Production:: option : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp]] = true; + break; + +case 101: + /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; + break; + +case 102: + /*! Production:: option : NAME "=" OPTION_VALUE */ +case 103: + /*! Production:: option : NAME "=" NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); + break; + +case 104: + /*! Production:: option : NAME "=" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS` + Internal error: option "${$option}" value assignment failure. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 105: + /*! Production:: option : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS` + Expected a valid option name (with optional value assignment). + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 108: + /*! Production:: include_macro_code : INCLUDE PATH */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); + // And no, we don't support nested '%include': + this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; + break; + +case 109: + /*! Production:: include_macro_code : INCLUDE error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + %include MUST be followed by a valid file path. + + Erroneous path: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 112: + /*! Production:: module_code_chunk : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS` + Module code declaration error? + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! + // error recovery reduction action (action generated by jison, + // using the user-specified `%code error_recovery_reduction` %{...%} + // code chunk below. + + + break; + +} +}, +table: bt({ + len: u([ + 13, + 1, + 12, + 15, + 1, + 1, + 11, + 18, + 21, + 2, + 2, + s, + [11, 3], + 4, + 4, + 12, + 4, + 1, + 1, + 19, + 11, + 12, + 18, + 29, + 30, + 22, + 22, + 17, + 17, + s, + [29, 7], + 31, + 5, + s, + [29, 3], + s, + [12, 4], + 4, + 11, + 3, + 3, + 2, + 2, + 1, + 1, + 12, + 1, + 5, + 4, + 3, + 7, + 17, + 23, + 3, + 30, + 29, + 30, + s, + [29, 5], + 3, + 20, + 3, + 30, + 30, + 6, + s, + [4, 3], + 12, + 12, + s, + [11, 6], + s, + [27, 3], + s, + [11, 8], + 2, + 11, + 1, + 4, + 3, + 2, + s, + [3, 3], + 17, + 16, + 3, + 3, + 1, + 3, + s, + [29, 3], + 21, + s, + [29, 4], + 4, + 13, + 13, + s, + [3, 4], + 6, + 3, + 23, + s, + [18, 3], + 14, + 14, + 1, + 14, + 20, + 2, + 17, + 14, + 17, + 3 +]), + symbol: u([ + 1, + 2, + s, + [19, 7, 1], + 28, + 47, + 54, + 56, + 1, + c, + [14, 11], + 57, + c, + [12, 11], + 55, + 58, + 68, + 84, + s, + [1, 3], + c, + [17, 10], + 1, + 3, + 5, + 9, + 10, + s, + [14, 4, 1], + 19, + 26, + s, + [38, 4, 1], + 44, + 46, + 64, + c, + [15, 6], + c, + [14, 7], + 72, + s, + [74, 5, 1], + 81, + 83, + 27, + 62, + 27, + 63, + c, + [54, 12], + c, + [11, 21], + 2, + 20, + 26, + 60, + c, + [4, 3], + 59, + 2, + s, + [29, 9, 1], + 51, + 69, + 2, + 20, + 85, + 86, + s, + [1, 3], + c, + [102, 16], + 65, + 70, + c, + [67, 13], + 9, + c, + [12, 9], + c, + [125, 12], + c, + [123, 6], + c, + [30, 3], + c, + [59, 6], + s, + [20, 7, 1], + 28, + c, + [29, 6], + 47, + c, + [29, 7], + 7, + s, + [9, 9, 1], + c, + [33, 14], + 45, + 46, + 47, + 82, + c, + [58, 3], + 11, + c, + [80, 11], + 73, + c, + [81, 6], + c, + [22, 22], + c, + [121, 12], + c, + [17, 22], + c, + [108, 29], + c, + [29, 199], + s, + [42, 6, 1], + 40, + 43, + 77, + 79, + 80, + c, + [123, 89], + c, + [19, 7], + 27, + c, + [572, 11], + c, + [12, 27], + c, + [593, 3], + 61, + c, + [612, 14], + c, + [3, 3], + 28, + 68, + 28, + 68, + 28, + 28, + c, + [616, 11], + 88, + 48, + 2, + 20, + 48, + 85, + 86, + 2, + 18, + 20, + c, + [9, 4], + 1, + 2, + 51, + 53, + 87, + 89, + 90, + c, + [630, 17], + 3, + c, + [732, 13], + 67, + c, + [733, 8], + 7, + 20, + 71, + c, + [613, 24], + c, + [643, 65], + c, + [507, 145], + 2, + 9, + 11, + c, + [769, 15], + c, + [789, 7], + 11, + c, + [201, 59], + 82, + 2, + 40, + 42, + 43, + 77, + 80, + c, + [6, 4], + c, + [4, 8], + c, + [476, 33], + c, + [11, 59], + 3, + 4, + c, + [473, 8], + c, + [401, 15], + c, + [27, 54], + c, + [584, 11], + c, + [11, 78], + 52, + c, + [182, 11], + c, + [664, 3], + 49, + 50, + 1, + 51, + 88, + 1, + 51, + 1, + 51, + 53, + c, + [3, 7], + c, + [672, 16], + 2, + 4, + c, + [673, 13], + 66, + 2, + 28, + 68, + 2, + 6, + 8, + 6, + c, + [4, 3], + c, + [642, 58], + c, + [525, 31], + c, + [522, 13], + c, + [750, 8], + c, + [662, 115], + c, + [562, 5], + c, + [315, 10], + 53, + c, + [13, 13], + c, + [979, 3], + c, + [3, 9], + c, + [988, 4], + c, + [987, 3], + 51, + 53, + c, + [300, 14], + c, + [973, 9], + 1, + c, + [487, 10], + c, + [27, 7], + c, + [18, 36], + c, + [1050, 14], + c, + [14, 14], + 20, + c, + [15, 14], + c, + [830, 20], + c, + [469, 3], + c, + [460, 16], + c, + [159, 14], + c, + [491, 18], + 6, + 8 +]), + type: u([ + s, + [2, 11], + 0, + 0, + 1, + c, + [14, 12], + c, + [26, 13], + 0, + c, + [15, 12], + s, + [2, 19], + c, + [31, 14], + s, + [0, 8], + c, + [23, 3], + c, + [56, 31], + c, + [62, 10], + c, + [112, 13], + c, + [67, 4], + c, + [40, 20], + c, + [78, 36], + c, + [123, 7], + c, + [30, 28], + c, + [203, 43], + c, + [205, 9], + c, + [22, 34], + c, + [17, 34], + s, + [2, 224], + c, + [239, 141], + c, + [139, 19], + c, + [655, 16], + c, + [14, 5], + c, + [180, 13], + c, + [194, 34], + s, + [0, 9], + c, + [98, 21], + c, + [643, 86], + c, + [492, 151], + c, + [494, 34], + c, + [231, 35], + c, + [802, 238], + c, + [716, 74], + c, + [44, 28], + c, + [708, 37], + c, + [522, 78], + c, + [454, 163], + c, + [164, 19], + c, + [973, 11], + c, + [830, 147], + s, + [2, 21] +]), + state: u([ + s, + [1, 4, 1], + 6, + 11, + 12, + 20, + 21, + 22, + 24, + 25, + 30, + 31, + 36, + 35, + 42, + 44, + 46, + 50, + 54, + 55, + 56, + 60, + 61, + 64, + c, + [15, 5], + 65, + c, + [5, 4], + 69, + 71, + 72, + c, + [13, 5], + 73, + c, + [7, 6], + 74, + c, + [5, 4], + 75, + c, + [5, 4], + 79, + 76, + 77, + 82, + 86, + 87, + 96, + 101, + 56, + 103, + 105, + 104, + 108, + 110, + c, + [66, 7], + 111, + 114, + c, + [58, 11], + c, + [6, 6], + 69, + 79, + 122, + 129, + 131, + 133, + c, + [12, 5], + 139, + c, + [29, 5], + 105, + 140, + 142, + c, + [47, 8], + c, + [22, 5] +]), + mode: u([ + s, + [2, 23], + s, + [1, 12], + s, + [2, 28], + s, + [1, 15], + s, + [2, 33], + c, + [39, 17], + c, + [13, 6], + c, + [18, 7], + c, + [64, 21], + c, + [21, 10], + c, + [106, 15], + c, + [75, 12], + 1, + c, + [90, 10], + c, + [27, 6], + c, + [72, 23], + c, + [40, 8], + c, + [45, 7], + c, + [15, 13], + s, + [1, 24], + s, + [2, 234], + c, + [236, 98], + c, + [97, 24], + c, + [24, 15], + c, + [374, 20], + c, + [432, 5], + c, + [409, 15], + c, + [568, 9], + c, + [47, 20], + c, + [454, 17], + c, + [561, 23], + c, + [585, 53], + c, + [442, 145], + c, + [718, 19], + c, + [780, 33], + c, + [29, 25], + c, + [759, 238], + c, + [796, 51], + c, + [289, 5], + c, + [1211, 12], + c, + [722, 35], + c, + [340, 9], + c, + [648, 24], + c, + [854, 59], + c, + [1199, 170], + c, + [311, 6], + c, + [969, 23], + c, + [1128, 90], + c, + [291, 66] +]), + goto: u([ + s, + [6, 11], + s, + [8, 11], + 5, + 5, + s, + [7, 4, 1], + s, + [13, 7, 1], + s, + [7, 11], + s, + [31, 17], + 23, + 26, + 28, + 32, + 33, + 34, + 39, + 27, + 29, + 37, + 38, + 41, + 40, + 43, + 45, + s, + [12, 11], + s, + [13, 11], + s, + [14, 11], + 47, + 48, + 49, + 51, + 52, + 53, + s, + [51, 11], + 58, + 57, + 1, + 2, + 4, + 55, + 62, + s, + [55, 6], + 59, + s, + [55, 7], + s, + [9, 11], + 58, + 58, + 63, + s, + [58, 9], + c, + [108, 12], + s, + [66, 3], + c, + [15, 5], + s, + [66, 7], + 39, + 66, + c, + [23, 7], + 68, + 68, + 67, + s, + [68, 3], + c, + [7, 3], + s, + [68, 17], + 70, + 68, + 68, + 62, + 62, + 26, + 62, + c, + [68, 11], + c, + [15, 15], + c, + [95, 12], + c, + [12, 12], + s, + [78, 29], + s, + [80, 29], + s, + [81, 29], + s, + [82, 29], + s, + [83, 29], + s, + [84, 29], + s, + [85, 29], + s, + [86, 31], + 37, + 78, + s, + [95, 29], + s, + [96, 29], + s, + [93, 29], + s, + [10, 9], + 80, + 10, + 10, + s, + [26, 12], + s, + [11, 9], + 81, + 11, + 11, + s, + [28, 12], + 83, + 84, + 85, + s, + [17, 11], + s, + [22, 3], + s, + [23, 3], + 16, + 16, + 20, + 21, + 98, + s, + [88, 8, 1], + 97, + 99, + 100, + 58, + 57, + 99, + 100, + 102, + 100, + 100, + s, + [105, 3], + 114, + 107, + 114, + 106, + s, + [30, 17], + 109, + c, + [667, 13], + 112, + 113, + s, + [64, 3], + c, + [17, 5], + s, + [64, 7], + 39, + 64, + c, + [25, 6], + 64, + s, + [65, 3], + c, + [24, 5], + s, + [65, 7], + 39, + 65, + c, + [24, 6], + 65, + s, + [67, 6], + 66, + 68, + s, + [67, 18], + 70, + 67, + 67, + s, + [73, 29], + s, + [74, 29], + s, + [75, 29], + s, + [79, 29], + s, + [94, 29], + 116, + 117, + 115, + 61, + 61, + 26, + 61, + c, + [242, 11], + 119, + 117, + 118, + 76, + 76, + 67, + s, + [76, 3], + 66, + 68, + s, + [76, 18], + 70, + 76, + 76, + 77, + 77, + 67, + s, + [77, 3], + 66, + 68, + s, + [77, 18], + 70, + 77, + 77, + 121, + 37, + 120, + 78, + s, + [90, 4], + s, + [91, 4], + s, + [92, 4], + s, + [27, 12], + s, + [29, 12], + s, + [15, 11], + s, + [16, 11], + s, + [24, 11], + s, + [25, 11], + s, + [18, 11], + s, + [19, 11], + s, + [40, 27], + s, + [41, 27], + s, + [42, 27], + s, + [43, 11], + s, + [44, 11], + s, + [45, 11], + s, + [46, 11], + s, + [47, 11], + s, + [48, 11], + s, + [49, 11], + s, + [50, 11], + 124, + 123, + s, + [97, 11], + 98, + 128, + 127, + 125, + 126, + 3, + 99, + 106, + 106, + 113, + 113, + 130, + s, + [110, 3], + s, + [112, 3], + s, + [32, 17], + 132, + s, + [37, 14], + 134, + 16, + 136, + 135, + 137, + 138, + s, + [56, 3], + s, + [63, 3], + c, + [624, 5], + s, + [63, 7], + 39, + 63, + c, + [431, 6], + 63, + s, + [69, 29], + s, + [71, 29], + 60, + 60, + 26, + 60, + c, + [505, 11], + s, + [70, 29], + s, + [72, 29], + s, + [87, 29], + s, + [88, 29], + s, + [89, 4], + s, + [108, 13], + s, + [109, 13], + s, + [101, 3], + s, + [102, 3], + s, + [103, 3], + s, + [104, 3], + c, + [940, 4], + s, + [111, 3], + 141, + c, + [926, 13], + 35, + 35, + 143, + s, + [35, 15], + s, + [38, 18], + s, + [39, 18], + s, + [52, 14], + s, + [53, 14], + 144, + s, + [54, 14], + 59, + 59, + 26, + 59, + c, + [112, 11], + 107, + 107, + s, + [33, 17], + s, + [36, 14], + s, + [34, 17], + s, + [57, 3] +]) +}), +defaultActions: bda({ + idx: u([ + 0, + 2, + 6, + 7, + 11, + 12, + 13, + 16, + 18, + 19, + 21, + s, + [30, 8, 1], + 39, + 40, + s, + [41, 4, 2], + 48, + 49, + 52, + 53, + 58, + 60, + s, + [66, 5, 1], + s, + [77, 22, 1], + 100, + 101, + 104, + 106, + 107, + 108, + 113, + 115, + 116, + s, + [118, 11, 1], + 130, + s, + [133, 4, 1], + 138, + s, + [140, 5, 1] +]), + goto: u([ + 6, + 8, + 7, + 31, + 12, + 13, + 14, + 51, + 1, + 2, + 9, + 78, + s, + [80, 7, 1], + 95, + 96, + 93, + 26, + 28, + 17, + 22, + 23, + 20, + 21, + 105, + 30, + 73, + 74, + 75, + 79, + 94, + 90, + 91, + 92, + 27, + 29, + 15, + 16, + 24, + 25, + 18, + 19, + s, + [40, 11, 1], + 97, + 98, + 106, + 110, + 112, + 32, + 56, + 69, + 71, + 70, + 72, + 87, + 88, + 89, + 108, + 109, + s, + [101, 4, 1], + 111, + 38, + 39, + 52, + 53, + 54, + 107, + 33, + 36, + 34, + 57 +]) +}), +parseError: function parseError(str, hash, ExceptionClass) { + if (hash.recoverable && typeof this.trace === 'function') { + this.trace(str); + hash.destroy(); // destroy... well, *almost*! + } else { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + throw new ExceptionClass(str, hash); + } +}, +parse: function parse(input) { + var self = this; + var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage) + var sstack = new Array(128); // state stack: stores states (column storage) + + var vstack = new Array(128); // semantic value stack + var lstack = new Array(128); // location stack + var table = this.table; + var sp = 0; // 'stack pointer': index into the stacks + var yyloc; + + var symbol = 0; + var preErrorSymbol = 0; + var lastEofErrorStateDepth = 0; + var recoveringErrorInfo = null; + var recovering = 0; // (only used when the grammar contains error recovery rules) + var TERROR = this.TERROR; + var EOF = this.EOF; + var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; + var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + + var lexer; + if (this.__lexer__) { + lexer = this.__lexer__; + } else { + lexer = this.__lexer__ = Object.create(this.lexer); + } + + var sharedState_yy = { + parseError: undefined, + quoteName: undefined, + lexer: undefined, + parser: undefined, + pre_parse: undefined, + post_parse: undefined, + pre_lex: undefined, + post_lex: undefined + }; + + if (typeof assert !== 'function') { + assert = function JisonAssert(cond, msg) { + if (!cond) { + throw new Error('assertion failed: ' + (msg || '***')); + } + }; + } + + this.yyGetSharedState = function yyGetSharedState() { + return sharedState_yy; + }; + + + this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() { + return recoveringErrorInfo; + }; + + + // shallow clone objects, straight copy of simple `src` values + // e.g. `lexer.yytext` MAY be a complex value object, + // rather than a simple string/value. + function shallow_copy(src) { + if (typeof src === 'object') { + var dst = {}; + for (var k in src) { + if (Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + return dst; + } + return src; + } + function shallow_copy_noclobber(dst, src) { + for (var k in src) { + if (typeof dst[k] === 'undefined' && Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + } + function copy_yylloc(loc) { + var rv = shallow_copy(loc); + if (rv && rv.range) { + rv.range = rv.range.slice(0); + } + return rv; + } + + // copy state + shallow_copy_noclobber(sharedState_yy, this.yy); + + sharedState_yy.lexer = lexer; + sharedState_yy.parser = this; + + + + + + // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount + // to have *their* closure match ours -- if we only set them up once, + // any subsequent `parse()` runs will fail in very obscure ways when + // these functions are invoked in the user action code block(s) as + // their closure will still refer to the `parse()` instance which set + // them up. Hence we MUST set them up at the start of every `parse()` run! + if (this.yyError) { + this.yyError = function yyError(str /*, ...args */) { + + + + + + + + + + + + var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1); + var expected = this.collect_expected_token_set(state); + var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0)); + // append to the old one? + if (recoveringErrorInfo) { + var esp = recoveringErrorInfo.info_stack_pointer; + + recoveringErrorInfo.symbol_stack[esp] = symbol; + var v = this.shallowCopyErrorInfo(hash); + v.yyError = true; + v.errorRuleDepth = error_rule_depth; + v.recovering = recovering; + // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH; + + recoveringErrorInfo.value_stack[esp] = v; + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + } else { + recoveringErrorInfo = this.shallowCopyErrorInfo(hash); + recoveringErrorInfo.yyError = true; + recoveringErrorInfo.errorRuleDepth = error_rule_depth; + recoveringErrorInfo.recovering = recovering; + } + + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + if (args.length) { + hash.extra_error_attributes = args; + } + + var r = this.parseError(str, hash, this.JisonParserError); + return r; + }; + } + + + + + + + + // Does the shared state override the default `parseError` that already comes with this instance? + if (typeof sharedState_yy.parseError === 'function') { + this.parseError = function parseErrorAlt(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + return sharedState_yy.parseError.call(this, str, hash, ExceptionClass); + }; + } else { + this.parseError = this.originalParseError; + } + + // Does the shared state override the default `quoteName` that already comes with this instance? + if (typeof sharedState_yy.quoteName === 'function') { + this.quoteName = function quoteNameAlt(id_str) { + return sharedState_yy.quoteName.call(this, id_str); + }; + } else { + this.quoteName = this.originalQuoteName; + } + + // set up the cleanup function; make it an API so that external code can re-use this one in case of + // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which + // case this parse() API method doesn't come with a `finally { ... }` block any more! + // + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `sharedState`, etc. references will be *wrong*! + this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) { + var rv; + + if (invoke_post_methods) { + var hash; + + if (sharedState_yy.post_parse || this.post_parse) { + // create an error hash info instance: we re-use this API in a **non-error situation** + // as this one delivers all parser internals ready for access by userland code. + hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false); + } + + if (sharedState_yy.post_parse) { + rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + if (this.post_parse) { + rv = this.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + + // cleanup: + if (hash && hash.destroy) { + hash.destroy(); + } + } + + if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. + + // clean up the lingering lexer structures as well: + if (lexer.cleanupAfterLex) { + lexer.cleanupAfterLex(do_not_nuke_errorinfos); + } + + // prevent lingering circular references from causing memory leaks: + if (sharedState_yy) { + sharedState_yy.lexer = undefined; + sharedState_yy.parser = undefined; + if (lexer.yy === sharedState_yy) { + lexer.yy = undefined; + } + } + sharedState_yy = undefined; + this.parseError = this.originalParseError; + this.quoteName = this.originalQuoteName; + + // nuke the vstack[] array at least as that one will still reference obsoleted user values. + // To be safe, we nuke the other internal stack columns as well... + stack.length = 0; // fastest way to nuke an array without overly bothering the GC + sstack.length = 0; + lstack.length = 0; + vstack.length = 0; + sp = 0; + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_infos.length = 0; + + + for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) { + var el = this.__error_recovery_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_recovery_infos.length = 0; + + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + recoveringErrorInfo = undefined; + } + + + } + + return resultValue; + }; + + // merge yylloc info into a new yylloc instance. + // + // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array. + // + // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which + // case these override the corresponding first/last indexes. + // + // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search + // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!) + // yylloc info. + // + // Note: epsilon rule's yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL. + this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) { + var i1 = first_index | 0, + i2 = last_index | 0; + var l1 = first_yylloc, + l2 = last_yylloc; + var rv; + + // rules: + // - first/last yylloc entries override first/last indexes + + if (!l1) { + if (first_index != null) { + for (var i = i1; i <= i2; i++) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + } + + if (!l2) { + if (last_index != null) { + for (var i = i2; i >= i1; i--) { + l2 = lstack[i]; + if (l2) { + break; + } + } + } + } + + // - detect if an epsilon rule is being processed and act accordingly: + if (!l1 && first_index == null) { + // epsilon rule span merger. With optional look-ahead in l2. + if (!dont_look_back) { + for (var i = (i1 || sp) - 1; i >= 0; i--) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + if (!l1) { + if (!l2) { + // when we still don't have any valid yylloc info, we're looking at an epsilon rule + // without look-ahead and no preceding terms and/or `dont_look_back` set: + // in that case we ca do nothing but return NULL/UNDEFINED: + return undefined; + } else { + // shallow-copy L2: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l2); + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + return rv; + } + } else { + // shallow-copy L1, then adjust first col/row 1 column past the end. + rv = shallow_copy(l1); + rv.first_line = rv.last_line; + rv.first_column = rv.last_column; + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + rv.range[0] = rv.range[1]; + } + + if (l2) { + // shallow-mixin L2, then adjust last col/row accordingly. + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + return rv; + } + } + + if (!l1) { + l1 = l2; + l2 = null; + } + if (!l1) { + return undefined; + } + + // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l1); + + // first_line: ..., + // first_column: ..., + // last_line: ..., + // last_column: ..., + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + + if (l2) { + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + + return rv; + }; + + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `lexer`, `sharedState`, etc. references will be *wrong*! + this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { + var pei = { + errStr: msg, + exception: ex, + text: lexer.match, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, + token_id: symbol, + line: lexer.yylineno, + loc: copy_yylloc(lexer.yylloc), + expected: expected, + recoverable: recoverable, + state: state, + action: action, + new_state: newState, + symbol_stack: stack, + state_stack: sstack, + value_stack: vstack, + location_stack: lstack, + stack_pointer: sp, + yy: sharedState_yy, + lexer: lexer, + parser: this, + + // and make sure the error info doesn't stay due to potential + // ref cycle via userland code manipulations. + // These would otherwise all be memory leak opportunities! + // + // Note that only array and object references are nuked as those + // constitute the set of elements which can produce a cyclic ref. + // The rest of the members is kept intact as they are harmless. + destroy: function destructParseErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // info.value = null; + // info.value_stack = null; + // ... + var rec = !!this.recoverable; + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; + } + } + this.recoverable = rec; + } + }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + return pei; + }; + + // clone some parts of the (possibly enhanced!) errorInfo object + // to give them some persistence. + this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) { + var rv = shallow_copy(p); + + // remove the large parts which can only cause cyclic references + // and are otherwise available from the parser kernel anyway. + delete rv.sharedState_yy; + delete rv.parser; + delete rv.lexer; + + // lexer.yytext MAY be a complex value object, rather than a simple string/value: + rv.value = shallow_copy(rv.value); + + // yylloc info: + rv.loc = copy_yylloc(rv.loc); + + // the 'expected' set won't be modified, so no need to clone it: + //rv.expected = rv.expected.slice(0); + + //symbol stack is a simple array: + rv.symbol_stack = rv.symbol_stack.slice(0); + // ditto for state stack: + rv.state_stack = rv.state_stack.slice(0); + // clone the yylloc's in the location stack?: + rv.location_stack = rv.location_stack.map(copy_yylloc); + // and the value stack may carry both simple and complex values: + // shallow-copy the latter. + rv.value_stack = rv.value_stack.map(shallow_copy); + + // and we don't bother with the sharedState_yy reference: + //delete rv.yy; + + // now we prepare for tracking the COMBINE actions + // in the error recovery code path: + // + // as we want to keep the maximum error info context, we + // *scan* the state stack to find the first *empty* slot. + // This position will surely be AT OR ABOVE the current + // stack pointer, but we want to keep the 'used but discarded' + // part of the parse stacks *intact* as those slots carry + // error context that may be useful when you want to produce + // very detailed error diagnostic reports. + // + // ### Purpose of each stack pointer: + // + // - stack_pointer: points at the top of the parse stack + // **as it existed at the time of the error + // occurrence, i.e. at the time the stack + // snapshot was taken and copied into the + // errorInfo object.** + // - base_pointer: the bottom of the **empty part** of the + // stack, i.e. **the start of the rest of + // the stack space /above/ the existing + // parse stack. This section will be filled + // by the error recovery process as it + // travels the parse state machine to + // arrive at the resolving error recovery rule.** + // - info_stack_pointer: + // this stack pointer points to the **top of + // the error ecovery tracking stack space**, i.e. + // this stack pointer takes up the role of + // the `stack_pointer` for the error recovery + // process. Any mutations in the **parse stack** + // are **copy-appended** to this part of the + // stack space, keeping the bottom part of the + // stack (the 'snapshot' part where the parse + // state at the time of error occurrence was kept) + // intact. + // - root_failure_pointer: + // copy of the `stack_pointer`... + // + for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== 'undefined'; i++) { + // empty + } + rv.base_pointer = i; + rv.info_stack_pointer = i; + + rv.root_failure_pointer = rv.stack_pointer; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_recovery_infos.push(rv); + + return rv; + }; + + function getNonTerminalFromCode(symbol) { + var tokenName = self.getSymbolName(symbol); + if (!tokenName) { + tokenName = symbol; + } + return tokenName; + } + + + function lex() { + var token = lexer.lex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + if (typeof Jison !== 'undefined' && Jison.lexDebugger) { + var tokenName = self.getSymbolName(token || EOF); + if (!tokenName) { + tokenName = token; + } + + Jison.lexDebugger.push({ + tokenName: tokenName, + tokenText: lexer.match, + tokenValue: lexer.yytext + }); + } + + return token || EOF; + } + + + var state, action, r, t; + var yyval = { + $: true, + _$: undefined, + yy: sharedState_yy + }; + var p; + var yyrulelen; + var this_production; + var newState; + var retval = false; + + + // Return the rule stack depth where the nearest error rule can be found. + // Return -1 when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = sp - 1; + var depth = 0; + + // try to recover from error + for (;;) { + // check for error recovery rule in this state + + + + + + + + + + var t = table[state][TERROR] || NO_ACTION; + if (t[0]) { + // We need to make sure we're not cycling forever: + // once we hit EOF, even when we `yyerrok()` an error, we must + // prevent the core from running forever, + // e.g. when parent rules are still expecting certain input to + // follow after this, for example when you handle an error inside a set + // of braces which are matched by a parent rule in your grammar. + // + // Hence we require that every error handling/recovery attempt + // *after we've hit EOF* has a diminishing state stack: this means + // we will ultimately have unwound the state stack entirely and thus + // terminate the parse in a controlled fashion even when we have + // very complex error/recovery code interplay in the core + user + // action code blocks: + + + + + + + + + + if (symbol === EOF) { + if (!lastEofErrorStateDepth) { + lastEofErrorStateDepth = sp - 1 - depth; + } else if (lastEofErrorStateDepth <= sp - 1 - depth) { + + + + + + + + + + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + continue; + } + } + return depth; + } + if (state === 0 /* $accept rule */ || stack_probe < 1) { + + + + + + + + + + return -1; // No suitable error recovery rule available. + } + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + } + } + + + try { + this.__reentrant_call_depth++; + + lexer.setInput(input, sharedState_yy); + + yyloc = lexer.yylloc; + lstack[sp] = yyloc; + vstack[sp] = null; + sstack[sp] = 0; + stack[sp] = 0; + ++sp; + + + + + + if (this.pre_parse) { + this.pre_parse.call(this, sharedState_yy); + } + if (sharedState_yy.pre_parse) { + sharedState_yy.pre_parse.call(this, sharedState_yy); + } + + newState = sstack[sp - 1]; + for (;;) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // The single `==` condition below covers both these `===` comparisons in a single + // operation: + // + // if (symbol === null || typeof symbol === 'undefined') ... + if (!symbol) { + symbol = lex(); + } + // read action for current state and first input + t = (table[state] && table[state][symbol]) || NO_ACTION; + newState = t[1]; + action = t[0]; + + + + + + + + + + + + // handle parse error + if (!action) { + // first see if there's any chance at hitting an error recovery rule: + var error_rule_depth = locateNearestErrorRecoveryRule(state); + var errStr = null; + var errSymbolDescr = (this.describeSymbol(symbol) || symbol); + var expected = this.collect_expected_token_set(state); + + if (!recovering) { + // Report error + if (typeof lexer.yylineno === 'number') { + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; + } else { + errStr = 'Parse error: '; + } + + if (typeof lexer.showPosition === 'function') { + errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; + } + if (expected.length) { + errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; + } else { + errStr += 'Unexpected ' + errSymbolDescr; + } + + p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0)); + + // cleanup the old one before we start the new error info track: + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + } + recoveringErrorInfo = this.shallowCopyErrorInfo(p); + + r = this.parseError(p.errStr, p, this.JisonParserError); + + + + + + + + + + // Protect against overly blunt userland `parseError` code which *sets* + // the `recoverable` flag without properly checking first: + // we always terminate the parse when there's no recovery rule available anyhow! + if (!p.recoverable || error_rule_depth < 0) { + retval = r; + break; + } else { + // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process... + } + } + + + + + + + + + + + var esp = recoveringErrorInfo.info_stack_pointer; + + // just recovered from another error + if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { + // SHIFT current lookahead and grab another + recoveringErrorInfo.symbol_stack[esp] = symbol; + recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState; // push state + ++esp; + + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + + yyloc = lexer.yylloc; + + preErrorSymbol = 0; + symbol = lex(); + + + + + + + + + + } + + // try to recover from error + if (error_rule_depth < 0) { + assert(recovering > 0); + recoveringErrorInfo.info_stack_pointer = esp; + + // barf a fatal hairball when we're out of look-ahead symbols and none hit a match + // while we are still busy recovering from another error: + var po = this.__error_infos[this.__error_infos.length - 1]; + if (!po) { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error.', null, expected, false); + } else { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error. Previous error which resulted in this fatal result: ' + po.errStr, null, expected, false); + p.extra_error_attributes = po; + } + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + + preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + + const EXTRA_STACK_SAMPLE_DEPTH = 3; + + // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token: + recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol; + if (errStr) { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + errorStr: errStr, + errorSymbolDescr: errSymbolDescr, + expectedStr: expected, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + + + + + + + + + + } else { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + } + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + yyval.$ = recoveringErrorInfo; + yyval._$ = undefined; + + yyrulelen = error_rule_depth; + + + + + + + + + + r = this.performAction.call(yyval, yyloc, NO_ACTION[1], sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // and move the top entries + discarded part of the parse stacks onto the error info stack: + for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) { + recoveringErrorInfo.symbol_stack[esp] = stack[idx]; + recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]); + recoveringErrorInfo.state_stack[esp] = sstack[idx]; + } + + recoveringErrorInfo.symbol_stack[esp] = TERROR; + recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$); + + // goto new state = table[STATE][NONTERMINAL] + newState = sstack[sp - 1]; + + if (this.defaultActions[newState]) { + recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState]; + } else { + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + recoveringErrorInfo.state_stack[esp] = t[1]; + } + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + // allow N (default: 3) real symbols to be shifted before reporting a new error + recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; + + + + + + + + + + + // Now duplicate the standard parse machine here, at least its initial + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // as we wish to push something special then! + + + // Run the state machine in this copy of the parser state machine + // until we *either* consume the error symbol (and its related information) + // *or* we run into another error while recovering from this one + // *or* we execute a `reduce` action which outputs a final parse + // result (yes, that MAY happen!)... + + assert(recoveringErrorInfo); + assert(symbol === TERROR); + while (symbol) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // read action for current state and first input + t = (table[state] && table[state][symbol]) || NO_ACTION; + newState = t[1]; + action = t[0]; + + + + + + + + + + + // encountered another parse error? If so, break out to main loop + // and take it from there! + if (!action) { + newState = state; + break; + } + } + + + + + + + + + + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + + // shift: + case 1: + stack[sp] = symbol; + //vstack[sp] = lexer.yytext; + assert(recoveringErrorInfo); + vstack[sp] = recoveringErrorInfo; + //lstack[sp] = copy_yylloc(lexer.yylloc); + lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); + sstack[sp] = newState; // push state + ++sp; + symbol = 0; + if (!preErrorSymbol) { // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + + + + + + + + + + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + + + + + + + + + // read action for current state and first input + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + + + + + + + + symbol = 0; + } + } + + // once we have pushed the special ERROR token value, we're done in this inner loop! + break; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + + + + + + + + + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + // signal end of error recovery loop AND end of outer parse loop + action = 3; + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + + + + + + + + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + break; + } + + // break out of loop: we accept or fail with error + break; + } + + // should we also break out of the regular/outer parse loop, + // i.e. did the parser already produce a parse result in here?! + if (action === 3) { + break; + } + continue; + } + + + } + + + + + + + + + + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + + // shift: + case 1: + stack[sp] = symbol; + vstack[sp] = lexer.yytext; + lstack[sp] = copy_yylloc(lexer.yylloc); + sstack[sp] = newState; // push state + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + var tokenName = self.getSymbolName(symbol || EOF); + if (!tokenName) { + tokenName = symbol; + } + + Jison.parserDebugger.push({ + action: 'shift', + text: lexer.yytext, + terminal: tokenName, + terminal_id: symbol + }); + } + + ++sp; + symbol = 0; + assert(preErrorSymbol === 0); + if (!preErrorSymbol) { // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + + + + + + + + + + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + + + + + + + + + // read action for current state and first input + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + + + + + + + + symbol = 0; + } + } + + continue; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + + + + + + + + + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { + var prereduceValue = vstack.slice(sp - yyrulelen, sp); + var debuggableProductions = []; + for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { + var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); + debuggableProductions.push(debuggableProduction); + } + // find the current nonterminal name (- nolan) + var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; + var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); + + Jison.parserDebugger.push({ + action: 'reduce', + nonterminal: currentNonterminal, + nonterminal_id: currentNonterminalCode, + prereduce: prereduceValue, + result: r, + productions: debuggableProductions, + text: yyval.$ + }); + } + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + + + + + + + + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'accept', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + + break; + } + + // break out of loop: we accept or fail with error + break; + } + } catch (ex) { + // report exceptions through the parseError callback too, but keep the exception intact + // if it is a known parser or lexer error which has been thrown by parseError() already: + if (ex instanceof this.JisonParserError) { + throw ex; + } + else if (lexer && typeof lexer.JisonLexerError === 'function' && ex instanceof lexer.JisonLexerError) { + throw ex; + } + else { + p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + } + } finally { + retval = this.cleanupAfterParse(retval, true, true); + this.__reentrant_call_depth--; + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'return', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + } // /finally + + return retval; +}, +yyError: 1 +}; +parser.originalParseError = parser.parseError; +parser.originalQuoteName = parser.quoteName; + +var rmCommonWS = helpers.rmCommonWS; + +function encodeRE(s) { + return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); +} + +function prepareString(s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; +} + +// convert string value to number or boolean value, when possible +// (and when this is more or less obviously the intent) +// otherwise produce the string itself as value. +function parseValue(v) { + if (v === 'false') { + return false; + } + if (v === 'true') { + return true; + } + // http://stackoverflow.com/questions/175739/is-there-a-built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number + // Note that the `v` check ensures that we do not convert `undefined`, `null` and `''` (empty string!) + if (v && !isNaN(v)) { + var rv = +v; + if (isFinite(rv)) { + return rv; + } + } + return v; +} + + +parser.warn = function p_warn() { + console.warn.apply(console, arguments); +}; + +parser.log = function p_log() { + console.log.apply(console, arguments); +}; + +parser.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse:', arguments); +}; + +parser.yy.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse YY:', arguments); +}; + +parser.yy.post_lex = function p_lex() { + if (parser.yydebug) parser.log('post_lex:', arguments); +}; +/* lexer generated by jison-lex 0.6.0-194*/ + +/* + * Returns a Lexer object of the following structure: + * + * Lexer: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a direct reference! + * + * This "shared context" object was passed to the lexer by way of + * the `lexer.setInput(str, yy)` API before you may use it. + * + * This "shared context" object is passed to the lexer action code in `performAction()` + * so userland code in the lexer actions may communicate with the outside world + * and/or other lexer rules' actions in more or less complex ways. + * + * } + * + * Lexer.prototype: { + * EOF: 1, + * ERROR: 2, + * + * yy: The overall "shared context" object reference. + * + * JisonLexerError: function(msg, hash), + * + * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `lexer` instance. + * `yy_` is an alias for `this` lexer instance reference used internally. + * + * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer + * by way of the `lexer.setInput(str, yy)` API before. + * + * Note: + * The extra arguments you specified in the `%parse-param` statement in your + * **parser** grammar definition file are passed to the lexer via this object + * reference as member variables. + * + * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. + * + * - `YY_START`: the current lexer "start condition" state. + * + * parseError: function(str, hash, ExceptionClass), + * + * constructLexErrorInfo: function(error_message, is_recoverable), + * Helper function. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this lexer kernel in many places; example usage: + * + * var infoObj = lexer.constructParseErrorInfo('fail!', true); + * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); + * + * options: { ... lexer %options ... }, + * + * lex: function(), + * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. + * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the **parser** or the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * cleanupAfterLex: function(do_not_nuke_errorinfos), + * Helper function. + * + * This helper API is invoked when the **parse process** has completed: it is the responsibility + * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. + * + * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. + * + * setInput: function(input, [yy]), + * + * + * input: function(), + * + * + * unput: function(str), + * + * + * more: function(), + * + * + * reject: function(), + * + * + * less: function(n), + * + * + * pastInput: function(n), + * + * + * upcomingInput: function(n), + * + * + * showPosition: function(), + * + * + * test_match: function(regex_match_array, rule_index), + * + * + * next: function(), + * + * + * begin: function(condition), + * + * + * pushState: function(condition), + * + * + * popState: function(), + * + * + * topState: function(), + * + * + * _currentRules: function(), + * + * + * stateStackSize: function(), + * + * + * performAction: function(yy, yy_, yyrulenumber, YY_START), + * + * + * rules: [...], + * + * + * conditions: {associative list: name ==> set}, + * } + * + * + * token location info (`yylloc`): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * } + * + * while `this` will reference the current lexer instance. + * + * When `parseError` is invoked by the lexer, the default implementation will + * attempt to invoke `yy.parser.parseError()`; when this callback is not provided + * it will try to invoke `yy.parseError()` instead. When that callback is also not + * provided, a `JisonLexerError` exception will be thrown containing the error + * message and `hash`, as constructed by the `constructLexErrorInfo()` API. + * + * Note that the lexer's `JisonLexerError` error class is passed via the + * `ExceptionClass` argument, which is invoked to construct the exception + * instance to be thrown, so technically `parseError` will throw the object + * produced by the `new ExceptionClass(str, hash)` JavaScript expression. + * + * --- + * + * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. + * These options are available: + * + * (Options are permanent.) + * + * yy: { + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * } + * + * lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * WARNING: the next set of options are not meant to be changed. They echo the abilities of + * the lexer as per when it was compiled! + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + +var lexer = function() { + // See also: + // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + // with userland code which might access the derived class in a 'classic' way. + function JisonLexerError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonLexerError' + }); + + if (msg == null) + msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + var stacktrace; + + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = new Error(msg).stack; + } + } + + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } + } + + if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); + } else { + JisonLexerError.prototype = Object.create(Error.prototype); + } + + JisonLexerError.prototype.constructor = JisonLexerError; + JisonLexerError.prototype.name = 'JisonLexerError'; + + var lexer = { + + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // backtracking: .................... false + // location.ranges: ................. true + // location line+column tracking: ... true + // + // + // Forwarded Parser Analysis flags: + // + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses lexer values: ............... true/ true + // location tracking: ............... true + // location assignment: ............. true + // + // + // Lexer Analysis flags: + // + // uses yyleng: ..................... ??? + // uses yylineno: ................... ??? + // uses yytext: ..................... ??? + // uses yylloc: ..................... ??? + // uses ParseError API: ............. ??? + // uses yyerror: .................... ??? + // uses location tracking & editing: ??? + // uses more() API: ................. ??? + // uses unput() API: ................ ??? + // uses reject() API: ............... ??? + // uses less() API: ................. ??? + // uses display APIs pastInput(), upcomingInput(), showPosition(): + // ............................. ??? + // uses describeYYLLOC() API: ....... ??? + // + // --------- END OF REPORT ----------- + + + EOF: 1, + + ERROR: 2, + + // JisonLexerError: JisonLexerError, /// <-- injected by the code generator + + // options: {}, /// <-- injected by the code generator + + // yy: ..., /// <-- injected by setInput() + + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + + /** + * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + * + * @public + * @this {RegExpLexer} + */ + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + /** @constructor */ + var pei = { + errStr: msg, + recoverable: !!recoverable, + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + token: null, + line: this.yylineno, + loc: this.yylloc, + yy: this.yy, + lexer: this, + + /** + * and make sure the error info doesn't stay due to potential + * ref cycle via userland code manipulations. + * These would otherwise all be memory leak opportunities! + * + * Note that only array and object references are nuked as those + * constitute the set of elements which can produce a cyclic ref. + * The rest of the members is kept intact as they are harmless. + * + * @public + * @this {LexErrorInfo} + */ + destroy: function destructLexErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // ... + var rec = !!this.recoverable; + + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; + } + } + + this.recoverable = rec; + } + }; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + + return pei; + }, + + /** + * handler which is invoked when a lexer error occurs. + * + * @public + * @this {RegExpLexer} + */ + parseError: function lexer_parseError(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonLexerError; + } + + if (this.yy) { + if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { + return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } else if (typeof this.yy.parseError === 'function') { + return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } + } + + throw new ExceptionClass(str, hash); + }, + + /** + * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions. + * + * @public + * @this {RegExpLexer} + */ + yyerror: function yyError(str /*, ...args */) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': ' + str, + this.options.lexerErrorsAreRecoverable + ); + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + + if (args.length) { + p.extra_error_attributes = args; + } + + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + }, + + /** + * final cleanup function for when we have completed lexing the input; + * make it an API so that external code can use this one once userland + * code has decided it's time to destroy any lingering lexer error + * hash object instances and the like: this function helps to clean + * up these constructs, which *may* carry cyclic references which would + * otherwise prevent the instances from being properly and timely + * garbage-collected, i.e. this function helps prevent memory leaks! + * + * @public + * @this {RegExpLexer} + */ + cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + this.setInput('', {}); + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + + this.__error_infos.length = 0; + } + + return this; + }, + + /** + * clear the lexer token context; intended for internal use only + * + * @public + * @this {RegExpLexer} + */ + clear: function lexer_clear() { + this.yytext = ''; + this.yyleng = 0; + this.match = ''; + + // - DO NOT reset `this.matched` + this.matches = false; + + this._more = false; + this._backtrack = false; + var col = (this.yylloc ? this.yylloc.last_column : 0); + + this.yylloc = { + first_line: this.yylineno + 1, + first_column: col, + last_line: this.yylineno + 1, + last_column: col, + range: [this.offset, this.offset] + }; + }, + + /** + * resets the lexer, sets new input + * + * @public + * @this {RegExpLexer} + */ + setInput: function lexer_setInput(input, yy) { + this.yy = yy || this.yy || {}; + + // also check if we've fully initialized the lexer instance, + // including expansion work to be done to go from a loaded + // lexer to a usable lexer: + if (!this.__decompressed) { + // step 1: decompress the regex list: + var rules = this.rules; + + for (var i = 0, len = rules.length; i < len; i++) { + var rule_re = rules[i]; + + // compression: is the RE an xref to another RE slot in the rules[] table? + if (typeof rule_re === 'number') { + rules[i] = rules[rule_re]; + } + } + + // step 2: unfold the conditions[] set to make these ready for use: + var conditions = this.conditions; + + for (var k in conditions) { + var spec = conditions[k]; + var rule_ids = spec.rules; + var len = rule_ids.length; + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_new_ids = new Array(len + 1); + + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; + } + + spec.rules = rule_new_ids; + spec.__rule_regexes = rule_regexes; + spec.__rule_count = len; + } + + this.__decompressed = true; + } + + this._input = input || ''; + this.clear(); + this._signaled_error_token = false; + this.done = false; + this.yylineno = 0; + this.matched = ''; + this.conditionStack = ['INITIAL']; + this.__currentRuleSet__ = null; + + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0, + range: [0, 0] + }; + + this.offset = 0; + return this; + }, + + /** + * edit the remaining input via user-specified callback. + * This can be used to forward-adjust the input-to-parse, + * e.g. inserting macro expansions and alike in the + * input which has yet to be lexed. + * The behaviour of this API contrasts the `unput()` et al + * APIs as those act on the *consumed* input, while this + * one allows one to manipulate the future, without impacting + * the current `yyloc` cursor location or any history. + * + * Use this API to help implement C-preprocessor-like + * `#include` statements, etc. + * + * The provided callback must be synchronous and is + * expected to return the edited input (string). + * + * The `cpsArg` argument value is passed to the callback + * as-is. + * + * `callback` interface: + * `function callback(input, cpsArg)` + * + * - `input` will carry the remaining-input-to-lex string + * from the lexer. + * - `cpsArg` is `cpsArg` passed into this API. + * + * The `this` reference for the callback will be set to + * reference this lexer instance so that userland code + * in the callback can easily and quickly access any lexer + * API. + * + * When the callback returns a non-string-type falsey value, + * we assume the callback did not edit the input and we + * will using the input as-is. + * + * When the callback returns a non-string-type value, it + * is converted to a string for lexing via the `"" + retval` + * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html + * -- that way any returned object's `toValue()` and `toString()` + * methods will be invoked in a proper/desirable order.) + * + * @public + * @this {RegExpLexer} + */ + editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) { + var rv = callback.call(this, this._input, cpsArg); + + if (typeof rv !== 'string') { + if (rv) { + this._input = '' + rv; + } + // else: keep `this._input` as is. + } else { + this._input = rv; + } + + return this; + }, + + /** + * consumes and returns one char from the input + * + * @public + * @this {RegExpLexer} + */ + input: function lexer_input() { + if (!this._input) { + //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) + return null; + } + + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + + // Count the linenumber up when we hit the LF (or a stand-alone CR). + // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo + // and we advance immediately past the LF as well, returning both together as if + // it was all a single 'character' only. + var slice_len = 1; + + var lines = false; + + if (ch === '\n') { + lines = true; + } else if (ch === '\r') { + lines = true; + var ch2 = this._input[1]; + + if (ch2 === '\n') { + slice_len++; + ch += ch2; + this.yytext += ch2; + this.yyleng++; + this.offset++; + this.match += ch2; + this.matched += ch2; + this.yylloc.range[1]++; + } + } + + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + this.yylloc.last_column = 0; + } else { + this.yylloc.last_column++; + } + + this.yylloc.range[1]++; + this._input = this._input.slice(slice_len); + return ch; + }, + + /** + * unshifts one char (or an entire string) into the input + * + * @public + * @this {RegExpLexer} + */ + unput: function lexer_unput(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.yyleng = this.yytext.length; + this.offset -= len; + this.match = this.match.substr(0, this.match.length - len); + this.matched = this.matched.substr(0, this.matched.length - len); + + if (lines.length > 1) { + this.yylineno -= lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); + + if (pre_lines.length === 1) { + pre = this.matched; + pre_lines = pre.split(/(?:\r\n?|\n)/g); + } + + this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; + } else { + this.yylloc.last_column -= len; + } + + this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; + this.done = false; + return this; + }, + + /** + * cache matched text and append it on next action + * + * @public + * @this {RegExpLexer} + */ + more: function lexer_more() { + this._more = true; + return this; + }, + + /** + * signal the lexer that this rule fails to match the input, so the + * next matching rule (regex) should be tested instead. + * + * @public + * @this {RegExpLexer} + */ + reject: function lexer_reject() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + // when the `parseError()` call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // `.lex()` run. + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, + false + ); + + this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + + return this; + }, + + /** + * retain first n characters of the match + * + * @public + * @this {RegExpLexer} + */ + less: function lexer_less(n) { + return this.unput(this.match.slice(n)); + }, + + /** + * return (part of the) already matched input, i.e. for error + * messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of + * input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * @public + * @this {RegExpLexer} + */ + pastInput: function lexer_pastInput(maxSize, maxLines) { + var past = this.matched.substring(0, this.matched.length - this.match.length); + + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = past.length; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + + // `substr` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + past = past.substr(-maxSize * 2 - 2); + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = past.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(-maxLines); + past = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis prefix... + if (past.length > maxSize) { + past = '...' + past.substr(-maxSize); + } + + return past; + }, + + /** + * return (part of the) upcoming input, i.e. for error messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * > ### NOTE ### + * > + * > *"upcoming input"* is defined as the whole of the both + * > the *currently lexed* input, together with any remaining input + * > following that. *"currently lexed"* input is the input + * > already recognized by the lexer but not yet returned with + * > the lexer token. This happens when you are invoking this API + * > from inside any lexer rule action code block. + * > + * + * @public + * @this {RegExpLexer} + */ + upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { + var next = this.match; + + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = maxSize; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + + // `substring` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + if (next.length < maxSize * 2 + 2) { + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + } + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = next.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(0, maxLines); + next = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis postfix... + if (next.length > maxSize) { + next = next.substring(0, maxSize) + '...'; + } + + return next; + }, + + /** + * return a string which displays the character position where the + * lexing error occurred, i.e. for error messages + * + * @public + * @this {RegExpLexer} + */ + showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { + var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; + }, + + /** + * return a string which displays the lines & columns of input which are referenced + * by the given location info range, plus a few lines of context. + * + * This function pretty-prints the indicated section of the input, with line numbers + * and everything! + * + * This function is very useful to provide highly readable error reports, while + * the location range may be specified in various flexible ways: + * + * - `loc` is the location info object which references the area which should be + * displayed and 'marked up': these lines & columns of text are marked up by `^` + * characters below each character in the entire input range. + * + * - `context_loc` is the *optional* location info object which instructs this + * pretty-printer how much *leading* context should be displayed alongside + * the area referenced by `loc`. This can help provide context for the displayed + * error, etc. + * + * When this location info is not provided, a default context of 3 lines is + * used. + * + * - `context_loc2` is another *optional* location info object, which serves + * a similar purpose to `context_loc`: it specifies the amount of *trailing* + * context lines to display in the pretty-print output. + * + * When this location info is not provided, a default context of 1 line only is + * used. + * + * Special Notes: + * + * - when the `loc`-indicated range is very large (about 5 lines or more), then + * only the first and last few lines of this block are printed while a + * `...continued...` message will be printed between them. + * + * This serves the purpose of not printing a huge amount of text when the `loc` + * range happens to be huge: this way a manageable & readable output results + * for arbitrary large ranges. + * + * - this function can display lines of input which whave not yet been lexed. + * `prettyPrintRange()` can access the entire input! + * + * @public + * @this {RegExpLexer} + */ + prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var input = this.matched + this._input; + var lines = input.split('\n'); + + //var show_context = (error_size < 5 || context_loc); + var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); + + var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); + var lineno_display_width = 1 + Math.log10(l1 | 1) | 0; + var ws_prefix = new Array(lineno_display_width).join(' '); + var nonempty_line_indexes = []; + + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ': ' + line; + var errpfx = new Array(lineno_display_width + 1).join('^'); + + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + + var len = Math.max( + 2, + ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 + ); + + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } + + rv = rv.replace(/\t/g, ' '); + return rv; + }); + + // now make sure we don't print an overly large amount of error area: limit it + // to the top and bottom line count: + if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { + var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; + + console.log('clip off: ', { + start: clip_start, + end: clip_end, + len: clip_end - clip_start + 1, + arr: nonempty_line_indexes, + rv + }); + + var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; + intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; + rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); + } + + return rv.join('\n'); + }, + + /** + * helper function, used to produce a human readable description as a string, given + * the input `yylloc` location object. + * + * Set `display_range_too` to TRUE to include the string character index position(s) + * in the description if the `yylloc.range` is available. + * + * @public + * @this {RegExpLexer} + */ + describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { + var l1 = yylloc.first_line; + var l2 = yylloc.last_line; + var c1 = yylloc.first_column; + var c2 = yylloc.last_column; + var dl = l2 - l1; + var dc = c2 - c1; + var rv; + + if (dl === 0) { + rv = 'line ' + l1 + ', '; + + if (dc <= 1) { + rv += 'column ' + c1; + } else { + rv += 'columns ' + c1 + ' .. ' + c2; + } + } else { + rv = 'lines ' + l1 + '(column ' + c1 + ') .. ' + l2 + '(column ' + c2 + ')'; + } + + if (yylloc.range && display_range_too) { + var r1 = yylloc.range[0]; + var r2 = yylloc.range[1] - 1; + + if (r2 <= r1) { + rv += ' {String Offset: ' + r1 + '}'; + } else { + rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; + } + } + + return rv; + }, + + /** + * test the lexed token: return FALSE when not a match, otherwise return token. + * + * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + * contains the actually matched text string. + * + * Also move the input cursor forward and update the match collectors: + * + * - `yytext` + * - `yyleng` + * - `match` + * - `matches` + * - `yylloc` + * - `offset` + * + * @public + * @this {RegExpLexer} + */ + test_match: function lexer_test_match(match, indexed_rule) { + var token, lines, backup, match_str, match_str_len; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.yylloc.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column, + range: this.yylloc.range.slice(0) + }, + + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + + //_signaled_error_token: this._signaled_error_token, + yy: this.yy, + + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + } + + match_str = match[0]; + match_str_len = match_str.length; + + // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { + lines = match_str.split(/(?:\r\n?|\n)/g); + + if (lines.length > 1) { + this.yylineno += lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + this.yylloc.last_column = lines[lines.length - 1].length; + } else { + this.yylloc.last_column += match_str_len; + } + + // } + this.yytext += match_str; + + this.match += match_str; + this.matched += match_str; + this.matches = match; + this.yyleng = this.yytext.length; + this.yylloc.range[1] += match_str_len; + + // previous lex rules MAY have invoked the `more()` API rather than producing a token: + // those rules will already have moved this `offset` forward matching their match lengths, + // hence we must only add our own match length now: + this.offset += match_str_len; + + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match_str_len); + + // calling this method: + // + // function lexer__performAction(yy, yyrulenumber, YY_START) {...} + token = this.performAction.call( + this, + this.yy, + indexed_rule, + this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ + ); + + // otherwise, when the action codes are all simple return token statements: + //token = this.simpleCaseActionClusters[indexed_rule]; + + if (this.done && this._input) { + this.done = false; + } + + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + + this.__currentRuleSet__ = null; + return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as `.parseError()` in `reject()` + // did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + + this._signaled_error_token = false; + return token; + } + + return false; + }, + + /** + * return next match in input + * + * @public + * @this {RegExpLexer} + */ + next: function lexer_next() { + if (this.done) { + this.clear(); + return this.EOF; + } + + if (!this._input) { + this.done = true; + } + + var token, match, tempMatch, index; + + if (!this._more) { + this.clear(); + } + + var spec = this.__currentRuleSet__; + + if (!spec) { + // Update the ruleset cache as we apparently encountered a state change or just started lexing. + // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will + // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps + // speed up those activities a tiny bit. + spec = this.__currentRuleSet__ = this._currentRules(); + + // Check whether a *sane* condition has been pushed before: this makes the lexer robust against + // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 + if (!spec || !spec.rules) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo( + 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, + false + ); + + // produce one 'error' token until this situation has been resolved, most probably by parse termination! + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + } + + var rule_ids = spec.rules; + var regexes = spec.__rule_regexes; + var len = spec.__rule_count; + + // Note: the arrays are 1-based, while `len` itself is a valid index, + // hence the non-standard less-or-equal check in the next loop condition! + for (var i = 1; i <= len; i++) { + tempMatch = this._input.match(regexes[i]); + + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rule_ids[i]); + + if (token !== false) { + return token; + } else if (this._backtrack) { + match = undefined; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + + if (match) { + token = this.test_match(match, rule_ids[index]); + + if (token !== false) { + return token; + } + + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + + if (!this._input) { + this.done = true; + this.clear(); + return this.EOF; + } else { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, + this.options.lexerErrorsAreRecoverable + ); + + token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + + if (token === this.ERROR) { + // we can try to recover from a lexer error that `parseError()` did not 'recover' for us + // by moving forward at least one character at a time: + if (!this.match.length) { + this.input(); + } + } + + return token; + } + }, + + /** + * return next match that has a token + * + * @public + * @this {RegExpLexer} + */ + lex: function lexer_lex() { + var r; + + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + + while (!r) { + r = this.next(); + } + + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + + return r; + }, + + /** + * backwards compatible alias for `pushState()`; + * the latter is symmetrical with `popState()` and we advise to use + * those APIs in any modern lexer code, rather than `begin()`. + * + * @public + * @this {RegExpLexer} + */ + begin: function lexer_begin(condition) { + return this.pushState(condition); + }, + + /** + * activates a new lexer condition state (pushes the new lexer + * condition state onto the condition stack) + * + * @public + * @this {RegExpLexer} + */ + pushState: function lexer_pushState(condition) { + this.conditionStack.push(condition); + this.__currentRuleSet__ = null; + return this; + }, + + /** + * pop the previously active lexer condition state off the condition + * stack + * + * @public + * @this {RegExpLexer} + */ + popState: function lexer_popState() { + var n = this.conditionStack.length - 1; + + if (n > 0) { + this.__currentRuleSet__ = null; + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + + /** + * return the currently active lexer condition state; when an index + * argument is provided it produces the N-th previous condition state, + * if available + * + * @public + * @this {RegExpLexer} + */ + topState: function lexer_topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + + if (n >= 0) { + return this.conditionStack[n]; + } else { + return 'INITIAL'; + } + }, + + /** + * (internal) determine the lexer rule set which is active for the + * currently active lexer condition state + * + * @public + * @this {RegExpLexer} + */ + _currentRules: function lexer__currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; + } else { + return this.conditions['INITIAL']; + } + }, + + /** + * return the number of states currently on the stack + * + * @public + * @this {RegExpLexer} + */ + stateStackSize: function lexer_stateStackSize() { + return this.conditionStack.length; + }, + + options: { + xregexp: true, + ranges: true, + trackPosition: true, + parseActionsUseYYMERGELOCATIONINFO: true, + easy_keyword_rules: true + }, + + JisonLexerError: JisonLexerError, + + performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { + var yy_ = this; + switch (yyrulenumber) { + case 0: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %\{ */ + yy.dept = 0; + + yy.include_command_allowed = false; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 1: + /*! Conditions:: action */ + /*! Rule:: %\{([^]*?)%\} */ + yy_.yytext = this.matches[1]; + + yy.include_command_allowed = true; + return 32; + break; + + case 2: + /*! Conditions:: action */ + /*! Rule:: %include\b */ + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState('path'); + + return 51; + } else { + // TODO + yy_.yyerror('oops!'); + + return 37; + } + + break; + + case 3: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 34; + + break; + + case 4: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\/.* */ + yy.include_command_allowed = false; + + return 35; + break; + + case 6: + /*! Conditions:: action */ + /*! Rule:: \| */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 7: + /*! Conditions:: action */ + /*! Rule:: %% */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 9: + /*! Conditions:: action */ + /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 10: + /*! Conditions:: action */ + /*! Rule:: \/[^}{BR}]* */ + yy.include_command_allowed = false; + + return 33; + break; + + case 11: + /*! Conditions:: action */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy.include_command_allowed = false; + + return 33; + break; + + case 12: + /*! Conditions:: action */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy.include_command_allowed = false; + + return 33; + break; + + case 13: + /*! Conditions:: action */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy.include_command_allowed = false; + + return 33; + break; + + case 14: + /*! Conditions:: action */ + /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 15: + /*! Conditions:: action */ + /*! Rule:: \{ */ + yy.depth++; + + yy.include_command_allowed = false; + return 33; + break; + + case 16: + /*! Conditions:: action */ + /*! Rule:: \} */ + yy.include_command_allowed = false; + + if (yy.depth <= 0) { + yy_.yyerror(rmCommonWS` + too many closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 'BRACKETS_SURPLUS'; + } else { + yy.depth--; + } + + return 33; + break; + + case 17: + /*! Conditions:: action */ + /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|]) */ + yy.include_command_allowed = true; + + return 36; // keep empty lines as-is inside action code blocks. + break; + + case 18: + /*! Conditions:: action */ + /*! Rule:: {BR} */ + if (yy.depth > 0) { + yy.include_command_allowed = true; + return 36; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk + this.popState(); + + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } + + break; + + case 19: + /*! Conditions:: action */ + /*! Rule:: $ */ + yy.include_command_allowed = false; + + if (yy.depth !== 0) { + yy_.yyerror(rmCommonWS` + missing ${yy.depth} closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = ''; + return 'BRACKETS_MISSING'; + } + + this.popState(); + yy_.yytext = ''; + return 31; + break; + + case 21: + /*! Conditions:: conditions */ + /*! Rule:: > */ + this.popState(); + + return 6; + break; + + case 24: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 25: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 26: + /*! Conditions:: rules */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 27: + /*! Conditions:: rules */ + /*! Rule:: {WS}+{BR}+ */ + /* empty */ + break; + + case 28: + /*! Conditions:: rules */ + /*! Rule:: \/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 29: + /*! Conditions:: rules */ + /*! Rule:: \/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 30: + /*! Conditions:: rules */ + /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + return 28; + break; + + case 31: + /*! Conditions:: rules */ + /*! Rule:: %% */ + this.popState(); + + this.pushState('code'); + return 19; + break; + + case 32: + /*! Conditions:: rules */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 35: + /*! Conditions:: options */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 49; // value is always a string type + break; + + case 36: + /*! Conditions:: options */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 49; // value is always a string type + break; + + case 37: + /*! Conditions:: options */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy_.yytext = unescQuote(this.matches[1], /\\`/g); + + return 49; // value is always a string type + break; + + case 39: + /*! Conditions:: options */ + /*! Rule:: {BR}{WS}+(?=\S) */ + /* skip leading whitespace on the next line of input, when followed by more options */ + break; + + case 40: + /*! Conditions:: options */ + /*! Rule:: {BR} */ + this.popState(); + + return 48; + break; + + case 41: + /*! Conditions:: options */ + /*! Rule:: {WS}+ */ + /* skip whitespace */ + break; + + case 43: + /*! Conditions:: start_condition */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 44: + /*! Conditions:: start_condition */ + /*! Rule:: {WS}+ */ + /* empty */ + break; + + case 46: + /*! Conditions:: INITIAL */ + /*! Rule:: {ID} */ + this.pushState('macro'); + + return 20; + break; + + case 47: + /*! Conditions:: macro named_chunk */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 48: + /*! Conditions:: macro */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 49: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 50: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \s+ */ + /* empty */ + break; + + case 51: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 26; + break; + + case 52: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 26; + break; + + case 53: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \[ */ + this.pushState('set'); + + return 41; + break; + + case 66: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: < */ + this.pushState('conditions'); + + return 5; + break; + + case 67: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/! */ + return 39; // treated as `(?!atom)` + + break; + + case 68: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/ */ + return 14; // treated as `(?=atom)` + + break; + + case 70: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); + + return 44; + break; + + case 73: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %options\b */ + this.pushState('options'); + + return 47; + break; + + case 74: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %s\b */ + this.pushState('start_condition'); + + return 21; + break; + + case 75: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %x\b */ + this.pushState('start_condition'); + + return 22; + break; + + case 76: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %code\b */ + this.pushState('named_chunk'); + + return 25; + break; + + case 77: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %import\b */ + this.pushState('named_chunk'); + + return 24; + break; + + case 78: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %include\b */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 79: + /*! Conditions:: code */ + /*! Rule:: %include\b */ + this.pushState('path'); + + return 51; + break; + + case 80: + /*! Conditions:: INITIAL rules code */ + /*! Rule:: %{NAME}([^\r\n]*) */ + /* ignore unrecognized decl */ + this.warn(rmCommonWS` + LEX: ignoring unsupported lexer option ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = [ + this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; + + return 23; + break; + + case 81: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %% */ + this.pushState('rules'); + + return 19; + break; + + case 89: + /*! Conditions:: set */ + /*! Rule:: \] */ + this.popState(); + + return 42; + break; + + case 91: + /*! Conditions:: code */ + /*! Rule:: [^\r\n]+ */ + return 53; // the bit of CODE just before EOF... + + break; + + case 92: + /*! Conditions:: path */ + /*! Rule:: {BR} */ + this.popState(); + + this.unput(yy_.yytext); + break; + + case 93: + /*! Conditions:: path */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 94: + /*! Conditions:: path */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 95: + /*! Conditions:: path */ + /*! Rule:: {WS}+ */ + // skip whitespace in the line + break; + + case 96: + /*! Conditions:: path */ + /*! Rule:: [^\s\r\n]+ */ + this.popState(); + + return 52; + break; + + case 97: + /*! Conditions:: action */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 98: + /*! Conditions:: action */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 99: + /*! Conditions:: action */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 100: + /*! Conditions:: options */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 101: + /*! Conditions:: options */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 102: + /*! Conditions:: options */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 103: + /*! Conditions:: * */ + /*! Rule:: " */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 104: + /*! Conditions:: * */ + /*! Rule:: ' */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 105: + /*! Conditions:: * */ + /*! Rule:: ` */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 106: + /*! Conditions:: macro rules */ + /*! Rule:: . */ + /* b0rk on bad characters */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unsupported lexer input encountered while lexing + ${rules} (i.e. jison lex regexes). + + NOTE: When you want this input to be interpreted as a LITERAL part + of a lex rule regex, you MUST enclose it in double or + single quotes. + + If not, then know that this input is not accepted as a valid + regex expression here in jison-lex ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + case 107: + /*! Conditions:: * */ + /*! Rule:: . */ + yy_.yyerror(rmCommonWS` + unsupported lexer input: ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + default: + return this.simpleCaseActionClusters[yyrulenumber]; + } + }, + + simpleCaseActionClusters: { + /*! Conditions:: action */ + /*! Rule:: {WS}+ */ + 5: 36, + + /*! Conditions:: action */ + /*! Rule:: % */ + 8: 33, + + /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ + 20: 20, + + /*! Conditions:: conditions */ + /*! Rule:: , */ + 22: 8, + + /*! Conditions:: conditions */ + /*! Rule:: \* */ + 23: 7, + + /*! Conditions:: options */ + /*! Rule:: {NAME} */ + 33: 20, + + /*! Conditions:: options */ + /*! Rule:: = */ + 34: 18, + + /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ + 38: 50, + + /*! Conditions:: start_condition */ + /*! Rule:: {ID} */ + 42: 27, + + /*! Conditions:: named_chunk */ + /*! Rule:: {ID} */ + 45: 20, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \| */ + 54: 9, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?: */ + 55: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?= */ + 56: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?! */ + 57: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \( */ + 58: 10, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \) */ + 59: 11, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \+ */ + 60: 12, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \* */ + 61: 7, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \? */ + 62: 13, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \^ */ + 63: 16, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: , */ + 64: 8, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: <> */ + 65: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + 69: 44, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \$ */ + 71: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \. */ + 72: 15, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{\d+(,\s*\d+|,)?\} */ + 82: 45, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{{ID}\} */ + 83: 40, + + /*! Conditions:: set options */ + /*! Rule:: \{{ID}\} */ + 84: 40, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{ */ + 85: 3, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \} */ + 86: 4, + + /*! Conditions:: set */ + /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ + 87: 43, + + /*! Conditions:: set */ + /*! Rule:: \{ */ + 88: 43, + + /*! Conditions:: code */ + /*! Rule:: [^\r\n]*(\r|\n)+ */ + 90: 53, + + /*! Conditions:: * */ + /*! Rule:: $ */ + 108: 1 + }, + + rules: [ + /* 0: */ /^(?:%\{)/, + /* 1: */ new XRegExp('^(?:%\\{([^]*?)%\\})', ''), + /* 2: */ /^(?:%include\b)/, + /* 3: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 4: */ /^(?:([^\S\n\r])*\/\/.*)/, + /* 5: */ /^(?:([^\S\n\r])+)/, + /* 6: */ /^(?:\|)/, + /* 7: */ /^(?:%%)/, + /* 8: */ /^(?:%)/, + /* 9: */ /^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, + /* 10: */ /^(?:\/[^\n\r}]*)/, + /* 11: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 12: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 13: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 14: */ /^(?:[^\s"%'\/`{-}]+)/, + /* 15: */ /^(?:\{)/, + /* 16: */ /^(?:\})/, + /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s|]))/, + /* 18: */ /^(?:(\r\n|\n|\r))/, + /* 19: */ /^(?:$)/, + /* 20: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' + ), + /* 21: */ /^(?:>)/, + /* 22: */ /^(?:,)/, + /* 23: */ /^(?:\*)/, + /* 24: */ /^(?:([^\S\n\r])*\/\/[^\n\r]*)/, + /* 25: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 26: */ /^(?:(\r\n|\n|\r)+)/, + /* 27: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, + /* 28: */ /^(?:\/\/[^\r\n]*)/, + /* 29: */ new XRegExp('^(?:\\/\\*[^]*?\\*\\/)', ''), + /* 30: */ /^(?:([^\S\n\r])+(?=[^\s%|]))/, + /* 31: */ /^(?:%%)/, + /* 32: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 33: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' + ), + /* 34: */ /^(?:=)/, + /* 35: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 36: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 37: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 38: */ /^(?:\S+)/, + /* 39: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, + /* 40: */ /^(?:(\r\n|\n|\r))/, + /* 41: */ /^(?:([^\S\n\r])+)/, + /* 42: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 43: */ /^(?:(\r\n|\n|\r)+)/, + /* 44: */ /^(?:([^\S\n\r])+)/, + /* 45: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 46: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 47: */ /^(?:(\r\n|\n|\r)+)/, + /* 48: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 49: */ /^(?:(\r\n|\n|\r)+)/, + /* 50: */ /^(?:\s+)/, + /* 51: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 52: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 53: */ /^(?:\[)/, + /* 54: */ /^(?:\|)/, + /* 55: */ /^(?:\(\?:)/, + /* 56: */ /^(?:\(\?=)/, + /* 57: */ /^(?:\(\?!)/, + /* 58: */ /^(?:\()/, + /* 59: */ /^(?:\))/, + /* 60: */ /^(?:\+)/, + /* 61: */ /^(?:\*)/, + /* 62: */ /^(?:\?)/, + /* 63: */ /^(?:\^)/, + /* 64: */ /^(?:,)/, + /* 65: */ /^(?:<>)/, + /* 66: */ /^(?:<)/, + /* 67: */ /^(?:\/!)/, + /* 68: */ /^(?:\/)/, + /* 69: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 70: */ /^(?:\\.)/, + /* 71: */ /^(?:\$)/, + /* 72: */ /^(?:\.)/, + /* 73: */ /^(?:%options\b)/, + /* 74: */ /^(?:%s\b)/, + /* 75: */ /^(?:%x\b)/, + /* 76: */ /^(?:%code\b)/, + /* 77: */ /^(?:%import\b)/, + /* 78: */ /^(?:%include\b)/, + /* 79: */ /^(?:%include\b)/, + /* 80: */ new XRegExp( + '^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))', + '' + ), + /* 81: */ /^(?:%%)/, + /* 82: */ /^(?:\{\d+(,\s*\d+|,)?\})/, + /* 83: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 84: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 85: */ /^(?:\{)/, + /* 86: */ /^(?:\})/, + /* 87: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 88: */ /^(?:\{)/, + /* 89: */ /^(?:\])/, + /* 90: */ /^(?:[^\r\n]*(\r|\n)+)/, + /* 91: */ /^(?:[^\r\n]+)/, + /* 92: */ /^(?:(\r\n|\n|\r))/, + /* 93: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 94: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 95: */ /^(?:([^\S\n\r])+)/, + /* 96: */ /^(?:\S+)/, + /* 97: */ /^(?:")/, + /* 98: */ /^(?:')/, + /* 99: */ /^(?:`)/, + /* 100: */ /^(?:")/, + /* 101: */ /^(?:')/, + /* 102: */ /^(?:`)/, + /* 103: */ /^(?:")/, + /* 104: */ /^(?:')/, + /* 105: */ /^(?:`)/, + /* 106: */ /^(?:.)/, + /* 107: */ /^(?:.)/, + /* 108: */ /^(?:$)/ + ], + + conditions: { + 'rules': { + rules: [ + 0, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 80, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 106, + 107, + 108 + ], + + inclusive: true + }, + + 'macro': { + rules: [ + 0, + 24, + 25, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 106, + 107, + 108 + ], + + inclusive: true + }, + + 'named_chunk': { + rules: [ + 0, + 45, + 47, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: true + }, + + 'code': { + rules: [79, 80, 90, 91, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'start_condition': { + rules: [24, 25, 42, 43, 44, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'options': { + rules: [ + 24, + 25, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 84, + 100, + 101, + 102, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: false + }, + + 'conditions': { + rules: [20, 21, 22, 23, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'action': { + rules: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 97, + 98, + 99, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: false + }, + + 'path': { + rules: [24, 25, 92, 93, 94, 95, 96, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'set': { + rules: [84, 87, 88, 89, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'INITIAL': { + rules: [ + 0, + 24, + 25, + 46, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 80, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: true + } + } + }; + + var rmCommonWS = helpers.rmCommonWS; + var dquote = helpers.dquote; + + function unescQuote(str) { + str = '' + str; + var a = str.split('\\\\'); + + a = a.map(function(s) { + return s.replace(/\\'/g, '\'').replace(/\\"/g, '"'); + }); + + str = a.join('\\\\'); + return str; + } + + lexer.warn = function l_warn() { + if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { + return this.yy.parser.warn.apply(this, arguments); + } else { + console.warn.apply(console, arguments); + } + }; + + lexer.log = function l_log() { + if (this.yy && this.yy.parser && typeof this.yy.parser.log === 'function') { + return this.yy.parser.log.apply(this, arguments); + } else { + console.log.apply(console, arguments); + } + }; + + return lexer; +}(); +parser.lexer = lexer; + +function Parser() { + this.yy = {}; +} +Parser.prototype = parser; +parser.Parser = Parser; + +function yyparse() { + return parser.parse.apply(parser, arguments); +} + +export { parser, Parser, yyparse as parse }; diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js new file mode 100644 index 0000000..0bed292 --- /dev/null +++ b/dist/lex-parser-umd-es5.js @@ -0,0 +1,5689 @@ +'use strict'; + +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; + +var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject2 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject3 = _taggedTemplateLiteral(['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject4 = _taggedTemplateLiteral(['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject5 = _taggedTemplateLiteral(['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject6 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject7 = _taggedTemplateLiteral(['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject8 = _taggedTemplateLiteral(['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), + _templateObject9 = _taggedTemplateLiteral(['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), + _templateObject10 = _taggedTemplateLiteral(['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n '], ['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n ']), + _templateObject11 = _taggedTemplateLiteral(['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject12 = _taggedTemplateLiteral(['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject13 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject14 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject15 = _taggedTemplateLiteral(['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject16 = _taggedTemplateLiteral(['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject17 = _taggedTemplateLiteral(['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject18 = _taggedTemplateLiteral(['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject19 = _taggedTemplateLiteral(['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%\\}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), + _templateObject20 = _taggedTemplateLiteral(['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%\\}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), + _templateObject21 = _taggedTemplateLiteral(['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n ']), + _templateObject22 = _taggedTemplateLiteral(['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n '], ['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n ']), + _templateObject23 = _taggedTemplateLiteral(['\n unterminated string constant in %options entry.\n\n Erroneous area:\n '], ['\n unterminated string constant in %options entry.\n\n Erroneous area:\n ']), + _templateObject24 = _taggedTemplateLiteral(['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n '], ['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n ']), + _templateObject25 = _taggedTemplateLiteral(['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n '], ['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n ']), + _templateObject26 = _taggedTemplateLiteral(['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n ']); + +function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } + +(function (global, factory) { + (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs'), require('@gerhobbelt/xregexp'), require('jison-helpers-lib')) : typeof define === 'function' && define.amd ? define(['exports', 'fs', '@gerhobbelt/xregexp', 'jison-helpers-lib'], factory) : factory(global['lex-parser'] = {}, global.fs, global.XRegExp, global.helpers); +})(undefined, function (exports, fs, XRegExp, helpers) { + 'use strict'; + + fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; + XRegExp = XRegExp && XRegExp.hasOwnProperty('default') ? XRegExp['default'] : XRegExp; + helpers = helpers && helpers.hasOwnProperty('default') ? helpers['default'] : helpers; + + // hack: + var assert; + + /* parser generated by jison 0.6.0-194 */ + + /* + * Returns a Parser object of the following structure: + * + * Parser: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a derivative/copy of this one, + * not a direct reference! + * } + * + * Parser.prototype: { + * yy: {}, + * EOF: 1, + * TERROR: 2, + * + * trace: function(errorMessage, ...), + * + * JisonParserError: function(msg, hash), + * + * quoteName: function(name), + * Helper function which can be overridden by user code later on: put suitable + * quotes around literal IDs in a description string. + * + * originalQuoteName: function(name), + * The basic quoteName handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function + * at the end of the `parse()`. + * + * describeSymbol: function(symbol), + * Return a more-or-less human-readable description of the given symbol, when + * available, or the symbol itself, serving as its own 'description' for lack + * of something better to serve up. + * + * Return NULL when the symbol is unknown to the parser. + * + * symbols_: {associative list: name ==> number}, + * terminals_: {associative list: number ==> name}, + * nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}}, + * terminal_descriptions_: (if there are any) {associative list: number ==> description}, + * productions_: [...], + * + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) + * to store/reference the rule value `$$` and location info `@$`. + * + * One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets + * to see the same object via the `this` reference, i.e. if you wish to carry custom + * data from one reduce action through to the next within a single parse run, then you + * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. + * + * `this.yy` is a direct reference to the `yy` shared state object. + * + * `%parse-param`-specified additional `parse()` arguments have been added to this `yy` + * object at `parse()` start and are therefore available to the action code via the + * same named `yy.xxxx` attributes (where `xxxx` represents a identifier name from + * the %parse-param` list. + * + * - `yytext` : reference to the lexer value which belongs to the last lexer token used + * to match this rule. This is *not* the look-ahead token, but the last token + * that's actually part of this rule. + * + * Formulated another way, `yytext` is the value of the token immediately preceeding + * the current look-ahead token. + * Caveats apply for rules which don't require look-ahead, such as epsilon rules. + * + * - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value. + * + * - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value. + * + * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. + * + * WARNING: since jison 0.4.18-186 this entry may be NULL/UNDEFINED instead + * of an empty object when no suitable location info can be provided. + * + * - `yystate` : the current parser state number, used internally for dispatching and + * executing the action code chunk matching the rule currently being reduced. + * + * - `yysp` : the current state stack position (a.k.a. 'stack pointer') + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * Also note that you can access this and other stack index values using the new double-hash + * syntax, i.e. `##$ === ##0 === yysp`, while `##1` is the stack index for all things + * related to the first rule term, just like you have `$1`, `@1` and `#1`. + * This is made available to write very advanced grammar action rules, e.g. when you want + * to investigate the parse state stack in your action code, which would, for example, + * be relevant when you wish to implement error diagnostics and reporting schemes similar + * to the work described here: + * + * + Pottier, F., 2016. Reachability and error diagnosis in LR(1) automata. + * In Journées Francophones des Languages Applicatifs. + * + * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. + * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. + * + * - `yyrulelength`: the current rule's term count, i.e. the number of entries occupied on the stack. + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. + * constructs. + * + * - `yylstack`: reference to the parser token location stack. Also accessed via + * the `@1` etc. constructs. + * + * WARNING: since jison 0.4.18-186 this array MAY contain slots which are + * UNDEFINED rather than an empty (location) object, when the lexer/parser + * action code did not provide a suitable location info object when such a + * slot was filled! + * + * - `yystack` : reference to the parser token id stack. Also accessed via the + * `#1` etc. constructs. + * + * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to + * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might + * want access this array for your own purposes, such as error analysis as mentioned above! + * + * Note that this stack stores the current stack of *tokens*, that is the sequence of + * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* + * (lexer tokens *shifted* onto the stack until the rule they belong to is found and + * *reduced*. + * + * - `yysstack`: reference to the parser state stack. This one carries the internal parser + * *states* such as the one in `yystate`, which are used to represent + * the parser state machine in the *parse table*. *Very* *internal* stuff, + * what can I say? If you access this one, you're clearly doing wicked things + * + * - `...` : the extra arguments you specified in the `%parse-param` statement in your + * grammar definition file. + * + * table: [...], + * State transition table + * ---------------------- + * + * index levels are: + * - `state` --> hash table + * - `symbol` --> action (number or array) + * + * If the `action` is an array, these are the elements' meaning: + * - index [0]: 1 = shift, 2 = reduce, 3 = accept + * - index [1]: GOTO `state` + * + * If the `action` is a number, it is the GOTO `state` + * + * defaultActions: {...}, + * + * parseError: function(str, hash, ExceptionClass), + * yyError: function(str, ...), + * yyRecovering: function(), + * yyErrOk: function(), + * yyClearIn: function(), + * + * constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this parser kernel in many places; example usage: + * + * var infoObj = parser.constructParseErrorInfo('fail!', null, + * parser.collect_expected_token_set(state), true); + * var retVal = parser.parseError(infoObj.errStr, infoObj, parser.JisonParserError); + * + * originalParseError: function(str, hash, ExceptionClass), + * The basic `parseError` handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function + * at the end of the `parse()`. + * + * options: { ... parser %options ... }, + * + * parse: function(input[, args...]), + * Parse the given `input` and return the parsed value (or `true` when none was provided by + * the root action, in which case the parser is acting as a *matcher*). + * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * the lexer section of the grammar spec): these will be inserted in the `yy` shared state + * object and any collision with those will be reported by the lexer via a thrown exception. + * + * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown + * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY + * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and + * the internal parser gets properly garbage collected under these particular circumstances. + * + * yyMergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API can be invoked to calculate a spanning `yylloc` location info object. + * + * Note: %epsilon rules MAY specify no `first_index` and `first_yylloc`, in which case + * this function will attempt to obtain a suitable location marker by inspecting the location stack + * backwards. + * + * For more info see the documentation comment further below, immediately above this function's + * implementation. + * + * lexer: { + * yy: {...}, A reference to the so-called "shared state" `yy` once + * received via a call to the `.setInput(input, yy)` lexer API. + * EOF: 1, + * ERROR: 2, + * JisonLexerError: function(msg, hash), + * parseError: function(str, hash, ExceptionClass), + * setInput: function(input, [yy]), + * input: function(), + * unput: function(str), + * more: function(), + * reject: function(), + * less: function(n), + * pastInput: function(n), + * upcomingInput: function(n), + * showPosition: function(), + * test_match: function(regex_match_array, rule_index, ...), + * next: function(...), + * lex: function(...), + * begin: function(condition), + * pushState: function(condition), + * popState: function(), + * topState: function(), + * _currentRules: function(), + * stateStackSize: function(), + * cleanupAfterLex: function() + * + * options: { ... lexer %options ... }, + * + * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...), + * rules: [...], + * conditions: {associative list: name ==> set}, + * } + * } + * + * + * token location info (@$, _$, etc.): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer and + * parser errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * } + * + * parser (grammar) errors will also provide these additional members: + * + * { + * expected: (array describing the set of expected tokens; + * may be UNDEFINED when we cannot easily produce such a set) + * state: (integer (or array when the table includes grammar collisions); + * represents the current internal state of the parser kernel. + * can, for example, be used to pass to the `collect_expected_token_set()` + * API to obtain the expected token set) + * action: (integer; represents the current internal action which will be executed) + * new_state: (integer; represents the next/planned internal state, once the current + * action has executed) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, + * for instance, for advanced error analysis and reporting) + * value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used, + * for instance, for advanced error analysis and reporting) + * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, + * for instance, for advanced error analysis and reporting) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * parser: (reference to the current parser instance) + * } + * + * while `this` will reference the current parser instance. + * + * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * lexer: (reference to the current lexer instance which reported the error) + * } + * + * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired + * from either the parser or lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * exception: (reference to the exception thrown) + * } + * + * Please do note that in the latter situation, the `expected` field will be omitted as + * this type of failure is assumed not to be due to *parse errors* but rather due to user + * action code in either parser or lexer failing unexpectedly. + * + * --- + * + * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + * These options are available: + * + * ### options which are global for all parser instances + * + * Parser.pre_parse: function(yy) + * optional: you can specify a pre_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. + * Parser.post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: you can specify a post_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. When it does not return any value, + * the parser will return the original `retval`. + * + * ### options which can be set up per parser instance + * + * yy: { + * pre_parse: function(yy) + * optional: is invoked before the parse cycle starts (and before the first + * invocation of `lex()`) but immediately after the invocation of + * `parser.pre_parse()`). + * post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: is invoked when the parse terminates due to success ('accept') + * or failure (even when exceptions are thrown). + * `retval` contains the return value to be produced by `Parser.parse()`; + * this function can override the return value by returning another. + * When it does not return any value, the parser will return the original + * `retval`. + * This function is invoked immediately before `parser.post_parse()`. + * + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * quoteName: function(name), + * optional: overrides the default `quoteName` function. + * } + * + * parser.lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this `%option` has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + // See also: + // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + // with userland code which might access the derived class in a 'classic' way. + function JisonParserError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonParserError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + + var stacktrace; + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = new Error(msg).stack; + } + } + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } + } + + if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonParserError.prototype, Error.prototype); + } else { + JisonParserError.prototype = Object.create(Error.prototype); + } + JisonParserError.prototype.constructor = JisonParserError; + JisonParserError.prototype.name = 'JisonParserError'; + + // import XRegExp from '@gerhobbelt/xregexp'; + // import helpers from 'jison-helpers-lib'; + // import fs from 'fs'; + + + // helper: reconstruct the productions[] table + function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([p[i], r[i]]); + } + return rv; + } + + // helper: reconstruct the defaultActions[] table + function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; + } + + // helper: reconstruct the 'goto' table + function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [m.shift(), g.shift()]; + break; + + case 0: + q[z] = a.shift(); + break; + + default: + // type === 1: accept + q[z] = [3]; + } + } + rv.push(q); + } + return rv; + } + + // helper: runlength encoding with increment step: code, length: step (default step = 0) + // `this` references an array + function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } + } + + // helper: duplicate sequence from *relative* offset and length. + // `this` references an array + function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } + } + + // helper: unpack an array using helpers and data, all passed in an array argument 'a'. + function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; + } + + var parser = { + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // default action mode: ............. classic,merge + // no try..catch: ................... false + // no default resolve on conflict: false + // on-demand look-ahead: ............ false + // error recovery token skip maximum: 3 + // yyerror in parse actions is: ..... NOT recoverable, + // yyerror in lexer actions and other non-fatal lexer are: + // .................................. NOT recoverable, + // debug grammar/output: ............ false + // has partial LR conflict upgrade: true + // rudimentary token-stack support: false + // parser table compression mode: ... 2 + // export debug tables: ............. false + // export *all* tables: ............. false + // module type: ..................... es + // parser engine type: .............. lalr + // output main() in the module: ..... true + // number of expected conflicts: .... 0 + // + // + // Parser Analysis flags: + // + // no significant actions (parser is a language matcher only): + // .................................. false + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses ParseError API: ............. false + // uses YYERROR: .................... true + // uses YYRECOVERING: ............... false + // uses YYERROK: .................... false + // uses YYCLEARIN: .................. false + // tracks rule values: .............. true + // assigns rule values: ............. true + // uses location tracking: .......... true + // assigns location: ................ true + // uses yystack: .................... false + // uses yysstack: ................... false + // uses yysp: ....................... true + // uses yyrulelength: ............... false + // uses yyMergeLocationInfo API: .... true + // has error recovery: .............. true + // has error reporting: ............. true + // + // --------- END OF REPORT ----------- + + trace: function no_op_trace() {}, + JisonParserError: JisonParserError, + yy: {}, + options: { + type: "lalr", + hasPartialLrUpgradeOnConflict: true, + errorRecoveryTokenDiscardCount: 3 + }, + symbols_: { + "$": 17, + "$accept": 0, + "$end": 1, + "%%": 19, + "(": 10, + ")": 11, + "*": 7, + "+": 12, + ",": 8, + ".": 15, + "/": 14, + "/!": 39, + "<": 5, + "=": 18, + ">": 6, + "?": 13, + "ACTION": 32, + "ACTION_BODY": 33, + "ACTION_BODY_CPP_COMMENT": 35, + "ACTION_BODY_C_COMMENT": 34, + "ACTION_BODY_WHITESPACE": 36, + "ACTION_END": 31, + "ACTION_START": 28, + "BRACKET_MISSING": 29, + "BRACKET_SURPLUS": 30, + "CHARACTER_LIT": 46, + "CODE": 53, + "EOF": 1, + "ESCAPE_CHAR": 44, + "IMPORT": 24, + "INCLUDE": 51, + "INCLUDE_PLACEMENT_ERROR": 37, + "INIT_CODE": 25, + "NAME": 20, + "NAME_BRACE": 40, + "OPTIONS": 47, + "OPTIONS_END": 48, + "OPTION_STRING_VALUE": 49, + "OPTION_VALUE": 50, + "PATH": 52, + "RANGE_REGEX": 45, + "REGEX_SET": 43, + "REGEX_SET_END": 42, + "REGEX_SET_START": 41, + "SPECIAL_GROUP": 38, + "START_COND": 27, + "START_EXC": 22, + "START_INC": 21, + "STRING_LIT": 26, + "UNKNOWN_DECL": 23, + "^": 16, + "action": 68, + "action_body": 69, + "any_group_regex": 78, + "definition": 58, + "definitions": 57, + "error": 2, + "escape_char": 81, + "extra_lexer_module_code": 87, + "import_name": 60, + "import_path": 61, + "include_macro_code": 88, + "init": 56, + "init_code_name": 59, + "lex": 54, + "module_code_chunk": 89, + "name_expansion": 77, + "name_list": 71, + "names_exclusive": 63, + "names_inclusive": 62, + "nonempty_regex_list": 74, + "option": 86, + "option_list": 85, + "optional_module_code_chunk": 90, + "options": 84, + "range_regex": 82, + "regex": 72, + "regex_base": 76, + "regex_concat": 75, + "regex_list": 73, + "regex_set": 79, + "regex_set_atom": 80, + "rule": 67, + "rule_block": 66, + "rules": 64, + "rules_and_epilogue": 55, + "rules_collective": 65, + "start_conditions": 70, + "string": 83, + "{": 3, + "|": 9, + "}": 4 + }, + terminals_: { + 1: "EOF", + 2: "error", + 3: "{", + 4: "}", + 5: "<", + 6: ">", + 7: "*", + 8: ",", + 9: "|", + 10: "(", + 11: ")", + 12: "+", + 13: "?", + 14: "/", + 15: ".", + 16: "^", + 17: "$", + 18: "=", + 19: "%%", + 20: "NAME", + 21: "START_INC", + 22: "START_EXC", + 23: "UNKNOWN_DECL", + 24: "IMPORT", + 25: "INIT_CODE", + 26: "STRING_LIT", + 27: "START_COND", + 28: "ACTION_START", + 29: "BRACKET_MISSING", + 30: "BRACKET_SURPLUS", + 31: "ACTION_END", + 32: "ACTION", + 33: "ACTION_BODY", + 34: "ACTION_BODY_C_COMMENT", + 35: "ACTION_BODY_CPP_COMMENT", + 36: "ACTION_BODY_WHITESPACE", + 37: "INCLUDE_PLACEMENT_ERROR", + 38: "SPECIAL_GROUP", + 39: "/!", + 40: "NAME_BRACE", + 41: "REGEX_SET_START", + 42: "REGEX_SET_END", + 43: "REGEX_SET", + 44: "ESCAPE_CHAR", + 45: "RANGE_REGEX", + 46: "CHARACTER_LIT", + 47: "OPTIONS", + 48: "OPTIONS_END", + 49: "OPTION_STRING_VALUE", + 50: "OPTION_VALUE", + 51: "INCLUDE", + 52: "PATH", + 53: "CODE" + }, + TERROR: 2, + EOF: 1, + + // internals: defined here so the object *structure* doesn't get modified by parse() et al, + // thus helping JIT compilers like Chrome V8. + originalQuoteName: null, + originalParseError: null, + cleanupAfterParse: null, + constructParseErrorInfo: null, + yyMergeLocationInfo: null, + + __reentrant_call_depth: 0, // INTERNAL USE ONLY + __error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup + __error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup + + // APIs which will be set up depending on user action code analysis: + //yyRecovering: 0, + //yyErrOk: 0, + //yyClearIn: 0, + + // Helper APIs + // ----------- + + // Helper function which can be overridden by user code later on: put suitable quotes around + // literal IDs in a description string. + quoteName: function parser_quoteName(id_str) { + return '"' + id_str + '"'; + }, + + // Return the name of the given symbol (terminal or non-terminal) as a string, when available. + // + // Return NULL when the symbol is unknown to the parser. + getSymbolName: function parser_getSymbolName(symbol) { + if (this.terminals_[symbol]) { + return this.terminals_[symbol]; + } + + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. + // + // An example of this may be where a rule's action code contains a call like this: + // + // parser.getSymbolName(#$) + // + // to obtain a human-readable name of the current grammar rule. + var s = this.symbols_; + for (var key in s) { + if (s[key] === symbol) { + return key; + } + } + return null; + }, + + // Return a more-or-less human-readable description of the given symbol, when available, + // or the symbol itself, serving as its own 'description' for lack of something better to serve up. + // + // Return NULL when the symbol is unknown to the parser. + describeSymbol: function parser_describeSymbol(symbol) { + if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { + return this.terminal_descriptions_[symbol]; + } else if (symbol === this.EOF) { + return 'end of input'; + } + var id = this.getSymbolName(symbol); + if (id) { + return this.quoteName(id); + } + return null; + }, + + // Produce a (more or less) human-readable list of expected tokens at the point of failure. + // + // The produced list may contain token or token set descriptions instead of the tokens + // themselves to help turning this output into something that easier to read by humans + // unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*, + // expected terminals and nonterminals is produced. + // + // The returned list (array) will not contain any duplicate entries. + collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) { + var TERROR = this.TERROR; + var tokenset = []; + var check = {}; + // Has this (error?) state been outfitted with a custom expectations description text for human consumption? + // If so, use that one instead of the less palatable token set. + if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { + return [this.state_descriptions_[state]]; + } + for (var p in this.table[state]) { + p = +p; + if (p !== TERROR) { + var d = do_not_describe ? p : this.describeSymbol(p); + if (d && !check[d]) { + tokenset.push(d); + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + } + } + } + return tokenset; + }, + productions_: bp({ + pop: u([54, 54, s, [55, 3], 56, 57, 57, s, [58, 11], 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, s, [65, 4], 66, 66, 67, 67, s, [68, 3], s, [69, 9], s, [70, 4], 71, 71, 72, s, [73, 4], s, [74, 4], 75, 75, s, [76, 17], 77, 78, 78, 79, 79, 80, s, [80, 4, 1], 83, 84, 85, 85, s, [86, 6], 87, 87, 88, 88, s, [89, 3], 90, 90]), + rule: u([s, [4, 3], 2, 0, 0, 2, 0, s, [2, 3], s, [1, 3], 3, 3, 2, 3, 3, s, [1, 7], 2, 1, 2, c, [23, 3], 4, 4, 3, c, [29, 4], s, [3, 3], s, [2, 8], 0, s, [3, 3], 0, 1, 3, 1, s, [3, 4, -1], c, [21, 3], c, [40, 3], s, [3, 4], s, [2, 5], c, [12, 3], s, [1, 6], c, [16, 3], c, [10, 8], c, [9, 3], s, [3, 4], c, [10, 4], c, [32, 5], 0]) + }), + performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyvstack, yylstack) { + + /* this == yyval */ + + // the JS engine itself can go and remove these statements when `yy` turns out to be unused in any action code! + var yy = this.yy; + var yyparser = yy.parser; + var yylexer = yy.lexer; + + switch (yystate) { + case 0: + /*! Production:: $accept : lex $end */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yylstack[yysp - 1]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + + case 1: + /*! Production:: lex : init definitions rules_and_epilogue EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + this.$.macros = yyvstack[yysp - 2].macros; + this.$.startConditions = yyvstack[yysp - 2].startConditions; + this.$.unknownDecls = yyvstack[yysp - 2].unknownDecls; + + // if there are any options, add them all, otherwise set options to NULL: + // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: + for (var k in yy.options) { + this.$.options = yy.options; + break; + } + + if (yy.actionInclude) { + var asrc = yy.actionInclude.join('\n\n'); + // Only a non-empty action code chunk should actually make it through: + if (asrc.trim() !== '') { + this.$.actionInclude = asrc; + } + } + + delete yy.options; + delete yy.actionInclude; + return this.$; + break; + + case 2: + /*! Production:: lex : init definitions error EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject, yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); + break; + + case 3: + /*! Production:: rules_and_epilogue : "%%" rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; + } else { + this.$ = { rules: yyvstack[yysp - 2] }; + } + break; + + case 4: + /*! Production:: rules_and_epilogue : "%%" rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: yyvstack[yysp] }; + break; + + case 5: + /*! Production:: rules_and_epilogue : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: [] }; + break; + + case 6: + /*! Production:: init : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.actionInclude = []; + if (!yy.options) yy.options = {}; + break; + + case 7: + /*! Production:: definitions : definitions definition */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + if (yyvstack[yysp] != null) { + if ('length' in yyvstack[yysp]) { + this.$.macros[yyvstack[yysp][0]] = yyvstack[yysp][1]; + } else if (yyvstack[yysp].type === 'names') { + for (var name in yyvstack[yysp].names) { + this.$.startConditions[name] = yyvstack[yysp].names[name]; + } + } else if (yyvstack[yysp].type === 'unknown') { + this.$.unknownDecls.push(yyvstack[yysp].body); + } + } + break; + + case 8: + /*! Production:: definitions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + macros: {}, // { hash table } + startConditions: {}, // { hash table } + unknownDecls: [] // [ array of [key,value] pairs } + }; + break; + + case 9: + /*! Production:: definition : NAME regex */ + case 38: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + + case 10: + /*! Production:: definition : START_INC names_inclusive */ + case 11: + /*! Production:: definition : START_EXC names_exclusive */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + + case 12: + /*! Production:: definition : action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + yy.actionInclude.push(yyvstack[yysp]);this.$ = null; + break; + + case 13: + /*! Production:: definition : options */ + case 99: + /*! Production:: option_list : option */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + + case 14: + /*! Production:: definition : UNKNOWN_DECL */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { type: 'unknown', body: yyvstack[yysp] }; + break; + + case 15: + /*! Production:: definition : IMPORT import_name import_path */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp] }; + break; + + case 16: + /*! Production:: definition : IMPORT import_name error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject2, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 17: + /*! Production:: definition : IMPORT error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject3, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + break; + + case 18: + /*! Production:: definition : INIT_CODE init_code_name action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + type: 'codesection', + qualifier: yyvstack[yysp - 1], + include: yyvstack[yysp] + }; + break; + + case 19: + /*! Production:: definition : INIT_CODE error action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject4, yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp]), yyvstack[yysp - 1].errStr)); + break; + + case 20: + /*! Production:: init_code_name : NAME */ + case 21: + /*! Production:: init_code_name : STRING_LIT */ + case 22: + /*! Production:: import_name : NAME */ + case 23: + /*! Production:: import_name : STRING_LIT */ + case 24: + /*! Production:: import_path : NAME */ + case 25: + /*! Production:: import_path : STRING_LIT */ + case 61: + /*! Production:: regex_list : regex_concat */ + case 66: + /*! Production:: nonempty_regex_list : regex_concat */ + case 68: + /*! Production:: regex_concat : regex_base */ + case 93: + /*! Production:: escape_char : ESCAPE_CHAR */ + case 94: + /*! Production:: range_regex : RANGE_REGEX */ + case 106: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + case 110: + /*! Production:: module_code_chunk : CODE */ + case 113: + /*! Production:: optional_module_code_chunk : module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + + case 26: + /*! Production:: names_inclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { type: 'names', names: {} };this.$.names[yyvstack[yysp]] = 0; + break; + + case 27: + /*! Production:: names_inclusive : names_inclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1];this.$.names[yyvstack[yysp]] = 0; + break; + + case 28: + /*! Production:: names_exclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { type: 'names', names: {} };this.$.names[yyvstack[yysp]] = 1; + break; + + case 29: + /*! Production:: names_exclusive : names_exclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1];this.$.names[yyvstack[yysp]] = 1; + break; + + case 30: + /*! Production:: rules : rules rules_collective */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); + break; + + case 31: + /*! Production:: rules : %epsilon */ + case 37: + /*! Production:: rule_block : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = []; + break; + + case 32: + /*! Production:: rules_collective : start_conditions rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 1]) { + yyvstack[yysp].unshift(yyvstack[yysp - 1]); + } + this.$ = [yyvstack[yysp]]; + break; + + case 33: + /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 3]) { + yyvstack[yysp - 1].forEach(function (d) { + d.unshift(yyvstack[yysp - 3]); + }); + } + this.$ = yyvstack[yysp - 1]; + break; + + case 34: + /*! Production:: rules_collective : start_conditions "{" error "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject5, yyvstack[yysp - 3].join(','), yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo(yysp - 3, yysp), yylstack[yysp - 3]), yyvstack[yysp - 1].errStr)); + break; + + case 35: + /*! Production:: rules_collective : start_conditions "{" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject6, yyvstack[yysp - 2].join(','), yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 36: + /*! Production:: rule_block : rule_block rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1];this.$.push(yyvstack[yysp]); + break; + + case 39: + /*! Production:: rule : regex error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + yyparser.yyError(rmCommonWS(_templateObject7, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + break; + + case 40: + /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject8, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]))); + break; + + case 41: + /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject9, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]))); + break; + + case 42: + /*! Production:: action : ACTION_START action_body ACTION_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var s = yyvstack[yysp - 1].trim(); + // remove outermost set of braces UNLESS there's + // a curly brace in there anywhere: in that case + // we should leave it up to the sophisticated + // code analyzer to simplify the code! + // + // This is a very rough check as it will also look + // inside code comments, which should not have + // any influence. + // + // Nevertheless: this is a *safe* transform! + if (s[0] === '{' && s.indexOf('}') === s.length - 1) { + this.$ = s.substring(1, s.length - 1).trim(); + } else { + this.$ = s; + } + break; + + case 43: + /*! Production:: action_body : action_body ACTION */ + case 48: + /*! Production:: action_body : action_body include_macro_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; + break; + + case 44: + /*! Production:: action_body : action_body ACTION_BODY */ + case 45: + /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ + case 46: + /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ + case 47: + /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ + case 67: + /*! Production:: regex_concat : regex_concat regex_base */ + case 79: + /*! Production:: regex_base : regex_base range_regex */ + case 89: + /*! Production:: regex_set : regex_set regex_set_atom */ + case 111: + /*! Production:: module_code_chunk : module_code_chunk CODE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; + break; + + case 49: + /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject10, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]))); + break; + + case 50: + /*! Production:: action_body : action_body error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject11, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + break; + + case 51: + /*! Production:: action_body : %epsilon */ + case 62: + /*! Production:: regex_list : %epsilon */ + case 114: + /*! Production:: optional_module_code_chunk : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ''; + break; + + case 52: + /*! Production:: start_conditions : "<" name_list ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + break; + + case 53: + /*! Production:: start_conditions : "<" name_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject12, yyvstack[yysp - 1].join(','), yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 54: + /*! Production:: start_conditions : "<" "*" ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ['*']; + break; + + case 55: + /*! Production:: start_conditions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + + case 56: + /*! Production:: name_list : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp]]; + break; + + case 57: + /*! Production:: name_list : name_list "," NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2];this.$.push(yyvstack[yysp]); + break; + + case 58: + /*! Production:: regex : nonempty_regex_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Detect if the regex ends with a pure (Unicode) word; + // we *do* consider escaped characters which are 'alphanumeric' + // to be equivalent to their non-escaped version, hence these are + // all valid 'words' for the 'easy keyword rules' option: + // + // - hello_kitty + // - γεια_σου_γατοÏλα + // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 + // + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // + // As we only check the *tail*, we also accept these as + // 'easy keywords': + // + // - %options + // - %foo-bar + // - +++a:b:c1 + // + // Note the dash in that last example: there the code will consider + // `bar` to be the keyword, which is fine with us as we're only + // interested in the trailing boundary and patching that one for + // the `easy_keyword_rules` option. + this.$ = yyvstack[yysp]; + if (yy.options.easy_keyword_rules) { + // We need to 'protect' `eval` here as keywords are allowed + // to contain double-quotes and other leading cruft. + // `eval` *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `eval(str)` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. + this.$ = this.$.replace(/\\\\/g, '.').replace(/"/g, '.').replace(/\\c[A-Z]/g, '.').replace(/\\[^xu0-9]/g, '.'); + + try { + // Convert Unicode escapes and other escapes to their literal characters + // BEFORE we go and check whether this item is subject to the + // `easy_keyword_rules` option. + this.$ = JSON.parse('"' + this.$ + '"'); + } catch (ex) { + yyparser.warn('easy-keyword-rule FAIL on eval: ', ex); + + // make the next keyword test fail: + this.$ = '.'; + } + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: + var re = new XRegExp('\\w[\\w\\d]*$'); + if (XRegExp.match(this.$, re)) { + this.$ = yyvstack[yysp] + "\\b"; + } else { + this.$ = yyvstack[yysp]; + } + } + break; + + case 59: + /*! Production:: regex_list : regex_list "|" regex_concat */ + case 63: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; + break; + + case 60: + /*! Production:: regex_list : regex_list "|" */ + case 64: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '|'; + break; + + case 65: + /*! Production:: nonempty_regex_list : "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '|' + yyvstack[yysp]; + break; + + case 69: + /*! Production:: regex_base : "(" regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(' + yyvstack[yysp - 1] + ')'; + break; + + case 70: + /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; + break; + + case 71: + /*! Production:: regex_base : "(" regex_list error */ + case 72: + /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject13, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 73: + /*! Production:: regex_base : regex_base "+" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '+'; + break; + + case 74: + /*! Production:: regex_base : regex_base "*" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '*'; + break; + + case 75: + /*! Production:: regex_base : regex_base "?" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '?'; + break; + + case 76: + /*! Production:: regex_base : "/" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?=' + yyvstack[yysp] + ')'; + break; + + case 77: + /*! Production:: regex_base : "/!" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?!' + yyvstack[yysp] + ')'; + break; + + case 78: + /*! Production:: regex_base : name_expansion */ + case 80: + /*! Production:: regex_base : any_group_regex */ + case 84: + /*! Production:: regex_base : string */ + case 85: + /*! Production:: regex_base : escape_char */ + case 86: + /*! Production:: name_expansion : NAME_BRACE */ + case 90: + /*! Production:: regex_set : regex_set_atom */ + case 91: + /*! Production:: regex_set_atom : REGEX_SET */ + case 96: + /*! Production:: string : CHARACTER_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + + case 81: + /*! Production:: regex_base : "." */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '.'; + break; + + case 82: + /*! Production:: regex_base : "^" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '^'; + break; + + case 83: + /*! Production:: regex_base : "$" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '$'; + break; + + case 87: + /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ + case 107: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + + case 88: + /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject14, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 92: + /*! Production:: regex_set_atom : name_expansion */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) && yyvstack[yysp].toUpperCase() !== yyvstack[yysp]) { + // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories + this.$ = yyvstack[yysp]; + } else { + this.$ = yyvstack[yysp]; + } + //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + break; + + case 95: + /*! Production:: string : STRING_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = prepareString(yyvstack[yysp]); + break; + + case 97: + /*! Production:: options : OPTIONS option_list OPTIONS_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + + case 98: + /*! Production:: option_list : option option_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + + case 100: + /*! Production:: option : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp]] = true; + break; + + case 101: + /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; + break; + + case 102: + /*! Production:: option : NAME "=" OPTION_VALUE */ + case 103: + /*! Production:: option : NAME "=" NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); + break; + + case 104: + /*! Production:: option : NAME "=" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS(_templateObject15, $option, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + break; + + case 105: + /*! Production:: option : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS(_templateObject16, yylexer.prettyPrintRange(yylexer, yylstack[yysp]), yyvstack[yysp].errStr)); + break; + + case 108: + /*! Production:: include_macro_code : INCLUDE PATH */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); + // And no, we don't support nested '%include': + this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; + break; + + case 109: + /*! Production:: include_macro_code : INCLUDE error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject17, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + break; + + case 112: + /*! Production:: module_code_chunk : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS(_templateObject18, yylexer.prettyPrintRange(yylexer, yylstack[yysp]), yyvstack[yysp].errStr)); + break; + + case 145: + // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! + // error recovery reduction action (action generated by jison, + // using the user-specified `%code error_recovery_reduction` %{...%} + // code chunk below. + + + break; + + } + }, + table: bt({ + len: u([13, 1, 12, 15, 1, 1, 11, 18, 21, 2, 2, s, [11, 3], 4, 4, 12, 4, 1, 1, 19, 11, 12, 18, 29, 30, 22, 22, 17, 17, s, [29, 7], 31, 5, s, [29, 3], s, [12, 4], 4, 11, 3, 3, 2, 2, 1, 1, 12, 1, 5, 4, 3, 7, 17, 23, 3, 30, 29, 30, s, [29, 5], 3, 20, 3, 30, 30, 6, s, [4, 3], 12, 12, s, [11, 6], s, [27, 3], s, [11, 8], 2, 11, 1, 4, 3, 2, s, [3, 3], 17, 16, 3, 3, 1, 3, s, [29, 3], 21, s, [29, 4], 4, 13, 13, s, [3, 4], 6, 3, 23, s, [18, 3], 14, 14, 1, 14, 20, 2, 17, 14, 17, 3]), + symbol: u([1, 2, s, [19, 7, 1], 28, 47, 54, 56, 1, c, [14, 11], 57, c, [12, 11], 55, 58, 68, 84, s, [1, 3], c, [17, 10], 1, 3, 5, 9, 10, s, [14, 4, 1], 19, 26, s, [38, 4, 1], 44, 46, 64, c, [15, 6], c, [14, 7], 72, s, [74, 5, 1], 81, 83, 27, 62, 27, 63, c, [54, 12], c, [11, 21], 2, 20, 26, 60, c, [4, 3], 59, 2, s, [29, 9, 1], 51, 69, 2, 20, 85, 86, s, [1, 3], c, [102, 16], 65, 70, c, [67, 13], 9, c, [12, 9], c, [125, 12], c, [123, 6], c, [30, 3], c, [59, 6], s, [20, 7, 1], 28, c, [29, 6], 47, c, [29, 7], 7, s, [9, 9, 1], c, [33, 14], 45, 46, 47, 82, c, [58, 3], 11, c, [80, 11], 73, c, [81, 6], c, [22, 22], c, [121, 12], c, [17, 22], c, [108, 29], c, [29, 199], s, [42, 6, 1], 40, 43, 77, 79, 80, c, [123, 89], c, [19, 7], 27, c, [572, 11], c, [12, 27], c, [593, 3], 61, c, [612, 14], c, [3, 3], 28, 68, 28, 68, 28, 28, c, [616, 11], 88, 48, 2, 20, 48, 85, 86, 2, 18, 20, c, [9, 4], 1, 2, 51, 53, 87, 89, 90, c, [630, 17], 3, c, [732, 13], 67, c, [733, 8], 7, 20, 71, c, [613, 24], c, [643, 65], c, [507, 145], 2, 9, 11, c, [769, 15], c, [789, 7], 11, c, [201, 59], 82, 2, 40, 42, 43, 77, 80, c, [6, 4], c, [4, 8], c, [476, 33], c, [11, 59], 3, 4, c, [473, 8], c, [401, 15], c, [27, 54], c, [584, 11], c, [11, 78], 52, c, [182, 11], c, [664, 3], 49, 50, 1, 51, 88, 1, 51, 1, 51, 53, c, [3, 7], c, [672, 16], 2, 4, c, [673, 13], 66, 2, 28, 68, 2, 6, 8, 6, c, [4, 3], c, [642, 58], c, [525, 31], c, [522, 13], c, [750, 8], c, [662, 115], c, [562, 5], c, [315, 10], 53, c, [13, 13], c, [979, 3], c, [3, 9], c, [988, 4], c, [987, 3], 51, 53, c, [300, 14], c, [973, 9], 1, c, [487, 10], c, [27, 7], c, [18, 36], c, [1050, 14], c, [14, 14], 20, c, [15, 14], c, [830, 20], c, [469, 3], c, [460, 16], c, [159, 14], c, [491, 18], 6, 8]), + type: u([s, [2, 11], 0, 0, 1, c, [14, 12], c, [26, 13], 0, c, [15, 12], s, [2, 19], c, [31, 14], s, [0, 8], c, [23, 3], c, [56, 31], c, [62, 10], c, [112, 13], c, [67, 4], c, [40, 20], c, [78, 36], c, [123, 7], c, [30, 28], c, [203, 43], c, [205, 9], c, [22, 34], c, [17, 34], s, [2, 224], c, [239, 141], c, [139, 19], c, [655, 16], c, [14, 5], c, [180, 13], c, [194, 34], s, [0, 9], c, [98, 21], c, [643, 86], c, [492, 151], c, [494, 34], c, [231, 35], c, [802, 238], c, [716, 74], c, [44, 28], c, [708, 37], c, [522, 78], c, [454, 163], c, [164, 19], c, [973, 11], c, [830, 147], s, [2, 21]]), + state: u([s, [1, 4, 1], 6, 11, 12, 20, 21, 22, 24, 25, 30, 31, 36, 35, 42, 44, 46, 50, 54, 55, 56, 60, 61, 64, c, [15, 5], 65, c, [5, 4], 69, 71, 72, c, [13, 5], 73, c, [7, 6], 74, c, [5, 4], 75, c, [5, 4], 79, 76, 77, 82, 86, 87, 96, 101, 56, 103, 105, 104, 108, 110, c, [66, 7], 111, 114, c, [58, 11], c, [6, 6], 69, 79, 122, 129, 131, 133, c, [12, 5], 139, c, [29, 5], 105, 140, 142, c, [47, 8], c, [22, 5]]), + mode: u([s, [2, 23], s, [1, 12], s, [2, 28], s, [1, 15], s, [2, 33], c, [39, 17], c, [13, 6], c, [18, 7], c, [64, 21], c, [21, 10], c, [106, 15], c, [75, 12], 1, c, [90, 10], c, [27, 6], c, [72, 23], c, [40, 8], c, [45, 7], c, [15, 13], s, [1, 24], s, [2, 234], c, [236, 98], c, [97, 24], c, [24, 15], c, [374, 20], c, [432, 5], c, [409, 15], c, [568, 9], c, [47, 20], c, [454, 17], c, [561, 23], c, [585, 53], c, [442, 145], c, [718, 19], c, [780, 33], c, [29, 25], c, [759, 238], c, [796, 51], c, [289, 5], c, [1211, 12], c, [722, 35], c, [340, 9], c, [648, 24], c, [854, 59], c, [1199, 170], c, [311, 6], c, [969, 23], c, [1128, 90], c, [291, 66]]), + goto: u([s, [6, 11], s, [8, 11], 5, 5, s, [7, 4, 1], s, [13, 7, 1], s, [7, 11], s, [31, 17], 23, 26, 28, 32, 33, 34, 39, 27, 29, 37, 38, 41, 40, 43, 45, s, [12, 11], s, [13, 11], s, [14, 11], 47, 48, 49, 51, 52, 53, s, [51, 11], 58, 57, 1, 2, 4, 55, 62, s, [55, 6], 59, s, [55, 7], s, [9, 11], 58, 58, 63, s, [58, 9], c, [108, 12], s, [66, 3], c, [15, 5], s, [66, 7], 39, 66, c, [23, 7], 68, 68, 67, s, [68, 3], c, [7, 3], s, [68, 17], 70, 68, 68, 62, 62, 26, 62, c, [68, 11], c, [15, 15], c, [95, 12], c, [12, 12], s, [78, 29], s, [80, 29], s, [81, 29], s, [82, 29], s, [83, 29], s, [84, 29], s, [85, 29], s, [86, 31], 37, 78, s, [95, 29], s, [96, 29], s, [93, 29], s, [10, 9], 80, 10, 10, s, [26, 12], s, [11, 9], 81, 11, 11, s, [28, 12], 83, 84, 85, s, [17, 11], s, [22, 3], s, [23, 3], 16, 16, 20, 21, 98, s, [88, 8, 1], 97, 99, 100, 58, 57, 99, 100, 102, 100, 100, s, [105, 3], 114, 107, 114, 106, s, [30, 17], 109, c, [667, 13], 112, 113, s, [64, 3], c, [17, 5], s, [64, 7], 39, 64, c, [25, 6], 64, s, [65, 3], c, [24, 5], s, [65, 7], 39, 65, c, [24, 6], 65, s, [67, 6], 66, 68, s, [67, 18], 70, 67, 67, s, [73, 29], s, [74, 29], s, [75, 29], s, [79, 29], s, [94, 29], 116, 117, 115, 61, 61, 26, 61, c, [242, 11], 119, 117, 118, 76, 76, 67, s, [76, 3], 66, 68, s, [76, 18], 70, 76, 76, 77, 77, 67, s, [77, 3], 66, 68, s, [77, 18], 70, 77, 77, 121, 37, 120, 78, s, [90, 4], s, [91, 4], s, [92, 4], s, [27, 12], s, [29, 12], s, [15, 11], s, [16, 11], s, [24, 11], s, [25, 11], s, [18, 11], s, [19, 11], s, [40, 27], s, [41, 27], s, [42, 27], s, [43, 11], s, [44, 11], s, [45, 11], s, [46, 11], s, [47, 11], s, [48, 11], s, [49, 11], s, [50, 11], 124, 123, s, [97, 11], 98, 128, 127, 125, 126, 3, 99, 106, 106, 113, 113, 130, s, [110, 3], s, [112, 3], s, [32, 17], 132, s, [37, 14], 134, 16, 136, 135, 137, 138, s, [56, 3], s, [63, 3], c, [624, 5], s, [63, 7], 39, 63, c, [431, 6], 63, s, [69, 29], s, [71, 29], 60, 60, 26, 60, c, [505, 11], s, [70, 29], s, [72, 29], s, [87, 29], s, [88, 29], s, [89, 4], s, [108, 13], s, [109, 13], s, [101, 3], s, [102, 3], s, [103, 3], s, [104, 3], c, [940, 4], s, [111, 3], 141, c, [926, 13], 35, 35, 143, s, [35, 15], s, [38, 18], s, [39, 18], s, [52, 14], s, [53, 14], 144, s, [54, 14], 59, 59, 26, 59, c, [112, 11], 107, 107, s, [33, 17], s, [36, 14], s, [34, 17], s, [57, 3]]) + }), + defaultActions: bda({ + idx: u([0, 2, 6, 7, 11, 12, 13, 16, 18, 19, 21, s, [30, 8, 1], 39, 40, s, [41, 4, 2], 48, 49, 52, 53, 58, 60, s, [66, 5, 1], s, [77, 22, 1], 100, 101, 104, 106, 107, 108, 113, 115, 116, s, [118, 11, 1], 130, s, [133, 4, 1], 138, s, [140, 5, 1]]), + goto: u([6, 8, 7, 31, 12, 13, 14, 51, 1, 2, 9, 78, s, [80, 7, 1], 95, 96, 93, 26, 28, 17, 22, 23, 20, 21, 105, 30, 73, 74, 75, 79, 94, 90, 91, 92, 27, 29, 15, 16, 24, 25, 18, 19, s, [40, 11, 1], 97, 98, 106, 110, 112, 32, 56, 69, 71, 70, 72, 87, 88, 89, 108, 109, s, [101, 4, 1], 111, 38, 39, 52, 53, 54, 107, 33, 36, 34, 57]) + }), + parseError: function parseError(str, hash, ExceptionClass) { + if (hash.recoverable && typeof this.trace === 'function') { + this.trace(str); + hash.destroy(); // destroy... well, *almost*! + } else { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + throw new ExceptionClass(str, hash); + } + }, + parse: function parse(input) { + var self = this; + var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage) + var sstack = new Array(128); // state stack: stores states (column storage) + + var vstack = new Array(128); // semantic value stack + var lstack = new Array(128); // location stack + var table = this.table; + var sp = 0; // 'stack pointer': index into the stacks + var yyloc; + + var symbol = 0; + var preErrorSymbol = 0; + var lastEofErrorStateDepth = 0; + var recoveringErrorInfo = null; + var recovering = 0; // (only used when the grammar contains error recovery rules) + var TERROR = this.TERROR; + var EOF = this.EOF; + var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = this.options.errorRecoveryTokenDiscardCount | 0 || 3; + var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + + var lexer; + if (this.__lexer__) { + lexer = this.__lexer__; + } else { + lexer = this.__lexer__ = Object.create(this.lexer); + } + + var sharedState_yy = { + parseError: undefined, + quoteName: undefined, + lexer: undefined, + parser: undefined, + pre_parse: undefined, + post_parse: undefined, + pre_lex: undefined, + post_lex: undefined + }; + + if (typeof assert !== 'function') { + assert = function JisonAssert(cond, msg) { + if (!cond) { + throw new Error('assertion failed: ' + (msg || '***')); + } + }; + } + + this.yyGetSharedState = function yyGetSharedState() { + return sharedState_yy; + }; + + this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() { + return recoveringErrorInfo; + }; + + // shallow clone objects, straight copy of simple `src` values + // e.g. `lexer.yytext` MAY be a complex value object, + // rather than a simple string/value. + function shallow_copy(src) { + if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) === 'object') { + var dst = {}; + for (var k in src) { + if (Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + return dst; + } + return src; + } + function shallow_copy_noclobber(dst, src) { + for (var k in src) { + if (typeof dst[k] === 'undefined' && Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + } + function copy_yylloc(loc) { + var rv = shallow_copy(loc); + if (rv && rv.range) { + rv.range = rv.range.slice(0); + } + return rv; + } + + // copy state + shallow_copy_noclobber(sharedState_yy, this.yy); + + sharedState_yy.lexer = lexer; + sharedState_yy.parser = this; + + // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount + // to have *their* closure match ours -- if we only set them up once, + // any subsequent `parse()` runs will fail in very obscure ways when + // these functions are invoked in the user action code block(s) as + // their closure will still refer to the `parse()` instance which set + // them up. Hence we MUST set them up at the start of every `parse()` run! + if (this.yyError) { + this.yyError = function yyError(str /*, ...args */) { + + var error_rule_depth = this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1; + var expected = this.collect_expected_token_set(state); + var hash = this.constructParseErrorInfo(str, null, expected, error_rule_depth >= 0); + // append to the old one? + if (recoveringErrorInfo) { + var esp = recoveringErrorInfo.info_stack_pointer; + + recoveringErrorInfo.symbol_stack[esp] = symbol; + var v = this.shallowCopyErrorInfo(hash); + v.yyError = true; + v.errorRuleDepth = error_rule_depth; + v.recovering = recovering; + // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH; + + recoveringErrorInfo.value_stack[esp] = v; + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + } else { + recoveringErrorInfo = this.shallowCopyErrorInfo(hash); + recoveringErrorInfo.yyError = true; + recoveringErrorInfo.errorRuleDepth = error_rule_depth; + recoveringErrorInfo.recovering = recovering; + } + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + if (args.length) { + hash.extra_error_attributes = args; + } + + var r = this.parseError(str, hash, this.JisonParserError); + return r; + }; + } + + // Does the shared state override the default `parseError` that already comes with this instance? + if (typeof sharedState_yy.parseError === 'function') { + this.parseError = function parseErrorAlt(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + return sharedState_yy.parseError.call(this, str, hash, ExceptionClass); + }; + } else { + this.parseError = this.originalParseError; + } + + // Does the shared state override the default `quoteName` that already comes with this instance? + if (typeof sharedState_yy.quoteName === 'function') { + this.quoteName = function quoteNameAlt(id_str) { + return sharedState_yy.quoteName.call(this, id_str); + }; + } else { + this.quoteName = this.originalQuoteName; + } + + // set up the cleanup function; make it an API so that external code can re-use this one in case of + // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which + // case this parse() API method doesn't come with a `finally { ... }` block any more! + // + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `sharedState`, etc. references will be *wrong*! + this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) { + var rv; + + if (invoke_post_methods) { + var hash; + + if (sharedState_yy.post_parse || this.post_parse) { + // create an error hash info instance: we re-use this API in a **non-error situation** + // as this one delivers all parser internals ready for access by userland code. + hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false); + } + + if (sharedState_yy.post_parse) { + rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + if (this.post_parse) { + rv = this.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + + // cleanup: + if (hash && hash.destroy) { + hash.destroy(); + } + } + + if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. + + // clean up the lingering lexer structures as well: + if (lexer.cleanupAfterLex) { + lexer.cleanupAfterLex(do_not_nuke_errorinfos); + } + + // prevent lingering circular references from causing memory leaks: + if (sharedState_yy) { + sharedState_yy.lexer = undefined; + sharedState_yy.parser = undefined; + if (lexer.yy === sharedState_yy) { + lexer.yy = undefined; + } + } + sharedState_yy = undefined; + this.parseError = this.originalParseError; + this.quoteName = this.originalQuoteName; + + // nuke the vstack[] array at least as that one will still reference obsoleted user values. + // To be safe, we nuke the other internal stack columns as well... + stack.length = 0; // fastest way to nuke an array without overly bothering the GC + sstack.length = 0; + lstack.length = 0; + vstack.length = 0; + sp = 0; + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_infos.length = 0; + + for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) { + var el = this.__error_recovery_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_recovery_infos.length = 0; + + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + recoveringErrorInfo = undefined; + } + } + + return resultValue; + }; + + // merge yylloc info into a new yylloc instance. + // + // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array. + // + // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which + // case these override the corresponding first/last indexes. + // + // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search + // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!) + // yylloc info. + // + // Note: epsilon rule's yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL. + this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) { + var i1 = first_index | 0, + i2 = last_index | 0; + var l1 = first_yylloc, + l2 = last_yylloc; + var rv; + + // rules: + // - first/last yylloc entries override first/last indexes + + if (!l1) { + if (first_index != null) { + for (var i = i1; i <= i2; i++) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + } + + if (!l2) { + if (last_index != null) { + for (var i = i2; i >= i1; i--) { + l2 = lstack[i]; + if (l2) { + break; + } + } + } + } + + // - detect if an epsilon rule is being processed and act accordingly: + if (!l1 && first_index == null) { + // epsilon rule span merger. With optional look-ahead in l2. + if (!dont_look_back) { + for (var i = (i1 || sp) - 1; i >= 0; i--) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + if (!l1) { + if (!l2) { + // when we still don't have any valid yylloc info, we're looking at an epsilon rule + // without look-ahead and no preceding terms and/or `dont_look_back` set: + // in that case we ca do nothing but return NULL/UNDEFINED: + return undefined; + } else { + // shallow-copy L2: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l2); + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + return rv; + } + } else { + // shallow-copy L1, then adjust first col/row 1 column past the end. + rv = shallow_copy(l1); + rv.first_line = rv.last_line; + rv.first_column = rv.last_column; + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + rv.range[0] = rv.range[1]; + } + + if (l2) { + // shallow-mixin L2, then adjust last col/row accordingly. + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + return rv; + } + } + + if (!l1) { + l1 = l2; + l2 = null; + } + if (!l1) { + return undefined; + } + + // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l1); + + // first_line: ..., + // first_column: ..., + // last_line: ..., + // last_column: ..., + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + + if (l2) { + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + + return rv; + }; + + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `lexer`, `sharedState`, etc. references will be *wrong*! + this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { + var pei = { + errStr: msg, + exception: ex, + text: lexer.match, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, + token_id: symbol, + line: lexer.yylineno, + loc: copy_yylloc(lexer.yylloc), + expected: expected, + recoverable: recoverable, + state: state, + action: action, + new_state: newState, + symbol_stack: stack, + state_stack: sstack, + value_stack: vstack, + location_stack: lstack, + stack_pointer: sp, + yy: sharedState_yy, + lexer: lexer, + parser: this, + + // and make sure the error info doesn't stay due to potential + // ref cycle via userland code manipulations. + // These would otherwise all be memory leak opportunities! + // + // Note that only array and object references are nuked as those + // constitute the set of elements which can produce a cyclic ref. + // The rest of the members is kept intact as they are harmless. + destroy: function destructParseErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // info.value = null; + // info.value_stack = null; + // ... + var rec = !!this.recoverable; + for (var key in this) { + if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { + this[key] = undefined; + } + } + this.recoverable = rec; + } + }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + return pei; + }; + + // clone some parts of the (possibly enhanced!) errorInfo object + // to give them some persistence. + this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) { + var rv = shallow_copy(p); + + // remove the large parts which can only cause cyclic references + // and are otherwise available from the parser kernel anyway. + delete rv.sharedState_yy; + delete rv.parser; + delete rv.lexer; + + // lexer.yytext MAY be a complex value object, rather than a simple string/value: + rv.value = shallow_copy(rv.value); + + // yylloc info: + rv.loc = copy_yylloc(rv.loc); + + // the 'expected' set won't be modified, so no need to clone it: + //rv.expected = rv.expected.slice(0); + + //symbol stack is a simple array: + rv.symbol_stack = rv.symbol_stack.slice(0); + // ditto for state stack: + rv.state_stack = rv.state_stack.slice(0); + // clone the yylloc's in the location stack?: + rv.location_stack = rv.location_stack.map(copy_yylloc); + // and the value stack may carry both simple and complex values: + // shallow-copy the latter. + rv.value_stack = rv.value_stack.map(shallow_copy); + + // and we don't bother with the sharedState_yy reference: + //delete rv.yy; + + // now we prepare for tracking the COMBINE actions + // in the error recovery code path: + // + // as we want to keep the maximum error info context, we + // *scan* the state stack to find the first *empty* slot. + // This position will surely be AT OR ABOVE the current + // stack pointer, but we want to keep the 'used but discarded' + // part of the parse stacks *intact* as those slots carry + // error context that may be useful when you want to produce + // very detailed error diagnostic reports. + // + // ### Purpose of each stack pointer: + // + // - stack_pointer: points at the top of the parse stack + // **as it existed at the time of the error + // occurrence, i.e. at the time the stack + // snapshot was taken and copied into the + // errorInfo object.** + // - base_pointer: the bottom of the **empty part** of the + // stack, i.e. **the start of the rest of + // the stack space /above/ the existing + // parse stack. This section will be filled + // by the error recovery process as it + // travels the parse state machine to + // arrive at the resolving error recovery rule.** + // - info_stack_pointer: + // this stack pointer points to the **top of + // the error ecovery tracking stack space**, i.e. + // this stack pointer takes up the role of + // the `stack_pointer` for the error recovery + // process. Any mutations in the **parse stack** + // are **copy-appended** to this part of the + // stack space, keeping the bottom part of the + // stack (the 'snapshot' part where the parse + // state at the time of error occurrence was kept) + // intact. + // - root_failure_pointer: + // copy of the `stack_pointer`... + // + for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== 'undefined'; i++) { + // empty + } + rv.base_pointer = i; + rv.info_stack_pointer = i; + + rv.root_failure_pointer = rv.stack_pointer; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_recovery_infos.push(rv); + + return rv; + }; + + function getNonTerminalFromCode(symbol) { + var tokenName = self.getSymbolName(symbol); + if (!tokenName) { + tokenName = symbol; + } + return tokenName; + } + + function lex() { + var token = lexer.lex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + if (typeof Jison !== 'undefined' && Jison.lexDebugger) { + var tokenName = self.getSymbolName(token || EOF); + if (!tokenName) { + tokenName = token; + } + + Jison.lexDebugger.push({ + tokenName: tokenName, + tokenText: lexer.match, + tokenValue: lexer.yytext + }); + } + + return token || EOF; + } + + var state, action, r, t; + var yyval = { + $: true, + _$: undefined, + yy: sharedState_yy + }; + var p; + var yyrulelen; + var this_production; + var newState; + var retval = false; + + // Return the rule stack depth where the nearest error rule can be found. + // Return -1 when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = sp - 1; + var depth = 0; + + // try to recover from error + for (;;) { + // check for error recovery rule in this state + + + var t = table[state][TERROR] || NO_ACTION; + if (t[0]) { + // We need to make sure we're not cycling forever: + // once we hit EOF, even when we `yyerrok()` an error, we must + // prevent the core from running forever, + // e.g. when parent rules are still expecting certain input to + // follow after this, for example when you handle an error inside a set + // of braces which are matched by a parent rule in your grammar. + // + // Hence we require that every error handling/recovery attempt + // *after we've hit EOF* has a diminishing state stack: this means + // we will ultimately have unwound the state stack entirely and thus + // terminate the parse in a controlled fashion even when we have + // very complex error/recovery code interplay in the core + user + // action code blocks: + + + if (symbol === EOF) { + if (!lastEofErrorStateDepth) { + lastEofErrorStateDepth = sp - 1 - depth; + } else if (lastEofErrorStateDepth <= sp - 1 - depth) { + + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + continue; + } + } + return depth; + } + if (state === 0 /* $accept rule */ || stack_probe < 1) { + + return -1; // No suitable error recovery rule available. + } + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + } + } + + try { + this.__reentrant_call_depth++; + + lexer.setInput(input, sharedState_yy); + + yyloc = lexer.yylloc; + lstack[sp] = yyloc; + vstack[sp] = null; + sstack[sp] = 0; + stack[sp] = 0; + ++sp; + + if (this.pre_parse) { + this.pre_parse.call(this, sharedState_yy); + } + if (sharedState_yy.pre_parse) { + sharedState_yy.pre_parse.call(this, sharedState_yy); + } + + newState = sstack[sp - 1]; + for (;;) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // The single `==` condition below covers both these `===` comparisons in a single + // operation: + // + // if (symbol === null || typeof symbol === 'undefined') ... + if (!symbol) { + symbol = lex(); + } + // read action for current state and first input + t = table[state] && table[state][symbol] || NO_ACTION; + newState = t[1]; + action = t[0]; + + // handle parse error + if (!action) { + // first see if there's any chance at hitting an error recovery rule: + var error_rule_depth = locateNearestErrorRecoveryRule(state); + var errStr = null; + var errSymbolDescr = this.describeSymbol(symbol) || symbol; + var expected = this.collect_expected_token_set(state); + + if (!recovering) { + // Report error + if (typeof lexer.yylineno === 'number') { + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; + } else { + errStr = 'Parse error: '; + } + + if (typeof lexer.showPosition === 'function') { + errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; + } + if (expected.length) { + errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; + } else { + errStr += 'Unexpected ' + errSymbolDescr; + } + + p = this.constructParseErrorInfo(errStr, null, expected, error_rule_depth >= 0); + + // cleanup the old one before we start the new error info track: + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + } + recoveringErrorInfo = this.shallowCopyErrorInfo(p); + + r = this.parseError(p.errStr, p, this.JisonParserError); + + // Protect against overly blunt userland `parseError` code which *sets* + // the `recoverable` flag without properly checking first: + // we always terminate the parse when there's no recovery rule available anyhow! + if (!p.recoverable || error_rule_depth < 0) { + retval = r; + break; + } else { + // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process... + } + } + + var esp = recoveringErrorInfo.info_stack_pointer; + + // just recovered from another error + if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { + // SHIFT current lookahead and grab another + recoveringErrorInfo.symbol_stack[esp] = symbol; + recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState; // push state + ++esp; + + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + yyloc = lexer.yylloc; + + preErrorSymbol = 0; + symbol = lex(); + } + + // try to recover from error + if (error_rule_depth < 0) { + assert(recovering > 0); + recoveringErrorInfo.info_stack_pointer = esp; + + // barf a fatal hairball when we're out of look-ahead symbols and none hit a match + // while we are still busy recovering from another error: + var po = this.__error_infos[this.__error_infos.length - 1]; + if (!po) { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error.', null, expected, false); + } else { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error. Previous error which resulted in this fatal result: ' + po.errStr, null, expected, false); + p.extra_error_attributes = po; + } + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + + preErrorSymbol = symbol === TERROR ? 0 : symbol; // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + + var EXTRA_STACK_SAMPLE_DEPTH = 3; + + // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token: + recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol; + if (errStr) { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + errorStr: errStr, + errorSymbolDescr: errSymbolDescr, + expectedStr: expected, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + } else { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + } + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + yyval.$ = recoveringErrorInfo; + yyval._$ = undefined; + + yyrulelen = error_rule_depth; + + r = this.performAction.call(yyval, yyloc, NO_ACTION[1], sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // and move the top entries + discarded part of the parse stacks onto the error info stack: + for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) { + recoveringErrorInfo.symbol_stack[esp] = stack[idx]; + recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]); + recoveringErrorInfo.state_stack[esp] = sstack[idx]; + } + + recoveringErrorInfo.symbol_stack[esp] = TERROR; + recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$); + + // goto new state = table[STATE][NONTERMINAL] + newState = sstack[sp - 1]; + + if (this.defaultActions[newState]) { + recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState]; + } else { + t = table[newState] && table[newState][symbol] || NO_ACTION; + recoveringErrorInfo.state_stack[esp] = t[1]; + } + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + // allow N (default: 3) real symbols to be shifted before reporting a new error + recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; + + // Now duplicate the standard parse machine here, at least its initial + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // as we wish to push something special then! + + + // Run the state machine in this copy of the parser state machine + // until we *either* consume the error symbol (and its related information) + // *or* we run into another error while recovering from this one + // *or* we execute a `reduce` action which outputs a final parse + // result (yes, that MAY happen!)... + + assert(recoveringErrorInfo); + assert(symbol === TERROR); + while (symbol) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // read action for current state and first input + t = table[state] && table[state][symbol] || NO_ACTION; + newState = t[1]; + action = t[0]; + + // encountered another parse error? If so, break out to main loop + // and take it from there! + if (!action) { + newState = state; + break; + } + } + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + + // shift: + case 1: + stack[sp] = symbol; + //vstack[sp] = lexer.yytext; + assert(recoveringErrorInfo); + vstack[sp] = recoveringErrorInfo; + //lstack[sp] = copy_yylloc(lexer.yylloc); + lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); + sstack[sp] = newState; // push state + ++sp; + symbol = 0; + if (!preErrorSymbol) { + // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + // read action for current state and first input + t = table[newState] && table[newState][symbol] || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + symbol = 0; + } + } + + // once we have pushed the special ERROR token value, we're done in this inner loop! + break; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + // signal end of error recovery loop AND end of outer parse loop + action = 3; + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + break; + } + + // break out of loop: we accept or fail with error + break; + } + + // should we also break out of the regular/outer parse loop, + // i.e. did the parser already produce a parse result in here?! + if (action === 3) { + break; + } + continue; + } + } + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + + // shift: + case 1: + stack[sp] = symbol; + vstack[sp] = lexer.yytext; + lstack[sp] = copy_yylloc(lexer.yylloc); + sstack[sp] = newState; // push state + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + var tokenName = self.getSymbolName(symbol || EOF); + if (!tokenName) { + tokenName = symbol; + } + + Jison.parserDebugger.push({ + action: 'shift', + text: lexer.yytext, + terminal: tokenName, + terminal_id: symbol + }); + } + + ++sp; + symbol = 0; + assert(preErrorSymbol === 0); + if (!preErrorSymbol) { + // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + // read action for current state and first input + t = table[newState] && table[newState][symbol] || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + symbol = 0; + } + } + + continue; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { + var prereduceValue = vstack.slice(sp - yyrulelen, sp); + var debuggableProductions = []; + for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { + var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); + debuggableProductions.push(debuggableProduction); + } + // find the current nonterminal name (- nolan) + var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; + var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); + + Jison.parserDebugger.push({ + action: 'reduce', + nonterminal: currentNonterminal, + nonterminal_id: currentNonterminalCode, + prereduce: prereduceValue, + result: r, + productions: debuggableProductions, + text: yyval.$ + }); + } + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'accept', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + + break; + } + + // break out of loop: we accept or fail with error + break; + } + } catch (ex) { + // report exceptions through the parseError callback too, but keep the exception intact + // if it is a known parser or lexer error which has been thrown by parseError() already: + if (ex instanceof this.JisonParserError) { + throw ex; + } else if (lexer && typeof lexer.JisonLexerError === 'function' && ex instanceof lexer.JisonLexerError) { + throw ex; + } else { + p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + } + } finally { + retval = this.cleanupAfterParse(retval, true, true); + this.__reentrant_call_depth--; + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'return', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + } // /finally + + return retval; + }, + yyError: 1 + }; + parser.originalParseError = parser.parseError; + parser.originalQuoteName = parser.quoteName; + + var rmCommonWS = helpers.rmCommonWS; + + function encodeRE(s) { + return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); + } + + function prepareString(s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; + } + + // convert string value to number or boolean value, when possible + // (and when this is more or less obviously the intent) + // otherwise produce the string itself as value. + function parseValue(v) { + if (v === 'false') { + return false; + } + if (v === 'true') { + return true; + } + // http://stackoverflow.com/questions/175739/is-there-a-built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number + // Note that the `v` check ensures that we do not convert `undefined`, `null` and `''` (empty string!) + if (v && !isNaN(v)) { + var rv = +v; + if (isFinite(rv)) { + return rv; + } + } + return v; + } + + parser.warn = function p_warn() { + console.warn.apply(console, arguments); + }; + + parser.log = function p_log() { + console.log.apply(console, arguments); + }; + + parser.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse:', arguments); + }; + + parser.yy.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse YY:', arguments); + }; + + parser.yy.post_lex = function p_lex() { + if (parser.yydebug) parser.log('post_lex:', arguments); + }; + /* lexer generated by jison-lex 0.6.0-194*/ + + /* + * Returns a Lexer object of the following structure: + * + * Lexer: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a direct reference! + * + * This "shared context" object was passed to the lexer by way of + * the `lexer.setInput(str, yy)` API before you may use it. + * + * This "shared context" object is passed to the lexer action code in `performAction()` + * so userland code in the lexer actions may communicate with the outside world + * and/or other lexer rules' actions in more or less complex ways. + * + * } + * + * Lexer.prototype: { + * EOF: 1, + * ERROR: 2, + * + * yy: The overall "shared context" object reference. + * + * JisonLexerError: function(msg, hash), + * + * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `lexer` instance. + * `yy_` is an alias for `this` lexer instance reference used internally. + * + * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer + * by way of the `lexer.setInput(str, yy)` API before. + * + * Note: + * The extra arguments you specified in the `%parse-param` statement in your + * **parser** grammar definition file are passed to the lexer via this object + * reference as member variables. + * + * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. + * + * - `YY_START`: the current lexer "start condition" state. + * + * parseError: function(str, hash, ExceptionClass), + * + * constructLexErrorInfo: function(error_message, is_recoverable), + * Helper function. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this lexer kernel in many places; example usage: + * + * var infoObj = lexer.constructParseErrorInfo('fail!', true); + * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); + * + * options: { ... lexer %options ... }, + * + * lex: function(), + * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. + * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the **parser** or the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * cleanupAfterLex: function(do_not_nuke_errorinfos), + * Helper function. + * + * This helper API is invoked when the **parse process** has completed: it is the responsibility + * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. + * + * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. + * + * setInput: function(input, [yy]), + * + * + * input: function(), + * + * + * unput: function(str), + * + * + * more: function(), + * + * + * reject: function(), + * + * + * less: function(n), + * + * + * pastInput: function(n), + * + * + * upcomingInput: function(n), + * + * + * showPosition: function(), + * + * + * test_match: function(regex_match_array, rule_index), + * + * + * next: function(), + * + * + * begin: function(condition), + * + * + * pushState: function(condition), + * + * + * popState: function(), + * + * + * topState: function(), + * + * + * _currentRules: function(), + * + * + * stateStackSize: function(), + * + * + * performAction: function(yy, yy_, yyrulenumber, YY_START), + * + * + * rules: [...], + * + * + * conditions: {associative list: name ==> set}, + * } + * + * + * token location info (`yylloc`): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * } + * + * while `this` will reference the current lexer instance. + * + * When `parseError` is invoked by the lexer, the default implementation will + * attempt to invoke `yy.parser.parseError()`; when this callback is not provided + * it will try to invoke `yy.parseError()` instead. When that callback is also not + * provided, a `JisonLexerError` exception will be thrown containing the error + * message and `hash`, as constructed by the `constructLexErrorInfo()` API. + * + * Note that the lexer's `JisonLexerError` error class is passed via the + * `ExceptionClass` argument, which is invoked to construct the exception + * instance to be thrown, so technically `parseError` will throw the object + * produced by the `new ExceptionClass(str, hash)` JavaScript expression. + * + * --- + * + * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. + * These options are available: + * + * (Options are permanent.) + * + * yy: { + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * } + * + * lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * WARNING: the next set of options are not meant to be changed. They echo the abilities of + * the lexer as per when it was compiled! + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + var lexer = function () { + // See also: + // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + // with userland code which might access the derived class in a 'classic' way. + function JisonLexerError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonLexerError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + var stacktrace; + + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = new Error(msg).stack; + } + } + + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } + } + + if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); + } else { + JisonLexerError.prototype = Object.create(Error.prototype); + } + + JisonLexerError.prototype.constructor = JisonLexerError; + JisonLexerError.prototype.name = 'JisonLexerError'; + + var lexer = { + + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // backtracking: .................... false + // location.ranges: ................. true + // location line+column tracking: ... true + // + // + // Forwarded Parser Analysis flags: + // + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses lexer values: ............... true/ true + // location tracking: ............... true + // location assignment: ............. true + // + // + // Lexer Analysis flags: + // + // uses yyleng: ..................... ??? + // uses yylineno: ................... ??? + // uses yytext: ..................... ??? + // uses yylloc: ..................... ??? + // uses ParseError API: ............. ??? + // uses yyerror: .................... ??? + // uses location tracking & editing: ??? + // uses more() API: ................. ??? + // uses unput() API: ................ ??? + // uses reject() API: ............... ??? + // uses less() API: ................. ??? + // uses display APIs pastInput(), upcomingInput(), showPosition(): + // ............................. ??? + // uses describeYYLLOC() API: ....... ??? + // + // --------- END OF REPORT ----------- + + + EOF: 1, + + ERROR: 2, + + // JisonLexerError: JisonLexerError, /// <-- injected by the code generator + + // options: {}, /// <-- injected by the code generator + + // yy: ..., /// <-- injected by setInput() + + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + + /** + * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + * + * @public + * @this {RegExpLexer} + */ + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + /** @constructor */ + var pei = { + errStr: msg, + recoverable: !!recoverable, + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + token: null, + line: this.yylineno, + loc: this.yylloc, + yy: this.yy, + lexer: this, + + /** + * and make sure the error info doesn't stay due to potential + * ref cycle via userland code manipulations. + * These would otherwise all be memory leak opportunities! + * + * Note that only array and object references are nuked as those + * constitute the set of elements which can produce a cyclic ref. + * The rest of the members is kept intact as they are harmless. + * + * @public + * @this {LexErrorInfo} + */ + destroy: function destructLexErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // ... + var rec = !!this.recoverable; + + for (var key in this) { + if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { + this[key] = undefined; + } + } + + this.recoverable = rec; + } + }; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + + return pei; + }, + + /** + * handler which is invoked when a lexer error occurs. + * + * @public + * @this {RegExpLexer} + */ + parseError: function lexer_parseError(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonLexerError; + } + + if (this.yy) { + if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { + return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } else if (typeof this.yy.parseError === 'function') { + return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } + } + + throw new ExceptionClass(str, hash); + }, + + /** + * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions. + * + * @public + * @this {RegExpLexer} + */ + yyerror: function yyError(str /*, ...args */) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': ' + str, this.options.lexerErrorsAreRecoverable); + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + + if (args.length) { + p.extra_error_attributes = args; + } + + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + }, + + /** + * final cleanup function for when we have completed lexing the input; + * make it an API so that external code can use this one once userland + * code has decided it's time to destroy any lingering lexer error + * hash object instances and the like: this function helps to clean + * up these constructs, which *may* carry cyclic references which would + * otherwise prevent the instances from being properly and timely + * garbage-collected, i.e. this function helps prevent memory leaks! + * + * @public + * @this {RegExpLexer} + */ + cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + this.setInput('', {}); + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + + this.__error_infos.length = 0; + } + + return this; + }, + + /** + * clear the lexer token context; intended for internal use only + * + * @public + * @this {RegExpLexer} + */ + clear: function lexer_clear() { + this.yytext = ''; + this.yyleng = 0; + this.match = ''; + + // - DO NOT reset `this.matched` + this.matches = false; + + this._more = false; + this._backtrack = false; + var col = this.yylloc ? this.yylloc.last_column : 0; + + this.yylloc = { + first_line: this.yylineno + 1, + first_column: col, + last_line: this.yylineno + 1, + last_column: col, + range: [this.offset, this.offset] + }; + }, + + /** + * resets the lexer, sets new input + * + * @public + * @this {RegExpLexer} + */ + setInput: function lexer_setInput(input, yy) { + this.yy = yy || this.yy || {}; + + // also check if we've fully initialized the lexer instance, + // including expansion work to be done to go from a loaded + // lexer to a usable lexer: + if (!this.__decompressed) { + // step 1: decompress the regex list: + var rules = this.rules; + + for (var i = 0, len = rules.length; i < len; i++) { + var rule_re = rules[i]; + + // compression: is the RE an xref to another RE slot in the rules[] table? + if (typeof rule_re === 'number') { + rules[i] = rules[rule_re]; + } + } + + // step 2: unfold the conditions[] set to make these ready for use: + var conditions = this.conditions; + + for (var k in conditions) { + var spec = conditions[k]; + var rule_ids = spec.rules; + var len = rule_ids.length; + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_new_ids = new Array(len + 1); + + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; + } + + spec.rules = rule_new_ids; + spec.__rule_regexes = rule_regexes; + spec.__rule_count = len; + } + + this.__decompressed = true; + } + + this._input = input || ''; + this.clear(); + this._signaled_error_token = false; + this.done = false; + this.yylineno = 0; + this.matched = ''; + this.conditionStack = ['INITIAL']; + this.__currentRuleSet__ = null; + + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0, + range: [0, 0] + }; + + this.offset = 0; + return this; + }, + + /** + * edit the remaining input via user-specified callback. + * This can be used to forward-adjust the input-to-parse, + * e.g. inserting macro expansions and alike in the + * input which has yet to be lexed. + * The behaviour of this API contrasts the `unput()` et al + * APIs as those act on the *consumed* input, while this + * one allows one to manipulate the future, without impacting + * the current `yyloc` cursor location or any history. + * + * Use this API to help implement C-preprocessor-like + * `#include` statements, etc. + * + * The provided callback must be synchronous and is + * expected to return the edited input (string). + * + * The `cpsArg` argument value is passed to the callback + * as-is. + * + * `callback` interface: + * `function callback(input, cpsArg)` + * + * - `input` will carry the remaining-input-to-lex string + * from the lexer. + * - `cpsArg` is `cpsArg` passed into this API. + * + * The `this` reference for the callback will be set to + * reference this lexer instance so that userland code + * in the callback can easily and quickly access any lexer + * API. + * + * When the callback returns a non-string-type falsey value, + * we assume the callback did not edit the input and we + * will using the input as-is. + * + * When the callback returns a non-string-type value, it + * is converted to a string for lexing via the `"" + retval` + * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html + * -- that way any returned object's `toValue()` and `toString()` + * methods will be invoked in a proper/desirable order.) + * + * @public + * @this {RegExpLexer} + */ + editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) { + var rv = callback.call(this, this._input, cpsArg); + + if (typeof rv !== 'string') { + if (rv) { + this._input = '' + rv; + } + // else: keep `this._input` as is. + } else { + this._input = rv; + } + + return this; + }, + + /** + * consumes and returns one char from the input + * + * @public + * @this {RegExpLexer} + */ + input: function lexer_input() { + if (!this._input) { + //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) + return null; + } + + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + + // Count the linenumber up when we hit the LF (or a stand-alone CR). + // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo + // and we advance immediately past the LF as well, returning both together as if + // it was all a single 'character' only. + var slice_len = 1; + + var lines = false; + + if (ch === '\n') { + lines = true; + } else if (ch === '\r') { + lines = true; + var ch2 = this._input[1]; + + if (ch2 === '\n') { + slice_len++; + ch += ch2; + this.yytext += ch2; + this.yyleng++; + this.offset++; + this.match += ch2; + this.matched += ch2; + this.yylloc.range[1]++; + } + } + + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + this.yylloc.last_column = 0; + } else { + this.yylloc.last_column++; + } + + this.yylloc.range[1]++; + this._input = this._input.slice(slice_len); + return ch; + }, + + /** + * unshifts one char (or an entire string) into the input + * + * @public + * @this {RegExpLexer} + */ + unput: function lexer_unput(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.yyleng = this.yytext.length; + this.offset -= len; + this.match = this.match.substr(0, this.match.length - len); + this.matched = this.matched.substr(0, this.matched.length - len); + + if (lines.length > 1) { + this.yylineno -= lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); + + if (pre_lines.length === 1) { + pre = this.matched; + pre_lines = pre.split(/(?:\r\n?|\n)/g); + } + + this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; + } else { + this.yylloc.last_column -= len; + } + + this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; + this.done = false; + return this; + }, + + /** + * cache matched text and append it on next action + * + * @public + * @this {RegExpLexer} + */ + more: function lexer_more() { + this._more = true; + return this; + }, + + /** + * signal the lexer that this rule fails to match the input, so the + * next matching rule (regex) should be tested instead. + * + * @public + * @this {RegExpLexer} + */ + reject: function lexer_reject() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + // when the `parseError()` call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // `.lex()` run. + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, false); + + this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + + return this; + }, + + /** + * retain first n characters of the match + * + * @public + * @this {RegExpLexer} + */ + less: function lexer_less(n) { + return this.unput(this.match.slice(n)); + }, + + /** + * return (part of the) already matched input, i.e. for error + * messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of + * input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * @public + * @this {RegExpLexer} + */ + pastInput: function lexer_pastInput(maxSize, maxLines) { + var past = this.matched.substring(0, this.matched.length - this.match.length); + + if (maxSize < 0) maxSize = past.length;else if (!maxSize) maxSize = 20; + + if (maxLines < 0) maxLines = past.length; // can't ever have more input lines than this! + else if (!maxLines) maxLines = 1; + + // `substr` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + past = past.substr(-maxSize * 2 - 2); + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = past.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(-maxLines); + past = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis prefix... + if (past.length > maxSize) { + past = '...' + past.substr(-maxSize); + } + + return past; + }, + + /** + * return (part of the) upcoming input, i.e. for error messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * > ### NOTE ### + * > + * > *"upcoming input"* is defined as the whole of the both + * > the *currently lexed* input, together with any remaining input + * > following that. *"currently lexed"* input is the input + * > already recognized by the lexer but not yet returned with + * > the lexer token. This happens when you are invoking this API + * > from inside any lexer rule action code block. + * > + * + * @public + * @this {RegExpLexer} + */ + upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { + var next = this.match; + + if (maxSize < 0) maxSize = next.length + this._input.length;else if (!maxSize) maxSize = 20; + + if (maxLines < 0) maxLines = maxSize; // can't ever have more input lines than this! + else if (!maxLines) maxLines = 1; + + // `substring` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + if (next.length < maxSize * 2 + 2) { + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + } + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = next.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(0, maxLines); + next = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis postfix... + if (next.length > maxSize) { + next = next.substring(0, maxSize) + '...'; + } + + return next; + }, + + /** + * return a string which displays the character position where the + * lexing error occurred, i.e. for error messages + * + * @public + * @this {RegExpLexer} + */ + showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { + var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; + }, + + /** + * return a string which displays the lines & columns of input which are referenced + * by the given location info range, plus a few lines of context. + * + * This function pretty-prints the indicated section of the input, with line numbers + * and everything! + * + * This function is very useful to provide highly readable error reports, while + * the location range may be specified in various flexible ways: + * + * - `loc` is the location info object which references the area which should be + * displayed and 'marked up': these lines & columns of text are marked up by `^` + * characters below each character in the entire input range. + * + * - `context_loc` is the *optional* location info object which instructs this + * pretty-printer how much *leading* context should be displayed alongside + * the area referenced by `loc`. This can help provide context for the displayed + * error, etc. + * + * When this location info is not provided, a default context of 3 lines is + * used. + * + * - `context_loc2` is another *optional* location info object, which serves + * a similar purpose to `context_loc`: it specifies the amount of *trailing* + * context lines to display in the pretty-print output. + * + * When this location info is not provided, a default context of 1 line only is + * used. + * + * Special Notes: + * + * - when the `loc`-indicated range is very large (about 5 lines or more), then + * only the first and last few lines of this block are printed while a + * `...continued...` message will be printed between them. + * + * This serves the purpose of not printing a huge amount of text when the `loc` + * range happens to be huge: this way a manageable & readable output results + * for arbitrary large ranges. + * + * - this function can display lines of input which whave not yet been lexed. + * `prettyPrintRange()` can access the entire input! + * + * @public + * @this {RegExpLexer} + */ + prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { + var CONTEXT = 3; + var CONTEXT_TAIL = 1; + var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var input = this.matched + this._input; + var lines = input.split('\n'); + + //var show_context = (error_size < 5 || context_loc); + var l0 = Math.max(1, context_loc ? context_loc.first_line : loc.first_line - CONTEXT); + + var l1 = Math.max(1, context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL); + var lineno_display_width = 1 + Math.log10(l1 | 1) | 0; + var ws_prefix = new Array(lineno_display_width).join(' '); + var nonempty_line_indexes = []; + + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ': ' + line; + var errpfx = new Array(lineno_display_width + 1).join('^'); + + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + + var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); + + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } + + rv = rv.replace(/\t/g, ' '); + return rv; + }); + + // now make sure we don't print an overly large amount of error area: limit it + // to the top and bottom line count: + if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { + var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; + + console.log('clip off: ', { + start: clip_start, + end: clip_end, + len: clip_end - clip_start + 1, + arr: nonempty_line_indexes, + rv: rv + }); + + var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; + intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; + rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); + } + + return rv.join('\n'); + }, + + /** + * helper function, used to produce a human readable description as a string, given + * the input `yylloc` location object. + * + * Set `display_range_too` to TRUE to include the string character index position(s) + * in the description if the `yylloc.range` is available. + * + * @public + * @this {RegExpLexer} + */ + describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { + var l1 = yylloc.first_line; + var l2 = yylloc.last_line; + var c1 = yylloc.first_column; + var c2 = yylloc.last_column; + var dl = l2 - l1; + var dc = c2 - c1; + var rv; + + if (dl === 0) { + rv = 'line ' + l1 + ', '; + + if (dc <= 1) { + rv += 'column ' + c1; + } else { + rv += 'columns ' + c1 + ' .. ' + c2; + } + } else { + rv = 'lines ' + l1 + '(column ' + c1 + ') .. ' + l2 + '(column ' + c2 + ')'; + } + + if (yylloc.range && display_range_too) { + var r1 = yylloc.range[0]; + var r2 = yylloc.range[1] - 1; + + if (r2 <= r1) { + rv += ' {String Offset: ' + r1 + '}'; + } else { + rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; + } + } + + return rv; + }, + + /** + * test the lexed token: return FALSE when not a match, otherwise return token. + * + * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + * contains the actually matched text string. + * + * Also move the input cursor forward and update the match collectors: + * + * - `yytext` + * - `yyleng` + * - `match` + * - `matches` + * - `yylloc` + * - `offset` + * + * @public + * @this {RegExpLexer} + */ + test_match: function lexer_test_match(match, indexed_rule) { + var token, lines, backup, match_str, match_str_len; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.yylloc.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column, + range: this.yylloc.range.slice(0) + }, + + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + + //_signaled_error_token: this._signaled_error_token, + yy: this.yy, + + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + } + + match_str = match[0]; + match_str_len = match_str.length; + + // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { + lines = match_str.split(/(?:\r\n?|\n)/g); + + if (lines.length > 1) { + this.yylineno += lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + this.yylloc.last_column = lines[lines.length - 1].length; + } else { + this.yylloc.last_column += match_str_len; + } + + // } + this.yytext += match_str; + + this.match += match_str; + this.matched += match_str; + this.matches = match; + this.yyleng = this.yytext.length; + this.yylloc.range[1] += match_str_len; + + // previous lex rules MAY have invoked the `more()` API rather than producing a token: + // those rules will already have moved this `offset` forward matching their match lengths, + // hence we must only add our own match length now: + this.offset += match_str_len; + + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match_str_len); + + // calling this method: + // + // function lexer__performAction(yy, yyrulenumber, YY_START) {...} + token = this.performAction.call(this, this.yy, indexed_rule, this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ + ); + + // otherwise, when the action codes are all simple return token statements: + //token = this.simpleCaseActionClusters[indexed_rule]; + + if (this.done && this._input) { + this.done = false; + } + + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + + this.__currentRuleSet__ = null; + return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as `.parseError()` in `reject()` + // did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + + this._signaled_error_token = false; + return token; + } + + return false; + }, + + /** + * return next match in input + * + * @public + * @this {RegExpLexer} + */ + next: function lexer_next() { + if (this.done) { + this.clear(); + return this.EOF; + } + + if (!this._input) { + this.done = true; + } + + var token, match, tempMatch, index; + + if (!this._more) { + this.clear(); + } + + var spec = this.__currentRuleSet__; + + if (!spec) { + // Update the ruleset cache as we apparently encountered a state change or just started lexing. + // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will + // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps + // speed up those activities a tiny bit. + spec = this.__currentRuleSet__ = this._currentRules(); + + // Check whether a *sane* condition has been pushed before: this makes the lexer robust against + // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 + if (!spec || !spec.rules) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo('Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, false); + + // produce one 'error' token until this situation has been resolved, most probably by parse termination! + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + } + + var rule_ids = spec.rules; + var regexes = spec.__rule_regexes; + var len = spec.__rule_count; + + // Note: the arrays are 1-based, while `len` itself is a valid index, + // hence the non-standard less-or-equal check in the next loop condition! + for (var i = 1; i <= len; i++) { + tempMatch = this._input.match(regexes[i]); + + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rule_ids[i]); + + if (token !== false) { + return token; + } else if (this._backtrack) { + match = undefined; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + + if (match) { + token = this.test_match(match, rule_ids[index]); + + if (token !== false) { + return token; + } + + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + + if (!this._input) { + this.done = true; + this.clear(); + return this.EOF; + } else { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, this.options.lexerErrorsAreRecoverable); + + token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + + if (token === this.ERROR) { + // we can try to recover from a lexer error that `parseError()` did not 'recover' for us + // by moving forward at least one character at a time: + if (!this.match.length) { + this.input(); + } + } + + return token; + } + }, + + /** + * return next match that has a token + * + * @public + * @this {RegExpLexer} + */ + lex: function lexer_lex() { + var r; + + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + + while (!r) { + r = this.next(); + } + + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + + return r; + }, + + /** + * backwards compatible alias for `pushState()`; + * the latter is symmetrical with `popState()` and we advise to use + * those APIs in any modern lexer code, rather than `begin()`. + * + * @public + * @this {RegExpLexer} + */ + begin: function lexer_begin(condition) { + return this.pushState(condition); + }, + + /** + * activates a new lexer condition state (pushes the new lexer + * condition state onto the condition stack) + * + * @public + * @this {RegExpLexer} + */ + pushState: function lexer_pushState(condition) { + this.conditionStack.push(condition); + this.__currentRuleSet__ = null; + return this; + }, + + /** + * pop the previously active lexer condition state off the condition + * stack + * + * @public + * @this {RegExpLexer} + */ + popState: function lexer_popState() { + var n = this.conditionStack.length - 1; + + if (n > 0) { + this.__currentRuleSet__ = null; + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + + /** + * return the currently active lexer condition state; when an index + * argument is provided it produces the N-th previous condition state, + * if available + * + * @public + * @this {RegExpLexer} + */ + topState: function lexer_topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + + if (n >= 0) { + return this.conditionStack[n]; + } else { + return 'INITIAL'; + } + }, + + /** + * (internal) determine the lexer rule set which is active for the + * currently active lexer condition state + * + * @public + * @this {RegExpLexer} + */ + _currentRules: function lexer__currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; + } else { + return this.conditions['INITIAL']; + } + }, + + /** + * return the number of states currently on the stack + * + * @public + * @this {RegExpLexer} + */ + stateStackSize: function lexer_stateStackSize() { + return this.conditionStack.length; + }, + + options: { + xregexp: true, + ranges: true, + trackPosition: true, + parseActionsUseYYMERGELOCATIONINFO: true, + easy_keyword_rules: true + }, + + JisonLexerError: JisonLexerError, + + performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { + var yy_ = this; + switch (yyrulenumber) { + case 0: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %\{ */ + yy.dept = 0; + + yy.include_command_allowed = false; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 1: + /*! Conditions:: action */ + /*! Rule:: %\{([^]*?)%\} */ + yy_.yytext = this.matches[1]; + + yy.include_command_allowed = true; + return 32; + break; + + case 2: + /*! Conditions:: action */ + /*! Rule:: %include\b */ + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState('path'); + + return 51; + } else { + // TODO + yy_.yyerror('oops!'); + + return 37; + } + + break; + + case 3: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 34; + + break; + + case 4: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\/.* */ + yy.include_command_allowed = false; + + return 35; + break; + + case 6: + /*! Conditions:: action */ + /*! Rule:: \| */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 7: + /*! Conditions:: action */ + /*! Rule:: %% */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 9: + /*! Conditions:: action */ + /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 10: + /*! Conditions:: action */ + /*! Rule:: \/[^}{BR}]* */ + yy.include_command_allowed = false; + + return 33; + break; + + case 11: + /*! Conditions:: action */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy.include_command_allowed = false; + + return 33; + break; + + case 12: + /*! Conditions:: action */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy.include_command_allowed = false; + + return 33; + break; + + case 13: + /*! Conditions:: action */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy.include_command_allowed = false; + + return 33; + break; + + case 14: + /*! Conditions:: action */ + /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 15: + /*! Conditions:: action */ + /*! Rule:: \{ */ + yy.depth++; + + yy.include_command_allowed = false; + return 33; + break; + + case 16: + /*! Conditions:: action */ + /*! Rule:: \} */ + yy.include_command_allowed = false; + + if (yy.depth <= 0) { + yy_.yyerror(rmCommonWS(_templateObject19) + this.prettyPrintRange(this, yy_.yylloc)); + + return 'BRACKETS_SURPLUS'; + } else { + yy.depth--; + } + + return 33; + break; + + case 17: + /*! Conditions:: action */ + /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|]) */ + yy.include_command_allowed = true; + + return 36; // keep empty lines as-is inside action code blocks. + break; + + case 18: + /*! Conditions:: action */ + /*! Rule:: {BR} */ + if (yy.depth > 0) { + yy.include_command_allowed = true; + return 36; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk + this.popState(); + + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } + + break; + + case 19: + /*! Conditions:: action */ + /*! Rule:: $ */ + yy.include_command_allowed = false; + + if (yy.depth !== 0) { + yy_.yyerror(rmCommonWS(_templateObject20, yy.depth) + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = ''; + return 'BRACKETS_MISSING'; + } + + this.popState(); + yy_.yytext = ''; + return 31; + break; + + case 21: + /*! Conditions:: conditions */ + /*! Rule:: > */ + this.popState(); + + return 6; + break; + + case 24: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 25: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 26: + /*! Conditions:: rules */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 27: + /*! Conditions:: rules */ + /*! Rule:: {WS}+{BR}+ */ + /* empty */ + break; + + case 28: + /*! Conditions:: rules */ + /*! Rule:: \/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 29: + /*! Conditions:: rules */ + /*! Rule:: \/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 30: + /*! Conditions:: rules */ + /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + return 28; + break; + + case 31: + /*! Conditions:: rules */ + /*! Rule:: %% */ + this.popState(); + + this.pushState('code'); + return 19; + break; + + case 32: + /*! Conditions:: rules */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 35: + /*! Conditions:: options */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 49; // value is always a string type + break; + + case 36: + /*! Conditions:: options */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 49; // value is always a string type + break; + + case 37: + /*! Conditions:: options */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy_.yytext = unescQuote(this.matches[1], /\\`/g); + + return 49; // value is always a string type + break; + + case 39: + /*! Conditions:: options */ + /*! Rule:: {BR}{WS}+(?=\S) */ + /* skip leading whitespace on the next line of input, when followed by more options */ + break; + + case 40: + /*! Conditions:: options */ + /*! Rule:: {BR} */ + this.popState(); + + return 48; + break; + + case 41: + /*! Conditions:: options */ + /*! Rule:: {WS}+ */ + /* skip whitespace */ + break; + + case 43: + /*! Conditions:: start_condition */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 44: + /*! Conditions:: start_condition */ + /*! Rule:: {WS}+ */ + /* empty */ + break; + + case 46: + /*! Conditions:: INITIAL */ + /*! Rule:: {ID} */ + this.pushState('macro'); + + return 20; + break; + + case 47: + /*! Conditions:: macro named_chunk */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 48: + /*! Conditions:: macro */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 49: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 50: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \s+ */ + /* empty */ + break; + + case 51: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 26; + break; + + case 52: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 26; + break; + + case 53: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \[ */ + this.pushState('set'); + + return 41; + break; + + case 66: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: < */ + this.pushState('conditions'); + + return 5; + break; + + case 67: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/! */ + return 39; // treated as `(?!atom)` + + break; + + case 68: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/ */ + return 14; // treated as `(?=atom)` + + break; + + case 70: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); + + return 44; + break; + + case 73: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %options\b */ + this.pushState('options'); + + return 47; + break; + + case 74: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %s\b */ + this.pushState('start_condition'); + + return 21; + break; + + case 75: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %x\b */ + this.pushState('start_condition'); + + return 22; + break; + + case 76: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %code\b */ + this.pushState('named_chunk'); + + return 25; + break; + + case 77: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %import\b */ + this.pushState('named_chunk'); + + return 24; + break; + + case 78: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %include\b */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 79: + /*! Conditions:: code */ + /*! Rule:: %include\b */ + this.pushState('path'); + + return 51; + break; + + case 80: + /*! Conditions:: INITIAL rules code */ + /*! Rule:: %{NAME}([^\r\n]*) */ + /* ignore unrecognized decl */ + this.warn(rmCommonWS(_templateObject21, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = [this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; + + return 23; + break; + + case 81: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %% */ + this.pushState('rules'); + + return 19; + break; + + case 89: + /*! Conditions:: set */ + /*! Rule:: \] */ + this.popState(); + + return 42; + break; + + case 91: + /*! Conditions:: code */ + /*! Rule:: [^\r\n]+ */ + return 53; // the bit of CODE just before EOF... + + break; + + case 92: + /*! Conditions:: path */ + /*! Rule:: {BR} */ + this.popState(); + + this.unput(yy_.yytext); + break; + + case 93: + /*! Conditions:: path */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 94: + /*! Conditions:: path */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 95: + /*! Conditions:: path */ + /*! Rule:: {WS}+ */ + // skip whitespace in the line + break; + + case 96: + /*! Conditions:: path */ + /*! Rule:: [^\s\r\n]+ */ + this.popState(); + + return 52; + break; + + case 97: + /*! Conditions:: action */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 98: + /*! Conditions:: action */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 99: + /*! Conditions:: action */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 100: + /*! Conditions:: options */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 101: + /*! Conditions:: options */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 102: + /*! Conditions:: options */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 103: + /*! Conditions:: * */ + /*! Rule:: " */ + var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); + + yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 104: + /*! Conditions:: * */ + /*! Rule:: ' */ + var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); + + yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 105: + /*! Conditions:: * */ + /*! Rule:: ` */ + var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); + + yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 106: + /*! Conditions:: macro rules */ + /*! Rule:: . */ + /* b0rk on bad characters */ + var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); + + yy_.yyerror(rmCommonWS(_templateObject25, rules, rules) + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + case 107: + /*! Conditions:: * */ + /*! Rule:: . */ + yy_.yyerror(rmCommonWS(_templateObject26, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + default: + return this.simpleCaseActionClusters[yyrulenumber]; + } + }, + + simpleCaseActionClusters: { + /*! Conditions:: action */ + /*! Rule:: {WS}+ */ + 5: 36, + + /*! Conditions:: action */ + /*! Rule:: % */ + 8: 33, + + /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ + 20: 20, + + /*! Conditions:: conditions */ + /*! Rule:: , */ + 22: 8, + + /*! Conditions:: conditions */ + /*! Rule:: \* */ + 23: 7, + + /*! Conditions:: options */ + /*! Rule:: {NAME} */ + 33: 20, + + /*! Conditions:: options */ + /*! Rule:: = */ + 34: 18, + + /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ + 38: 50, + + /*! Conditions:: start_condition */ + /*! Rule:: {ID} */ + 42: 27, + + /*! Conditions:: named_chunk */ + /*! Rule:: {ID} */ + 45: 20, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \| */ + 54: 9, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?: */ + 55: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?= */ + 56: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?! */ + 57: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \( */ + 58: 10, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \) */ + 59: 11, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \+ */ + 60: 12, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \* */ + 61: 7, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \? */ + 62: 13, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \^ */ + 63: 16, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: , */ + 64: 8, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: <> */ + 65: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + 69: 44, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \$ */ + 71: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \. */ + 72: 15, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{\d+(,\s*\d+|,)?\} */ + 82: 45, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{{ID}\} */ + 83: 40, + + /*! Conditions:: set options */ + /*! Rule:: \{{ID}\} */ + 84: 40, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{ */ + 85: 3, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \} */ + 86: 4, + + /*! Conditions:: set */ + /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ + 87: 43, + + /*! Conditions:: set */ + /*! Rule:: \{ */ + 88: 43, + + /*! Conditions:: code */ + /*! Rule:: [^\r\n]*(\r|\n)+ */ + 90: 53, + + /*! Conditions:: * */ + /*! Rule:: $ */ + 108: 1 + }, + + rules: [ + /* 0: *//^(?:%\{)/, + /* 1: */new XRegExp('^(?:%\\{([^]*?)%\\})', ''), + /* 2: *//^(?:%include\b)/, + /* 3: */new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 4: *//^(?:([^\S\n\r])*\/\/.*)/, + /* 5: *//^(?:([^\S\n\r])+)/, + /* 6: *//^(?:\|)/, + /* 7: *//^(?:%%)/, + /* 8: *//^(?:%)/, + /* 9: *//^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, + /* 10: *//^(?:\/[^\n\r}]*)/, + /* 11: *//^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 12: *//^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 13: *//^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 14: *//^(?:[^\s"%'\/`{-}]+)/, + /* 15: *//^(?:\{)/, + /* 16: *//^(?:\})/, + /* 17: *//^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s|]))/, + /* 18: *//^(?:(\r\n|\n|\r))/, + /* 19: *//^(?:$)/, + /* 20: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', ''), + /* 21: *//^(?:>)/, + /* 22: *//^(?:,)/, + /* 23: *//^(?:\*)/, + /* 24: *//^(?:([^\S\n\r])*\/\/[^\n\r]*)/, + /* 25: */new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 26: *//^(?:(\r\n|\n|\r)+)/, + /* 27: *//^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, + /* 28: *//^(?:\/\/[^\r\n]*)/, + /* 29: */new XRegExp('^(?:\\/\\*[^]*?\\*\\/)', ''), + /* 30: *//^(?:([^\S\n\r])+(?=[^\s%|]))/, + /* 31: *//^(?:%%)/, + /* 32: *//^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 33: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', ''), + /* 34: *//^(?:=)/, + /* 35: *//^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 36: *//^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 37: *//^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 38: *//^(?:\S+)/, + /* 39: *//^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, + /* 40: *//^(?:(\r\n|\n|\r))/, + /* 41: *//^(?:([^\S\n\r])+)/, + /* 42: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 43: *//^(?:(\r\n|\n|\r)+)/, + /* 44: *//^(?:([^\S\n\r])+)/, + /* 45: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 46: */new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 47: *//^(?:(\r\n|\n|\r)+)/, + /* 48: *//^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 49: *//^(?:(\r\n|\n|\r)+)/, + /* 50: *//^(?:\s+)/, + /* 51: *//^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 52: *//^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 53: *//^(?:\[)/, + /* 54: *//^(?:\|)/, + /* 55: *//^(?:\(\?:)/, + /* 56: *//^(?:\(\?=)/, + /* 57: *//^(?:\(\?!)/, + /* 58: *//^(?:\()/, + /* 59: *//^(?:\))/, + /* 60: *//^(?:\+)/, + /* 61: *//^(?:\*)/, + /* 62: *//^(?:\?)/, + /* 63: *//^(?:\^)/, + /* 64: *//^(?:,)/, + /* 65: *//^(?:<>)/, + /* 66: *//^(?:<)/, + /* 67: *//^(?:\/!)/, + /* 68: *//^(?:\/)/, + /* 69: *//^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 70: *//^(?:\\.)/, + /* 71: *//^(?:\$)/, + /* 72: *//^(?:\.)/, + /* 73: *//^(?:%options\b)/, + /* 74: *//^(?:%s\b)/, + /* 75: *//^(?:%x\b)/, + /* 76: *//^(?:%code\b)/, + /* 77: *//^(?:%import\b)/, + /* 78: *//^(?:%include\b)/, + /* 79: *//^(?:%include\b)/, + /* 80: */new XRegExp('^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))', ''), + /* 81: *//^(?:%%)/, + /* 82: *//^(?:\{\d+(,\s*\d+|,)?\})/, + /* 83: */new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 84: */new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 85: *//^(?:\{)/, + /* 86: *//^(?:\})/, + /* 87: *//^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 88: *//^(?:\{)/, + /* 89: *//^(?:\])/, + /* 90: *//^(?:[^\r\n]*(\r|\n)+)/, + /* 91: *//^(?:[^\r\n]+)/, + /* 92: *//^(?:(\r\n|\n|\r))/, + /* 93: *//^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 94: *//^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 95: *//^(?:([^\S\n\r])+)/, + /* 96: *//^(?:\S+)/, + /* 97: *//^(?:")/, + /* 98: *//^(?:')/, + /* 99: *//^(?:`)/, + /* 100: *//^(?:")/, + /* 101: *//^(?:')/, + /* 102: *//^(?:`)/, + /* 103: *//^(?:")/, + /* 104: *//^(?:')/, + /* 105: *//^(?:`)/, + /* 106: *//^(?:.)/, + /* 107: *//^(?:.)/, + /* 108: *//^(?:$)/], + + conditions: { + 'rules': { + rules: [0, 26, 27, 28, 29, 30, 31, 32, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 85, 86, 103, 104, 105, 106, 107, 108], + + inclusive: true + }, + + 'macro': { + rules: [0, 24, 25, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 81, 82, 83, 85, 86, 103, 104, 105, 106, 107, 108], + + inclusive: true + }, + + 'named_chunk': { + rules: [0, 45, 47, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 81, 82, 83, 85, 86, 103, 104, 105, 107, 108], + + inclusive: true + }, + + 'code': { + rules: [79, 80, 90, 91, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'start_condition': { + rules: [24, 25, 42, 43, 44, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'options': { + rules: [24, 25, 33, 34, 35, 36, 37, 38, 39, 40, 41, 84, 100, 101, 102, 103, 104, 105, 107, 108], + + inclusive: false + }, + + 'conditions': { + rules: [20, 21, 22, 23, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'action': { + rules: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 97, 98, 99, 103, 104, 105, 107, 108], + + inclusive: false + }, + + 'path': { + rules: [24, 25, 92, 93, 94, 95, 96, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'set': { + rules: [84, 87, 88, 89, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'INITIAL': { + rules: [0, 24, 25, 46, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80, 81, 82, 83, 85, 86, 103, 104, 105, 107, 108], + + inclusive: true + } + } + }; + + var rmCommonWS = helpers.rmCommonWS; + var dquote = helpers.dquote; + + function unescQuote(str) { + str = '' + str; + var a = str.split('\\\\'); + + a = a.map(function (s) { + return s.replace(/\\'/g, '\'').replace(/\\"/g, '"'); + }); + + str = a.join('\\\\'); + return str; + } + + lexer.warn = function l_warn() { + if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { + return this.yy.parser.warn.apply(this, arguments); + } else { + console.warn.apply(console, arguments); + } + }; + + lexer.log = function l_log() { + if (this.yy && this.yy.parser && typeof this.yy.parser.log === 'function') { + return this.yy.parser.log.apply(this, arguments); + } else { + console.log.apply(console, arguments); + } + }; + + return lexer; + }(); + parser.lexer = lexer; + + function Parser() { + this.yy = {}; + } + Parser.prototype = parser; + parser.Parser = Parser; + + function yyparse() { + return parser.parse.apply(parser, arguments); + } + + exports.parser = parser; + exports.Parser = Parser; + exports.parse = yyparse; + + Object.defineProperty(exports, '__esModule', { value: true }); +}); diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js new file mode 100644 index 0000000..7da8651 --- /dev/null +++ b/dist/lex-parser-umd.js @@ -0,0 +1,7813 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs'), require('@gerhobbelt/xregexp'), require('jison-helpers-lib')) : + typeof define === 'function' && define.amd ? define(['exports', 'fs', '@gerhobbelt/xregexp', 'jison-helpers-lib'], factory) : + (factory((global['lex-parser'] = {}),global.fs,global.XRegExp,global.helpers)); +}(this, (function (exports,fs,XRegExp,helpers) { 'use strict'; + +fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; +XRegExp = XRegExp && XRegExp.hasOwnProperty('default') ? XRegExp['default'] : XRegExp; +helpers = helpers && helpers.hasOwnProperty('default') ? helpers['default'] : helpers; + +// hack: +var assert; + + +/* parser generated by jison 0.6.0-194 */ + +/* + * Returns a Parser object of the following structure: + * + * Parser: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a derivative/copy of this one, + * not a direct reference! + * } + * + * Parser.prototype: { + * yy: {}, + * EOF: 1, + * TERROR: 2, + * + * trace: function(errorMessage, ...), + * + * JisonParserError: function(msg, hash), + * + * quoteName: function(name), + * Helper function which can be overridden by user code later on: put suitable + * quotes around literal IDs in a description string. + * + * originalQuoteName: function(name), + * The basic quoteName handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `quoteName()` to reference this function + * at the end of the `parse()`. + * + * describeSymbol: function(symbol), + * Return a more-or-less human-readable description of the given symbol, when + * available, or the symbol itself, serving as its own 'description' for lack + * of something better to serve up. + * + * Return NULL when the symbol is unknown to the parser. + * + * symbols_: {associative list: name ==> number}, + * terminals_: {associative list: number ==> name}, + * nonterminals: {associative list: rule-name ==> {associative list: number ==> rule-alt}}, + * terminal_descriptions_: (if there are any) {associative list: number ==> description}, + * productions_: [...], + * + * performAction: function parser__performAction(yytext, yyleng, yylineno, yyloc, yystate, yysp, yyvstack, yylstack, yystack, yysstack), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `yyval` internal object, which has members (`$` and `_$`) + * to store/reference the rule value `$$` and location info `@$`. + * + * One important thing to note about `this` a.k.a. `yyval`: every *reduce* action gets + * to see the same object via the `this` reference, i.e. if you wish to carry custom + * data from one reduce action through to the next within a single parse run, then you + * may get nasty and use `yyval` a.k.a. `this` for storing you own semi-permanent data. + * + * `this.yy` is a direct reference to the `yy` shared state object. + * + * `%parse-param`-specified additional `parse()` arguments have been added to this `yy` + * object at `parse()` start and are therefore available to the action code via the + * same named `yy.xxxx` attributes (where `xxxx` represents a identifier name from + * the %parse-param` list. + * + * - `yytext` : reference to the lexer value which belongs to the last lexer token used + * to match this rule. This is *not* the look-ahead token, but the last token + * that's actually part of this rule. + * + * Formulated another way, `yytext` is the value of the token immediately preceeding + * the current look-ahead token. + * Caveats apply for rules which don't require look-ahead, such as epsilon rules. + * + * - `yyleng` : ditto as `yytext`, only now for the lexer.yyleng value. + * + * - `yylineno`: ditto as `yytext`, only now for the lexer.yylineno value. + * + * - `yyloc` : ditto as `yytext`, only now for the lexer.yylloc lexer token location info. + * + * WARNING: since jison 0.4.18-186 this entry may be NULL/UNDEFINED instead + * of an empty object when no suitable location info can be provided. + * + * - `yystate` : the current parser state number, used internally for dispatching and + * executing the action code chunk matching the rule currently being reduced. + * + * - `yysp` : the current state stack position (a.k.a. 'stack pointer') + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * Also note that you can access this and other stack index values using the new double-hash + * syntax, i.e. `##$ === ##0 === yysp`, while `##1` is the stack index for all things + * related to the first rule term, just like you have `$1`, `@1` and `#1`. + * This is made available to write very advanced grammar action rules, e.g. when you want + * to investigate the parse state stack in your action code, which would, for example, + * be relevant when you wish to implement error diagnostics and reporting schemes similar + * to the work described here: + * + * + Pottier, F., 2016. Reachability and error diagnosis in LR(1) automata. + * In Journées Francophones des Languages Applicatifs. + * + * + Jeffery, C.L., 2003. Generating LR syntax error messages from examples. + * ACM Transactions on Programming Languages and Systems (TOPLAS), 25(5), pp.631–640. + * + * - `yyrulelength`: the current rule's term count, i.e. the number of entries occupied on the stack. + * + * This one comes in handy when you are going to do advanced things to the parser + * stacks, all of which are accessible from your action code (see the next entries below). + * + * - `yyvstack`: reference to the parser value stack. Also accessed via the `$1` etc. + * constructs. + * + * - `yylstack`: reference to the parser token location stack. Also accessed via + * the `@1` etc. constructs. + * + * WARNING: since jison 0.4.18-186 this array MAY contain slots which are + * UNDEFINED rather than an empty (location) object, when the lexer/parser + * action code did not provide a suitable location info object when such a + * slot was filled! + * + * - `yystack` : reference to the parser token id stack. Also accessed via the + * `#1` etc. constructs. + * + * Note: this is a bit of a **white lie** as we can statically decode any `#n` reference to + * its numeric token id value, hence that code wouldn't need the `yystack` but *you* might + * want access this array for your own purposes, such as error analysis as mentioned above! + * + * Note that this stack stores the current stack of *tokens*, that is the sequence of + * already parsed=reduced *nonterminals* (tokens representing rules) and *terminals* + * (lexer tokens *shifted* onto the stack until the rule they belong to is found and + * *reduced*. + * + * - `yysstack`: reference to the parser state stack. This one carries the internal parser + * *states* such as the one in `yystate`, which are used to represent + * the parser state machine in the *parse table*. *Very* *internal* stuff, + * what can I say? If you access this one, you're clearly doing wicked things + * + * - `...` : the extra arguments you specified in the `%parse-param` statement in your + * grammar definition file. + * + * table: [...], + * State transition table + * ---------------------- + * + * index levels are: + * - `state` --> hash table + * - `symbol` --> action (number or array) + * + * If the `action` is an array, these are the elements' meaning: + * - index [0]: 1 = shift, 2 = reduce, 3 = accept + * - index [1]: GOTO `state` + * + * If the `action` is a number, it is the GOTO `state` + * + * defaultActions: {...}, + * + * parseError: function(str, hash, ExceptionClass), + * yyError: function(str, ...), + * yyRecovering: function(), + * yyErrOk: function(), + * yyClearIn: function(), + * + * constructParseErrorInfo: function(error_message, exception_object, expected_token_set, is_recoverable), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this parser kernel in many places; example usage: + * + * var infoObj = parser.constructParseErrorInfo('fail!', null, + * parser.collect_expected_token_set(state), true); + * var retVal = parser.parseError(infoObj.errStr, infoObj, parser.JisonParserError); + * + * originalParseError: function(str, hash, ExceptionClass), + * The basic `parseError` handler provided by JISON. + * `cleanupAfterParse()` will clean up and reset `parseError()` to reference this function + * at the end of the `parse()`. + * + * options: { ... parser %options ... }, + * + * parse: function(input[, args...]), + * Parse the given `input` and return the parsed value (or `true` when none was provided by + * the root action, in which case the parser is acting as a *matcher*). + * You MAY use the additional `args...` parameters as per `%parse-param` spec of this grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * the lexer section of the grammar spec): these will be inserted in the `yy` shared state + * object and any collision with those will be reported by the lexer via a thrown exception. + * + * cleanupAfterParse: function(resultValue, invoke_post_methods, do_not_nuke_errorinfos), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API is invoked at the end of the `parse()` call, unless an exception was thrown + * and `%options no-try-catch` has been defined for this grammar: in that case this helper MAY + * be invoked by calling user code to ensure the `post_parse` callbacks are invoked and + * the internal parser gets properly garbage collected under these particular circumstances. + * + * yyMergeLocationInfo: function(first_index, last_index, first_yylloc, last_yylloc, dont_look_back), + * Helper function **which will be set up during the first invocation of the `parse()` method**. + * This helper API can be invoked to calculate a spanning `yylloc` location info object. + * + * Note: %epsilon rules MAY specify no `first_index` and `first_yylloc`, in which case + * this function will attempt to obtain a suitable location marker by inspecting the location stack + * backwards. + * + * For more info see the documentation comment further below, immediately above this function's + * implementation. + * + * lexer: { + * yy: {...}, A reference to the so-called "shared state" `yy` once + * received via a call to the `.setInput(input, yy)` lexer API. + * EOF: 1, + * ERROR: 2, + * JisonLexerError: function(msg, hash), + * parseError: function(str, hash, ExceptionClass), + * setInput: function(input, [yy]), + * input: function(), + * unput: function(str), + * more: function(), + * reject: function(), + * less: function(n), + * pastInput: function(n), + * upcomingInput: function(n), + * showPosition: function(), + * test_match: function(regex_match_array, rule_index, ...), + * next: function(...), + * lex: function(...), + * begin: function(condition), + * pushState: function(condition), + * popState: function(), + * topState: function(), + * _currentRules: function(), + * stateStackSize: function(), + * cleanupAfterLex: function() + * + * options: { ... lexer %options ... }, + * + * performAction: function(yy, yy_, $avoiding_name_collisions, YY_START, ...), + * rules: [...], + * conditions: {associative list: name ==> set}, + * } + * } + * + * + * token location info (@$, _$, etc.): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer and + * parser errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * } + * + * parser (grammar) errors will also provide these additional members: + * + * { + * expected: (array describing the set of expected tokens; + * may be UNDEFINED when we cannot easily produce such a set) + * state: (integer (or array when the table includes grammar collisions); + * represents the current internal state of the parser kernel. + * can, for example, be used to pass to the `collect_expected_token_set()` + * API to obtain the expected token set) + * action: (integer; represents the current internal action which will be executed) + * new_state: (integer; represents the next/planned internal state, once the current + * action has executed) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * state_stack: (array: the current parser LALR/LR internal state stack; this can be used, + * for instance, for advanced error analysis and reporting) + * value_stack: (array: the current parser LALR/LR internal `$$` value stack; this can be used, + * for instance, for advanced error analysis and reporting) + * location_stack: (array: the current parser LALR/LR internal location stack; this can be used, + * for instance, for advanced error analysis and reporting) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * parser: (reference to the current parser instance) + * } + * + * while `this` will reference the current parser instance. + * + * When `parseError` is invoked by the lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * lexer: (reference to the current lexer instance which reported the error) + * } + * + * When `parseError` is invoked by the parser due to a **JavaScript exception** being fired + * from either the parser or lexer, `this` will still reference the related *parser* + * instance, while these additional `hash` fields will also be provided: + * + * { + * exception: (reference to the exception thrown) + * } + * + * Please do note that in the latter situation, the `expected` field will be omitted as + * this type of failure is assumed not to be due to *parse errors* but rather due to user + * action code in either parser or lexer failing unexpectedly. + * + * --- + * + * You can specify parser options by setting / modifying the `.yy` object of your Parser instance. + * These options are available: + * + * ### options which are global for all parser instances + * + * Parser.pre_parse: function(yy) + * optional: you can specify a pre_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. + * Parser.post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: you can specify a post_parse() function in the chunk following + * the grammar, i.e. after the last `%%`. When it does not return any value, + * the parser will return the original `retval`. + * + * ### options which can be set up per parser instance + * + * yy: { + * pre_parse: function(yy) + * optional: is invoked before the parse cycle starts (and before the first + * invocation of `lex()`) but immediately after the invocation of + * `parser.pre_parse()`). + * post_parse: function(yy, retval, parseInfo) { return retval; } + * optional: is invoked when the parse terminates due to success ('accept') + * or failure (even when exceptions are thrown). + * `retval` contains the return value to be produced by `Parser.parse()`; + * this function can override the return value by returning another. + * When it does not return any value, the parser will return the original + * `retval`. + * This function is invoked immediately before `parser.post_parse()`. + * + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * quoteName: function(name), + * optional: overrides the default `quoteName` function. + * } + * + * parser.lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this `%option` has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + + +// See also: +// http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 +// but we keep the prototype.constructor and prototype.name assignment lines too for compatibility +// with userland code which might access the derived class in a 'classic' way. +function JisonParserError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonParserError' + }); + + if (msg == null) msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + + var stacktrace; + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = (new Error(msg)).stack; + } + } + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } +} + +if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonParserError.prototype, Error.prototype); +} else { + JisonParserError.prototype = Object.create(Error.prototype); +} +JisonParserError.prototype.constructor = JisonParserError; +JisonParserError.prototype.name = 'JisonParserError'; + + +// import XRegExp from '@gerhobbelt/xregexp'; +// import helpers from 'jison-helpers-lib'; +// import fs from 'fs'; + + +// helper: reconstruct the productions[] table +function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); + } + return rv; +} + + + +// helper: reconstruct the defaultActions[] table +function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; +} + + + +// helper: reconstruct the 'goto' table +function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; + + case 0: + q[z] = a.shift(); + break; + + default: + // type === 1: accept + q[z] = [ + 3 + ]; + } + } + rv.push(q); + } + return rv; +} + + + +// helper: runlength encoding with increment step: code, length: step (default step = 0) +// `this` references an array +function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } +} + +// helper: duplicate sequence from *relative* offset and length. +// `this` references an array +function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } +} + +// helper: unpack an array using helpers and data, all passed in an array argument 'a'. +function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; +} + + +var parser = { + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // default action mode: ............. classic,merge + // no try..catch: ................... false + // no default resolve on conflict: false + // on-demand look-ahead: ............ false + // error recovery token skip maximum: 3 + // yyerror in parse actions is: ..... NOT recoverable, + // yyerror in lexer actions and other non-fatal lexer are: + // .................................. NOT recoverable, + // debug grammar/output: ............ false + // has partial LR conflict upgrade: true + // rudimentary token-stack support: false + // parser table compression mode: ... 2 + // export debug tables: ............. false + // export *all* tables: ............. false + // module type: ..................... es + // parser engine type: .............. lalr + // output main() in the module: ..... true + // number of expected conflicts: .... 0 + // + // + // Parser Analysis flags: + // + // no significant actions (parser is a language matcher only): + // .................................. false + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses ParseError API: ............. false + // uses YYERROR: .................... true + // uses YYRECOVERING: ............... false + // uses YYERROK: .................... false + // uses YYCLEARIN: .................. false + // tracks rule values: .............. true + // assigns rule values: ............. true + // uses location tracking: .......... true + // assigns location: ................ true + // uses yystack: .................... false + // uses yysstack: ................... false + // uses yysp: ....................... true + // uses yyrulelength: ............... false + // uses yyMergeLocationInfo API: .... true + // has error recovery: .............. true + // has error reporting: ............. true + // + // --------- END OF REPORT ----------- + +trace: function no_op_trace() { }, +JisonParserError: JisonParserError, +yy: {}, +options: { + type: "lalr", + hasPartialLrUpgradeOnConflict: true, + errorRecoveryTokenDiscardCount: 3 +}, +symbols_: { + "$": 17, + "$accept": 0, + "$end": 1, + "%%": 19, + "(": 10, + ")": 11, + "*": 7, + "+": 12, + ",": 8, + ".": 15, + "/": 14, + "/!": 39, + "<": 5, + "=": 18, + ">": 6, + "?": 13, + "ACTION": 32, + "ACTION_BODY": 33, + "ACTION_BODY_CPP_COMMENT": 35, + "ACTION_BODY_C_COMMENT": 34, + "ACTION_BODY_WHITESPACE": 36, + "ACTION_END": 31, + "ACTION_START": 28, + "BRACKET_MISSING": 29, + "BRACKET_SURPLUS": 30, + "CHARACTER_LIT": 46, + "CODE": 53, + "EOF": 1, + "ESCAPE_CHAR": 44, + "IMPORT": 24, + "INCLUDE": 51, + "INCLUDE_PLACEMENT_ERROR": 37, + "INIT_CODE": 25, + "NAME": 20, + "NAME_BRACE": 40, + "OPTIONS": 47, + "OPTIONS_END": 48, + "OPTION_STRING_VALUE": 49, + "OPTION_VALUE": 50, + "PATH": 52, + "RANGE_REGEX": 45, + "REGEX_SET": 43, + "REGEX_SET_END": 42, + "REGEX_SET_START": 41, + "SPECIAL_GROUP": 38, + "START_COND": 27, + "START_EXC": 22, + "START_INC": 21, + "STRING_LIT": 26, + "UNKNOWN_DECL": 23, + "^": 16, + "action": 68, + "action_body": 69, + "any_group_regex": 78, + "definition": 58, + "definitions": 57, + "error": 2, + "escape_char": 81, + "extra_lexer_module_code": 87, + "import_name": 60, + "import_path": 61, + "include_macro_code": 88, + "init": 56, + "init_code_name": 59, + "lex": 54, + "module_code_chunk": 89, + "name_expansion": 77, + "name_list": 71, + "names_exclusive": 63, + "names_inclusive": 62, + "nonempty_regex_list": 74, + "option": 86, + "option_list": 85, + "optional_module_code_chunk": 90, + "options": 84, + "range_regex": 82, + "regex": 72, + "regex_base": 76, + "regex_concat": 75, + "regex_list": 73, + "regex_set": 79, + "regex_set_atom": 80, + "rule": 67, + "rule_block": 66, + "rules": 64, + "rules_and_epilogue": 55, + "rules_collective": 65, + "start_conditions": 70, + "string": 83, + "{": 3, + "|": 9, + "}": 4 +}, +terminals_: { + 1: "EOF", + 2: "error", + 3: "{", + 4: "}", + 5: "<", + 6: ">", + 7: "*", + 8: ",", + 9: "|", + 10: "(", + 11: ")", + 12: "+", + 13: "?", + 14: "/", + 15: ".", + 16: "^", + 17: "$", + 18: "=", + 19: "%%", + 20: "NAME", + 21: "START_INC", + 22: "START_EXC", + 23: "UNKNOWN_DECL", + 24: "IMPORT", + 25: "INIT_CODE", + 26: "STRING_LIT", + 27: "START_COND", + 28: "ACTION_START", + 29: "BRACKET_MISSING", + 30: "BRACKET_SURPLUS", + 31: "ACTION_END", + 32: "ACTION", + 33: "ACTION_BODY", + 34: "ACTION_BODY_C_COMMENT", + 35: "ACTION_BODY_CPP_COMMENT", + 36: "ACTION_BODY_WHITESPACE", + 37: "INCLUDE_PLACEMENT_ERROR", + 38: "SPECIAL_GROUP", + 39: "/!", + 40: "NAME_BRACE", + 41: "REGEX_SET_START", + 42: "REGEX_SET_END", + 43: "REGEX_SET", + 44: "ESCAPE_CHAR", + 45: "RANGE_REGEX", + 46: "CHARACTER_LIT", + 47: "OPTIONS", + 48: "OPTIONS_END", + 49: "OPTION_STRING_VALUE", + 50: "OPTION_VALUE", + 51: "INCLUDE", + 52: "PATH", + 53: "CODE" +}, +TERROR: 2, +EOF: 1, + +// internals: defined here so the object *structure* doesn't get modified by parse() et al, +// thus helping JIT compilers like Chrome V8. +originalQuoteName: null, +originalParseError: null, +cleanupAfterParse: null, +constructParseErrorInfo: null, +yyMergeLocationInfo: null, + +__reentrant_call_depth: 0, // INTERNAL USE ONLY +__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup + +// APIs which will be set up depending on user action code analysis: +//yyRecovering: 0, +//yyErrOk: 0, +//yyClearIn: 0, + +// Helper APIs +// ----------- + +// Helper function which can be overridden by user code later on: put suitable quotes around +// literal IDs in a description string. +quoteName: function parser_quoteName(id_str) { + return '"' + id_str + '"'; +}, + +// Return the name of the given symbol (terminal or non-terminal) as a string, when available. +// +// Return NULL when the symbol is unknown to the parser. +getSymbolName: function parser_getSymbolName(symbol) { + if (this.terminals_[symbol]) { + return this.terminals_[symbol]; + } + + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. + // + // An example of this may be where a rule's action code contains a call like this: + // + // parser.getSymbolName(#$) + // + // to obtain a human-readable name of the current grammar rule. + var s = this.symbols_; + for (var key in s) { + if (s[key] === symbol) { + return key; + } + } + return null; +}, + +// Return a more-or-less human-readable description of the given symbol, when available, +// or the symbol itself, serving as its own 'description' for lack of something better to serve up. +// +// Return NULL when the symbol is unknown to the parser. +describeSymbol: function parser_describeSymbol(symbol) { + if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { + return this.terminal_descriptions_[symbol]; + } + else if (symbol === this.EOF) { + return 'end of input'; + } + var id = this.getSymbolName(symbol); + if (id) { + return this.quoteName(id); + } + return null; +}, + +// Produce a (more or less) human-readable list of expected tokens at the point of failure. +// +// The produced list may contain token or token set descriptions instead of the tokens +// themselves to help turning this output into something that easier to read by humans +// unless `do_not_describe` parameter is set, in which case a list of the raw, *numeric*, +// expected terminals and nonterminals is produced. +// +// The returned list (array) will not contain any duplicate entries. +collect_expected_token_set: function parser_collect_expected_token_set(state, do_not_describe) { + var TERROR = this.TERROR; + var tokenset = []; + var check = {}; + // Has this (error?) state been outfitted with a custom expectations description text for human consumption? + // If so, use that one instead of the less palatable token set. + if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { + return [ + this.state_descriptions_[state] + ]; + } + for (var p in this.table[state]) { + p = +p; + if (p !== TERROR) { + var d = do_not_describe ? p : this.describeSymbol(p); + if (d && !check[d]) { + tokenset.push(d); + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + } + } + } + return tokenset; +}, +productions_: bp({ + pop: u([ + 54, + 54, + s, + [55, 3], + 56, + 57, + 57, + s, + [58, 11], + 59, + 59, + 60, + 60, + 61, + 61, + 62, + 62, + 63, + 63, + 64, + 64, + s, + [65, 4], + 66, + 66, + 67, + 67, + s, + [68, 3], + s, + [69, 9], + s, + [70, 4], + 71, + 71, + 72, + s, + [73, 4], + s, + [74, 4], + 75, + 75, + s, + [76, 17], + 77, + 78, + 78, + 79, + 79, + 80, + s, + [80, 4, 1], + 83, + 84, + 85, + 85, + s, + [86, 6], + 87, + 87, + 88, + 88, + s, + [89, 3], + 90, + 90 +]), + rule: u([ + s, + [4, 3], + 2, + 0, + 0, + 2, + 0, + s, + [2, 3], + s, + [1, 3], + 3, + 3, + 2, + 3, + 3, + s, + [1, 7], + 2, + 1, + 2, + c, + [23, 3], + 4, + 4, + 3, + c, + [29, 4], + s, + [3, 3], + s, + [2, 8], + 0, + s, + [3, 3], + 0, + 1, + 3, + 1, + s, + [3, 4, -1], + c, + [21, 3], + c, + [40, 3], + s, + [3, 4], + s, + [2, 5], + c, + [12, 3], + s, + [1, 6], + c, + [16, 3], + c, + [10, 8], + c, + [9, 3], + s, + [3, 4], + c, + [10, 4], + c, + [32, 5], + 0 +]) +}), +performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyvstack, yylstack) { + + /* this == yyval */ + + // the JS engine itself can go and remove these statements when `yy` turns out to be unused in any action code! + var yy = this.yy; + var yyparser = yy.parser; + var yylexer = yy.lexer; + + + + switch (yystate) { +case 0: + /*! Production:: $accept : lex $end */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yylstack[yysp - 1]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + +case 1: + /*! Production:: lex : init definitions rules_and_epilogue EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + this.$.macros = yyvstack[yysp - 2].macros; + this.$.startConditions = yyvstack[yysp - 2].startConditions; + this.$.unknownDecls = yyvstack[yysp - 2].unknownDecls; + + // if there are any options, add them all, otherwise set options to NULL: + // can't check for 'empty object' by `if (yy.options) ...` so we do it this way: + for (var k in yy.options) { + this.$.options = yy.options; + break; + } + + if (yy.actionInclude) { + var asrc = yy.actionInclude.join('\n\n'); + // Only a non-empty action code chunk should actually make it through: + if (asrc.trim() !== '') { + this.$.actionInclude = asrc; + } + } + + delete yy.options; + delete yy.actionInclude; + return this.$; + break; + +case 2: + /*! Production:: lex : init definitions error EOF */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Maybe you did not correctly separate the lexer sections with a '%%' + on an otherwise empty line? + The lexer spec file should have this structure: + + definitions + %% + rules + %% // <-- optional! + extra_module_code // <-- optional! + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 3: + /*! Production:: rules_and_epilogue : "%%" rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; + } else { + this.$ = { rules: yyvstack[yysp - 2] }; + } + break; + +case 4: + /*! Production:: rules_and_epilogue : "%%" rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: yyvstack[yysp] }; + break; + +case 5: + /*! Production:: rules_and_epilogue : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { rules: [] }; + break; + +case 6: + /*! Production:: init : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.actionInclude = []; + if (!yy.options) yy.options = {}; + break; + +case 7: + /*! Production:: definitions : definitions definition */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + if (yyvstack[yysp] != null) { + if ('length' in yyvstack[yysp]) { + this.$.macros[yyvstack[yysp][0]] = yyvstack[yysp][1]; + } else if (yyvstack[yysp].type === 'names') { + for (var name in yyvstack[yysp].names) { + this.$.startConditions[name] = yyvstack[yysp].names[name]; + } + } else if (yyvstack[yysp].type === 'unknown') { + this.$.unknownDecls.push(yyvstack[yysp].body); + } + } + break; + +case 8: + /*! Production:: definitions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + macros: {}, // { hash table } + startConditions: {}, // { hash table } + unknownDecls: [] // [ array of [key,value] pairs } + }; + break; + +case 9: + /*! Production:: definition : NAME regex */ +case 38: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + +case 10: + /*! Production:: definition : START_INC names_inclusive */ +case 11: + /*! Production:: definition : START_EXC names_exclusive */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + +case 12: + /*! Production:: definition : action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + yy.actionInclude.push(yyvstack[yysp]); this.$ = null; + break; + +case 13: + /*! Production:: definition : options */ +case 99: + /*! Production:: option_list : option */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 14: + /*! Production:: definition : UNKNOWN_DECL */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'unknown', body: yyvstack[yysp]}; + break; + +case 15: + /*! Production:: definition : IMPORT import_name import_path */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp]}; + break; + +case 16: + /*! Production:: definition : IMPORT import_name error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + You did not specify a legal file path for the '%import' initialization code statement, which must have the format: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 17: + /*! Production:: definition : IMPORT error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + %import name or source filename missing maybe? + + Note: each '%import'-ed initialization code section must be qualified by a name, e.g. 'required' before the import path itself: + %import qualifier_name file_path + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 18: + /*! Production:: definition : INIT_CODE init_code_name action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = { + type: 'codesection', + qualifier: yyvstack[yysp - 1], + include: yyvstack[yysp] + }; + break; + +case 19: + /*! Production:: definition : INIT_CODE error action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Each '%code' initialization code section must be qualified by a name, e.g. 'required' before the action code itself: + %code qualifier_name {action code} + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 20: + /*! Production:: init_code_name : NAME */ +case 21: + /*! Production:: init_code_name : STRING_LIT */ +case 22: + /*! Production:: import_name : NAME */ +case 23: + /*! Production:: import_name : STRING_LIT */ +case 24: + /*! Production:: import_path : NAME */ +case 25: + /*! Production:: import_path : STRING_LIT */ +case 61: + /*! Production:: regex_list : regex_concat */ +case 66: + /*! Production:: nonempty_regex_list : regex_concat */ +case 68: + /*! Production:: regex_concat : regex_base */ +case 93: + /*! Production:: escape_char : ESCAPE_CHAR */ +case 94: + /*! Production:: range_regex : RANGE_REGEX */ +case 106: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ +case 110: + /*! Production:: module_code_chunk : CODE */ +case 113: + /*! Production:: optional_module_code_chunk : module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp]; + break; + +case 26: + /*! Production:: names_inclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; + break; + +case 27: + /*! Production:: names_inclusive : names_inclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; + break; + +case 28: + /*! Production:: names_exclusive : START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; + break; + +case 29: + /*! Production:: names_exclusive : names_exclusive START_COND */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; + break; + +case 30: + /*! Production:: rules : rules rules_collective */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); + break; + +case 31: + /*! Production:: rules : %epsilon */ +case 37: + /*! Production:: rule_block : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = []; + break; + +case 32: + /*! Production:: rules_collective : start_conditions rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 1]) { + yyvstack[yysp].unshift(yyvstack[yysp - 1]); + } + this.$ = [yyvstack[yysp]]; + break; + +case 33: + /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (yyvstack[yysp - 3]) { + yyvstack[yysp - 1].forEach(function (d) { + d.unshift(yyvstack[yysp - 3]); + }); + } + this.$ = yyvstack[yysp - 1]; + break; + +case 34: + /*! Production:: rules_collective : start_conditions "{" error "}" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you made a mistake while specifying one of the lexer rules inside + the start condition + <${yyvstack[yysp - 3].join(',')}> { rules... } + block. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 35: + /*! Production:: rules_collective : start_conditions "{" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lexer rules set inside + the start condition + <${yyvstack[yysp - 2].join(',')}> { rules... } + as a terminating curly brace '}' could not be found. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 36: + /*! Production:: rule_block : rule_block rule */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); + break; + +case 39: + /*! Production:: rule : regex error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + yyparser.yyError(rmCommonWS` + Lexer rule regex action code declaration error? + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 40: + /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + `); + break; + +case 41: + /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. + + Offending action body: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + `); + break; + +case 42: + /*! Production:: action : ACTION_START action_body ACTION_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var s = yyvstack[yysp - 1].trim(); + // remove outermost set of braces UNLESS there's + // a curly brace in there anywhere: in that case + // we should leave it up to the sophisticated + // code analyzer to simplify the code! + // + // This is a very rough check as it will also look + // inside code comments, which should not have + // any influence. + // + // Nevertheless: this is a *safe* transform! + if (s[0] === '{' && s.indexOf('}') === s.length - 1) { + this.$ = s.substring(1, s.length - 1).trim(); + } else { + this.$ = s; + } + break; + +case 43: + /*! Production:: action_body : action_body ACTION */ +case 48: + /*! Production:: action_body : action_body include_macro_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; + break; + +case 44: + /*! Production:: action_body : action_body ACTION_BODY */ +case 45: + /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ +case 46: + /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ +case 47: + /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ +case 67: + /*! Production:: regex_concat : regex_concat regex_base */ +case 79: + /*! Production:: regex_base : regex_base range_regex */ +case 89: + /*! Production:: regex_set : regex_set regex_set_atom */ +case 111: + /*! Production:: module_code_chunk : module_code_chunk CODE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 49: + /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + You may place the '%include' instruction only at the start/front of a line. + + It's use is not permitted at this position: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + `); + break; + +case 50: + /*! Production:: action_body : action_body error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 51: + /*! Production:: action_body : %epsilon */ +case 62: + /*! Production:: regex_list : %epsilon */ +case 114: + /*! Production:: optional_module_code_chunk : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ''; + break; + +case 52: + /*! Production:: start_conditions : "<" name_list ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1]; + break; + +case 53: + /*! Production:: start_conditions : "<" name_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly terminate the start condition set <${yyvstack[yysp - 1].join(',')},???> with a terminating '>' + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 54: + /*! Production:: start_conditions : "<" "*" ">" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = ['*']; + break; + +case 55: + /*! Production:: start_conditions : %epsilon */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = undefined; + this._$ = yyparser.yyMergeLocationInfo(null, null, null, null, true); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + +case 56: + /*! Production:: name_list : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = [yyvstack[yysp]]; + break; + +case 57: + /*! Production:: name_list : name_list "," NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); + break; + +case 58: + /*! Production:: regex : nonempty_regex_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Detect if the regex ends with a pure (Unicode) word; + // we *do* consider escaped characters which are 'alphanumeric' + // to be equivalent to their non-escaped version, hence these are + // all valid 'words' for the 'easy keyword rules' option: + // + // - hello_kitty + // - γεια_σου_γατοÏλα + // - \u03B3\u03B5\u03B9\u03B1_\u03C3\u03BF\u03C5_\u03B3\u03B1\u03C4\u03BF\u03CD\u03BB\u03B1 + // + // http://stackoverflow.com/questions/7885096/how-do-i-decode-a-string-with-escaped-unicode#12869914 + // + // As we only check the *tail*, we also accept these as + // 'easy keywords': + // + // - %options + // - %foo-bar + // - +++a:b:c1 + // + // Note the dash in that last example: there the code will consider + // `bar` to be the keyword, which is fine with us as we're only + // interested in the trailing boundary and patching that one for + // the `easy_keyword_rules` option. + this.$ = yyvstack[yysp]; + if (yy.options.easy_keyword_rules) { + // We need to 'protect' `eval` here as keywords are allowed + // to contain double-quotes and other leading cruft. + // `eval` *does* gobble some escapes (such as `\b`) but + // we protect against that through a simple replace regex: + // we're not interested in the special escapes' exact value + // anyway. + // It will also catch escaped escapes (`\\`), which are not + // word characters either, so no need to worry about + // `eval(str)` 'correctly' converting convoluted constructs + // like '\\\\\\\\\\b' in here. + this.$ = this.$ + .replace(/\\\\/g, '.') + .replace(/"/g, '.') + .replace(/\\c[A-Z]/g, '.') + .replace(/\\[^xu0-9]/g, '.'); + + try { + // Convert Unicode escapes and other escapes to their literal characters + // BEFORE we go and check whether this item is subject to the + // `easy_keyword_rules` option. + this.$ = JSON.parse('"' + this.$ + '"'); + } + catch (ex) { + yyparser.warn('easy-keyword-rule FAIL on eval: ', ex); + + // make the next keyword test fail: + this.$ = '.'; + } + // a 'keyword' starts with an alphanumeric character, + // followed by zero or more alphanumerics or digits: + var re = new XRegExp('\\w[\\w\\d]*$'); + if (XRegExp.match(this.$, re)) { + this.$ = yyvstack[yysp] + "\\b"; + } else { + this.$ = yyvstack[yysp]; + } + } + break; + +case 59: + /*! Production:: regex_list : regex_list "|" regex_concat */ +case 63: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; + break; + +case 60: + /*! Production:: regex_list : regex_list "|" */ +case 64: + /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '|'; + break; + +case 65: + /*! Production:: nonempty_regex_list : "|" regex_concat */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '|' + yyvstack[yysp]; + break; + +case 69: + /*! Production:: regex_base : "(" regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(' + yyvstack[yysp - 1] + ')'; + break; + +case 70: + /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; + break; + +case 71: + /*! Production:: regex_base : "(" regex_list error */ +case 72: + /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lex rule regex part in '(...)' braces. + + Unterminated regex part: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 73: + /*! Production:: regex_base : regex_base "+" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '+'; + break; + +case 74: + /*! Production:: regex_base : regex_base "*" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '*'; + break; + +case 75: + /*! Production:: regex_base : regex_base "?" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 1] + '?'; + break; + +case 76: + /*! Production:: regex_base : "/" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?=' + yyvstack[yysp] + ')'; + break; + +case 77: + /*! Production:: regex_base : "/!" regex_base */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '(?!' + yyvstack[yysp] + ')'; + break; + +case 78: + /*! Production:: regex_base : name_expansion */ +case 80: + /*! Production:: regex_base : any_group_regex */ +case 84: + /*! Production:: regex_base : string */ +case 85: + /*! Production:: regex_base : escape_char */ +case 86: + /*! Production:: name_expansion : NAME_BRACE */ +case 90: + /*! Production:: regex_set : regex_set_atom */ +case 91: + /*! Production:: regex_set_atom : REGEX_SET */ +case 96: + /*! Production:: string : CHARACTER_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + break; + +case 81: + /*! Production:: regex_base : "." */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '.'; + break; + +case 82: + /*! Production:: regex_base : "^" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '^'; + break; + +case 83: + /*! Production:: regex_base : "$" */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = '$'; + break; + +case 87: + /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ +case 107: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 88: + /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. + + Unterminated regex set: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 92: + /*! Production:: regex_set_atom : name_expansion */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + if (XRegExp._getUnicodeProperty(yyvstack[yysp].replace(/[{}]/g, '')) + && yyvstack[yysp].toUpperCase() !== yyvstack[yysp] + ) { + // treat this as part of an XRegExp `\p{...}` Unicode 'General Category' Property cf. http://unicode.org/reports/tr18/#Categories + this.$ = yyvstack[yysp]; + } else { + this.$ = yyvstack[yysp]; + } + //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); + break; + +case 95: + /*! Production:: string : STRING_LIT */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = prepareString(yyvstack[yysp]); + break; + +case 97: + /*! Production:: options : OPTIONS option_list OPTIONS_END */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 98: + /*! Production:: option_list : option option_list */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + this.$ = null; + break; + +case 100: + /*! Production:: option : NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp]] = true; + break; + +case 101: + /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; + break; + +case 102: + /*! Production:: option : NAME "=" OPTION_VALUE */ +case 103: + /*! Production:: option : NAME "=" NAME */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); + break; + +case 104: + /*! Production:: option : NAME "=" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS` + Internal error: option "${$option}" value assignment failure. + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 105: + /*! Production:: option : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS` + Expected a valid option name (with optional value assignment). + + Erroneous area: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 108: + /*! Production:: include_macro_code : INCLUDE PATH */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var fileContent = fs.readFileSync(yyvstack[yysp], { encoding: 'utf-8' }); + // And no, we don't support nested '%include': + this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; + break; + +case 109: + /*! Production:: include_macro_code : INCLUDE error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + %include MUST be followed by a valid file path. + + Erroneous path: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 112: + /*! Production:: module_code_chunk : error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp]; + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + // TODO ... + yyparser.yyError(rmCommonWS` + Module code declaration error? + + Erroneous code: + ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! + // error recovery reduction action (action generated by jison, + // using the user-specified `%code error_recovery_reduction` %{...%} + // code chunk below. + + + break; + +} +}, +table: bt({ + len: u([ + 13, + 1, + 12, + 15, + 1, + 1, + 11, + 18, + 21, + 2, + 2, + s, + [11, 3], + 4, + 4, + 12, + 4, + 1, + 1, + 19, + 11, + 12, + 18, + 29, + 30, + 22, + 22, + 17, + 17, + s, + [29, 7], + 31, + 5, + s, + [29, 3], + s, + [12, 4], + 4, + 11, + 3, + 3, + 2, + 2, + 1, + 1, + 12, + 1, + 5, + 4, + 3, + 7, + 17, + 23, + 3, + 30, + 29, + 30, + s, + [29, 5], + 3, + 20, + 3, + 30, + 30, + 6, + s, + [4, 3], + 12, + 12, + s, + [11, 6], + s, + [27, 3], + s, + [11, 8], + 2, + 11, + 1, + 4, + 3, + 2, + s, + [3, 3], + 17, + 16, + 3, + 3, + 1, + 3, + s, + [29, 3], + 21, + s, + [29, 4], + 4, + 13, + 13, + s, + [3, 4], + 6, + 3, + 23, + s, + [18, 3], + 14, + 14, + 1, + 14, + 20, + 2, + 17, + 14, + 17, + 3 +]), + symbol: u([ + 1, + 2, + s, + [19, 7, 1], + 28, + 47, + 54, + 56, + 1, + c, + [14, 11], + 57, + c, + [12, 11], + 55, + 58, + 68, + 84, + s, + [1, 3], + c, + [17, 10], + 1, + 3, + 5, + 9, + 10, + s, + [14, 4, 1], + 19, + 26, + s, + [38, 4, 1], + 44, + 46, + 64, + c, + [15, 6], + c, + [14, 7], + 72, + s, + [74, 5, 1], + 81, + 83, + 27, + 62, + 27, + 63, + c, + [54, 12], + c, + [11, 21], + 2, + 20, + 26, + 60, + c, + [4, 3], + 59, + 2, + s, + [29, 9, 1], + 51, + 69, + 2, + 20, + 85, + 86, + s, + [1, 3], + c, + [102, 16], + 65, + 70, + c, + [67, 13], + 9, + c, + [12, 9], + c, + [125, 12], + c, + [123, 6], + c, + [30, 3], + c, + [59, 6], + s, + [20, 7, 1], + 28, + c, + [29, 6], + 47, + c, + [29, 7], + 7, + s, + [9, 9, 1], + c, + [33, 14], + 45, + 46, + 47, + 82, + c, + [58, 3], + 11, + c, + [80, 11], + 73, + c, + [81, 6], + c, + [22, 22], + c, + [121, 12], + c, + [17, 22], + c, + [108, 29], + c, + [29, 199], + s, + [42, 6, 1], + 40, + 43, + 77, + 79, + 80, + c, + [123, 89], + c, + [19, 7], + 27, + c, + [572, 11], + c, + [12, 27], + c, + [593, 3], + 61, + c, + [612, 14], + c, + [3, 3], + 28, + 68, + 28, + 68, + 28, + 28, + c, + [616, 11], + 88, + 48, + 2, + 20, + 48, + 85, + 86, + 2, + 18, + 20, + c, + [9, 4], + 1, + 2, + 51, + 53, + 87, + 89, + 90, + c, + [630, 17], + 3, + c, + [732, 13], + 67, + c, + [733, 8], + 7, + 20, + 71, + c, + [613, 24], + c, + [643, 65], + c, + [507, 145], + 2, + 9, + 11, + c, + [769, 15], + c, + [789, 7], + 11, + c, + [201, 59], + 82, + 2, + 40, + 42, + 43, + 77, + 80, + c, + [6, 4], + c, + [4, 8], + c, + [476, 33], + c, + [11, 59], + 3, + 4, + c, + [473, 8], + c, + [401, 15], + c, + [27, 54], + c, + [584, 11], + c, + [11, 78], + 52, + c, + [182, 11], + c, + [664, 3], + 49, + 50, + 1, + 51, + 88, + 1, + 51, + 1, + 51, + 53, + c, + [3, 7], + c, + [672, 16], + 2, + 4, + c, + [673, 13], + 66, + 2, + 28, + 68, + 2, + 6, + 8, + 6, + c, + [4, 3], + c, + [642, 58], + c, + [525, 31], + c, + [522, 13], + c, + [750, 8], + c, + [662, 115], + c, + [562, 5], + c, + [315, 10], + 53, + c, + [13, 13], + c, + [979, 3], + c, + [3, 9], + c, + [988, 4], + c, + [987, 3], + 51, + 53, + c, + [300, 14], + c, + [973, 9], + 1, + c, + [487, 10], + c, + [27, 7], + c, + [18, 36], + c, + [1050, 14], + c, + [14, 14], + 20, + c, + [15, 14], + c, + [830, 20], + c, + [469, 3], + c, + [460, 16], + c, + [159, 14], + c, + [491, 18], + 6, + 8 +]), + type: u([ + s, + [2, 11], + 0, + 0, + 1, + c, + [14, 12], + c, + [26, 13], + 0, + c, + [15, 12], + s, + [2, 19], + c, + [31, 14], + s, + [0, 8], + c, + [23, 3], + c, + [56, 31], + c, + [62, 10], + c, + [112, 13], + c, + [67, 4], + c, + [40, 20], + c, + [78, 36], + c, + [123, 7], + c, + [30, 28], + c, + [203, 43], + c, + [205, 9], + c, + [22, 34], + c, + [17, 34], + s, + [2, 224], + c, + [239, 141], + c, + [139, 19], + c, + [655, 16], + c, + [14, 5], + c, + [180, 13], + c, + [194, 34], + s, + [0, 9], + c, + [98, 21], + c, + [643, 86], + c, + [492, 151], + c, + [494, 34], + c, + [231, 35], + c, + [802, 238], + c, + [716, 74], + c, + [44, 28], + c, + [708, 37], + c, + [522, 78], + c, + [454, 163], + c, + [164, 19], + c, + [973, 11], + c, + [830, 147], + s, + [2, 21] +]), + state: u([ + s, + [1, 4, 1], + 6, + 11, + 12, + 20, + 21, + 22, + 24, + 25, + 30, + 31, + 36, + 35, + 42, + 44, + 46, + 50, + 54, + 55, + 56, + 60, + 61, + 64, + c, + [15, 5], + 65, + c, + [5, 4], + 69, + 71, + 72, + c, + [13, 5], + 73, + c, + [7, 6], + 74, + c, + [5, 4], + 75, + c, + [5, 4], + 79, + 76, + 77, + 82, + 86, + 87, + 96, + 101, + 56, + 103, + 105, + 104, + 108, + 110, + c, + [66, 7], + 111, + 114, + c, + [58, 11], + c, + [6, 6], + 69, + 79, + 122, + 129, + 131, + 133, + c, + [12, 5], + 139, + c, + [29, 5], + 105, + 140, + 142, + c, + [47, 8], + c, + [22, 5] +]), + mode: u([ + s, + [2, 23], + s, + [1, 12], + s, + [2, 28], + s, + [1, 15], + s, + [2, 33], + c, + [39, 17], + c, + [13, 6], + c, + [18, 7], + c, + [64, 21], + c, + [21, 10], + c, + [106, 15], + c, + [75, 12], + 1, + c, + [90, 10], + c, + [27, 6], + c, + [72, 23], + c, + [40, 8], + c, + [45, 7], + c, + [15, 13], + s, + [1, 24], + s, + [2, 234], + c, + [236, 98], + c, + [97, 24], + c, + [24, 15], + c, + [374, 20], + c, + [432, 5], + c, + [409, 15], + c, + [568, 9], + c, + [47, 20], + c, + [454, 17], + c, + [561, 23], + c, + [585, 53], + c, + [442, 145], + c, + [718, 19], + c, + [780, 33], + c, + [29, 25], + c, + [759, 238], + c, + [796, 51], + c, + [289, 5], + c, + [1211, 12], + c, + [722, 35], + c, + [340, 9], + c, + [648, 24], + c, + [854, 59], + c, + [1199, 170], + c, + [311, 6], + c, + [969, 23], + c, + [1128, 90], + c, + [291, 66] +]), + goto: u([ + s, + [6, 11], + s, + [8, 11], + 5, + 5, + s, + [7, 4, 1], + s, + [13, 7, 1], + s, + [7, 11], + s, + [31, 17], + 23, + 26, + 28, + 32, + 33, + 34, + 39, + 27, + 29, + 37, + 38, + 41, + 40, + 43, + 45, + s, + [12, 11], + s, + [13, 11], + s, + [14, 11], + 47, + 48, + 49, + 51, + 52, + 53, + s, + [51, 11], + 58, + 57, + 1, + 2, + 4, + 55, + 62, + s, + [55, 6], + 59, + s, + [55, 7], + s, + [9, 11], + 58, + 58, + 63, + s, + [58, 9], + c, + [108, 12], + s, + [66, 3], + c, + [15, 5], + s, + [66, 7], + 39, + 66, + c, + [23, 7], + 68, + 68, + 67, + s, + [68, 3], + c, + [7, 3], + s, + [68, 17], + 70, + 68, + 68, + 62, + 62, + 26, + 62, + c, + [68, 11], + c, + [15, 15], + c, + [95, 12], + c, + [12, 12], + s, + [78, 29], + s, + [80, 29], + s, + [81, 29], + s, + [82, 29], + s, + [83, 29], + s, + [84, 29], + s, + [85, 29], + s, + [86, 31], + 37, + 78, + s, + [95, 29], + s, + [96, 29], + s, + [93, 29], + s, + [10, 9], + 80, + 10, + 10, + s, + [26, 12], + s, + [11, 9], + 81, + 11, + 11, + s, + [28, 12], + 83, + 84, + 85, + s, + [17, 11], + s, + [22, 3], + s, + [23, 3], + 16, + 16, + 20, + 21, + 98, + s, + [88, 8, 1], + 97, + 99, + 100, + 58, + 57, + 99, + 100, + 102, + 100, + 100, + s, + [105, 3], + 114, + 107, + 114, + 106, + s, + [30, 17], + 109, + c, + [667, 13], + 112, + 113, + s, + [64, 3], + c, + [17, 5], + s, + [64, 7], + 39, + 64, + c, + [25, 6], + 64, + s, + [65, 3], + c, + [24, 5], + s, + [65, 7], + 39, + 65, + c, + [24, 6], + 65, + s, + [67, 6], + 66, + 68, + s, + [67, 18], + 70, + 67, + 67, + s, + [73, 29], + s, + [74, 29], + s, + [75, 29], + s, + [79, 29], + s, + [94, 29], + 116, + 117, + 115, + 61, + 61, + 26, + 61, + c, + [242, 11], + 119, + 117, + 118, + 76, + 76, + 67, + s, + [76, 3], + 66, + 68, + s, + [76, 18], + 70, + 76, + 76, + 77, + 77, + 67, + s, + [77, 3], + 66, + 68, + s, + [77, 18], + 70, + 77, + 77, + 121, + 37, + 120, + 78, + s, + [90, 4], + s, + [91, 4], + s, + [92, 4], + s, + [27, 12], + s, + [29, 12], + s, + [15, 11], + s, + [16, 11], + s, + [24, 11], + s, + [25, 11], + s, + [18, 11], + s, + [19, 11], + s, + [40, 27], + s, + [41, 27], + s, + [42, 27], + s, + [43, 11], + s, + [44, 11], + s, + [45, 11], + s, + [46, 11], + s, + [47, 11], + s, + [48, 11], + s, + [49, 11], + s, + [50, 11], + 124, + 123, + s, + [97, 11], + 98, + 128, + 127, + 125, + 126, + 3, + 99, + 106, + 106, + 113, + 113, + 130, + s, + [110, 3], + s, + [112, 3], + s, + [32, 17], + 132, + s, + [37, 14], + 134, + 16, + 136, + 135, + 137, + 138, + s, + [56, 3], + s, + [63, 3], + c, + [624, 5], + s, + [63, 7], + 39, + 63, + c, + [431, 6], + 63, + s, + [69, 29], + s, + [71, 29], + 60, + 60, + 26, + 60, + c, + [505, 11], + s, + [70, 29], + s, + [72, 29], + s, + [87, 29], + s, + [88, 29], + s, + [89, 4], + s, + [108, 13], + s, + [109, 13], + s, + [101, 3], + s, + [102, 3], + s, + [103, 3], + s, + [104, 3], + c, + [940, 4], + s, + [111, 3], + 141, + c, + [926, 13], + 35, + 35, + 143, + s, + [35, 15], + s, + [38, 18], + s, + [39, 18], + s, + [52, 14], + s, + [53, 14], + 144, + s, + [54, 14], + 59, + 59, + 26, + 59, + c, + [112, 11], + 107, + 107, + s, + [33, 17], + s, + [36, 14], + s, + [34, 17], + s, + [57, 3] +]) +}), +defaultActions: bda({ + idx: u([ + 0, + 2, + 6, + 7, + 11, + 12, + 13, + 16, + 18, + 19, + 21, + s, + [30, 8, 1], + 39, + 40, + s, + [41, 4, 2], + 48, + 49, + 52, + 53, + 58, + 60, + s, + [66, 5, 1], + s, + [77, 22, 1], + 100, + 101, + 104, + 106, + 107, + 108, + 113, + 115, + 116, + s, + [118, 11, 1], + 130, + s, + [133, 4, 1], + 138, + s, + [140, 5, 1] +]), + goto: u([ + 6, + 8, + 7, + 31, + 12, + 13, + 14, + 51, + 1, + 2, + 9, + 78, + s, + [80, 7, 1], + 95, + 96, + 93, + 26, + 28, + 17, + 22, + 23, + 20, + 21, + 105, + 30, + 73, + 74, + 75, + 79, + 94, + 90, + 91, + 92, + 27, + 29, + 15, + 16, + 24, + 25, + 18, + 19, + s, + [40, 11, 1], + 97, + 98, + 106, + 110, + 112, + 32, + 56, + 69, + 71, + 70, + 72, + 87, + 88, + 89, + 108, + 109, + s, + [101, 4, 1], + 111, + 38, + 39, + 52, + 53, + 54, + 107, + 33, + 36, + 34, + 57 +]) +}), +parseError: function parseError(str, hash, ExceptionClass) { + if (hash.recoverable && typeof this.trace === 'function') { + this.trace(str); + hash.destroy(); // destroy... well, *almost*! + } else { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + throw new ExceptionClass(str, hash); + } +}, +parse: function parse(input) { + var self = this; + var stack = new Array(128); // token stack: stores token which leads to state at the same index (column storage) + var sstack = new Array(128); // state stack: stores states (column storage) + + var vstack = new Array(128); // semantic value stack + var lstack = new Array(128); // location stack + var table = this.table; + var sp = 0; // 'stack pointer': index into the stacks + var yyloc; + + var symbol = 0; + var preErrorSymbol = 0; + var lastEofErrorStateDepth = 0; + var recoveringErrorInfo = null; + var recovering = 0; // (only used when the grammar contains error recovery rules) + var TERROR = this.TERROR; + var EOF = this.EOF; + var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; + var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + + var lexer; + if (this.__lexer__) { + lexer = this.__lexer__; + } else { + lexer = this.__lexer__ = Object.create(this.lexer); + } + + var sharedState_yy = { + parseError: undefined, + quoteName: undefined, + lexer: undefined, + parser: undefined, + pre_parse: undefined, + post_parse: undefined, + pre_lex: undefined, + post_lex: undefined + }; + + if (typeof assert !== 'function') { + assert = function JisonAssert(cond, msg) { + if (!cond) { + throw new Error('assertion failed: ' + (msg || '***')); + } + }; + } + + this.yyGetSharedState = function yyGetSharedState() { + return sharedState_yy; + }; + + + this.yyGetErrorInfoTrack = function yyGetErrorInfoTrack() { + return recoveringErrorInfo; + }; + + + // shallow clone objects, straight copy of simple `src` values + // e.g. `lexer.yytext` MAY be a complex value object, + // rather than a simple string/value. + function shallow_copy(src) { + if (typeof src === 'object') { + var dst = {}; + for (var k in src) { + if (Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + return dst; + } + return src; + } + function shallow_copy_noclobber(dst, src) { + for (var k in src) { + if (typeof dst[k] === 'undefined' && Object.prototype.hasOwnProperty.call(src, k)) { + dst[k] = src[k]; + } + } + } + function copy_yylloc(loc) { + var rv = shallow_copy(loc); + if (rv && rv.range) { + rv.range = rv.range.slice(0); + } + return rv; + } + + // copy state + shallow_copy_noclobber(sharedState_yy, this.yy); + + sharedState_yy.lexer = lexer; + sharedState_yy.parser = this; + + + + + + // *Always* setup `yyError`, `YYRECOVERING`, `yyErrOk` and `yyClearIn` functions as it is paramount + // to have *their* closure match ours -- if we only set them up once, + // any subsequent `parse()` runs will fail in very obscure ways when + // these functions are invoked in the user action code block(s) as + // their closure will still refer to the `parse()` instance which set + // them up. Hence we MUST set them up at the start of every `parse()` run! + if (this.yyError) { + this.yyError = function yyError(str /*, ...args */) { + + + + + + + + + + + + var error_rule_depth = (this.options.parserErrorsAreRecoverable ? locateNearestErrorRecoveryRule(state) : -1); + var expected = this.collect_expected_token_set(state); + var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0)); + // append to the old one? + if (recoveringErrorInfo) { + var esp = recoveringErrorInfo.info_stack_pointer; + + recoveringErrorInfo.symbol_stack[esp] = symbol; + var v = this.shallowCopyErrorInfo(hash); + v.yyError = true; + v.errorRuleDepth = error_rule_depth; + v.recovering = recovering; + // v.stackSampleLength = error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH; + + recoveringErrorInfo.value_stack[esp] = v; + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + } else { + recoveringErrorInfo = this.shallowCopyErrorInfo(hash); + recoveringErrorInfo.yyError = true; + recoveringErrorInfo.errorRuleDepth = error_rule_depth; + recoveringErrorInfo.recovering = recovering; + } + + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + if (args.length) { + hash.extra_error_attributes = args; + } + + var r = this.parseError(str, hash, this.JisonParserError); + return r; + }; + } + + + + + + + + // Does the shared state override the default `parseError` that already comes with this instance? + if (typeof sharedState_yy.parseError === 'function') { + this.parseError = function parseErrorAlt(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonParserError; + } + return sharedState_yy.parseError.call(this, str, hash, ExceptionClass); + }; + } else { + this.parseError = this.originalParseError; + } + + // Does the shared state override the default `quoteName` that already comes with this instance? + if (typeof sharedState_yy.quoteName === 'function') { + this.quoteName = function quoteNameAlt(id_str) { + return sharedState_yy.quoteName.call(this, id_str); + }; + } else { + this.quoteName = this.originalQuoteName; + } + + // set up the cleanup function; make it an API so that external code can re-use this one in case of + // calamities or when the `%options no-try-catch` option has been specified for the grammar, in which + // case this parse() API method doesn't come with a `finally { ... }` block any more! + // + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `sharedState`, etc. references will be *wrong*! + this.cleanupAfterParse = function parser_cleanupAfterParse(resultValue, invoke_post_methods, do_not_nuke_errorinfos) { + var rv; + + if (invoke_post_methods) { + var hash; + + if (sharedState_yy.post_parse || this.post_parse) { + // create an error hash info instance: we re-use this API in a **non-error situation** + // as this one delivers all parser internals ready for access by userland code. + hash = this.constructParseErrorInfo(null /* no error! */, null /* no exception! */, null, false); + } + + if (sharedState_yy.post_parse) { + rv = sharedState_yy.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + if (this.post_parse) { + rv = this.post_parse.call(this, sharedState_yy, resultValue, hash); + if (typeof rv !== 'undefined') resultValue = rv; + } + + // cleanup: + if (hash && hash.destroy) { + hash.destroy(); + } + } + + if (this.__reentrant_call_depth > 1) return resultValue; // do not (yet) kill the sharedState when this is a reentrant run. + + // clean up the lingering lexer structures as well: + if (lexer.cleanupAfterLex) { + lexer.cleanupAfterLex(do_not_nuke_errorinfos); + } + + // prevent lingering circular references from causing memory leaks: + if (sharedState_yy) { + sharedState_yy.lexer = undefined; + sharedState_yy.parser = undefined; + if (lexer.yy === sharedState_yy) { + lexer.yy = undefined; + } + } + sharedState_yy = undefined; + this.parseError = this.originalParseError; + this.quoteName = this.originalQuoteName; + + // nuke the vstack[] array at least as that one will still reference obsoleted user values. + // To be safe, we nuke the other internal stack columns as well... + stack.length = 0; // fastest way to nuke an array without overly bothering the GC + sstack.length = 0; + lstack.length = 0; + vstack.length = 0; + sp = 0; + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_infos.length = 0; + + + for (var i = this.__error_recovery_infos.length - 1; i >= 0; i--) { + var el = this.__error_recovery_infos[i]; + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + this.__error_recovery_infos.length = 0; + + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + recoveringErrorInfo = undefined; + } + + + } + + return resultValue; + }; + + // merge yylloc info into a new yylloc instance. + // + // `first_index` and `last_index` MAY be UNDEFINED/NULL or these are indexes into the `lstack[]` location stack array. + // + // `first_yylloc` and `last_yylloc` MAY be UNDEFINED/NULL or explicit (custom or regular) `yylloc` instances, in which + // case these override the corresponding first/last indexes. + // + // `dont_look_back` is an optional flag (default: FALSE), which instructs this merge operation NOT to search + // through the parse location stack for a location, which would otherwise be used to construct the new (epsilon!) + // yylloc info. + // + // Note: epsilon rule's yylloc situation is detected by passing both `first_index` and `first_yylloc` as UNDEFINED/NULL. + this.yyMergeLocationInfo = function parser_yyMergeLocationInfo(first_index, last_index, first_yylloc, last_yylloc, dont_look_back) { + var i1 = first_index | 0, + i2 = last_index | 0; + var l1 = first_yylloc, + l2 = last_yylloc; + var rv; + + // rules: + // - first/last yylloc entries override first/last indexes + + if (!l1) { + if (first_index != null) { + for (var i = i1; i <= i2; i++) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + } + + if (!l2) { + if (last_index != null) { + for (var i = i2; i >= i1; i--) { + l2 = lstack[i]; + if (l2) { + break; + } + } + } + } + + // - detect if an epsilon rule is being processed and act accordingly: + if (!l1 && first_index == null) { + // epsilon rule span merger. With optional look-ahead in l2. + if (!dont_look_back) { + for (var i = (i1 || sp) - 1; i >= 0; i--) { + l1 = lstack[i]; + if (l1) { + break; + } + } + } + if (!l1) { + if (!l2) { + // when we still don't have any valid yylloc info, we're looking at an epsilon rule + // without look-ahead and no preceding terms and/or `dont_look_back` set: + // in that case we ca do nothing but return NULL/UNDEFINED: + return undefined; + } else { + // shallow-copy L2: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l2); + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + return rv; + } + } else { + // shallow-copy L1, then adjust first col/row 1 column past the end. + rv = shallow_copy(l1); + rv.first_line = rv.last_line; + rv.first_column = rv.last_column; + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + rv.range[0] = rv.range[1]; + } + + if (l2) { + // shallow-mixin L2, then adjust last col/row accordingly. + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + return rv; + } + } + + if (!l1) { + l1 = l2; + l2 = null; + } + if (!l1) { + return undefined; + } + + // shallow-copy L1|L2, before we try to adjust the yylloc values: after all, we MAY be looking + // at unconventional yylloc info objects... + rv = shallow_copy(l1); + + // first_line: ..., + // first_column: ..., + // last_line: ..., + // last_column: ..., + if (rv.range) { + // shallow copy the yylloc ranges info to prevent us from modifying the original arguments' entries: + rv.range = rv.range.slice(0); + } + + if (l2) { + shallow_copy_noclobber(rv, l2); + rv.last_line = l2.last_line; + rv.last_column = l2.last_column; + if (rv.range && l2.range) { + rv.range[1] = l2.range[1]; + } + } + + return rv; + }; + + // NOTE: as this API uses parse() as a closure, it MUST be set again on every parse() invocation, + // or else your `lexer`, `sharedState`, etc. references will be *wrong*! + this.constructParseErrorInfo = function parser_constructParseErrorInfo(msg, ex, expected, recoverable) { + var pei = { + errStr: msg, + exception: ex, + text: lexer.match, + value: lexer.yytext, + token: this.describeSymbol(symbol) || symbol, + token_id: symbol, + line: lexer.yylineno, + loc: copy_yylloc(lexer.yylloc), + expected: expected, + recoverable: recoverable, + state: state, + action: action, + new_state: newState, + symbol_stack: stack, + state_stack: sstack, + value_stack: vstack, + location_stack: lstack, + stack_pointer: sp, + yy: sharedState_yy, + lexer: lexer, + parser: this, + + // and make sure the error info doesn't stay due to potential + // ref cycle via userland code manipulations. + // These would otherwise all be memory leak opportunities! + // + // Note that only array and object references are nuked as those + // constitute the set of elements which can produce a cyclic ref. + // The rest of the members is kept intact as they are harmless. + destroy: function destructParseErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // info.value = null; + // info.value_stack = null; + // ... + var rec = !!this.recoverable; + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; + } + } + this.recoverable = rec; + } + }; + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + return pei; + }; + + // clone some parts of the (possibly enhanced!) errorInfo object + // to give them some persistence. + this.shallowCopyErrorInfo = function parser_shallowCopyErrorInfo(p) { + var rv = shallow_copy(p); + + // remove the large parts which can only cause cyclic references + // and are otherwise available from the parser kernel anyway. + delete rv.sharedState_yy; + delete rv.parser; + delete rv.lexer; + + // lexer.yytext MAY be a complex value object, rather than a simple string/value: + rv.value = shallow_copy(rv.value); + + // yylloc info: + rv.loc = copy_yylloc(rv.loc); + + // the 'expected' set won't be modified, so no need to clone it: + //rv.expected = rv.expected.slice(0); + + //symbol stack is a simple array: + rv.symbol_stack = rv.symbol_stack.slice(0); + // ditto for state stack: + rv.state_stack = rv.state_stack.slice(0); + // clone the yylloc's in the location stack?: + rv.location_stack = rv.location_stack.map(copy_yylloc); + // and the value stack may carry both simple and complex values: + // shallow-copy the latter. + rv.value_stack = rv.value_stack.map(shallow_copy); + + // and we don't bother with the sharedState_yy reference: + //delete rv.yy; + + // now we prepare for tracking the COMBINE actions + // in the error recovery code path: + // + // as we want to keep the maximum error info context, we + // *scan* the state stack to find the first *empty* slot. + // This position will surely be AT OR ABOVE the current + // stack pointer, but we want to keep the 'used but discarded' + // part of the parse stacks *intact* as those slots carry + // error context that may be useful when you want to produce + // very detailed error diagnostic reports. + // + // ### Purpose of each stack pointer: + // + // - stack_pointer: points at the top of the parse stack + // **as it existed at the time of the error + // occurrence, i.e. at the time the stack + // snapshot was taken and copied into the + // errorInfo object.** + // - base_pointer: the bottom of the **empty part** of the + // stack, i.e. **the start of the rest of + // the stack space /above/ the existing + // parse stack. This section will be filled + // by the error recovery process as it + // travels the parse state machine to + // arrive at the resolving error recovery rule.** + // - info_stack_pointer: + // this stack pointer points to the **top of + // the error ecovery tracking stack space**, i.e. + // this stack pointer takes up the role of + // the `stack_pointer` for the error recovery + // process. Any mutations in the **parse stack** + // are **copy-appended** to this part of the + // stack space, keeping the bottom part of the + // stack (the 'snapshot' part where the parse + // state at the time of error occurrence was kept) + // intact. + // - root_failure_pointer: + // copy of the `stack_pointer`... + // + for (var i = rv.stack_pointer; typeof rv.state_stack[i] !== 'undefined'; i++) { + // empty + } + rv.base_pointer = i; + rv.info_stack_pointer = i; + + rv.root_failure_pointer = rv.stack_pointer; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_recovery_infos.push(rv); + + return rv; + }; + + function getNonTerminalFromCode(symbol) { + var tokenName = self.getSymbolName(symbol); + if (!tokenName) { + tokenName = symbol; + } + return tokenName; + } + + + function lex() { + var token = lexer.lex(); + // if token isn't its numeric value, convert + if (typeof token !== 'number') { + token = self.symbols_[token] || token; + } + + if (typeof Jison !== 'undefined' && Jison.lexDebugger) { + var tokenName = self.getSymbolName(token || EOF); + if (!tokenName) { + tokenName = token; + } + + Jison.lexDebugger.push({ + tokenName: tokenName, + tokenText: lexer.match, + tokenValue: lexer.yytext + }); + } + + return token || EOF; + } + + + var state, action, r, t; + var yyval = { + $: true, + _$: undefined, + yy: sharedState_yy + }; + var p; + var yyrulelen; + var this_production; + var newState; + var retval = false; + + + // Return the rule stack depth where the nearest error rule can be found. + // Return -1 when no error recovery rule was found. + function locateNearestErrorRecoveryRule(state) { + var stack_probe = sp - 1; + var depth = 0; + + // try to recover from error + for (;;) { + // check for error recovery rule in this state + + + + + + + + + + var t = table[state][TERROR] || NO_ACTION; + if (t[0]) { + // We need to make sure we're not cycling forever: + // once we hit EOF, even when we `yyerrok()` an error, we must + // prevent the core from running forever, + // e.g. when parent rules are still expecting certain input to + // follow after this, for example when you handle an error inside a set + // of braces which are matched by a parent rule in your grammar. + // + // Hence we require that every error handling/recovery attempt + // *after we've hit EOF* has a diminishing state stack: this means + // we will ultimately have unwound the state stack entirely and thus + // terminate the parse in a controlled fashion even when we have + // very complex error/recovery code interplay in the core + user + // action code blocks: + + + + + + + + + + if (symbol === EOF) { + if (!lastEofErrorStateDepth) { + lastEofErrorStateDepth = sp - 1 - depth; + } else if (lastEofErrorStateDepth <= sp - 1 - depth) { + + + + + + + + + + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + continue; + } + } + return depth; + } + if (state === 0 /* $accept rule */ || stack_probe < 1) { + + + + + + + + + + return -1; // No suitable error recovery rule available. + } + --stack_probe; // popStack(1): [symbol, action] + state = sstack[stack_probe]; + ++depth; + } + } + + + try { + this.__reentrant_call_depth++; + + lexer.setInput(input, sharedState_yy); + + yyloc = lexer.yylloc; + lstack[sp] = yyloc; + vstack[sp] = null; + sstack[sp] = 0; + stack[sp] = 0; + ++sp; + + + + + + if (this.pre_parse) { + this.pre_parse.call(this, sharedState_yy); + } + if (sharedState_yy.pre_parse) { + sharedState_yy.pre_parse.call(this, sharedState_yy); + } + + newState = sstack[sp - 1]; + for (;;) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // The single `==` condition below covers both these `===` comparisons in a single + // operation: + // + // if (symbol === null || typeof symbol === 'undefined') ... + if (!symbol) { + symbol = lex(); + } + // read action for current state and first input + t = (table[state] && table[state][symbol]) || NO_ACTION; + newState = t[1]; + action = t[0]; + + + + + + + + + + + + // handle parse error + if (!action) { + // first see if there's any chance at hitting an error recovery rule: + var error_rule_depth = locateNearestErrorRecoveryRule(state); + var errStr = null; + var errSymbolDescr = (this.describeSymbol(symbol) || symbol); + var expected = this.collect_expected_token_set(state); + + if (!recovering) { + // Report error + if (typeof lexer.yylineno === 'number') { + errStr = 'Parse error on line ' + (lexer.yylineno + 1) + ': '; + } else { + errStr = 'Parse error: '; + } + + if (typeof lexer.showPosition === 'function') { + errStr += '\n' + lexer.showPosition(79 - 10, 10) + '\n'; + } + if (expected.length) { + errStr += 'Expecting ' + expected.join(', ') + ', got unexpected ' + errSymbolDescr; + } else { + errStr += 'Unexpected ' + errSymbolDescr; + } + + p = this.constructParseErrorInfo(errStr, null, expected, (error_rule_depth >= 0)); + + // cleanup the old one before we start the new error info track: + if (recoveringErrorInfo && typeof recoveringErrorInfo.destroy === 'function') { + recoveringErrorInfo.destroy(); + } + recoveringErrorInfo = this.shallowCopyErrorInfo(p); + + r = this.parseError(p.errStr, p, this.JisonParserError); + + + + + + + + + + // Protect against overly blunt userland `parseError` code which *sets* + // the `recoverable` flag without properly checking first: + // we always terminate the parse when there's no recovery rule available anyhow! + if (!p.recoverable || error_rule_depth < 0) { + retval = r; + break; + } else { + // TODO: allow parseError callback to edit symbol and or state at the start of the error recovery process... + } + } + + + + + + + + + + + var esp = recoveringErrorInfo.info_stack_pointer; + + // just recovered from another error + if (recovering === ERROR_RECOVERY_TOKEN_DISCARD_COUNT && error_rule_depth >= 0) { + // SHIFT current lookahead and grab another + recoveringErrorInfo.symbol_stack[esp] = symbol; + recoveringErrorInfo.value_stack[esp] = shallow_copy(lexer.yytext); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState; // push state + ++esp; + + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + + yyloc = lexer.yylloc; + + preErrorSymbol = 0; + symbol = lex(); + + + + + + + + + + } + + // try to recover from error + if (error_rule_depth < 0) { + assert(recovering > 0); + recoveringErrorInfo.info_stack_pointer = esp; + + // barf a fatal hairball when we're out of look-ahead symbols and none hit a match + // while we are still busy recovering from another error: + var po = this.__error_infos[this.__error_infos.length - 1]; + if (!po) { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error.', null, expected, false); + } else { + p = this.constructParseErrorInfo('Parsing halted while starting to recover from another error. Previous error which resulted in this fatal result: ' + po.errStr, null, expected, false); + p.extra_error_attributes = po; + } + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + + preErrorSymbol = (symbol === TERROR ? 0 : symbol); // save the lookahead token + symbol = TERROR; // insert generic error symbol as new lookahead + + const EXTRA_STACK_SAMPLE_DEPTH = 3; + + // REDUCE/COMBINE the pushed terms/tokens to a new ERROR token: + recoveringErrorInfo.symbol_stack[esp] = preErrorSymbol; + if (errStr) { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + errorStr: errStr, + errorSymbolDescr: errSymbolDescr, + expectedStr: expected, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + + + + + + + + + + } else { + recoveringErrorInfo.value_stack[esp] = { + yytext: shallow_copy(lexer.yytext), + errorRuleDepth: error_rule_depth, + stackSampleLength: error_rule_depth + EXTRA_STACK_SAMPLE_DEPTH + }; + } + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lexer.yylloc); + recoveringErrorInfo.state_stack[esp] = newState || NO_ACTION[1]; + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + yyval.$ = recoveringErrorInfo; + yyval._$ = undefined; + + yyrulelen = error_rule_depth; + + + + + + + + + + r = this.performAction.call(yyval, yyloc, NO_ACTION[1], sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // and move the top entries + discarded part of the parse stacks onto the error info stack: + for (var idx = sp - EXTRA_STACK_SAMPLE_DEPTH, top = idx + yyrulelen; idx < top; idx++, esp++) { + recoveringErrorInfo.symbol_stack[esp] = stack[idx]; + recoveringErrorInfo.value_stack[esp] = shallow_copy(vstack[idx]); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(lstack[idx]); + recoveringErrorInfo.state_stack[esp] = sstack[idx]; + } + + recoveringErrorInfo.symbol_stack[esp] = TERROR; + recoveringErrorInfo.value_stack[esp] = shallow_copy(yyval.$); + recoveringErrorInfo.location_stack[esp] = copy_yylloc(yyval._$); + + // goto new state = table[STATE][NONTERMINAL] + newState = sstack[sp - 1]; + + if (this.defaultActions[newState]) { + recoveringErrorInfo.state_stack[esp] = this.defaultActions[newState]; + } else { + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + recoveringErrorInfo.state_stack[esp] = t[1]; + } + + ++esp; + recoveringErrorInfo.info_stack_pointer = esp; + + // allow N (default: 3) real symbols to be shifted before reporting a new error + recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; + + + + + + + + + + + // Now duplicate the standard parse machine here, at least its initial + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // as we wish to push something special then! + + + // Run the state machine in this copy of the parser state machine + // until we *either* consume the error symbol (and its related information) + // *or* we run into another error while recovering from this one + // *or* we execute a `reduce` action which outputs a final parse + // result (yes, that MAY happen!)... + + assert(recoveringErrorInfo); + assert(symbol === TERROR); + while (symbol) { + // retrieve state number from top of stack + state = newState; // sstack[sp - 1]; + + // use default actions if available + if (this.defaultActions[state]) { + action = 2; + newState = this.defaultActions[state]; + } else { + // read action for current state and first input + t = (table[state] && table[state][symbol]) || NO_ACTION; + newState = t[1]; + action = t[0]; + + + + + + + + + + + // encountered another parse error? If so, break out to main loop + // and take it from there! + if (!action) { + newState = state; + break; + } + } + + + + + + + + + + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + // signal end of error recovery loop AND end of outer parse loop + action = 3; + break; + + // shift: + case 1: + stack[sp] = symbol; + //vstack[sp] = lexer.yytext; + assert(recoveringErrorInfo); + vstack[sp] = recoveringErrorInfo; + //lstack[sp] = copy_yylloc(lexer.yylloc); + lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); + sstack[sp] = newState; // push state + ++sp; + symbol = 0; + if (!preErrorSymbol) { // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + + + + + + + + + + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + + + + + + + + + // read action for current state and first input + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + + + + + + + + symbol = 0; + } + } + + // once we have pushed the special ERROR token value, we're done in this inner loop! + break; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + + + + + + + + + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (typeof r !== 'undefined') { + // signal end of error recovery loop AND end of outer parse loop + action = 3; + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + + + + + + + + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + break; + } + + // break out of loop: we accept or fail with error + break; + } + + // should we also break out of the regular/outer parse loop, + // i.e. did the parser already produce a parse result in here?! + if (action === 3) { + break; + } + continue; + } + + + } + + + + + + + + + + + switch (action) { + // catch misc. parse failures: + default: + // this shouldn't happen, unless resolve defaults are off + if (action instanceof Array) { + p = this.constructParseErrorInfo('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol, null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + } + // Another case of better safe than sorry: in case state transitions come out of another error recovery process + // or a buggy LUT (LookUp Table): + p = this.constructParseErrorInfo('Parsing halted. No viable error recovery approach available due to internal system failure.', null, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + break; + + // shift: + case 1: + stack[sp] = symbol; + vstack[sp] = lexer.yytext; + lstack[sp] = copy_yylloc(lexer.yylloc); + sstack[sp] = newState; // push state + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + var tokenName = self.getSymbolName(symbol || EOF); + if (!tokenName) { + tokenName = symbol; + } + + Jison.parserDebugger.push({ + action: 'shift', + text: lexer.yytext, + terminal: tokenName, + terminal_id: symbol + }); + } + + ++sp; + symbol = 0; + assert(preErrorSymbol === 0); + if (!preErrorSymbol) { // normal execution / no error + // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: + + + + yyloc = lexer.yylloc; + + if (recovering > 0) { + recovering--; + + + + + + + + + + } + } else { + // error just occurred, resume old lookahead f/ before error, *unless* that drops us straight back into error mode: + symbol = preErrorSymbol; + preErrorSymbol = 0; + + + + + + + + + + // read action for current state and first input + t = (table[newState] && table[newState][symbol]) || NO_ACTION; + if (!t[0] || symbol === TERROR) { + // forget about that symbol and move forward: this wasn't a 'forgot to insert' error type where + // (simple) stuff might have been missing before the token which caused the error we're + // recovering from now... + // + // Also check if the LookAhead symbol isn't the ERROR token we set as part of the error + // recovery, for then this we would we idling (cycling) on the error forever. + // Yes, this does not take into account the possibility that the *lexer* may have + // produced a *new* TERROR token all by itself, but that would be a very peculiar grammar! + + + + + + + + + + symbol = 0; + } + } + + continue; + + // reduce: + case 2: + this_production = this.productions_[newState - 1]; // `this.productions_[]` is zero-based indexed while states start from 1 upwards... + yyrulelen = this_production[1]; + + + + + + + + + + + r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); + + if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { + var prereduceValue = vstack.slice(sp - yyrulelen, sp); + var debuggableProductions = []; + for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { + var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); + debuggableProductions.push(debuggableProduction); + } + // find the current nonterminal name (- nolan) + var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; + var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); + + Jison.parserDebugger.push({ + action: 'reduce', + nonterminal: currentNonterminal, + nonterminal_id: currentNonterminalCode, + prereduce: prereduceValue, + result: r, + productions: debuggableProductions, + text: yyval.$ + }); + } + + if (typeof r !== 'undefined') { + retval = r; + break; + } + + // pop off stack + sp -= yyrulelen; + + // don't overwrite the `symbol` variable: use a local var to speed things up: + var ntsymbol = this_production[0]; // push nonterminal (reduce) + stack[sp] = ntsymbol; + vstack[sp] = yyval.$; + lstack[sp] = yyval._$; + // goto new state = table[STATE][NONTERMINAL] + newState = table[sstack[sp - 1]][ntsymbol]; + sstack[sp] = newState; + ++sp; + + + + + + + + + + continue; + + // accept: + case 3: + retval = true; + // Return the `$accept` rule's `$$` result, if available. + // + // Also note that JISON always adds this top-most `$accept` rule (with implicit, + // default, action): + // + // $accept: $end + // %{ $$ = $1; @$ = @1; %} + // + // which, combined with the parse kernel's `$accept` state behaviour coded below, + // will produce the `$$` value output of the rule as the parse result, + // IFF that result is *not* `undefined`. (See also the parser kernel code.) + // + // In code: + // + // %{ + // @$ = @1; // if location tracking support is included + // if (typeof $1 !== 'undefined') + // return $1; + // else + // return true; // the default parse result if the rule actions don't produce anything + // %} + sp--; + if (typeof vstack[sp] !== 'undefined') { + retval = vstack[sp]; + } + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'accept', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + + break; + } + + // break out of loop: we accept or fail with error + break; + } + } catch (ex) { + // report exceptions through the parseError callback too, but keep the exception intact + // if it is a known parser or lexer error which has been thrown by parseError() already: + if (ex instanceof this.JisonParserError) { + throw ex; + } + else if (lexer && typeof lexer.JisonLexerError === 'function' && ex instanceof lexer.JisonLexerError) { + throw ex; + } + else { + p = this.constructParseErrorInfo('Parsing aborted due to exception.', ex, null, false); + retval = this.parseError(p.errStr, p, this.JisonParserError); + } + } finally { + retval = this.cleanupAfterParse(retval, true, true); + this.__reentrant_call_depth--; + + if (typeof Jison !== 'undefined' && Jison.parserDebugger) { + Jison.parserDebugger.push({ + action: 'return', + text: retval + }); + console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); + } + } // /finally + + return retval; +}, +yyError: 1 +}; +parser.originalParseError = parser.parseError; +parser.originalQuoteName = parser.quoteName; + +var rmCommonWS = helpers.rmCommonWS; + +function encodeRE(s) { + return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); +} + +function prepareString(s) { + // unescape slashes + s = s.replace(/\\\\/g, "\\"); + s = encodeRE(s); + return s; +} + +// convert string value to number or boolean value, when possible +// (and when this is more or less obviously the intent) +// otherwise produce the string itself as value. +function parseValue(v) { + if (v === 'false') { + return false; + } + if (v === 'true') { + return true; + } + // http://stackoverflow.com/questions/175739/is-there-a-built-in-way-in-javascript-to-check-if-a-string-is-a-valid-number + // Note that the `v` check ensures that we do not convert `undefined`, `null` and `''` (empty string!) + if (v && !isNaN(v)) { + var rv = +v; + if (isFinite(rv)) { + return rv; + } + } + return v; +} + + +parser.warn = function p_warn() { + console.warn.apply(console, arguments); +}; + +parser.log = function p_log() { + console.log.apply(console, arguments); +}; + +parser.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse:', arguments); +}; + +parser.yy.pre_parse = function p_lex() { + if (parser.yydebug) parser.log('pre_parse YY:', arguments); +}; + +parser.yy.post_lex = function p_lex() { + if (parser.yydebug) parser.log('post_lex:', arguments); +}; +/* lexer generated by jison-lex 0.6.0-194*/ + +/* + * Returns a Lexer object of the following structure: + * + * Lexer: { + * yy: {} The so-called "shared state" or rather the *source* of it; + * the real "shared state" `yy` passed around to + * the rule actions, etc. is a direct reference! + * + * This "shared context" object was passed to the lexer by way of + * the `lexer.setInput(str, yy)` API before you may use it. + * + * This "shared context" object is passed to the lexer action code in `performAction()` + * so userland code in the lexer actions may communicate with the outside world + * and/or other lexer rules' actions in more or less complex ways. + * + * } + * + * Lexer.prototype: { + * EOF: 1, + * ERROR: 2, + * + * yy: The overall "shared context" object reference. + * + * JisonLexerError: function(msg, hash), + * + * performAction: function lexer__performAction(yy, yyrulenumber, YY_START), + * + * The function parameters and `this` have the following value/meaning: + * - `this` : reference to the `lexer` instance. + * `yy_` is an alias for `this` lexer instance reference used internally. + * + * - `yy` : a reference to the `yy` "shared state" object which was passed to the lexer + * by way of the `lexer.setInput(str, yy)` API before. + * + * Note: + * The extra arguments you specified in the `%parse-param` statement in your + * **parser** grammar definition file are passed to the lexer via this object + * reference as member variables. + * + * - `yyrulenumber` : index of the matched lexer rule (regex), used internally. + * + * - `YY_START`: the current lexer "start condition" state. + * + * parseError: function(str, hash, ExceptionClass), + * + * constructLexErrorInfo: function(error_message, is_recoverable), + * Helper function. + * Produces a new errorInfo 'hash object' which can be passed into `parseError()`. + * See it's use in this lexer kernel in many places; example usage: + * + * var infoObj = lexer.constructParseErrorInfo('fail!', true); + * var retVal = lexer.parseError(infoObj.errStr, infoObj, lexer.JisonLexerError); + * + * options: { ... lexer %options ... }, + * + * lex: function(), + * Produce one token of lexed input, which was passed in earlier via the `lexer.setInput()` API. + * You MAY use the additional `args...` parameters as per `%parse-param` spec of the **lexer** grammar: + * these extra `args...` are added verbatim to the `yy` object reference as member variables. + * + * WARNING: + * Lexer's additional `args...` parameters (via lexer's `%parse-param`) MAY conflict with + * any attributes already added to `yy` by the **parser** or the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time + * from silently accepting this confusing and potentially hazardous situation! + * + * cleanupAfterLex: function(do_not_nuke_errorinfos), + * Helper function. + * + * This helper API is invoked when the **parse process** has completed: it is the responsibility + * of the **parser** (or the calling userland code) to invoke this method once cleanup is desired. + * + * This helper may be invoked by user code to ensure the internal lexer gets properly garbage collected. + * + * setInput: function(input, [yy]), + * + * + * input: function(), + * + * + * unput: function(str), + * + * + * more: function(), + * + * + * reject: function(), + * + * + * less: function(n), + * + * + * pastInput: function(n), + * + * + * upcomingInput: function(n), + * + * + * showPosition: function(), + * + * + * test_match: function(regex_match_array, rule_index), + * + * + * next: function(), + * + * + * begin: function(condition), + * + * + * pushState: function(condition), + * + * + * popState: function(), + * + * + * topState: function(), + * + * + * _currentRules: function(), + * + * + * stateStackSize: function(), + * + * + * performAction: function(yy, yy_, yyrulenumber, YY_START), + * + * + * rules: [...], + * + * + * conditions: {associative list: name ==> set}, + * } + * + * + * token location info (`yylloc`): { + * first_line: n, + * last_line: n, + * first_column: n, + * last_column: n, + * range: [start_number, end_number] + * (where the numbers are indexes into the input string, zero-based) + * } + * + * --- + * + * The `parseError` function receives a 'hash' object with these members for lexer errors: + * + * { + * text: (matched text) + * token: (the produced terminal token, if any) + * token_id: (the produced terminal token numeric ID, if any) + * line: (yylineno) + * loc: (yylloc) + * recoverable: (boolean: TRUE when the parser MAY have an error recovery rule + * available for this particular error) + * yy: (object: the current parser internal "shared state" `yy` + * as is also available in the rule actions; this can be used, + * for instance, for advanced error analysis and reporting) + * lexer: (reference to the current lexer instance used by the parser) + * } + * + * while `this` will reference the current lexer instance. + * + * When `parseError` is invoked by the lexer, the default implementation will + * attempt to invoke `yy.parser.parseError()`; when this callback is not provided + * it will try to invoke `yy.parseError()` instead. When that callback is also not + * provided, a `JisonLexerError` exception will be thrown containing the error + * message and `hash`, as constructed by the `constructLexErrorInfo()` API. + * + * Note that the lexer's `JisonLexerError` error class is passed via the + * `ExceptionClass` argument, which is invoked to construct the exception + * instance to be thrown, so technically `parseError` will throw the object + * produced by the `new ExceptionClass(str, hash)` JavaScript expression. + * + * --- + * + * You can specify lexer options by setting / modifying the `.options` object of your Lexer instance. + * These options are available: + * + * (Options are permanent.) + * + * yy: { + * parseError: function(str, hash, ExceptionClass) + * optional: overrides the default `parseError` function. + * } + * + * lexer.options: { + * pre_lex: function() + * optional: is invoked before the lexer is invoked to produce another token. + * `this` refers to the Lexer object. + * post_lex: function(token) { return token; } + * optional: is invoked when the lexer has produced a token `token`; + * this function can override the returned token value by returning another. + * When it does not return any (truthy) value, the lexer will return + * the original `token`. + * `this` refers to the Lexer object. + * + * WARNING: the next set of options are not meant to be changed. They echo the abilities of + * the lexer as per when it was compiled! + * + * ranges: boolean + * optional: `true` ==> token location info will include a .range[] member. + * flex: boolean + * optional: `true` ==> flex-like lexing behaviour where the rules are tested + * exhaustively to find the longest match. + * backtrack_lexer: boolean + * optional: `true` ==> lexer regexes are tested in order and for invoked; + * the lexer terminates the scan when a token is returned by the action code. + * xregexp: boolean + * optional: `true` ==> lexer rule regexes are "extended regex format" requiring the + * `XRegExp` library. When this %option has not been specified at compile time, all lexer + * rule regexes have been written as standard JavaScript RegExp expressions. + * } + */ + + +var lexer = function() { + // See also: + // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + // with userland code which might access the derived class in a 'classic' way. + function JisonLexerError(msg, hash) { + Object.defineProperty(this, 'name', { + enumerable: false, + writable: false, + value: 'JisonLexerError' + }); + + if (msg == null) + msg = '???'; + + Object.defineProperty(this, 'message', { + enumerable: false, + writable: true, + value: msg + }); + + this.hash = hash; + var stacktrace; + + if (hash && hash.exception instanceof Error) { + var ex2 = hash.exception; + this.message = ex2.message || msg; + stacktrace = ex2.stack; + } + + if (!stacktrace) { + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 + Error.captureStackTrace(this, this.constructor); + } else { + stacktrace = new Error(msg).stack; + } + } + + if (stacktrace) { + Object.defineProperty(this, 'stack', { + enumerable: false, + writable: false, + value: stacktrace + }); + } + } + + if (typeof Object.setPrototypeOf === 'function') { + Object.setPrototypeOf(JisonLexerError.prototype, Error.prototype); + } else { + JisonLexerError.prototype = Object.create(Error.prototype); + } + + JisonLexerError.prototype.constructor = JisonLexerError; + JisonLexerError.prototype.name = 'JisonLexerError'; + + var lexer = { + + // Code Generator Information Report + // --------------------------------- + // + // Options: + // + // backtracking: .................... false + // location.ranges: ................. true + // location line+column tracking: ... true + // + // + // Forwarded Parser Analysis flags: + // + // uses yyleng: ..................... false + // uses yylineno: ................... false + // uses yytext: ..................... false + // uses yylloc: ..................... false + // uses lexer values: ............... true/ true + // location tracking: ............... true + // location assignment: ............. true + // + // + // Lexer Analysis flags: + // + // uses yyleng: ..................... ??? + // uses yylineno: ................... ??? + // uses yytext: ..................... ??? + // uses yylloc: ..................... ??? + // uses ParseError API: ............. ??? + // uses yyerror: .................... ??? + // uses location tracking & editing: ??? + // uses more() API: ................. ??? + // uses unput() API: ................ ??? + // uses reject() API: ............... ??? + // uses less() API: ................. ??? + // uses display APIs pastInput(), upcomingInput(), showPosition(): + // ............................. ??? + // uses describeYYLLOC() API: ....... ??? + // + // --------- END OF REPORT ----------- + + + EOF: 1, + + ERROR: 2, + + // JisonLexerError: JisonLexerError, /// <-- injected by the code generator + + // options: {}, /// <-- injected by the code generator + + // yy: ..., /// <-- injected by setInput() + + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + + /** + * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. + * + * @public + * @this {RegExpLexer} + */ + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + /** @constructor */ + var pei = { + errStr: msg, + recoverable: !!recoverable, + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + token: null, + line: this.yylineno, + loc: this.yylloc, + yy: this.yy, + lexer: this, + + /** + * and make sure the error info doesn't stay due to potential + * ref cycle via userland code manipulations. + * These would otherwise all be memory leak opportunities! + * + * Note that only array and object references are nuked as those + * constitute the set of elements which can produce a cyclic ref. + * The rest of the members is kept intact as they are harmless. + * + * @public + * @this {LexErrorInfo} + */ + destroy: function destructLexErrorInfo() { + // remove cyclic references added to error info: + // info.yy = null; + // info.lexer = null; + // ... + var rec = !!this.recoverable; + + for (var key in this) { + if (this.hasOwnProperty(key) && typeof key === 'object') { + this[key] = undefined; + } + } + + this.recoverable = rec; + } + }; + + // track this instance so we can `destroy()` it once we deem it superfluous and ready for garbage collection! + this.__error_infos.push(pei); + + return pei; + }, + + /** + * handler which is invoked when a lexer error occurs. + * + * @public + * @this {RegExpLexer} + */ + parseError: function lexer_parseError(str, hash, ExceptionClass) { + if (!ExceptionClass) { + ExceptionClass = this.JisonLexerError; + } + + if (this.yy) { + if (this.yy.parser && typeof this.yy.parser.parseError === 'function') { + return this.yy.parser.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } else if (typeof this.yy.parseError === 'function') { + return this.yy.parseError.call(this, str, hash, ExceptionClass) || this.ERROR; + } + } + + throw new ExceptionClass(str, hash); + }, + + /** + * method which implements `yyerror(str, ...args)` functionality for use inside lexer actions. + * + * @public + * @this {RegExpLexer} + */ + yyerror: function yyError(str /*, ...args */) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': ' + str, + this.options.lexerErrorsAreRecoverable + ); + + // Add any extra args to the hash under the name `extra_error_attributes`: + var args = Array.prototype.slice.call(arguments, 1); + + if (args.length) { + p.extra_error_attributes = args; + } + + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + }, + + /** + * final cleanup function for when we have completed lexing the input; + * make it an API so that external code can use this one once userland + * code has decided it's time to destroy any lingering lexer error + * hash object instances and the like: this function helps to clean + * up these constructs, which *may* carry cyclic references which would + * otherwise prevent the instances from being properly and timely + * garbage-collected, i.e. this function helps prevent memory leaks! + * + * @public + * @this {RegExpLexer} + */ + cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + this.setInput('', {}); + + // nuke the error hash info instances created during this run. + // Userland code must COPY any data/references + // in the error hash instance(s) it is more permanently interested in. + if (!do_not_nuke_errorinfos) { + for (var i = this.__error_infos.length - 1; i >= 0; i--) { + var el = this.__error_infos[i]; + + if (el && typeof el.destroy === 'function') { + el.destroy(); + } + } + + this.__error_infos.length = 0; + } + + return this; + }, + + /** + * clear the lexer token context; intended for internal use only + * + * @public + * @this {RegExpLexer} + */ + clear: function lexer_clear() { + this.yytext = ''; + this.yyleng = 0; + this.match = ''; + + // - DO NOT reset `this.matched` + this.matches = false; + + this._more = false; + this._backtrack = false; + var col = (this.yylloc ? this.yylloc.last_column : 0); + + this.yylloc = { + first_line: this.yylineno + 1, + first_column: col, + last_line: this.yylineno + 1, + last_column: col, + range: [this.offset, this.offset] + }; + }, + + /** + * resets the lexer, sets new input + * + * @public + * @this {RegExpLexer} + */ + setInput: function lexer_setInput(input, yy) { + this.yy = yy || this.yy || {}; + + // also check if we've fully initialized the lexer instance, + // including expansion work to be done to go from a loaded + // lexer to a usable lexer: + if (!this.__decompressed) { + // step 1: decompress the regex list: + var rules = this.rules; + + for (var i = 0, len = rules.length; i < len; i++) { + var rule_re = rules[i]; + + // compression: is the RE an xref to another RE slot in the rules[] table? + if (typeof rule_re === 'number') { + rules[i] = rules[rule_re]; + } + } + + // step 2: unfold the conditions[] set to make these ready for use: + var conditions = this.conditions; + + for (var k in conditions) { + var spec = conditions[k]; + var rule_ids = spec.rules; + var len = rule_ids.length; + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_new_ids = new Array(len + 1); + + for (var i = 0; i < len; i++) { + var idx = rule_ids[i]; + var rule_re = rules[idx]; + rule_regexes[i + 1] = rule_re; + rule_new_ids[i + 1] = idx; + } + + spec.rules = rule_new_ids; + spec.__rule_regexes = rule_regexes; + spec.__rule_count = len; + } + + this.__decompressed = true; + } + + this._input = input || ''; + this.clear(); + this._signaled_error_token = false; + this.done = false; + this.yylineno = 0; + this.matched = ''; + this.conditionStack = ['INITIAL']; + this.__currentRuleSet__ = null; + + this.yylloc = { + first_line: 1, + first_column: 0, + last_line: 1, + last_column: 0, + range: [0, 0] + }; + + this.offset = 0; + return this; + }, + + /** + * edit the remaining input via user-specified callback. + * This can be used to forward-adjust the input-to-parse, + * e.g. inserting macro expansions and alike in the + * input which has yet to be lexed. + * The behaviour of this API contrasts the `unput()` et al + * APIs as those act on the *consumed* input, while this + * one allows one to manipulate the future, without impacting + * the current `yyloc` cursor location or any history. + * + * Use this API to help implement C-preprocessor-like + * `#include` statements, etc. + * + * The provided callback must be synchronous and is + * expected to return the edited input (string). + * + * The `cpsArg` argument value is passed to the callback + * as-is. + * + * `callback` interface: + * `function callback(input, cpsArg)` + * + * - `input` will carry the remaining-input-to-lex string + * from the lexer. + * - `cpsArg` is `cpsArg` passed into this API. + * + * The `this` reference for the callback will be set to + * reference this lexer instance so that userland code + * in the callback can easily and quickly access any lexer + * API. + * + * When the callback returns a non-string-type falsey value, + * we assume the callback did not edit the input and we + * will using the input as-is. + * + * When the callback returns a non-string-type value, it + * is converted to a string for lexing via the `"" + retval` + * operation. (See also why: http://2ality.com/2012/03/converting-to-string.html + * -- that way any returned object's `toValue()` and `toString()` + * methods will be invoked in a proper/desirable order.) + * + * @public + * @this {RegExpLexer} + */ + editRemainingInput: function lexer_editRemainingInput(callback, cpsArg) { + var rv = callback.call(this, this._input, cpsArg); + + if (typeof rv !== 'string') { + if (rv) { + this._input = '' + rv; + } + // else: keep `this._input` as is. + } else { + this._input = rv; + } + + return this; + }, + + /** + * consumes and returns one char from the input + * + * @public + * @this {RegExpLexer} + */ + input: function lexer_input() { + if (!this._input) { + //this.done = true; -- don't set `done` as we want the lex()/next() API to be able to produce one custom EOF token match after this anyhow. (lexer can match special <> tokens and perform user action code for a <> match, but only does so *once*) + return null; + } + + var ch = this._input[0]; + this.yytext += ch; + this.yyleng++; + this.offset++; + this.match += ch; + this.matched += ch; + + // Count the linenumber up when we hit the LF (or a stand-alone CR). + // On CRLF, the linenumber is incremented when you fetch the CR or the CRLF combo + // and we advance immediately past the LF as well, returning both together as if + // it was all a single 'character' only. + var slice_len = 1; + + var lines = false; + + if (ch === '\n') { + lines = true; + } else if (ch === '\r') { + lines = true; + var ch2 = this._input[1]; + + if (ch2 === '\n') { + slice_len++; + ch += ch2; + this.yytext += ch2; + this.yyleng++; + this.offset++; + this.match += ch2; + this.matched += ch2; + this.yylloc.range[1]++; + } + } + + if (lines) { + this.yylineno++; + this.yylloc.last_line++; + this.yylloc.last_column = 0; + } else { + this.yylloc.last_column++; + } + + this.yylloc.range[1]++; + this._input = this._input.slice(slice_len); + return ch; + }, + + /** + * unshifts one char (or an entire string) into the input + * + * @public + * @this {RegExpLexer} + */ + unput: function lexer_unput(ch) { + var len = ch.length; + var lines = ch.split(/(?:\r\n?|\n)/g); + this._input = ch + this._input; + this.yytext = this.yytext.substr(0, this.yytext.length - len); + this.yyleng = this.yytext.length; + this.offset -= len; + this.match = this.match.substr(0, this.match.length - len); + this.matched = this.matched.substr(0, this.matched.length - len); + + if (lines.length > 1) { + this.yylineno -= lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); + + if (pre_lines.length === 1) { + pre = this.matched; + pre_lines = pre.split(/(?:\r\n?|\n)/g); + } + + this.yylloc.last_column = pre_lines[pre_lines.length - 1].length; + } else { + this.yylloc.last_column -= len; + } + + this.yylloc.range[1] = this.yylloc.range[0] + this.yyleng; + this.done = false; + return this; + }, + + /** + * cache matched text and append it on next action + * + * @public + * @this {RegExpLexer} + */ + more: function lexer_more() { + this._more = true; + return this; + }, + + /** + * signal the lexer that this rule fails to match the input, so the + * next matching rule (regex) should be tested instead. + * + * @public + * @this {RegExpLexer} + */ + reject: function lexer_reject() { + if (this.options.backtrack_lexer) { + this._backtrack = true; + } else { + // when the `parseError()` call returns, we MUST ensure that the error is registered. + // We accomplish this by signaling an 'error' token to be produced for the current + // `.lex()` run. + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, + false + ); + + this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + + return this; + }, + + /** + * retain first n characters of the match + * + * @public + * @this {RegExpLexer} + */ + less: function lexer_less(n) { + return this.unput(this.match.slice(n)); + }, + + /** + * return (part of the) already matched input, i.e. for error + * messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of + * input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * @public + * @this {RegExpLexer} + */ + pastInput: function lexer_pastInput(maxSize, maxLines) { + var past = this.matched.substring(0, this.matched.length - this.match.length); + + if (maxSize < 0) + maxSize = past.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = past.length; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + + // `substr` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + past = past.substr(-maxSize * 2 - 2); + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = past.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(-maxLines); + past = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis prefix... + if (past.length > maxSize) { + past = '...' + past.substr(-maxSize); + } + + return past; + }, + + /** + * return (part of the) upcoming input, i.e. for error messages. + * + * Limit the returned string length to `maxSize` (default: 20). + * + * Limit the returned string to the `maxLines` number of lines of input (default: 1). + * + * Negative limit values equal *unlimited*. + * + * > ### NOTE ### + * > + * > *"upcoming input"* is defined as the whole of the both + * > the *currently lexed* input, together with any remaining input + * > following that. *"currently lexed"* input is the input + * > already recognized by the lexer but not yet returned with + * > the lexer token. This happens when you are invoking this API + * > from inside any lexer rule action code block. + * > + * + * @public + * @this {RegExpLexer} + */ + upcomingInput: function lexer_upcomingInput(maxSize, maxLines) { + var next = this.match; + + if (maxSize < 0) + maxSize = next.length + this._input.length; + else if (!maxSize) + maxSize = 20; + + if (maxLines < 0) + maxLines = maxSize; // can't ever have more input lines than this! + else if (!maxLines) + maxLines = 1; + + // `substring` anticipation: treat \r\n as a single character and take a little + // more than necessary so that we can still properly check against maxSize + // after we've transformed and limited the newLines in here: + if (next.length < maxSize * 2 + 2) { + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + } + + // now that we have a significantly reduced string to process, transform the newlines + // and chop them, then limit them: + var a = next.replace(/\r\n|\r/g, '\n').split('\n'); + + a = a.slice(0, maxLines); + next = a.join('\n'); + + // When, after limiting to maxLines, we still have too much to return, + // do add an ellipsis postfix... + if (next.length > maxSize) { + next = next.substring(0, maxSize) + '...'; + } + + return next; + }, + + /** + * return a string which displays the character position where the + * lexing error occurred, i.e. for error messages + * + * @public + * @this {RegExpLexer} + */ + showPosition: function lexer_showPosition(maxPrefix, maxPostfix) { + var pre = this.pastInput(maxPrefix).replace(/\s/g, ' '); + var c = new Array(pre.length + 1).join('-'); + return pre + this.upcomingInput(maxPostfix).replace(/\s/g, ' ') + '\n' + c + '^'; + }, + + /** + * return a string which displays the lines & columns of input which are referenced + * by the given location info range, plus a few lines of context. + * + * This function pretty-prints the indicated section of the input, with line numbers + * and everything! + * + * This function is very useful to provide highly readable error reports, while + * the location range may be specified in various flexible ways: + * + * - `loc` is the location info object which references the area which should be + * displayed and 'marked up': these lines & columns of text are marked up by `^` + * characters below each character in the entire input range. + * + * - `context_loc` is the *optional* location info object which instructs this + * pretty-printer how much *leading* context should be displayed alongside + * the area referenced by `loc`. This can help provide context for the displayed + * error, etc. + * + * When this location info is not provided, a default context of 3 lines is + * used. + * + * - `context_loc2` is another *optional* location info object, which serves + * a similar purpose to `context_loc`: it specifies the amount of *trailing* + * context lines to display in the pretty-print output. + * + * When this location info is not provided, a default context of 1 line only is + * used. + * + * Special Notes: + * + * - when the `loc`-indicated range is very large (about 5 lines or more), then + * only the first and last few lines of this block are printed while a + * `...continued...` message will be printed between them. + * + * This serves the purpose of not printing a huge amount of text when the `loc` + * range happens to be huge: this way a manageable & readable output results + * for arbitrary large ranges. + * + * - this function can display lines of input which whave not yet been lexed. + * `prettyPrintRange()` can access the entire input! + * + * @public + * @this {RegExpLexer} + */ + prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var input = this.matched + this._input; + var lines = input.split('\n'); + + //var show_context = (error_size < 5 || context_loc); + var l0 = Math.max(1, (context_loc ? context_loc.first_line : loc.first_line - CONTEXT)); + + var l1 = Math.max(1, (context_loc2 ? context_loc2.last_line : loc.last_line + CONTEXT_TAIL)); + var lineno_display_width = 1 + Math.log10(l1 | 1) | 0; + var ws_prefix = new Array(lineno_display_width).join(' '); + var nonempty_line_indexes = []; + + var rv = lines.slice(l0 - 1, l1 + 1).map(function injectLineNumber(line, index) { + var lno = index + l0; + var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); + var rv = lno_pfx + ': ' + line; + var errpfx = new Array(lineno_display_width + 1).join('^'); + + if (lno === loc.first_line) { + var offset = loc.first_column + 2; + + var len = Math.max( + 2, + ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 + ); + + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno === loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, loc.last_column + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } else if (lno > loc.first_line && lno < loc.last_line) { + var offset = 2 + 1; + var len = Math.max(2, line.length + 1); + var lead = new Array(offset).join('.'); + var mark = new Array(len).join('^'); + rv += '\n' + errpfx + lead + mark; + + if (line.trim().length > 0) { + nonempty_line_indexes.push(index); + } + } + + rv = rv.replace(/\t/g, ' '); + return rv; + }); + + // now make sure we don't print an overly large amount of error area: limit it + // to the top and bottom line count: + if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { + var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; + var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; + + console.log('clip off: ', { + start: clip_start, + end: clip_end, + len: clip_end - clip_start + 1, + arr: nonempty_line_indexes, + rv + }); + + var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; + intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; + rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); + } + + return rv.join('\n'); + }, + + /** + * helper function, used to produce a human readable description as a string, given + * the input `yylloc` location object. + * + * Set `display_range_too` to TRUE to include the string character index position(s) + * in the description if the `yylloc.range` is available. + * + * @public + * @this {RegExpLexer} + */ + describeYYLLOC: function lexer_describe_yylloc(yylloc, display_range_too) { + var l1 = yylloc.first_line; + var l2 = yylloc.last_line; + var c1 = yylloc.first_column; + var c2 = yylloc.last_column; + var dl = l2 - l1; + var dc = c2 - c1; + var rv; + + if (dl === 0) { + rv = 'line ' + l1 + ', '; + + if (dc <= 1) { + rv += 'column ' + c1; + } else { + rv += 'columns ' + c1 + ' .. ' + c2; + } + } else { + rv = 'lines ' + l1 + '(column ' + c1 + ') .. ' + l2 + '(column ' + c2 + ')'; + } + + if (yylloc.range && display_range_too) { + var r1 = yylloc.range[0]; + var r2 = yylloc.range[1] - 1; + + if (r2 <= r1) { + rv += ' {String Offset: ' + r1 + '}'; + } else { + rv += ' {String Offset range: ' + r1 + ' .. ' + r2 + '}'; + } + } + + return rv; + }, + + /** + * test the lexed token: return FALSE when not a match, otherwise return token. + * + * `match` is supposed to be an array coming out of a regex match, i.e. `match[0]` + * contains the actually matched text string. + * + * Also move the input cursor forward and update the match collectors: + * + * - `yytext` + * - `yyleng` + * - `match` + * - `matches` + * - `yylloc` + * - `offset` + * + * @public + * @this {RegExpLexer} + */ + test_match: function lexer_test_match(match, indexed_rule) { + var token, lines, backup, match_str, match_str_len; + + if (this.options.backtrack_lexer) { + // save context + backup = { + yylineno: this.yylineno, + + yylloc: { + first_line: this.yylloc.first_line, + last_line: this.yylloc.last_line, + first_column: this.yylloc.first_column, + last_column: this.yylloc.last_column, + range: this.yylloc.range.slice(0) + }, + + yytext: this.yytext, + match: this.match, + matches: this.matches, + matched: this.matched, + yyleng: this.yyleng, + offset: this.offset, + _more: this._more, + _input: this._input, + + //_signaled_error_token: this._signaled_error_token, + yy: this.yy, + + conditionStack: this.conditionStack.slice(0), + done: this.done + }; + } + + match_str = match[0]; + match_str_len = match_str.length; + + // if (match_str.indexOf('\n') !== -1 || match_str.indexOf('\r') !== -1) { + lines = match_str.split(/(?:\r\n?|\n)/g); + + if (lines.length > 1) { + this.yylineno += lines.length - 1; + this.yylloc.last_line = this.yylineno + 1; + this.yylloc.last_column = lines[lines.length - 1].length; + } else { + this.yylloc.last_column += match_str_len; + } + + // } + this.yytext += match_str; + + this.match += match_str; + this.matched += match_str; + this.matches = match; + this.yyleng = this.yytext.length; + this.yylloc.range[1] += match_str_len; + + // previous lex rules MAY have invoked the `more()` API rather than producing a token: + // those rules will already have moved this `offset` forward matching their match lengths, + // hence we must only add our own match length now: + this.offset += match_str_len; + + this._more = false; + this._backtrack = false; + this._input = this._input.slice(match_str_len); + + // calling this method: + // + // function lexer__performAction(yy, yyrulenumber, YY_START) {...} + token = this.performAction.call( + this, + this.yy, + indexed_rule, + this.conditionStack[this.conditionStack.length - 1] /* = YY_START */ + ); + + // otherwise, when the action codes are all simple return token statements: + //token = this.simpleCaseActionClusters[indexed_rule]; + + if (this.done && this._input) { + this.done = false; + } + + if (token) { + return token; + } else if (this._backtrack) { + // recover context + for (var k in backup) { + this[k] = backup[k]; + } + + this.__currentRuleSet__ = null; + return false; // rule action called reject() implying the next rule should be tested instead. + } else if (this._signaled_error_token) { + // produce one 'error' token as `.parseError()` in `reject()` + // did not guarantee a failure signal by throwing an exception! + token = this._signaled_error_token; + + this._signaled_error_token = false; + return token; + } + + return false; + }, + + /** + * return next match in input + * + * @public + * @this {RegExpLexer} + */ + next: function lexer_next() { + if (this.done) { + this.clear(); + return this.EOF; + } + + if (!this._input) { + this.done = true; + } + + var token, match, tempMatch, index; + + if (!this._more) { + this.clear(); + } + + var spec = this.__currentRuleSet__; + + if (!spec) { + // Update the ruleset cache as we apparently encountered a state change or just started lexing. + // The cache is set up for fast lookup -- we assume a lexer will switch states much less often than it will + // invoke the `lex()` token-producing API and related APIs, hence caching the set for direct access helps + // speed up those activities a tiny bit. + spec = this.__currentRuleSet__ = this._currentRules(); + + // Check whether a *sane* condition has been pushed before: this makes the lexer robust against + // user-programmer bugs such as https://github.com/zaach/jison-lex/issues/19 + if (!spec || !spec.rules) { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo( + 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, + false + ); + + // produce one 'error' token until this situation has been resolved, most probably by parse termination! + return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + } + } + + var rule_ids = spec.rules; + var regexes = spec.__rule_regexes; + var len = spec.__rule_count; + + // Note: the arrays are 1-based, while `len` itself is a valid index, + // hence the non-standard less-or-equal check in the next loop condition! + for (var i = 1; i <= len; i++) { + tempMatch = this._input.match(regexes[i]); + + if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { + match = tempMatch; + index = i; + + if (this.options.backtrack_lexer) { + token = this.test_match(tempMatch, rule_ids[i]); + + if (token !== false) { + return token; + } else if (this._backtrack) { + match = undefined; + continue; // rule action called reject() implying a rule MISmatch. + } else { + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + } else if (!this.options.flex) { + break; + } + } + } + + if (match) { + token = this.test_match(match, rule_ids[index]); + + if (token !== false) { + return token; + } + + // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) + return false; + } + + if (!this._input) { + this.done = true; + this.clear(); + return this.EOF; + } else { + var lineno_msg = ''; + + if (this.options.trackPosition) { + lineno_msg = ' on line ' + (this.yylineno + 1); + } + + var pos_str = ''; + + if (typeof this.showPosition === 'function') { + pos_str = this.showPosition(); + + if (pos_str && pos_str[0] !== '\n') { + pos_str = '\n' + pos_str; + } + } + + var p = this.constructLexErrorInfo( + 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, + this.options.lexerErrorsAreRecoverable + ); + + token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; + + if (token === this.ERROR) { + // we can try to recover from a lexer error that `parseError()` did not 'recover' for us + // by moving forward at least one character at a time: + if (!this.match.length) { + this.input(); + } + } + + return token; + } + }, + + /** + * return next match that has a token + * + * @public + * @this {RegExpLexer} + */ + lex: function lexer_lex() { + var r; + + // allow the PRE/POST handlers set/modify the return token for maximum flexibility of the generated lexer: + if (typeof this.options.pre_lex === 'function') { + r = this.options.pre_lex.call(this); + } + + while (!r) { + r = this.next(); + } + + if (typeof this.options.post_lex === 'function') { + // (also account for a userdef function which does not return any value: keep the token as is) + r = this.options.post_lex.call(this, r) || r; + } + + return r; + }, + + /** + * backwards compatible alias for `pushState()`; + * the latter is symmetrical with `popState()` and we advise to use + * those APIs in any modern lexer code, rather than `begin()`. + * + * @public + * @this {RegExpLexer} + */ + begin: function lexer_begin(condition) { + return this.pushState(condition); + }, + + /** + * activates a new lexer condition state (pushes the new lexer + * condition state onto the condition stack) + * + * @public + * @this {RegExpLexer} + */ + pushState: function lexer_pushState(condition) { + this.conditionStack.push(condition); + this.__currentRuleSet__ = null; + return this; + }, + + /** + * pop the previously active lexer condition state off the condition + * stack + * + * @public + * @this {RegExpLexer} + */ + popState: function lexer_popState() { + var n = this.conditionStack.length - 1; + + if (n > 0) { + this.__currentRuleSet__ = null; + return this.conditionStack.pop(); + } else { + return this.conditionStack[0]; + } + }, + + /** + * return the currently active lexer condition state; when an index + * argument is provided it produces the N-th previous condition state, + * if available + * + * @public + * @this {RegExpLexer} + */ + topState: function lexer_topState(n) { + n = this.conditionStack.length - 1 - Math.abs(n || 0); + + if (n >= 0) { + return this.conditionStack[n]; + } else { + return 'INITIAL'; + } + }, + + /** + * (internal) determine the lexer rule set which is active for the + * currently active lexer condition state + * + * @public + * @this {RegExpLexer} + */ + _currentRules: function lexer__currentRules() { + if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { + return this.conditions[this.conditionStack[this.conditionStack.length - 1]]; + } else { + return this.conditions['INITIAL']; + } + }, + + /** + * return the number of states currently on the stack + * + * @public + * @this {RegExpLexer} + */ + stateStackSize: function lexer_stateStackSize() { + return this.conditionStack.length; + }, + + options: { + xregexp: true, + ranges: true, + trackPosition: true, + parseActionsUseYYMERGELOCATIONINFO: true, + easy_keyword_rules: true + }, + + JisonLexerError: JisonLexerError, + + performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { + var yy_ = this; + switch (yyrulenumber) { + case 0: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %\{ */ + yy.dept = 0; + + yy.include_command_allowed = false; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 1: + /*! Conditions:: action */ + /*! Rule:: %\{([^]*?)%\} */ + yy_.yytext = this.matches[1]; + + yy.include_command_allowed = true; + return 32; + break; + + case 2: + /*! Conditions:: action */ + /*! Rule:: %include\b */ + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState('path'); + + return 51; + } else { + // TODO + yy_.yyerror('oops!'); + + return 37; + } + + break; + + case 3: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 34; + + break; + + case 4: + /*! Conditions:: action */ + /*! Rule:: {WS}*\/\/.* */ + yy.include_command_allowed = false; + + return 35; + break; + + case 6: + /*! Conditions:: action */ + /*! Rule:: \| */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 7: + /*! Conditions:: action */ + /*! Rule:: %% */ + if (yy.include_command_allowed) { + this.popState(); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } else { + return 33; + } + + break; + + case 9: + /*! Conditions:: action */ + /*! Rule:: \/[^\s/]*?(?:['"`{}][^\s/]*?)*\/ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 10: + /*! Conditions:: action */ + /*! Rule:: \/[^}{BR}]* */ + yy.include_command_allowed = false; + + return 33; + break; + + case 11: + /*! Conditions:: action */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy.include_command_allowed = false; + + return 33; + break; + + case 12: + /*! Conditions:: action */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy.include_command_allowed = false; + + return 33; + break; + + case 13: + /*! Conditions:: action */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy.include_command_allowed = false; + + return 33; + break; + + case 14: + /*! Conditions:: action */ + /*! Rule:: [^{}/"'`|%\{\}{BR}{WS}]+ */ + yy.include_command_allowed = false; + + return 33; + break; + + case 15: + /*! Conditions:: action */ + /*! Rule:: \{ */ + yy.depth++; + + yy.include_command_allowed = false; + return 33; + break; + + case 16: + /*! Conditions:: action */ + /*! Rule:: \} */ + yy.include_command_allowed = false; + + if (yy.depth <= 0) { + yy_.yyerror(rmCommonWS` + too many closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 'BRACKETS_SURPLUS'; + } else { + yy.depth--; + } + + return 33; + break; + + case 17: + /*! Conditions:: action */ + /*! Rule:: (?:{BR}{WS}+)+(?=[^{WS}{BR}|]) */ + yy.include_command_allowed = true; + + return 36; // keep empty lines as-is inside action code blocks. + break; + + case 18: + /*! Conditions:: action */ + /*! Rule:: {BR} */ + if (yy.depth > 0) { + yy.include_command_allowed = true; + return 36; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk + this.popState(); + + this.unput(yy_.yytext); + yy_.yytext = ''; + return 31; + } + + break; + + case 19: + /*! Conditions:: action */ + /*! Rule:: $ */ + yy.include_command_allowed = false; + + if (yy.depth !== 0) { + yy_.yyerror(rmCommonWS` + missing ${yy.depth} closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = ''; + return 'BRACKETS_MISSING'; + } + + this.popState(); + yy_.yytext = ''; + return 31; + break; + + case 21: + /*! Conditions:: conditions */ + /*! Rule:: > */ + this.popState(); + + return 6; + break; + + case 24: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 25: + /*! Conditions:: INITIAL start_condition macro path options */ + /*! Rule:: {WS}*\/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 26: + /*! Conditions:: rules */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 27: + /*! Conditions:: rules */ + /*! Rule:: {WS}+{BR}+ */ + /* empty */ + break; + + case 28: + /*! Conditions:: rules */ + /*! Rule:: \/\/[^\r\n]* */ + /* skip single-line comment */ + break; + + case 29: + /*! Conditions:: rules */ + /*! Rule:: \/\*[^]*?\*\/ */ + /* skip multi-line comment */ + break; + + case 30: + /*! Conditions:: rules */ + /*! Rule:: {WS}+(?=[^{WS}{BR}|%]) */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + return 28; + break; + + case 31: + /*! Conditions:: rules */ + /*! Rule:: %% */ + this.popState(); + + this.pushState('code'); + return 19; + break; + + case 32: + /*! Conditions:: rules */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 35: + /*! Conditions:: options */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 49; // value is always a string type + break; + + case 36: + /*! Conditions:: options */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 49; // value is always a string type + break; + + case 37: + /*! Conditions:: options */ + /*! Rule:: `{ES2017_STRING_CONTENT}` */ + yy_.yytext = unescQuote(this.matches[1], /\\`/g); + + return 49; // value is always a string type + break; + + case 39: + /*! Conditions:: options */ + /*! Rule:: {BR}{WS}+(?=\S) */ + /* skip leading whitespace on the next line of input, when followed by more options */ + break; + + case 40: + /*! Conditions:: options */ + /*! Rule:: {BR} */ + this.popState(); + + return 48; + break; + + case 41: + /*! Conditions:: options */ + /*! Rule:: {WS}+ */ + /* skip whitespace */ + break; + + case 43: + /*! Conditions:: start_condition */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 44: + /*! Conditions:: start_condition */ + /*! Rule:: {WS}+ */ + /* empty */ + break; + + case 46: + /*! Conditions:: INITIAL */ + /*! Rule:: {ID} */ + this.pushState('macro'); + + return 20; + break; + + case 47: + /*! Conditions:: macro named_chunk */ + /*! Rule:: {BR}+ */ + this.popState(); + + break; + + case 48: + /*! Conditions:: macro */ + /*! Rule:: {ANY_LITERAL_CHAR}+ */ + // accept any non-regex, non-lex, non-string-delim, + // non-escape-starter, non-space character as-is + return 46; + + break; + + case 49: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: {BR}+ */ + /* empty */ + break; + + case 50: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \s+ */ + /* empty */ + break; + + case 51: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1], /\\"/g); + + return 26; + break; + + case 52: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1], /\\'/g); + + return 26; + break; + + case 53: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \[ */ + this.pushState('set'); + + return 41; + break; + + case 66: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: < */ + this.pushState('conditions'); + + return 5; + break; + + case 67: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/! */ + return 39; // treated as `(?!atom)` + + break; + + case 68: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \/ */ + return 14; // treated as `(?=atom)` + + break; + + case 70: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\. */ + yy_.yytext = yy_.yytext.replace(/^\\/g, ''); + + return 44; + break; + + case 73: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %options\b */ + this.pushState('options'); + + return 47; + break; + + case 74: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %s\b */ + this.pushState('start_condition'); + + return 21; + break; + + case 75: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %x\b */ + this.pushState('start_condition'); + + return 22; + break; + + case 76: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %code\b */ + this.pushState('named_chunk'); + + return 25; + break; + + case 77: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %import\b */ + this.pushState('named_chunk'); + + return 24; + break; + + case 78: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %include\b */ + yy.depth = 0; + + yy.include_command_allowed = true; + this.pushState('action'); + this.unput(yy_.yytext); + yy_.yytext = ''; + return 28; + break; + + case 79: + /*! Conditions:: code */ + /*! Rule:: %include\b */ + this.pushState('path'); + + return 51; + break; + + case 80: + /*! Conditions:: INITIAL rules code */ + /*! Rule:: %{NAME}([^\r\n]*) */ + /* ignore unrecognized decl */ + this.warn(rmCommonWS` + LEX: ignoring unsupported lexer option ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + yy_.yytext = [ + this.matches[1], // {NAME} + this.matches[2].trim() // optional value/parameters + ]; + + return 23; + break; + + case 81: + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: %% */ + this.pushState('rules'); + + return 19; + break; + + case 89: + /*! Conditions:: set */ + /*! Rule:: \] */ + this.popState(); + + return 42; + break; + + case 91: + /*! Conditions:: code */ + /*! Rule:: [^\r\n]+ */ + return 53; // the bit of CODE just before EOF... + + break; + + case 92: + /*! Conditions:: path */ + /*! Rule:: {BR} */ + this.popState(); + + this.unput(yy_.yytext); + break; + + case 93: + /*! Conditions:: path */ + /*! Rule:: "{DOUBLEQUOTED_STRING_CONTENT}" */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 94: + /*! Conditions:: path */ + /*! Rule:: '{QUOTED_STRING_CONTENT}' */ + yy_.yytext = unescQuote(this.matches[1]); + + this.popState(); + return 52; + break; + + case 95: + /*! Conditions:: path */ + /*! Rule:: {WS}+ */ + // skip whitespace in the line + break; + + case 96: + /*! Conditions:: path */ + /*! Rule:: [^\s\r\n]+ */ + this.popState(); + + return 52; + break; + + case 97: + /*! Conditions:: action */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 98: + /*! Conditions:: action */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 99: + /*! Conditions:: action */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 100: + /*! Conditions:: options */ + /*! Rule:: " */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 101: + /*! Conditions:: options */ + /*! Rule:: ' */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 102: + /*! Conditions:: options */ + /*! Rule:: ` */ + yy_.yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 103: + /*! Conditions:: * */ + /*! Rule:: " */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 104: + /*! Conditions:: * */ + /*! Rule:: ' */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 105: + /*! Conditions:: * */ + /*! Rule:: ` */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + return 2; + break; + + case 106: + /*! Conditions:: macro rules */ + /*! Rule:: . */ + /* b0rk on bad characters */ + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + + yy_.yyerror(rmCommonWS` + unsupported lexer input encountered while lexing + ${rules} (i.e. jison lex regexes). + + NOTE: When you want this input to be interpreted as a LITERAL part + of a lex rule regex, you MUST enclose it in double or + single quotes. + + If not, then know that this input is not accepted as a valid + regex expression here in jison-lex ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + case 107: + /*! Conditions:: * */ + /*! Rule:: . */ + yy_.yyerror(rmCommonWS` + unsupported lexer input: ${dquote(yy_.yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + this.prettyPrintRange(this, yy_.yylloc)); + + break; + + default: + return this.simpleCaseActionClusters[yyrulenumber]; + } + }, + + simpleCaseActionClusters: { + /*! Conditions:: action */ + /*! Rule:: {WS}+ */ + 5: 36, + + /*! Conditions:: action */ + /*! Rule:: % */ + 8: 33, + + /*! Conditions:: conditions */ + /*! Rule:: {NAME} */ + 20: 20, + + /*! Conditions:: conditions */ + /*! Rule:: , */ + 22: 8, + + /*! Conditions:: conditions */ + /*! Rule:: \* */ + 23: 7, + + /*! Conditions:: options */ + /*! Rule:: {NAME} */ + 33: 20, + + /*! Conditions:: options */ + /*! Rule:: = */ + 34: 18, + + /*! Conditions:: options */ + /*! Rule:: [^\s\r\n]+ */ + 38: 50, + + /*! Conditions:: start_condition */ + /*! Rule:: {ID} */ + 42: 27, + + /*! Conditions:: named_chunk */ + /*! Rule:: {ID} */ + 45: 20, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \| */ + 54: 9, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?: */ + 55: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?= */ + 56: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \(\?! */ + 57: 38, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \( */ + 58: 10, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \) */ + 59: 11, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \+ */ + 60: 12, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \* */ + 61: 7, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \? */ + 62: 13, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \^ */ + 63: 16, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: , */ + 64: 8, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: <> */ + 65: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \\([0-7]{1,3}|[rfntvsSbBwWdD\\*+()${}|[\]\/.^?]|c[A-Z]|x[0-9A-F]{2}|u[a-fA-F0-9]{4}) */ + 69: 44, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \$ */ + 71: 17, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \. */ + 72: 15, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{\d+(,\s*\d+|,)?\} */ + 82: 45, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{{ID}\} */ + 83: 40, + + /*! Conditions:: set options */ + /*! Rule:: \{{ID}\} */ + 84: 40, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \{ */ + 85: 3, + + /*! Conditions:: rules macro named_chunk INITIAL */ + /*! Rule:: \} */ + 86: 4, + + /*! Conditions:: set */ + /*! Rule:: (?:\\\\|\\\]|[^\]{])+ */ + 87: 43, + + /*! Conditions:: set */ + /*! Rule:: \{ */ + 88: 43, + + /*! Conditions:: code */ + /*! Rule:: [^\r\n]*(\r|\n)+ */ + 90: 53, + + /*! Conditions:: * */ + /*! Rule:: $ */ + 108: 1 + }, + + rules: [ + /* 0: */ /^(?:%\{)/, + /* 1: */ new XRegExp('^(?:%\\{([^]*?)%\\})', ''), + /* 2: */ /^(?:%include\b)/, + /* 3: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 4: */ /^(?:([^\S\n\r])*\/\/.*)/, + /* 5: */ /^(?:([^\S\n\r])+)/, + /* 6: */ /^(?:\|)/, + /* 7: */ /^(?:%%)/, + /* 8: */ /^(?:%)/, + /* 9: */ /^(?:\/[^\s\/]*?(?:['"`{}][^\s\/]*?)*\/)/, + /* 10: */ /^(?:\/[^\n\r}]*)/, + /* 11: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 12: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 13: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 14: */ /^(?:[^\s"%'\/`{-}]+)/, + /* 15: */ /^(?:\{)/, + /* 16: */ /^(?:\})/, + /* 17: */ /^(?:(?:(\r\n|\n|\r)([^\S\n\r])+)+(?=[^\s|]))/, + /* 18: */ /^(?:(\r\n|\n|\r))/, + /* 19: */ /^(?:$)/, + /* 20: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' + ), + /* 21: */ /^(?:>)/, + /* 22: */ /^(?:,)/, + /* 23: */ /^(?:\*)/, + /* 24: */ /^(?:([^\S\n\r])*\/\/[^\n\r]*)/, + /* 25: */ new XRegExp('^(?:([^\\S\\n\\r])*\\/\\*[^]*?\\*\\/)', ''), + /* 26: */ /^(?:(\r\n|\n|\r)+)/, + /* 27: */ /^(?:([^\S\n\r])+(\r\n|\n|\r)+)/, + /* 28: */ /^(?:\/\/[^\r\n]*)/, + /* 29: */ new XRegExp('^(?:\\/\\*[^]*?\\*\\/)', ''), + /* 30: */ /^(?:([^\S\n\r])+(?=[^\s%|]))/, + /* 31: */ /^(?:%%)/, + /* 32: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 33: */ new XRegExp( + '^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?))', + '' + ), + /* 34: */ /^(?:=)/, + /* 35: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 36: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 37: */ /^(?:`((?:\\`|\\[^`]|[^\\`])*)`)/, + /* 38: */ /^(?:\S+)/, + /* 39: */ /^(?:(\r\n|\n|\r)([^\S\n\r])+(?=\S))/, + /* 40: */ /^(?:(\r\n|\n|\r))/, + /* 41: */ /^(?:([^\S\n\r])+)/, + /* 42: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 43: */ /^(?:(\r\n|\n|\r)+)/, + /* 44: */ /^(?:([^\S\n\r])+)/, + /* 45: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 46: */ new XRegExp('^(?:([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*))', ''), + /* 47: */ /^(?:(\r\n|\n|\r)+)/, + /* 48: */ /^(?:([^\s!"$%'-,.\/:-?\[-\^{-}])+)/, + /* 49: */ /^(?:(\r\n|\n|\r)+)/, + /* 50: */ /^(?:\s+)/, + /* 51: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 52: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 53: */ /^(?:\[)/, + /* 54: */ /^(?:\|)/, + /* 55: */ /^(?:\(\?:)/, + /* 56: */ /^(?:\(\?=)/, + /* 57: */ /^(?:\(\?!)/, + /* 58: */ /^(?:\()/, + /* 59: */ /^(?:\))/, + /* 60: */ /^(?:\+)/, + /* 61: */ /^(?:\*)/, + /* 62: */ /^(?:\?)/, + /* 63: */ /^(?:\^)/, + /* 64: */ /^(?:,)/, + /* 65: */ /^(?:<>)/, + /* 66: */ /^(?:<)/, + /* 67: */ /^(?:\/!)/, + /* 68: */ /^(?:\/)/, + /* 69: */ /^(?:\\([0-7]{1,3}|[$(-+.\/?BDSW\[-\^bdfnr-tvw{-}]|c[A-Z]|x[\dA-F]{2}|u[\dA-Fa-f]{4}))/, + /* 70: */ /^(?:\\.)/, + /* 71: */ /^(?:\$)/, + /* 72: */ /^(?:\.)/, + /* 73: */ /^(?:%options\b)/, + /* 74: */ /^(?:%s\b)/, + /* 75: */ /^(?:%x\b)/, + /* 76: */ /^(?:%code\b)/, + /* 77: */ /^(?:%import\b)/, + /* 78: */ /^(?:%include\b)/, + /* 79: */ /^(?:%include\b)/, + /* 80: */ new XRegExp( + '^(?:%([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}\\-_]*(?:[\\p{Alphabetic}\\p{Number}_]))?)([^\\n\\r]*))', + '' + ), + /* 81: */ /^(?:%%)/, + /* 82: */ /^(?:\{\d+(,\s*\d+|,)?\})/, + /* 83: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 84: */ new XRegExp('^(?:\\{([\\p{Alphabetic}_](?:[\\p{Alphabetic}\\p{Number}_])*)\\})', ''), + /* 85: */ /^(?:\{)/, + /* 86: */ /^(?:\})/, + /* 87: */ /^(?:(?:\\\\|\\\]|[^\]{])+)/, + /* 88: */ /^(?:\{)/, + /* 89: */ /^(?:\])/, + /* 90: */ /^(?:[^\r\n]*(\r|\n)+)/, + /* 91: */ /^(?:[^\r\n]+)/, + /* 92: */ /^(?:(\r\n|\n|\r))/, + /* 93: */ /^(?:"((?:\\"|\\[^"]|[^\n\r"\\])*)")/, + /* 94: */ /^(?:'((?:\\'|\\[^']|[^\n\r'\\])*)')/, + /* 95: */ /^(?:([^\S\n\r])+)/, + /* 96: */ /^(?:\S+)/, + /* 97: */ /^(?:")/, + /* 98: */ /^(?:')/, + /* 99: */ /^(?:`)/, + /* 100: */ /^(?:")/, + /* 101: */ /^(?:')/, + /* 102: */ /^(?:`)/, + /* 103: */ /^(?:")/, + /* 104: */ /^(?:')/, + /* 105: */ /^(?:`)/, + /* 106: */ /^(?:.)/, + /* 107: */ /^(?:.)/, + /* 108: */ /^(?:$)/ + ], + + conditions: { + 'rules': { + rules: [ + 0, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 80, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 106, + 107, + 108 + ], + + inclusive: true + }, + + 'macro': { + rules: [ + 0, + 24, + 25, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 106, + 107, + 108 + ], + + inclusive: true + }, + + 'named_chunk': { + rules: [ + 0, + 45, + 47, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: true + }, + + 'code': { + rules: [79, 80, 90, 91, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'start_condition': { + rules: [24, 25, 42, 43, 44, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'options': { + rules: [ + 24, + 25, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 84, + 100, + 101, + 102, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: false + }, + + 'conditions': { + rules: [20, 21, 22, 23, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'action': { + rules: [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 97, + 98, + 99, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: false + }, + + 'path': { + rules: [24, 25, 92, 93, 94, 95, 96, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'set': { + rules: [84, 87, 88, 89, 103, 104, 105, 107, 108], + inclusive: false + }, + + 'INITIAL': { + rules: [ + 0, + 24, + 25, + 46, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 80, + 81, + 82, + 83, + 85, + 86, + 103, + 104, + 105, + 107, + 108 + ], + + inclusive: true + } + } + }; + + var rmCommonWS = helpers.rmCommonWS; + var dquote = helpers.dquote; + + function unescQuote(str) { + str = '' + str; + var a = str.split('\\\\'); + + a = a.map(function(s) { + return s.replace(/\\'/g, '\'').replace(/\\"/g, '"'); + }); + + str = a.join('\\\\'); + return str; + } + + lexer.warn = function l_warn() { + if (this.yy && this.yy.parser && typeof this.yy.parser.warn === 'function') { + return this.yy.parser.warn.apply(this, arguments); + } else { + console.warn.apply(console, arguments); + } + }; + + lexer.log = function l_log() { + if (this.yy && this.yy.parser && typeof this.yy.parser.log === 'function') { + return this.yy.parser.log.apply(this, arguments); + } else { + console.log.apply(console, arguments); + } + }; + + return lexer; +}(); +parser.lexer = lexer; + +function Parser() { + this.yy = {}; +} +Parser.prototype = parser; +parser.Parser = Parser; + +function yyparse() { + return parser.parse.apply(parser, arguments); +} + +exports.parser = parser; +exports.Parser = Parser; +exports.parse = yyparse; + +Object.defineProperty(exports, '__esModule', { value: true }); + +}))); From 04c0513e88b6cc22be1f6c5e5380928384949165 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 13 Oct 2017 01:20:07 +0200 Subject: [PATCH 391/417] `make clean` should also nuke the dist directory; rebuilt library files --- Makefile | 1 + dist/lex-parser-cjs-es5.js | 2 +- dist/lex-parser-cjs.js | 2 +- dist/lex-parser-es6.js | 2 +- dist/lex-parser-umd-es5.js | 2 +- dist/lex-parser-umd.js | 2 +- lex-parser.js | 2 +- lex.y | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 372d767..16fde87 100644 --- a/Makefile +++ b/Makefile @@ -59,6 +59,7 @@ publish: clean: -rm -f lex-parser.js + -rm -rf dist/ -rm -rf node_modules/ -rm -f package-lock.json diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js index 17828ef..778f9d1 100644 --- a/dist/lex-parser-cjs-es5.js +++ b/dist/lex-parser-cjs-es5.js @@ -473,7 +473,7 @@ if (typeof Object.setPrototypeOf === 'function') { JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; +// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer // import helpers from 'jison-helpers-lib'; // import fs from 'fs'; diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js index 52afe78..37c52a6 100644 --- a/dist/lex-parser-cjs.js +++ b/dist/lex-parser-cjs.js @@ -443,7 +443,7 @@ JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; +// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer // import helpers from 'jison-helpers-lib'; // import fs from 'fs'; diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 3d80cf5..252df76 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -437,7 +437,7 @@ JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; +// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer // import helpers from 'jison-helpers-lib'; // import fs from 'fs'; diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js index 0bed292..05ccaca 100644 --- a/dist/lex-parser-umd-es5.js +++ b/dist/lex-parser-umd-es5.js @@ -472,7 +472,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; - // import XRegExp from '@gerhobbelt/xregexp'; + // import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer // import helpers from 'jison-helpers-lib'; // import fs from 'fs'; diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js index 7da8651..f56cf78 100644 --- a/dist/lex-parser-umd.js +++ b/dist/lex-parser-umd.js @@ -443,7 +443,7 @@ JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; +// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer // import helpers from 'jison-helpers-lib'; // import fs from 'fs'; diff --git a/lex-parser.js b/lex-parser.js index 67f49a2..4944bdc 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -439,7 +439,7 @@ JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; +// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer // import helpers from 'jison-helpers-lib'; // import fs from 'fs'; diff --git a/lex.y b/lex.y index 374c8ea..0a20673 100644 --- a/lex.y +++ b/lex.y @@ -1,6 +1,6 @@ %code imports %{ -// import XRegExp from '@gerhobbelt/xregexp'; +// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer // import helpers from 'jison-helpers-lib'; // import fs from 'fs'; %} From 453d898526453ab65048541ef81105231f563eb8 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 13 Oct 2017 05:21:13 +0200 Subject: [PATCH 392/417] tweak export style to suit JISON --- lex-parser.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 4944bdc..780d283 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -7818,10 +7818,9 @@ function yyparse() { return parser.parse.apply(parser, arguments); } -export { +export default { parser, Parser, - yyparse as parse, - + parse: yyparse, }; From f3453a766f76e47650edc2ab9fac11fd655cc3a1 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 13 Oct 2017 05:21:30 +0200 Subject: [PATCH 393/417] regenerated library files --- dist/lex-parser-es6.js | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 252df76..2aeed36 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -1,4 +1,6 @@ + import fs from 'fs'; + import XRegExp from '@gerhobbelt/xregexp'; import helpers from 'jison-helpers-lib'; @@ -3829,8 +3831,10 @@ parse: function parse(input) { } // - detect if an epsilon rule is being processed and act accordingly: + var start_with_epsilon = false; if (!l1 && first_index == null) { // epsilon rule span merger. With optional look-ahead in l2. + start_with_epsilon = true; if (!dont_look_back) { for (var i = (i1 || sp) - 1; i >= 0; i--) { l1 = lstack[i]; @@ -5444,6 +5448,9 @@ var lexer = function() { * @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + var rv; + + // prevent lingering circular references from causing memory leaks: this.setInput('', {}); // nuke the error hash info instances created during this run. @@ -5943,6 +5950,7 @@ var lexer = function() { * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { + var error_size = loc.last_line - loc.first_line; const CONTEXT = 3; const CONTEXT_TAIL = 1; const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; @@ -6459,6 +6467,8 @@ var lexer = function() { performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { var yy_ = this; + var YYSTATE = YY_START; + switch (yyrulenumber) { case 0: /*! Conditions:: rules macro named_chunk INITIAL */ @@ -7756,6 +7766,13 @@ var lexer = function() { var rmCommonWS = helpers.rmCommonWS; var dquote = helpers.dquote; + function indent(s, i) { + var a = s.split('\n'); + var pf = new Array(i + 1).join(' '); + return pf + a.join('\n' + pf); + } + + // unescape a string value which is wrapped in quotes/doublequotes function unescQuote(str) { str = '' + str; var a = str.split('\\\\'); @@ -7798,4 +7815,9 @@ function yyparse() { return parser.parse.apply(parser, arguments); } -export { parser, Parser, yyparse as parse }; +export default { + parser, + Parser, + parse: yyparse, +}; + From 7eaf10fdb05505601821795370b48744e7e804a3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 13 Oct 2017 06:06:35 +0200 Subject: [PATCH 394/417] correctly point at parent development JISON's CLI interface again. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 16fde87..57bfa25 100644 --- a/Makefile +++ b/Makefile @@ -1,10 +1,10 @@ -JISON_VERSION := $(shell node ../../lib/cli.js -V 2> /dev/null ) +JISON_VERSION := $(shell node ../../dist/cli-cjs-es5.js -V 2> /dev/null ) ifndef JISON_VERSION JISON = sh node_modules/.bin/jison else - JISON = node ../../lib/cli.js + JISON = node ../../dist/cli-cjs-es5.js endif ROLLUP = node_modules/.bin/rollup From 5c52a503834553de4a2b01521f4744f0b931fe53 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 13 Oct 2017 06:07:28 +0200 Subject: [PATCH 395/417] regenerate library files; all tests pass. --- dist/lex-parser-cjs-es5.js | 28 ++-- dist/lex-parser-cjs.js | 288 +++++++++++++++++----------------- dist/lex-parser-es6.js | 310 +++++++++++++++++-------------------- dist/lex-parser-umd-es5.js | 28 ++-- dist/lex-parser-umd.js | 288 +++++++++++++++++----------------- lex-parser.js | 297 ++++++++++++++++++----------------- 6 files changed, 614 insertions(+), 625 deletions(-) diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js index 778f9d1..009a9d5 100644 --- a/dist/lex-parser-cjs-es5.js +++ b/dist/lex-parser-cjs-es5.js @@ -1,6 +1,6 @@ 'use strict'; -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), _templateObject2 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), @@ -34,7 +34,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi Object.defineProperty(exports, '__esModule', { value: true }); function _interopDefault(ex) { - return ex && (typeof ex === 'undefined' ? 'undefined' : _typeof(ex)) === 'object' && 'default' in ex ? ex['default'] : ex; + return ex && (typeof ex === 'undefined' ? 'undefined' : _typeof2(ex)) === 'object' && 'default' in ex ? ex['default'] : ex; } var fs = _interopDefault(require('fs')); @@ -2027,15 +2027,18 @@ var parser = { pre_parse: undefined, post_parse: undefined, pre_lex: undefined, - post_lex: undefined + post_lex: undefined // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes! }; + var ASSERT; if (typeof assert !== 'function') { - assert = function JisonAssert(cond, msg) { + ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; + } else { + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { @@ -2050,7 +2053,7 @@ var parser = { // e.g. `lexer.yytext` MAY be a complex value object, // rather than a simple string/value. function shallow_copy(src) { - if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) === 'object') { + if ((typeof src === 'undefined' ? 'undefined' : _typeof2(src)) === 'object') { var dst = {}; for (var k in src) { if (Object.prototype.hasOwnProperty.call(src, k)) { @@ -2409,7 +2412,7 @@ var parser = { // ... var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { + if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof2(key)) === 'object') { this[key] = undefined; } } @@ -2710,7 +2713,7 @@ var parser = { // try to recover from error if (error_rule_depth < 0) { - assert(recovering > 0); + ASSERT(recovering > 0); recoveringErrorInfo.info_stack_pointer = esp; // barf a fatal hairball when we're out of look-ahead symbols and none hit a match @@ -2809,8 +2812,8 @@ var parser = { // *or* we execute a `reduce` action which outputs a final parse // result (yes, that MAY happen!)... - assert(recoveringErrorInfo); - assert(symbol === TERROR); + ASSERT(recoveringErrorInfo); + ASSERT(symbol === TERROR); while (symbol) { // retrieve state number from top of stack state = newState; // sstack[sp - 1]; @@ -2856,7 +2859,7 @@ var parser = { case 1: stack[sp] = symbol; //vstack[sp] = lexer.yytext; - assert(recoveringErrorInfo); + ASSERT(recoveringErrorInfo); vstack[sp] = recoveringErrorInfo; //lstack[sp] = copy_yylloc(lexer.yylloc); lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); @@ -3009,7 +3012,7 @@ var parser = { ++sp; symbol = 0; - assert(preErrorSymbol === 0); + ASSERT(preErrorSymbol === 0); if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: @@ -3220,7 +3223,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-194*/ +/* lexer generated by jison-lex 0.6.0-196*/ /* * Returns a Lexer object of the following structure: @@ -3679,6 +3682,7 @@ var lexer = function () { * @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + // prevent lingering circular references from causing memory leaks: this.setInput('', {}); // nuke the error hash info instances created during this run. diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js index 37c52a6..46db0fd 100644 --- a/dist/lex-parser-cjs.js +++ b/dist/lex-parser-cjs.js @@ -419,10 +419,11 @@ function JisonParserError(msg, hash) { stacktrace = ex2.stack; } if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { // V8 + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 Error.captureStackTrace(this, this.constructor); } else { - stacktrace = (new Error(msg)).stack; + stacktrace = new Error(msg).stack; } } if (stacktrace) { @@ -448,111 +449,111 @@ JisonParserError.prototype.name = 'JisonParserError'; // import fs from 'fs'; -// helper: reconstruct the productions[] table -function bp(s) { - var rv = []; - var p = s.pop; - var r = s.rule; - for (var i = 0, l = p.length; i < l; i++) { - rv.push([ - p[i], - r[i] - ]); - } - return rv; -} - - + // helper: reconstruct the productions[] table + function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); + } + return rv; + } + -// helper: reconstruct the defaultActions[] table -function bda(s) { - var rv = {}; - var d = s.idx; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var j = d[i]; - rv[j] = g[i]; - } - return rv; -} + // helper: reconstruct the defaultActions[] table + function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; + } + -// helper: reconstruct the 'goto' table -function bt(s) { - var rv = []; - var d = s.len; - var y = s.symbol; - var t = s.type; - var a = s.state; - var m = s.mode; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var n = d[i]; - var q = {}; - for (var j = 0; j < n; j++) { - var z = y.shift(); - switch (t.shift()) { - case 2: - q[z] = [ - m.shift(), - g.shift() - ]; - break; + // helper: reconstruct the 'goto' table + function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; - case 0: - q[z] = a.shift(); - break; + case 0: + q[z] = a.shift(); + break; - default: - // type === 1: accept - q[z] = [ - 3 - ]; + default: + // type === 1: accept + q[z] = [ + 3 + ]; + } + } + rv.push(q); } + return rv; } - rv.push(q); - } - return rv; -} - - + -// helper: runlength encoding with increment step: code, length: step (default step = 0) -// `this` references an array -function s(c, l, a) { - a = a || 0; - for (var i = 0; i < l; i++) { - this.push(c); - c += a; - } -} -// helper: duplicate sequence from *relative* offset and length. -// `this` references an array -function c(i, l) { - i = this.length - i; - for (l += i; i < l; i++) { - this.push(this[i]); - } -} + // helper: runlength encoding with increment step: code, length: step (default step = 0) + // `this` references an array + function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } + } -// helper: unpack an array using helpers and data, all passed in an array argument 'a'. -function u(a) { - var rv = []; - for (var i = 0, l = a.length; i < l; i++) { - var e = a[i]; - // Is this entry a helper function? - if (typeof e === 'function') { - i++; - e.apply(rv, a[i]); - } else { - rv.push(e); + // helper: duplicate sequence from *relative* offset and length. + // `this` references an array + function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } } - } - return rv; -} + // helper: unpack an array using helpers and data, all passed in an array argument 'a'. + function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; + } + var parser = { // Code Generator Information Report @@ -607,7 +608,7 @@ var parser = { // // --------- END OF REPORT ----------- -trace: function no_op_trace() { }, +trace: function no_op_trace() {}, JisonParserError: JisonParserError, yy: {}, options: { @@ -775,9 +776,9 @@ cleanupAfterParse: null, constructParseErrorInfo: null, yyMergeLocationInfo: null, -__reentrant_call_depth: 0, // INTERNAL USE ONLY -__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup -__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__reentrant_call_depth: 0, // INTERNAL USE ONLY +__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup // APIs which will be set up depending on user action code analysis: //yyRecovering: 0, @@ -800,7 +801,7 @@ getSymbolName: function parser_getSymbolName(symbol) { if (this.terminals_[symbol]) { return this.terminals_[symbol]; } - + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. // // An example of this may be where a rule's action code contains a call like this: @@ -824,8 +825,7 @@ getSymbolName: function parser_getSymbolName(symbol) { describeSymbol: function parser_describeSymbol(symbol) { if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { return this.terminal_descriptions_[symbol]; - } - else if (symbol === this.EOF) { + } else if (symbol === this.EOF) { return 'end of input'; } var id = this.getSymbolName(symbol); @@ -850,9 +850,7 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do // Has this (error?) state been outfitted with a custom expectations description text for human consumption? // If so, use that one instead of the less palatable token set. if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { - return [ - this.state_descriptions_[state] - ]; + return [this.state_descriptions_[state]]; } for (var p in this.table[state]) { p = +p; @@ -860,7 +858,7 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do var d = do_not_describe ? p : this.describeSymbol(p); if (d && !check[d]) { tokenset.push(d); - check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. } } } @@ -3508,7 +3506,7 @@ defaultActions: bda({ parseError: function parseError(str, hash, ExceptionClass) { if (hash.recoverable && typeof this.trace === 'function') { this.trace(str); - hash.destroy(); // destroy... well, *almost*! + hash.destroy(); // destroy... well, *almost*! } else { if (!ExceptionClass) { ExceptionClass = this.JisonParserError; @@ -3552,15 +3550,18 @@ parse: function parse(input) { pre_parse: undefined, post_parse: undefined, pre_lex: undefined, - post_lex: undefined + post_lex: undefined // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes! }; + var ASSERT; if (typeof assert !== 'function') { - assert = function JisonAssert(cond, msg) { + ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; + } else { + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { @@ -4321,7 +4322,7 @@ parse: function parse(input) { yyloc = lexer.yylloc; - preErrorSymbol = 0; + preErrorSymbol = 0; symbol = lex(); @@ -4336,7 +4337,7 @@ parse: function parse(input) { // try to recover from error if (error_rule_depth < 0) { - assert(recovering > 0); + ASSERT(recovering > 0); recoveringErrorInfo.info_stack_pointer = esp; // barf a fatal hairball when we're out of look-ahead symbols and none hit a match @@ -4461,8 +4462,8 @@ parse: function parse(input) { // *or* we execute a `reduce` action which outputs a final parse // result (yes, that MAY happen!)... - assert(recoveringErrorInfo); - assert(symbol === TERROR); + ASSERT(recoveringErrorInfo); + ASSERT(symbol === TERROR); while (symbol) { // retrieve state number from top of stack state = newState; // sstack[sp - 1]; @@ -4526,7 +4527,7 @@ parse: function parse(input) { case 1: stack[sp] = symbol; //vstack[sp] = lexer.yytext; - assert(recoveringErrorInfo); + ASSERT(recoveringErrorInfo); vstack[sp] = recoveringErrorInfo; //lstack[sp] = copy_yylloc(lexer.yylloc); lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); @@ -4731,7 +4732,7 @@ parse: function parse(input) { ++sp; symbol = 0; - assert(preErrorSymbol === 0); + ASSERT(preErrorSymbol === 0); if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: @@ -4986,7 +4987,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-194*/ +/* lexer generated by jison-lex 0.6.0-196*/ /* * Returns a Lexer object of the following structure: @@ -5315,24 +5316,24 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state - - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: '', /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -5345,7 +5346,7 @@ var lexer = function() { var pei = { errStr: msg, recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -5372,7 +5373,7 @@ var lexer = function() { var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && typeof key === 'object') { + if (this.hasOwnProperty(key) && ((typeof key === 'undefined' ? 'undefined' : _typeof(key))) === 'object') { this[key] = undefined; } } @@ -5450,6 +5451,7 @@ var lexer = function() { * @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + // prevent lingering circular references from causing memory leaks: this.setInput('', {}); // nuke the error hash info instances created during this run. @@ -5529,7 +5531,7 @@ var lexer = function() { var spec = conditions[k]; var rule_ids = spec.rules; var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -5807,7 +5809,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! + maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5863,7 +5865,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! + maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5871,7 +5873,7 @@ var lexer = function() { // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } // now that we have a significantly reduced string to process, transform the newlines @@ -5949,9 +5951,9 @@ var lexer = function() { * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { - const CONTEXT = 3; - const CONTEXT_TAIL = 1; - const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var CONTEXT = 3; + var CONTEXT_TAIL = 1; + var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; var lines = input.split('\n'); @@ -6021,7 +6023,7 @@ var lexer = function() { end: clip_end, len: clip_end - clip_start + 1, arr: nonempty_line_indexes, - rv + rv: rv }); var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 2aeed36..0f20d51 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -1,6 +1,4 @@ - import fs from 'fs'; - import XRegExp from '@gerhobbelt/xregexp'; import helpers from 'jison-helpers-lib'; @@ -415,10 +413,11 @@ function JisonParserError(msg, hash) { stacktrace = ex2.stack; } if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { // V8 + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 Error.captureStackTrace(this, this.constructor); } else { - stacktrace = (new Error(msg)).stack; + stacktrace = new Error(msg).stack; } } if (stacktrace) { @@ -444,111 +443,111 @@ JisonParserError.prototype.name = 'JisonParserError'; // import fs from 'fs'; -// helper: reconstruct the productions[] table -function bp(s) { - var rv = []; - var p = s.pop; - var r = s.rule; - for (var i = 0, l = p.length; i < l; i++) { - rv.push([ - p[i], - r[i] - ]); - } - return rv; -} - - + // helper: reconstruct the productions[] table + function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); + } + return rv; + } + -// helper: reconstruct the defaultActions[] table -function bda(s) { - var rv = {}; - var d = s.idx; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var j = d[i]; - rv[j] = g[i]; - } - return rv; -} + // helper: reconstruct the defaultActions[] table + function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; + } + -// helper: reconstruct the 'goto' table -function bt(s) { - var rv = []; - var d = s.len; - var y = s.symbol; - var t = s.type; - var a = s.state; - var m = s.mode; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var n = d[i]; - var q = {}; - for (var j = 0; j < n; j++) { - var z = y.shift(); - switch (t.shift()) { - case 2: - q[z] = [ - m.shift(), - g.shift() - ]; - break; + // helper: reconstruct the 'goto' table + function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; - case 0: - q[z] = a.shift(); - break; + case 0: + q[z] = a.shift(); + break; - default: - // type === 1: accept - q[z] = [ - 3 - ]; + default: + // type === 1: accept + q[z] = [ + 3 + ]; + } + } + rv.push(q); } + return rv; } - rv.push(q); - } - return rv; -} - - + -// helper: runlength encoding with increment step: code, length: step (default step = 0) -// `this` references an array -function s(c, l, a) { - a = a || 0; - for (var i = 0; i < l; i++) { - this.push(c); - c += a; - } -} -// helper: duplicate sequence from *relative* offset and length. -// `this` references an array -function c(i, l) { - i = this.length - i; - for (l += i; i < l; i++) { - this.push(this[i]); - } -} + // helper: runlength encoding with increment step: code, length: step (default step = 0) + // `this` references an array + function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } + } -// helper: unpack an array using helpers and data, all passed in an array argument 'a'. -function u(a) { - var rv = []; - for (var i = 0, l = a.length; i < l; i++) { - var e = a[i]; - // Is this entry a helper function? - if (typeof e === 'function') { - i++; - e.apply(rv, a[i]); - } else { - rv.push(e); + // helper: duplicate sequence from *relative* offset and length. + // `this` references an array + function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } } - } - return rv; -} + // helper: unpack an array using helpers and data, all passed in an array argument 'a'. + function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; + } + var parser = { // Code Generator Information Report @@ -603,7 +602,7 @@ var parser = { // // --------- END OF REPORT ----------- -trace: function no_op_trace() { }, +trace: function no_op_trace() {}, JisonParserError: JisonParserError, yy: {}, options: { @@ -771,9 +770,9 @@ cleanupAfterParse: null, constructParseErrorInfo: null, yyMergeLocationInfo: null, -__reentrant_call_depth: 0, // INTERNAL USE ONLY -__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup -__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__reentrant_call_depth: 0, // INTERNAL USE ONLY +__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup // APIs which will be set up depending on user action code analysis: //yyRecovering: 0, @@ -796,7 +795,7 @@ getSymbolName: function parser_getSymbolName(symbol) { if (this.terminals_[symbol]) { return this.terminals_[symbol]; } - + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. // // An example of this may be where a rule's action code contains a call like this: @@ -820,8 +819,7 @@ getSymbolName: function parser_getSymbolName(symbol) { describeSymbol: function parser_describeSymbol(symbol) { if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { return this.terminal_descriptions_[symbol]; - } - else if (symbol === this.EOF) { + } else if (symbol === this.EOF) { return 'end of input'; } var id = this.getSymbolName(symbol); @@ -846,9 +844,7 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do // Has this (error?) state been outfitted with a custom expectations description text for human consumption? // If so, use that one instead of the less palatable token set. if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { - return [ - this.state_descriptions_[state] - ]; + return [this.state_descriptions_[state]]; } for (var p in this.table[state]) { p = +p; @@ -856,7 +852,7 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do var d = do_not_describe ? p : this.describeSymbol(p); if (d && !check[d]) { tokenset.push(d); - check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. } } } @@ -3504,7 +3500,7 @@ defaultActions: bda({ parseError: function parseError(str, hash, ExceptionClass) { if (hash.recoverable && typeof this.trace === 'function') { this.trace(str); - hash.destroy(); // destroy... well, *almost*! + hash.destroy(); // destroy... well, *almost*! } else { if (!ExceptionClass) { ExceptionClass = this.JisonParserError; @@ -3548,15 +3544,18 @@ parse: function parse(input) { pre_parse: undefined, post_parse: undefined, pre_lex: undefined, - post_lex: undefined + post_lex: undefined // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes! }; + var ASSERT; if (typeof assert !== 'function') { - assert = function JisonAssert(cond, msg) { + ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; + } else { + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { @@ -3831,10 +3830,8 @@ parse: function parse(input) { } // - detect if an epsilon rule is being processed and act accordingly: - var start_with_epsilon = false; if (!l1 && first_index == null) { // epsilon rule span merger. With optional look-ahead in l2. - start_with_epsilon = true; if (!dont_look_back) { for (var i = (i1 || sp) - 1; i >= 0; i--) { l1 = lstack[i]; @@ -4319,7 +4316,7 @@ parse: function parse(input) { yyloc = lexer.yylloc; - preErrorSymbol = 0; + preErrorSymbol = 0; symbol = lex(); @@ -4334,7 +4331,7 @@ parse: function parse(input) { // try to recover from error if (error_rule_depth < 0) { - assert(recovering > 0); + ASSERT(recovering > 0); recoveringErrorInfo.info_stack_pointer = esp; // barf a fatal hairball when we're out of look-ahead symbols and none hit a match @@ -4459,8 +4456,8 @@ parse: function parse(input) { // *or* we execute a `reduce` action which outputs a final parse // result (yes, that MAY happen!)... - assert(recoveringErrorInfo); - assert(symbol === TERROR); + ASSERT(recoveringErrorInfo); + ASSERT(symbol === TERROR); while (symbol) { // retrieve state number from top of stack state = newState; // sstack[sp - 1]; @@ -4524,7 +4521,7 @@ parse: function parse(input) { case 1: stack[sp] = symbol; //vstack[sp] = lexer.yytext; - assert(recoveringErrorInfo); + ASSERT(recoveringErrorInfo); vstack[sp] = recoveringErrorInfo; //lstack[sp] = copy_yylloc(lexer.yylloc); lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); @@ -4729,7 +4726,7 @@ parse: function parse(input) { ++sp; symbol = 0; - assert(preErrorSymbol === 0); + ASSERT(preErrorSymbol === 0); if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: @@ -4984,7 +4981,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-194*/ +/* lexer generated by jison-lex 0.6.0-196*/ /* * Returns a Lexer object of the following structure: @@ -5313,24 +5310,24 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state - - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: '', /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -5343,7 +5340,7 @@ var lexer = function() { var pei = { errStr: msg, recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -5370,7 +5367,7 @@ var lexer = function() { var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && typeof key === 'object') { + if (this.hasOwnProperty(key) && ((typeof key === 'undefined' ? 'undefined' : _typeof(key))) === 'object') { this[key] = undefined; } } @@ -5448,8 +5445,6 @@ var lexer = function() { * @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { - var rv; - // prevent lingering circular references from causing memory leaks: this.setInput('', {}); @@ -5530,7 +5525,7 @@ var lexer = function() { var spec = conditions[k]; var rule_ids = spec.rules; var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -5808,7 +5803,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! + maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5864,7 +5859,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! + maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5872,7 +5867,7 @@ var lexer = function() { // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } // now that we have a significantly reduced string to process, transform the newlines @@ -5950,10 +5945,9 @@ var lexer = function() { * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { - var error_size = loc.last_line - loc.first_line; - const CONTEXT = 3; - const CONTEXT_TAIL = 1; - const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var CONTEXT = 3; + var CONTEXT_TAIL = 1; + var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; var lines = input.split('\n'); @@ -6023,7 +6017,7 @@ var lexer = function() { end: clip_end, len: clip_end - clip_start + 1, arr: nonempty_line_indexes, - rv + rv: rv }); var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; @@ -6467,8 +6461,6 @@ var lexer = function() { performAction: function lexer__performAction(yy, yyrulenumber, YY_START) { var yy_ = this; - var YYSTATE = YY_START; - switch (yyrulenumber) { case 0: /*! Conditions:: rules macro named_chunk INITIAL */ @@ -7766,13 +7758,6 @@ var lexer = function() { var rmCommonWS = helpers.rmCommonWS; var dquote = helpers.dquote; - function indent(s, i) { - var a = s.split('\n'); - var pf = new Array(i + 1).join(' '); - return pf + a.join('\n' + pf); - } - - // unescape a string value which is wrapped in quotes/doublequotes function unescQuote(str) { str = '' + str; var a = str.split('\\\\'); @@ -7815,9 +7800,4 @@ function yyparse() { return parser.parse.apply(parser, arguments); } -export default { - parser, - Parser, - parse: yyparse, -}; - +export { parser, Parser, yyparse as parse }; diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js index 05ccaca..8012fa5 100644 --- a/dist/lex-parser-umd-es5.js +++ b/dist/lex-parser-umd-es5.js @@ -1,6 +1,6 @@ 'use strict'; -var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), _templateObject2 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), @@ -32,7 +32,7 @@ var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not corre function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } (function (global, factory) { - (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs'), require('@gerhobbelt/xregexp'), require('jison-helpers-lib')) : typeof define === 'function' && define.amd ? define(['exports', 'fs', '@gerhobbelt/xregexp', 'jison-helpers-lib'], factory) : factory(global['lex-parser'] = {}, global.fs, global.XRegExp, global.helpers); + (typeof exports === 'undefined' ? 'undefined' : _typeof2(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs'), require('@gerhobbelt/xregexp'), require('jison-helpers-lib')) : typeof define === 'function' && define.amd ? define(['exports', 'fs', '@gerhobbelt/xregexp', 'jison-helpers-lib'], factory) : factory(global['lex-parser'] = {}, global.fs, global.XRegExp, global.helpers); })(undefined, function (exports, fs, XRegExp, helpers) { 'use strict'; @@ -2026,15 +2026,18 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi pre_parse: undefined, post_parse: undefined, pre_lex: undefined, - post_lex: undefined + post_lex: undefined // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes! }; + var ASSERT; if (typeof assert !== 'function') { - assert = function JisonAssert(cond, msg) { + ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; + } else { + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { @@ -2049,7 +2052,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // e.g. `lexer.yytext` MAY be a complex value object, // rather than a simple string/value. function shallow_copy(src) { - if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) === 'object') { + if ((typeof src === 'undefined' ? 'undefined' : _typeof2(src)) === 'object') { var dst = {}; for (var k in src) { if (Object.prototype.hasOwnProperty.call(src, k)) { @@ -2408,7 +2411,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // ... var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { + if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof2(key)) === 'object') { this[key] = undefined; } } @@ -2709,7 +2712,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // try to recover from error if (error_rule_depth < 0) { - assert(recovering > 0); + ASSERT(recovering > 0); recoveringErrorInfo.info_stack_pointer = esp; // barf a fatal hairball when we're out of look-ahead symbols and none hit a match @@ -2808,8 +2811,8 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // *or* we execute a `reduce` action which outputs a final parse // result (yes, that MAY happen!)... - assert(recoveringErrorInfo); - assert(symbol === TERROR); + ASSERT(recoveringErrorInfo); + ASSERT(symbol === TERROR); while (symbol) { // retrieve state number from top of stack state = newState; // sstack[sp - 1]; @@ -2855,7 +2858,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 1: stack[sp] = symbol; //vstack[sp] = lexer.yytext; - assert(recoveringErrorInfo); + ASSERT(recoveringErrorInfo); vstack[sp] = recoveringErrorInfo; //lstack[sp] = copy_yylloc(lexer.yylloc); lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); @@ -3008,7 +3011,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi ++sp; symbol = 0; - assert(preErrorSymbol === 0); + ASSERT(preErrorSymbol === 0); if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: @@ -3219,7 +3222,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; - /* lexer generated by jison-lex 0.6.0-194*/ + /* lexer generated by jison-lex 0.6.0-196*/ /* * Returns a Lexer object of the following structure: @@ -3678,6 +3681,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi * @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + // prevent lingering circular references from causing memory leaks: this.setInput('', {}); // nuke the error hash info instances created during this run. diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js index f56cf78..de5d955 100644 --- a/dist/lex-parser-umd.js +++ b/dist/lex-parser-umd.js @@ -419,10 +419,11 @@ function JisonParserError(msg, hash) { stacktrace = ex2.stack; } if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { // V8 + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 Error.captureStackTrace(this, this.constructor); } else { - stacktrace = (new Error(msg)).stack; + stacktrace = new Error(msg).stack; } } if (stacktrace) { @@ -448,111 +449,111 @@ JisonParserError.prototype.name = 'JisonParserError'; // import fs from 'fs'; -// helper: reconstruct the productions[] table -function bp(s) { - var rv = []; - var p = s.pop; - var r = s.rule; - for (var i = 0, l = p.length; i < l; i++) { - rv.push([ - p[i], - r[i] - ]); - } - return rv; -} - - + // helper: reconstruct the productions[] table + function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); + } + return rv; + } + -// helper: reconstruct the defaultActions[] table -function bda(s) { - var rv = {}; - var d = s.idx; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var j = d[i]; - rv[j] = g[i]; - } - return rv; -} + // helper: reconstruct the defaultActions[] table + function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; + } + -// helper: reconstruct the 'goto' table -function bt(s) { - var rv = []; - var d = s.len; - var y = s.symbol; - var t = s.type; - var a = s.state; - var m = s.mode; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var n = d[i]; - var q = {}; - for (var j = 0; j < n; j++) { - var z = y.shift(); - switch (t.shift()) { - case 2: - q[z] = [ - m.shift(), - g.shift() - ]; - break; + // helper: reconstruct the 'goto' table + function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; - case 0: - q[z] = a.shift(); - break; + case 0: + q[z] = a.shift(); + break; - default: - // type === 1: accept - q[z] = [ - 3 - ]; + default: + // type === 1: accept + q[z] = [ + 3 + ]; + } + } + rv.push(q); } + return rv; } - rv.push(q); - } - return rv; -} - - + -// helper: runlength encoding with increment step: code, length: step (default step = 0) -// `this` references an array -function s(c, l, a) { - a = a || 0; - for (var i = 0; i < l; i++) { - this.push(c); - c += a; - } -} -// helper: duplicate sequence from *relative* offset and length. -// `this` references an array -function c(i, l) { - i = this.length - i; - for (l += i; i < l; i++) { - this.push(this[i]); - } -} + // helper: runlength encoding with increment step: code, length: step (default step = 0) + // `this` references an array + function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } + } -// helper: unpack an array using helpers and data, all passed in an array argument 'a'. -function u(a) { - var rv = []; - for (var i = 0, l = a.length; i < l; i++) { - var e = a[i]; - // Is this entry a helper function? - if (typeof e === 'function') { - i++; - e.apply(rv, a[i]); - } else { - rv.push(e); + // helper: duplicate sequence from *relative* offset and length. + // `this` references an array + function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } } - } - return rv; -} + // helper: unpack an array using helpers and data, all passed in an array argument 'a'. + function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; + } + var parser = { // Code Generator Information Report @@ -607,7 +608,7 @@ var parser = { // // --------- END OF REPORT ----------- -trace: function no_op_trace() { }, +trace: function no_op_trace() {}, JisonParserError: JisonParserError, yy: {}, options: { @@ -775,9 +776,9 @@ cleanupAfterParse: null, constructParseErrorInfo: null, yyMergeLocationInfo: null, -__reentrant_call_depth: 0, // INTERNAL USE ONLY -__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup -__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__reentrant_call_depth: 0, // INTERNAL USE ONLY +__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup // APIs which will be set up depending on user action code analysis: //yyRecovering: 0, @@ -800,7 +801,7 @@ getSymbolName: function parser_getSymbolName(symbol) { if (this.terminals_[symbol]) { return this.terminals_[symbol]; } - + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. // // An example of this may be where a rule's action code contains a call like this: @@ -824,8 +825,7 @@ getSymbolName: function parser_getSymbolName(symbol) { describeSymbol: function parser_describeSymbol(symbol) { if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { return this.terminal_descriptions_[symbol]; - } - else if (symbol === this.EOF) { + } else if (symbol === this.EOF) { return 'end of input'; } var id = this.getSymbolName(symbol); @@ -850,9 +850,7 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do // Has this (error?) state been outfitted with a custom expectations description text for human consumption? // If so, use that one instead of the less palatable token set. if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { - return [ - this.state_descriptions_[state] - ]; + return [this.state_descriptions_[state]]; } for (var p in this.table[state]) { p = +p; @@ -860,7 +858,7 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do var d = do_not_describe ? p : this.describeSymbol(p); if (d && !check[d]) { tokenset.push(d); - check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. } } } @@ -3508,7 +3506,7 @@ defaultActions: bda({ parseError: function parseError(str, hash, ExceptionClass) { if (hash.recoverable && typeof this.trace === 'function') { this.trace(str); - hash.destroy(); // destroy... well, *almost*! + hash.destroy(); // destroy... well, *almost*! } else { if (!ExceptionClass) { ExceptionClass = this.JisonParserError; @@ -3552,15 +3550,18 @@ parse: function parse(input) { pre_parse: undefined, post_parse: undefined, pre_lex: undefined, - post_lex: undefined + post_lex: undefined // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes! }; + var ASSERT; if (typeof assert !== 'function') { - assert = function JisonAssert(cond, msg) { + ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; + } else { + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { @@ -4321,7 +4322,7 @@ parse: function parse(input) { yyloc = lexer.yylloc; - preErrorSymbol = 0; + preErrorSymbol = 0; symbol = lex(); @@ -4336,7 +4337,7 @@ parse: function parse(input) { // try to recover from error if (error_rule_depth < 0) { - assert(recovering > 0); + ASSERT(recovering > 0); recoveringErrorInfo.info_stack_pointer = esp; // barf a fatal hairball when we're out of look-ahead symbols and none hit a match @@ -4461,8 +4462,8 @@ parse: function parse(input) { // *or* we execute a `reduce` action which outputs a final parse // result (yes, that MAY happen!)... - assert(recoveringErrorInfo); - assert(symbol === TERROR); + ASSERT(recoveringErrorInfo); + ASSERT(symbol === TERROR); while (symbol) { // retrieve state number from top of stack state = newState; // sstack[sp - 1]; @@ -4526,7 +4527,7 @@ parse: function parse(input) { case 1: stack[sp] = symbol; //vstack[sp] = lexer.yytext; - assert(recoveringErrorInfo); + ASSERT(recoveringErrorInfo); vstack[sp] = recoveringErrorInfo; //lstack[sp] = copy_yylloc(lexer.yylloc); lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); @@ -4731,7 +4732,7 @@ parse: function parse(input) { ++sp; symbol = 0; - assert(preErrorSymbol === 0); + ASSERT(preErrorSymbol === 0); if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: @@ -4986,7 +4987,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-194*/ +/* lexer generated by jison-lex 0.6.0-196*/ /* * Returns a Lexer object of the following structure: @@ -5315,24 +5316,24 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state - - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: '', /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -5345,7 +5346,7 @@ var lexer = function() { var pei = { errStr: msg, recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -5372,7 +5373,7 @@ var lexer = function() { var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && typeof key === 'object') { + if (this.hasOwnProperty(key) && ((typeof key === 'undefined' ? 'undefined' : _typeof(key))) === 'object') { this[key] = undefined; } } @@ -5450,6 +5451,7 @@ var lexer = function() { * @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { + // prevent lingering circular references from causing memory leaks: this.setInput('', {}); // nuke the error hash info instances created during this run. @@ -5529,7 +5531,7 @@ var lexer = function() { var spec = conditions[k]; var rule_ids = spec.rules; var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -5807,7 +5809,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! + maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5863,7 +5865,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! + maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5871,7 +5873,7 @@ var lexer = function() { // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } // now that we have a significantly reduced string to process, transform the newlines @@ -5949,9 +5951,9 @@ var lexer = function() { * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { - const CONTEXT = 3; - const CONTEXT_TAIL = 1; - const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var CONTEXT = 3; + var CONTEXT_TAIL = 1; + var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; var lines = input.split('\n'); @@ -6021,7 +6023,7 @@ var lexer = function() { end: clip_end, len: clip_end - clip_start + 1, arr: nonempty_line_indexes, - rv + rv: rv }); var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; diff --git a/lex-parser.js b/lex-parser.js index 780d283..8640aec 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -415,10 +415,11 @@ function JisonParserError(msg, hash) { stacktrace = ex2.stack; } if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { // V8 + if (Error.hasOwnProperty('captureStackTrace')) { + // V8 Error.captureStackTrace(this, this.constructor); } else { - stacktrace = (new Error(msg)).stack; + stacktrace = new Error(msg).stack; } } if (stacktrace) { @@ -444,111 +445,111 @@ JisonParserError.prototype.name = 'JisonParserError'; // import fs from 'fs'; -// helper: reconstruct the productions[] table -function bp(s) { - var rv = []; - var p = s.pop; - var r = s.rule; - for (var i = 0, l = p.length; i < l; i++) { - rv.push([ - p[i], - r[i] - ]); - } - return rv; -} - - + // helper: reconstruct the productions[] table + function bp(s) { + var rv = []; + var p = s.pop; + var r = s.rule; + for (var i = 0, l = p.length; i < l; i++) { + rv.push([ + p[i], + r[i] + ]); + } + return rv; + } + -// helper: reconstruct the defaultActions[] table -function bda(s) { - var rv = {}; - var d = s.idx; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var j = d[i]; - rv[j] = g[i]; - } - return rv; -} + // helper: reconstruct the defaultActions[] table + function bda(s) { + var rv = {}; + var d = s.idx; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var j = d[i]; + rv[j] = g[i]; + } + return rv; + } + -// helper: reconstruct the 'goto' table -function bt(s) { - var rv = []; - var d = s.len; - var y = s.symbol; - var t = s.type; - var a = s.state; - var m = s.mode; - var g = s.goto; - for (var i = 0, l = d.length; i < l; i++) { - var n = d[i]; - var q = {}; - for (var j = 0; j < n; j++) { - var z = y.shift(); - switch (t.shift()) { - case 2: - q[z] = [ - m.shift(), - g.shift() - ]; - break; + // helper: reconstruct the 'goto' table + function bt(s) { + var rv = []; + var d = s.len; + var y = s.symbol; + var t = s.type; + var a = s.state; + var m = s.mode; + var g = s.goto; + for (var i = 0, l = d.length; i < l; i++) { + var n = d[i]; + var q = {}; + for (var j = 0; j < n; j++) { + var z = y.shift(); + switch (t.shift()) { + case 2: + q[z] = [ + m.shift(), + g.shift() + ]; + break; - case 0: - q[z] = a.shift(); - break; + case 0: + q[z] = a.shift(); + break; - default: - // type === 1: accept - q[z] = [ - 3 - ]; + default: + // type === 1: accept + q[z] = [ + 3 + ]; + } + } + rv.push(q); } + return rv; } - rv.push(q); - } - return rv; -} - - + -// helper: runlength encoding with increment step: code, length: step (default step = 0) -// `this` references an array -function s(c, l, a) { - a = a || 0; - for (var i = 0; i < l; i++) { - this.push(c); - c += a; - } -} -// helper: duplicate sequence from *relative* offset and length. -// `this` references an array -function c(i, l) { - i = this.length - i; - for (l += i; i < l; i++) { - this.push(this[i]); - } -} + // helper: runlength encoding with increment step: code, length: step (default step = 0) + // `this` references an array + function s(c, l, a) { + a = a || 0; + for (var i = 0; i < l; i++) { + this.push(c); + c += a; + } + } -// helper: unpack an array using helpers and data, all passed in an array argument 'a'. -function u(a) { - var rv = []; - for (var i = 0, l = a.length; i < l; i++) { - var e = a[i]; - // Is this entry a helper function? - if (typeof e === 'function') { - i++; - e.apply(rv, a[i]); - } else { - rv.push(e); + // helper: duplicate sequence from *relative* offset and length. + // `this` references an array + function c(i, l) { + i = this.length - i; + for (l += i; i < l; i++) { + this.push(this[i]); + } } - } - return rv; -} + // helper: unpack an array using helpers and data, all passed in an array argument 'a'. + function u(a) { + var rv = []; + for (var i = 0, l = a.length; i < l; i++) { + var e = a[i]; + // Is this entry a helper function? + if (typeof e === 'function') { + i++; + e.apply(rv, a[i]); + } else { + rv.push(e); + } + } + return rv; + } + var parser = { // Code Generator Information Report @@ -603,7 +604,7 @@ var parser = { // // --------- END OF REPORT ----------- -trace: function no_op_trace() { }, +trace: function no_op_trace() {}, JisonParserError: JisonParserError, yy: {}, options: { @@ -771,9 +772,9 @@ cleanupAfterParse: null, constructParseErrorInfo: null, yyMergeLocationInfo: null, -__reentrant_call_depth: 0, // INTERNAL USE ONLY -__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup -__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__reentrant_call_depth: 0, // INTERNAL USE ONLY +__error_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup +__error_recovery_infos: [], // INTERNAL USE ONLY: the set of parseErrorInfo objects created since the last cleanup // APIs which will be set up depending on user action code analysis: //yyRecovering: 0, @@ -796,7 +797,7 @@ getSymbolName: function parser_getSymbolName(symbol) { if (this.terminals_[symbol]) { return this.terminals_[symbol]; } - + // Otherwise... this might refer to a RULE token i.e. a non-terminal: see if we can dig that one up. // // An example of this may be where a rule's action code contains a call like this: @@ -820,8 +821,7 @@ getSymbolName: function parser_getSymbolName(symbol) { describeSymbol: function parser_describeSymbol(symbol) { if (symbol !== this.EOF && this.terminal_descriptions_ && this.terminal_descriptions_[symbol]) { return this.terminal_descriptions_[symbol]; - } - else if (symbol === this.EOF) { + } else if (symbol === this.EOF) { return 'end of input'; } var id = this.getSymbolName(symbol); @@ -846,9 +846,7 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do // Has this (error?) state been outfitted with a custom expectations description text for human consumption? // If so, use that one instead of the less palatable token set. if (!do_not_describe && this.state_descriptions_ && this.state_descriptions_[state]) { - return [ - this.state_descriptions_[state] - ]; + return [this.state_descriptions_[state]]; } for (var p in this.table[state]) { p = +p; @@ -856,7 +854,7 @@ collect_expected_token_set: function parser_collect_expected_token_set(state, do var d = do_not_describe ? p : this.describeSymbol(p); if (d && !check[d]) { tokenset.push(d); - check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. + check[d] = true; // Mark this token description as already mentioned to prevent outputting duplicate entries. } } } @@ -3504,7 +3502,7 @@ defaultActions: bda({ parseError: function parseError(str, hash, ExceptionClass) { if (hash.recoverable && typeof this.trace === 'function') { this.trace(str); - hash.destroy(); // destroy... well, *almost*! + hash.destroy(); // destroy... well, *almost*! } else { if (!ExceptionClass) { ExceptionClass = this.JisonParserError; @@ -3551,15 +3549,18 @@ parse: function parse(input) { pre_parse: undefined, post_parse: undefined, pre_lex: undefined, - post_lex: undefined + post_lex: undefined // WARNING: must be written this way for the code expanders to work correctly in both ES5 and ES6 modes! }; + var ASSERT; if (typeof assert !== 'function') { - assert = function JisonAssert(cond, msg) { + ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; + } else { + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { @@ -3834,10 +3835,8 @@ parse: function parse(input) { } // - detect if an epsilon rule is being processed and act accordingly: - var start_with_epsilon = false; if (!l1 && first_index == null) { // epsilon rule span merger. With optional look-ahead in l2. - start_with_epsilon = true; if (!dont_look_back) { for (var i = (i1 || sp) - 1; i >= 0; i--) { l1 = lstack[i]; @@ -4322,7 +4321,7 @@ parse: function parse(input) { yyloc = lexer.yylloc; - preErrorSymbol = 0; + preErrorSymbol = 0; symbol = lex(); @@ -4337,7 +4336,7 @@ parse: function parse(input) { // try to recover from error if (error_rule_depth < 0) { - assert(recovering > 0); + ASSERT(recovering > 0); recoveringErrorInfo.info_stack_pointer = esp; // barf a fatal hairball when we're out of look-ahead symbols and none hit a match @@ -4462,8 +4461,8 @@ parse: function parse(input) { // *or* we execute a `reduce` action which outputs a final parse // result (yes, that MAY happen!)... - assert(recoveringErrorInfo); - assert(symbol === TERROR); + ASSERT(recoveringErrorInfo); + ASSERT(symbol === TERROR); while (symbol) { // retrieve state number from top of stack state = newState; // sstack[sp - 1]; @@ -4527,7 +4526,7 @@ parse: function parse(input) { case 1: stack[sp] = symbol; //vstack[sp] = lexer.yytext; - assert(recoveringErrorInfo); + ASSERT(recoveringErrorInfo); vstack[sp] = recoveringErrorInfo; //lstack[sp] = copy_yylloc(lexer.yylloc); lstack[sp] = this.yyMergeLocationInfo(null, null, recoveringErrorInfo.loc, lexer.yylloc, true); @@ -4732,7 +4731,7 @@ parse: function parse(input) { ++sp; symbol = 0; - assert(preErrorSymbol === 0); + ASSERT(preErrorSymbol === 0); if (!preErrorSymbol) { // normal execution / no error // Pick up the lexer details for the current symbol as that one is not 'look-ahead' any more: @@ -4987,7 +4986,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-194*/ +/* lexer generated by jison-lex 0.6.0-196*/ /* * Returns a Lexer object of the following structure: @@ -5316,24 +5315,24 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state - - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: '', /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -5346,7 +5345,7 @@ var lexer = function() { var pei = { errStr: msg, recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -5373,7 +5372,7 @@ var lexer = function() { var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && typeof key === 'object') { + if (this.hasOwnProperty(key) && ((typeof key === 'undefined' ? 'undefined' : _typeof(key))) === 'object') { this[key] = undefined; } } @@ -5451,8 +5450,6 @@ var lexer = function() { * @this {RegExpLexer} */ cleanupAfterLex: function lexer_cleanupAfterLex(do_not_nuke_errorinfos) { - var rv; - // prevent lingering circular references from causing memory leaks: this.setInput('', {}); @@ -5533,7 +5530,7 @@ var lexer = function() { var spec = conditions[k]; var rule_ids = spec.rules; var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -5811,7 +5808,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! + maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5867,7 +5864,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! + maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5875,7 +5872,7 @@ var lexer = function() { // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } // now that we have a significantly reduced string to process, transform the newlines @@ -5953,10 +5950,9 @@ var lexer = function() { * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { - var error_size = loc.last_line - loc.first_line; - const CONTEXT = 3; - const CONTEXT_TAIL = 1; - const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var CONTEXT = 3; + var CONTEXT_TAIL = 1; + var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; var lines = input.split('\n'); @@ -6026,7 +6022,7 @@ var lexer = function() { end: clip_end, len: clip_end - clip_start + 1, arr: nonempty_line_indexes, - rv + rv: rv }); var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; @@ -7818,9 +7814,10 @@ function yyparse() { return parser.parse.apply(parser, arguments); } -export default { +export { parser, Parser, - parse: yyparse, + yyparse as parse, + }; From b61141d57b2b8f86988a10ffa8d7d830a1a64455 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 13 Oct 2017 06:08:08 +0200 Subject: [PATCH 396/417] bump build revision --- package-lock.json | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 62c445b..b6c4595 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-194", + "version": "0.6.0-195", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { diff --git a/package.json b/package.json index 051acb1..8dd0313 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-194", + "version": "0.6.0-195", "description": "A parser for lexical grammars used by jison", "main": "dist/lex-parser-cjs-es5.js", "module": "lex-parser.js", From e6e783c51ecd3258013f02d117210e17e945e04d Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 13 Oct 2017 18:41:15 +0200 Subject: [PATCH 397/417] fix ES6 export spec --- lex-parser.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index 8640aec..bd65df3 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -7814,10 +7814,9 @@ function yyparse() { return parser.parse.apply(parser, arguments); } -export { +export default { parser, Parser, - yyparse as parse, - + parse: yyparse }; From 836c969f2e69afdc6a06669d93ca507e27a6fca3 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 13 Oct 2017 21:56:08 +0200 Subject: [PATCH 398/417] sync changes with jison monorepo: corrections and augmentations for the ES6 code generator migration --- lex-parser.js | 60 +++++++++++++++++++++++++----------------------- package.json | 3 ++- rollup.config.js | 36 +++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 30 deletions(-) diff --git a/lex-parser.js b/lex-parser.js index bd65df3..b89ec1e 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -5315,24 +5315,24 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state - - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: '', /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -5345,7 +5345,7 @@ var lexer = function() { var pei = { errStr: msg, recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -5372,7 +5372,7 @@ var lexer = function() { var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && ((typeof key === 'undefined' ? 'undefined' : _typeof(key))) === 'object') { + if (this.hasOwnProperty(key) && typeof key === 'object') { this[key] = undefined; } } @@ -5530,7 +5530,7 @@ var lexer = function() { var spec = conditions[k]; var rule_ids = spec.rules; var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -5808,7 +5808,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! + maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5864,7 +5864,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! + maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5872,7 +5872,7 @@ var lexer = function() { // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } // now that we have a significantly reduced string to process, transform the newlines @@ -5950,9 +5950,10 @@ var lexer = function() { * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { - var CONTEXT = 3; - var CONTEXT_TAIL = 1; - var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + var error_size = loc.last_line - loc.first_line; + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; var lines = input.split('\n'); @@ -6022,7 +6023,7 @@ var lexer = function() { end: clip_end, len: clip_end - clip_start + 1, arr: nonempty_line_indexes, - rv: rv + rv }); var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; @@ -7817,6 +7818,7 @@ function yyparse() { export default { parser, Parser, - parse: yyparse + parse: yyparse, + }; diff --git a/package.json b/package.json index 8dd0313..74a5002 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-195", + "version": "0.6.1-200", "description": "A parser for lexical grammars used by jison", "main": "dist/lex-parser-cjs-es5.js", "module": "lex-parser.js", @@ -38,6 +38,7 @@ "chai": "4.1.2", "jison-gho": "0.6.0-193", "mocha": "4.0.1", + "rollup-plugin-node-resolve": "3.0.0", "rollup": "0.50.0" } } diff --git a/rollup.config.js b/rollup.config.js index 16957ca..ce1fd9f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,4 +1,6 @@ // rollup.config.js +import resolve from 'rollup-plugin-node-resolve'; + export default { input: 'lex-parser.js', output: [ @@ -15,5 +17,39 @@ export default { name: 'lex-parser', format: 'umd' } + ], + plugins: [ + resolve({ + // use "module" field for ES6 module if possible + module: true, // Default: true + + // use "main" field or index.js, even if it's not an ES6 module + // (needs to be converted from CommonJS to ES6 + // – see https://github.com/rollup/rollup-plugin-commonjs + main: true, // Default: true + + // not all files you want to resolve are .js files + extensions: [ '.js' ], // Default: ['.js'] + + // whether to prefer built-in modules (e.g. `fs`, `path`) or + // local ones with the same names + preferBuiltins: true, // Default: true + + // If true, inspect resolved files to check that they are + // ES2015 modules + modulesOnly: true, // Default: false + }) + ], + external: [ + '@gerhobbelt/ast-util', + '@gerhobbelt/json5', + '@gerhobbelt/nomnom', + '@gerhobbelt/prettier-miscellaneous', + '@gerhobbelt/recast', + '@gerhobbelt/xregexp', + 'assert', + 'fs', + 'path', + 'process', ] }; From 70e3c736554d88906c02c423c30f9259aed9f363 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Fri, 13 Oct 2017 22:53:49 +0200 Subject: [PATCH 399/417] sync with jison monorepo changes: updated version and npm-ignore development utility scripts --- .npmignore | 3 +++ lex-parser.js | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.npmignore b/.npmignore index 5407458..9fe4b2e 100644 --- a/.npmignore +++ b/.npmignore @@ -15,3 +15,6 @@ Makefile # Sources which are compiled through jison lex.y lex.l + +# misc files which are used during development +__patch_*.js diff --git a/lex-parser.js b/lex-parser.js index b89ec1e..63708be 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -8,7 +8,7 @@ import helpers from 'jison-helpers-lib'; var assert; -/* parser generated by jison 0.6.0-194 */ +/* parser generated by jison 0.6.1-200 */ /* * Returns a Parser object of the following structure: @@ -4986,7 +4986,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-196*/ +/* lexer generated by jison-lex 0.6.1-200*/ /* * Returns a Lexer object of the following structure: From f867530746a90ff8368c15a78fef0d9bf6478827 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 02:23:15 +0200 Subject: [PATCH 400/417] synchronized with monorepo JISON --- Makefile | 2 +- lex-parser-prelude.js | 6 ---- lex-parser.js | 64 +++++++++++++++++++++++++------------------ lex.l | 2 +- lex.y | 6 ++-- 5 files changed, 42 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index 57bfa25..39f1ab2 100644 --- a/Makefile +++ b/Makefile @@ -25,7 +25,7 @@ npm-update: ncu -a --packageFile=package.json build: -ifeq ($(wildcard ./node_modules/.bin/jison),) +ifeq ($(wildcard node_modules/.bin/jison),) $(error "### FAILURE: Make sure you have run 'make prep' before as the jison compiler is unavailable! ###") endif $(JISON) -m es -o lex-parser.js lex.y lex.l diff --git a/lex-parser-prelude.js b/lex-parser-prelude.js index 0a54bb7..075ac5f 100644 --- a/lex-parser-prelude.js +++ b/lex-parser-prelude.js @@ -1,9 +1,3 @@ -import fs from 'fs'; - -import XRegExp from '@gerhobbelt/xregexp'; -import helpers from 'jison-helpers-lib'; - // hack: var assert; - diff --git a/lex-parser.js b/lex-parser.js index 63708be..f29b7dc 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -190,11 +190,11 @@ var assert; * * WARNING: * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with - * any attributes already added to `yy` by the jison run-time; - * when such a collision is detected an exception is thrown to prevent the generated run-time + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time * from silently accepting this confusing and potentially hazardous situation! * - * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in * the lexer section of the grammar spec): these will be inserted in the `yy` shared state * object and any collision with those will be reported by the lexer via a thrown exception. * @@ -415,11 +415,10 @@ function JisonParserError(msg, hash) { stacktrace = ex2.stack; } if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { - // V8 + if (Error.hasOwnProperty('captureStackTrace')) { // V8/Chrome engine Error.captureStackTrace(this, this.constructor); } else { - stacktrace = new Error(msg).stack; + stacktrace = (new Error(msg)).stack; } } if (stacktrace) { @@ -574,12 +573,15 @@ var parser = { // module type: ..................... es // parser engine type: .............. lalr // output main() in the module: ..... true + // has user-specified main(): ....... false + // has user-specified require()/import modules for main(): + // .................................. false // number of expected conflicts: .... 0 // // // Parser Analysis flags: // - // no significant actions (parser is a language matcher only): + // no significant actions (parser is a language matcher only): // .................................. false // uses yyleng: ..................... false // uses yylineno: ................... false @@ -2237,7 +2239,7 @@ case 112: break; case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! - // error recovery reduction action (action generated by jison, + // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -3562,7 +3564,7 @@ parse: function parse(input) { } else { ASSERT = assert; } - + this.yyGetSharedState = function yyGetSharedState() { return sharedState_yy; }; @@ -3574,7 +3576,7 @@ parse: function parse(input) { // shallow clone objects, straight copy of simple `src` values - // e.g. `lexer.yytext` MAY be a complex value object, + // e.g. `lexer.yytext` MAY be a complex value object, // rather than a simple string/value. function shallow_copy(src) { if (typeof src === 'object') { @@ -3637,7 +3639,7 @@ parse: function parse(input) { var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0)); // append to the old one? if (recoveringErrorInfo) { - var esp = recoveringErrorInfo.info_stack_pointer; + var esp = recoveringErrorInfo.info_stack_pointer; recoveringErrorInfo.symbol_stack[esp] = symbol; var v = this.shallowCopyErrorInfo(hash); @@ -3991,7 +3993,7 @@ parse: function parse(input) { // the 'expected' set won't be modified, so no need to clone it: //rv.expected = rv.expected.slice(0); - + //symbol stack is a simple array: rv.symbol_stack = rv.symbol_stack.slice(0); // ditto for state stack: @@ -4005,7 +4007,7 @@ parse: function parse(input) { // and we don't bother with the sharedState_yy reference: //delete rv.yy; - // now we prepare for tracking the COMBINE actions + // now we prepare for tracking the COMBINE actions // in the error recovery code path: // // as we want to keep the maximum error info context, we @@ -4019,15 +4021,15 @@ parse: function parse(input) { // ### Purpose of each stack pointer: // // - stack_pointer: points at the top of the parse stack - // **as it existed at the time of the error + // **as it existed at the time of the error // occurrence, i.e. at the time the stack // snapshot was taken and copied into the // errorInfo object.** - // - base_pointer: the bottom of the **empty part** of the + // - base_pointer: the bottom of the **empty part** of the // stack, i.e. **the start of the rest of - // the stack space /above/ the existing + // the stack space /above/ the existing // parse stack. This section will be filled - // by the error recovery process as it + // by the error recovery process as it // travels the parse state machine to // arrive at the resolving error recovery rule.** // - info_stack_pointer: @@ -4038,7 +4040,7 @@ parse: function parse(input) { // process. Any mutations in the **parse stack** // are **copy-appended** to this part of the // stack space, keeping the bottom part of the - // stack (the 'snapshot' part where the parse + // stack (the 'snapshot' part where the parse // state at the time of error occurrence was kept) // intact. // - root_failure_pointer: @@ -4284,7 +4286,7 @@ parse: function parse(input) { - // Protect against overly blunt userland `parseError` code which *sets* + // Protect against overly blunt userland `parseError` code which *sets* // the `recoverable` flag without properly checking first: // we always terminate the parse when there's no recovery rule available anyhow! if (!p.recoverable || error_rule_depth < 0) { @@ -4451,7 +4453,7 @@ parse: function parse(input) { // Now duplicate the standard parse machine here, at least its initial - // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, // as we wish to push something special then! @@ -4673,7 +4675,7 @@ parse: function parse(input) { break; } - // should we also break out of the regular/outer parse loop, + // should we also break out of the regular/outer parse loop, // i.e. did the parser already produce a parse result in here?! if (action === 3) { break; @@ -4892,7 +4894,7 @@ parse: function parse(input) { }); console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); } - + break; } @@ -4986,7 +4988,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-200*/ +/* lexer generated by jison-lex 0.6.1-200 */ /* * Returns a Lexer object of the following structure: @@ -5206,10 +5208,16 @@ parser.yy.post_lex = function p_lex() { var lexer = function() { - // See also: - // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 - // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility - // with userland code which might access the derived class in a 'classic' way. + /** + * See also: + * http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + * but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + * with userland code which might access the derived class in a 'classic' way. + * + * @public + * @constructor + * @nocollapse + */ function JisonLexerError(msg, hash) { Object.defineProperty(this, 'name', { enumerable: false, @@ -7815,6 +7823,8 @@ function yyparse() { return parser.parse.apply(parser, arguments); } + + export default { parser, Parser, diff --git a/lex.l b/lex.l index 089c128..d06d309 100644 --- a/lex.l +++ b/lex.l @@ -1,6 +1,6 @@ %code imports %{ -// import helpers from 'jison-helpers-lib'; + import helpers from 'jison-helpers-lib'; %} diff --git a/lex.y b/lex.y index 0a20673..d6bb19c 100644 --- a/lex.y +++ b/lex.y @@ -1,8 +1,8 @@ %code imports %{ -// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer -// import helpers from 'jison-helpers-lib'; -// import fs from 'fs'; + import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer + import helpers from 'jison-helpers-lib'; + import fs from 'fs'; %} From 61c61babf3d4d3356d0aab7480848513eb65b9fa Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 02:34:39 +0200 Subject: [PATCH 401/417] updated NPM packages --- dist/lex-parser-cjs-es5.js | 388 +++++++++++++++++++++++--- dist/lex-parser-cjs.js | 552 ++++++++++++++++++++++++++++-------- dist/lex-parser-es6.js | 548 +++++++++++++++++++++++++++++------- dist/lex-parser-umd-es5.js | 388 +++++++++++++++++++++++--- dist/lex-parser-umd.js | 558 +++++++++++++++++++++++++++++-------- lex-parser.js | 95 +++---- package-lock.json | 122 +++++--- 7 files changed, 2153 insertions(+), 498 deletions(-) diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js index 009a9d5..3bdbf8b 100644 --- a/dist/lex-parser-cjs-es5.js +++ b/dist/lex-parser-cjs-es5.js @@ -1,6 +1,6 @@ 'use strict'; -var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), _templateObject2 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), @@ -31,20 +31,319 @@ var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not corre function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } -Object.defineProperty(exports, '__esModule', { value: true }); - function _interopDefault(ex) { - return ex && (typeof ex === 'undefined' ? 'undefined' : _typeof2(ex)) === 'object' && 'default' in ex ? ex['default'] : ex; + return ex && (typeof ex === 'undefined' ? 'undefined' : _typeof(ex)) === 'object' && 'default' in ex ? ex['default'] : ex; } -var fs = _interopDefault(require('fs')); var XRegExp = _interopDefault(require('@gerhobbelt/xregexp')); -var helpers = _interopDefault(require('jison-helpers-lib')); +var recast = _interopDefault(require('@gerhobbelt/recast')); +var fs = _interopDefault(require('fs')); + +// Return TRUE if `src` starts with `searchString`. +function startsWith(src, searchString) { + return src.substr(0, searchString.length) === searchString; +} + +// tagged template string helper which removes the indentation common to all +// non-empty lines: that indentation was added as part of the source code +// formatting of this lexer spec file and must be removed to produce what +// we were aiming for. +// +// Each template string starts with an optional empty line, which should be +// removed entirely, followed by a first line of error reporting content text, +// which should not be indented at all, i.e. the indentation of the first +// non-empty line should be treated as the 'common' indentation and thus +// should also be removed from all subsequent lines in the same template string. +// +// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals +function rmCommonWS$1(strings) { + // As `strings[]` is an array of strings, each potentially consisting + // of multiple lines, followed by one(1) value, we have to split each + // individual string into lines to keep that bit of information intact. + // + // We assume clean code style, hence no random mix of tabs and spaces, so every + // line MUST have the same indent style as all others, so `length` of indent + // should suffice, but the way we coded this is stricter checking as we look + // for the *exact* indenting=leading whitespace in each line. + var indent_str = null; + var src = strings.map(function splitIntoLines(s) { + var a = s.split('\n'); + + indent_str = a.reduce(function analyzeLine(indent_str, line) { + var m = /^(\s*)\S/gm.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } + } + return indent_str; + }, indent_str); + + return a; + }); + + // Also note: due to the way we format the template strings in our sourcecode, + // the last line in the entire template must be empty when it has ANY trailing + // whitespace: + var a = src[src.length - 1]; + a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); + + // Done removing common indentation. + // + // Process template string partials now: + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + for (var j = 0, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } + } + } + + // now merge everything to construct the template result: + var rv = []; + + for (var _len = arguments.length, values = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + values[_key - 1] = arguments[_key]; + } + + for (var i = 0, len = values.length; i < len; i++) { + rv.push(src[i].join('\n')); + rv.push(values[i]); + } + // the last value is always followed by a last template string partial: + rv.push(src[i].join('\n')); + + var sv = rv.join(''); + return sv; +} + +// Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` +/** @public */ +function camelCase(s) { + // Convert first character to lowercase + return s.replace(/^\w/, function (match) { + return match.toLowerCase(); + }).replace(/-\w/g, function (match) { + return match.charAt(1).toUpperCase(); + }); +} + +// properly quote and escape the given input string +function dquote(s) { + var sq = s.indexOf('\'') >= 0; + var dq = s.indexOf('"') >= 0; + if (sq && dq) { + s = s.replace(/"/g, '\\"'); + dq = false; + } + if (dq) { + s = '\'' + s + '\''; + } else { + s = '"' + s + '"'; + } + return s; +} + +// +// Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis +// (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) +// +// MIT Licensed +// +// +// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: +// +// the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to +// the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that +// we can test the code in a different environment so that we can see what precisely is causing the failure. +// + + +var fs$1 = require('fs'); +var path = require('path'); + +// Helper function: pad number with leading zeroes +function pad(n, p) { + p = p || 2; + var rv = '0000' + n; + return rv.slice(-p); +} + +// attempt to dump in one of several locations: first winner is *it*! +function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { + var dumpfile; + + try { + var dumpPaths = [options.outfile ? path.dirname(options.outfile) : null, options.inputPath, process.cwd()]; + var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname).replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever + .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. + if (dumpName === '' || dumpName === '_') { + dumpName = '__bugger__'; + } + err_id = err_id || 'XXX'; + + var ts = new Date(); + var tm = ts.getUTCFullYear() + '_' + pad(ts.getUTCMonth() + 1) + '_' + pad(ts.getUTCDate()) + 'T' + pad(ts.getUTCHours()) + '' + pad(ts.getUTCMinutes()) + '' + pad(ts.getUTCSeconds()) + '.' + pad(ts.getUTCMilliseconds(), 3) + 'Z'; + + dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; + + for (var i = 0, l = dumpPaths.length; i < l; i++) { + if (!dumpPaths[i]) { + continue; + } + + try { + dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); + fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); + break; // abort loop once a dump action was successful! + } catch (ex3) { + //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); + if (i === l - 1) { + throw ex3; + } + } + } + } catch (ex2) { + console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); + } + + // augment the exception info, when available: + if (ex) { + ex.offending_source_code = sourcecode; + ex.offending_source_title = errname; + ex.offending_source_dumpfile = dumpfile; + } +} + +// +// `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. +// When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode +// is dumped to file for later diagnosis. +// +// Two options drive the internal behaviour: +// +// - options.dumpSourceCodeOnFailure -- default: FALSE +// - options.throwErrorOnCompileFailure -- default: FALSE +// +// Dumpfile naming and path are determined through these options: +// +// - options.outfile +// - options.inputPath +// - options.inputFilename +// - options.moduleName +// - options.defaultModuleName +// +function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { + options = options || {}; + var errname = "" + (title || "exec_test"); + var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); + if (err_id.length === 0) { + err_id = "exec_crash"; + } + var debug = 0; + + if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); + if (debug > 1) console.warn('\n ######################## source code ##########################\n ' + sourcecode + '\n ######################## source code ##########################\n '); + + var p; + try { + // p = eval(sourcecode); + if (typeof code_execution_rig !== 'function') { + throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); + } + p = code_execution_rig.call(this, sourcecode, options, errname, debug); + } catch (ex) { + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); + + if (debug > 1) console.log("exec-and-diagnose options:", options); + + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (options.dumpSourceCodeOnFailure) { + dumpSourceToFile(sourcecode, errname, err_id, options, ex); + } + + if (options.throwErrorOnCompileFailure) { + throw ex; + } + } + return p; +} + +// +// Parse a given chunk of code to an AST. +// +// MIT Licensed +// +// +// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: +// +// would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? +// + + +//import astUtils from '@gerhobbelt/ast-util'; +//import prettier from '@gerhobbelt/prettier-miscellaneous'; +//import assert from 'assert'; + +// assert(recast); +// var types = recast.types; +// assert(types); +// var namedTypes = types.namedTypes; +// assert(namedTypes); +// var b = types.builders; +// assert(b); +// //assert(astUtils); + + +function parseCodeChunkToAST(src, options) { + var ast = recast.parse(src); + return ast; +} + +function prettyPrintAST(ast, options) { + var new_src; + + { + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; + } + + new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup + return new_src; +} + +var helpers = { + rmCommonWS: rmCommonWS$1, + camelCase: camelCase, + dquote: dquote, + + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile, + + parseCodeChunkToAST: parseCodeChunkToAST, + prettyPrintAST: prettyPrintAST +}; // hack: var assert; -/* parser generated by jison 0.6.0-194 */ +/* parser generated by jison 0.6.1-200 */ /* * Returns a Parser object of the following structure: @@ -226,11 +525,11 @@ var assert; * * WARNING: * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with - * any attributes already added to `yy` by the jison run-time; - * when such a collision is detected an exception is thrown to prevent the generated run-time + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time * from silently accepting this confusing and potentially hazardous situation! * - * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in * the lexer section of the grammar spec): these will be inserted in the `yy` shared state * object and any collision with those will be reported by the lexer via a thrown exception. * @@ -450,7 +749,7 @@ function JisonParserError(msg, hash) { } if (!stacktrace) { if (Error.hasOwnProperty('captureStackTrace')) { - // V8 + // V8/Chrome engine Error.captureStackTrace(this, this.constructor); } else { stacktrace = new Error(msg).stack; @@ -473,11 +772,6 @@ if (typeof Object.setPrototypeOf === 'function') { JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer -// import helpers from 'jison-helpers-lib'; -// import fs from 'fs'; - - // helper: reconstruct the productions[] table function bp(s) { var rv = []; @@ -592,12 +886,15 @@ var parser = { // module type: ..................... es // parser engine type: .............. lalr // output main() in the module: ..... true + // has user-specified main(): ....... false + // has user-specified require()/import modules for main(): + // .................................. false // number of expected conflicts: .... 0 // // // Parser Analysis flags: // - // no significant actions (parser is a language matcher only): + // no significant actions (parser is a language matcher only): // .................................. false // uses yyleng: ..................... false // uses yylineno: ................... false @@ -1959,7 +2256,7 @@ var parser = { case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! - // error recovery reduction action (action generated by jison, + // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -2050,10 +2347,10 @@ var parser = { }; // shallow clone objects, straight copy of simple `src` values - // e.g. `lexer.yytext` MAY be a complex value object, + // e.g. `lexer.yytext` MAY be a complex value object, // rather than a simple string/value. function shallow_copy(src) { - if ((typeof src === 'undefined' ? 'undefined' : _typeof2(src)) === 'object') { + if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) === 'object') { var dst = {}; for (var k in src) { if (Object.prototype.hasOwnProperty.call(src, k)) { @@ -2412,7 +2709,7 @@ var parser = { // ... var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof2(key)) === 'object') { + if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { this[key] = undefined; } } @@ -2457,7 +2754,7 @@ var parser = { // and we don't bother with the sharedState_yy reference: //delete rv.yy; - // now we prepare for tracking the COMBINE actions + // now we prepare for tracking the COMBINE actions // in the error recovery code path: // // as we want to keep the maximum error info context, we @@ -2471,15 +2768,15 @@ var parser = { // ### Purpose of each stack pointer: // // - stack_pointer: points at the top of the parse stack - // **as it existed at the time of the error + // **as it existed at the time of the error // occurrence, i.e. at the time the stack // snapshot was taken and copied into the // errorInfo object.** - // - base_pointer: the bottom of the **empty part** of the + // - base_pointer: the bottom of the **empty part** of the // stack, i.e. **the start of the rest of - // the stack space /above/ the existing + // the stack space /above/ the existing // parse stack. This section will be filled - // by the error recovery process as it + // by the error recovery process as it // travels the parse state machine to // arrive at the resolving error recovery rule.** // - info_stack_pointer: @@ -2490,7 +2787,7 @@ var parser = { // process. Any mutations in the **parse stack** // are **copy-appended** to this part of the // stack space, keeping the bottom part of the - // stack (the 'snapshot' part where the parse + // stack (the 'snapshot' part where the parse // state at the time of error occurrence was kept) // intact. // - root_failure_pointer: @@ -2680,7 +2977,7 @@ var parser = { r = this.parseError(p.errStr, p, this.JisonParserError); - // Protect against overly blunt userland `parseError` code which *sets* + // Protect against overly blunt userland `parseError` code which *sets* // the `recoverable` flag without properly checking first: // we always terminate the parse when there's no recovery rule available anyhow! if (!p.recoverable || error_rule_depth < 0) { @@ -2802,7 +3099,7 @@ var parser = { recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; // Now duplicate the standard parse machine here, at least its initial - // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, // as we wish to push something special then! @@ -2965,7 +3262,7 @@ var parser = { break; } - // should we also break out of the regular/outer parse loop, + // should we also break out of the regular/outer parse loop, // i.e. did the parser already produce a parse result in here?! if (action === 3) { break; @@ -3223,7 +3520,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-196*/ +/* lexer generated by jison-lex 0.6.1-200 */ /* * Returns a Lexer object of the following structure: @@ -3442,10 +3739,16 @@ parser.yy.post_lex = function p_lex() { */ var lexer = function () { - // See also: - // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 - // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility - // with userland code which might access the derived class in a 'classic' way. + /** + * See also: + * http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + * but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + * with userland code which might access the derived class in a 'classic' way. + * + * @public + * @constructor + * @nocollapse + */ function JisonLexerError(msg, hash) { Object.defineProperty(this, 'name', { enumerable: false, @@ -3515,7 +3818,7 @@ var lexer = function () { // uses yylineno: ................... false // uses yytext: ..................... false // uses yylloc: ..................... false - // uses lexer values: ............... true/ true + // uses lexer values: ............... true / true // location tracking: ............... true // location assignment: ............. true // @@ -3539,9 +3842,7 @@ var lexer = function () { // // --------- END OF REPORT ----------- - EOF: 1, - ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator @@ -5686,6 +5987,11 @@ function yyparse() { return parser.parse.apply(parser, arguments); } -exports.parser = parser; -exports.Parser = Parser; -exports.parse = yyparse; +var lexParser = { + parser: parser, + Parser: Parser, + parse: yyparse + +}; + +module.exports = lexParser; diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js index 46db0fd..7d6b025 100644 --- a/dist/lex-parser-cjs.js +++ b/dist/lex-parser-cjs.js @@ -1,18 +1,340 @@ 'use strict'; -Object.defineProperty(exports, '__esModule', { value: true }); - function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } -var fs = _interopDefault(require('fs')); var XRegExp = _interopDefault(require('@gerhobbelt/xregexp')); -var helpers = _interopDefault(require('jison-helpers-lib')); +var recast = _interopDefault(require('@gerhobbelt/recast')); +var fs = _interopDefault(require('fs')); + +// Return TRUE if `src` starts with `searchString`. +function startsWith(src, searchString) { + return src.substr(0, searchString.length) === searchString; +} + + + +// tagged template string helper which removes the indentation common to all +// non-empty lines: that indentation was added as part of the source code +// formatting of this lexer spec file and must be removed to produce what +// we were aiming for. +// +// Each template string starts with an optional empty line, which should be +// removed entirely, followed by a first line of error reporting content text, +// which should not be indented at all, i.e. the indentation of the first +// non-empty line should be treated as the 'common' indentation and thus +// should also be removed from all subsequent lines in the same template string. +// +// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals +function rmCommonWS$1(strings, ...values) { + // As `strings[]` is an array of strings, each potentially consisting + // of multiple lines, followed by one(1) value, we have to split each + // individual string into lines to keep that bit of information intact. + // + // We assume clean code style, hence no random mix of tabs and spaces, so every + // line MUST have the same indent style as all others, so `length` of indent + // should suffice, but the way we coded this is stricter checking as we look + // for the *exact* indenting=leading whitespace in each line. + var indent_str = null; + var src = strings.map(function splitIntoLines(s) { + var a = s.split('\n'); + + indent_str = a.reduce(function analyzeLine(indent_str, line) { + var m = /^(\s*)\S/gm.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } + } + return indent_str; + }, indent_str); + + return a; + }); + + // Also note: due to the way we format the template strings in our sourcecode, + // the last line in the entire template must be empty when it has ANY trailing + // whitespace: + var a = src[src.length - 1]; + a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); + + // Done removing common indentation. + // + // Process template string partials now: + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + for (var j = 0, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } + } + } + + // now merge everything to construct the template result: + var rv = []; + for (var i = 0, len = values.length; i < len; i++) { + rv.push(src[i].join('\n')); + rv.push(values[i]); + } + // the last value is always followed by a last template string partial: + rv.push(src[i].join('\n')); + + var sv = rv.join(''); + return sv; +} + +// Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` +/** @public */ +function camelCase(s) { + // Convert first character to lowercase + return s.replace(/^\w/, function (match) { + return match.toLowerCase(); + }) + .replace(/-\w/g, function (match) { + return match.charAt(1).toUpperCase(); + }); +} + +// properly quote and escape the given input string +function dquote(s) { + var sq = (s.indexOf('\'') >= 0); + var dq = (s.indexOf('"') >= 0); + if (sq && dq) { + s = s.replace(/"/g, '\\"'); + dq = false; + } + if (dq) { + s = '\'' + s + '\''; + } + else { + s = '"' + s + '"'; + } + return s; +} + +// +// Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis +// (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) +// +// MIT Licensed +// +// +// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: +// +// the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to +// the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that +// we can test the code in a different environment so that we can see what precisely is causing the failure. +// + + +var fs$1 = require('fs'); +var path = require('path'); + + + + + +// Helper function: pad number with leading zeroes +function pad(n, p) { + p = p || 2; + var rv = '0000' + n; + return rv.slice(-p); +} + + +// attempt to dump in one of several locations: first winner is *it*! +function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { + var dumpfile; + + try { + var dumpPaths = [(options.outfile ? path.dirname(options.outfile) : null), options.inputPath, process.cwd()]; + var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname) + .replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever + .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. + if (dumpName === '' || dumpName === '_') { + dumpName = '__bugger__'; + } + err_id = err_id || 'XXX'; + + var ts = new Date(); + var tm = ts.getUTCFullYear() + + '_' + pad(ts.getUTCMonth() + 1) + + '_' + pad(ts.getUTCDate()) + + 'T' + pad(ts.getUTCHours()) + + '' + pad(ts.getUTCMinutes()) + + '' + pad(ts.getUTCSeconds()) + + '.' + pad(ts.getUTCMilliseconds(), 3) + + 'Z'; + + dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; + + for (var i = 0, l = dumpPaths.length; i < l; i++) { + if (!dumpPaths[i]) { + continue; + } + + try { + dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); + fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); + break; // abort loop once a dump action was successful! + } catch (ex3) { + //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); + if (i === l - 1) { + throw ex3; + } + } + } + } catch (ex2) { + console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); + } + + // augment the exception info, when available: + if (ex) { + ex.offending_source_code = sourcecode; + ex.offending_source_title = errname; + ex.offending_source_dumpfile = dumpfile; + } +} + + + + +// +// `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. +// When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode +// is dumped to file for later diagnosis. +// +// Two options drive the internal behaviour: +// +// - options.dumpSourceCodeOnFailure -- default: FALSE +// - options.throwErrorOnCompileFailure -- default: FALSE +// +// Dumpfile naming and path are determined through these options: +// +// - options.outfile +// - options.inputPath +// - options.inputFilename +// - options.moduleName +// - options.defaultModuleName +// +function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { + options = options || {}; + var errname = "" + (title || "exec_test"); + var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); + if (err_id.length === 0) { + err_id = "exec_crash"; + } + const debug = 0; + + if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); + if (debug > 1) console.warn(` + ######################## source code ########################## + ${sourcecode} + ######################## source code ########################## + `); + + var p; + try { + // p = eval(sourcecode); + if (typeof code_execution_rig !== 'function') { + throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); + } + p = code_execution_rig.call(this, sourcecode, options, errname, debug); + } catch (ex) { + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); + + if (debug > 1) console.log("exec-and-diagnose options:", options); + + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (options.dumpSourceCodeOnFailure) { + dumpSourceToFile(sourcecode, errname, err_id, options, ex); + } + + if (options.throwErrorOnCompileFailure) { + throw ex; + } + } + return p; +} + +// +// Parse a given chunk of code to an AST. +// +// MIT Licensed +// +// +// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: +// +// would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? +// + + +//import astUtils from '@gerhobbelt/ast-util'; +//import prettier from '@gerhobbelt/prettier-miscellaneous'; +//import assert from 'assert'; + +// assert(recast); +// var types = recast.types; +// assert(types); +// var namedTypes = types.namedTypes; +// assert(namedTypes); +// var b = types.builders; +// assert(b); +// //assert(astUtils); + + + + +function parseCodeChunkToAST(src, options) { + var ast = recast.parse(src); + return ast; +} + + + + +function prettyPrintAST(ast, options) { + var new_src; + + { + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; + } + + new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup + return new_src; +} + +var helpers = { + rmCommonWS: rmCommonWS$1, + camelCase, + dquote, + + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile, + + parseCodeChunkToAST, + prettyPrintAST, +}; // hack: var assert; - -/* parser generated by jison 0.6.0-194 */ +/* parser generated by jison 0.6.1-200 */ /* * Returns a Parser object of the following structure: @@ -194,11 +516,11 @@ var assert; * * WARNING: * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with - * any attributes already added to `yy` by the jison run-time; - * when such a collision is detected an exception is thrown to prevent the generated run-time + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time * from silently accepting this confusing and potentially hazardous situation! * - * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in * the lexer section of the grammar spec): these will be inserted in the `yy` shared state * object and any collision with those will be reported by the lexer via a thrown exception. * @@ -390,7 +712,6 @@ var assert; */ - // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility @@ -419,11 +740,10 @@ function JisonParserError(msg, hash) { stacktrace = ex2.stack; } if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { - // V8 + if (Error.hasOwnProperty('captureStackTrace')) { // V8/Chrome engine Error.captureStackTrace(this, this.constructor); } else { - stacktrace = new Error(msg).stack; + stacktrace = (new Error(msg)).stack; } } if (stacktrace) { @@ -444,10 +764,6 @@ JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer -// import helpers from 'jison-helpers-lib'; -// import fs from 'fs'; - // helper: reconstruct the productions[] table function bp(s) { @@ -578,12 +894,15 @@ var parser = { // module type: ..................... es // parser engine type: .............. lalr // output main() in the module: ..... true + // has user-specified main(): ....... false + // has user-specified require()/import modules for main(): + // .................................. false // number of expected conflicts: .... 0 // // // Parser Analysis flags: // - // no significant actions (parser is a language matcher only): + // no significant actions (parser is a language matcher only): // .................................. false // uses yyleng: ..................... false // uses yylineno: ................... false @@ -2241,7 +2560,7 @@ case 112: break; case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! - // error recovery reduction action (action generated by jison, + // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -3563,7 +3882,7 @@ parse: function parse(input) { } else { ASSERT = assert; } - + this.yyGetSharedState = function yyGetSharedState() { return sharedState_yy; }; @@ -3575,7 +3894,7 @@ parse: function parse(input) { // shallow clone objects, straight copy of simple `src` values - // e.g. `lexer.yytext` MAY be a complex value object, + // e.g. `lexer.yytext` MAY be a complex value object, // rather than a simple string/value. function shallow_copy(src) { if (typeof src === 'object') { @@ -3638,7 +3957,7 @@ parse: function parse(input) { var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0)); // append to the old one? if (recoveringErrorInfo) { - var esp = recoveringErrorInfo.info_stack_pointer; + var esp = recoveringErrorInfo.info_stack_pointer; recoveringErrorInfo.symbol_stack[esp] = symbol; var v = this.shallowCopyErrorInfo(hash); @@ -3992,7 +4311,7 @@ parse: function parse(input) { // the 'expected' set won't be modified, so no need to clone it: //rv.expected = rv.expected.slice(0); - + //symbol stack is a simple array: rv.symbol_stack = rv.symbol_stack.slice(0); // ditto for state stack: @@ -4006,7 +4325,7 @@ parse: function parse(input) { // and we don't bother with the sharedState_yy reference: //delete rv.yy; - // now we prepare for tracking the COMBINE actions + // now we prepare for tracking the COMBINE actions // in the error recovery code path: // // as we want to keep the maximum error info context, we @@ -4020,15 +4339,15 @@ parse: function parse(input) { // ### Purpose of each stack pointer: // // - stack_pointer: points at the top of the parse stack - // **as it existed at the time of the error + // **as it existed at the time of the error // occurrence, i.e. at the time the stack // snapshot was taken and copied into the // errorInfo object.** - // - base_pointer: the bottom of the **empty part** of the + // - base_pointer: the bottom of the **empty part** of the // stack, i.e. **the start of the rest of - // the stack space /above/ the existing + // the stack space /above/ the existing // parse stack. This section will be filled - // by the error recovery process as it + // by the error recovery process as it // travels the parse state machine to // arrive at the resolving error recovery rule.** // - info_stack_pointer: @@ -4039,7 +4358,7 @@ parse: function parse(input) { // process. Any mutations in the **parse stack** // are **copy-appended** to this part of the // stack space, keeping the bottom part of the - // stack (the 'snapshot' part where the parse + // stack (the 'snapshot' part where the parse // state at the time of error occurrence was kept) // intact. // - root_failure_pointer: @@ -4285,7 +4604,7 @@ parse: function parse(input) { - // Protect against overly blunt userland `parseError` code which *sets* + // Protect against overly blunt userland `parseError` code which *sets* // the `recoverable` flag without properly checking first: // we always terminate the parse when there's no recovery rule available anyhow! if (!p.recoverable || error_rule_depth < 0) { @@ -4452,7 +4771,7 @@ parse: function parse(input) { // Now duplicate the standard parse machine here, at least its initial - // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, // as we wish to push something special then! @@ -4674,7 +4993,7 @@ parse: function parse(input) { break; } - // should we also break out of the regular/outer parse loop, + // should we also break out of the regular/outer parse loop, // i.e. did the parser already produce a parse result in here?! if (action === 3) { break; @@ -4893,7 +5212,7 @@ parse: function parse(input) { }); console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); } - + break; } @@ -4987,7 +5306,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-196*/ +/* lexer generated by jison-lex 0.6.1-200 */ /* * Returns a Lexer object of the following structure: @@ -5207,10 +5526,16 @@ parser.yy.post_lex = function p_lex() { var lexer = function() { - // See also: - // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 - // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility - // with userland code which might access the derived class in a 'classic' way. + /** + * See also: + * http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + * but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + * with userland code which might access the derived class in a 'classic' way. + * + * @public + * @constructor + * @nocollapse + */ function JisonLexerError(msg, hash) { Object.defineProperty(this, 'name', { enumerable: false, @@ -5265,49 +5590,47 @@ var lexer = function() { var lexer = { - // Code Generator Information Report - // --------------------------------- - // - // Options: - // - // backtracking: .................... false - // location.ranges: ................. true - // location line+column tracking: ... true - // - // - // Forwarded Parser Analysis flags: - // - // uses yyleng: ..................... false - // uses yylineno: ................... false - // uses yytext: ..................... false - // uses yylloc: ..................... false - // uses lexer values: ............... true/ true - // location tracking: ............... true - // location assignment: ............. true - // - // - // Lexer Analysis flags: - // - // uses yyleng: ..................... ??? - // uses yylineno: ................... ??? - // uses yytext: ..................... ??? - // uses yylloc: ..................... ??? - // uses ParseError API: ............. ??? - // uses yyerror: .................... ??? - // uses location tracking & editing: ??? - // uses more() API: ................. ??? - // uses unput() API: ................ ??? - // uses reject() API: ............... ??? - // uses less() API: ................. ??? - // uses display APIs pastInput(), upcomingInput(), showPosition(): - // ............................. ??? - // uses describeYYLLOC() API: ....... ??? - // - // --------- END OF REPORT ----------- - - - EOF: 1, +// Code Generator Information Report +// --------------------------------- +// +// Options: +// +// backtracking: .................... false +// location.ranges: ................. true +// location line+column tracking: ... true +// +// +// Forwarded Parser Analysis flags: +// +// uses yyleng: ..................... false +// uses yylineno: ................... false +// uses yytext: ..................... false +// uses yylloc: ..................... false +// uses lexer values: ............... true / true +// location tracking: ............... true +// location assignment: ............. true +// +// +// Lexer Analysis flags: +// +// uses yyleng: ..................... ??? +// uses yylineno: ................... ??? +// uses yytext: ..................... ??? +// uses yylloc: ..................... ??? +// uses ParseError API: ............. ??? +// uses yyerror: .................... ??? +// uses location tracking & editing: ??? +// uses more() API: ................. ??? +// uses unput() API: ................ ??? +// uses reject() API: ............... ??? +// uses less() API: ................. ??? +// uses display APIs pastInput(), upcomingInput(), showPosition(): +// ............................. ??? +// uses describeYYLLOC() API: ....... ??? +// +// --------- END OF REPORT ----------- +EOF: 1, ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator @@ -5316,24 +5639,24 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state - - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: '', /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -5346,7 +5669,7 @@ var lexer = function() { var pei = { errStr: msg, recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -5373,7 +5696,7 @@ var lexer = function() { var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && ((typeof key === 'undefined' ? 'undefined' : _typeof(key))) === 'object') { + if (this.hasOwnProperty(key) && typeof key === 'object') { this[key] = undefined; } } @@ -5531,7 +5854,7 @@ var lexer = function() { var spec = conditions[k]; var rule_ids = spec.rules; var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -5809,7 +6132,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! + maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5865,7 +6188,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! + maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5873,7 +6196,7 @@ var lexer = function() { // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } // now that we have a significantly reduced string to process, transform the newlines @@ -5951,9 +6274,9 @@ var lexer = function() { * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { - var CONTEXT = 3; - var CONTEXT_TAIL = 1; - var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; var lines = input.split('\n'); @@ -6023,7 +6346,7 @@ var lexer = function() { end: clip_end, len: clip_end - clip_start + 1, arr: nonempty_line_indexes, - rv: rv + rv }); var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; @@ -7806,6 +8129,13 @@ function yyparse() { return parser.parse.apply(parser, arguments); } -exports.parser = parser; -exports.Parser = Parser; -exports.parse = yyparse; + + +var lexParser = { + parser, + Parser, + parse: yyparse, + +}; + +module.exports = lexParser; diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 0f20d51..8be8ac5 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -1,12 +1,336 @@ -import fs from 'fs'; import XRegExp from '@gerhobbelt/xregexp'; -import helpers from 'jison-helpers-lib'; +import recast from '@gerhobbelt/recast'; +import fs from 'fs'; + +// Return TRUE if `src` starts with `searchString`. +function startsWith(src, searchString) { + return src.substr(0, searchString.length) === searchString; +} + + + +// tagged template string helper which removes the indentation common to all +// non-empty lines: that indentation was added as part of the source code +// formatting of this lexer spec file and must be removed to produce what +// we were aiming for. +// +// Each template string starts with an optional empty line, which should be +// removed entirely, followed by a first line of error reporting content text, +// which should not be indented at all, i.e. the indentation of the first +// non-empty line should be treated as the 'common' indentation and thus +// should also be removed from all subsequent lines in the same template string. +// +// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals +function rmCommonWS$1(strings, ...values) { + // As `strings[]` is an array of strings, each potentially consisting + // of multiple lines, followed by one(1) value, we have to split each + // individual string into lines to keep that bit of information intact. + // + // We assume clean code style, hence no random mix of tabs and spaces, so every + // line MUST have the same indent style as all others, so `length` of indent + // should suffice, but the way we coded this is stricter checking as we look + // for the *exact* indenting=leading whitespace in each line. + var indent_str = null; + var src = strings.map(function splitIntoLines(s) { + var a = s.split('\n'); + + indent_str = a.reduce(function analyzeLine(indent_str, line) { + var m = /^(\s*)\S/gm.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } + } + return indent_str; + }, indent_str); + + return a; + }); + + // Also note: due to the way we format the template strings in our sourcecode, + // the last line in the entire template must be empty when it has ANY trailing + // whitespace: + var a = src[src.length - 1]; + a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); + + // Done removing common indentation. + // + // Process template string partials now: + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + for (var j = 0, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } + } + } + + // now merge everything to construct the template result: + var rv = []; + for (var i = 0, len = values.length; i < len; i++) { + rv.push(src[i].join('\n')); + rv.push(values[i]); + } + // the last value is always followed by a last template string partial: + rv.push(src[i].join('\n')); + + var sv = rv.join(''); + return sv; +} + +// Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` +/** @public */ +function camelCase(s) { + // Convert first character to lowercase + return s.replace(/^\w/, function (match) { + return match.toLowerCase(); + }) + .replace(/-\w/g, function (match) { + return match.charAt(1).toUpperCase(); + }); +} + +// properly quote and escape the given input string +function dquote(s) { + var sq = (s.indexOf('\'') >= 0); + var dq = (s.indexOf('"') >= 0); + if (sq && dq) { + s = s.replace(/"/g, '\\"'); + dq = false; + } + if (dq) { + s = '\'' + s + '\''; + } + else { + s = '"' + s + '"'; + } + return s; +} + +// +// Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis +// (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) +// +// MIT Licensed +// +// +// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: +// +// the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to +// the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that +// we can test the code in a different environment so that we can see what precisely is causing the failure. +// + + +var fs$1 = require('fs'); +var path = require('path'); + + + + + +// Helper function: pad number with leading zeroes +function pad(n, p) { + p = p || 2; + var rv = '0000' + n; + return rv.slice(-p); +} + + +// attempt to dump in one of several locations: first winner is *it*! +function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { + var dumpfile; + + try { + var dumpPaths = [(options.outfile ? path.dirname(options.outfile) : null), options.inputPath, process.cwd()]; + var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname) + .replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever + .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. + if (dumpName === '' || dumpName === '_') { + dumpName = '__bugger__'; + } + err_id = err_id || 'XXX'; + + var ts = new Date(); + var tm = ts.getUTCFullYear() + + '_' + pad(ts.getUTCMonth() + 1) + + '_' + pad(ts.getUTCDate()) + + 'T' + pad(ts.getUTCHours()) + + '' + pad(ts.getUTCMinutes()) + + '' + pad(ts.getUTCSeconds()) + + '.' + pad(ts.getUTCMilliseconds(), 3) + + 'Z'; + + dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; + + for (var i = 0, l = dumpPaths.length; i < l; i++) { + if (!dumpPaths[i]) { + continue; + } + + try { + dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); + fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); + break; // abort loop once a dump action was successful! + } catch (ex3) { + //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); + if (i === l - 1) { + throw ex3; + } + } + } + } catch (ex2) { + console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); + } + + // augment the exception info, when available: + if (ex) { + ex.offending_source_code = sourcecode; + ex.offending_source_title = errname; + ex.offending_source_dumpfile = dumpfile; + } +} + + + + +// +// `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. +// When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode +// is dumped to file for later diagnosis. +// +// Two options drive the internal behaviour: +// +// - options.dumpSourceCodeOnFailure -- default: FALSE +// - options.throwErrorOnCompileFailure -- default: FALSE +// +// Dumpfile naming and path are determined through these options: +// +// - options.outfile +// - options.inputPath +// - options.inputFilename +// - options.moduleName +// - options.defaultModuleName +// +function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { + options = options || {}; + var errname = "" + (title || "exec_test"); + var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); + if (err_id.length === 0) { + err_id = "exec_crash"; + } + const debug = 0; + + if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); + if (debug > 1) console.warn(` + ######################## source code ########################## + ${sourcecode} + ######################## source code ########################## + `); + + var p; + try { + // p = eval(sourcecode); + if (typeof code_execution_rig !== 'function') { + throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); + } + p = code_execution_rig.call(this, sourcecode, options, errname, debug); + } catch (ex) { + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); + + if (debug > 1) console.log("exec-and-diagnose options:", options); + + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (options.dumpSourceCodeOnFailure) { + dumpSourceToFile(sourcecode, errname, err_id, options, ex); + } + + if (options.throwErrorOnCompileFailure) { + throw ex; + } + } + return p; +} + +// +// Parse a given chunk of code to an AST. +// +// MIT Licensed +// +// +// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: +// +// would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? +// + + +//import astUtils from '@gerhobbelt/ast-util'; +//import prettier from '@gerhobbelt/prettier-miscellaneous'; +//import assert from 'assert'; + +// assert(recast); +// var types = recast.types; +// assert(types); +// var namedTypes = types.namedTypes; +// assert(namedTypes); +// var b = types.builders; +// assert(b); +// //assert(astUtils); + + + + +function parseCodeChunkToAST(src, options) { + var ast = recast.parse(src); + return ast; +} + + + + +function prettyPrintAST(ast, options) { + var new_src; + + { + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; + } + + new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup + return new_src; +} + +var helpers = { + rmCommonWS: rmCommonWS$1, + camelCase, + dquote, + + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile, + + parseCodeChunkToAST, + prettyPrintAST, +}; // hack: var assert; - -/* parser generated by jison 0.6.0-194 */ +/* parser generated by jison 0.6.1-200 */ /* * Returns a Parser object of the following structure: @@ -188,11 +512,11 @@ var assert; * * WARNING: * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with - * any attributes already added to `yy` by the jison run-time; - * when such a collision is detected an exception is thrown to prevent the generated run-time + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time * from silently accepting this confusing and potentially hazardous situation! * - * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in * the lexer section of the grammar spec): these will be inserted in the `yy` shared state * object and any collision with those will be reported by the lexer via a thrown exception. * @@ -384,7 +708,6 @@ var assert; */ - // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility @@ -413,11 +736,10 @@ function JisonParserError(msg, hash) { stacktrace = ex2.stack; } if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { - // V8 + if (Error.hasOwnProperty('captureStackTrace')) { // V8/Chrome engine Error.captureStackTrace(this, this.constructor); } else { - stacktrace = new Error(msg).stack; + stacktrace = (new Error(msg)).stack; } } if (stacktrace) { @@ -438,10 +760,6 @@ JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer -// import helpers from 'jison-helpers-lib'; -// import fs from 'fs'; - // helper: reconstruct the productions[] table function bp(s) { @@ -572,12 +890,15 @@ var parser = { // module type: ..................... es // parser engine type: .............. lalr // output main() in the module: ..... true + // has user-specified main(): ....... false + // has user-specified require()/import modules for main(): + // .................................. false // number of expected conflicts: .... 0 // // // Parser Analysis flags: // - // no significant actions (parser is a language matcher only): + // no significant actions (parser is a language matcher only): // .................................. false // uses yyleng: ..................... false // uses yylineno: ................... false @@ -2235,7 +2556,7 @@ case 112: break; case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! - // error recovery reduction action (action generated by jison, + // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -3557,7 +3878,7 @@ parse: function parse(input) { } else { ASSERT = assert; } - + this.yyGetSharedState = function yyGetSharedState() { return sharedState_yy; }; @@ -3569,7 +3890,7 @@ parse: function parse(input) { // shallow clone objects, straight copy of simple `src` values - // e.g. `lexer.yytext` MAY be a complex value object, + // e.g. `lexer.yytext` MAY be a complex value object, // rather than a simple string/value. function shallow_copy(src) { if (typeof src === 'object') { @@ -3632,7 +3953,7 @@ parse: function parse(input) { var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0)); // append to the old one? if (recoveringErrorInfo) { - var esp = recoveringErrorInfo.info_stack_pointer; + var esp = recoveringErrorInfo.info_stack_pointer; recoveringErrorInfo.symbol_stack[esp] = symbol; var v = this.shallowCopyErrorInfo(hash); @@ -3986,7 +4307,7 @@ parse: function parse(input) { // the 'expected' set won't be modified, so no need to clone it: //rv.expected = rv.expected.slice(0); - + //symbol stack is a simple array: rv.symbol_stack = rv.symbol_stack.slice(0); // ditto for state stack: @@ -4000,7 +4321,7 @@ parse: function parse(input) { // and we don't bother with the sharedState_yy reference: //delete rv.yy; - // now we prepare for tracking the COMBINE actions + // now we prepare for tracking the COMBINE actions // in the error recovery code path: // // as we want to keep the maximum error info context, we @@ -4014,15 +4335,15 @@ parse: function parse(input) { // ### Purpose of each stack pointer: // // - stack_pointer: points at the top of the parse stack - // **as it existed at the time of the error + // **as it existed at the time of the error // occurrence, i.e. at the time the stack // snapshot was taken and copied into the // errorInfo object.** - // - base_pointer: the bottom of the **empty part** of the + // - base_pointer: the bottom of the **empty part** of the // stack, i.e. **the start of the rest of - // the stack space /above/ the existing + // the stack space /above/ the existing // parse stack. This section will be filled - // by the error recovery process as it + // by the error recovery process as it // travels the parse state machine to // arrive at the resolving error recovery rule.** // - info_stack_pointer: @@ -4033,7 +4354,7 @@ parse: function parse(input) { // process. Any mutations in the **parse stack** // are **copy-appended** to this part of the // stack space, keeping the bottom part of the - // stack (the 'snapshot' part where the parse + // stack (the 'snapshot' part where the parse // state at the time of error occurrence was kept) // intact. // - root_failure_pointer: @@ -4279,7 +4600,7 @@ parse: function parse(input) { - // Protect against overly blunt userland `parseError` code which *sets* + // Protect against overly blunt userland `parseError` code which *sets* // the `recoverable` flag without properly checking first: // we always terminate the parse when there's no recovery rule available anyhow! if (!p.recoverable || error_rule_depth < 0) { @@ -4446,7 +4767,7 @@ parse: function parse(input) { // Now duplicate the standard parse machine here, at least its initial - // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, // as we wish to push something special then! @@ -4668,7 +4989,7 @@ parse: function parse(input) { break; } - // should we also break out of the regular/outer parse loop, + // should we also break out of the regular/outer parse loop, // i.e. did the parser already produce a parse result in here?! if (action === 3) { break; @@ -4887,7 +5208,7 @@ parse: function parse(input) { }); console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); } - + break; } @@ -4981,7 +5302,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-196*/ +/* lexer generated by jison-lex 0.6.1-200 */ /* * Returns a Lexer object of the following structure: @@ -5201,10 +5522,16 @@ parser.yy.post_lex = function p_lex() { var lexer = function() { - // See also: - // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 - // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility - // with userland code which might access the derived class in a 'classic' way. + /** + * See also: + * http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + * but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + * with userland code which might access the derived class in a 'classic' way. + * + * @public + * @constructor + * @nocollapse + */ function JisonLexerError(msg, hash) { Object.defineProperty(this, 'name', { enumerable: false, @@ -5259,49 +5586,47 @@ var lexer = function() { var lexer = { - // Code Generator Information Report - // --------------------------------- - // - // Options: - // - // backtracking: .................... false - // location.ranges: ................. true - // location line+column tracking: ... true - // - // - // Forwarded Parser Analysis flags: - // - // uses yyleng: ..................... false - // uses yylineno: ................... false - // uses yytext: ..................... false - // uses yylloc: ..................... false - // uses lexer values: ............... true/ true - // location tracking: ............... true - // location assignment: ............. true - // - // - // Lexer Analysis flags: - // - // uses yyleng: ..................... ??? - // uses yylineno: ................... ??? - // uses yytext: ..................... ??? - // uses yylloc: ..................... ??? - // uses ParseError API: ............. ??? - // uses yyerror: .................... ??? - // uses location tracking & editing: ??? - // uses more() API: ................. ??? - // uses unput() API: ................ ??? - // uses reject() API: ............... ??? - // uses less() API: ................. ??? - // uses display APIs pastInput(), upcomingInput(), showPosition(): - // ............................. ??? - // uses describeYYLLOC() API: ....... ??? - // - // --------- END OF REPORT ----------- - - - EOF: 1, +// Code Generator Information Report +// --------------------------------- +// +// Options: +// +// backtracking: .................... false +// location.ranges: ................. true +// location line+column tracking: ... true +// +// +// Forwarded Parser Analysis flags: +// +// uses yyleng: ..................... false +// uses yylineno: ................... false +// uses yytext: ..................... false +// uses yylloc: ..................... false +// uses lexer values: ............... true / true +// location tracking: ............... true +// location assignment: ............. true +// +// +// Lexer Analysis flags: +// +// uses yyleng: ..................... ??? +// uses yylineno: ................... ??? +// uses yytext: ..................... ??? +// uses yylloc: ..................... ??? +// uses ParseError API: ............. ??? +// uses yyerror: .................... ??? +// uses location tracking & editing: ??? +// uses more() API: ................. ??? +// uses unput() API: ................ ??? +// uses reject() API: ............... ??? +// uses less() API: ................. ??? +// uses display APIs pastInput(), upcomingInput(), showPosition(): +// ............................. ??? +// uses describeYYLLOC() API: ....... ??? +// +// --------- END OF REPORT ----------- +EOF: 1, ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator @@ -5310,24 +5635,24 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state - - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: '', /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -5340,7 +5665,7 @@ var lexer = function() { var pei = { errStr: msg, recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -5367,7 +5692,7 @@ var lexer = function() { var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && ((typeof key === 'undefined' ? 'undefined' : _typeof(key))) === 'object') { + if (this.hasOwnProperty(key) && typeof key === 'object') { this[key] = undefined; } } @@ -5525,7 +5850,7 @@ var lexer = function() { var spec = conditions[k]; var rule_ids = spec.rules; var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -5803,7 +6128,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! + maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5859,7 +6184,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! + maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5867,7 +6192,7 @@ var lexer = function() { // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } // now that we have a significantly reduced string to process, transform the newlines @@ -5945,9 +6270,9 @@ var lexer = function() { * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { - var CONTEXT = 3; - var CONTEXT_TAIL = 1; - var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; var lines = input.split('\n'); @@ -6017,7 +6342,7 @@ var lexer = function() { end: clip_end, len: clip_end - clip_start + 1, arr: nonempty_line_indexes, - rv: rv + rv }); var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; @@ -7800,4 +8125,13 @@ function yyparse() { return parser.parse.apply(parser, arguments); } -export { parser, Parser, yyparse as parse }; + + +var lexParser = { + parser, + Parser, + parse: yyparse, + +}; + +export default lexParser; diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js index 8012fa5..b041161 100644 --- a/dist/lex-parser-umd-es5.js +++ b/dist/lex-parser-umd-es5.js @@ -1,6 +1,6 @@ 'use strict'; -var _typeof2 = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; +var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), _templateObject2 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), @@ -32,18 +32,319 @@ var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not corre function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } (function (global, factory) { - (typeof exports === 'undefined' ? 'undefined' : _typeof2(exports)) === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs'), require('@gerhobbelt/xregexp'), require('jison-helpers-lib')) : typeof define === 'function' && define.amd ? define(['exports', 'fs', '@gerhobbelt/xregexp', 'jison-helpers-lib'], factory) : factory(global['lex-parser'] = {}, global.fs, global.XRegExp, global.helpers); -})(undefined, function (exports, fs, XRegExp, helpers) { + (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('@gerhobbelt/recast'), require('fs')) : typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', '@gerhobbelt/recast', 'fs'], factory) : global['lex-parser'] = factory(global.XRegExp, global.recast, global.fs); +})(undefined, function (XRegExp, recast, fs) { 'use strict'; - fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; XRegExp = XRegExp && XRegExp.hasOwnProperty('default') ? XRegExp['default'] : XRegExp; - helpers = helpers && helpers.hasOwnProperty('default') ? helpers['default'] : helpers; + recast = recast && recast.hasOwnProperty('default') ? recast['default'] : recast; + fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; + + // Return TRUE if `src` starts with `searchString`. + function startsWith(src, searchString) { + return src.substr(0, searchString.length) === searchString; + } + + // tagged template string helper which removes the indentation common to all + // non-empty lines: that indentation was added as part of the source code + // formatting of this lexer spec file and must be removed to produce what + // we were aiming for. + // + // Each template string starts with an optional empty line, which should be + // removed entirely, followed by a first line of error reporting content text, + // which should not be indented at all, i.e. the indentation of the first + // non-empty line should be treated as the 'common' indentation and thus + // should also be removed from all subsequent lines in the same template string. + // + // See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals + function rmCommonWS$1(strings) { + // As `strings[]` is an array of strings, each potentially consisting + // of multiple lines, followed by one(1) value, we have to split each + // individual string into lines to keep that bit of information intact. + // + // We assume clean code style, hence no random mix of tabs and spaces, so every + // line MUST have the same indent style as all others, so `length` of indent + // should suffice, but the way we coded this is stricter checking as we look + // for the *exact* indenting=leading whitespace in each line. + var indent_str = null; + var src = strings.map(function splitIntoLines(s) { + var a = s.split('\n'); + + indent_str = a.reduce(function analyzeLine(indent_str, line) { + var m = /^(\s*)\S/gm.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } + } + return indent_str; + }, indent_str); + + return a; + }); + + // Also note: due to the way we format the template strings in our sourcecode, + // the last line in the entire template must be empty when it has ANY trailing + // whitespace: + var a = src[src.length - 1]; + a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); + + // Done removing common indentation. + // + // Process template string partials now: + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + for (var j = 0, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } + } + } + + // now merge everything to construct the template result: + var rv = []; + + for (var _len = arguments.length, values = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + values[_key - 1] = arguments[_key]; + } + + for (var i = 0, len = values.length; i < len; i++) { + rv.push(src[i].join('\n')); + rv.push(values[i]); + } + // the last value is always followed by a last template string partial: + rv.push(src[i].join('\n')); + + var sv = rv.join(''); + return sv; + } + + // Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` + /** @public */ + function camelCase(s) { + // Convert first character to lowercase + return s.replace(/^\w/, function (match) { + return match.toLowerCase(); + }).replace(/-\w/g, function (match) { + return match.charAt(1).toUpperCase(); + }); + } + + // properly quote and escape the given input string + function dquote(s) { + var sq = s.indexOf('\'') >= 0; + var dq = s.indexOf('"') >= 0; + if (sq && dq) { + s = s.replace(/"/g, '\\"'); + dq = false; + } + if (dq) { + s = '\'' + s + '\''; + } else { + s = '"' + s + '"'; + } + return s; + } + + // + // Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis + // (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) + // + // MIT Licensed + // + // + // This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: + // + // the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to + // the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that + // we can test the code in a different environment so that we can see what precisely is causing the failure. + // + + + var fs$1 = require('fs'); + var path = require('path'); + + // Helper function: pad number with leading zeroes + function pad(n, p) { + p = p || 2; + var rv = '0000' + n; + return rv.slice(-p); + } + + // attempt to dump in one of several locations: first winner is *it*! + function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { + var dumpfile; + + try { + var dumpPaths = [options.outfile ? path.dirname(options.outfile) : null, options.inputPath, process.cwd()]; + var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname).replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever + .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. + if (dumpName === '' || dumpName === '_') { + dumpName = '__bugger__'; + } + err_id = err_id || 'XXX'; + + var ts = new Date(); + var tm = ts.getUTCFullYear() + '_' + pad(ts.getUTCMonth() + 1) + '_' + pad(ts.getUTCDate()) + 'T' + pad(ts.getUTCHours()) + '' + pad(ts.getUTCMinutes()) + '' + pad(ts.getUTCSeconds()) + '.' + pad(ts.getUTCMilliseconds(), 3) + 'Z'; + + dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; + + for (var i = 0, l = dumpPaths.length; i < l; i++) { + if (!dumpPaths[i]) { + continue; + } + + try { + dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); + fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); + break; // abort loop once a dump action was successful! + } catch (ex3) { + //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); + if (i === l - 1) { + throw ex3; + } + } + } + } catch (ex2) { + console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); + } + + // augment the exception info, when available: + if (ex) { + ex.offending_source_code = sourcecode; + ex.offending_source_title = errname; + ex.offending_source_dumpfile = dumpfile; + } + } + + // + // `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. + // When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode + // is dumped to file for later diagnosis. + // + // Two options drive the internal behaviour: + // + // - options.dumpSourceCodeOnFailure -- default: FALSE + // - options.throwErrorOnCompileFailure -- default: FALSE + // + // Dumpfile naming and path are determined through these options: + // + // - options.outfile + // - options.inputPath + // - options.inputFilename + // - options.moduleName + // - options.defaultModuleName + // + function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { + options = options || {}; + var errname = "" + (title || "exec_test"); + var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); + if (err_id.length === 0) { + err_id = "exec_crash"; + } + var debug = 0; + + if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); + if (debug > 1) console.warn('\n ######################## source code ##########################\n ' + sourcecode + '\n ######################## source code ##########################\n '); + + var p; + try { + // p = eval(sourcecode); + if (typeof code_execution_rig !== 'function') { + throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); + } + p = code_execution_rig.call(this, sourcecode, options, errname, debug); + } catch (ex) { + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); + + if (debug > 1) console.log("exec-and-diagnose options:", options); + + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (options.dumpSourceCodeOnFailure) { + dumpSourceToFile(sourcecode, errname, err_id, options, ex); + } + + if (options.throwErrorOnCompileFailure) { + throw ex; + } + } + return p; + } + + // + // Parse a given chunk of code to an AST. + // + // MIT Licensed + // + // + // This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: + // + // would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? + // + + + //import astUtils from '@gerhobbelt/ast-util'; + //import prettier from '@gerhobbelt/prettier-miscellaneous'; + //import assert from 'assert'; + + // assert(recast); + // var types = recast.types; + // assert(types); + // var namedTypes = types.namedTypes; + // assert(namedTypes); + // var b = types.builders; + // assert(b); + // //assert(astUtils); + + + function parseCodeChunkToAST(src, options) { + var ast = recast.parse(src); + return ast; + } + + function prettyPrintAST(ast, options) { + var new_src; + + { + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; + } + + new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup + return new_src; + } + + var helpers = { + rmCommonWS: rmCommonWS$1, + camelCase: camelCase, + dquote: dquote, + + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile, + + parseCodeChunkToAST: parseCodeChunkToAST, + prettyPrintAST: prettyPrintAST + }; // hack: var assert; - /* parser generated by jison 0.6.0-194 */ + /* parser generated by jison 0.6.1-200 */ /* * Returns a Parser object of the following structure: @@ -225,11 +526,11 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi * * WARNING: * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with - * any attributes already added to `yy` by the jison run-time; - * when such a collision is detected an exception is thrown to prevent the generated run-time + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time * from silently accepting this confusing and potentially hazardous situation! * - * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in * the lexer section of the grammar spec): these will be inserted in the `yy` shared state * object and any collision with those will be reported by the lexer via a thrown exception. * @@ -449,7 +750,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi } if (!stacktrace) { if (Error.hasOwnProperty('captureStackTrace')) { - // V8 + // V8/Chrome engine Error.captureStackTrace(this, this.constructor); } else { stacktrace = new Error(msg).stack; @@ -472,11 +773,6 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; - // import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer - // import helpers from 'jison-helpers-lib'; - // import fs from 'fs'; - - // helper: reconstruct the productions[] table function bp(s) { var rv = []; @@ -591,12 +887,15 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // module type: ..................... es // parser engine type: .............. lalr // output main() in the module: ..... true + // has user-specified main(): ....... false + // has user-specified require()/import modules for main(): + // .................................. false // number of expected conflicts: .... 0 // // // Parser Analysis flags: // - // no significant actions (parser is a language matcher only): + // no significant actions (parser is a language matcher only): // .................................. false // uses yyleng: ..................... false // uses yylineno: ................... false @@ -1958,7 +2257,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! - // error recovery reduction action (action generated by jison, + // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -2049,10 +2348,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; // shallow clone objects, straight copy of simple `src` values - // e.g. `lexer.yytext` MAY be a complex value object, + // e.g. `lexer.yytext` MAY be a complex value object, // rather than a simple string/value. function shallow_copy(src) { - if ((typeof src === 'undefined' ? 'undefined' : _typeof2(src)) === 'object') { + if ((typeof src === 'undefined' ? 'undefined' : _typeof(src)) === 'object') { var dst = {}; for (var k in src) { if (Object.prototype.hasOwnProperty.call(src, k)) { @@ -2411,7 +2710,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // ... var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof2(key)) === 'object') { + if (this.hasOwnProperty(key) && (typeof key === 'undefined' ? 'undefined' : _typeof(key)) === 'object') { this[key] = undefined; } } @@ -2456,7 +2755,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // and we don't bother with the sharedState_yy reference: //delete rv.yy; - // now we prepare for tracking the COMBINE actions + // now we prepare for tracking the COMBINE actions // in the error recovery code path: // // as we want to keep the maximum error info context, we @@ -2470,15 +2769,15 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // ### Purpose of each stack pointer: // // - stack_pointer: points at the top of the parse stack - // **as it existed at the time of the error + // **as it existed at the time of the error // occurrence, i.e. at the time the stack // snapshot was taken and copied into the // errorInfo object.** - // - base_pointer: the bottom of the **empty part** of the + // - base_pointer: the bottom of the **empty part** of the // stack, i.e. **the start of the rest of - // the stack space /above/ the existing + // the stack space /above/ the existing // parse stack. This section will be filled - // by the error recovery process as it + // by the error recovery process as it // travels the parse state machine to // arrive at the resolving error recovery rule.** // - info_stack_pointer: @@ -2489,7 +2788,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // process. Any mutations in the **parse stack** // are **copy-appended** to this part of the // stack space, keeping the bottom part of the - // stack (the 'snapshot' part where the parse + // stack (the 'snapshot' part where the parse // state at the time of error occurrence was kept) // intact. // - root_failure_pointer: @@ -2679,7 +2978,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi r = this.parseError(p.errStr, p, this.JisonParserError); - // Protect against overly blunt userland `parseError` code which *sets* + // Protect against overly blunt userland `parseError` code which *sets* // the `recoverable` flag without properly checking first: // we always terminate the parse when there's no recovery rule available anyhow! if (!p.recoverable || error_rule_depth < 0) { @@ -2801,7 +3100,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi recovering = ERROR_RECOVERY_TOKEN_DISCARD_COUNT; // Now duplicate the standard parse machine here, at least its initial - // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, // as we wish to push something special then! @@ -2964,7 +3263,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi break; } - // should we also break out of the regular/outer parse loop, + // should we also break out of the regular/outer parse loop, // i.e. did the parser already produce a parse result in here?! if (action === 3) { break; @@ -3222,7 +3521,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; - /* lexer generated by jison-lex 0.6.0-196*/ + /* lexer generated by jison-lex 0.6.1-200 */ /* * Returns a Lexer object of the following structure: @@ -3441,10 +3740,16 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi */ var lexer = function () { - // See also: - // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 - // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility - // with userland code which might access the derived class in a 'classic' way. + /** + * See also: + * http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + * but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + * with userland code which might access the derived class in a 'classic' way. + * + * @public + * @constructor + * @nocollapse + */ function JisonLexerError(msg, hash) { Object.defineProperty(this, 'name', { enumerable: false, @@ -3514,7 +3819,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // uses yylineno: ................... false // uses yytext: ..................... false // uses yylloc: ..................... false - // uses lexer values: ............... true/ true + // uses lexer values: ............... true / true // location tracking: ............... true // location assignment: ............. true // @@ -3538,9 +3843,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // // --------- END OF REPORT ----------- - EOF: 1, - ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator @@ -5685,9 +5988,12 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return parser.parse.apply(parser, arguments); } - exports.parser = parser; - exports.Parser = Parser; - exports.parse = yyparse; + var lexParser = { + parser: parser, + Parser: Parser, + parse: yyparse + + }; - Object.defineProperty(exports, '__esModule', { value: true }); + return lexParser; }); diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js index de5d955..066c415 100644 --- a/dist/lex-parser-umd.js +++ b/dist/lex-parser-umd.js @@ -1,18 +1,342 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('fs'), require('@gerhobbelt/xregexp'), require('jison-helpers-lib')) : - typeof define === 'function' && define.amd ? define(['exports', 'fs', '@gerhobbelt/xregexp', 'jison-helpers-lib'], factory) : - (factory((global['lex-parser'] = {}),global.fs,global.XRegExp,global.helpers)); -}(this, (function (exports,fs,XRegExp,helpers) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('@gerhobbelt/recast'), require('fs')) : + typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', '@gerhobbelt/recast', 'fs'], factory) : + (global['lex-parser'] = factory(global.XRegExp,global.recast,global.fs)); +}(this, (function (XRegExp,recast,fs) { 'use strict'; -fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; XRegExp = XRegExp && XRegExp.hasOwnProperty('default') ? XRegExp['default'] : XRegExp; -helpers = helpers && helpers.hasOwnProperty('default') ? helpers['default'] : helpers; +recast = recast && recast.hasOwnProperty('default') ? recast['default'] : recast; +fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; + +// Return TRUE if `src` starts with `searchString`. +function startsWith(src, searchString) { + return src.substr(0, searchString.length) === searchString; +} + + + +// tagged template string helper which removes the indentation common to all +// non-empty lines: that indentation was added as part of the source code +// formatting of this lexer spec file and must be removed to produce what +// we were aiming for. +// +// Each template string starts with an optional empty line, which should be +// removed entirely, followed by a first line of error reporting content text, +// which should not be indented at all, i.e. the indentation of the first +// non-empty line should be treated as the 'common' indentation and thus +// should also be removed from all subsequent lines in the same template string. +// +// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals +function rmCommonWS$1(strings, ...values) { + // As `strings[]` is an array of strings, each potentially consisting + // of multiple lines, followed by one(1) value, we have to split each + // individual string into lines to keep that bit of information intact. + // + // We assume clean code style, hence no random mix of tabs and spaces, so every + // line MUST have the same indent style as all others, so `length` of indent + // should suffice, but the way we coded this is stricter checking as we look + // for the *exact* indenting=leading whitespace in each line. + var indent_str = null; + var src = strings.map(function splitIntoLines(s) { + var a = s.split('\n'); + + indent_str = a.reduce(function analyzeLine(indent_str, line) { + var m = /^(\s*)\S/gm.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } + } + return indent_str; + }, indent_str); + + return a; + }); + + // Also note: due to the way we format the template strings in our sourcecode, + // the last line in the entire template must be empty when it has ANY trailing + // whitespace: + var a = src[src.length - 1]; + a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); + + // Done removing common indentation. + // + // Process template string partials now: + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + for (var j = 0, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } + } + } + + // now merge everything to construct the template result: + var rv = []; + for (var i = 0, len = values.length; i < len; i++) { + rv.push(src[i].join('\n')); + rv.push(values[i]); + } + // the last value is always followed by a last template string partial: + rv.push(src[i].join('\n')); + + var sv = rv.join(''); + return sv; +} + +// Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` +/** @public */ +function camelCase(s) { + // Convert first character to lowercase + return s.replace(/^\w/, function (match) { + return match.toLowerCase(); + }) + .replace(/-\w/g, function (match) { + return match.charAt(1).toUpperCase(); + }); +} + +// properly quote and escape the given input string +function dquote(s) { + var sq = (s.indexOf('\'') >= 0); + var dq = (s.indexOf('"') >= 0); + if (sq && dq) { + s = s.replace(/"/g, '\\"'); + dq = false; + } + if (dq) { + s = '\'' + s + '\''; + } + else { + s = '"' + s + '"'; + } + return s; +} + +// +// Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis +// (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) +// +// MIT Licensed +// +// +// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: +// +// the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to +// the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that +// we can test the code in a different environment so that we can see what precisely is causing the failure. +// + + +var fs$1 = require('fs'); +var path = require('path'); + + + + + +// Helper function: pad number with leading zeroes +function pad(n, p) { + p = p || 2; + var rv = '0000' + n; + return rv.slice(-p); +} + + +// attempt to dump in one of several locations: first winner is *it*! +function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { + var dumpfile; + + try { + var dumpPaths = [(options.outfile ? path.dirname(options.outfile) : null), options.inputPath, process.cwd()]; + var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname) + .replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever + .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. + if (dumpName === '' || dumpName === '_') { + dumpName = '__bugger__'; + } + err_id = err_id || 'XXX'; + + var ts = new Date(); + var tm = ts.getUTCFullYear() + + '_' + pad(ts.getUTCMonth() + 1) + + '_' + pad(ts.getUTCDate()) + + 'T' + pad(ts.getUTCHours()) + + '' + pad(ts.getUTCMinutes()) + + '' + pad(ts.getUTCSeconds()) + + '.' + pad(ts.getUTCMilliseconds(), 3) + + 'Z'; + + dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; + + for (var i = 0, l = dumpPaths.length; i < l; i++) { + if (!dumpPaths[i]) { + continue; + } + + try { + dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); + fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); + break; // abort loop once a dump action was successful! + } catch (ex3) { + //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); + if (i === l - 1) { + throw ex3; + } + } + } + } catch (ex2) { + console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); + } + + // augment the exception info, when available: + if (ex) { + ex.offending_source_code = sourcecode; + ex.offending_source_title = errname; + ex.offending_source_dumpfile = dumpfile; + } +} + + + + +// +// `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. +// When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode +// is dumped to file for later diagnosis. +// +// Two options drive the internal behaviour: +// +// - options.dumpSourceCodeOnFailure -- default: FALSE +// - options.throwErrorOnCompileFailure -- default: FALSE +// +// Dumpfile naming and path are determined through these options: +// +// - options.outfile +// - options.inputPath +// - options.inputFilename +// - options.moduleName +// - options.defaultModuleName +// +function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { + options = options || {}; + var errname = "" + (title || "exec_test"); + var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); + if (err_id.length === 0) { + err_id = "exec_crash"; + } + const debug = 0; + + if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); + if (debug > 1) console.warn(` + ######################## source code ########################## + ${sourcecode} + ######################## source code ########################## + `); + + var p; + try { + // p = eval(sourcecode); + if (typeof code_execution_rig !== 'function') { + throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); + } + p = code_execution_rig.call(this, sourcecode, options, errname, debug); + } catch (ex) { + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); + + if (debug > 1) console.log("exec-and-diagnose options:", options); + + if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); + + if (options.dumpSourceCodeOnFailure) { + dumpSourceToFile(sourcecode, errname, err_id, options, ex); + } + + if (options.throwErrorOnCompileFailure) { + throw ex; + } + } + return p; +} + +// +// Parse a given chunk of code to an AST. +// +// MIT Licensed +// +// +// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: +// +// would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? +// + + +//import astUtils from '@gerhobbelt/ast-util'; +//import prettier from '@gerhobbelt/prettier-miscellaneous'; +//import assert from 'assert'; + +// assert(recast); +// var types = recast.types; +// assert(types); +// var namedTypes = types.namedTypes; +// assert(namedTypes); +// var b = types.builders; +// assert(b); +// //assert(astUtils); + + + + +function parseCodeChunkToAST(src, options) { + var ast = recast.parse(src); + return ast; +} + + + + +function prettyPrintAST(ast, options) { + var new_src; + + { + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; + } + + new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup + return new_src; +} + +var helpers = { + rmCommonWS: rmCommonWS$1, + camelCase, + dquote, + + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile, + + parseCodeChunkToAST, + prettyPrintAST, +}; // hack: var assert; - -/* parser generated by jison 0.6.0-194 */ +/* parser generated by jison 0.6.1-200 */ /* * Returns a Parser object of the following structure: @@ -194,11 +518,11 @@ var assert; * * WARNING: * Parser's additional `args...` parameters (via `%parse-param`) MAY conflict with - * any attributes already added to `yy` by the jison run-time; - * when such a collision is detected an exception is thrown to prevent the generated run-time + * any attributes already added to `yy` by the jison run-time; + * when such a collision is detected an exception is thrown to prevent the generated run-time * from silently accepting this confusing and potentially hazardous situation! * - * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in + * The lexer MAY add its own set of additional parameters (via the `%parse-param` line in * the lexer section of the grammar spec): these will be inserted in the `yy` shared state * object and any collision with those will be reported by the lexer via a thrown exception. * @@ -390,7 +714,6 @@ var assert; */ - // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility @@ -419,11 +742,10 @@ function JisonParserError(msg, hash) { stacktrace = ex2.stack; } if (!stacktrace) { - if (Error.hasOwnProperty('captureStackTrace')) { - // V8 + if (Error.hasOwnProperty('captureStackTrace')) { // V8/Chrome engine Error.captureStackTrace(this, this.constructor); } else { - stacktrace = new Error(msg).stack; + stacktrace = (new Error(msg)).stack; } } if (stacktrace) { @@ -444,10 +766,6 @@ JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer -// import helpers from 'jison-helpers-lib'; -// import fs from 'fs'; - // helper: reconstruct the productions[] table function bp(s) { @@ -578,12 +896,15 @@ var parser = { // module type: ..................... es // parser engine type: .............. lalr // output main() in the module: ..... true + // has user-specified main(): ....... false + // has user-specified require()/import modules for main(): + // .................................. false // number of expected conflicts: .... 0 // // // Parser Analysis flags: // - // no significant actions (parser is a language matcher only): + // no significant actions (parser is a language matcher only): // .................................. false // uses yyleng: ..................... false // uses yylineno: ................... false @@ -2241,7 +2562,7 @@ case 112: break; case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! - // error recovery reduction action (action generated by jison, + // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -3563,7 +3884,7 @@ parse: function parse(input) { } else { ASSERT = assert; } - + this.yyGetSharedState = function yyGetSharedState() { return sharedState_yy; }; @@ -3575,7 +3896,7 @@ parse: function parse(input) { // shallow clone objects, straight copy of simple `src` values - // e.g. `lexer.yytext` MAY be a complex value object, + // e.g. `lexer.yytext` MAY be a complex value object, // rather than a simple string/value. function shallow_copy(src) { if (typeof src === 'object') { @@ -3638,7 +3959,7 @@ parse: function parse(input) { var hash = this.constructParseErrorInfo(str, null, expected, (error_rule_depth >= 0)); // append to the old one? if (recoveringErrorInfo) { - var esp = recoveringErrorInfo.info_stack_pointer; + var esp = recoveringErrorInfo.info_stack_pointer; recoveringErrorInfo.symbol_stack[esp] = symbol; var v = this.shallowCopyErrorInfo(hash); @@ -3992,7 +4313,7 @@ parse: function parse(input) { // the 'expected' set won't be modified, so no need to clone it: //rv.expected = rv.expected.slice(0); - + //symbol stack is a simple array: rv.symbol_stack = rv.symbol_stack.slice(0); // ditto for state stack: @@ -4006,7 +4327,7 @@ parse: function parse(input) { // and we don't bother with the sharedState_yy reference: //delete rv.yy; - // now we prepare for tracking the COMBINE actions + // now we prepare for tracking the COMBINE actions // in the error recovery code path: // // as we want to keep the maximum error info context, we @@ -4020,15 +4341,15 @@ parse: function parse(input) { // ### Purpose of each stack pointer: // // - stack_pointer: points at the top of the parse stack - // **as it existed at the time of the error + // **as it existed at the time of the error // occurrence, i.e. at the time the stack // snapshot was taken and copied into the // errorInfo object.** - // - base_pointer: the bottom of the **empty part** of the + // - base_pointer: the bottom of the **empty part** of the // stack, i.e. **the start of the rest of - // the stack space /above/ the existing + // the stack space /above/ the existing // parse stack. This section will be filled - // by the error recovery process as it + // by the error recovery process as it // travels the parse state machine to // arrive at the resolving error recovery rule.** // - info_stack_pointer: @@ -4039,7 +4360,7 @@ parse: function parse(input) { // process. Any mutations in the **parse stack** // are **copy-appended** to this part of the // stack space, keeping the bottom part of the - // stack (the 'snapshot' part where the parse + // stack (the 'snapshot' part where the parse // state at the time of error occurrence was kept) // intact. // - root_failure_pointer: @@ -4285,7 +4606,7 @@ parse: function parse(input) { - // Protect against overly blunt userland `parseError` code which *sets* + // Protect against overly blunt userland `parseError` code which *sets* // the `recoverable` flag without properly checking first: // we always terminate the parse when there's no recovery rule available anyhow! if (!p.recoverable || error_rule_depth < 0) { @@ -4452,7 +4773,7 @@ parse: function parse(input) { // Now duplicate the standard parse machine here, at least its initial - // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, + // couple of rounds until the TERROR symbol is **pushed onto the parse stack**, // as we wish to push something special then! @@ -4674,7 +4995,7 @@ parse: function parse(input) { break; } - // should we also break out of the regular/outer parse loop, + // should we also break out of the regular/outer parse loop, // i.e. did the parser already produce a parse result in here?! if (action === 3) { break; @@ -4893,7 +5214,7 @@ parse: function parse(input) { }); console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); } - + break; } @@ -4987,7 +5308,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.0-196*/ +/* lexer generated by jison-lex 0.6.1-200 */ /* * Returns a Lexer object of the following structure: @@ -5207,10 +5528,16 @@ parser.yy.post_lex = function p_lex() { var lexer = function() { - // See also: - // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 - // but we keep the prototype.constructor and prototype.name assignment lines too for compatibility - // with userland code which might access the derived class in a 'classic' way. + /** + * See also: + * http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 + * but we keep the prototype.constructor and prototype.name assignment lines too for compatibility + * with userland code which might access the derived class in a 'classic' way. + * + * @public + * @constructor + * @nocollapse + */ function JisonLexerError(msg, hash) { Object.defineProperty(this, 'name', { enumerable: false, @@ -5265,49 +5592,47 @@ var lexer = function() { var lexer = { - // Code Generator Information Report - // --------------------------------- - // - // Options: - // - // backtracking: .................... false - // location.ranges: ................. true - // location line+column tracking: ... true - // - // - // Forwarded Parser Analysis flags: - // - // uses yyleng: ..................... false - // uses yylineno: ................... false - // uses yytext: ..................... false - // uses yylloc: ..................... false - // uses lexer values: ............... true/ true - // location tracking: ............... true - // location assignment: ............. true - // - // - // Lexer Analysis flags: - // - // uses yyleng: ..................... ??? - // uses yylineno: ................... ??? - // uses yytext: ..................... ??? - // uses yylloc: ..................... ??? - // uses ParseError API: ............. ??? - // uses yyerror: .................... ??? - // uses location tracking & editing: ??? - // uses more() API: ................. ??? - // uses unput() API: ................ ??? - // uses reject() API: ............... ??? - // uses less() API: ................. ??? - // uses display APIs pastInput(), upcomingInput(), showPosition(): - // ............................. ??? - // uses describeYYLLOC() API: ....... ??? - // - // --------- END OF REPORT ----------- - - - EOF: 1, +// Code Generator Information Report +// --------------------------------- +// +// Options: +// +// backtracking: .................... false +// location.ranges: ................. true +// location line+column tracking: ... true +// +// +// Forwarded Parser Analysis flags: +// +// uses yyleng: ..................... false +// uses yylineno: ................... false +// uses yytext: ..................... false +// uses yylloc: ..................... false +// uses lexer values: ............... true / true +// location tracking: ............... true +// location assignment: ............. true +// +// +// Lexer Analysis flags: +// +// uses yyleng: ..................... ??? +// uses yylineno: ................... ??? +// uses yytext: ..................... ??? +// uses yylloc: ..................... ??? +// uses ParseError API: ............. ??? +// uses yyerror: .................... ??? +// uses location tracking & editing: ??? +// uses more() API: ................. ??? +// uses unput() API: ................ ??? +// uses reject() API: ............... ??? +// uses less() API: ................. ??? +// uses display APIs pastInput(), upcomingInput(), showPosition(): +// ............................. ??? +// uses describeYYLLOC() API: ....... ??? +// +// --------- END OF REPORT ----------- +EOF: 1, ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator @@ -5316,24 +5641,24 @@ var lexer = function() { // yy: ..., /// <-- injected by setInput() - __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state - - __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup - __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use - done: false, /// INTERNAL USE ONLY - _backtrack: false, /// INTERNAL USE ONLY - _input: '', /// INTERNAL USE ONLY - _more: false, /// INTERNAL USE ONLY - _signaled_error_token: false, /// INTERNAL USE ONLY - conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` - match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! - matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far - matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt - yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. - offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far - yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) - yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located - yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction + __currentRuleSet__: null, /// INTERNAL USE ONLY: internal rule set cache for the current lexer state + + __error_infos: [], /// INTERNAL USE ONLY: the set of lexErrorInfo objects created since the last cleanup + __decompressed: false, /// INTERNAL USE ONLY: mark whether the lexer instance has been 'unfolded' completely and is now ready for use + done: false, /// INTERNAL USE ONLY + _backtrack: false, /// INTERNAL USE ONLY + _input: '', /// INTERNAL USE ONLY + _more: false, /// INTERNAL USE ONLY + _signaled_error_token: false, /// INTERNAL USE ONLY + conditionStack: [], /// INTERNAL USE ONLY; managed via `pushState()`, `popState()`, `topState()` and `stateStackSize()` + match: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction. `match` is identical to `yytext` except that this one still contains the matched input string after `lexer.performAction()` has been invoked, where userland code MAY have changed/replaced the `yytext` value entirely! + matched: '', /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks entire input which has been matched so far + matches: false, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks RE match result for last (successful) match attempt + yytext: '', /// ADVANCED USE ONLY: tracks input which has been matched so far for the lexer token under construction; this value is transferred to the parser as the 'token value' when the parser consumes the lexer token produced through a call to the `lex()` API. + offset: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks the 'cursor position' in the input string, i.e. the number of characters matched so far + yyleng: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: length of matched input for the token under construction (`yytext`) + yylineno: 0, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: 'line number' at which the token under construction is located + yylloc: null, /// READ-ONLY EXTERNAL ACCESS - ADVANCED USE ONLY: tracks location info (lines + columns) for the token under construction /** * INTERNAL USE: construct a suitable error info hash object instance for `parseError`. @@ -5346,7 +5671,7 @@ var lexer = function() { var pei = { errStr: msg, recoverable: !!recoverable, - text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... + text: this.match, // This one MAY be empty; userland code should use the `upcomingInput` API to obtain more text which follows the 'lexer cursor position'... token: null, line: this.yylineno, loc: this.yylloc, @@ -5373,7 +5698,7 @@ var lexer = function() { var rec = !!this.recoverable; for (var key in this) { - if (this.hasOwnProperty(key) && ((typeof key === 'undefined' ? 'undefined' : _typeof(key))) === 'object') { + if (this.hasOwnProperty(key) && typeof key === 'object') { this[key] = undefined; } } @@ -5531,7 +5856,7 @@ var lexer = function() { var spec = conditions[k]; var rule_ids = spec.rules; var len = rule_ids.length; - var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! + var rule_regexes = new Array(len + 1); // slot 0 is unused; we use a 1-based index approach here to keep the hottest code in `lexer_next()` fast and simple! var rule_new_ids = new Array(len + 1); for (var i = 0; i < len; i++) { @@ -5809,7 +6134,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = past.length; // can't ever have more input lines than this! + maxLines = past.length; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5865,7 +6190,7 @@ var lexer = function() { maxSize = 20; if (maxLines < 0) - maxLines = maxSize; // can't ever have more input lines than this! + maxLines = maxSize; // can't ever have more input lines than this! else if (!maxLines) maxLines = 1; @@ -5873,7 +6198,7 @@ var lexer = function() { // more than necessary so that we can still properly check against maxSize // after we've transformed and limited the newLines in here: if (next.length < maxSize * 2 + 2) { - next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 + next += this._input.substring(0, maxSize * 2 + 2); // substring is faster on Chrome/V8 } // now that we have a significantly reduced string to process, transform the newlines @@ -5951,9 +6276,9 @@ var lexer = function() { * @this {RegExpLexer} */ prettyPrintRange: function lexer_prettyPrintRange(loc, context_loc, context_loc2) { - var CONTEXT = 3; - var CONTEXT_TAIL = 1; - var MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; + const CONTEXT = 3; + const CONTEXT_TAIL = 1; + const MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT = 2; var input = this.matched + this._input; var lines = input.split('\n'); @@ -6023,7 +6348,7 @@ var lexer = function() { end: clip_end, len: clip_end - clip_start + 1, arr: nonempty_line_indexes, - rv: rv + rv }); var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; @@ -7806,10 +8131,15 @@ function yyparse() { return parser.parse.apply(parser, arguments); } -exports.parser = parser; -exports.Parser = Parser; -exports.parse = yyparse; -Object.defineProperty(exports, '__esModule', { value: true }); + +var lexParser = { + parser, + Parser, + parse: yyparse, + +}; + +return lexParser; }))); diff --git a/lex-parser.js b/lex-parser.js index f29b7dc..05d6bde 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -1,13 +1,7 @@ -import fs from 'fs'; - -import XRegExp from '@gerhobbelt/xregexp'; -import helpers from 'jison-helpers-lib'; - // hack: var assert; - /* parser generated by jison 0.6.1-200 */ /* @@ -386,6 +380,9 @@ var assert; */ +import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer + import helpers from 'jison-helpers-lib'; + import fs from 'fs'; // See also: // http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript/#35881508 @@ -439,10 +436,6 @@ JisonParserError.prototype.constructor = JisonParserError; JisonParserError.prototype.name = 'JisonParserError'; -// import XRegExp from '@gerhobbelt/xregexp'; // for helping out the `%options xregexp` in the lexer -// import helpers from 'jison-helpers-lib'; -// import fs from 'fs'; - // helper: reconstruct the productions[] table function bp(s) { @@ -5272,49 +5265,47 @@ var lexer = function() { var lexer = { - // Code Generator Information Report - // --------------------------------- - // - // Options: - // - // backtracking: .................... false - // location.ranges: ................. true - // location line+column tracking: ... true - // - // - // Forwarded Parser Analysis flags: - // - // uses yyleng: ..................... false - // uses yylineno: ................... false - // uses yytext: ..................... false - // uses yylloc: ..................... false - // uses lexer values: ............... true/ true - // location tracking: ............... true - // location assignment: ............. true - // - // - // Lexer Analysis flags: - // - // uses yyleng: ..................... ??? - // uses yylineno: ................... ??? - // uses yytext: ..................... ??? - // uses yylloc: ..................... ??? - // uses ParseError API: ............. ??? - // uses yyerror: .................... ??? - // uses location tracking & editing: ??? - // uses more() API: ................. ??? - // uses unput() API: ................ ??? - // uses reject() API: ............... ??? - // uses less() API: ................. ??? - // uses display APIs pastInput(), upcomingInput(), showPosition(): - // ............................. ??? - // uses describeYYLLOC() API: ....... ??? - // - // --------- END OF REPORT ----------- - - - EOF: 1, +// Code Generator Information Report +// --------------------------------- +// +// Options: +// +// backtracking: .................... false +// location.ranges: ................. true +// location line+column tracking: ... true +// +// +// Forwarded Parser Analysis flags: +// +// uses yyleng: ..................... false +// uses yylineno: ................... false +// uses yytext: ..................... false +// uses yylloc: ..................... false +// uses lexer values: ............... true / true +// location tracking: ............... true +// location assignment: ............. true +// +// +// Lexer Analysis flags: +// +// uses yyleng: ..................... ??? +// uses yylineno: ................... ??? +// uses yytext: ..................... ??? +// uses yylloc: ..................... ??? +// uses ParseError API: ............. ??? +// uses yyerror: .................... ??? +// uses location tracking & editing: ??? +// uses more() API: ................. ??? +// uses unput() API: ................ ??? +// uses reject() API: ............... ??? +// uses less() API: ................. ??? +// uses display APIs pastInput(), upcomingInput(), showPosition(): +// ............................. ??? +// uses describeYYLLOC() API: ....... ??? +// +// --------- END OF REPORT ----------- +EOF: 1, ERROR: 2, // JisonLexerError: JisonLexerError, /// <-- injected by the code generator diff --git a/package-lock.json b/package-lock.json index b6c4595..d596ca0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.0-195", + "version": "0.6.1-200", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { @@ -13,7 +13,15 @@ "version": "0.6.1-4", "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-util/-/ast-util-0.6.1-4.tgz", "integrity": "sha512-NP7YZh7rR6CNiMLyKTF+qb2Epx0r5x/zKQ3Z14TgXl73YJurC8WkMkFM9nDj8cRXb6R+f+BEu4DqAvvYKMxbqg==", - "dev": true + "dev": true, + "dependencies": { + "private": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", + "dev": true + } + } }, "@gerhobbelt/linewrap": { "version": "0.2.2-2", @@ -64,6 +72,12 @@ "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=", "dev": true + }, + "private": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", + "dev": true } } }, @@ -652,6 +666,20 @@ "dev": true, "optional": true }, + "browser-resolve": { + "version": "1.11.2", + "resolved": "https://registry.npmjs.org/browser-resolve/-/browser-resolve-1.11.2.tgz", + "integrity": "sha1-j/CbCixCFxihBRwmCzLkj0QpOM4=", + "dev": true, + "dependencies": { + "resolve": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.1.7.tgz", + "integrity": "sha1-IDEU2CrSxe2ejgQRs5ModeiJ6Xs=", + "dev": true + } + } + }, "browser-stdout": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", @@ -746,9 +774,9 @@ "dev": true }, "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } @@ -1876,9 +1904,9 @@ "dev": true, "dependencies": { "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } @@ -1927,6 +1955,12 @@ "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", "dev": true }, + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", + "dev": true + }, "is-number": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-number/-/is-number-2.1.0.tgz", @@ -2111,9 +2145,9 @@ "dev": true, "dependencies": { "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } @@ -2150,6 +2184,11 @@ "integrity": "sha1-FUPx0EgTRHrIUgAcX1qTNAF4bR0=", "dev": true }, + "private": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -2324,9 +2363,9 @@ "dev": true }, "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } @@ -2418,9 +2457,9 @@ "dev": true, "dependencies": { "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } @@ -2547,6 +2586,12 @@ "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", "dev": true }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, "path-type": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", @@ -2579,9 +2624,10 @@ "optional": true }, "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", + "dev": true }, "process-nextick-args": { "version": "1.0.7", @@ -2747,6 +2793,12 @@ "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", "dev": true }, + "resolve": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", + "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", + "dev": true + }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -2765,6 +2817,12 @@ "integrity": "sha512-7RqCBQ9iwsOBPkjYgoIaeUij606mSkDMExP0NT7QDI3bqkHYQHrQ83uoNIXwPcQm/vP2VbsUz3kiyZZ1qPlLTQ==", "dev": true }, + "rollup-plugin-node-resolve": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.0.0.tgz", + "integrity": "sha1-i4l8TDAw1QASd7BRSyXSygloPuA=", + "dev": true + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", @@ -2853,9 +2911,9 @@ "dev": true }, "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } @@ -2947,9 +3005,9 @@ "dev": true }, "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } @@ -3048,9 +3106,9 @@ "dev": true }, "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } @@ -3166,9 +3224,9 @@ "dev": true }, "kind-of": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.0.2.tgz", - "integrity": "sha512-ru8+TQHbN8956c7ZlkgK5Imjx0GMat3jN45GNIthpPeb+SzLrqSg/NG7llQtIqUTbrdu5Oi0lSnIoJmDTwwSzw==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", + "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", "dev": true } } From 3ae60dc69a5eaec3ed387bdae002b1ea68d02dc5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 12:47:40 +0200 Subject: [PATCH 402/417] updated NPM packages and rebuilt library files --- dist/lex-parser-cjs-es5.js | 133 ++++++++----- dist/lex-parser-cjs.js | 156 ++++++++++------ dist/lex-parser-es6.js | 156 ++++++++++------ dist/lex-parser-umd-es5.js | 137 +++++++++----- dist/lex-parser-umd.js | 164 ++++++++++------ package-lock.json | 374 +++++++++++++++++++++++++------------ package.json | 2 +- 7 files changed, 737 insertions(+), 385 deletions(-) diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js index 3bdbf8b..5e621b6 100644 --- a/dist/lex-parser-cjs-es5.js +++ b/dist/lex-parser-cjs-es5.js @@ -36,8 +36,10 @@ function _interopDefault(ex) { } var XRegExp = _interopDefault(require('@gerhobbelt/xregexp')); -var recast = _interopDefault(require('@gerhobbelt/recast')); var fs = _interopDefault(require('fs')); +var path = _interopDefault(require('path')); +var recast = _interopDefault(require('@gerhobbelt/recast')); +var assert = _interopDefault(require('assert')); // Return TRUE if `src` starts with `searchString`. function startsWith(src, searchString) { @@ -69,14 +71,17 @@ function rmCommonWS$1(strings) { var src = strings.map(function splitIntoLines(s) { var a = s.split('\n'); - indent_str = a.reduce(function analyzeLine(indent_str, line) { - var m = /^(\s*)\S/gm.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; + indent_str = a.reduce(function analyzeLine(indent_str, line, index) { + // only check indentation of parts which follow a NEWLINE: + if (index !== 0) { + var m = /^(\s*)\S/.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } } } return indent_str; @@ -93,12 +98,17 @@ function rmCommonWS$1(strings) { // Done removing common indentation. // - // Process template string partials now: - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - for (var j = 0, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); + // Process template string partials now, but only when there's + // some actual UNindenting to do: + if (indent_str) { + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + // only correct indentation at start of line, i.e. only check for + // the indent after every NEWLINE ==> start at j=1 rather than j=0 + for (var j = 1, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } } } } @@ -163,9 +173,6 @@ function dquote(s) { // -var fs$1 = require('fs'); -var path = require('path'); - // Helper function: pad number with leading zeroes function pad(n, p) { p = p || 2; @@ -198,7 +205,7 @@ function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { try { dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + fs.writeFileSync(dumpfile, sourcecode, 'utf8'); console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); break; // abort loop once a dump action was successful! } catch (ex3) { @@ -277,6 +284,11 @@ function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, t return p; } +var code_exec = { + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile +}; + // // Parse a given chunk of code to an AST. // @@ -290,58 +302,81 @@ function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, t //import astUtils from '@gerhobbelt/ast-util'; -//import prettier from '@gerhobbelt/prettier-miscellaneous'; -//import assert from 'assert'; - -// assert(recast); -// var types = recast.types; -// assert(types); -// var namedTypes = types.namedTypes; -// assert(namedTypes); -// var b = types.builders; -// assert(b); +assert(recast); +var types = recast.types; +assert(types); +var namedTypes = types.namedTypes; +assert(namedTypes); +var b = types.builders; +assert(b); // //assert(astUtils); function parseCodeChunkToAST(src, options) { + src = src.replace(/@/g, '\uFFDA').replace(/#/g, '\uFFDB'); var ast = recast.parse(src); return ast; } function prettyPrintAST(ast, options) { var new_src; + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; - { - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, + new_src = new_src.replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup + // backpatch possible jison variables extant in the prettified code: + .replace(/\uFFDA/g, '@').replace(/\uFFDB/g, '#'); - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - } - - new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup return new_src; } +var parse2AST = { + parseCodeChunkToAST: parseCodeChunkToAST, + prettyPrintAST: prettyPrintAST +}; + +/// HELPER FUNCTION: print the function in source code form, properly indented. +/** @public */ +function printFunctionSourceCode(f) { + return String(f); +} + +/// HELPER FUNCTION: print the function **content** in source code form, properly indented. +/** @public */ +function printFunctionSourceCodeContainer(f) { + return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); +} + +var stringifier = { + printFunctionSourceCode: printFunctionSourceCode, + printFunctionSourceCodeContainer: printFunctionSourceCodeContainer +}; + var helpers = { rmCommonWS: rmCommonWS$1, camelCase: camelCase, dquote: dquote, - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile, + exec: code_exec.exec, + dump: code_exec.dump, - parseCodeChunkToAST: parseCodeChunkToAST, - prettyPrintAST: prettyPrintAST + parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, + prettyPrintAST: parse2AST.prettyPrintAST, + + printFunctionSourceCode: stringifier.printFunctionSourceCode, + printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer }; // hack: -var assert; +var assert$1; /* parser generated by jison 0.6.1-200 */ @@ -2328,14 +2363,14 @@ var parser = { }; var ASSERT; - if (typeof assert !== 'function') { + if (typeof assert$1 !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert; + ASSERT = assert$1; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js index 7d6b025..acb6d6b 100644 --- a/dist/lex-parser-cjs.js +++ b/dist/lex-parser-cjs.js @@ -3,8 +3,10 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var XRegExp = _interopDefault(require('@gerhobbelt/xregexp')); -var recast = _interopDefault(require('@gerhobbelt/recast')); var fs = _interopDefault(require('fs')); +var path = _interopDefault(require('path')); +var recast = _interopDefault(require('@gerhobbelt/recast')); +var assert = _interopDefault(require('assert')); // Return TRUE if `src` starts with `searchString`. function startsWith(src, searchString) { @@ -38,14 +40,17 @@ function rmCommonWS$1(strings, ...values) { var src = strings.map(function splitIntoLines(s) { var a = s.split('\n'); - indent_str = a.reduce(function analyzeLine(indent_str, line) { - var m = /^(\s*)\S/gm.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; + indent_str = a.reduce(function analyzeLine(indent_str, line, index) { + // only check indentation of parts which follow a NEWLINE: + if (index !== 0) { + var m = /^(\s*)\S/.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } } } return indent_str; @@ -62,12 +67,17 @@ function rmCommonWS$1(strings, ...values) { // Done removing common indentation. // - // Process template string partials now: - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - for (var j = 0, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); + // Process template string partials now, but only when there's + // some actual UNindenting to do: + if (indent_str) { + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + // only correct indentation at start of line, i.e. only check for + // the indent after every NEWLINE ==> start at j=1 rather than j=0 + for (var j = 1, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } } } } @@ -129,13 +139,6 @@ function dquote(s) { // -var fs$1 = require('fs'); -var path = require('path'); - - - - - // Helper function: pad number with leading zeroes function pad(n, p) { p = p || 2; @@ -177,7 +180,7 @@ function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { try { dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + fs.writeFileSync(dumpfile, sourcecode, 'utf8'); console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); break; // abort loop once a dump action was successful! } catch (ex3) { @@ -263,6 +266,16 @@ function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, t return p; } + + + + + +var code_exec = { + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile +}; + // // Parse a given chunk of code to an AST. // @@ -276,22 +289,23 @@ function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, t //import astUtils from '@gerhobbelt/ast-util'; -//import prettier from '@gerhobbelt/prettier-miscellaneous'; -//import assert from 'assert'; - -// assert(recast); -// var types = recast.types; -// assert(types); -// var namedTypes = types.namedTypes; -// assert(namedTypes); -// var b = types.builders; -// assert(b); +assert(recast); +var types = recast.types; +assert(types); +var namedTypes = types.namedTypes; +assert(namedTypes); +var b = types.builders; +assert(b); // //assert(astUtils); function parseCodeChunkToAST(src, options) { + src = src + .replace(/@/g, '\uFFDA') + .replace(/#/g, '\uFFDB') + ; var ast = recast.parse(src); return ast; } @@ -301,38 +315,74 @@ function parseCodeChunkToAST(src, options) { function prettyPrintAST(ast, options) { var new_src; + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; - { - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, + new_src = new_src + .replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup + // backpatch possible jison variables extant in the prettified code: + .replace(/\uFFDA/g, '@') + .replace(/\uFFDB/g, '#') + ; - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - } - - new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup return new_src; } + + + + + + +var parse2AST = { + parseCodeChunkToAST, + prettyPrintAST +}; + +/// HELPER FUNCTION: print the function in source code form, properly indented. +/** @public */ +function printFunctionSourceCode(f) { + return String(f); +} + +/// HELPER FUNCTION: print the function **content** in source code form, properly indented. +/** @public */ +function printFunctionSourceCodeContainer(f) { + return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); +} + + + +var stringifier = { + printFunctionSourceCode, + printFunctionSourceCodeContainer, +}; + var helpers = { rmCommonWS: rmCommonWS$1, camelCase, dquote, - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile, + exec: code_exec.exec, + dump: code_exec.dump, - parseCodeChunkToAST, - prettyPrintAST, + parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, + prettyPrintAST: parse2AST.prettyPrintAST, + + printFunctionSourceCode: stringifier.printFunctionSourceCode, + printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer, }; // hack: -var assert; +var assert$1; /* parser generated by jison 0.6.1-200 */ @@ -3873,14 +3923,14 @@ parse: function parse(input) { }; var ASSERT; - if (typeof assert !== 'function') { + if (typeof assert$1 !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert; + ASSERT = assert$1; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 8be8ac5..26c40b7 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -1,6 +1,8 @@ import XRegExp from '@gerhobbelt/xregexp'; -import recast from '@gerhobbelt/recast'; import fs from 'fs'; +import path from 'path'; +import recast from '@gerhobbelt/recast'; +import assert from 'assert'; // Return TRUE if `src` starts with `searchString`. function startsWith(src, searchString) { @@ -34,14 +36,17 @@ function rmCommonWS$1(strings, ...values) { var src = strings.map(function splitIntoLines(s) { var a = s.split('\n'); - indent_str = a.reduce(function analyzeLine(indent_str, line) { - var m = /^(\s*)\S/gm.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; + indent_str = a.reduce(function analyzeLine(indent_str, line, index) { + // only check indentation of parts which follow a NEWLINE: + if (index !== 0) { + var m = /^(\s*)\S/.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } } } return indent_str; @@ -58,12 +63,17 @@ function rmCommonWS$1(strings, ...values) { // Done removing common indentation. // - // Process template string partials now: - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - for (var j = 0, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); + // Process template string partials now, but only when there's + // some actual UNindenting to do: + if (indent_str) { + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + // only correct indentation at start of line, i.e. only check for + // the indent after every NEWLINE ==> start at j=1 rather than j=0 + for (var j = 1, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } } } } @@ -125,13 +135,6 @@ function dquote(s) { // -var fs$1 = require('fs'); -var path = require('path'); - - - - - // Helper function: pad number with leading zeroes function pad(n, p) { p = p || 2; @@ -173,7 +176,7 @@ function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { try { dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + fs.writeFileSync(dumpfile, sourcecode, 'utf8'); console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); break; // abort loop once a dump action was successful! } catch (ex3) { @@ -259,6 +262,16 @@ function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, t return p; } + + + + + +var code_exec = { + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile +}; + // // Parse a given chunk of code to an AST. // @@ -272,22 +285,23 @@ function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, t //import astUtils from '@gerhobbelt/ast-util'; -//import prettier from '@gerhobbelt/prettier-miscellaneous'; -//import assert from 'assert'; - -// assert(recast); -// var types = recast.types; -// assert(types); -// var namedTypes = types.namedTypes; -// assert(namedTypes); -// var b = types.builders; -// assert(b); +assert(recast); +var types = recast.types; +assert(types); +var namedTypes = types.namedTypes; +assert(namedTypes); +var b = types.builders; +assert(b); // //assert(astUtils); function parseCodeChunkToAST(src, options) { + src = src + .replace(/@/g, '\uFFDA') + .replace(/#/g, '\uFFDB') + ; var ast = recast.parse(src); return ast; } @@ -297,38 +311,74 @@ function parseCodeChunkToAST(src, options) { function prettyPrintAST(ast, options) { var new_src; + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; - { - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, + new_src = new_src + .replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup + // backpatch possible jison variables extant in the prettified code: + .replace(/\uFFDA/g, '@') + .replace(/\uFFDB/g, '#') + ; - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - } - - new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup return new_src; } + + + + + + +var parse2AST = { + parseCodeChunkToAST, + prettyPrintAST +}; + +/// HELPER FUNCTION: print the function in source code form, properly indented. +/** @public */ +function printFunctionSourceCode(f) { + return String(f); +} + +/// HELPER FUNCTION: print the function **content** in source code form, properly indented. +/** @public */ +function printFunctionSourceCodeContainer(f) { + return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); +} + + + +var stringifier = { + printFunctionSourceCode, + printFunctionSourceCodeContainer, +}; + var helpers = { rmCommonWS: rmCommonWS$1, camelCase, dquote, - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile, + exec: code_exec.exec, + dump: code_exec.dump, - parseCodeChunkToAST, - prettyPrintAST, + parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, + prettyPrintAST: parse2AST.prettyPrintAST, + + printFunctionSourceCode: stringifier.printFunctionSourceCode, + printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer, }; // hack: -var assert; +var assert$1; /* parser generated by jison 0.6.1-200 */ @@ -3869,14 +3919,14 @@ parse: function parse(input) { }; var ASSERT; - if (typeof assert !== 'function') { + if (typeof assert$1 !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert; + ASSERT = assert$1; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js index b041161..6e869ec 100644 --- a/dist/lex-parser-umd-es5.js +++ b/dist/lex-parser-umd-es5.js @@ -32,13 +32,15 @@ var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not corre function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } (function (global, factory) { - (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('@gerhobbelt/recast'), require('fs')) : typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', '@gerhobbelt/recast', 'fs'], factory) : global['lex-parser'] = factory(global.XRegExp, global.recast, global.fs); -})(undefined, function (XRegExp, recast, fs) { + (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('fs'), require('path'), require('@gerhobbelt/recast'), require('assert')) : typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', 'fs', 'path', '@gerhobbelt/recast', 'assert'], factory) : global['lex-parser'] = factory(global.XRegExp, global.fs, global.path, global.recast, global.assert); +})(undefined, function (XRegExp, fs, path, recast, assert) { 'use strict'; XRegExp = XRegExp && XRegExp.hasOwnProperty('default') ? XRegExp['default'] : XRegExp; - recast = recast && recast.hasOwnProperty('default') ? recast['default'] : recast; fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; + path = path && path.hasOwnProperty('default') ? path['default'] : path; + recast = recast && recast.hasOwnProperty('default') ? recast['default'] : recast; + assert = assert && assert.hasOwnProperty('default') ? assert['default'] : assert; // Return TRUE if `src` starts with `searchString`. function startsWith(src, searchString) { @@ -70,14 +72,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi var src = strings.map(function splitIntoLines(s) { var a = s.split('\n'); - indent_str = a.reduce(function analyzeLine(indent_str, line) { - var m = /^(\s*)\S/gm.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; + indent_str = a.reduce(function analyzeLine(indent_str, line, index) { + // only check indentation of parts which follow a NEWLINE: + if (index !== 0) { + var m = /^(\s*)\S/.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } } } return indent_str; @@ -94,12 +99,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // Done removing common indentation. // - // Process template string partials now: - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - for (var j = 0, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); + // Process template string partials now, but only when there's + // some actual UNindenting to do: + if (indent_str) { + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + // only correct indentation at start of line, i.e. only check for + // the indent after every NEWLINE ==> start at j=1 rather than j=0 + for (var j = 1, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } } } } @@ -164,9 +174,6 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // - var fs$1 = require('fs'); - var path = require('path'); - // Helper function: pad number with leading zeroes function pad(n, p) { p = p || 2; @@ -199,7 +206,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi try { dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + fs.writeFileSync(dumpfile, sourcecode, 'utf8'); console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); break; // abort loop once a dump action was successful! } catch (ex3) { @@ -278,6 +285,11 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return p; } + var code_exec = { + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile + }; + // // Parse a given chunk of code to an AST. // @@ -291,58 +303,81 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi //import astUtils from '@gerhobbelt/ast-util'; - //import prettier from '@gerhobbelt/prettier-miscellaneous'; - //import assert from 'assert'; - - // assert(recast); - // var types = recast.types; - // assert(types); - // var namedTypes = types.namedTypes; - // assert(namedTypes); - // var b = types.builders; - // assert(b); + assert(recast); + var types = recast.types; + assert(types); + var namedTypes = types.namedTypes; + assert(namedTypes); + var b = types.builders; + assert(b); // //assert(astUtils); function parseCodeChunkToAST(src, options) { + src = src.replace(/@/g, '\uFFDA').replace(/#/g, '\uFFDB'); var ast = recast.parse(src); return ast; } function prettyPrintAST(ast, options) { var new_src; + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; - { - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, + new_src = new_src.replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup + // backpatch possible jison variables extant in the prettified code: + .replace(/\uFFDA/g, '@').replace(/\uFFDB/g, '#'); - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - } - - new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup return new_src; } + var parse2AST = { + parseCodeChunkToAST: parseCodeChunkToAST, + prettyPrintAST: prettyPrintAST + }; + + /// HELPER FUNCTION: print the function in source code form, properly indented. + /** @public */ + function printFunctionSourceCode(f) { + return String(f); + } + + /// HELPER FUNCTION: print the function **content** in source code form, properly indented. + /** @public */ + function printFunctionSourceCodeContainer(f) { + return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); + } + + var stringifier = { + printFunctionSourceCode: printFunctionSourceCode, + printFunctionSourceCodeContainer: printFunctionSourceCodeContainer + }; + var helpers = { rmCommonWS: rmCommonWS$1, camelCase: camelCase, dquote: dquote, - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile, + exec: code_exec.exec, + dump: code_exec.dump, - parseCodeChunkToAST: parseCodeChunkToAST, - prettyPrintAST: prettyPrintAST + parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, + prettyPrintAST: parse2AST.prettyPrintAST, + + printFunctionSourceCode: stringifier.printFunctionSourceCode, + printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer }; // hack: - var assert; + var assert$1; /* parser generated by jison 0.6.1-200 */ @@ -2329,14 +2364,14 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; var ASSERT; - if (typeof assert !== 'function') { + if (typeof assert$1 !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert; + ASSERT = assert$1; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js index 066c415..283929e 100644 --- a/dist/lex-parser-umd.js +++ b/dist/lex-parser-umd.js @@ -1,12 +1,14 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('@gerhobbelt/recast'), require('fs')) : - typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', '@gerhobbelt/recast', 'fs'], factory) : - (global['lex-parser'] = factory(global.XRegExp,global.recast,global.fs)); -}(this, (function (XRegExp,recast,fs) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('fs'), require('path'), require('@gerhobbelt/recast'), require('assert')) : + typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', 'fs', 'path', '@gerhobbelt/recast', 'assert'], factory) : + (global['lex-parser'] = factory(global.XRegExp,global.fs,global.path,global.recast,global.assert)); +}(this, (function (XRegExp,fs,path,recast,assert) { 'use strict'; XRegExp = XRegExp && XRegExp.hasOwnProperty('default') ? XRegExp['default'] : XRegExp; -recast = recast && recast.hasOwnProperty('default') ? recast['default'] : recast; fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; +path = path && path.hasOwnProperty('default') ? path['default'] : path; +recast = recast && recast.hasOwnProperty('default') ? recast['default'] : recast; +assert = assert && assert.hasOwnProperty('default') ? assert['default'] : assert; // Return TRUE if `src` starts with `searchString`. function startsWith(src, searchString) { @@ -40,14 +42,17 @@ function rmCommonWS$1(strings, ...values) { var src = strings.map(function splitIntoLines(s) { var a = s.split('\n'); - indent_str = a.reduce(function analyzeLine(indent_str, line) { - var m = /^(\s*)\S/gm.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; + indent_str = a.reduce(function analyzeLine(indent_str, line, index) { + // only check indentation of parts which follow a NEWLINE: + if (index !== 0) { + var m = /^(\s*)\S/.exec(line); + // only non-empty ~ content-carrying lines matter re common indent calculus: + if (m) { + if (!indent_str) { + indent_str = m[1]; + } else if (m[1].length < indent_str.length) { + indent_str = m[1]; + } } } return indent_str; @@ -64,12 +69,17 @@ function rmCommonWS$1(strings, ...values) { // Done removing common indentation. // - // Process template string partials now: - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - for (var j = 0, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); + // Process template string partials now, but only when there's + // some actual UNindenting to do: + if (indent_str) { + for (var i = 0, len = src.length; i < len; i++) { + var a = src[i]; + // only correct indentation at start of line, i.e. only check for + // the indent after every NEWLINE ==> start at j=1 rather than j=0 + for (var j = 1, linecnt = a.length; j < linecnt; j++) { + if (startsWith(a[j], indent_str)) { + a[j] = a[j].substr(indent_str.length); + } } } } @@ -131,13 +141,6 @@ function dquote(s) { // -var fs$1 = require('fs'); -var path = require('path'); - - - - - // Helper function: pad number with leading zeroes function pad(n, p) { p = p || 2; @@ -179,7 +182,7 @@ function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { try { dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs$1.writeFileSync(dumpfile, sourcecode, 'utf8'); + fs.writeFileSync(dumpfile, sourcecode, 'utf8'); console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); break; // abort loop once a dump action was successful! } catch (ex3) { @@ -265,6 +268,16 @@ function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, t return p; } + + + + + +var code_exec = { + exec: exec_and_diagnose_this_stuff, + dump: dumpSourceToFile +}; + // // Parse a given chunk of code to an AST. // @@ -278,22 +291,23 @@ function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, t //import astUtils from '@gerhobbelt/ast-util'; -//import prettier from '@gerhobbelt/prettier-miscellaneous'; -//import assert from 'assert'; - -// assert(recast); -// var types = recast.types; -// assert(types); -// var namedTypes = types.namedTypes; -// assert(namedTypes); -// var b = types.builders; -// assert(b); +assert(recast); +var types = recast.types; +assert(types); +var namedTypes = types.namedTypes; +assert(namedTypes); +var b = types.builders; +assert(b); // //assert(astUtils); function parseCodeChunkToAST(src, options) { + src = src + .replace(/@/g, '\uFFDA') + .replace(/#/g, '\uFFDB') + ; var ast = recast.parse(src); return ast; } @@ -303,38 +317,74 @@ function parseCodeChunkToAST(src, options) { function prettyPrintAST(ast, options) { var new_src; + var s = recast.prettyPrint(ast, { + tabWidth: 2, + quote: 'single', + arrowParensAlways: true, + + // Do not reuse whitespace (or anything else, for that matter) + // when printing generically. + reuseWhitespace: false + }); + new_src = s.code; - { - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, + new_src = new_src + .replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup + // backpatch possible jison variables extant in the prettified code: + .replace(/\uFFDA/g, '@') + .replace(/\uFFDB/g, '#') + ; - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - } - - new_src = new_src.replace(/\r\n|\n|\r/g, '\n'); // platform dependent EOL fixup return new_src; } + + + + + + +var parse2AST = { + parseCodeChunkToAST, + prettyPrintAST +}; + +/// HELPER FUNCTION: print the function in source code form, properly indented. +/** @public */ +function printFunctionSourceCode(f) { + return String(f); +} + +/// HELPER FUNCTION: print the function **content** in source code form, properly indented. +/** @public */ +function printFunctionSourceCodeContainer(f) { + return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); +} + + + +var stringifier = { + printFunctionSourceCode, + printFunctionSourceCodeContainer, +}; + var helpers = { rmCommonWS: rmCommonWS$1, camelCase, dquote, - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile, + exec: code_exec.exec, + dump: code_exec.dump, - parseCodeChunkToAST, - prettyPrintAST, + parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, + prettyPrintAST: parse2AST.prettyPrintAST, + + printFunctionSourceCode: stringifier.printFunctionSourceCode, + printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer, }; // hack: -var assert; +var assert$1; /* parser generated by jison 0.6.1-200 */ @@ -3875,14 +3925,14 @@ parse: function parse(input) { }; var ASSERT; - if (typeof assert !== 'function') { + if (typeof assert$1 !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert; + ASSERT = assert$1; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/package-lock.json b/package-lock.json index d596ca0..02739e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6,20 +6,17 @@ "@gerhobbelt/ast-types": { "version": "0.9.13-4", "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.13-4.tgz", - "integrity": "sha512-V8UIj1XN6XOP014fPpecxEa7AlAB9kaTOB/wF9UbguuwIMWCHDmdA9i03JDK9zXyVDVaLWCYh42JK8F9f27AtA==", - "dev": true + "integrity": "sha512-V8UIj1XN6XOP014fPpecxEa7AlAB9kaTOB/wF9UbguuwIMWCHDmdA9i03JDK9zXyVDVaLWCYh42JK8F9f27AtA==" }, "@gerhobbelt/ast-util": { "version": "0.6.1-4", "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-util/-/ast-util-0.6.1-4.tgz", "integrity": "sha512-NP7YZh7rR6CNiMLyKTF+qb2Epx0r5x/zKQ3Z14TgXl73YJurC8WkMkFM9nDj8cRXb6R+f+BEu4DqAvvYKMxbqg==", - "dev": true, "dependencies": { "private": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", - "dev": true + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" } } }, @@ -1043,146 +1040,172 @@ "dependencies": { "abbrev": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", + "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=", "dev": true, "optional": true }, "ajv": { "version": "4.11.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", + "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", "dev": true }, "aproba": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.1.tgz", + "integrity": "sha1-ldNgDwdxCqDpKYxyatXs8urLq6s=", "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", + "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", "dev": true, "optional": true }, "asn1": { "version": "0.2.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", + "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", "dev": true, "optional": true }, "assert-plus": { "version": "0.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", + "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", "dev": true, "optional": true }, "asynckit": { "version": "0.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", "dev": true, "optional": true }, "aws-sign2": { "version": "0.6.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", + "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", "dev": true, "optional": true }, "aws4": { "version": "1.6.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", + "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", "dev": true, "optional": true }, "balanced-match": { "version": "0.4.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", + "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", "dev": true }, "bcrypt-pbkdf": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", + "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", "dev": true, "optional": true }, "block-stream": { "version": "0.0.9", - "bundled": true, + "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", + "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", "dev": true }, "boom": { "version": "2.10.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", + "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "dev": true }, "brace-expansion": { "version": "1.1.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", + "integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", "dev": true }, "buffer-shims": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", + "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=", "dev": true }, "caseless": { "version": "0.12.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", + "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", "dev": true, "optional": true }, "co": { "version": "4.6.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", + "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, "combined-stream": { "version": "1.0.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", + "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", "dev": true }, "concat-map": { "version": "0.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, "console-control-strings": { "version": "1.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", + "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", "dev": true }, "core-util-is": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", "dev": true }, "cryptiles": { "version": "2.0.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", + "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", "dev": true, "optional": true }, "dashdash": { "version": "1.14.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", + "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", "dev": true, "optional": true, "dependencies": { "assert-plus": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, "optional": true } @@ -1190,87 +1213,102 @@ }, "debug": { "version": "2.6.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", "dev": true, "optional": true }, "deep-extend": { "version": "0.4.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", + "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", "dev": true, "optional": true }, "delayed-stream": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", "dev": true }, "delegates": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", + "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true, "optional": true }, "ecc-jsbn": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", + "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", "dev": true, "optional": true }, "extend": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", + "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", "dev": true, "optional": true }, "extsprintf": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", + "integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=", "dev": true }, "forever-agent": { "version": "0.6.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", + "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", "dev": true, "optional": true }, "form-data": { "version": "2.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", + "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", "dev": true, "optional": true }, "fs.realpath": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, "fstream": { "version": "1.0.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", + "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true }, "fstream-ignore": { "version": "1.0.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", + "integrity": "sha1-nDHa40dnAY/h0kmyTa2mfQktoQU=", "dev": true, "optional": true }, "gauge": { "version": "2.7.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", + "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", "dev": true, "optional": true }, "getpass": { "version": "0.1.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", + "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", "dev": true, "optional": true, "dependencies": { "assert-plus": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, "optional": true } @@ -1278,132 +1316,155 @@ }, "glob": { "version": "7.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "dev": true }, "graceful-fs": { "version": "4.1.11", - "bundled": true, + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", "dev": true }, "har-schema": { "version": "1.0.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", + "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", "dev": true, "optional": true }, "har-validator": { "version": "4.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", + "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", "dev": true, "optional": true }, "has-unicode": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", + "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", "dev": true, "optional": true }, "hawk": { "version": "3.1.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", + "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", "dev": true, "optional": true }, "hoek": { "version": "2.16.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", + "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", "dev": true }, "http-signature": { "version": "1.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", + "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", "dev": true, "optional": true }, "inflight": { "version": "1.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true }, "inherits": { "version": "2.0.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, "ini": { "version": "1.3.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", + "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", + "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", "dev": true }, "is-typedarray": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", + "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", "dev": true, "optional": true }, "isarray": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, "isstream": { "version": "0.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", + "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", "dev": true, "optional": true }, "jodid25519": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz", + "integrity": "sha1-BtSRIlUJNBlHfUJWM2BuDpB4KWc=", "dev": true, "optional": true }, "jsbn": { "version": "0.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", + "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", "dev": true, "optional": true }, "json-schema": { "version": "0.2.3", - "bundled": true, + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", + "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", "dev": true, "optional": true }, "json-stable-stringify": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", + "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", "dev": true, "optional": true }, "json-stringify-safe": { "version": "5.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", + "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", "dev": true, "optional": true }, "jsonify": { "version": "0.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", + "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", "dev": true, "optional": true }, "jsprim": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", + "integrity": "sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg=", "dev": true, "optional": true, "dependencies": { "assert-plus": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, "optional": true } @@ -1411,130 +1472,153 @@ }, "mime-db": { "version": "1.27.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz", + "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=", "dev": true }, "mime-types": { "version": "2.1.15", - "bundled": true, + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", + "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", "dev": true }, "minimatch": { "version": "3.0.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true }, "minimist": { "version": "0.0.8", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, "mkdirp": { "version": "0.5.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true }, "ms": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true, "optional": true }, "node-pre-gyp": { "version": "0.6.36", - "bundled": true, + "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.36.tgz", + "integrity": "sha1-22BBEst04NR3VU6bUFsXq936t4Y=", "dev": true, "optional": true }, "nopt": { "version": "4.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", + "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", "dev": true, "optional": true }, "npmlog": { "version": "4.1.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.0.tgz", + "integrity": "sha512-ocolIkZYZt8UveuiDS0yAkkIjid1o7lPG8cYm05yNYzBn8ykQtaiPMEGp8fY9tKdDgm8okpdKzkvu1y9hUYugA==", "dev": true, "optional": true }, "number-is-nan": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", + "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "dev": true }, "oauth-sign": { "version": "0.8.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", + "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", "dev": true, "optional": true }, "object-assign": { "version": "4.1.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true, "optional": true }, "once": { "version": "1.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true }, "os-homedir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", + "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", "dev": true, "optional": true }, "osenv": { "version": "0.1.4", - "bundled": true, + "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", + "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", "dev": true, "optional": true }, "path-is-absolute": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, "performance-now": { "version": "0.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", + "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", "dev": true, "optional": true }, "process-nextick-args": { "version": "1.0.7", - "bundled": true, + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "dev": true }, "punycode": { "version": "1.4.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", + "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", "dev": true, "optional": true }, "qs": { "version": "6.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", + "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", "dev": true, "optional": true }, "rc": { "version": "1.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", + "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", "dev": true, "optional": true, "dependencies": { "minimist": { "version": "1.2.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "dev": true, "optional": true } @@ -1542,58 +1626,68 @@ }, "readable-stream": { "version": "2.2.9", - "bundled": true, + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", + "integrity": "sha1-z3jsb0ptHrQ9JkiMrJfwQudLf8g=", "dev": true }, "request": { "version": "2.81.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", + "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", "dev": true, "optional": true }, "rimraf": { "version": "2.6.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", + "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", "dev": true }, "safe-buffer": { "version": "5.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", + "integrity": "sha1-0mPKVGls2KMGtcplUekt5XkY++c=", "dev": true }, "semver": { "version": "5.3.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", + "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", "dev": true, "optional": true }, "sntp": { "version": "1.0.9", - "bundled": true, + "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", + "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", "dev": true, "optional": true }, "sshpk": { "version": "1.13.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.0.tgz", + "integrity": "sha1-/yo+T9BEl1Vf7Zezmg/YL6+zozw=", "dev": true, "optional": true, "dependencies": { "assert-plus": { "version": "1.0.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", + "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", "dev": true, "optional": true } @@ -1601,92 +1695,108 @@ }, "string_decoder": { "version": "1.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", + "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", "dev": true }, "string-width": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", + "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", "dev": true }, "stringstream": { "version": "0.0.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", + "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", "dev": true, "optional": true }, "strip-ansi": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", + "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", "dev": true }, "strip-json-comments": { "version": "2.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", "dev": true, "optional": true }, "tar": { "version": "2.2.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", + "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true }, "tar-pack": { "version": "3.4.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/tar-pack/-/tar-pack-3.4.0.tgz", + "integrity": "sha1-I74tf2cagzk3bL2wuP4/3r8xeYQ=", "dev": true, "optional": true }, "tough-cookie": { "version": "2.3.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", + "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", "dev": true, "optional": true }, "tunnel-agent": { "version": "0.6.0", - "bundled": true, + "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", + "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", "dev": true, "optional": true }, "tweetnacl": { "version": "0.14.5", - "bundled": true, + "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", + "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "dev": true, "optional": true }, "uid-number": { "version": "0.0.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/uid-number/-/uid-number-0.0.6.tgz", + "integrity": "sha1-DqEOgDXo61uOREnwbaHHMGY7qoE=", "dev": true, "optional": true }, "util-deprecate": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, "uuid": { "version": "3.0.1", - "bundled": true, + "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz", + "integrity": "sha1-ZUS7ot/ajBzxfmKaOjBeK7H+5sE=", "dev": true, "optional": true }, "verror": { "version": "1.3.6", - "bundled": true, + "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", + "integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=", "dev": true, "optional": true }, "wide-align": { "version": "1.1.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", + "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", "dev": true, "optional": true }, "wrappy": { "version": "1.0.2", - "bundled": true, + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true } } @@ -2050,9 +2160,31 @@ } }, "jison-helpers-lib": { - "version": "0.1.0-194", - "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.1.0-194.tgz", - "integrity": "sha512-+Wo5ycNZw6cPXATbfnkEzbbt0Rmh3sqSl6aKW5tyB/e39ONLhxceutrl1tsJP2EqpxllruoM9soELt649IWVUw==" + "version": "0.1.1-200", + "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.1.1-200.tgz", + "integrity": "sha512-PlVBgpGK1Cg74RYc1EnBgNk5w2UJMA2B6S80nJqBIHtOoqzPv3+pPW/hd+8MfDkGbON03HX0JqdqJ4END87NOw==", + "dependencies": { + "@gerhobbelt/ast-types": { + "version": "0.9.13-7", + "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.13-7.tgz", + "integrity": "sha512-OKLyvezcD1X9WHXsKfDm2nLhwt1ybNRvErTqVeM5wlq6vQvNMkWKG6SLwG3Y08gkseZWKfe7enhPiJWoJORf3A==" + }, + "@gerhobbelt/recast": { + "version": "0.12.7-11", + "resolved": "https://registry.npmjs.org/@gerhobbelt/recast/-/recast-0.12.7-11.tgz", + "integrity": "sha512-vjk3AMqq8bgg8Wf5B6n2OdWmpa9iyBYX+/N5+vTf9mz/+etm0YUHcgGdzX98f8tSTCUl+LEdMKNN4vteLbUsxg==" + }, + "private": { + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + } + } }, "js-tokens": { "version": "3.0.2", diff --git a/package.json b/package.json index 74a5002..1051be4 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@gerhobbelt/xregexp": "3.2.0-21", - "jison-helpers-lib": "0.1.0-194" + "jison-helpers-lib": "0.1.1-200" }, "devDependencies": { "babel-cli": "6.26.0", From 67c56a67195280250708a24654233db308915a39 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 12:49:02 +0200 Subject: [PATCH 403/417] add deprecation/secondary-source notice --- README.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.md b/README.md index 5217112..ad2f928 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,26 @@ A parser for lexical grammars used by [jison](http://jison.org) and jison-lex. +> +> # deprecation ~ secondary-source notice +> +> From today (2017/oct/15) the lex-parser repository is only a **secondary source** +> for the `lex-parser` package/codebase: the **primary source** is the +> [jison](https://github.com/GerHobbelt/jison) +> [monorepo](https://medium.com/netscape/the-case-for-monorepos-907c1361708a)'s `packages/lex-parser/` +> directory. +> +> (For a comparable argument, see also ["Why is Babel a monorepo?"](https://github.com/babel/babel/blob/master/doc/design/monorepo.md)) +> +> Issues, pull requests, etc. for `lex-parser` should be filed there; hence +> we do not accept issue reports in this secondary repository any more. +> +> This repository will track the primary source for a while still, but be +> *very aware* that this particular repository will always be lagging behind! +> + + + ## install npm install lex-parser From b090d5cadf3159f05e96c433073ae9b64a5c65f2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 13:10:38 +0200 Subject: [PATCH 404/417] updated NPM packages after quick-hack fix for jison-helpers-lib npm registry --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 02739e9..100f41c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2160,9 +2160,9 @@ } }, "jison-helpers-lib": { - "version": "0.1.1-200", - "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.1.1-200.tgz", - "integrity": "sha512-PlVBgpGK1Cg74RYc1EnBgNk5w2UJMA2B6S80nJqBIHtOoqzPv3+pPW/hd+8MfDkGbON03HX0JqdqJ4END87NOw==", + "version": "0.1.1-201", + "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.1.1-201.tgz", + "integrity": "sha512-GfHePRWgrNI0ixkW73uxsNo686S8MZ+sZ6GAurR6WKfdzNKthc7WHfjW52w/IFHU9ZVKlVgzgp+JfDw33U+1dA==", "dependencies": { "@gerhobbelt/ast-types": { "version": "0.9.13-7", diff --git a/package.json b/package.json index 1051be4..06b9e8b 100644 --- a/package.json +++ b/package.json @@ -29,7 +29,7 @@ }, "dependencies": { "@gerhobbelt/xregexp": "3.2.0-21", - "jison-helpers-lib": "0.1.1-200" + "jison-helpers-lib": "0.1.1-201" }, "devDependencies": { "babel-cli": "6.26.0", From 1d4513b3b16d73e80161fc7f9c6dccef725df9e2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 13:19:35 +0200 Subject: [PATCH 405/417] sync / update README with latest lexer grammar and link set a la jison-helpers-lib --- .babelrc | 15 ++ README.md | 433 +++++++++++++++++++++++++++++++++++++++++---------- package.json | 4 +- 3 files changed, 369 insertions(+), 83 deletions(-) create mode 100644 .babelrc diff --git a/.babelrc b/.babelrc new file mode 100644 index 0000000..10823cf --- /dev/null +++ b/.babelrc @@ -0,0 +1,15 @@ +{ + "ignore": [ + "node_modules/**/*.js" + ], + "compact": false, + "retainLines": false, + "presets": [ + ["env", { + "targets": { + "browsers": ["last 2 versions", "safari >= 7"], + "node": "4.0" + } + }] + ] +} diff --git a/README.md b/README.md index ad2f928..3fe3b82 100644 --- a/README.md +++ b/README.md @@ -60,10 +60,15 @@ This will generate `lex-parser.js`. The parser can parse its own lexical grammar, shown below: ``` +%code imports %{ + import helpers from 'jison-helpers-lib'; +%} + + ASCII_LETTER [a-zA-z] -// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge -// with {UNICODE_LETTER} (though jison has code to optimize if you *did* +// \p{Alphabetic} already includes [a-zA-z], hence we don't need to merge +// with {UNICODE_LETTER} (though jison has code to optimize if you *did* // include the `[a-zA-Z]` anyway): UNICODE_LETTER [\p{Alphabetic}] ALPHA [{UNICODE_LETTER}_] @@ -81,15 +86,17 @@ BR \r\n|\n|\r WS [^\S\r\n] // Quoted string content: support *escaped* quotes inside strings: -QUOTED_STRING_CONTENT (?:\\\'|\\[^\']|[^\\\'])* -DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"])* +QUOTED_STRING_CONTENT (?:\\\'|\\[^\']|[^\\\'\r\n])* +DOUBLEQUOTED_STRING_CONTENT (?:\\\"|\\[^\"]|[^\\\"\r\n])* +// backquoted ES6/ES2017 string templates MAY span multiple lines: +ES2017_STRING_CONTENT (?:\\\`|\\[^\`]|[^\\\`])* -// Accept any non-regex-special character as a direct literal without +// Accept any non-regex-special character as a direct literal without // the need to put quotes around it: ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] -%s indented trail rules macro +%s rules macro named_chunk %x code start_condition options conditions action path set @@ -109,23 +116,136 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] %% -"/*"(.|\n|\r)*?"*/" return 'ACTION_BODY'; -"//".* return 'ACTION_BODY'; -// regexp with braces or quotes (and no spaces, so we don't mistake +"%{" yy.dept = 0; + yy.include_command_allowed = false; + this.pushState('action'); + this.unput(yytext); + yytext = ''; + return 'ACTION_START'; +"%{"([^]*?)"%}" yytext = this.matches[1]; + yy.include_command_allowed = true; + return 'ACTION'; +"%include" %{ + if (yy.include_command_allowed) { + // This is an include instruction in place of an action: + // + // - one %include per action chunk + // - one %include replaces an entire action chunk + this.pushState('path'); + return 'INCLUDE'; + } else { + // TODO + yyerror('oops!'); + return 'INCLUDE_PLACEMENT_ERROR'; + } + %} +{WS}*"/*"[^]*?"*/" //yy.include_command_allowed = false; -- doesn't impact include-allowed state + return 'ACTION_BODY_C_COMMENT'; +{WS}*"//".* yy.include_command_allowed = false; + return 'ACTION_BODY_CPP_COMMENT'; +{WS}+ return 'ACTION_BODY_WHITESPACE'; + +// make sure to terminate on linefeed before the next rule alternative, +// which is announced by `|`: +"|" if (yy.include_command_allowed) { + this.popState(); + this.unput(yytext); + yytext = ''; + return 'ACTION_END'; + } else { + return 'ACTION_BODY'; + } + +// make sure to terminate on linefeed before the rule section ends, +// which is announced by `%%`: +"%%" if (yy.include_command_allowed) { + this.popState(); + this.unput(yytext); + yytext = ''; + return 'ACTION_END'; + } else { + return 'ACTION_BODY'; + } + +"%" return 'ACTION_BODY'; + +// regexp with braces or quotes (and no spaces, so we don't mistake // a *division operator* `/` for a regex delimiter here in most circumstances): -"/"[^ /]*?['"{}][^ ]*?"/" return 'ACTION_BODY'; -\"("\\\\"|'\"'|[^"])*\" return 'ACTION_BODY'; -"'"("\\\\"|"\'"|[^'])*"'" return 'ACTION_BODY'; -[/"'][^{}/"']+ return 'ACTION_BODY'; -[^{}/"']+ return 'ACTION_BODY'; -"{" yy.depth++; return '{'; +"/"[^\s/]*?(?:['"`{}][^\s/]*?)*"/" + yy.include_command_allowed = false; + return 'ACTION_BODY'; +// hack to cope with slashes which MAY be divide operators OR are regex starters: +// we simply gobble the entire line until the end or until we hit a closing brace, +// as we MUST keep track of the curly brace pairs inside an action body. +"/"[^}{BR}]* + yy.include_command_allowed = false; + return 'ACTION_BODY'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" + yy.include_command_allowed = false; + return 'ACTION_BODY'; +\'{QUOTED_STRING_CONTENT}\' yy.include_command_allowed = false; + return 'ACTION_BODY'; +\`{ES2017_STRING_CONTENT}\` yy.include_command_allowed = false; + return 'ACTION_BODY'; +[^{}/"'`|%\{\}{BR}{WS}]+ yy.include_command_allowed = false; + return 'ACTION_BODY'; +"{" yy.depth++; + yy.include_command_allowed = false; + return 'ACTION_BODY'; "}" %{ - if (yy.depth == 0) { - this.pushState('trail'); - } else { - yy.depth--; - } - return '}'; + yy.include_command_allowed = false; + if (yy.depth <= 0) { + yyerror(rmCommonWS` + too many closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'BRACKETS_SURPLUS'; + } else { + yy.depth--; + } + return 'ACTION_BODY'; + %} +// make sure to terminate on linefeed before the next rule alternative, +// which is announced by `|`. +// Note that lexer options & commands should be at the start-of-line, i.e. +// without leading whitespace. The only lexer command which we do accept +// here after the last indent is `%include`, which is considered (part +// of) the rule's action code block. +(?:{BR}{WS}+)+/[^{WS}{BR}|] yy.include_command_allowed = true; + return 'ACTION_BODY_WHITESPACE'; // keep empty lines as-is inside action code blocks. +{BR} if (yy.depth > 0) { + yy.include_command_allowed = true; + return 'ACTION_BODY_WHITESPACE'; // keep empty lines as-is inside action code blocks. + } else { + // end of action code chunk + this.popState(); + this.unput(yytext); + yytext = ''; + return 'ACTION_END'; + } +<> %{ + yy.include_command_allowed = false; + if (yy.depth !== 0) { + yyerror(rmCommonWS` + missing ${yy.depth} closing curly braces in lexer rule action block. + + Note: the action code chunk may be too complex for jison to parse + easily; we suggest you wrap the action code chunk in '%{...%\}' + to help jison grok more or less complex action code chunks. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + yytext = ''; + return 'BRACKETS_MISSING'; + } + this.popState(); + yytext = ''; + return 'ACTION_END'; %} {NAME} return 'NAME'; @@ -133,11 +253,32 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "," return ','; "*" return '*'; +// Comments should be gobbled and discarded anywhere +// *except* the code/action blocks: +{WS}*"//"[^\r\n]* + /* skip single-line comment */ +{WS}*"/*"[^]*?"*/" + /* skip multi-line comment */ + {BR}+ /* empty */ {WS}+{BR}+ /* empty */ -{WS}+ this.pushState('indented'); -"%%" this.pushState('code'); return '%%'; -// Accept any non-regex-special character as a direct literal without +"//"[^\r\n]* + /* skip single-line comment */ +"/*"[^]*?"*/" + /* skip multi-line comment */ +// ACTION code chunks follow rules and are generally indented, but +// never start with characters special to the lex language itself: +// - `%` can start options, commands, etc., e.g. `%include` or `%options` +// - `|` starts a rule alternative, never a chunk of action code. +// - +{WS}+/[^{WS}{BR}|%] yy.depth = 0; + yy.include_command_allowed = true; + this.pushState('action'); + return 'ACTION_START'; +"%%" this.popState(); + this.pushState('code'); + return '%%'; +// Accept any non-regex-special character as a direct literal without // the need to put quotes around it: {ANY_LITERAL_CHAR}+ %{ @@ -148,53 +289,28 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {NAME} return 'NAME'; "=" return '='; \"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; + yytext = unescQuote(this.matches[1], /\\"/g); return 'OPTION_STRING_VALUE'; // value is always a string type \'{QUOTED_STRING_CONTENT}\' - yytext = yytext.substr(1, yyleng - 2); return 'OPTION_VALUE'; + yytext = unescQuote(this.matches[1], /\\'/g); return 'OPTION_STRING_VALUE'; // value is always a string type +\`{ES2017_STRING_CONTENT}\` + yytext = unescQuote(this.matches[1], /\\`/g); return 'OPTION_STRING_VALUE'; // value is always a string type + [^\s\r\n]+ return 'OPTION_VALUE'; -{BR}+ this.popState(); return 'OPTIONS_END'; +{BR}{WS}+(?=\S) /* skip leading whitespace on the next line of input, when followed by more options */ +{BR} this.popState(); return 'OPTIONS_END'; {WS}+ /* skip whitespace */ {ID} return 'START_COND'; {BR}+ this.popState(); {WS}+ /* empty */ -{WS}*{BR}+ this.pushState('rules'); - -"{" yy.depth = 0; this.pushState('action'); return '{'; -"%{"(.|{BR})*?"%}" this.pushState('trail'); yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; -"%{"(.|{BR})*?"%}" yytext = yytext.substr(2, yyleng - 4); return 'ACTION'; -"%include" %{ - // This is an include instruction in place of an action: - // thanks to the `.+` rule immediately below we need to semi-duplicate - // the `%include` token recognition here vs. the almost-identical rule for the same - // further below. - // There's no real harm as we need to do something special in this case anyway: - // push 2 (two!) conditions. - // - // (Anecdotal: to find that we needed to place this almost-copy here to make the test grammar - // parse correctly took several hours as the debug facilities were - and are - too meager to - // quickly diagnose the problem while we hadn't. So the code got littered with debug prints - // and finally it hit me what the *F* went wrong, after which I saw I needed to add *this* rule!) - - // first push the 'trail' condition which will be the follow-up after we're done parsing the path parameter... - this.pushState('trail'); - // then push the immediate need: the 'path' condition. - this.pushState('path'); - return 'INCLUDE'; - %} -.* this.popState(); return 'ACTION'; - -"/*"(.|\n|\r)*?"*/" /* ignore */ -"//"[^\r\n]* /* ignore */ - +{ID} return 'NAME'; {ID} this.pushState('macro'); return 'NAME'; -{BR}+ this.popState('macro'); +{BR}+ this.popState(); -// Accept any non-regex-special character as a direct literal without +// Accept any non-regex-special character as a direct literal without // the need to put quotes around it: -{ANY_LITERAL_CHAR}+ - %{ +{ANY_LITERAL_CHAR}+ %{ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is return 'CHARACTER_LIT'; @@ -203,10 +319,14 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR}+ /* empty */ \s+ /* empty */ -\"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = yytext.replace(/\\"/g,'"'); return 'STRING_LIT'; -\'{QUOTED_STRING_CONTENT}\' - yytext = yytext.replace(/\\'/g,"'"); return 'STRING_LIT'; +\"{DOUBLEQUOTED_STRING_CONTENT}\" %{ + yytext = unescQuote(this.matches[1], /\\"/g); + return 'STRING_LIT'; + %} +\'{QUOTED_STRING_CONTENT}\' %{ + yytext = unescQuote(this.matches[1], /\\'/g); + return 'STRING_LIT'; + %} "[" this.pushState('set'); return 'REGEX_SET_START'; "|" return '|'; "(?:" return 'SPECIAL_GROUP'; @@ -231,20 +351,38 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] "%options" this.pushState('options'); return 'OPTIONS'; "%s" this.pushState('start_condition'); return 'START_INC'; "%x" this.pushState('start_condition'); return 'START_EXC'; -"%include" this.pushState('path'); return 'INCLUDE'; -"%"{NAME}([^\r\n]*) + +"%code" this.pushState('named_chunk'); return 'INIT_CODE'; +"%import" this.pushState('named_chunk'); return 'IMPORT'; + +"%include" yy.depth = 0; + yy.include_command_allowed = true; + this.pushState('action'); + this.unput(yytext); + yytext = ''; + return 'ACTION_START'; + +"%include" this.pushState('path'); + return 'INCLUDE'; + +"%"{NAME}([^\r\n]*) %{ /* ignore unrecognized decl */ - console.warn('LEX: ignoring unsupported lexer option: ', yytext + ' while lexing in ' + this.topState() + ' state:', this._input, ' /////// ', this.matched); - // this.pushState('options'); + this.warn(rmCommonWS` + LEX: ignoring unsupported lexer option ${dquote(yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); yytext = [ this.matches[1], // {NAME} this.matches[2].trim() // optional value/parameters ]; return 'UNKNOWN_DECL'; %} -"%%" this.pushState('rules'); return '%%'; -"{"\d+(","\s?\d+|",")?"}" return 'RANGE_REGEX'; +"%%" this.pushState('rules'); + return '%%'; +"{"\d+(","\s*\d+|",")?"}" return 'RANGE_REGEX'; "{"{ID}"}" return 'NAME_BRACE'; "{"{ID}"}" return 'NAME_BRACE'; "{" return '{'; @@ -253,44 +391,177 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] (?:"\\\\"|"\\]"|[^\]{])+ return 'REGEX_SET'; "{" return 'REGEX_SET'; -"]" this.popState('set'); return 'REGEX_SET_END'; +"]" this.popState(); + return 'REGEX_SET_END'; -// in the trailing CODE block, only accept these `%include` macros when -// they appear at the start of a line and make sure the rest of lexer +// in the trailing CODE block, only accept these `%include` macros when +// they appear at the start of a line and make sure the rest of lexer // regexes account for this one so it'll match that way only: [^\r\n]*(\r|\n)+ return 'CODE'; [^\r\n]+ return 'CODE'; // the bit of CODE just before EOF... {BR} this.popState(); this.unput(yytext); + \"{DOUBLEQUOTED_STRING_CONTENT}\" - yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; + yytext = unescQuote(this.matches[1]); + this.popState(); + return 'PATH'; \'{QUOTED_STRING_CONTENT}\' - yytext = yytext.substr(1, yyleng - 2); this.popState(); return 'PATH'; + yytext = unescQuote(this.matches[1]); + this.popState(); + return 'PATH'; + {WS}+ // skip whitespace in the line -[^\s\r\n]+ this.popState(); return 'PATH'; +[^\s\r\n]+ this.popState(); + return 'PATH'; -<*>. %{ + +// detect and report unterminated string constants ASAP +// for 'action', 'options', but also for other lexer conditions: +// +// these error catching rules fix https://github.com/GerHobbelt/jison/issues/13 +\" yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'error'; +\' yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'error'; +\` yyerror(rmCommonWS` + unterminated string constant in lexer rule action block. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'error'; + +\" yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'error'; +\' yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'error'; +\` yyerror(rmCommonWS` + unterminated string constant in %options entry. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'error'; + +<*>\" var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'error'; +<*>\' var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'error'; +<*>\` var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + yyerror(rmCommonWS` + unterminated string constant encountered while lexing + ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + return 'error'; + + +. %{ /* b0rk on bad characters */ - var l0 = Math.max(0, yylloc.last_column - yylloc.first_column); - var l2 = 3; - var l1 = Math.min(79 - 4 - l0 - l2, yylloc.first_column, 0); - throw new Error('unsupported lexer input: ', yytext, ' @ ' + this.describeYYLLOC(yylloc) + ' while lexing in ' + this.topState() + ' state:\n', indent(this.showPosition(l1, l2), 4)); + var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); + yyerror(rmCommonWS` + unsupported lexer input encountered while lexing + ${rules} (i.e. jison lex regexes). + + NOTE: When you want this input to be interpreted as a LITERAL part + of a lex rule regex, you MUST enclose it in double or + single quotes. + + If not, then know that this input is not accepted as a valid + regex expression here in jison-lex ${rules}. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); + %} + +<*>. %{ + yyerror(rmCommonWS` + unsupported lexer input: ${dquote(yytext)} + while lexing in ${dquote(this.topState())} state. + + Erroneous area: + ` + this.prettyPrintRange(this, yylloc)); %} <*><> return 'EOF'; %% + +var rmCommonWS = helpers.rmCommonWS; +var dquote = helpers.dquote; + + function indent(s, i) { var a = s.split('\n'); var pf = (new Array(i + 1)).join(' '); return pf + a.join('\n' + pf); } + +// unescape a string value which is wrapped in quotes/doublequotes +function unescQuote(str) { + str = '' + str; + var a = str.split('\\\\'); + a = a.map(function (s) { + return s.replace(/\\'/g, "'").replace(/\\"/g, '"'); + }); + str = a.join('\\\\'); + return str; +} ``` + ## license MIT + + + +## related repositories + +- [jison / jison-gho](https://github.com/GerHobbelt/jison) @ [NPM](https://www.npmjs.com/package/jison-gho) +- [jison-lex](https://github.com/GerHobbelt/jison/master/packages/jison-lex) @ [NPM](https://www.npmjs.com/package/@gerhobbelt/jison-lex) +- [lex-parser](https://github.com/GerHobbelt/jison/master/packages/lex-parser) @ [NPM](https://www.npmjs.com/package/@gerhobbelt/lex-parser) +- [ebnf-parser](https://github.com/GerHobbelt/jison/master/packages/ebnf-parser) @ [NPM](https://www.npmjs.com/package/@gerhobbelt/ebnf-parser) +- [jison2json](https://github.com/GerHobbelt/jison/master/packages/jison2json) @ [NPM](https://www.npmjs.com/package/@gerhobbelt/jison2json) +- [json2jison](https://github.com/GerHobbelt/jison/master/packages/json2jison) @ [NPM](https://www.npmjs.com/package/@gerhobbelt/json2jison) +- [jison-helpers-lib](https://github.com/GerHobbelt/jison/master/packages/helpers-lib) @ [NPM](https://www.npmjs.com/package/jison-helpers-lib) +- ### secondary source repositories + + [jison-lex](https://github.com/GerHobbelt/jison-lex) + + [lex-parser](https://github.com/GerHobbelt/lex-parser) + + [ebnf-parser](https://github.com/GerHobbelt/ebnf-parser) + + [jison2json](https://github.com/GerHobbelt/jison2json) + + [json2jison](https://github.com/GerHobbelt/json2jison) + + [jison-helpers-lib](https://github.com/GerHobbelt/jison-helpers-lib) + diff --git a/package.json b/package.json index 06b9e8b..ef3abd4 100644 --- a/package.json +++ b/package.json @@ -5,13 +5,13 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.1-200", + "version": "0.6.1-201", "description": "A parser for lexical grammars used by jison", "main": "dist/lex-parser-cjs-es5.js", "module": "lex-parser.js", "scripts": { "test": "make test", - "pub": "npm publish --access public" + "pub": "echo '### WARNING/NOTICE: publish from the jison monorepo! ###' && false" }, "repository": { "type": "git", From 7bbaba2138f211a5a7d715a8813c04889600811a Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 13:33:12 +0200 Subject: [PATCH 406/417] updated README to point at the monorepo for build instructions --- README.md | 16 +++------------- package-lock.json | 2 +- 2 files changed, 4 insertions(+), 14 deletions(-) diff --git a/README.md b/README.md index 3fe3b82..526045d 100644 --- a/README.md +++ b/README.md @@ -29,27 +29,17 @@ A parser for lexical grammars used by [jison](http://jison.org) and jison-lex. ## install - npm install lex-parser + npm install @gerhobbelt/lex-parser ## build -To build the parser yourself, clone the git repo then run: - - make prep - -to install required packages and then run: - - make - -to run the unit tests. - -This will generate `lex-parser.js`. +To build the parser yourself, follow the install & build directions of the [monorepo](https://github.com/GerHobbelt/jison). ## usage - var lexParser = require("lex-parser"); + var lexParser = require("@gerhobbelt/lex-parser"); // parse a lexical grammar and return JSON lexParser.parse("%% ... "); diff --git a/package-lock.json b/package-lock.json index 100f41c..6365968 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.1-200", + "version": "0.6.1-201", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { From 5406d89dba9be392d8467b3de49e5323cff7b768 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 14:06:07 +0200 Subject: [PATCH 407/417] sync README --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 526045d..55e5033 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lex-parser +# lex-parser \[SECONDARY SOURCE REPO] [![build status](https://secure.travis-ci.org/GerHobbelt/lex-parser.png)](http://travis-ci.org/GerHobbelt/lex-parser) @@ -36,6 +36,24 @@ A parser for lexical grammars used by [jison](http://jison.org) and jison-lex. To build the parser yourself, follow the install & build directions of the [monorepo](https://github.com/GerHobbelt/jison). +> +> ### Note about ES6/rollup usage vs. ES5 +> +> All `dist/` library files are 'self-contained': they include all 'local imports' +> from within this jison monorepo in order to deliver a choice of source files +> for your perusal where you only need to worry about importing **external dependencies** +> (such as `recast`). +> +> As such, these `dist/` files **should** be easier to minify and/or use in older +> (ES5) environments. +> +> #### rollup +> +> Iff you use `rollup` or similar tools in an ES6/ES2015/ES2017 setting, then the +> [`package.json::module`](https://github.com/rollup/rollup/wiki/pkg.module) has +> already been set up for you to use the *original sources* instead! +> + ## usage From a53b050a765b79680116abc845002f717c39e2f5 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 14:55:24 +0200 Subject: [PATCH 408/417] all rollup.config.js files should define the same rollup process where 'external dependencies' ARE NOT included in the rollup but kept external. ==> jison-helpers-lib MUST NOT be included in the dist/ rollup library files for lex-parser! --- dist/lex-parser-cjs-es5.js | 344 +------------------------------- dist/lex-parser-cjs.js | 383 +----------------------------------- dist/lex-parser-es6.js | 383 +----------------------------------- dist/lex-parser-umd-es5.js | 348 +-------------------------------- dist/lex-parser-umd.js | 391 +------------------------------------ rollup.config.js | 7 + 6 files changed, 33 insertions(+), 1823 deletions(-) diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js index 5e621b6..0d28b62 100644 --- a/dist/lex-parser-cjs-es5.js +++ b/dist/lex-parser-cjs-es5.js @@ -36,347 +36,11 @@ function _interopDefault(ex) { } var XRegExp = _interopDefault(require('@gerhobbelt/xregexp')); +var helpers = _interopDefault(require('jison-helpers-lib')); var fs = _interopDefault(require('fs')); -var path = _interopDefault(require('path')); -var recast = _interopDefault(require('@gerhobbelt/recast')); -var assert = _interopDefault(require('assert')); - -// Return TRUE if `src` starts with `searchString`. -function startsWith(src, searchString) { - return src.substr(0, searchString.length) === searchString; -} - -// tagged template string helper which removes the indentation common to all -// non-empty lines: that indentation was added as part of the source code -// formatting of this lexer spec file and must be removed to produce what -// we were aiming for. -// -// Each template string starts with an optional empty line, which should be -// removed entirely, followed by a first line of error reporting content text, -// which should not be indented at all, i.e. the indentation of the first -// non-empty line should be treated as the 'common' indentation and thus -// should also be removed from all subsequent lines in the same template string. -// -// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals -function rmCommonWS$1(strings) { - // As `strings[]` is an array of strings, each potentially consisting - // of multiple lines, followed by one(1) value, we have to split each - // individual string into lines to keep that bit of information intact. - // - // We assume clean code style, hence no random mix of tabs and spaces, so every - // line MUST have the same indent style as all others, so `length` of indent - // should suffice, but the way we coded this is stricter checking as we look - // for the *exact* indenting=leading whitespace in each line. - var indent_str = null; - var src = strings.map(function splitIntoLines(s) { - var a = s.split('\n'); - - indent_str = a.reduce(function analyzeLine(indent_str, line, index) { - // only check indentation of parts which follow a NEWLINE: - if (index !== 0) { - var m = /^(\s*)\S/.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; - } - } - } - return indent_str; - }, indent_str); - - return a; - }); - - // Also note: due to the way we format the template strings in our sourcecode, - // the last line in the entire template must be empty when it has ANY trailing - // whitespace: - var a = src[src.length - 1]; - a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); - - // Done removing common indentation. - // - // Process template string partials now, but only when there's - // some actual UNindenting to do: - if (indent_str) { - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - // only correct indentation at start of line, i.e. only check for - // the indent after every NEWLINE ==> start at j=1 rather than j=0 - for (var j = 1, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); - } - } - } - } - - // now merge everything to construct the template result: - var rv = []; - - for (var _len = arguments.length, values = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - values[_key - 1] = arguments[_key]; - } - - for (var i = 0, len = values.length; i < len; i++) { - rv.push(src[i].join('\n')); - rv.push(values[i]); - } - // the last value is always followed by a last template string partial: - rv.push(src[i].join('\n')); - - var sv = rv.join(''); - return sv; -} - -// Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` -/** @public */ -function camelCase(s) { - // Convert first character to lowercase - return s.replace(/^\w/, function (match) { - return match.toLowerCase(); - }).replace(/-\w/g, function (match) { - return match.charAt(1).toUpperCase(); - }); -} - -// properly quote and escape the given input string -function dquote(s) { - var sq = s.indexOf('\'') >= 0; - var dq = s.indexOf('"') >= 0; - if (sq && dq) { - s = s.replace(/"/g, '\\"'); - dq = false; - } - if (dq) { - s = '\'' + s + '\''; - } else { - s = '"' + s + '"'; - } - return s; -} - -// -// Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis -// (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) -// -// MIT Licensed -// -// -// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: -// -// the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to -// the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that -// we can test the code in a different environment so that we can see what precisely is causing the failure. -// - - -// Helper function: pad number with leading zeroes -function pad(n, p) { - p = p || 2; - var rv = '0000' + n; - return rv.slice(-p); -} - -// attempt to dump in one of several locations: first winner is *it*! -function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { - var dumpfile; - - try { - var dumpPaths = [options.outfile ? path.dirname(options.outfile) : null, options.inputPath, process.cwd()]; - var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname).replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever - .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. - if (dumpName === '' || dumpName === '_') { - dumpName = '__bugger__'; - } - err_id = err_id || 'XXX'; - - var ts = new Date(); - var tm = ts.getUTCFullYear() + '_' + pad(ts.getUTCMonth() + 1) + '_' + pad(ts.getUTCDate()) + 'T' + pad(ts.getUTCHours()) + '' + pad(ts.getUTCMinutes()) + '' + pad(ts.getUTCSeconds()) + '.' + pad(ts.getUTCMilliseconds(), 3) + 'Z'; - - dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; - - for (var i = 0, l = dumpPaths.length; i < l; i++) { - if (!dumpPaths[i]) { - continue; - } - - try { - dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs.writeFileSync(dumpfile, sourcecode, 'utf8'); - console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); - break; // abort loop once a dump action was successful! - } catch (ex3) { - //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); - if (i === l - 1) { - throw ex3; - } - } - } - } catch (ex2) { - console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); - } - - // augment the exception info, when available: - if (ex) { - ex.offending_source_code = sourcecode; - ex.offending_source_title = errname; - ex.offending_source_dumpfile = dumpfile; - } -} - -// -// `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. -// When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode -// is dumped to file for later diagnosis. -// -// Two options drive the internal behaviour: -// -// - options.dumpSourceCodeOnFailure -- default: FALSE -// - options.throwErrorOnCompileFailure -- default: FALSE -// -// Dumpfile naming and path are determined through these options: -// -// - options.outfile -// - options.inputPath -// - options.inputFilename -// - options.moduleName -// - options.defaultModuleName -// -function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { - options = options || {}; - var errname = "" + (title || "exec_test"); - var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); - if (err_id.length === 0) { - err_id = "exec_crash"; - } - var debug = 0; - - if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); - if (debug > 1) console.warn('\n ######################## source code ##########################\n ' + sourcecode + '\n ######################## source code ##########################\n '); - - var p; - try { - // p = eval(sourcecode); - if (typeof code_execution_rig !== 'function') { - throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); - } - p = code_execution_rig.call(this, sourcecode, options, errname, debug); - } catch (ex) { - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); - - if (debug > 1) console.log("exec-and-diagnose options:", options); - - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (options.dumpSourceCodeOnFailure) { - dumpSourceToFile(sourcecode, errname, err_id, options, ex); - } - - if (options.throwErrorOnCompileFailure) { - throw ex; - } - } - return p; -} - -var code_exec = { - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile -}; - -// -// Parse a given chunk of code to an AST. -// -// MIT Licensed -// -// -// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: -// -// would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? -// - - -//import astUtils from '@gerhobbelt/ast-util'; -assert(recast); -var types = recast.types; -assert(types); -var namedTypes = types.namedTypes; -assert(namedTypes); -var b = types.builders; -assert(b); -// //assert(astUtils); - - -function parseCodeChunkToAST(src, options) { - src = src.replace(/@/g, '\uFFDA').replace(/#/g, '\uFFDB'); - var ast = recast.parse(src); - return ast; -} - -function prettyPrintAST(ast, options) { - var new_src; - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, - - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - - new_src = new_src.replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup - // backpatch possible jison variables extant in the prettified code: - .replace(/\uFFDA/g, '@').replace(/\uFFDB/g, '#'); - - return new_src; -} - -var parse2AST = { - parseCodeChunkToAST: parseCodeChunkToAST, - prettyPrintAST: prettyPrintAST -}; - -/// HELPER FUNCTION: print the function in source code form, properly indented. -/** @public */ -function printFunctionSourceCode(f) { - return String(f); -} - -/// HELPER FUNCTION: print the function **content** in source code form, properly indented. -/** @public */ -function printFunctionSourceCodeContainer(f) { - return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); -} - -var stringifier = { - printFunctionSourceCode: printFunctionSourceCode, - printFunctionSourceCodeContainer: printFunctionSourceCodeContainer -}; - -var helpers = { - rmCommonWS: rmCommonWS$1, - camelCase: camelCase, - dquote: dquote, - - exec: code_exec.exec, - dump: code_exec.dump, - - parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, - prettyPrintAST: parse2AST.prettyPrintAST, - - printFunctionSourceCode: stringifier.printFunctionSourceCode, - printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer -}; // hack: -var assert$1; +var assert; /* parser generated by jison 0.6.1-200 */ @@ -2363,14 +2027,14 @@ var parser = { }; var ASSERT; - if (typeof assert$1 !== 'function') { + if (typeof assert !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert$1; + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js index acb6d6b..395586f 100644 --- a/dist/lex-parser-cjs.js +++ b/dist/lex-parser-cjs.js @@ -3,386 +3,11 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; } var XRegExp = _interopDefault(require('@gerhobbelt/xregexp')); +var helpers = _interopDefault(require('jison-helpers-lib')); var fs = _interopDefault(require('fs')); -var path = _interopDefault(require('path')); -var recast = _interopDefault(require('@gerhobbelt/recast')); -var assert = _interopDefault(require('assert')); - -// Return TRUE if `src` starts with `searchString`. -function startsWith(src, searchString) { - return src.substr(0, searchString.length) === searchString; -} - - - -// tagged template string helper which removes the indentation common to all -// non-empty lines: that indentation was added as part of the source code -// formatting of this lexer spec file and must be removed to produce what -// we were aiming for. -// -// Each template string starts with an optional empty line, which should be -// removed entirely, followed by a first line of error reporting content text, -// which should not be indented at all, i.e. the indentation of the first -// non-empty line should be treated as the 'common' indentation and thus -// should also be removed from all subsequent lines in the same template string. -// -// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals -function rmCommonWS$1(strings, ...values) { - // As `strings[]` is an array of strings, each potentially consisting - // of multiple lines, followed by one(1) value, we have to split each - // individual string into lines to keep that bit of information intact. - // - // We assume clean code style, hence no random mix of tabs and spaces, so every - // line MUST have the same indent style as all others, so `length` of indent - // should suffice, but the way we coded this is stricter checking as we look - // for the *exact* indenting=leading whitespace in each line. - var indent_str = null; - var src = strings.map(function splitIntoLines(s) { - var a = s.split('\n'); - - indent_str = a.reduce(function analyzeLine(indent_str, line, index) { - // only check indentation of parts which follow a NEWLINE: - if (index !== 0) { - var m = /^(\s*)\S/.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; - } - } - } - return indent_str; - }, indent_str); - - return a; - }); - - // Also note: due to the way we format the template strings in our sourcecode, - // the last line in the entire template must be empty when it has ANY trailing - // whitespace: - var a = src[src.length - 1]; - a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); - - // Done removing common indentation. - // - // Process template string partials now, but only when there's - // some actual UNindenting to do: - if (indent_str) { - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - // only correct indentation at start of line, i.e. only check for - // the indent after every NEWLINE ==> start at j=1 rather than j=0 - for (var j = 1, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); - } - } - } - } - - // now merge everything to construct the template result: - var rv = []; - for (var i = 0, len = values.length; i < len; i++) { - rv.push(src[i].join('\n')); - rv.push(values[i]); - } - // the last value is always followed by a last template string partial: - rv.push(src[i].join('\n')); - - var sv = rv.join(''); - return sv; -} - -// Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` -/** @public */ -function camelCase(s) { - // Convert first character to lowercase - return s.replace(/^\w/, function (match) { - return match.toLowerCase(); - }) - .replace(/-\w/g, function (match) { - return match.charAt(1).toUpperCase(); - }); -} - -// properly quote and escape the given input string -function dquote(s) { - var sq = (s.indexOf('\'') >= 0); - var dq = (s.indexOf('"') >= 0); - if (sq && dq) { - s = s.replace(/"/g, '\\"'); - dq = false; - } - if (dq) { - s = '\'' + s + '\''; - } - else { - s = '"' + s + '"'; - } - return s; -} - -// -// Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis -// (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) -// -// MIT Licensed -// -// -// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: -// -// the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to -// the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that -// we can test the code in a different environment so that we can see what precisely is causing the failure. -// - - -// Helper function: pad number with leading zeroes -function pad(n, p) { - p = p || 2; - var rv = '0000' + n; - return rv.slice(-p); -} - - -// attempt to dump in one of several locations: first winner is *it*! -function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { - var dumpfile; - - try { - var dumpPaths = [(options.outfile ? path.dirname(options.outfile) : null), options.inputPath, process.cwd()]; - var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname) - .replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever - .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. - if (dumpName === '' || dumpName === '_') { - dumpName = '__bugger__'; - } - err_id = err_id || 'XXX'; - - var ts = new Date(); - var tm = ts.getUTCFullYear() + - '_' + pad(ts.getUTCMonth() + 1) + - '_' + pad(ts.getUTCDate()) + - 'T' + pad(ts.getUTCHours()) + - '' + pad(ts.getUTCMinutes()) + - '' + pad(ts.getUTCSeconds()) + - '.' + pad(ts.getUTCMilliseconds(), 3) + - 'Z'; - - dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; - - for (var i = 0, l = dumpPaths.length; i < l; i++) { - if (!dumpPaths[i]) { - continue; - } - - try { - dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs.writeFileSync(dumpfile, sourcecode, 'utf8'); - console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); - break; // abort loop once a dump action was successful! - } catch (ex3) { - //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); - if (i === l - 1) { - throw ex3; - } - } - } - } catch (ex2) { - console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); - } - - // augment the exception info, when available: - if (ex) { - ex.offending_source_code = sourcecode; - ex.offending_source_title = errname; - ex.offending_source_dumpfile = dumpfile; - } -} - - - - -// -// `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. -// When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode -// is dumped to file for later diagnosis. -// -// Two options drive the internal behaviour: -// -// - options.dumpSourceCodeOnFailure -- default: FALSE -// - options.throwErrorOnCompileFailure -- default: FALSE -// -// Dumpfile naming and path are determined through these options: -// -// - options.outfile -// - options.inputPath -// - options.inputFilename -// - options.moduleName -// - options.defaultModuleName -// -function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { - options = options || {}; - var errname = "" + (title || "exec_test"); - var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); - if (err_id.length === 0) { - err_id = "exec_crash"; - } - const debug = 0; - - if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); - if (debug > 1) console.warn(` - ######################## source code ########################## - ${sourcecode} - ######################## source code ########################## - `); - - var p; - try { - // p = eval(sourcecode); - if (typeof code_execution_rig !== 'function') { - throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); - } - p = code_execution_rig.call(this, sourcecode, options, errname, debug); - } catch (ex) { - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); - - if (debug > 1) console.log("exec-and-diagnose options:", options); - - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (options.dumpSourceCodeOnFailure) { - dumpSourceToFile(sourcecode, errname, err_id, options, ex); - } - - if (options.throwErrorOnCompileFailure) { - throw ex; - } - } - return p; -} - - - - - - -var code_exec = { - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile -}; - -// -// Parse a given chunk of code to an AST. -// -// MIT Licensed -// -// -// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: -// -// would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? -// - - -//import astUtils from '@gerhobbelt/ast-util'; -assert(recast); -var types = recast.types; -assert(types); -var namedTypes = types.namedTypes; -assert(namedTypes); -var b = types.builders; -assert(b); -// //assert(astUtils); - - - - -function parseCodeChunkToAST(src, options) { - src = src - .replace(/@/g, '\uFFDA') - .replace(/#/g, '\uFFDB') - ; - var ast = recast.parse(src); - return ast; -} - - - - -function prettyPrintAST(ast, options) { - var new_src; - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, - - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - - new_src = new_src - .replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup - // backpatch possible jison variables extant in the prettified code: - .replace(/\uFFDA/g, '@') - .replace(/\uFFDB/g, '#') - ; - - return new_src; -} - - - - - - - -var parse2AST = { - parseCodeChunkToAST, - prettyPrintAST -}; - -/// HELPER FUNCTION: print the function in source code form, properly indented. -/** @public */ -function printFunctionSourceCode(f) { - return String(f); -} - -/// HELPER FUNCTION: print the function **content** in source code form, properly indented. -/** @public */ -function printFunctionSourceCodeContainer(f) { - return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); -} - - - -var stringifier = { - printFunctionSourceCode, - printFunctionSourceCodeContainer, -}; - -var helpers = { - rmCommonWS: rmCommonWS$1, - camelCase, - dquote, - - exec: code_exec.exec, - dump: code_exec.dump, - - parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, - prettyPrintAST: parse2AST.prettyPrintAST, - - printFunctionSourceCode: stringifier.printFunctionSourceCode, - printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer, -}; // hack: -var assert$1; +var assert; /* parser generated by jison 0.6.1-200 */ @@ -3923,14 +3548,14 @@ parse: function parse(input) { }; var ASSERT; - if (typeof assert$1 !== 'function') { + if (typeof assert !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert$1; + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 26c40b7..3c6672e 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -1,384 +1,9 @@ import XRegExp from '@gerhobbelt/xregexp'; +import helpers from 'jison-helpers-lib'; import fs from 'fs'; -import path from 'path'; -import recast from '@gerhobbelt/recast'; -import assert from 'assert'; - -// Return TRUE if `src` starts with `searchString`. -function startsWith(src, searchString) { - return src.substr(0, searchString.length) === searchString; -} - - - -// tagged template string helper which removes the indentation common to all -// non-empty lines: that indentation was added as part of the source code -// formatting of this lexer spec file and must be removed to produce what -// we were aiming for. -// -// Each template string starts with an optional empty line, which should be -// removed entirely, followed by a first line of error reporting content text, -// which should not be indented at all, i.e. the indentation of the first -// non-empty line should be treated as the 'common' indentation and thus -// should also be removed from all subsequent lines in the same template string. -// -// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals -function rmCommonWS$1(strings, ...values) { - // As `strings[]` is an array of strings, each potentially consisting - // of multiple lines, followed by one(1) value, we have to split each - // individual string into lines to keep that bit of information intact. - // - // We assume clean code style, hence no random mix of tabs and spaces, so every - // line MUST have the same indent style as all others, so `length` of indent - // should suffice, but the way we coded this is stricter checking as we look - // for the *exact* indenting=leading whitespace in each line. - var indent_str = null; - var src = strings.map(function splitIntoLines(s) { - var a = s.split('\n'); - - indent_str = a.reduce(function analyzeLine(indent_str, line, index) { - // only check indentation of parts which follow a NEWLINE: - if (index !== 0) { - var m = /^(\s*)\S/.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; - } - } - } - return indent_str; - }, indent_str); - - return a; - }); - - // Also note: due to the way we format the template strings in our sourcecode, - // the last line in the entire template must be empty when it has ANY trailing - // whitespace: - var a = src[src.length - 1]; - a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); - - // Done removing common indentation. - // - // Process template string partials now, but only when there's - // some actual UNindenting to do: - if (indent_str) { - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - // only correct indentation at start of line, i.e. only check for - // the indent after every NEWLINE ==> start at j=1 rather than j=0 - for (var j = 1, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); - } - } - } - } - - // now merge everything to construct the template result: - var rv = []; - for (var i = 0, len = values.length; i < len; i++) { - rv.push(src[i].join('\n')); - rv.push(values[i]); - } - // the last value is always followed by a last template string partial: - rv.push(src[i].join('\n')); - - var sv = rv.join(''); - return sv; -} - -// Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` -/** @public */ -function camelCase(s) { - // Convert first character to lowercase - return s.replace(/^\w/, function (match) { - return match.toLowerCase(); - }) - .replace(/-\w/g, function (match) { - return match.charAt(1).toUpperCase(); - }); -} - -// properly quote and escape the given input string -function dquote(s) { - var sq = (s.indexOf('\'') >= 0); - var dq = (s.indexOf('"') >= 0); - if (sq && dq) { - s = s.replace(/"/g, '\\"'); - dq = false; - } - if (dq) { - s = '\'' + s + '\''; - } - else { - s = '"' + s + '"'; - } - return s; -} - -// -// Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis -// (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) -// -// MIT Licensed -// -// -// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: -// -// the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to -// the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that -// we can test the code in a different environment so that we can see what precisely is causing the failure. -// - - -// Helper function: pad number with leading zeroes -function pad(n, p) { - p = p || 2; - var rv = '0000' + n; - return rv.slice(-p); -} - - -// attempt to dump in one of several locations: first winner is *it*! -function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { - var dumpfile; - - try { - var dumpPaths = [(options.outfile ? path.dirname(options.outfile) : null), options.inputPath, process.cwd()]; - var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname) - .replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever - .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. - if (dumpName === '' || dumpName === '_') { - dumpName = '__bugger__'; - } - err_id = err_id || 'XXX'; - - var ts = new Date(); - var tm = ts.getUTCFullYear() + - '_' + pad(ts.getUTCMonth() + 1) + - '_' + pad(ts.getUTCDate()) + - 'T' + pad(ts.getUTCHours()) + - '' + pad(ts.getUTCMinutes()) + - '' + pad(ts.getUTCSeconds()) + - '.' + pad(ts.getUTCMilliseconds(), 3) + - 'Z'; - - dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; - - for (var i = 0, l = dumpPaths.length; i < l; i++) { - if (!dumpPaths[i]) { - continue; - } - - try { - dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs.writeFileSync(dumpfile, sourcecode, 'utf8'); - console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); - break; // abort loop once a dump action was successful! - } catch (ex3) { - //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); - if (i === l - 1) { - throw ex3; - } - } - } - } catch (ex2) { - console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); - } - - // augment the exception info, when available: - if (ex) { - ex.offending_source_code = sourcecode; - ex.offending_source_title = errname; - ex.offending_source_dumpfile = dumpfile; - } -} - - - - -// -// `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. -// When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode -// is dumped to file for later diagnosis. -// -// Two options drive the internal behaviour: -// -// - options.dumpSourceCodeOnFailure -- default: FALSE -// - options.throwErrorOnCompileFailure -- default: FALSE -// -// Dumpfile naming and path are determined through these options: -// -// - options.outfile -// - options.inputPath -// - options.inputFilename -// - options.moduleName -// - options.defaultModuleName -// -function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { - options = options || {}; - var errname = "" + (title || "exec_test"); - var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); - if (err_id.length === 0) { - err_id = "exec_crash"; - } - const debug = 0; - - if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); - if (debug > 1) console.warn(` - ######################## source code ########################## - ${sourcecode} - ######################## source code ########################## - `); - - var p; - try { - // p = eval(sourcecode); - if (typeof code_execution_rig !== 'function') { - throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); - } - p = code_execution_rig.call(this, sourcecode, options, errname, debug); - } catch (ex) { - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); - - if (debug > 1) console.log("exec-and-diagnose options:", options); - - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (options.dumpSourceCodeOnFailure) { - dumpSourceToFile(sourcecode, errname, err_id, options, ex); - } - - if (options.throwErrorOnCompileFailure) { - throw ex; - } - } - return p; -} - - - - - - -var code_exec = { - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile -}; - -// -// Parse a given chunk of code to an AST. -// -// MIT Licensed -// -// -// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: -// -// would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? -// - - -//import astUtils from '@gerhobbelt/ast-util'; -assert(recast); -var types = recast.types; -assert(types); -var namedTypes = types.namedTypes; -assert(namedTypes); -var b = types.builders; -assert(b); -// //assert(astUtils); - - - - -function parseCodeChunkToAST(src, options) { - src = src - .replace(/@/g, '\uFFDA') - .replace(/#/g, '\uFFDB') - ; - var ast = recast.parse(src); - return ast; -} - - - - -function prettyPrintAST(ast, options) { - var new_src; - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, - - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - - new_src = new_src - .replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup - // backpatch possible jison variables extant in the prettified code: - .replace(/\uFFDA/g, '@') - .replace(/\uFFDB/g, '#') - ; - - return new_src; -} - - - - - - - -var parse2AST = { - parseCodeChunkToAST, - prettyPrintAST -}; - -/// HELPER FUNCTION: print the function in source code form, properly indented. -/** @public */ -function printFunctionSourceCode(f) { - return String(f); -} - -/// HELPER FUNCTION: print the function **content** in source code form, properly indented. -/** @public */ -function printFunctionSourceCodeContainer(f) { - return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); -} - - - -var stringifier = { - printFunctionSourceCode, - printFunctionSourceCodeContainer, -}; - -var helpers = { - rmCommonWS: rmCommonWS$1, - camelCase, - dquote, - - exec: code_exec.exec, - dump: code_exec.dump, - - parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, - prettyPrintAST: parse2AST.prettyPrintAST, - - printFunctionSourceCode: stringifier.printFunctionSourceCode, - printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer, -}; // hack: -var assert$1; +var assert; /* parser generated by jison 0.6.1-200 */ @@ -3919,14 +3544,14 @@ parse: function parse(input) { }; var ASSERT; - if (typeof assert$1 !== 'function') { + if (typeof assert !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert$1; + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js index 6e869ec..b9f7585 100644 --- a/dist/lex-parser-umd-es5.js +++ b/dist/lex-parser-umd-es5.js @@ -32,352 +32,16 @@ var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not corre function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } (function (global, factory) { - (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('fs'), require('path'), require('@gerhobbelt/recast'), require('assert')) : typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', 'fs', 'path', '@gerhobbelt/recast', 'assert'], factory) : global['lex-parser'] = factory(global.XRegExp, global.fs, global.path, global.recast, global.assert); -})(undefined, function (XRegExp, fs, path, recast, assert) { + (typeof exports === 'undefined' ? 'undefined' : _typeof(exports)) === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('jison-helpers-lib'), require('fs')) : typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', 'jison-helpers-lib', 'fs'], factory) : global['lex-parser'] = factory(global.XRegExp, global.helpers, global.fs); +})(undefined, function (XRegExp, helpers, fs) { 'use strict'; XRegExp = XRegExp && XRegExp.hasOwnProperty('default') ? XRegExp['default'] : XRegExp; + helpers = helpers && helpers.hasOwnProperty('default') ? helpers['default'] : helpers; fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; - path = path && path.hasOwnProperty('default') ? path['default'] : path; - recast = recast && recast.hasOwnProperty('default') ? recast['default'] : recast; - assert = assert && assert.hasOwnProperty('default') ? assert['default'] : assert; - - // Return TRUE if `src` starts with `searchString`. - function startsWith(src, searchString) { - return src.substr(0, searchString.length) === searchString; - } - - // tagged template string helper which removes the indentation common to all - // non-empty lines: that indentation was added as part of the source code - // formatting of this lexer spec file and must be removed to produce what - // we were aiming for. - // - // Each template string starts with an optional empty line, which should be - // removed entirely, followed by a first line of error reporting content text, - // which should not be indented at all, i.e. the indentation of the first - // non-empty line should be treated as the 'common' indentation and thus - // should also be removed from all subsequent lines in the same template string. - // - // See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals - function rmCommonWS$1(strings) { - // As `strings[]` is an array of strings, each potentially consisting - // of multiple lines, followed by one(1) value, we have to split each - // individual string into lines to keep that bit of information intact. - // - // We assume clean code style, hence no random mix of tabs and spaces, so every - // line MUST have the same indent style as all others, so `length` of indent - // should suffice, but the way we coded this is stricter checking as we look - // for the *exact* indenting=leading whitespace in each line. - var indent_str = null; - var src = strings.map(function splitIntoLines(s) { - var a = s.split('\n'); - - indent_str = a.reduce(function analyzeLine(indent_str, line, index) { - // only check indentation of parts which follow a NEWLINE: - if (index !== 0) { - var m = /^(\s*)\S/.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; - } - } - } - return indent_str; - }, indent_str); - - return a; - }); - - // Also note: due to the way we format the template strings in our sourcecode, - // the last line in the entire template must be empty when it has ANY trailing - // whitespace: - var a = src[src.length - 1]; - a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); - - // Done removing common indentation. - // - // Process template string partials now, but only when there's - // some actual UNindenting to do: - if (indent_str) { - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - // only correct indentation at start of line, i.e. only check for - // the indent after every NEWLINE ==> start at j=1 rather than j=0 - for (var j = 1, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); - } - } - } - } - - // now merge everything to construct the template result: - var rv = []; - - for (var _len = arguments.length, values = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { - values[_key - 1] = arguments[_key]; - } - - for (var i = 0, len = values.length; i < len; i++) { - rv.push(src[i].join('\n')); - rv.push(values[i]); - } - // the last value is always followed by a last template string partial: - rv.push(src[i].join('\n')); - - var sv = rv.join(''); - return sv; - } - - // Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` - /** @public */ - function camelCase(s) { - // Convert first character to lowercase - return s.replace(/^\w/, function (match) { - return match.toLowerCase(); - }).replace(/-\w/g, function (match) { - return match.charAt(1).toUpperCase(); - }); - } - - // properly quote and escape the given input string - function dquote(s) { - var sq = s.indexOf('\'') >= 0; - var dq = s.indexOf('"') >= 0; - if (sq && dq) { - s = s.replace(/"/g, '\\"'); - dq = false; - } - if (dq) { - s = '\'' + s + '\''; - } else { - s = '"' + s + '"'; - } - return s; - } - - // - // Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis - // (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) - // - // MIT Licensed - // - // - // This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: - // - // the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to - // the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that - // we can test the code in a different environment so that we can see what precisely is causing the failure. - // - - - // Helper function: pad number with leading zeroes - function pad(n, p) { - p = p || 2; - var rv = '0000' + n; - return rv.slice(-p); - } - - // attempt to dump in one of several locations: first winner is *it*! - function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { - var dumpfile; - - try { - var dumpPaths = [options.outfile ? path.dirname(options.outfile) : null, options.inputPath, process.cwd()]; - var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname).replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever - .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. - if (dumpName === '' || dumpName === '_') { - dumpName = '__bugger__'; - } - err_id = err_id || 'XXX'; - - var ts = new Date(); - var tm = ts.getUTCFullYear() + '_' + pad(ts.getUTCMonth() + 1) + '_' + pad(ts.getUTCDate()) + 'T' + pad(ts.getUTCHours()) + '' + pad(ts.getUTCMinutes()) + '' + pad(ts.getUTCSeconds()) + '.' + pad(ts.getUTCMilliseconds(), 3) + 'Z'; - - dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; - - for (var i = 0, l = dumpPaths.length; i < l; i++) { - if (!dumpPaths[i]) { - continue; - } - - try { - dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs.writeFileSync(dumpfile, sourcecode, 'utf8'); - console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); - break; // abort loop once a dump action was successful! - } catch (ex3) { - //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); - if (i === l - 1) { - throw ex3; - } - } - } - } catch (ex2) { - console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); - } - - // augment the exception info, when available: - if (ex) { - ex.offending_source_code = sourcecode; - ex.offending_source_title = errname; - ex.offending_source_dumpfile = dumpfile; - } - } - - // - // `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. - // When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode - // is dumped to file for later diagnosis. - // - // Two options drive the internal behaviour: - // - // - options.dumpSourceCodeOnFailure -- default: FALSE - // - options.throwErrorOnCompileFailure -- default: FALSE - // - // Dumpfile naming and path are determined through these options: - // - // - options.outfile - // - options.inputPath - // - options.inputFilename - // - options.moduleName - // - options.defaultModuleName - // - function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { - options = options || {}; - var errname = "" + (title || "exec_test"); - var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); - if (err_id.length === 0) { - err_id = "exec_crash"; - } - var debug = 0; - - if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); - if (debug > 1) console.warn('\n ######################## source code ##########################\n ' + sourcecode + '\n ######################## source code ##########################\n '); - - var p; - try { - // p = eval(sourcecode); - if (typeof code_execution_rig !== 'function') { - throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); - } - p = code_execution_rig.call(this, sourcecode, options, errname, debug); - } catch (ex) { - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); - - if (debug > 1) console.log("exec-and-diagnose options:", options); - - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (options.dumpSourceCodeOnFailure) { - dumpSourceToFile(sourcecode, errname, err_id, options, ex); - } - - if (options.throwErrorOnCompileFailure) { - throw ex; - } - } - return p; - } - - var code_exec = { - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile - }; - - // - // Parse a given chunk of code to an AST. - // - // MIT Licensed - // - // - // This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: - // - // would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? - // - - - //import astUtils from '@gerhobbelt/ast-util'; - assert(recast); - var types = recast.types; - assert(types); - var namedTypes = types.namedTypes; - assert(namedTypes); - var b = types.builders; - assert(b); - // //assert(astUtils); - - - function parseCodeChunkToAST(src, options) { - src = src.replace(/@/g, '\uFFDA').replace(/#/g, '\uFFDB'); - var ast = recast.parse(src); - return ast; - } - - function prettyPrintAST(ast, options) { - var new_src; - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, - - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - - new_src = new_src.replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup - // backpatch possible jison variables extant in the prettified code: - .replace(/\uFFDA/g, '@').replace(/\uFFDB/g, '#'); - - return new_src; - } - - var parse2AST = { - parseCodeChunkToAST: parseCodeChunkToAST, - prettyPrintAST: prettyPrintAST - }; - - /// HELPER FUNCTION: print the function in source code form, properly indented. - /** @public */ - function printFunctionSourceCode(f) { - return String(f); - } - - /// HELPER FUNCTION: print the function **content** in source code form, properly indented. - /** @public */ - function printFunctionSourceCodeContainer(f) { - return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); - } - - var stringifier = { - printFunctionSourceCode: printFunctionSourceCode, - printFunctionSourceCodeContainer: printFunctionSourceCodeContainer - }; - - var helpers = { - rmCommonWS: rmCommonWS$1, - camelCase: camelCase, - dquote: dquote, - - exec: code_exec.exec, - dump: code_exec.dump, - - parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, - prettyPrintAST: parse2AST.prettyPrintAST, - - printFunctionSourceCode: stringifier.printFunctionSourceCode, - printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer - }; // hack: - var assert$1; + var assert; /* parser generated by jison 0.6.1-200 */ @@ -2364,14 +2028,14 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; var ASSERT; - if (typeof assert$1 !== 'function') { + if (typeof assert !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert$1; + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js index 283929e..be792e8 100644 --- a/dist/lex-parser-umd.js +++ b/dist/lex-parser-umd.js @@ -1,390 +1,15 @@ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('fs'), require('path'), require('@gerhobbelt/recast'), require('assert')) : - typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', 'fs', 'path', '@gerhobbelt/recast', 'assert'], factory) : - (global['lex-parser'] = factory(global.XRegExp,global.fs,global.path,global.recast,global.assert)); -}(this, (function (XRegExp,fs,path,recast,assert) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@gerhobbelt/xregexp'), require('jison-helpers-lib'), require('fs')) : + typeof define === 'function' && define.amd ? define(['@gerhobbelt/xregexp', 'jison-helpers-lib', 'fs'], factory) : + (global['lex-parser'] = factory(global.XRegExp,global.helpers,global.fs)); +}(this, (function (XRegExp,helpers,fs) { 'use strict'; XRegExp = XRegExp && XRegExp.hasOwnProperty('default') ? XRegExp['default'] : XRegExp; +helpers = helpers && helpers.hasOwnProperty('default') ? helpers['default'] : helpers; fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; -path = path && path.hasOwnProperty('default') ? path['default'] : path; -recast = recast && recast.hasOwnProperty('default') ? recast['default'] : recast; -assert = assert && assert.hasOwnProperty('default') ? assert['default'] : assert; - -// Return TRUE if `src` starts with `searchString`. -function startsWith(src, searchString) { - return src.substr(0, searchString.length) === searchString; -} - - - -// tagged template string helper which removes the indentation common to all -// non-empty lines: that indentation was added as part of the source code -// formatting of this lexer spec file and must be removed to produce what -// we were aiming for. -// -// Each template string starts with an optional empty line, which should be -// removed entirely, followed by a first line of error reporting content text, -// which should not be indented at all, i.e. the indentation of the first -// non-empty line should be treated as the 'common' indentation and thus -// should also be removed from all subsequent lines in the same template string. -// -// See also: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Template_literals -function rmCommonWS$1(strings, ...values) { - // As `strings[]` is an array of strings, each potentially consisting - // of multiple lines, followed by one(1) value, we have to split each - // individual string into lines to keep that bit of information intact. - // - // We assume clean code style, hence no random mix of tabs and spaces, so every - // line MUST have the same indent style as all others, so `length` of indent - // should suffice, but the way we coded this is stricter checking as we look - // for the *exact* indenting=leading whitespace in each line. - var indent_str = null; - var src = strings.map(function splitIntoLines(s) { - var a = s.split('\n'); - - indent_str = a.reduce(function analyzeLine(indent_str, line, index) { - // only check indentation of parts which follow a NEWLINE: - if (index !== 0) { - var m = /^(\s*)\S/.exec(line); - // only non-empty ~ content-carrying lines matter re common indent calculus: - if (m) { - if (!indent_str) { - indent_str = m[1]; - } else if (m[1].length < indent_str.length) { - indent_str = m[1]; - } - } - } - return indent_str; - }, indent_str); - - return a; - }); - - // Also note: due to the way we format the template strings in our sourcecode, - // the last line in the entire template must be empty when it has ANY trailing - // whitespace: - var a = src[src.length - 1]; - a[a.length - 1] = a[a.length - 1].replace(/\s+$/, ''); - - // Done removing common indentation. - // - // Process template string partials now, but only when there's - // some actual UNindenting to do: - if (indent_str) { - for (var i = 0, len = src.length; i < len; i++) { - var a = src[i]; - // only correct indentation at start of line, i.e. only check for - // the indent after every NEWLINE ==> start at j=1 rather than j=0 - for (var j = 1, linecnt = a.length; j < linecnt; j++) { - if (startsWith(a[j], indent_str)) { - a[j] = a[j].substr(indent_str.length); - } - } - } - } - - // now merge everything to construct the template result: - var rv = []; - for (var i = 0, len = values.length; i < len; i++) { - rv.push(src[i].join('\n')); - rv.push(values[i]); - } - // the last value is always followed by a last template string partial: - rv.push(src[i].join('\n')); - - var sv = rv.join(''); - return sv; -} - -// Convert dashed option keys to Camel Case, e.g. `camelCase('camels-have-one-hump')` => `'camelsHaveOneHump'` -/** @public */ -function camelCase(s) { - // Convert first character to lowercase - return s.replace(/^\w/, function (match) { - return match.toLowerCase(); - }) - .replace(/-\w/g, function (match) { - return match.charAt(1).toUpperCase(); - }); -} - -// properly quote and escape the given input string -function dquote(s) { - var sq = (s.indexOf('\'') >= 0); - var dq = (s.indexOf('"') >= 0); - if (sq && dq) { - s = s.replace(/"/g, '\\"'); - dq = false; - } - if (dq) { - s = '\'' + s + '\''; - } - else { - s = '"' + s + '"'; - } - return s; -} - -// -// Helper library for safe code execution/compilation, including dumping offending code to file for further error analysis -// (the idea was originally coded in https://github.com/GerHobbelt/jison/commit/85e367d03b977780516d2b643afbe6f65ee758f2 ) -// -// MIT Licensed -// -// -// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: -// -// the given code fails, but where exactly and why? It's precise failure conditions are 'hidden' due to -// the stuff running inside an `eval()` or `Function(...)` call, so we want the code dumped to file so that -// we can test the code in a different environment so that we can see what precisely is causing the failure. -// - - -// Helper function: pad number with leading zeroes -function pad(n, p) { - p = p || 2; - var rv = '0000' + n; - return rv.slice(-p); -} - - -// attempt to dump in one of several locations: first winner is *it*! -function dumpSourceToFile(sourcecode, errname, err_id, options, ex) { - var dumpfile; - - try { - var dumpPaths = [(options.outfile ? path.dirname(options.outfile) : null), options.inputPath, process.cwd()]; - var dumpName = path.basename(options.inputFilename || options.moduleName || (options.outfile ? path.dirname(options.outfile) : null) || options.defaultModuleName || errname) - .replace(/\.[a-z]{1,5}$/i, '') // remove extension .y, .yacc, .jison, ...whatever - .replace(/[^a-z0-9_]/ig, '_'); // make sure it's legal in the destination filesystem: the least common denominator. - if (dumpName === '' || dumpName === '_') { - dumpName = '__bugger__'; - } - err_id = err_id || 'XXX'; - - var ts = new Date(); - var tm = ts.getUTCFullYear() + - '_' + pad(ts.getUTCMonth() + 1) + - '_' + pad(ts.getUTCDate()) + - 'T' + pad(ts.getUTCHours()) + - '' + pad(ts.getUTCMinutes()) + - '' + pad(ts.getUTCSeconds()) + - '.' + pad(ts.getUTCMilliseconds(), 3) + - 'Z'; - - dumpName += '.fatal_' + err_id + '_dump_' + tm + '.js'; - - for (var i = 0, l = dumpPaths.length; i < l; i++) { - if (!dumpPaths[i]) { - continue; - } - - try { - dumpfile = path.normalize(dumpPaths[i] + '/' + dumpName); - fs.writeFileSync(dumpfile, sourcecode, 'utf8'); - console.error("****** offending generated " + errname + " source code dumped into file: ", dumpfile); - break; // abort loop once a dump action was successful! - } catch (ex3) { - //console.error("generated " + errname + " source code fatal DUMPING error ATTEMPT: ", i, " = ", ex3.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex3.stack); - if (i === l - 1) { - throw ex3; - } - } - } - } catch (ex2) { - console.error("generated " + errname + " source code fatal DUMPING error: ", ex2.message, " -- while attempting to dump into file: ", dumpfile, "\n", ex2.stack); - } - - // augment the exception info, when available: - if (ex) { - ex.offending_source_code = sourcecode; - ex.offending_source_title = errname; - ex.offending_source_dumpfile = dumpfile; - } -} - - - - -// -// `code_execution_rig` is a function which gets executed, while it is fed the `sourcecode` as a parameter. -// When the `code_execution_rig` crashes, its failure is caught and (using the `options`) the sourcecode -// is dumped to file for later diagnosis. -// -// Two options drive the internal behaviour: -// -// - options.dumpSourceCodeOnFailure -- default: FALSE -// - options.throwErrorOnCompileFailure -- default: FALSE -// -// Dumpfile naming and path are determined through these options: -// -// - options.outfile -// - options.inputPath -// - options.inputFilename -// - options.moduleName -// - options.defaultModuleName -// -function exec_and_diagnose_this_stuff(sourcecode, code_execution_rig, options, title) { - options = options || {}; - var errname = "" + (title || "exec_test"); - var err_id = errname.replace(/[^a-z0-9_]/ig, "_"); - if (err_id.length === 0) { - err_id = "exec_crash"; - } - const debug = 0; - - if (debug) console.warn('generated ' + errname + ' code under EXEC TEST.'); - if (debug > 1) console.warn(` - ######################## source code ########################## - ${sourcecode} - ######################## source code ########################## - `); - - var p; - try { - // p = eval(sourcecode); - if (typeof code_execution_rig !== 'function') { - throw new Error("safe-code-exec-and-diag: code_execution_rig MUST be a JavaScript function"); - } - p = code_execution_rig.call(this, sourcecode, options, errname, debug); - } catch (ex) { - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (debug) console.log("generated " + errname + " source code fatal error: ", ex.message); - - if (debug > 1) console.log("exec-and-diagnose options:", options); - - if (debug > 1) console.log("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); - - if (options.dumpSourceCodeOnFailure) { - dumpSourceToFile(sourcecode, errname, err_id, options, ex); - } - - if (options.throwErrorOnCompileFailure) { - throw ex; - } - } - return p; -} - - - - - - -var code_exec = { - exec: exec_and_diagnose_this_stuff, - dump: dumpSourceToFile -}; - -// -// Parse a given chunk of code to an AST. -// -// MIT Licensed -// -// -// This code is intended to help test and diagnose arbitrary chunks of code, answering questions like this: -// -// would the given code compile and possibly execute correctly, when included in a lexer, parser or other engine? -// - - -//import astUtils from '@gerhobbelt/ast-util'; -assert(recast); -var types = recast.types; -assert(types); -var namedTypes = types.namedTypes; -assert(namedTypes); -var b = types.builders; -assert(b); -// //assert(astUtils); - - - - -function parseCodeChunkToAST(src, options) { - src = src - .replace(/@/g, '\uFFDA') - .replace(/#/g, '\uFFDB') - ; - var ast = recast.parse(src); - return ast; -} - - - - -function prettyPrintAST(ast, options) { - var new_src; - var s = recast.prettyPrint(ast, { - tabWidth: 2, - quote: 'single', - arrowParensAlways: true, - - // Do not reuse whitespace (or anything else, for that matter) - // when printing generically. - reuseWhitespace: false - }); - new_src = s.code; - - new_src = new_src - .replace(/\r\n|\n|\r/g, '\n') // platform dependent EOL fixup - // backpatch possible jison variables extant in the prettified code: - .replace(/\uFFDA/g, '@') - .replace(/\uFFDB/g, '#') - ; - - return new_src; -} - - - - - - - -var parse2AST = { - parseCodeChunkToAST, - prettyPrintAST -}; - -/// HELPER FUNCTION: print the function in source code form, properly indented. -/** @public */ -function printFunctionSourceCode(f) { - return String(f); -} - -/// HELPER FUNCTION: print the function **content** in source code form, properly indented. -/** @public */ -function printFunctionSourceCodeContainer(f) { - return String(f).replace(/^[\s\r\n]*function\b[^\{]+\{/, '').replace(/\}[\s\r\n]*$/, ''); -} - - - -var stringifier = { - printFunctionSourceCode, - printFunctionSourceCodeContainer, -}; - -var helpers = { - rmCommonWS: rmCommonWS$1, - camelCase, - dquote, - - exec: code_exec.exec, - dump: code_exec.dump, - - parseCodeChunkToAST: parse2AST.parseCodeChunkToAST, - prettyPrintAST: parse2AST.prettyPrintAST, - - printFunctionSourceCode: stringifier.printFunctionSourceCode, - printFunctionSourceCodeContainer: stringifier.printFunctionSourceCodeContainer, -}; // hack: -var assert$1; +var assert; /* parser generated by jison 0.6.1-200 */ @@ -3925,14 +3550,14 @@ parse: function parse(input) { }; var ASSERT; - if (typeof assert$1 !== 'function') { + if (typeof assert !== 'function') { ASSERT = function JisonAssert(cond, msg) { if (!cond) { throw new Error('assertion failed: ' + (msg || '***')); } }; } else { - ASSERT = assert$1; + ASSERT = assert; } this.yyGetSharedState = function yyGetSharedState() { diff --git a/rollup.config.js b/rollup.config.js index ce1fd9f..5cf550a 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -47,6 +47,13 @@ export default { '@gerhobbelt/prettier-miscellaneous', '@gerhobbelt/recast', '@gerhobbelt/xregexp', + 'jison-helpers-lib', + '@gerhobbelt/lex-parser', + '@gerhobbelt/jison-lex', + '@gerhobbelt/ebnf-parser', + '@gerhobbelt/jison2json', + '@gerhobbelt/json2jison', + 'jison-gho', 'assert', 'fs', 'path', From 733c31103c749d9b2d6dc0008ba49f1f7f9b5003 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Sun, 15 Oct 2017 16:27:05 +0200 Subject: [PATCH 409/417] updated npm packages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ef3abd4..8535781 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ "babel-preset-env": "1.6.0", "babel-preset-modern-browsers": "9.0.2", "chai": "4.1.2", - "jison-gho": "0.6.0-193", + "jison-gho": "0.6.1-200", "mocha": "4.0.1", "rollup-plugin-node-resolve": "3.0.0", "rollup": "0.50.0" From 7a76f1729ea6c35e26717b85e24c148785a9550c Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 16 Oct 2017 00:07:26 +0200 Subject: [PATCH 410/417] removed dangerous `make` targets & rebuilt library files --- Makefile | 2 - dist/lex-parser-cjs-es5.js | 77 +-- dist/lex-parser-cjs.js | 78 +-- dist/lex-parser-es6.js | 78 +-- dist/lex-parser-umd-es5.js | 77 +-- dist/lex-parser-umd.js | 78 +-- lex-parser.js | 69 +-- package-lock.json | 1093 +++--------------------------------- package.json | 8 +- 9 files changed, 90 insertions(+), 1470 deletions(-) diff --git a/Makefile b/Makefile index 39f1ab2..eb0afbb 100644 --- a/Makefile +++ b/Makefile @@ -44,10 +44,8 @@ test: # increment the XXX number in the package.json file: version ..- bump: - npm version --no-git-tag-version prerelease git-tag: - node -e 'var pkg = require("./package.json"); console.log(pkg.version);' | xargs git tag publish: npm run pub diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js index 0d28b62..473e923 100644 --- a/dist/lex-parser-cjs-es5.js +++ b/dist/lex-parser-cjs-es5.js @@ -42,7 +42,7 @@ var fs = _interopDefault(require('fs')); // hack: var assert; -/* parser generated by jison 0.6.1-200 */ +/* parser generated by jison 0.6.1-202 */ /* * Returns a Parser object of the following structure: @@ -2506,14 +2506,6 @@ var parser = { return rv; }; - function getNonTerminalFromCode(symbol) { - var tokenName = self.getSymbolName(symbol); - if (!tokenName) { - tokenName = symbol; - } - return tokenName; - } - function lex() { var token = lexer.lex(); // if token isn't its numeric value, convert @@ -2521,19 +2513,6 @@ var parser = { token = self.symbols_[token] || token; } - if (typeof Jison !== 'undefined' && Jison.lexDebugger) { - var tokenName = self.getSymbolName(token || EOF); - if (!tokenName) { - tokenName = token; - } - - Jison.lexDebugger.push({ - tokenName: tokenName, - tokenText: lexer.match, - tokenValue: lexer.yytext - }); - } - return token || EOF; } @@ -2992,20 +2971,6 @@ var parser = { lstack[sp] = copy_yylloc(lexer.yylloc); sstack[sp] = newState; // push state - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - var tokenName = self.getSymbolName(symbol || EOF); - if (!tokenName) { - tokenName = symbol; - } - - Jison.parserDebugger.push({ - action: 'shift', - text: lexer.yytext, - terminal: tokenName, - terminal_id: symbol - }); - } - ++sp; symbol = 0; ASSERT(preErrorSymbol === 0); @@ -3050,28 +3015,6 @@ var parser = { r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); - if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { - var prereduceValue = vstack.slice(sp - yyrulelen, sp); - var debuggableProductions = []; - for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { - var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); - debuggableProductions.push(debuggableProduction); - } - // find the current nonterminal name (- nolan) - var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; - var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); - - Jison.parserDebugger.push({ - action: 'reduce', - nonterminal: currentNonterminal, - nonterminal_id: currentNonterminalCode, - prereduce: prereduceValue, - result: r, - productions: debuggableProductions, - text: yyval.$ - }); - } - if (typeof r !== 'undefined') { retval = r; break; @@ -3121,14 +3064,6 @@ var parser = { retval = vstack[sp]; } - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'accept', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } - break; } @@ -3149,14 +3084,6 @@ var parser = { } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; - - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'return', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } } // /finally return retval; @@ -3219,7 +3146,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-200 */ +/* lexer generated by jison-lex 0.6.1-202 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js index 395586f..030e464 100644 --- a/dist/lex-parser-cjs.js +++ b/dist/lex-parser-cjs.js @@ -9,7 +9,7 @@ var fs = _interopDefault(require('fs')); // hack: var assert; -/* parser generated by jison 0.6.1-200 */ +/* parser generated by jison 0.6.1-202 */ /* * Returns a Parser object of the following structure: @@ -4053,15 +4053,6 @@ parse: function parse(input) { return rv; }; - function getNonTerminalFromCode(symbol) { - var tokenName = self.getSymbolName(symbol); - if (!tokenName) { - tokenName = symbol; - } - return tokenName; - } - - function lex() { var token = lexer.lex(); // if token isn't its numeric value, convert @@ -4069,19 +4060,6 @@ parse: function parse(input) { token = self.symbols_[token] || token; } - if (typeof Jison !== 'undefined' && Jison.lexDebugger) { - var tokenName = self.getSymbolName(token || EOF); - if (!tokenName) { - tokenName = token; - } - - Jison.lexDebugger.push({ - tokenName: tokenName, - tokenText: lexer.match, - tokenValue: lexer.yytext - }); - } - return token || EOF; } @@ -4710,20 +4688,6 @@ parse: function parse(input) { lstack[sp] = copy_yylloc(lexer.yylloc); sstack[sp] = newState; // push state - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - var tokenName = self.getSymbolName(symbol || EOF); - if (!tokenName) { - tokenName = symbol; - } - - Jison.parserDebugger.push({ - action: 'shift', - text: lexer.yytext, - terminal: tokenName, - terminal_id: symbol - }); - } - ++sp; symbol = 0; ASSERT(preErrorSymbol === 0); @@ -4801,28 +4765,6 @@ parse: function parse(input) { r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); - if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { - var prereduceValue = vstack.slice(sp - yyrulelen, sp); - var debuggableProductions = []; - for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { - var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); - debuggableProductions.push(debuggableProduction); - } - // find the current nonterminal name (- nolan) - var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; - var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); - - Jison.parserDebugger.push({ - action: 'reduce', - nonterminal: currentNonterminal, - nonterminal_id: currentNonterminalCode, - prereduce: prereduceValue, - result: r, - productions: debuggableProductions, - text: yyval.$ - }); - } - if (typeof r !== 'undefined') { retval = r; break; @@ -4880,14 +4822,6 @@ parse: function parse(input) { retval = vstack[sp]; } - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'accept', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } - break; } @@ -4910,14 +4844,6 @@ parse: function parse(input) { } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; - - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'return', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } } // /finally return retval; @@ -4981,7 +4907,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-200 */ +/* lexer generated by jison-lex 0.6.1-202 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 3c6672e..82060f2 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -5,7 +5,7 @@ import fs from 'fs'; // hack: var assert; -/* parser generated by jison 0.6.1-200 */ +/* parser generated by jison 0.6.1-202 */ /* * Returns a Parser object of the following structure: @@ -4049,15 +4049,6 @@ parse: function parse(input) { return rv; }; - function getNonTerminalFromCode(symbol) { - var tokenName = self.getSymbolName(symbol); - if (!tokenName) { - tokenName = symbol; - } - return tokenName; - } - - function lex() { var token = lexer.lex(); // if token isn't its numeric value, convert @@ -4065,19 +4056,6 @@ parse: function parse(input) { token = self.symbols_[token] || token; } - if (typeof Jison !== 'undefined' && Jison.lexDebugger) { - var tokenName = self.getSymbolName(token || EOF); - if (!tokenName) { - tokenName = token; - } - - Jison.lexDebugger.push({ - tokenName: tokenName, - tokenText: lexer.match, - tokenValue: lexer.yytext - }); - } - return token || EOF; } @@ -4706,20 +4684,6 @@ parse: function parse(input) { lstack[sp] = copy_yylloc(lexer.yylloc); sstack[sp] = newState; // push state - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - var tokenName = self.getSymbolName(symbol || EOF); - if (!tokenName) { - tokenName = symbol; - } - - Jison.parserDebugger.push({ - action: 'shift', - text: lexer.yytext, - terminal: tokenName, - terminal_id: symbol - }); - } - ++sp; symbol = 0; ASSERT(preErrorSymbol === 0); @@ -4797,28 +4761,6 @@ parse: function parse(input) { r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); - if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { - var prereduceValue = vstack.slice(sp - yyrulelen, sp); - var debuggableProductions = []; - for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { - var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); - debuggableProductions.push(debuggableProduction); - } - // find the current nonterminal name (- nolan) - var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; - var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); - - Jison.parserDebugger.push({ - action: 'reduce', - nonterminal: currentNonterminal, - nonterminal_id: currentNonterminalCode, - prereduce: prereduceValue, - result: r, - productions: debuggableProductions, - text: yyval.$ - }); - } - if (typeof r !== 'undefined') { retval = r; break; @@ -4876,14 +4818,6 @@ parse: function parse(input) { retval = vstack[sp]; } - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'accept', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } - break; } @@ -4906,14 +4840,6 @@ parse: function parse(input) { } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; - - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'return', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } } // /finally return retval; @@ -4977,7 +4903,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-200 */ +/* lexer generated by jison-lex 0.6.1-202 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js index b9f7585..e964e33 100644 --- a/dist/lex-parser-umd-es5.js +++ b/dist/lex-parser-umd-es5.js @@ -43,7 +43,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert; - /* parser generated by jison 0.6.1-200 */ + /* parser generated by jison 0.6.1-202 */ /* * Returns a Parser object of the following structure: @@ -2507,14 +2507,6 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return rv; }; - function getNonTerminalFromCode(symbol) { - var tokenName = self.getSymbolName(symbol); - if (!tokenName) { - tokenName = symbol; - } - return tokenName; - } - function lex() { var token = lexer.lex(); // if token isn't its numeric value, convert @@ -2522,19 +2514,6 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi token = self.symbols_[token] || token; } - if (typeof Jison !== 'undefined' && Jison.lexDebugger) { - var tokenName = self.getSymbolName(token || EOF); - if (!tokenName) { - tokenName = token; - } - - Jison.lexDebugger.push({ - tokenName: tokenName, - tokenText: lexer.match, - tokenValue: lexer.yytext - }); - } - return token || EOF; } @@ -2993,20 +2972,6 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lstack[sp] = copy_yylloc(lexer.yylloc); sstack[sp] = newState; // push state - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - var tokenName = self.getSymbolName(symbol || EOF); - if (!tokenName) { - tokenName = symbol; - } - - Jison.parserDebugger.push({ - action: 'shift', - text: lexer.yytext, - terminal: tokenName, - terminal_id: symbol - }); - } - ++sp; symbol = 0; ASSERT(preErrorSymbol === 0); @@ -3051,28 +3016,6 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); - if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { - var prereduceValue = vstack.slice(sp - yyrulelen, sp); - var debuggableProductions = []; - for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { - var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); - debuggableProductions.push(debuggableProduction); - } - // find the current nonterminal name (- nolan) - var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; - var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); - - Jison.parserDebugger.push({ - action: 'reduce', - nonterminal: currentNonterminal, - nonterminal_id: currentNonterminalCode, - prereduce: prereduceValue, - result: r, - productions: debuggableProductions, - text: yyval.$ - }); - } - if (typeof r !== 'undefined') { retval = r; break; @@ -3122,14 +3065,6 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi retval = vstack[sp]; } - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'accept', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } - break; } @@ -3150,14 +3085,6 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; - - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'return', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } } // /finally return retval; @@ -3220,7 +3147,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; - /* lexer generated by jison-lex 0.6.1-200 */ + /* lexer generated by jison-lex 0.6.1-202 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js index be792e8..e53be87 100644 --- a/dist/lex-parser-umd.js +++ b/dist/lex-parser-umd.js @@ -11,7 +11,7 @@ fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; // hack: var assert; -/* parser generated by jison 0.6.1-200 */ +/* parser generated by jison 0.6.1-202 */ /* * Returns a Parser object of the following structure: @@ -4055,15 +4055,6 @@ parse: function parse(input) { return rv; }; - function getNonTerminalFromCode(symbol) { - var tokenName = self.getSymbolName(symbol); - if (!tokenName) { - tokenName = symbol; - } - return tokenName; - } - - function lex() { var token = lexer.lex(); // if token isn't its numeric value, convert @@ -4071,19 +4062,6 @@ parse: function parse(input) { token = self.symbols_[token] || token; } - if (typeof Jison !== 'undefined' && Jison.lexDebugger) { - var tokenName = self.getSymbolName(token || EOF); - if (!tokenName) { - tokenName = token; - } - - Jison.lexDebugger.push({ - tokenName: tokenName, - tokenText: lexer.match, - tokenValue: lexer.yytext - }); - } - return token || EOF; } @@ -4712,20 +4690,6 @@ parse: function parse(input) { lstack[sp] = copy_yylloc(lexer.yylloc); sstack[sp] = newState; // push state - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - var tokenName = self.getSymbolName(symbol || EOF); - if (!tokenName) { - tokenName = symbol; - } - - Jison.parserDebugger.push({ - action: 'shift', - text: lexer.yytext, - terminal: tokenName, - terminal_id: symbol - }); - } - ++sp; symbol = 0; ASSERT(preErrorSymbol === 0); @@ -4803,28 +4767,6 @@ parse: function parse(input) { r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); - if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { - var prereduceValue = vstack.slice(sp - yyrulelen, sp); - var debuggableProductions = []; - for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { - var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); - debuggableProductions.push(debuggableProduction); - } - // find the current nonterminal name (- nolan) - var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; - var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); - - Jison.parserDebugger.push({ - action: 'reduce', - nonterminal: currentNonterminal, - nonterminal_id: currentNonterminalCode, - prereduce: prereduceValue, - result: r, - productions: debuggableProductions, - text: yyval.$ - }); - } - if (typeof r !== 'undefined') { retval = r; break; @@ -4882,14 +4824,6 @@ parse: function parse(input) { retval = vstack[sp]; } - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'accept', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } - break; } @@ -4912,14 +4846,6 @@ parse: function parse(input) { } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; - - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'return', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } } // /finally return retval; @@ -4983,7 +4909,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-200 */ +/* lexer generated by jison-lex 0.6.1-202 */ /* * Returns a Lexer object of the following structure: diff --git a/lex-parser.js b/lex-parser.js index 05d6bde..2ca62c1 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2,7 +2,7 @@ // hack: var assert; -/* parser generated by jison 0.6.1-200 */ +/* parser generated by jison 0.6.1-202 */ /* * Returns a Parser object of the following structure: @@ -4069,19 +4069,6 @@ parse: function parse(input) { token = self.symbols_[token] || token; } - if (typeof Jison !== 'undefined' && Jison.lexDebugger) { - var tokenName = self.getSymbolName(token || EOF); - if (!tokenName) { - tokenName = token; - } - - Jison.lexDebugger.push({ - tokenName: tokenName, - tokenText: lexer.match, - tokenValue: lexer.yytext - }); - } - return token || EOF; } @@ -4710,20 +4697,6 @@ parse: function parse(input) { lstack[sp] = copy_yylloc(lexer.yylloc); sstack[sp] = newState; // push state - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - var tokenName = self.getSymbolName(symbol || EOF); - if (!tokenName) { - tokenName = symbol; - } - - Jison.parserDebugger.push({ - action: 'shift', - text: lexer.yytext, - terminal: tokenName, - terminal_id: symbol - }); - } - ++sp; symbol = 0; ASSERT(preErrorSymbol === 0); @@ -4801,28 +4774,6 @@ parse: function parse(input) { r = this.performAction.call(yyval, yyloc, newState, sp - 1, vstack, lstack); - if (yyrulelen && typeof Jison !== 'undefined' && Jison.parserDebugger) { - var prereduceValue = vstack.slice(sp - yyrulelen, sp); - var debuggableProductions = []; - for (var debugIdx = yyrulelen - 1; debugIdx >= 0; debugIdx--) { - var debuggableProduction = getNonTerminalFromCode(stack[sp - debugIdx]); - debuggableProductions.push(debuggableProduction); - } - // find the current nonterminal name (- nolan) - var currentNonterminalCode = this_production[0]; // WARNING: nolan's original code takes this one instead: this.productions_[newState][0]; - var currentNonterminal = getNonTerminalFromCode(currentNonterminalCode); - - Jison.parserDebugger.push({ - action: 'reduce', - nonterminal: currentNonterminal, - nonterminal_id: currentNonterminalCode, - prereduce: prereduceValue, - result: r, - productions: debuggableProductions, - text: yyval.$ - }); - } - if (typeof r !== 'undefined') { retval = r; break; @@ -4880,14 +4831,6 @@ parse: function parse(input) { retval = vstack[sp]; } - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'accept', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } - break; } @@ -4910,14 +4853,6 @@ parse: function parse(input) { } finally { retval = this.cleanupAfterParse(retval, true, true); this.__reentrant_call_depth--; - - if (typeof Jison !== 'undefined' && Jison.parserDebugger) { - Jison.parserDebugger.push({ - action: 'return', - text: retval - }); - console.log(Jison.parserDebugger[Jison.parserDebugger.length - 1]); - } } // /finally return retval; @@ -4981,7 +4916,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-200 */ +/* lexer generated by jison-lex 0.6.1-202 */ /* * Returns a Lexer object of the following structure: diff --git a/package-lock.json b/package-lock.json index 6365968..a14483d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.1-201", + "version": "0.6.1-202", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { @@ -11,25 +11,18 @@ "@gerhobbelt/ast-util": { "version": "0.6.1-4", "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-util/-/ast-util-0.6.1-4.tgz", - "integrity": "sha512-NP7YZh7rR6CNiMLyKTF+qb2Epx0r5x/zKQ3Z14TgXl73YJurC8WkMkFM9nDj8cRXb6R+f+BEu4DqAvvYKMxbqg==", - "dependencies": { - "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" - } - } + "integrity": "sha512-NP7YZh7rR6CNiMLyKTF+qb2Epx0r5x/zKQ3Z14TgXl73YJurC8WkMkFM9nDj8cRXb6R+f+BEu4DqAvvYKMxbqg==" }, "@gerhobbelt/linewrap": { - "version": "0.2.2-2", - "resolved": "https://registry.npmjs.org/@gerhobbelt/linewrap/-/linewrap-0.2.2-2.tgz", - "integrity": "sha512-5maUNZqQrbjdCFQ2Fy6DktRHujp5m/+HyPHeZCG58NgT01U4TfQ7QrEmaF4jgXoBb/WYfzHKVpqBvE7dj18bEQ==", + "version": "0.2.2-3", + "resolved": "https://registry.npmjs.org/@gerhobbelt/linewrap/-/linewrap-0.2.2-3.tgz", + "integrity": "sha512-u2eUbXgNtqckBI4gxds/uiUNoytT+qIqpePmVDI5isW8A18uB3Qz1P+UxAHgFafGOZWJNrpR0IKnZhl7QhaUng==", "dev": true }, "@gerhobbelt/nomnom": { - "version": "1.8.4-21", - "resolved": "https://registry.npmjs.org/@gerhobbelt/nomnom/-/nomnom-1.8.4-21.tgz", - "integrity": "sha512-45Cy1g0RG2ZB99VFXmRmmcDlnQOAm2Z5FOKbfnJjRKBpCgxZYwDPAn/X6ewbjYk5j3ww1abMJZ26pSEFqcgIQg==", + "version": "1.8.4-24", + "resolved": "https://registry.npmjs.org/@gerhobbelt/nomnom/-/nomnom-1.8.4-24.tgz", + "integrity": "sha512-spzyz2vHd1BhYNSUMXjqJOwk4AjnOIzZz3cYCOryUCzMvlqz01/+SAPEy/pjT47CrOGdWd0JgemePjru1aLYgQ==", "dev": true, "dependencies": { "ansi-styles": { @@ -52,36 +45,22 @@ } } }, - "@gerhobbelt/prettier-miscellaneous": { - "version": "1.6.2-5", - "resolved": "https://registry.npmjs.org/@gerhobbelt/prettier-miscellaneous/-/prettier-miscellaneous-1.6.2-5.tgz", - "integrity": "sha512-MoWZbrLtY9Pu1O6lRB6DNYHVMrESW4ELQx652lgYssnWPq7I7lRwl19JSSfOlSvo/8RMJKhzWyujcjYPQJCP9Q==", - "dev": true - }, "@gerhobbelt/recast": { - "version": "0.12.7-7", - "resolved": "https://registry.npmjs.org/@gerhobbelt/recast/-/recast-0.12.7-7.tgz", - "integrity": "sha512-rGQfklyX1CV5wj3o8/4QvjdFYXqrAkBJffAa1cilxEPjZTEaMP86CjM6o+B4EpoY8AwzxuUnawPQiARhTphLMQ==", - "dev": true, + "version": "0.12.7-11", + "resolved": "https://registry.npmjs.org/@gerhobbelt/recast/-/recast-0.12.7-11.tgz", + "integrity": "sha512-vjk3AMqq8bgg8Wf5B6n2OdWmpa9iyBYX+/N5+vTf9mz/+etm0YUHcgGdzX98f8tSTCUl+LEdMKNN4vteLbUsxg==", "dependencies": { - "core-js": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.0.tgz", - "integrity": "sha1-VpwFCRi+ZIazg3VSAorgRmtxcIY=", - "dev": true - }, - "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=", - "dev": true + "@gerhobbelt/ast-types": { + "version": "0.9.13-7", + "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.13-7.tgz", + "integrity": "sha512-OKLyvezcD1X9WHXsKfDm2nLhwt1ybNRvErTqVeM5wlq6vQvNMkWKG6SLwG3Y08gkseZWKfe7enhPiJWoJORf3A==" } } }, "@gerhobbelt/xregexp": { - "version": "3.2.0-21", - "resolved": "https://registry.npmjs.org/@gerhobbelt/xregexp/-/xregexp-3.2.0-21.tgz", - "integrity": "sha512-TAwlbrEi941S+U4JuE/WovxssajgXWZot/M8za35NN/wPoUaExd5rFaWNDfd7Xp/PyhQ4zz4UGBjPpxnsS9euA==" + "version": "3.2.0-22", + "resolved": "https://registry.npmjs.org/@gerhobbelt/xregexp/-/xregexp-3.2.0-22.tgz", + "integrity": "sha512-TRu38Z67VxFSMrBP3z/ORiJVQqp56ulidZirbobtmJnVGBWLdo4GbHtihgIJFGieIZuk+LxmPkK45SY+SQsR3A==" }, "ansi-regex": { "version": "2.1.1", @@ -113,13 +92,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", "integrity": "sha512-L3hKV5R/p5o81R7O02IGnwpDmkp6E982XhtbuwSe3O4qOtMMMtodicASA1Cny2U+aCXcNpml+m4dPsvsJ3jatg==", - "dev": true - }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", - "dev": true + "dev": true, + "optional": true }, "array-unique": { "version": "0.2.1", @@ -134,12 +108,6 @@ "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", "dev": true }, - "async": { - "version": "2.5.0", - "resolved": "https://registry.npmjs.org/async/-/async-2.5.0.tgz", - "integrity": "sha512-e+lJAJeNWuPCNyxZKOBdaJGyLGHugXVQtrAwtuAe2vhxTYxFTKE73p8JuTmdH0qdQZtDvI4dhJwjZc5zsfIsYw==", - "dev": true - }, "async-each": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", @@ -147,17 +115,19 @@ "dev": true, "optional": true }, - "atob": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.0.3.tgz", - "integrity": "sha1-GcenYEc3dEaPILLS0DNyrX1Mv10=", - "dev": true - }, "babel-cli": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-cli/-/babel-cli-6.26.0.tgz", "integrity": "sha1-UCq1SHTX24itALiHoGODzgPQAvE=", - "dev": true + "dev": true, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } }, "babel-code-frame": { "version": "6.26.0", @@ -169,19 +139,29 @@ "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.0.tgz", "integrity": "sha1-rzL3izGm/O8RnIew/Y2XU/A6C7g=", - "dev": true + "dev": true, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } }, "babel-generator": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.0.tgz", "integrity": "sha1-rBriAHC3n248odMmlhMFN3TyDcU=", - "dev": true - }, - "babel-helper-bindify-decorators": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-bindify-decorators/-/babel-helper-bindify-decorators-6.24.1.tgz", - "integrity": "sha1-FMGeXxQte0fxmlJDHlKxzLxAozA=", - "dev": true + "dev": true, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } }, "babel-helper-builder-binary-assignment-operator-visitor": { "version": "6.24.1", @@ -207,12 +187,6 @@ "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", "dev": true }, - "babel-helper-explode-class": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helper-explode-class/-/babel-helper-explode-class-6.24.1.tgz", - "integrity": "sha1-fcKjkQ3uAHBW4eMdZAztPVTqqes=", - "dev": true - }, "babel-helper-function-name": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", @@ -279,96 +253,24 @@ "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", "dev": true }, - "babel-plugin-syntax-async-generators": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", - "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", - "dev": true - }, - "babel-plugin-syntax-class-constructor-call": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-constructor-call/-/babel-plugin-syntax-class-constructor-call-6.18.0.tgz", - "integrity": "sha1-nLnTn+Q8hgC+yBRkVt3L1OGnZBY=", - "dev": true - }, - "babel-plugin-syntax-class-properties": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-class-properties/-/babel-plugin-syntax-class-properties-6.13.0.tgz", - "integrity": "sha1-1+sjt5oxf4VDlixQW4J8fWysJ94=", - "dev": true - }, - "babel-plugin-syntax-decorators": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-decorators/-/babel-plugin-syntax-decorators-6.13.0.tgz", - "integrity": "sha1-MSVjtNvePMgGzuPkFszurd0RrAs=", - "dev": true - }, - "babel-plugin-syntax-dynamic-import": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-dynamic-import/-/babel-plugin-syntax-dynamic-import-6.18.0.tgz", - "integrity": "sha1-jWomIpyDdFqZgqRBBRVyyqF5sdo=", - "dev": true - }, "babel-plugin-syntax-exponentiation-operator": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", "dev": true }, - "babel-plugin-syntax-export-extensions": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-export-extensions/-/babel-plugin-syntax-export-extensions-6.13.0.tgz", - "integrity": "sha1-cKFITw+QiaToStRLrDU8lbmxJyE=", - "dev": true - }, - "babel-plugin-syntax-flow": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-flow/-/babel-plugin-syntax-flow-6.18.0.tgz", - "integrity": "sha1-TDqyCiryaqIM0lmVw5jE63AxDI0=", - "dev": true - }, - "babel-plugin-syntax-object-rest-spread": { - "version": "6.13.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", - "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", - "dev": true - }, "babel-plugin-syntax-trailing-function-commas": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", "dev": true }, - "babel-plugin-transform-async-generator-functions": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", - "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", - "dev": true - }, "babel-plugin-transform-async-to-generator": { "version": "6.24.1", "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", "dev": true }, - "babel-plugin-transform-class-constructor-call": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-constructor-call/-/babel-plugin-transform-class-constructor-call-6.24.1.tgz", - "integrity": "sha1-gNwoVQWsBn3LjWxl4vbxGrd2Xvk=", - "dev": true - }, - "babel-plugin-transform-class-properties": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-class-properties/-/babel-plugin-transform-class-properties-6.24.1.tgz", - "integrity": "sha1-anl2PqYdM9NvN7YRqp3vgagbRqw=", - "dev": true - }, - "babel-plugin-transform-decorators": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-decorators/-/babel-plugin-transform-decorators-6.24.1.tgz", - "integrity": "sha1-eIAT2PjGtSIr33s0Q5Df13Vp4k0=", - "dev": true - }, "babel-plugin-transform-es2015-arrow-functions": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", @@ -507,24 +409,6 @@ "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", "dev": true }, - "babel-plugin-transform-export-extensions": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-export-extensions/-/babel-plugin-transform-export-extensions-6.22.0.tgz", - "integrity": "sha1-U3OLR+deghhYnuqUbLvTkQm75lM=", - "dev": true - }, - "babel-plugin-transform-flow-strip-types": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-strip-types/-/babel-plugin-transform-flow-strip-types-6.22.0.tgz", - "integrity": "sha1-hMtnKTXUNxT9wyvOhFaNh0Qc988=", - "dev": true - }, - "babel-plugin-transform-object-rest-spread": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz", - "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", - "dev": true - }, "babel-plugin-transform-regenerator": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", @@ -557,36 +441,12 @@ "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", "dev": true }, - "babel-preset-es2015": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.24.1.tgz", - "integrity": "sha1-1EBQ1rwsn+6nAqrzjXJ6AhBTiTk=", - "dev": true - }, "babel-preset-modern-browsers": { "version": "9.0.2", "resolved": "https://registry.npmjs.org/babel-preset-modern-browsers/-/babel-preset-modern-browsers-9.0.2.tgz", "integrity": "sha1-/YvgliILIM4jH8f8ZZ0v7Ehs/gQ=", "dev": true }, - "babel-preset-stage-1": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-1/-/babel-preset-stage-1-6.24.1.tgz", - "integrity": "sha1-dpLNfc1oSZB+auSgqFWJz7niv7A=", - "dev": true - }, - "babel-preset-stage-2": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-2/-/babel-preset-stage-2-6.24.1.tgz", - "integrity": "sha1-2eKWD7PXEYfw5k7sYrwHdnIZvcE=", - "dev": true - }, - "babel-preset-stage-3": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", - "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", - "dev": true - }, "babel-register": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", @@ -629,20 +489,6 @@ "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, "binary-extensions": { "version": "1.10.0", "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.10.0.tgz", @@ -695,20 +541,6 @@ "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", "dev": true }, - "cache-base": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, "camelcase": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", @@ -746,38 +578,6 @@ "dev": true, "optional": true }, - "class-utils": { - "version": "0.3.5", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.5.tgz", - "integrity": "sha1-F+eTEDdQ+WJ7IXbqNM/RtWWQPIA=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, "cliui": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cliui/-/cliui-3.2.0.tgz", @@ -798,12 +598,6 @@ "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", "dev": true }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true - }, "color-convert": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.0.tgz", @@ -816,24 +610,12 @@ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", "dev": true }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, "commander": { "version": "2.11.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", "integrity": "sha512-b0553uYA5YAEGgyYIGYROzKQ7X5RAqedkfjiZxwi0kL1g3bOaBNNZfYkzt/CL0umgD5wc9Jec2FbB98CjkMRvQ==", "dev": true }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", @@ -846,12 +628,6 @@ "integrity": "sha1-ms1whRxtXf3ZPZKC5e35SgP/RrU=", "dev": true }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, "core-js": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", @@ -888,12 +664,6 @@ "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true }, - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true - }, "detect-indent": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", @@ -961,12 +731,6 @@ "dev": true, "optional": true }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true - }, "extglob": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", @@ -994,17 +758,12 @@ "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", "dev": true }, - "flow-parser": { - "version": "0.53.1", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.53.1.tgz", - "integrity": "sha1-a8lrbQGmlXG+ounKU/T/MY2YtD8=", - "dev": true - }, "for-in": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true + "dev": true, + "optional": true }, "for-own": { "version": "0.1.5", @@ -1013,12 +772,6 @@ "dev": true, "optional": true }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true - }, "fs-readdir-recursive": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.0.0.tgz", @@ -1819,12 +1572,6 @@ "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", "dev": true }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", @@ -1868,60 +1615,12 @@ "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", "dev": true }, - "has-color": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz", - "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8=", - "dev": true - }, "has-flag": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-2.0.0.tgz", "integrity": "sha1-6CB68cx7MNRGzHC3NLXovhj4jVE=", "dev": true }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true - } - } - }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -1940,12 +1639,6 @@ "integrity": "sha512-pNgbURSuab90KbTqvRPsseaTxOJCZBD0a7t+haSN33piP9cCM4l0CqdzAif2hUqm716UovKB2ROmiabGAKVXyg==", "dev": true }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -1970,12 +1663,6 @@ "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", "dev": true }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true - }, "is-arrayish": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", @@ -2001,26 +1688,6 @@ "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", "dev": true }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true - }, - "is-descriptor": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.1.tgz", - "integrity": "sha512-G3fFVFTqfaqu7r4YuSBHKBAuOaLz8Sy7ekklUpFEliaLMP1Y2ZjoN9jS62YWCAPQrQpMUQSitRlrzibbuCZjdA==", - "dev": true, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, "is-dotfile": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-dotfile/-/is-dotfile-1.0.3.tgz", @@ -2039,7 +1706,8 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true + "dev": true, + "optional": true }, "is-extglob": { "version": "1.0.0", @@ -2078,34 +1746,6 @@ "dev": true, "optional": true }, - "is-odd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-1.0.0.tgz", - "integrity": "sha1-O4qTLrAos3dcObsJ6RdnrM22kIg=", - "dev": true, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true - } - } - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, "is-posix-bracket": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/is-posix-bracket/-/is-posix-bracket-0.1.1.tgz", @@ -2146,9 +1786,9 @@ "optional": true }, "jison-gho": { - "version": "0.6.0-193", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.0-193.tgz", - "integrity": "sha512-7aud9KQ8Ka2usOtisRk6nvoFoIzfhMBsztVoD5pEN4faMgJzNCuFNCUVJ098OPWE+SwtveONJf6x1Qe2aKrmmg==", + "version": "0.6.1-202", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.1-202.tgz", + "integrity": "sha512-j/JV1B1t6GkGRj4NYQF0QXYgALrvXZb5dP+a9oKAyO665JEyQv6q8SjZd5NMpxS6Q1bW3Qasscl/cvZG4LRrfg==", "dev": true, "dependencies": { "@gerhobbelt/json5": { @@ -2160,31 +1800,9 @@ } }, "jison-helpers-lib": { - "version": "0.1.1-201", - "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.1.1-201.tgz", - "integrity": "sha512-GfHePRWgrNI0ixkW73uxsNo686S8MZ+sZ6GAurR6WKfdzNKthc7WHfjW52w/IFHU9ZVKlVgzgp+JfDw33U+1dA==", - "dependencies": { - "@gerhobbelt/ast-types": { - "version": "0.9.13-7", - "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.13-7.tgz", - "integrity": "sha512-OKLyvezcD1X9WHXsKfDm2nLhwt1ybNRvErTqVeM5wlq6vQvNMkWKG6SLwG3Y08gkseZWKfe7enhPiJWoJORf3A==" - }, - "@gerhobbelt/recast": { - "version": "0.12.7-11", - "resolved": "https://registry.npmjs.org/@gerhobbelt/recast/-/recast-0.12.7-11.tgz", - "integrity": "sha512-vjk3AMqq8bgg8Wf5B6n2OdWmpa9iyBYX+/N5+vTf9mz/+etm0YUHcgGdzX98f8tSTCUl+LEdMKNN4vteLbUsxg==" - }, - "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" - } - } + "version": "0.6.1-202", + "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.6.1-202.tgz", + "integrity": "sha512-OtI6OXRgpU28XfJc1T10ccxStOXp18tP6ivbgtjSU6skEPHahvm2PE7+GA21iv8eyTQ/Qq+vr0ftXoFXGaOl8w==" }, "js-tokens": { "version": "3.0.2", @@ -2192,142 +1810,6 @@ "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", "dev": true }, - "jscodeshift": { - "version": "github:GerHobbelt/jscodeshift#cebef559cde6c7402e3f96c8d606bf49d46adae1", - "dev": true, - "dependencies": { - "@gerhobbelt/ast-types": { - "version": "0.9.13-7", - "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.13-7.tgz", - "integrity": "sha512-OKLyvezcD1X9WHXsKfDm2nLhwt1ybNRvErTqVeM5wlq6vQvNMkWKG6SLwG3Y08gkseZWKfe7enhPiJWoJORf3A==" - }, - "@gerhobbelt/recast": { - "version": "github:GerHobbelt/recast#f812f6b96d76dacbe8645e47b0e26d8960997a27" - }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "braces": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.2.2.tgz", - "integrity": "sha1-JB+GjCsmkNn+vu5afIP7vyXQCxs=", - "dev": true - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - } - } - }, - "extglob": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-1.1.0.tgz", - "integrity": "sha1-Bni04s5FwOTlD15er7Gw2rW05CQ=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "to-regex": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-2.1.0.tgz", - "integrity": "sha1-4606QM/hGVWaBa6kPkyu+sxekB0=", - "dev": true, - "dependencies": { - "regex-not": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-0.1.2.tgz", - "integrity": "sha1-vH8cSUSxGINT0H3uuRK5TgreJds=", - "dev": true - } - } - } - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "dependencies": { - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true - } - } - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true - }, - "micromatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.0.4.tgz", - "integrity": "sha1-FUPx0EgTRHrIUgAcX1qTNAF4bR0=", - "dev": true - }, - "private": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", - "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" - } - } - }, "jsesc": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", @@ -2346,12 +1828,6 @@ "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", "dev": true }, - "lazy-cache": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/lazy-cache/-/lazy-cache-2.0.2.tgz", - "integrity": "sha1-uRkKT5EzVGlIQIWfio9whNiCImQ=", - "dev": true - }, "lcid": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", @@ -2388,18 +1864,6 @@ "integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==", "dev": true }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true - }, "mem": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", @@ -2431,12 +1895,6 @@ "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true }, - "mixin-deep": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.2.0.tgz", - "integrity": "sha1-0CuMb4ttS49ZgtP9AJxJGYUcP+I=", - "dev": true - }, "mkdirp": { "version": "0.5.1", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", @@ -2476,70 +1934,6 @@ "dev": true, "optional": true }, - "nanomatch": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.3.tgz", - "integrity": "sha512-HqDMQWJlwpXbfKDpAnkc6AJQh5PFqVlrjYbruDjYVAS+05TQUb1qhIde4G9jMzHbs/u6bgEok1jMAV4yJzoh+w==", - "dev": true, - "dependencies": { - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", - "dev": true - }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", - "dev": true - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "node-dir": { - "version": "0.1.17", - "resolved": "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz", - "integrity": "sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU=", - "dev": true - }, - "nomnom": { - "version": "1.8.1", - "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz", - "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=", - "dev": true, - "dependencies": { - "ansi-styles": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz", - "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg=", - "dev": true - }, - "chalk": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz", - "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=", - "dev": true - }, - "strip-ansi": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz", - "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE=", - "dev": true - }, - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, "normalize-package-data": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", @@ -2570,48 +1964,6 @@ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", "dev": true }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - } - } - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, "object.omit": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", @@ -2619,20 +1971,6 @@ "dev": true, "optional": true }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2694,12 +2032,6 @@ "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", "dev": true }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, "path-exists": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", @@ -2742,12 +2074,6 @@ "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", "dev": true }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, "preserve": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/preserve/-/preserve-0.2.0.tgz", @@ -2756,10 +2082,9 @@ "optional": true }, "private": { - "version": "0.1.8", - "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", - "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==", - "dev": true + "version": "0.1.7", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.7.tgz", + "integrity": "sha1-aM5eih7woju1cMwoU3tTMqumPvE=" }, "process-nextick-args": { "version": "1.0.7", @@ -2857,12 +2182,6 @@ "dev": true, "optional": true }, - "regex-not": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.0.tgz", - "integrity": "sha1-Qvg+OXcWIt+CawKvF2Ul1qXxV/k=", - "dev": true - }, "regexpu-core": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", @@ -2905,7 +2224,8 @@ "version": "1.6.1", "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true + "dev": true, + "optional": true }, "repeating": { "version": "2.0.1", @@ -2931,18 +2251,6 @@ "integrity": "sha512-aW7sVKPufyHqOmyyLzg/J+8606v5nevBgaliIlV7nUpVMsDnoBGV/cbSLNjZAg9q0Cfd/+easKVKQ8vOu8fn1Q==", "dev": true }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "rimraf": { - "version": "2.2.8", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.2.8.tgz", - "integrity": "sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI=", - "dev": true - }, "rollup": { "version": "0.50.0", "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.50.0.tgz", @@ -2973,12 +2281,6 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", "dev": true }, - "set-getter": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/set-getter/-/set-getter-0.1.0.tgz", - "integrity": "sha1-12nBgsnVpR9AkUXy+6guXoboA3Y=", - "dev": true - }, "set-immediate-shim": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", @@ -2986,20 +2288,6 @@ "dev": true, "optional": true }, - "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", - "dev": true, - "dependencies": { - "split-string": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.0.2.tgz", - "integrity": "sha512-d6myUSfwmBz1izkY4r7r7I0PL41rh21qUDYK1OgclmGHeoqQoujduGxMbzw6BlF3HKmJR4sMpbWVo7/Xzg4YBQ==", - "dev": true - } - } - }, "shebang-command": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", @@ -3024,75 +2312,24 @@ "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", "dev": true }, - "snapdragon": { - "version": "0.8.1", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.1.tgz", - "integrity": "sha1-4StUh/re0+PeoKyR6UAL91tAE3A=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", - "dev": true, - "dependencies": { - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", - "dev": true - }, "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.0.tgz", - "integrity": "sha1-/K0LZLcK+ydpnkJZUMtevNQQvCA=", - "dev": true + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" }, "source-map-support": { "version": "0.4.18", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "dev": true - }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true + "dev": true, + "dependencies": { + "source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", + "dev": true + } + } }, "spdx-correct": { "version": "1.0.2", @@ -3112,38 +2349,6 @@ "integrity": "sha1-yd96NCRZSt5r0RkA1ZZpbcBrrFc=", "dev": true }, - "split-string": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-2.1.1.tgz", - "integrity": "sha1-r0sG2CFWBCZEbDzZMc2mGJQNN9A=", - "dev": true - }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, "string_decoder": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.3.tgz", @@ -3201,64 +2406,12 @@ "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", "dev": true }, - "temp": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/temp/-/temp-0.8.3.tgz", - "integrity": "sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k=", - "dev": true - }, "to-fast-properties": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", "dev": true }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true - }, - "to-regex": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.1.tgz", - "integrity": "sha1-FTWL7kosg712N3uh3ASdDxiDeq4=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "dependencies": { - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true - } - } - }, "trim-right": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", @@ -3271,98 +2424,6 @@ "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", "dev": true }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true - }, - "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", - "dev": true, - "dependencies": { - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "dev": true - } - } - }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - } - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "use": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/use/-/use-2.0.2.tgz", - "integrity": "sha1-riig1y+TvyJCKhii43mZMRLeyOg=", - "dev": true, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, "user-home": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/user-home/-/user-home-1.1.1.tgz", @@ -3420,12 +2481,6 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true }, - "write-file-atomic": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-2.3.0.tgz", - "integrity": "sha512-xuPeK4OdjWqtfi59ylvVL0Yn35SF3zgcAcv7rBPFHVaEapaDr4GdGgm3j7ckTwH9wHL7fGmgfAnb0+THrHb8tA==", - "dev": true - }, "y18n": { "version": "3.2.1", "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", diff --git a/package.json b/package.json index 8535781..df37eae 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.1-201", + "version": "0.6.1-202", "description": "A parser for lexical grammars used by jison", "main": "dist/lex-parser-cjs-es5.js", "module": "lex-parser.js", @@ -28,15 +28,15 @@ "node": ">=4.0" }, "dependencies": { - "@gerhobbelt/xregexp": "3.2.0-21", - "jison-helpers-lib": "0.1.1-201" + "@gerhobbelt/xregexp": "3.2.0-22", + "jison-helpers-lib": "0.6.1-202" }, "devDependencies": { "babel-cli": "6.26.0", "babel-preset-env": "1.6.0", "babel-preset-modern-browsers": "9.0.2", "chai": "4.1.2", - "jison-gho": "0.6.1-200", + "jison-gho": "0.6.1-202", "mocha": "4.0.1", "rollup-plugin-node-resolve": "3.0.0", "rollup": "0.50.0" From 93b9406a1e004ccd5f928eafe6ffa637e5ccac60 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 16 Oct 2017 00:34:29 +0200 Subject: [PATCH 411/417] `make everything` --- dist/lex-parser-cjs-es5.js | 4 +- dist/lex-parser-cjs.js | 4 +- dist/lex-parser-es6.js | 4 +- dist/lex-parser-umd-es5.js | 4 +- dist/lex-parser-umd.js | 4 +- lex-parser.js | 4 +- package-lock.json | 339 +++++++++++++------------------------ 7 files changed, 125 insertions(+), 238 deletions(-) diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js index 473e923..2ffc19a 100644 --- a/dist/lex-parser-cjs-es5.js +++ b/dist/lex-parser-cjs-es5.js @@ -42,7 +42,7 @@ var fs = _interopDefault(require('fs')); // hack: var assert; -/* parser generated by jison 0.6.1-202 */ +/* parser generated by jison 0.6.1-203 */ /* * Returns a Parser object of the following structure: @@ -3146,7 +3146,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-202 */ +/* lexer generated by jison-lex 0.6.1-203 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js index 030e464..a2ee60a 100644 --- a/dist/lex-parser-cjs.js +++ b/dist/lex-parser-cjs.js @@ -9,7 +9,7 @@ var fs = _interopDefault(require('fs')); // hack: var assert; -/* parser generated by jison 0.6.1-202 */ +/* parser generated by jison 0.6.1-203 */ /* * Returns a Parser object of the following structure: @@ -4907,7 +4907,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-202 */ +/* lexer generated by jison-lex 0.6.1-203 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 82060f2..846dd91 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -5,7 +5,7 @@ import fs from 'fs'; // hack: var assert; -/* parser generated by jison 0.6.1-202 */ +/* parser generated by jison 0.6.1-203 */ /* * Returns a Parser object of the following structure: @@ -4903,7 +4903,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-202 */ +/* lexer generated by jison-lex 0.6.1-203 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js index e964e33..0fa3e1b 100644 --- a/dist/lex-parser-umd-es5.js +++ b/dist/lex-parser-umd-es5.js @@ -43,7 +43,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert; - /* parser generated by jison 0.6.1-202 */ + /* parser generated by jison 0.6.1-203 */ /* * Returns a Parser object of the following structure: @@ -3147,7 +3147,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; - /* lexer generated by jison-lex 0.6.1-202 */ + /* lexer generated by jison-lex 0.6.1-203 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js index e53be87..fe58842 100644 --- a/dist/lex-parser-umd.js +++ b/dist/lex-parser-umd.js @@ -11,7 +11,7 @@ fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; // hack: var assert; -/* parser generated by jison 0.6.1-202 */ +/* parser generated by jison 0.6.1-203 */ /* * Returns a Parser object of the following structure: @@ -4909,7 +4909,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-202 */ +/* lexer generated by jison-lex 0.6.1-203 */ /* * Returns a Lexer object of the following structure: diff --git a/lex-parser.js b/lex-parser.js index 2ca62c1..ccb9140 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2,7 +2,7 @@ // hack: var assert; -/* parser generated by jison 0.6.1-202 */ +/* parser generated by jison 0.6.1-203 */ /* * Returns a Parser object of the following structure: @@ -4916,7 +4916,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-202 */ +/* lexer generated by jison-lex 0.6.1-203 */ /* * Returns a Lexer object of the following structure: diff --git a/package-lock.json b/package-lock.json index a14483d..5c902c0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -793,172 +793,146 @@ "dependencies": { "abbrev": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.0.tgz", - "integrity": "sha1-0FVMIlZjbi9W58LlrRg/hZQo2B8=", + "bundled": true, "dev": true, "optional": true }, "ajv": { "version": "4.11.8", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-4.11.8.tgz", - "integrity": "sha1-gv+wKynmYq5TvcIK8VlHcGc5xTY=", + "bundled": true, "dev": true, "optional": true }, "ansi-regex": { "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "bundled": true, "dev": true }, "aproba": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.1.1.tgz", - "integrity": "sha1-ldNgDwdxCqDpKYxyatXs8urLq6s=", + "bundled": true, "dev": true, "optional": true }, "are-we-there-yet": { "version": "1.1.4", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.4.tgz", - "integrity": "sha1-u13KOCu5TwXhUZQ3PRb9O6HKEQ0=", + "bundled": true, "dev": true, "optional": true }, "asn1": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", - "integrity": "sha1-2sh4dxPJlmhJ/IGAd36+nB3fO4Y=", + "bundled": true, "dev": true, "optional": true }, "assert-plus": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-0.2.0.tgz", - "integrity": "sha1-104bh+ev/A24qttwIfP+SBAasjQ=", + "bundled": true, "dev": true, "optional": true }, "asynckit": { "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=", + "bundled": true, "dev": true, "optional": true }, "aws-sign2": { "version": "0.6.0", - "resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "integrity": "sha1-FDQt0428yU0OW4fXY81jYSwOeU8=", + "bundled": true, "dev": true, "optional": true }, "aws4": { "version": "1.6.0", - "resolved": "https://registry.npmjs.org/aws4/-/aws4-1.6.0.tgz", - "integrity": "sha1-g+9cqGCysy5KDe7e6MdxudtXRx4=", + "bundled": true, "dev": true, "optional": true }, "balanced-match": { "version": "0.4.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.4.2.tgz", - "integrity": "sha1-yz8+PHMtwPAe5wtAPzAuYddwmDg=", + "bundled": true, "dev": true }, "bcrypt-pbkdf": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.1.tgz", - "integrity": "sha1-Y7xdy2EzG5K8Bf1SiVPDNGKgb40=", + "bundled": true, "dev": true, "optional": true }, "block-stream": { "version": "0.0.9", - "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", - "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", + "bundled": true, "dev": true }, "boom": { "version": "2.10.1", - "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", - "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", + "bundled": true, "dev": true }, "brace-expansion": { "version": "1.1.7", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.7.tgz", - "integrity": "sha1-Pv/DxQ4ABTH7cg6v+A8K6O8jz1k=", + "bundled": true, "dev": true }, "buffer-shims": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", - "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=", + "bundled": true, "dev": true }, "caseless": { "version": "0.12.0", - "resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz", - "integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=", + "bundled": true, "dev": true, "optional": true }, "co": { "version": "4.6.0", - "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", - "integrity": "sha1-bqa989hTrlTMuOR7+gvz+QMfsYQ=", + "bundled": true, "dev": true, "optional": true }, "code-point-at": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", + "bundled": true, "dev": true }, "combined-stream": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "integrity": "sha1-k4NwpXtKUd6ix3wV1cX9+JUWQAk=", + "bundled": true, "dev": true }, "concat-map": { "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "bundled": true, "dev": true }, "console-control-strings": { "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", + "bundled": true, "dev": true }, "core-util-is": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "bundled": true, "dev": true }, "cryptiles": { "version": "2.0.5", - "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", - "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", + "bundled": true, "dev": true, "optional": true }, "dashdash": { "version": "1.14.1", - "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", - "integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=", + "bundled": true, "dev": true, "optional": true, "dependencies": { "assert-plus": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "bundled": true, "dev": true, "optional": true } @@ -966,102 +940,87 @@ }, "debug": { "version": "2.6.8", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", - "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "bundled": true, "dev": true, "optional": true }, "deep-extend": { "version": "0.4.2", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.4.2.tgz", - "integrity": "sha1-SLaZwn4zS/ifEIkr5DL25MfTSn8=", + "bundled": true, "dev": true, "optional": true }, "delayed-stream": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", + "bundled": true, "dev": true }, "delegates": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", + "bundled": true, "dev": true, "optional": true }, "ecc-jsbn": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", - "integrity": "sha1-D8c6ntXw1Tw4GTOYUj735UN3dQU=", + "bundled": true, "dev": true, "optional": true }, "extend": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", - "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=", + "bundled": true, "dev": true, "optional": true }, "extsprintf": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.0.2.tgz", - "integrity": "sha1-4QgOBljjALBilJkMxw4VAiNf1VA=", + "bundled": true, "dev": true }, "forever-agent": { "version": "0.6.1", - "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=", + "bundled": true, "dev": true, "optional": true }, "form-data": { "version": "2.1.4", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.1.4.tgz", - "integrity": "sha1-M8GDrPGTJ27KqYFDpp6Uv+4XUNE=", + "bundled": true, "dev": true, "optional": true }, "fs.realpath": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "bundled": true, "dev": true }, "fstream": { "version": "1.0.11", - "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", - "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", + "bundled": true, "dev": true }, "fstream-ignore": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/fstream-ignore/-/fstream-ignore-1.0.5.tgz", - "integrity": "sha1-nDHa40dnAY/h0kmyTa2mfQktoQU=", + "bundled": true, "dev": true, "optional": true }, "gauge": { "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", + "bundled": true, "dev": true, "optional": true }, "getpass": { "version": "0.1.7", - "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", - "integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=", + "bundled": true, "dev": true, "optional": true, "dependencies": { "assert-plus": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "bundled": true, "dev": true, "optional": true } @@ -1069,155 +1028,132 @@ }, "glob": { "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", + "bundled": true, "dev": true }, "graceful-fs": { "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "bundled": true, "dev": true }, "har-schema": { "version": "1.0.5", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-1.0.5.tgz", - "integrity": "sha1-0mMTX0MwfALGAq/I/pWXDAFRNp4=", + "bundled": true, "dev": true, "optional": true }, "har-validator": { "version": "4.2.1", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-4.2.1.tgz", - "integrity": "sha1-M0gdDxu/9gDdID11gSpqX7oALio=", + "bundled": true, "dev": true, "optional": true }, "has-unicode": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", + "bundled": true, "dev": true, "optional": true }, "hawk": { "version": "3.1.3", - "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", - "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", + "bundled": true, "dev": true, "optional": true }, "hoek": { "version": "2.16.3", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", - "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", + "bundled": true, "dev": true }, "http-signature": { "version": "1.1.1", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz", - "integrity": "sha1-33LiZwZs0Kxn+3at+OE0qPvPkb8=", + "bundled": true, "dev": true, "optional": true }, "inflight": { "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "bundled": true, "dev": true }, "inherits": { "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "bundled": true, "dev": true }, "ini": { "version": "1.3.4", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.4.tgz", - "integrity": "sha1-BTfLedr1m1mhpRff9wbIbsA5Fi4=", + "bundled": true, "dev": true, "optional": true }, "is-fullwidth-code-point": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", + "bundled": true, "dev": true }, "is-typedarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", - "integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=", + "bundled": true, "dev": true, "optional": true }, "isarray": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "bundled": true, "dev": true }, "isstream": { "version": "0.1.2", - "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=", + "bundled": true, "dev": true, "optional": true }, "jodid25519": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/jodid25519/-/jodid25519-1.0.2.tgz", - "integrity": "sha1-BtSRIlUJNBlHfUJWM2BuDpB4KWc=", + "bundled": true, "dev": true, "optional": true }, "jsbn": { "version": "0.1.1", - "resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz", - "integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=", + "bundled": true, "dev": true, "optional": true }, "json-schema": { "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", + "bundled": true, "dev": true, "optional": true }, "json-stable-stringify": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz", - "integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=", + "bundled": true, "dev": true, "optional": true }, "json-stringify-safe": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", + "bundled": true, "dev": true, "optional": true }, "jsonify": { "version": "0.0.0", - "resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz", - "integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM=", + "bundled": true, "dev": true, "optional": true }, "jsprim": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.0.tgz", - "integrity": "sha1-o7h+QCmNjDgFUtjMdiigu5WiKRg=", + "bundled": true, "dev": true, "optional": true, "dependencies": { "assert-plus": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "bundled": true, "dev": true, "optional": true } @@ -1225,153 +1161,130 @@ }, "mime-db": { "version": "1.27.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.27.0.tgz", - "integrity": "sha1-gg9XIpa70g7CXtVeW13oaeVDbrE=", + "bundled": true, "dev": true }, "mime-types": { "version": "2.1.15", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.15.tgz", - "integrity": "sha1-pOv1BkCUVpI3uM9wBGd20J/JKu0=", + "bundled": true, "dev": true }, "minimatch": { "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "bundled": true, "dev": true }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "bundled": true, "dev": true }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "bundled": true, "dev": true }, "ms": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "bundled": true, "dev": true, "optional": true }, "node-pre-gyp": { "version": "0.6.36", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.6.36.tgz", - "integrity": "sha1-22BBEst04NR3VU6bUFsXq936t4Y=", + "bundled": true, "dev": true, "optional": true }, "nopt": { "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", - "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", + "bundled": true, "dev": true, "optional": true }, "npmlog": { "version": "4.1.0", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.0.tgz", - "integrity": "sha512-ocolIkZYZt8UveuiDS0yAkkIjid1o7lPG8cYm05yNYzBn8ykQtaiPMEGp8fY9tKdDgm8okpdKzkvu1y9hUYugA==", + "bundled": true, "dev": true, "optional": true }, "number-is-nan": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", + "bundled": true, "dev": true }, "oauth-sign": { "version": "0.8.2", - "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz", - "integrity": "sha1-Rqarfwrq2N6unsBWV4C31O/rnUM=", + "bundled": true, "dev": true, "optional": true }, "object-assign": { "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "bundled": true, "dev": true, "optional": true }, "once": { "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "bundled": true, "dev": true }, "os-homedir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", + "bundled": true, "dev": true, "optional": true }, "os-tmpdir": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "bundled": true, "dev": true, "optional": true }, "osenv": { "version": "0.1.4", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.4.tgz", - "integrity": "sha1-Qv5tWVPfBsgGS+bxdsPQWqqjRkQ=", + "bundled": true, "dev": true, "optional": true }, "path-is-absolute": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "bundled": true, "dev": true }, "performance-now": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-0.2.0.tgz", - "integrity": "sha1-M+8wxcd9TqIcWlOGnZG1bY8lVeU=", + "bundled": true, "dev": true, "optional": true }, "process-nextick-args": { "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", + "bundled": true, "dev": true }, "punycode": { "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "bundled": true, "dev": true, "optional": true }, "qs": { "version": "6.4.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.4.0.tgz", - "integrity": "sha1-E+JtKK1rD/qpExLNO/cI7TUecjM=", + "bundled": true, "dev": true, "optional": true }, "rc": { "version": "1.2.1", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.1.tgz", - "integrity": "sha1-LgPo5C7kULjLPc5lvhv4l04d/ZU=", + "bundled": true, "dev": true, "optional": true, "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", + "bundled": true, "dev": true, "optional": true } @@ -1379,68 +1292,58 @@ }, "readable-stream": { "version": "2.2.9", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.9.tgz", - "integrity": "sha1-z3jsb0ptHrQ9JkiMrJfwQudLf8g=", + "bundled": true, "dev": true }, "request": { "version": "2.81.0", - "resolved": "https://registry.npmjs.org/request/-/request-2.81.0.tgz", - "integrity": "sha1-xpKJRqDgbF+Nb4qTM0af/aRimKA=", + "bundled": true, "dev": true, "optional": true }, "rimraf": { "version": "2.6.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.1.tgz", - "integrity": "sha1-wjOOxkPfeht/5cVPqG9XQopV8z0=", + "bundled": true, "dev": true }, "safe-buffer": { "version": "5.0.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.0.1.tgz", - "integrity": "sha1-0mPKVGls2KMGtcplUekt5XkY++c=", + "bundled": true, "dev": true }, "semver": { "version": "5.3.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz", - "integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=", + "bundled": true, "dev": true, "optional": true }, "set-blocking": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "bundled": true, "dev": true, "optional": true }, "signal-exit": { "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "bundled": true, "dev": true, "optional": true }, "sntp": { "version": "1.0.9", - "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", - "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", + "bundled": true, "dev": true, "optional": true }, "sshpk": { "version": "1.13.0", - "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.13.0.tgz", - "integrity": "sha1-/yo+T9BEl1Vf7Zezmg/YL6+zozw=", + "bundled": true, "dev": true, "optional": true, "dependencies": { "assert-plus": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", - "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", + "bundled": true, "dev": true, "optional": true } @@ -1448,108 +1351,92 @@ }, "string_decoder": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.0.1.tgz", - "integrity": "sha1-YuIA8DmVWmgQ2N8KM//A8BNmLZg=", + "bundled": true, "dev": true }, "string-width": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", + "bundled": true, "dev": true }, "stringstream": { "version": "0.0.5", - "resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "integrity": "sha1-TkhM1N5aC7vuGORjB3EKioFiGHg=", + "bundled": true, "dev": true, "optional": true }, "strip-ansi": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", + "bundled": true, "dev": true }, "strip-json-comments": { "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "bundled": true, "dev": true, "optional": true }, "tar": { "version": "2.2.1", - "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", - "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", + "bundled": true, "dev": true }, "tar-pack": { "version": "3.4.0", - "resolved": "https://registry.npmjs.org/tar-pack/-/tar-pack-3.4.0.tgz", - "integrity": "sha1-I74tf2cagzk3bL2wuP4/3r8xeYQ=", + "bundled": true, "dev": true, "optional": true }, "tough-cookie": { "version": "2.3.2", - "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.3.2.tgz", - "integrity": "sha1-8IH3bkyFcg5sN6X6ztc3FQ2EByo=", + "bundled": true, "dev": true, "optional": true }, "tunnel-agent": { "version": "0.6.0", - "resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz", - "integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=", + "bundled": true, "dev": true, "optional": true }, "tweetnacl": { "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", + "bundled": true, "dev": true, "optional": true }, "uid-number": { "version": "0.0.6", - "resolved": "https://registry.npmjs.org/uid-number/-/uid-number-0.0.6.tgz", - "integrity": "sha1-DqEOgDXo61uOREnwbaHHMGY7qoE=", + "bundled": true, "dev": true, "optional": true }, "util-deprecate": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "bundled": true, "dev": true }, "uuid": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.0.1.tgz", - "integrity": "sha1-ZUS7ot/ajBzxfmKaOjBeK7H+5sE=", + "bundled": true, "dev": true, "optional": true }, "verror": { "version": "1.3.6", - "resolved": "https://registry.npmjs.org/verror/-/verror-1.3.6.tgz", - "integrity": "sha1-z/XfEpRtKX0rqu+qJoniW+AcAFw=", + "bundled": true, "dev": true, "optional": true }, "wide-align": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.2.tgz", - "integrity": "sha512-ijDLlyQ7s6x1JgCLur53osjm/UXUYD9+0PbYKrBsYisYXzCxN+HC3mYDNy/dWdmf3AwqwU3CXwDCvsNgGK1S0w==", + "bundled": true, "dev": true, "optional": true }, "wrappy": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "bundled": true, "dev": true } } From db81fbd9388e4363c51bf3102bac02739ed9bf77 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 16 Oct 2017 01:19:59 +0200 Subject: [PATCH 412/417] bumped build revision --- dist/lex-parser-cjs-es5.js | 4 ++-- dist/lex-parser-cjs.js | 4 ++-- dist/lex-parser-es6.js | 4 ++-- dist/lex-parser-umd-es5.js | 4 ++-- dist/lex-parser-umd.js | 4 ++-- lex-parser.js | 4 ++-- package-lock.json | 12 ++++++------ package.json | 4 ++-- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js index 2ffc19a..6dc7cf3 100644 --- a/dist/lex-parser-cjs-es5.js +++ b/dist/lex-parser-cjs-es5.js @@ -42,7 +42,7 @@ var fs = _interopDefault(require('fs')); // hack: var assert; -/* parser generated by jison 0.6.1-203 */ +/* parser generated by jison 0.6.1-204 */ /* * Returns a Parser object of the following structure: @@ -3146,7 +3146,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-203 */ +/* lexer generated by jison-lex 0.6.1-204 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js index a2ee60a..8855185 100644 --- a/dist/lex-parser-cjs.js +++ b/dist/lex-parser-cjs.js @@ -9,7 +9,7 @@ var fs = _interopDefault(require('fs')); // hack: var assert; -/* parser generated by jison 0.6.1-203 */ +/* parser generated by jison 0.6.1-204 */ /* * Returns a Parser object of the following structure: @@ -4907,7 +4907,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-203 */ +/* lexer generated by jison-lex 0.6.1-204 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 846dd91..348d6b6 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -5,7 +5,7 @@ import fs from 'fs'; // hack: var assert; -/* parser generated by jison 0.6.1-203 */ +/* parser generated by jison 0.6.1-204 */ /* * Returns a Parser object of the following structure: @@ -4903,7 +4903,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-203 */ +/* lexer generated by jison-lex 0.6.1-204 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js index 0fa3e1b..5a60721 100644 --- a/dist/lex-parser-umd-es5.js +++ b/dist/lex-parser-umd-es5.js @@ -43,7 +43,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert; - /* parser generated by jison 0.6.1-203 */ + /* parser generated by jison 0.6.1-204 */ /* * Returns a Parser object of the following structure: @@ -3147,7 +3147,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; - /* lexer generated by jison-lex 0.6.1-203 */ + /* lexer generated by jison-lex 0.6.1-204 */ /* * Returns a Lexer object of the following structure: diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js index fe58842..8229a77 100644 --- a/dist/lex-parser-umd.js +++ b/dist/lex-parser-umd.js @@ -11,7 +11,7 @@ fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; // hack: var assert; -/* parser generated by jison 0.6.1-203 */ +/* parser generated by jison 0.6.1-204 */ /* * Returns a Parser object of the following structure: @@ -4909,7 +4909,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-203 */ +/* lexer generated by jison-lex 0.6.1-204 */ /* * Returns a Lexer object of the following structure: diff --git a/lex-parser.js b/lex-parser.js index ccb9140..fd27710 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2,7 +2,7 @@ // hack: var assert; -/* parser generated by jison 0.6.1-203 */ +/* parser generated by jison 0.6.1-204 */ /* * Returns a Parser object of the following structure: @@ -4916,7 +4916,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-203 */ +/* lexer generated by jison-lex 0.6.1-204 */ /* * Returns a Lexer object of the following structure: diff --git a/package-lock.json b/package-lock.json index 5c902c0..d34d2a2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1673,9 +1673,9 @@ "optional": true }, "jison-gho": { - "version": "0.6.1-202", - "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.1-202.tgz", - "integrity": "sha512-j/JV1B1t6GkGRj4NYQF0QXYgALrvXZb5dP+a9oKAyO665JEyQv6q8SjZd5NMpxS6Q1bW3Qasscl/cvZG4LRrfg==", + "version": "0.6.1-203", + "resolved": "https://registry.npmjs.org/jison-gho/-/jison-gho-0.6.1-203.tgz", + "integrity": "sha512-sFPO1T5uuMojPkwi8wC0KB5RaFlBTb8EsfOKcXtHuKoukinlIMy6HqMYPMeJ61G7xVoha4tdlO1I9samUpmLEw==", "dev": true, "dependencies": { "@gerhobbelt/json5": { @@ -1687,9 +1687,9 @@ } }, "jison-helpers-lib": { - "version": "0.6.1-202", - "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.6.1-202.tgz", - "integrity": "sha512-OtI6OXRgpU28XfJc1T10ccxStOXp18tP6ivbgtjSU6skEPHahvm2PE7+GA21iv8eyTQ/Qq+vr0ftXoFXGaOl8w==" + "version": "0.6.1-203", + "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.6.1-203.tgz", + "integrity": "sha512-Pc8JW2rGm3ZpFtcYD3+uoZdVRmnyBPwzZc2SaPvriWbSPwsQpLOZjSGOq5WK6fuPZH0FhifHwr0YwHwiXS3hWw==" }, "js-tokens": { "version": "3.0.2", diff --git a/package.json b/package.json index df37eae..ce16f84 100644 --- a/package.json +++ b/package.json @@ -29,14 +29,14 @@ }, "dependencies": { "@gerhobbelt/xregexp": "3.2.0-22", - "jison-helpers-lib": "0.6.1-202" + "jison-helpers-lib": "0.6.1-203" }, "devDependencies": { "babel-cli": "6.26.0", "babel-preset-env": "1.6.0", "babel-preset-modern-browsers": "9.0.2", "chai": "4.1.2", - "jison-gho": "0.6.1-202", + "jison-gho": "0.6.1-203", "mocha": "4.0.1", "rollup-plugin-node-resolve": "3.0.0", "rollup": "0.50.0" From 8694f37ed8edf45a02f2f4797a2344d3e7ffecab Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 16 Oct 2017 14:18:46 +0200 Subject: [PATCH 413/417] sync --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index ce16f84..077bb42 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.1-202", + "version": "0.6.1-204", "description": "A parser for lexical grammars used by jison", "main": "dist/lex-parser-cjs-es5.js", "module": "lex-parser.js", From ba36d599144db27ae6f15fac85bffc30775e3676 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Mon, 23 Oct 2017 18:39:05 +0200 Subject: [PATCH 414/417] sync + added/updated badges for all jison modules in their related README's --- README.md | 8 +++++- lex-parser.js | 74 +++++++++++++++++++++++++-------------------------- 2 files changed, 43 insertions(+), 39 deletions(-) diff --git a/README.md b/README.md index 55e5033..284f22d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,13 @@ # lex-parser \[SECONDARY SOURCE REPO] -[![build status](https://secure.travis-ci.org/GerHobbelt/lex-parser.png)](http://travis-ci.org/GerHobbelt/lex-parser) +[![Join the chat at https://gitter.im/jison-parsers-lexers/Lobby](https://badges.gitter.im/jison-parsers-lexers/Lobby.svg)](https://gitter.im/jison-parsers-lexers/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +[![Build Status](https://travis-ci.org/GerHobbelt/lex-parser.svg?branch=master)](https://travis-ci.org/GerHobbelt/lex-parser) +[![NPM version](https://badge.fury.io/js/@gerhobbelt/lex-parser.svg)](http://badge.fury.io/js/@gerhobbelt/lex-parser) +[![Dependency Status](https://img.shields.io/david/GerHobbelt/lex-parser.svg)](https://david-dm.org/GerHobbelt/lex-parser) +[![npm](https://img.shields.io/npm/dm/@gerhobbelt/lex-parser.svg?maxAge=2592000)]() + + A parser for lexical grammars used by [jison](http://jison.org) and jison-lex. diff --git a/lex-parser.js b/lex-parser.js index fd27710..3ac42c2 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -5274,7 +5274,23 @@ EOF: 1, * @public * @this {RegExpLexer} */ - constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) { + msg = '' + msg; + + if (this.yylloc) { + if (typeof this.showPosition === 'function') { + var pos_str = this.showPosition(); + + if (pos_str) { + if (msg.length && msg[msg.length - 1] !== '\n' && pos_str[0] !== '\n') { + msg += '\n' + pos_str; + } else { + msg += pos_str; + } + } + } + } + /** @constructor */ var pei = { errStr: msg, @@ -5352,7 +5368,7 @@ EOF: 1, yyerror: function yyError(str /*, ...args */) { var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } @@ -5639,7 +5655,12 @@ EOF: 1, if (lines.length > 1) { this.yylineno -= lines.length - 1; this.yylloc.last_line = this.yylineno + 1; + + // Get last entirely matched line into the `pre_lines[]` array's + // last index slot; we don't mind when other previously + // matched lines end up in the array too. var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); if (pre_lines.length === 1) { @@ -5684,22 +5705,12 @@ EOF: 1, // `.lex()` run. var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, + 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).', false ); @@ -6175,18 +6186,8 @@ EOF: 1, lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, + 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!', false ); @@ -6248,27 +6249,24 @@ EOF: 1, lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, + 'Lexical error' + lineno_msg + ': Unrecognized text.', this.options.lexerErrorsAreRecoverable ); + var pendingInput = this._input; + var activeCondition = this.topState(); + var conditionStackDepth = this.conditionStack.length; token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us - // by moving forward at least one character at a time: - if (!this.match.length) { + // by moving forward at least one character at a time IFF the (user-specified?) `parseError()` + // has not consumed/modified any pending input or changed state in the error handler: + if (!this.matches && // and make sure the input has been modified/consumed ... + pendingInput === this._input && // ...or the lexer state has been modified significantly enough + // to merit a non-consuming error handling action right now. + activeCondition === this.topState() && conditionStackDepth === this.conditionStack.length) { this.input(); } } From 9f4e142c389f80aaceaff86abc6eb2d1e03c6322 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 24 Oct 2017 00:58:21 +0200 Subject: [PATCH 415/417] bumped build revision + sync --- dist/lex-parser-cjs-es5.js | 619 ++++++++------ dist/lex-parser-cjs.js | 1665 ++++++++++++++++++++---------------- dist/lex-parser-es6.js | 1665 ++++++++++++++++++++---------------- dist/lex-parser-umd-es5.js | 619 ++++++++------ dist/lex-parser-umd.js | 1665 ++++++++++++++++++++---------------- lex-parser.js | 1603 +++++++++++++++++++--------------- lex.l | 49 +- lex.y | 176 +++- package-lock.json | 71 +- package.json | 10 +- tests/all-tests.js | 4 +- tests/lex/ansic.jisonlex | 4 +- 12 files changed, 4687 insertions(+), 3463 deletions(-) diff --git a/dist/lex-parser-cjs-es5.js b/dist/lex-parser-cjs-es5.js index 6dc7cf3..4106215 100644 --- a/dist/lex-parser-cjs-es5.js +++ b/dist/lex-parser-cjs-es5.js @@ -2,32 +2,39 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject2 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject3 = _taggedTemplateLiteral(['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject4 = _taggedTemplateLiteral(['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject5 = _taggedTemplateLiteral(['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject6 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject7 = _taggedTemplateLiteral(['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject8 = _taggedTemplateLiteral(['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), - _templateObject9 = _taggedTemplateLiteral(['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), - _templateObject10 = _taggedTemplateLiteral(['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n '], ['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n ']), - _templateObject11 = _taggedTemplateLiteral(['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject12 = _taggedTemplateLiteral(['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject13 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject14 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject15 = _taggedTemplateLiteral(['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject16 = _taggedTemplateLiteral(['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject17 = _taggedTemplateLiteral(['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject18 = _taggedTemplateLiteral(['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject19 = _taggedTemplateLiteral(['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%\\}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), - _templateObject20 = _taggedTemplateLiteral(['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%\\}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), - _templateObject21 = _taggedTemplateLiteral(['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n ']), - _templateObject22 = _taggedTemplateLiteral(['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n '], ['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n ']), - _templateObject23 = _taggedTemplateLiteral(['\n unterminated string constant in %options entry.\n\n Erroneous area:\n '], ['\n unterminated string constant in %options entry.\n\n Erroneous area:\n ']), - _templateObject24 = _taggedTemplateLiteral(['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n '], ['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n ']), - _templateObject25 = _taggedTemplateLiteral(['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n '], ['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n ']), - _templateObject26 = _taggedTemplateLiteral(['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n ']); +var _templateObject = _taggedTemplateLiteral(['\n There\'s an error in your lexer regex rules or epilogue.\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional epilogue!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n There\'s an error in your lexer regex rules or epilogue.\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional epilogue!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject2 = _taggedTemplateLiteral(['\n There\'s probably an error in one or more of your lexer regex rules.\n The lexer rule spec should have this structure:\n \n regex action_code\n \n where \'regex\' is a lex-style regex expression (see the\n jison and jison-lex documentation) which is intended to match a chunk\n of the input to lex, while the \'action_code\' block is the JS code\n which will be invoked when the regex is matched. The \'action_code\' block\n may be any (indented!) set of JS statements, optionally surrounded \n by \'{...}\' curly braces or otherwise enclosed in a \'%{...%}\' block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n There\'s probably an error in one or more of your lexer regex rules.\n The lexer rule spec should have this structure:\n \n regex action_code\n \n where \'regex\' is a lex-style regex expression (see the\n jison and jison-lex documentation) which is intended to match a chunk\n of the input to lex, while the \'action_code\' block is the JS code\n which will be invoked when the regex is matched. The \'action_code\' block\n may be any (indented!) set of JS statements, optionally surrounded \n by \'{...}\' curly braces or otherwise enclosed in a \'%{...%}\' block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject3 = _taggedTemplateLiteral(['\n There\'s an error in your lexer epilogue a.k.a. \'extra_module_code\' block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n There\'s an error in your lexer epilogue a.k.a. \'extra_module_code\' block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject4 = _taggedTemplateLiteral(['\n The \'%{...%}\' lexer setup action code section does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The \'%{...%}\' lexer setup action code section does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject5 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject6 = _taggedTemplateLiteral(['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject7 = _taggedTemplateLiteral(['\n The \'%code ', '\' action code section does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The \'%code ', '\' action code section does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject8 = _taggedTemplateLiteral(['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject9 = _taggedTemplateLiteral(['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject10 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject11 = _taggedTemplateLiteral(['\n The rule\'s action code section does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The rule\'s action code section does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject12 = _taggedTemplateLiteral(['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject13 = _taggedTemplateLiteral(['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), + _templateObject14 = _taggedTemplateLiteral(['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), + _templateObject15 = _taggedTemplateLiteral(['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n '], ['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n ']), + _templateObject16 = _taggedTemplateLiteral(['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject17 = _taggedTemplateLiteral(['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject18 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject19 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject20 = _taggedTemplateLiteral(['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject21 = _taggedTemplateLiteral(['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject22 = _taggedTemplateLiteral(['\n The extra lexer module code section (a.k.a. \'epilogue\') does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The extra lexer module code section (a.k.a. \'epilogue\') does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject23 = _taggedTemplateLiteral(['\n The source code %include-d into the extra lexer module code section (a.k.a. \'epilogue\') does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The source code %include-d into the extra lexer module code section (a.k.a. \'epilogue\') does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject24 = _taggedTemplateLiteral(['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject25 = _taggedTemplateLiteral(['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject26 = _taggedTemplateLiteral(['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), + _templateObject27 = _taggedTemplateLiteral(['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), + _templateObject28 = _taggedTemplateLiteral(['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n ']), + _templateObject29 = _taggedTemplateLiteral(['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n '], ['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n ']), + _templateObject30 = _taggedTemplateLiteral(['\n unterminated string constant in %options entry.\n\n Erroneous area:\n '], ['\n unterminated string constant in %options entry.\n\n Erroneous area:\n ']), + _templateObject31 = _taggedTemplateLiteral(['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n '], ['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n ']), + _templateObject32 = _taggedTemplateLiteral(['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n '], ['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n ']), + _templateObject33 = _taggedTemplateLiteral(['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n ']); function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } @@ -42,7 +49,7 @@ var fs = _interopDefault(require('fs')); // hack: var assert; -/* parser generated by jison 0.6.1-204 */ +/* parser generated by jison 0.6.1-205 */ /* * Returns a Parser object of the following structure: @@ -875,8 +882,8 @@ var parser = { return tokenset; }, productions_: bp({ - pop: u([54, 54, s, [55, 3], 56, 57, 57, s, [58, 11], 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, s, [65, 4], 66, 66, 67, 67, s, [68, 3], s, [69, 9], s, [70, 4], 71, 71, 72, s, [73, 4], s, [74, 4], 75, 75, s, [76, 17], 77, 78, 78, 79, 79, 80, s, [80, 4, 1], 83, 84, 85, 85, s, [86, 6], 87, 87, 88, 88, s, [89, 3], 90, 90]), - rule: u([s, [4, 3], 2, 0, 0, 2, 0, s, [2, 3], s, [1, 3], 3, 3, 2, 3, 3, s, [1, 7], 2, 1, 2, c, [23, 3], 4, 4, 3, c, [29, 4], s, [3, 3], s, [2, 8], 0, s, [3, 3], 0, 1, 3, 1, s, [3, 4, -1], c, [21, 3], c, [40, 3], s, [3, 4], s, [2, 5], c, [12, 3], s, [1, 6], c, [16, 3], c, [10, 8], c, [9, 3], s, [3, 4], c, [10, 4], c, [32, 5], 0]) + pop: u([54, 54, s, [55, 6], 56, 57, 57, s, [58, 11], 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, s, [65, 4], 66, 66, 67, 67, s, [68, 3], s, [69, 9], s, [70, 4], 71, 71, 72, s, [73, 4], s, [74, 4], 75, 75, s, [76, 17], 77, 78, 78, 79, 79, 80, s, [80, 4, 1], 83, 84, 85, 85, s, [86, 6], 87, 87, 88, 88, s, [89, 3], 90, 90]), + rule: u([s, [4, 3], s, [5, 4, -1], 0, 0, 2, 0, s, [2, 3], s, [1, 3], 3, 3, 2, 3, 3, s, [1, 7], 2, 1, 2, c, [23, 3], 4, c, [32, 4], 2, c, [22, 3], 3, s, [2, 8], 0, s, [3, 3], 0, 1, 3, 1, s, [3, 4, -1], c, [21, 3], c, [40, 3], s, [3, 4], s, [2, 5], c, [12, 3], s, [1, 6], c, [16, 3], c, [10, 8], c, [9, 3], s, [3, 4], c, [10, 4], c, [82, 4], 1, 0]) }), performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyvstack, yylstack) { @@ -939,7 +946,7 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject, yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); + yyparser.yyError(rmCommonWS(_templateObject, yylexer.prettyPrintRange(yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); break; case 3: @@ -950,7 +957,7 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + if (yyvstack[yysp].trim() !== '') { this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; } else { this.$ = { rules: yyvstack[yysp - 2] }; @@ -958,6 +965,42 @@ var parser = { break; case 4: + /*! Production:: rules_and_epilogue : "%%" error rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 4]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 4, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject2, yylexer.prettyPrintRange(yylstack[yysp - 3]), yyvstack[yysp - 3].errStr)); + break; + + case 5: + /*! Production:: rules_and_epilogue : "%%" rules "%%" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject3, yylexer.prettyPrintRange(yylstack[yysp]), yyvstack[yysp].errStr)); + break; + + case 6: + /*! Production:: rules_and_epilogue : "%%" error rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject2, yylexer.prettyPrintRange(yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); + break; + + case 7: /*! Production:: rules_and_epilogue : "%%" rules */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -968,7 +1011,7 @@ var parser = { this.$ = { rules: yyvstack[yysp] }; break; - case 5: + case 8: /*! Production:: rules_and_epilogue : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -979,7 +1022,7 @@ var parser = { this.$ = { rules: [] }; break; - case 6: + case 9: /*! Production:: init : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -992,7 +1035,7 @@ var parser = { if (!yy.options) yy.options = {}; break; - case 7: + case 10: /*! Production:: definitions : definitions definition */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1014,7 +1057,7 @@ var parser = { } break; - case 8: + case 11: /*! Production:: definitions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1029,10 +1072,8 @@ var parser = { }; break; - case 9: - /*! Production:: definition : NAME regex */ - case 38: - /*! Production:: rule : regex action */ + case 12: + /*! Production:: definition : NAME regex */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); @@ -1042,9 +1083,9 @@ var parser = { this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; - case 10: + case 13: /*! Production:: definition : START_INC names_inclusive */ - case 11: + case 14: /*! Production:: definition : START_EXC names_exclusive */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1055,7 +1096,7 @@ var parser = { this.$ = yyvstack[yysp]; break; - case 12: + case 15: /*! Production:: definition : action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1063,12 +1104,17 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - yy.actionInclude.push(yyvstack[yysp]);this.$ = null; + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject4, rv, yylexer.prettyPrintRange(yylstack[yysp]))); + } + yy.actionInclude.push(yyvstack[yysp]); + this.$ = null; break; - case 13: + case 16: /*! Production:: definition : options */ - case 99: + case 102: /*! Production:: option_list : option */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1079,7 +1125,7 @@ var parser = { this.$ = null; break; - case 14: + case 17: /*! Production:: definition : UNKNOWN_DECL */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1090,7 +1136,7 @@ var parser = { this.$ = { type: 'unknown', body: yyvstack[yysp] }; break; - case 15: + case 18: /*! Production:: definition : IMPORT import_name import_path */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1101,7 +1147,7 @@ var parser = { this.$ = { type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp] }; break; - case 16: + case 19: /*! Production:: definition : IMPORT import_name error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1110,10 +1156,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject2, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject5, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 17: + case 20: /*! Production:: definition : IMPORT error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1122,10 +1168,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject3, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject6, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); break; - case 18: + case 21: /*! Production:: definition : INIT_CODE init_code_name action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1133,6 +1179,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject7, $init_code_name, rv, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]))); + } this.$ = { type: 'codesection', qualifier: yyvstack[yysp - 1], @@ -1140,7 +1190,7 @@ var parser = { }; break; - case 19: + case 22: /*! Production:: definition : INIT_CODE error action */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1149,36 +1199,34 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject4, yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp]), yyvstack[yysp - 1].errStr)); + yyparser.yyError(rmCommonWS(_templateObject8, yylexer.prettyPrintRange(yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp]), yyvstack[yysp - 1].errStr)); break; - case 20: + case 23: /*! Production:: init_code_name : NAME */ - case 21: + case 24: /*! Production:: init_code_name : STRING_LIT */ - case 22: + case 25: /*! Production:: import_name : NAME */ - case 23: + case 26: /*! Production:: import_name : STRING_LIT */ - case 24: + case 27: /*! Production:: import_path : NAME */ - case 25: + case 28: /*! Production:: import_path : STRING_LIT */ - case 61: + case 64: /*! Production:: regex_list : regex_concat */ - case 66: + case 69: /*! Production:: nonempty_regex_list : regex_concat */ - case 68: + case 71: /*! Production:: regex_concat : regex_base */ - case 93: + case 96: /*! Production:: escape_char : ESCAPE_CHAR */ - case 94: + case 97: /*! Production:: range_regex : RANGE_REGEX */ - case 106: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ - case 110: - /*! Production:: module_code_chunk : CODE */ case 113: + /*! Production:: module_code_chunk : CODE */ + case 116: /*! Production:: optional_module_code_chunk : module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1189,7 +1237,7 @@ var parser = { this.$ = yyvstack[yysp]; break; - case 26: + case 29: /*! Production:: names_inclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1200,7 +1248,7 @@ var parser = { this.$ = { type: 'names', names: {} };this.$.names[yyvstack[yysp]] = 0; break; - case 27: + case 30: /*! Production:: names_inclusive : names_inclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1211,7 +1259,7 @@ var parser = { this.$ = yyvstack[yysp - 1];this.$.names[yyvstack[yysp]] = 0; break; - case 28: + case 31: /*! Production:: names_exclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1222,7 +1270,7 @@ var parser = { this.$ = { type: 'names', names: {} };this.$.names[yyvstack[yysp]] = 1; break; - case 29: + case 32: /*! Production:: names_exclusive : names_exclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1233,7 +1281,7 @@ var parser = { this.$ = yyvstack[yysp - 1];this.$.names[yyvstack[yysp]] = 1; break; - case 30: + case 33: /*! Production:: rules : rules rules_collective */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1244,9 +1292,9 @@ var parser = { this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; - case 31: + case 34: /*! Production:: rules : %epsilon */ - case 37: + case 40: /*! Production:: rule_block : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1257,7 +1305,7 @@ var parser = { this.$ = []; break; - case 32: + case 35: /*! Production:: rules_collective : start_conditions rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1271,7 +1319,7 @@ var parser = { this.$ = [yyvstack[yysp]]; break; - case 33: + case 36: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1287,7 +1335,7 @@ var parser = { this.$ = yyvstack[yysp - 1]; break; - case 34: + case 37: /*! Production:: rules_collective : start_conditions "{" error "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1296,10 +1344,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject5, yyvstack[yysp - 3].join(','), yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo(yysp - 3, yysp), yylstack[yysp - 3]), yyvstack[yysp - 1].errStr)); + yyparser.yyError(rmCommonWS(_templateObject9, yyvstack[yysp - 3].join(','), yylexer.prettyPrintRange(yylexer.mergeLocationInfo(yysp - 3, yysp), yylstack[yysp - 3]), yyvstack[yysp - 1].errStr)); break; - case 35: + case 38: /*! Production:: rules_collective : start_conditions "{" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1308,10 +1356,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject6, yyvstack[yysp - 2].join(','), yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject10, yyvstack[yysp - 2].join(','), yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 36: + case 39: /*! Production:: rule_block : rule_block rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1322,7 +1370,22 @@ var parser = { this.$ = yyvstack[yysp - 1];this.$.push(yyvstack[yysp]); break; - case 39: + case 41: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject11, rv, yylexer.prettyPrintRange(yylstack[yysp]))); + } + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + + case 42: /*! Production:: rule : regex error */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1331,10 +1394,10 @@ var parser = { this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; - yyparser.yyError(rmCommonWS(_templateObject7, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject12, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); break; - case 40: + case 43: /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1343,10 +1406,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject8, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]))); + yyparser.yyError(rmCommonWS(_templateObject13, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]))); break; - case 41: + case 44: /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1355,10 +1418,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject9, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]))); + yyparser.yyError(rmCommonWS(_templateObject14, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]))); break; - case 42: + case 45: /*! Production:: action : ACTION_START action_body ACTION_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1384,9 +1447,9 @@ var parser = { } break; - case 43: + case 46: /*! Production:: action_body : action_body ACTION */ - case 48: + case 51: /*! Production:: action_body : action_body include_macro_code */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1397,21 +1460,21 @@ var parser = { this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; break; - case 44: + case 47: /*! Production:: action_body : action_body ACTION_BODY */ - case 45: + case 48: /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ - case 46: + case 49: /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ - case 47: + case 50: /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ - case 67: + case 70: /*! Production:: regex_concat : regex_concat regex_base */ - case 79: + case 82: /*! Production:: regex_base : regex_base range_regex */ - case 89: + case 92: /*! Production:: regex_set : regex_set regex_set_atom */ - case 111: + case 114: /*! Production:: module_code_chunk : module_code_chunk CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1422,7 +1485,7 @@ var parser = { this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; - case 49: + case 52: /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1431,10 +1494,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject10, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]))); + yyparser.yyError(rmCommonWS(_templateObject15, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]))); break; - case 50: + case 53: /*! Production:: action_body : action_body error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1443,14 +1506,14 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject11, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject16, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); break; - case 51: + case 54: /*! Production:: action_body : %epsilon */ - case 62: + case 65: /*! Production:: regex_list : %epsilon */ - case 114: + case 117: /*! Production:: optional_module_code_chunk : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1461,7 +1524,7 @@ var parser = { this.$ = ''; break; - case 52: + case 55: /*! Production:: start_conditions : "<" name_list ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1472,7 +1535,7 @@ var parser = { this.$ = yyvstack[yysp - 1]; break; - case 53: + case 56: /*! Production:: start_conditions : "<" name_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1481,10 +1544,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject12, yyvstack[yysp - 1].join(','), yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject17, yyvstack[yysp - 1].join(','), yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 54: + case 57: /*! Production:: start_conditions : "<" "*" ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1495,7 +1558,7 @@ var parser = { this.$ = ['*']; break; - case 55: + case 58: /*! Production:: start_conditions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1504,7 +1567,7 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; - case 56: + case 59: /*! Production:: name_list : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1515,7 +1578,7 @@ var parser = { this.$ = [yyvstack[yysp]]; break; - case 57: + case 60: /*! Production:: name_list : name_list "," NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1526,7 +1589,7 @@ var parser = { this.$ = yyvstack[yysp - 2];this.$.push(yyvstack[yysp]); break; - case 58: + case 61: /*! Production:: regex : nonempty_regex_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1592,9 +1655,9 @@ var parser = { } break; - case 59: + case 62: /*! Production:: regex_list : regex_list "|" regex_concat */ - case 63: + case 66: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1605,9 +1668,9 @@ var parser = { this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; - case 60: + case 63: /*! Production:: regex_list : regex_list "|" */ - case 64: + case 67: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1618,7 +1681,7 @@ var parser = { this.$ = yyvstack[yysp - 1] + '|'; break; - case 65: + case 68: /*! Production:: nonempty_regex_list : "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1629,7 +1692,7 @@ var parser = { this.$ = '|' + yyvstack[yysp]; break; - case 69: + case 72: /*! Production:: regex_base : "(" regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1640,7 +1703,7 @@ var parser = { this.$ = '(' + yyvstack[yysp - 1] + ')'; break; - case 70: + case 73: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1651,9 +1714,9 @@ var parser = { this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; - case 71: + case 74: /*! Production:: regex_base : "(" regex_list error */ - case 72: + case 75: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1662,10 +1725,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject13, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject18, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 73: + case 76: /*! Production:: regex_base : regex_base "+" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1676,7 +1739,7 @@ var parser = { this.$ = yyvstack[yysp - 1] + '+'; break; - case 74: + case 77: /*! Production:: regex_base : regex_base "*" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1687,7 +1750,7 @@ var parser = { this.$ = yyvstack[yysp - 1] + '*'; break; - case 75: + case 78: /*! Production:: regex_base : regex_base "?" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1698,7 +1761,7 @@ var parser = { this.$ = yyvstack[yysp - 1] + '?'; break; - case 76: + case 79: /*! Production:: regex_base : "/" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1709,7 +1772,7 @@ var parser = { this.$ = '(?=' + yyvstack[yysp] + ')'; break; - case 77: + case 80: /*! Production:: regex_base : "/!" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1720,21 +1783,21 @@ var parser = { this.$ = '(?!' + yyvstack[yysp] + ')'; break; - case 78: + case 81: /*! Production:: regex_base : name_expansion */ - case 80: + case 83: /*! Production:: regex_base : any_group_regex */ - case 84: + case 87: /*! Production:: regex_base : string */ - case 85: + case 88: /*! Production:: regex_base : escape_char */ - case 86: + case 89: /*! Production:: name_expansion : NAME_BRACE */ - case 90: + case 93: /*! Production:: regex_set : regex_set_atom */ - case 91: + case 94: /*! Production:: regex_set_atom : REGEX_SET */ - case 96: + case 99: /*! Production:: string : CHARACTER_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1743,7 +1806,7 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; - case 81: + case 84: /*! Production:: regex_base : "." */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1754,7 +1817,7 @@ var parser = { this.$ = '.'; break; - case 82: + case 85: /*! Production:: regex_base : "^" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1765,7 +1828,7 @@ var parser = { this.$ = '^'; break; - case 83: + case 86: /*! Production:: regex_base : "$" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1776,10 +1839,8 @@ var parser = { this.$ = '$'; break; - case 87: - /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ - case 107: - /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + case 90: + /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); @@ -1789,7 +1850,7 @@ var parser = { this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; - case 88: + case 91: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1798,10 +1859,10 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject14, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject19, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 92: + case 95: /*! Production:: regex_set_atom : name_expansion */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1818,7 +1879,7 @@ var parser = { //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; - case 95: + case 98: /*! Production:: string : STRING_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1829,7 +1890,7 @@ var parser = { this.$ = prepareString(yyvstack[yysp]); break; - case 97: + case 100: /*! Production:: options : OPTIONS option_list OPTIONS_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1840,7 +1901,7 @@ var parser = { this.$ = null; break; - case 98: + case 101: /*! Production:: option_list : option option_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1851,7 +1912,7 @@ var parser = { this.$ = null; break; - case 100: + case 103: /*! Production:: option : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1863,7 +1924,7 @@ var parser = { yy.options[yyvstack[yysp]] = true; break; - case 101: + case 104: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1875,9 +1936,9 @@ var parser = { yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; - case 102: + case 105: /*! Production:: option : NAME "=" OPTION_VALUE */ - case 103: + case 106: /*! Production:: option : NAME "=" NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1889,7 +1950,7 @@ var parser = { yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; - case 104: + case 107: /*! Production:: option : NAME "=" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1899,10 +1960,10 @@ var parser = { // TODO ... - yyparser.yyError(rmCommonWS(_templateObject15, $option, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject20, $option, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 105: + case 108: /*! Production:: option : error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1912,10 +1973,48 @@ var parser = { // TODO ... - yyparser.yyError(rmCommonWS(_templateObject16, yylexer.prettyPrintRange(yylexer, yylstack[yysp]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject21, yylexer.prettyPrintRange(yylstack[yysp]), yyvstack[yysp].errStr)); break; - case 108: + case 109: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject22, rv, yylexer.prettyPrintRange(yylstack[yysp]))); + } + this.$ = yyvstack[yysp]; + break; + + case 110: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Each of the 3 chunks should be parse-able as a JS snippet on its own. + // + // Note: we have already checked the first section in a previous reduction + // of this rule, so we don't need to check that one again! + var rv = checkActionBlock(yyvstack[yysp - 1], yylstack[yysp - 1]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject23, rv, yylexer.prettyPrintRange(yylstack[yysp - 1]))); + } + rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject22, rv, yylexer.prettyPrintRange(yylstack[yysp]))); + } + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + + case 111: /*! Production:: include_macro_code : INCLUDE PATH */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1928,7 +2027,7 @@ var parser = { this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; - case 109: + case 112: /*! Production:: include_macro_code : INCLUDE error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1937,23 +2036,23 @@ var parser = { // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject17, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject24, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); break; - case 112: - /*! Production:: module_code_chunk : error */ + case 115: + /*! Production:: module_code_chunk : error CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): - this.$ = yyvstack[yysp]; - this._$ = yylstack[yysp]; + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) // TODO ... - yyparser.yyError(rmCommonWS(_templateObject18, yylexer.prettyPrintRange(yylexer, yylstack[yysp]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject25, yylexer.prettyPrintRange(yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); break; - case 145: + case 151: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} @@ -1965,16 +2064,16 @@ var parser = { } }, table: bt({ - len: u([13, 1, 12, 15, 1, 1, 11, 18, 21, 2, 2, s, [11, 3], 4, 4, 12, 4, 1, 1, 19, 11, 12, 18, 29, 30, 22, 22, 17, 17, s, [29, 7], 31, 5, s, [29, 3], s, [12, 4], 4, 11, 3, 3, 2, 2, 1, 1, 12, 1, 5, 4, 3, 7, 17, 23, 3, 30, 29, 30, s, [29, 5], 3, 20, 3, 30, 30, 6, s, [4, 3], 12, 12, s, [11, 6], s, [27, 3], s, [11, 8], 2, 11, 1, 4, 3, 2, s, [3, 3], 17, 16, 3, 3, 1, 3, s, [29, 3], 21, s, [29, 4], 4, 13, 13, s, [3, 4], 6, 3, 23, s, [18, 3], 14, 14, 1, 14, 20, 2, 17, 14, 17, 3]), - symbol: u([1, 2, s, [19, 7, 1], 28, 47, 54, 56, 1, c, [14, 11], 57, c, [12, 11], 55, 58, 68, 84, s, [1, 3], c, [17, 10], 1, 3, 5, 9, 10, s, [14, 4, 1], 19, 26, s, [38, 4, 1], 44, 46, 64, c, [15, 6], c, [14, 7], 72, s, [74, 5, 1], 81, 83, 27, 62, 27, 63, c, [54, 12], c, [11, 21], 2, 20, 26, 60, c, [4, 3], 59, 2, s, [29, 9, 1], 51, 69, 2, 20, 85, 86, s, [1, 3], c, [102, 16], 65, 70, c, [67, 13], 9, c, [12, 9], c, [125, 12], c, [123, 6], c, [30, 3], c, [59, 6], s, [20, 7, 1], 28, c, [29, 6], 47, c, [29, 7], 7, s, [9, 9, 1], c, [33, 14], 45, 46, 47, 82, c, [58, 3], 11, c, [80, 11], 73, c, [81, 6], c, [22, 22], c, [121, 12], c, [17, 22], c, [108, 29], c, [29, 199], s, [42, 6, 1], 40, 43, 77, 79, 80, c, [123, 89], c, [19, 7], 27, c, [572, 11], c, [12, 27], c, [593, 3], 61, c, [612, 14], c, [3, 3], 28, 68, 28, 68, 28, 28, c, [616, 11], 88, 48, 2, 20, 48, 85, 86, 2, 18, 20, c, [9, 4], 1, 2, 51, 53, 87, 89, 90, c, [630, 17], 3, c, [732, 13], 67, c, [733, 8], 7, 20, 71, c, [613, 24], c, [643, 65], c, [507, 145], 2, 9, 11, c, [769, 15], c, [789, 7], 11, c, [201, 59], 82, 2, 40, 42, 43, 77, 80, c, [6, 4], c, [4, 8], c, [476, 33], c, [11, 59], 3, 4, c, [473, 8], c, [401, 15], c, [27, 54], c, [584, 11], c, [11, 78], 52, c, [182, 11], c, [664, 3], 49, 50, 1, 51, 88, 1, 51, 1, 51, 53, c, [3, 7], c, [672, 16], 2, 4, c, [673, 13], 66, 2, 28, 68, 2, 6, 8, 6, c, [4, 3], c, [642, 58], c, [525, 31], c, [522, 13], c, [750, 8], c, [662, 115], c, [562, 5], c, [315, 10], 53, c, [13, 13], c, [979, 3], c, [3, 9], c, [988, 4], c, [987, 3], 51, 53, c, [300, 14], c, [973, 9], 1, c, [487, 10], c, [27, 7], c, [18, 36], c, [1050, 14], c, [14, 14], 20, c, [15, 14], c, [830, 20], c, [469, 3], c, [460, 16], c, [159, 14], c, [491, 18], 6, 8]), - type: u([s, [2, 11], 0, 0, 1, c, [14, 12], c, [26, 13], 0, c, [15, 12], s, [2, 19], c, [31, 14], s, [0, 8], c, [23, 3], c, [56, 31], c, [62, 10], c, [112, 13], c, [67, 4], c, [40, 20], c, [78, 36], c, [123, 7], c, [30, 28], c, [203, 43], c, [205, 9], c, [22, 34], c, [17, 34], s, [2, 224], c, [239, 141], c, [139, 19], c, [655, 16], c, [14, 5], c, [180, 13], c, [194, 34], s, [0, 9], c, [98, 21], c, [643, 86], c, [492, 151], c, [494, 34], c, [231, 35], c, [802, 238], c, [716, 74], c, [44, 28], c, [708, 37], c, [522, 78], c, [454, 163], c, [164, 19], c, [973, 11], c, [830, 147], s, [2, 21]]), - state: u([s, [1, 4, 1], 6, 11, 12, 20, 21, 22, 24, 25, 30, 31, 36, 35, 42, 44, 46, 50, 54, 55, 56, 60, 61, 64, c, [15, 5], 65, c, [5, 4], 69, 71, 72, c, [13, 5], 73, c, [7, 6], 74, c, [5, 4], 75, c, [5, 4], 79, 76, 77, 82, 86, 87, 96, 101, 56, 103, 105, 104, 108, 110, c, [66, 7], 111, 114, c, [58, 11], c, [6, 6], 69, 79, 122, 129, 131, 133, c, [12, 5], 139, c, [29, 5], 105, 140, 142, c, [47, 8], c, [22, 5]]), - mode: u([s, [2, 23], s, [1, 12], s, [2, 28], s, [1, 15], s, [2, 33], c, [39, 17], c, [13, 6], c, [18, 7], c, [64, 21], c, [21, 10], c, [106, 15], c, [75, 12], 1, c, [90, 10], c, [27, 6], c, [72, 23], c, [40, 8], c, [45, 7], c, [15, 13], s, [1, 24], s, [2, 234], c, [236, 98], c, [97, 24], c, [24, 15], c, [374, 20], c, [432, 5], c, [409, 15], c, [568, 9], c, [47, 20], c, [454, 17], c, [561, 23], c, [585, 53], c, [442, 145], c, [718, 19], c, [780, 33], c, [29, 25], c, [759, 238], c, [796, 51], c, [289, 5], c, [1211, 12], c, [722, 35], c, [340, 9], c, [648, 24], c, [854, 59], c, [1199, 170], c, [311, 6], c, [969, 23], c, [1128, 90], c, [291, 66]]), - goto: u([s, [6, 11], s, [8, 11], 5, 5, s, [7, 4, 1], s, [13, 7, 1], s, [7, 11], s, [31, 17], 23, 26, 28, 32, 33, 34, 39, 27, 29, 37, 38, 41, 40, 43, 45, s, [12, 11], s, [13, 11], s, [14, 11], 47, 48, 49, 51, 52, 53, s, [51, 11], 58, 57, 1, 2, 4, 55, 62, s, [55, 6], 59, s, [55, 7], s, [9, 11], 58, 58, 63, s, [58, 9], c, [108, 12], s, [66, 3], c, [15, 5], s, [66, 7], 39, 66, c, [23, 7], 68, 68, 67, s, [68, 3], c, [7, 3], s, [68, 17], 70, 68, 68, 62, 62, 26, 62, c, [68, 11], c, [15, 15], c, [95, 12], c, [12, 12], s, [78, 29], s, [80, 29], s, [81, 29], s, [82, 29], s, [83, 29], s, [84, 29], s, [85, 29], s, [86, 31], 37, 78, s, [95, 29], s, [96, 29], s, [93, 29], s, [10, 9], 80, 10, 10, s, [26, 12], s, [11, 9], 81, 11, 11, s, [28, 12], 83, 84, 85, s, [17, 11], s, [22, 3], s, [23, 3], 16, 16, 20, 21, 98, s, [88, 8, 1], 97, 99, 100, 58, 57, 99, 100, 102, 100, 100, s, [105, 3], 114, 107, 114, 106, s, [30, 17], 109, c, [667, 13], 112, 113, s, [64, 3], c, [17, 5], s, [64, 7], 39, 64, c, [25, 6], 64, s, [65, 3], c, [24, 5], s, [65, 7], 39, 65, c, [24, 6], 65, s, [67, 6], 66, 68, s, [67, 18], 70, 67, 67, s, [73, 29], s, [74, 29], s, [75, 29], s, [79, 29], s, [94, 29], 116, 117, 115, 61, 61, 26, 61, c, [242, 11], 119, 117, 118, 76, 76, 67, s, [76, 3], 66, 68, s, [76, 18], 70, 76, 76, 77, 77, 67, s, [77, 3], 66, 68, s, [77, 18], 70, 77, 77, 121, 37, 120, 78, s, [90, 4], s, [91, 4], s, [92, 4], s, [27, 12], s, [29, 12], s, [15, 11], s, [16, 11], s, [24, 11], s, [25, 11], s, [18, 11], s, [19, 11], s, [40, 27], s, [41, 27], s, [42, 27], s, [43, 11], s, [44, 11], s, [45, 11], s, [46, 11], s, [47, 11], s, [48, 11], s, [49, 11], s, [50, 11], 124, 123, s, [97, 11], 98, 128, 127, 125, 126, 3, 99, 106, 106, 113, 113, 130, s, [110, 3], s, [112, 3], s, [32, 17], 132, s, [37, 14], 134, 16, 136, 135, 137, 138, s, [56, 3], s, [63, 3], c, [624, 5], s, [63, 7], 39, 63, c, [431, 6], 63, s, [69, 29], s, [71, 29], 60, 60, 26, 60, c, [505, 11], s, [70, 29], s, [72, 29], s, [87, 29], s, [88, 29], s, [89, 4], s, [108, 13], s, [109, 13], s, [101, 3], s, [102, 3], s, [103, 3], s, [104, 3], c, [940, 4], s, [111, 3], 141, c, [926, 13], 35, 35, 143, s, [35, 15], s, [38, 18], s, [39, 18], s, [52, 14], s, [53, 14], 144, s, [54, 14], 59, 59, 26, 59, c, [112, 11], 107, 107, s, [33, 17], s, [36, 14], s, [34, 17], s, [57, 3]]) + len: u([13, 1, 12, 15, 1, 1, 11, 19, 21, 2, 2, s, [11, 3], 4, 4, 12, 4, 1, 1, 19, 18, 11, 12, 18, 29, 30, 22, 22, 17, 17, s, [29, 7], 31, 5, s, [29, 3], s, [12, 4], 4, 11, 3, 3, 2, 2, 1, 1, 12, 1, 5, 4, 3, 7, 17, 23, 3, 19, 30, 29, 30, s, [29, 5], 3, 20, 3, 30, 30, 6, s, [4, 3], 12, 12, s, [11, 6], s, [27, 3], s, [11, 8], 2, 11, 1, 4, c, [55, 3], 3, 3, 17, 16, 3, 3, 1, 3, 7, s, [29, 3], 21, s, [29, 4], 4, 13, 13, s, [3, 4], 6, 3, 3, 23, s, [18, 3], 14, 14, 1, 14, 3, 1, 20, 2, 17, 14, 17, 3]), + symbol: u([1, 2, s, [19, 7, 1], 28, 47, 54, 56, 1, c, [14, 11], 57, c, [12, 11], 55, 58, 68, 84, s, [1, 3], c, [17, 10], 1, 2, 3, 5, 9, 10, s, [14, 4, 1], 19, 26, s, [38, 4, 1], 44, 46, 64, c, [15, 6], c, [14, 7], 72, s, [74, 5, 1], 81, 83, 27, 62, 27, 63, c, [55, 13], c, [11, 20], 2, 20, 26, 60, c, [4, 3], 59, 2, s, [29, 9, 1], 51, 69, 2, 20, 85, 86, s, [1, 3], c, [102, 16], 65, 70, c, [19, 17], 64, c, [85, 13], 9, c, [12, 9], c, [143, 12], c, [141, 6], c, [30, 3], c, [58, 6], s, [20, 7, 1], 28, c, [29, 6], 47, c, [29, 7], 7, s, [9, 9, 1], c, [33, 14], 45, 46, 47, 82, c, [58, 3], 11, c, [80, 11], 73, c, [81, 6], c, [22, 22], c, [121, 12], c, [17, 22], c, [108, 29], c, [29, 199], s, [42, 6, 1], 40, 43, 77, 79, 80, c, [123, 89], c, [19, 7], 27, c, [590, 11], c, [12, 27], c, [611, 3], 61, c, [630, 14], c, [3, 3], 28, 68, 28, 68, 28, 28, c, [634, 11], 88, 48, 2, 20, 48, 85, 86, 2, 18, 20, c, [9, 4], 1, 2, 51, 53, 87, 89, 90, c, [629, 17], 3, c, [750, 13], 67, c, [751, 8], 7, 20, 71, c, [691, 20], c, [632, 23], c, [662, 65], c, [526, 145], 2, 9, 11, c, [788, 15], c, [808, 7], 11, c, [201, 59], 82, 2, 40, 42, 43, 77, 80, c, [6, 4], c, [4, 8], c, [495, 33], c, [11, 59], 3, 4, c, [449, 8], c, [401, 15], c, [27, 54], c, [603, 11], c, [11, 78], 52, c, [182, 11], c, [683, 3], 49, 50, 1, 51, 88, 1, 53, 1, 51, 1, 51, c, [5, 3], 53, c, [647, 17], 2, 4, c, [691, 13], 66, 2, 28, 68, 2, 6, 8, 6, c, [4, 3], c, [740, 8], c, [648, 57], c, [531, 31], c, [528, 13], c, [756, 8], c, [668, 115], c, [568, 5], c, [321, 10], 53, c, [13, 13], c, [1004, 3], c, [3, 9], c, [273, 4], c, [272, 3], c, [328, 5], c, [310, 14], c, [1001, 9], 1, c, [496, 10], c, [27, 7], c, [18, 36], c, [1078, 14], c, [14, 14], 20, c, [15, 14], c, [461, 3], 53, c, [843, 20], c, [480, 3], c, [474, 16], c, [163, 14], c, [505, 18], 6, 8]), + type: u([s, [2, 11], 0, 0, 1, c, [14, 12], c, [26, 13], 0, c, [15, 12], s, [2, 20], c, [32, 14], s, [0, 8], c, [23, 3], c, [57, 32], c, [62, 9], c, [113, 13], c, [67, 4], c, [40, 20], c, [21, 18], c, [96, 36], c, [141, 7], c, [30, 28], c, [221, 43], c, [223, 9], c, [22, 34], c, [17, 34], s, [2, 224], c, [239, 141], c, [139, 19], c, [673, 16], c, [14, 5], c, [180, 13], c, [764, 35], c, [751, 9], c, [98, 19], c, [632, 31], c, [662, 75], c, [511, 151], c, [513, 34], c, [231, 35], c, [821, 238], c, [735, 74], c, [43, 27], c, [740, 39], c, [1202, 78], c, [756, 30], c, [696, 140], c, [1001, 31], c, [461, 114], c, [121, 58]]), + state: u([s, [1, 4, 1], 6, 11, 12, 20, 22, 23, 25, 26, 31, 32, 37, 36, 43, 45, 47, 51, 55, 56, 57, 61, 62, 64, 66, c, [16, 5], 67, c, [5, 4], 71, 73, 74, c, [13, 5], 75, c, [7, 6], 76, c, [5, 4], 77, c, [5, 4], 81, 78, 79, 84, 88, 89, 98, 103, 57, 105, 108, 107, 110, 112, c, [67, 7], 113, 61, 62, 117, c, [60, 11], c, [6, 6], 71, 81, 125, 132, 135, 137, 143, 108, 107, c, [15, 5], 145, c, [32, 5], 108, 146, 148, c, [52, 8], 132, c, [23, 5]]), + mode: u([s, [2, 23], s, [1, 12], c, [24, 13], c, [41, 28], c, [44, 15], c, [89, 27], c, [17, 13], c, [88, 11], c, [64, 34], c, [38, 14], c, [123, 15], c, [92, 12], 1, c, [107, 10], c, [27, 6], c, [72, 23], c, [40, 8], c, [45, 7], c, [15, 13], s, [1, 24], s, [2, 234], c, [236, 98], c, [97, 24], c, [24, 15], c, [374, 20], c, [432, 5], c, [409, 15], c, [585, 9], c, [47, 20], c, [45, 25], c, [36, 14], c, [578, 18], c, [602, 53], c, [459, 145], c, [735, 19], c, [797, 33], c, [29, 25], c, [776, 238], c, [813, 51], c, [289, 5], c, [648, 7], c, [298, 21], c, [738, 18], c, [621, 8], c, [376, 7], c, [651, 22], c, [874, 59], c, [1219, 170], c, [960, 9], c, [947, 23], c, [1151, 89], c, [805, 17], s, [2, 53]]), + goto: u([s, [9, 11], s, [11, 11], 8, 5, s, [7, 4, 1], s, [13, 7, 1], s, [10, 11], 34, 21, s, [34, 16], 24, 27, 29, 33, 34, 35, 40, 28, 30, 38, 39, 42, 41, 44, 46, s, [15, 11], s, [16, 11], s, [17, 11], 48, 49, 50, 52, 53, s, [54, 12], 59, 58, 1, 2, 7, 58, 63, s, [58, 6], 60, s, [58, 7], s, [34, 17], s, [12, 11], 61, 61, 65, s, [61, 9], c, [125, 12], s, [69, 3], c, [15, 5], s, [69, 7], 40, 69, c, [23, 7], 71, 71, c, [3, 3], 71, 68, 70, s, [71, 18], 72, 71, 71, 65, 65, 27, 65, c, [68, 11], c, [15, 15], c, [95, 12], c, [12, 12], s, [81, 29], s, [83, 29], s, [84, 29], s, [85, 29], s, [86, 29], s, [87, 29], s, [88, 29], s, [89, 31], 38, 80, s, [98, 29], s, [99, 29], s, [96, 29], s, [13, 9], 82, 13, 13, s, [29, 12], s, [14, 9], 83, 14, 14, s, [31, 12], 85, 86, 87, s, [20, 11], s, [25, 3], s, [26, 3], 16, 16, 23, 24, 100, s, [90, 8, 1], 99, 101, 102, 59, 58, 102, 103, 104, 103, 103, s, [108, 3], 117, 106, 117, 109, s, [33, 17], 111, c, [684, 13], 114, 115, 6, c, [630, 8], 116, s, [58, 7], s, [67, 3], c, [34, 5], s, [67, 7], 40, 67, c, [42, 6], 67, s, [68, 3], c, [24, 5], s, [68, 7], 40, 68, c, [24, 6], 68, 70, 70, 69, s, [70, 3], c, [7, 3], s, [70, 17], 72, 70, 70, s, [76, 29], s, [77, 29], s, [78, 29], s, [82, 29], s, [97, 29], 119, 120, 118, 64, 64, 27, 64, c, [259, 11], 122, 120, 121, 79, 79, 69, s, [79, 3], 68, 70, s, [79, 18], 72, 79, 79, 80, 80, 69, s, [80, 3], 68, 70, s, [80, 18], 72, 80, 80, 124, 38, 123, 80, s, [93, 4], s, [94, 4], s, [95, 4], s, [30, 12], s, [32, 12], s, [18, 11], s, [19, 11], s, [27, 11], s, [28, 11], s, [21, 11], s, [22, 11], s, [43, 27], s, [44, 27], s, [45, 27], s, [46, 11], s, [47, 11], s, [48, 11], s, [49, 11], s, [50, 11], s, [51, 11], s, [52, 11], s, [53, 11], 127, 126, s, [100, 11], 101, 131, 130, 128, 129, 3, 101, 5, 133, 109, 109, 116, 116, 134, s, [113, 3], s, [35, 17], 136, s, [40, 14], 138, 16, 140, 139, 141, 142, s, [59, 3], 117, 144, 117, 109, s, [66, 3], c, [627, 5], s, [66, 7], 40, 66, c, [434, 6], 66, s, [72, 29], s, [74, 29], 63, 63, 27, 63, c, [508, 11], s, [73, 29], s, [75, 29], s, [90, 29], s, [91, 29], s, [92, 4], s, [111, 13], s, [112, 13], s, [104, 3], s, [105, 3], s, [106, 3], s, [107, 3], c, [259, 4], s, [115, 3], s, [114, 3], 147, c, [949, 13], 38, 38, 149, s, [38, 15], s, [41, 18], s, [42, 18], s, [55, 14], s, [56, 14], 150, s, [57, 14], 4, 101, 133, 62, 62, 27, 62, c, [115, 11], 110, 110, s, [36, 17], s, [39, 14], s, [37, 17], s, [60, 3]]) }), defaultActions: bda({ - idx: u([0, 2, 6, 7, 11, 12, 13, 16, 18, 19, 21, s, [30, 8, 1], 39, 40, s, [41, 4, 2], 48, 49, 52, 53, 58, 60, s, [66, 5, 1], s, [77, 22, 1], 100, 101, 104, 106, 107, 108, 113, 115, 116, s, [118, 11, 1], 130, s, [133, 4, 1], 138, s, [140, 5, 1]]), - goto: u([6, 8, 7, 31, 12, 13, 14, 51, 1, 2, 9, 78, s, [80, 7, 1], 95, 96, 93, 26, 28, 17, 22, 23, 20, 21, 105, 30, 73, 74, 75, 79, 94, 90, 91, 92, 27, 29, 15, 16, 24, 25, 18, 19, s, [40, 11, 1], 97, 98, 106, 110, 112, 32, 56, 69, 71, 70, 72, 87, 88, 89, 108, 109, s, [101, 4, 1], 111, 38, 39, 52, 53, 54, 107, 33, 36, 34, 57]) + idx: u([0, 2, 6, 11, 12, 13, 16, 18, 19, 21, 22, s, [31, 8, 1], 40, 41, s, [42, 4, 2], 49, 50, 53, 54, 59, 61, s, [68, 5, 1], s, [79, 22, 1], 102, 103, 107, 109, 110, 115, 118, 119, s, [121, 11, 1], 133, 134, s, [137, 4, 1], 142, s, [146, 5, 1]]), + goto: u([9, 11, 10, 15, 16, 17, 54, 1, 2, 34, 12, 81, s, [83, 7, 1], 98, 99, 96, 29, 31, 20, 25, 26, 23, 24, 108, 33, 76, 77, 78, 82, 97, 93, 94, 95, 30, 32, 18, 19, 27, 28, 21, 22, s, [43, 11, 1], 100, 101, 109, 113, 35, 59, 72, 74, 73, 75, 90, 91, 92, 111, 112, s, [104, 4, 1], 115, 114, 41, 42, 55, 56, 57, 110, 36, 39, 37, 60]) }), parseError: function parseError(str, hash, ExceptionClass) { if (hash.recoverable && typeof this.trace === 'function') { @@ -2006,7 +2105,7 @@ var parser = { var TERROR = this.TERROR; var EOF = this.EOF; var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = this.options.errorRecoveryTokenDiscardCount | 0 || 3; - var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + var NO_ACTION = [0, 151 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -3094,6 +3193,7 @@ parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; var rmCommonWS = helpers.rmCommonWS; +var checkActionBlock = helpers.checkActionBlock; function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); @@ -3146,7 +3246,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-204 */ +/* lexer generated by jison-lex 0.6.1-205 */ /* * Returns a Lexer object of the following structure: @@ -3502,7 +3602,37 @@ var lexer = function () { * @public * @this {RegExpLexer} */ - constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) { + msg = '' + msg; + + // heuristic to determine if the error message already contains a (partial) source code dump + // as produced by either `showPosition()` or `prettyPrintRange()`: + if (show_input_position == undefined) { + show_input_position = !(msg.indexOf('\n') > 0 && msg.indexOf('^') > 0); + } + + if (this.yylloc && show_input_position) { + if (typeof this.prettyPrintRange === 'function') { + var pretty_src = this.prettyPrintRange(this.yylloc); + + if (!/\n\s*$/.test(msg)) { + msg += '\n'; + } + + msg += '\n Erroneous area:\n' + this.prettyPrintRange(this.yylloc); + } else if (typeof this.showPosition === 'function') { + var pos_str = this.showPosition(); + + if (pos_str) { + if (msg.length && msg[msg.length - 1] !== '\n' && pos_str[0] !== '\n') { + msg += '\n' + pos_str; + } else { + msg += pos_str; + } + } + } + } + /** @constructor */ var pei = { errStr: msg, @@ -3580,7 +3710,7 @@ var lexer = function () { yyerror: function yyError(str /*, ...args */) { var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } @@ -3864,7 +3994,12 @@ var lexer = function () { if (lines.length > 1) { this.yylineno -= lines.length - 1; this.yylloc.last_line = this.yylineno + 1; + + // Get last entirely matched line into the `pre_lines[]` array's + // last index slot; we don't mind when other previously + // matched lines end up in the array too. var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); if (pre_lines.length === 1) { @@ -3909,21 +4044,11 @@ var lexer = function () { // `.lex()` run. var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - - var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, false); + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).', false); this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; } @@ -4115,32 +4240,20 @@ var lexer = function () { var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ': ' + line; var errpfx = new Array(lineno_display_width + 1).join('^'); + var offset = 2 + 1; + var len = 0; if (lno === loc.first_line) { - var offset = loc.first_column + 2; - - var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); + offset += loc.first_column; - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } + len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } + len = Math.max(2, loc.last_column + 1); } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); + len = Math.max(2, line.length + 1); + } + + if (len) { var lead = new Array(offset).join('.'); var mark = new Array(len).join('^'); rv += '\n' + errpfx + lead + mark; @@ -4159,15 +4272,6 @@ var lexer = function () { if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; - - console.log('clip off: ', { - start: clip_start, - end: clip_end, - len: clip_end - clip_start + 1, - arr: nonempty_line_indexes, - rv: rv - }); - var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); @@ -4379,17 +4483,7 @@ var lexer = function () { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - - var p = this.constructLexErrorInfo('Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, false); + var p = this.constructLexErrorInfo('Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!', false); // produce one 'error' token until this situation has been resolved, most probably by parse termination! return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; @@ -4449,24 +4543,21 @@ var lexer = function () { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - - var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, this.options.lexerErrorsAreRecoverable); + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': Unrecognized text.', this.options.lexerErrorsAreRecoverable); + var pendingInput = this._input; + var activeCondition = this.topState(); + var conditionStackDepth = this.conditionStack.length; token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us - // by moving forward at least one character at a time: - if (!this.match.length) { + // by moving forward at least one character at a time IFF the (user-specified?) `parseError()` + // has not consumed/modified any pending input or changed state in the error handler: + if (!this.matches && // and make sure the input has been modified/consumed ... + pendingInput === this._input && // ...or the lexer state has been modified significantly enough + // to merit a non-consuming error handling action right now. + activeCondition === this.topState() && conditionStackDepth === this.conditionStack.length) { this.input(); } } @@ -4603,7 +4694,7 @@ var lexer = function () { case 0: /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %\{ */ - yy.dept = 0; + yy.depth = 0; yy.include_command_allowed = false; this.pushState('action'); @@ -4615,7 +4706,7 @@ var lexer = function () { case 1: /*! Conditions:: action */ /*! Rule:: %\{([^]*?)%\} */ - yy_.yytext = this.matches[1]; + yy_.yytext = this.matches[1].replace(/%\\\}/g, '%}'); // unescape any literal '%\}' that exists within the action code block yy.include_command_allowed = true; return 32; @@ -4748,9 +4839,9 @@ var lexer = function () { yy.include_command_allowed = false; if (yy.depth <= 0) { - yy_.yyerror(rmCommonWS(_templateObject19) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject26) + this.prettyPrintRange(yy_.yylloc)); - return 'BRACKETS_SURPLUS'; + return 30; } else { yy.depth--; } @@ -4789,10 +4880,10 @@ var lexer = function () { yy.include_command_allowed = false; if (yy.depth !== 0) { - yy_.yyerror(rmCommonWS(_templateObject20, yy.depth) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject27, yy.depth) + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = ''; - return 'BRACKETS_MISSING'; + return 29; } this.popState(); @@ -5083,7 +5174,7 @@ var lexer = function () { /*! Conditions:: INITIAL rules code */ /*! Rule:: %{NAME}([^\r\n]*) */ /* ignore unrecognized decl */ - this.warn(rmCommonWS(_templateObject21, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(this, yy_.yylloc)); + this.warn(rmCommonWS(_templateObject28, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = [this.matches[1], // {NAME} this.matches[2].trim() // optional value/parameters @@ -5158,7 +5249,7 @@ var lexer = function () { case 97: /*! Conditions:: action */ /*! Rule:: " */ - yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject29) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5166,7 +5257,7 @@ var lexer = function () { case 98: /*! Conditions:: action */ /*! Rule:: ' */ - yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject29) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5174,7 +5265,7 @@ var lexer = function () { case 99: /*! Conditions:: action */ /*! Rule:: ` */ - yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject29) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5182,7 +5273,7 @@ var lexer = function () { case 100: /*! Conditions:: options */ /*! Rule:: " */ - yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject30) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5190,7 +5281,7 @@ var lexer = function () { case 101: /*! Conditions:: options */ /*! Rule:: ' */ - yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject30) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5198,7 +5289,7 @@ var lexer = function () { case 102: /*! Conditions:: options */ /*! Rule:: ` */ - yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject30) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5208,7 +5299,7 @@ var lexer = function () { /*! Rule:: " */ var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); - yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject31, rules) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5218,7 +5309,7 @@ var lexer = function () { /*! Rule:: ' */ var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); - yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject31, rules) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5228,7 +5319,7 @@ var lexer = function () { /*! Rule:: ` */ var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); - yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject31, rules) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5239,14 +5330,14 @@ var lexer = function () { /* b0rk on bad characters */ var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); - yy_.yyerror(rmCommonWS(_templateObject25, rules, rules) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject32, rules, rules) + this.prettyPrintRange(yy_.yylloc)); break; case 107: /*! Conditions:: * */ /*! Rule:: . */ - yy_.yyerror(rmCommonWS(_templateObject26, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject33, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(yy_.yylloc)); break; diff --git a/dist/lex-parser-cjs.js b/dist/lex-parser-cjs.js index 8855185..bebaa22 100644 --- a/dist/lex-parser-cjs.js +++ b/dist/lex-parser-cjs.js @@ -9,7 +9,7 @@ var fs = _interopDefault(require('fs')); // hack: var assert; -/* parser generated by jison 0.6.1-204 */ +/* parser generated by jison 0.6.1-205 */ /* * Returns a Parser object of the following structure: @@ -863,7 +863,7 @@ productions_: bp({ 54, 54, s, - [55, 3], + [55, 6], 56, 57, 57, @@ -930,7 +930,8 @@ productions_: bp({ rule: u([ s, [4, 3], - 2, + s, + [5, 4, -1], 0, 0, 2, @@ -952,12 +953,12 @@ productions_: bp({ c, [23, 3], 4, - 4, - 3, c, - [29, 4], - s, - [3, 3], + [32, 4], + 2, + c, + [22, 3], + 3, s, [2, 8], 0, @@ -992,7 +993,8 @@ productions_: bp({ c, [10, 4], c, - [32, 5], + [82, 4], + 1, 0 ]) }), @@ -1060,6 +1062,7 @@ case 2: yyparser.yyError(rmCommonWS` + There's an error in your lexer regex rules or epilogue. Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: @@ -1068,10 +1071,10 @@ case 2: %% rules %% // <-- optional! - extra_module_code // <-- optional! + extra_module_code // <-- optional epilogue! Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp - 1].errStr} @@ -1086,7 +1089,7 @@ case 3: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + if (yyvstack[yysp].trim() !== '') { this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; } else { this.$ = { rules: yyvstack[yysp - 2] }; @@ -1094,6 +1097,86 @@ case 3: break; case 4: + /*! Production:: rules_and_epilogue : "%%" error rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 4]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 4, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp - 3])} + + Technical error report: + ${yyvstack[yysp - 3].errStr} + `); + break; + +case 5: + /*! Production:: rules_and_epilogue : "%%" rules "%%" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's an error in your lexer epilogue a.k.a. 'extra_module_code' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 6: + /*! Production:: rules_and_epilogue : "%%" error rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 7: /*! Production:: rules_and_epilogue : "%%" rules */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1104,7 +1187,7 @@ case 4: this.$ = { rules: yyvstack[yysp] }; break; -case 5: +case 8: /*! Production:: rules_and_epilogue : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1115,7 +1198,7 @@ case 5: this.$ = { rules: [] }; break; -case 6: +case 9: /*! Production:: init : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1128,7 +1211,7 @@ case 6: if (!yy.options) yy.options = {}; break; -case 7: +case 10: /*! Production:: definitions : definitions definition */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1150,7 +1233,7 @@ case 7: } break; -case 8: +case 11: /*! Production:: definitions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1165,10 +1248,8 @@ case 8: }; break; -case 9: +case 12: /*! Production:: definition : NAME regex */ -case 38: - /*! Production:: rule : regex action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); @@ -1178,9 +1259,9 @@ case 38: this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; -case 10: +case 13: /*! Production:: definition : START_INC names_inclusive */ -case 11: +case 14: /*! Production:: definition : START_EXC names_exclusive */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1191,7 +1272,7 @@ case 11: this.$ = yyvstack[yysp]; break; -case 12: +case 15: /*! Production:: definition : action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1199,12 +1280,22 @@ case 12: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - yy.actionInclude.push(yyvstack[yysp]); this.$ = null; + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The '%{...%}' lexer setup action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + yy.actionInclude.push(yyvstack[yysp]); + this.$ = null; break; -case 13: +case 16: /*! Production:: definition : options */ -case 99: +case 102: /*! Production:: option_list : option */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1215,7 +1306,7 @@ case 99: this.$ = null; break; -case 14: +case 17: /*! Production:: definition : UNKNOWN_DECL */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1226,7 +1317,7 @@ case 14: this.$ = {type: 'unknown', body: yyvstack[yysp]}; break; -case 15: +case 18: /*! Production:: definition : IMPORT import_name import_path */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1237,7 +1328,7 @@ case 15: this.$ = {type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp]}; break; -case 16: +case 19: /*! Production:: definition : IMPORT import_name error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1251,14 +1342,14 @@ case 16: %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 17: +case 20: /*! Production:: definition : IMPORT error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1274,14 +1365,14 @@ case 17: %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 18: +case 21: /*! Production:: definition : INIT_CODE init_code_name action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1289,14 +1380,23 @@ case 18: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The '%code ${$init_code_name}' action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} + `); + } this.$ = { - type: 'codesection', + type: 'codesection', qualifier: yyvstack[yysp - 1], include: yyvstack[yysp] }; break; -case 19: +case 22: /*! Production:: definition : INIT_CODE error action */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1310,40 +1410,38 @@ case 19: %code qualifier_name {action code} Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} Technical error report: ${yyvstack[yysp - 1].errStr} `); break; -case 20: +case 23: /*! Production:: init_code_name : NAME */ -case 21: +case 24: /*! Production:: init_code_name : STRING_LIT */ -case 22: +case 25: /*! Production:: import_name : NAME */ -case 23: +case 26: /*! Production:: import_name : STRING_LIT */ -case 24: +case 27: /*! Production:: import_path : NAME */ -case 25: +case 28: /*! Production:: import_path : STRING_LIT */ -case 61: +case 64: /*! Production:: regex_list : regex_concat */ -case 66: +case 69: /*! Production:: nonempty_regex_list : regex_concat */ -case 68: +case 71: /*! Production:: regex_concat : regex_base */ -case 93: +case 96: /*! Production:: escape_char : ESCAPE_CHAR */ -case 94: +case 97: /*! Production:: range_regex : RANGE_REGEX */ -case 106: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 110: - /*! Production:: module_code_chunk : CODE */ case 113: + /*! Production:: module_code_chunk : CODE */ +case 116: /*! Production:: optional_module_code_chunk : module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1354,7 +1452,7 @@ case 113: this.$ = yyvstack[yysp]; break; -case 26: +case 29: /*! Production:: names_inclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1365,7 +1463,7 @@ case 26: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; break; -case 27: +case 30: /*! Production:: names_inclusive : names_inclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1376,7 +1474,7 @@ case 27: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; break; -case 28: +case 31: /*! Production:: names_exclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1387,7 +1485,7 @@ case 28: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; break; -case 29: +case 32: /*! Production:: names_exclusive : names_exclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1398,7 +1496,7 @@ case 29: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; break; -case 30: +case 33: /*! Production:: rules : rules rules_collective */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1409,9 +1507,9 @@ case 30: this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; -case 31: +case 34: /*! Production:: rules : %epsilon */ -case 37: +case 40: /*! Production:: rule_block : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1422,7 +1520,7 @@ case 37: this.$ = []; break; -case 32: +case 35: /*! Production:: rules_collective : start_conditions rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1436,7 +1534,7 @@ case 32: this.$ = [yyvstack[yysp]]; break; -case 33: +case 36: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1452,7 +1550,7 @@ case 33: this.$ = yyvstack[yysp - 1]; break; -case 34: +case 37: /*! Production:: rules_collective : start_conditions "{" error "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1468,14 +1566,14 @@ case 34: block. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} + ${yylexer.prettyPrintRange(yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} Technical error report: ${yyvstack[yysp - 1].errStr} `); break; -case 35: +case 38: /*! Production:: rules_collective : start_conditions "{" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1491,14 +1589,14 @@ case 35: as a terminating curly brace '}' could not be found. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 36: +case 39: /*! Production:: rule_block : rule_block rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1509,7 +1607,27 @@ case 36: this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); break; -case 39: +case 41: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The rule's action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + +case 42: /*! Production:: rule : regex error */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1522,14 +1640,14 @@ case 39: Lexer rule regex action code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 40: +case 43: /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1542,11 +1660,11 @@ case 40: Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} `); break; -case 41: +case 44: /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1559,11 +1677,11 @@ case 41: Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} `); break; -case 42: +case 45: /*! Production:: action : ACTION_START action_body ACTION_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1589,9 +1707,9 @@ case 42: } break; -case 43: +case 46: /*! Production:: action_body : action_body ACTION */ -case 48: +case 51: /*! Production:: action_body : action_body include_macro_code */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1602,21 +1720,21 @@ case 48: this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; break; -case 44: +case 47: /*! Production:: action_body : action_body ACTION_BODY */ -case 45: +case 48: /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ -case 46: +case 49: /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ -case 47: +case 50: /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ -case 67: +case 70: /*! Production:: regex_concat : regex_concat regex_base */ -case 79: +case 82: /*! Production:: regex_base : regex_base range_regex */ -case 89: +case 92: /*! Production:: regex_set : regex_set regex_set_atom */ -case 111: +case 114: /*! Production:: module_code_chunk : module_code_chunk CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1627,7 +1745,7 @@ case 111: this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 49: +case 52: /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1640,11 +1758,11 @@ case 49: You may place the '%include' instruction only at the start/front of a line. It's use is not permitted at this position: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} `); break; -case 50: +case 53: /*! Production:: action_body : action_body error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1657,18 +1775,18 @@ case 50: Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 51: +case 54: /*! Production:: action_body : %epsilon */ -case 62: +case 65: /*! Production:: regex_list : %epsilon */ -case 114: +case 117: /*! Production:: optional_module_code_chunk : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1679,7 +1797,7 @@ case 114: this.$ = ''; break; -case 52: +case 55: /*! Production:: start_conditions : "<" name_list ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1690,7 +1808,7 @@ case 52: this.$ = yyvstack[yysp - 1]; break; -case 53: +case 56: /*! Production:: start_conditions : "<" name_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1703,14 +1821,14 @@ case 53: Seems you did not correctly terminate the start condition set <${yyvstack[yysp - 1].join(',')},???> with a terminating '>' Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 54: +case 57: /*! Production:: start_conditions : "<" "*" ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1721,7 +1839,7 @@ case 54: this.$ = ['*']; break; -case 55: +case 58: /*! Production:: start_conditions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1730,7 +1848,7 @@ case 55: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 56: +case 59: /*! Production:: name_list : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1741,7 +1859,7 @@ case 56: this.$ = [yyvstack[yysp]]; break; -case 57: +case 60: /*! Production:: name_list : name_list "," NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1752,7 +1870,7 @@ case 57: this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; -case 58: +case 61: /*! Production:: regex : nonempty_regex_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1823,9 +1941,9 @@ case 58: } break; -case 59: +case 62: /*! Production:: regex_list : regex_list "|" regex_concat */ -case 63: +case 66: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1836,9 +1954,9 @@ case 63: this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; -case 60: +case 63: /*! Production:: regex_list : regex_list "|" */ -case 64: +case 67: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1849,7 +1967,7 @@ case 64: this.$ = yyvstack[yysp - 1] + '|'; break; -case 65: +case 68: /*! Production:: nonempty_regex_list : "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1860,7 +1978,7 @@ case 65: this.$ = '|' + yyvstack[yysp]; break; -case 69: +case 72: /*! Production:: regex_base : "(" regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1871,7 +1989,7 @@ case 69: this.$ = '(' + yyvstack[yysp - 1] + ')'; break; -case 70: +case 73: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1882,9 +2000,9 @@ case 70: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; -case 71: +case 74: /*! Production:: regex_base : "(" regex_list error */ -case 72: +case 75: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1897,14 +2015,14 @@ case 72: Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 73: +case 76: /*! Production:: regex_base : regex_base "+" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1915,7 +2033,7 @@ case 73: this.$ = yyvstack[yysp - 1] + '+'; break; -case 74: +case 77: /*! Production:: regex_base : regex_base "*" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1926,7 +2044,7 @@ case 74: this.$ = yyvstack[yysp - 1] + '*'; break; -case 75: +case 78: /*! Production:: regex_base : regex_base "?" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1937,7 +2055,7 @@ case 75: this.$ = yyvstack[yysp - 1] + '?'; break; -case 76: +case 79: /*! Production:: regex_base : "/" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1948,7 +2066,7 @@ case 76: this.$ = '(?=' + yyvstack[yysp] + ')'; break; -case 77: +case 80: /*! Production:: regex_base : "/!" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1959,21 +2077,21 @@ case 77: this.$ = '(?!' + yyvstack[yysp] + ')'; break; -case 78: +case 81: /*! Production:: regex_base : name_expansion */ -case 80: +case 83: /*! Production:: regex_base : any_group_regex */ -case 84: +case 87: /*! Production:: regex_base : string */ -case 85: +case 88: /*! Production:: regex_base : escape_char */ -case 86: +case 89: /*! Production:: name_expansion : NAME_BRACE */ -case 90: +case 93: /*! Production:: regex_set : regex_set_atom */ -case 91: +case 94: /*! Production:: regex_set_atom : REGEX_SET */ -case 96: +case 99: /*! Production:: string : CHARACTER_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1982,7 +2100,7 @@ case 96: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 81: +case 84: /*! Production:: regex_base : "." */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1993,7 +2111,7 @@ case 81: this.$ = '.'; break; -case 82: +case 85: /*! Production:: regex_base : "^" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2004,7 +2122,7 @@ case 82: this.$ = '^'; break; -case 83: +case 86: /*! Production:: regex_base : "$" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2015,10 +2133,8 @@ case 83: this.$ = '$'; break; -case 87: +case 90: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 107: - /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); @@ -2028,7 +2144,7 @@ case 107: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 88: +case 91: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2041,14 +2157,14 @@ case 88: Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 92: +case 95: /*! Production:: regex_set_atom : name_expansion */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2067,7 +2183,7 @@ case 92: //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 95: +case 98: /*! Production:: string : STRING_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2078,7 +2194,7 @@ case 95: this.$ = prepareString(yyvstack[yysp]); break; -case 97: +case 100: /*! Production:: options : OPTIONS option_list OPTIONS_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2089,7 +2205,7 @@ case 97: this.$ = null; break; -case 98: +case 101: /*! Production:: option_list : option option_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2100,7 +2216,7 @@ case 98: this.$ = null; break; -case 100: +case 103: /*! Production:: option : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2112,7 +2228,7 @@ case 100: yy.options[yyvstack[yysp]] = true; break; -case 101: +case 104: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2124,9 +2240,9 @@ case 101: yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; -case 102: +case 105: /*! Production:: option : NAME "=" OPTION_VALUE */ -case 103: +case 106: /*! Production:: option : NAME "=" NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2138,7 +2254,7 @@ case 103: yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; -case 104: +case 107: /*! Production:: option : NAME "=" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2152,14 +2268,14 @@ case 104: Internal error: option "${$option}" value assignment failure. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 105: +case 108: /*! Production:: option : error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2173,14 +2289,67 @@ case 105: Expected a valid option name (with optional value assignment). Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 108: +case 109: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = yyvstack[yysp]; + break; + +case 110: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Each of the 3 chunks should be parse-able as a JS snippet on its own. + // + // Note: we have already checked the first section in a previous reduction + // of this rule, so we don't need to check that one again! + var rv = checkActionBlock(yyvstack[yysp - 1], yylstack[yysp - 1]); + if (rv) { + yyparser.yyError(rmCommonWS` + The source code %include-d into the extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} + `); + } + rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 111: /*! Production:: include_macro_code : INCLUDE PATH */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2193,7 +2362,7 @@ case 108: this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; -case 109: +case 112: /*! Production:: include_macro_code : INCLUDE error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2206,19 +2375,19 @@ case 109: %include MUST be followed by a valid file path. Erroneous path: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 112: - /*! Production:: module_code_chunk : error */ +case 115: + /*! Production:: module_code_chunk : error CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): - this.$ = yyvstack[yysp]; - this._$ = yylstack[yysp]; + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) @@ -2227,14 +2396,14 @@ case 112: Module code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} Technical error report: - ${yyvstack[yysp].errStr} + ${yyvstack[yysp - 1].errStr} `); break; -case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! +case 151: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -2253,7 +2422,7 @@ table: bt({ 1, 1, 11, - 18, + 19, 21, 2, 2, @@ -2266,6 +2435,7 @@ table: bt({ 1, 1, 19, + 18, 11, 12, 18, @@ -2300,6 +2470,7 @@ table: bt({ 17, 23, 3, + 19, 30, 29, 30, @@ -2325,16 +2496,17 @@ table: bt({ 11, 1, 4, + c, + [55, 3], + 3, 3, - 2, - s, - [3, 3], 17, 16, 3, 3, 1, 3, + 7, s, [29, 3], 21, @@ -2347,6 +2519,7 @@ table: bt({ [3, 4], 6, 3, + 3, 23, s, [18, 3], @@ -2354,6 +2527,8 @@ table: bt({ 14, 1, 14, + 3, + 1, 20, 2, 17, @@ -2385,6 +2560,7 @@ table: bt({ c, [17, 10], 1, + 2, 3, 5, 9, @@ -2412,9 +2588,9 @@ table: bt({ 27, 63, c, - [54, 12], + [55, 13], c, - [11, 21], + [11, 20], 2, 20, 26, @@ -2438,18 +2614,21 @@ table: bt({ 65, 70, c, - [67, 13], + [19, 17], + 64, + c, + [85, 13], 9, c, [12, 9], c, - [125, 12], + [143, 12], c, - [123, 6], + [141, 6], c, [30, 3], c, - [59, 6], + [58, 6], s, [20, 7, 1], 28, @@ -2498,14 +2677,14 @@ table: bt({ [19, 7], 27, c, - [572, 11], + [590, 11], c, [12, 27], c, - [593, 3], + [611, 3], 61, c, - [612, 14], + [630, 14], c, [3, 3], 28, @@ -2515,7 +2694,7 @@ table: bt({ 28, 28, c, - [616, 11], + [634, 11], 88, 48, 2, @@ -2536,29 +2715,31 @@ table: bt({ 89, 90, c, - [630, 17], + [629, 17], 3, c, - [732, 13], + [750, 13], 67, c, - [733, 8], + [751, 8], 7, 20, 71, c, - [613, 24], + [691, 20], c, - [643, 65], + [632, 23], c, - [507, 145], + [662, 65], + c, + [526, 145], 2, 9, 11, c, - [769, 15], + [788, 15], c, - [789, 7], + [808, 7], 11, c, [201, 59], @@ -2574,44 +2755,46 @@ table: bt({ c, [4, 8], c, - [476, 33], + [495, 33], c, [11, 59], 3, 4, c, - [473, 8], + [449, 8], c, [401, 15], c, [27, 54], c, - [584, 11], + [603, 11], c, [11, 78], 52, c, [182, 11], c, - [664, 3], + [683, 3], 49, 50, 1, 51, 88, 1, + 53, + 1, 51, 1, 51, - 53, c, - [3, 7], + [5, 3], + 53, c, - [672, 16], + [647, 17], 2, 4, c, - [673, 13], + [691, 13], 66, 2, 28, @@ -2623,60 +2806,65 @@ table: bt({ c, [4, 3], c, - [642, 58], + [740, 8], + c, + [648, 57], c, - [525, 31], + [531, 31], c, - [522, 13], + [528, 13], c, - [750, 8], + [756, 8], c, - [662, 115], + [668, 115], c, - [562, 5], + [568, 5], c, - [315, 10], + [321, 10], 53, c, [13, 13], c, - [979, 3], + [1004, 3], c, [3, 9], c, - [988, 4], + [273, 4], c, - [987, 3], - 51, - 53, + [272, 3], c, - [300, 14], + [328, 5], c, - [973, 9], + [310, 14], + c, + [1001, 9], 1, c, - [487, 10], + [496, 10], c, [27, 7], c, [18, 36], c, - [1050, 14], + [1078, 14], c, [14, 14], 20, c, [15, 14], c, - [830, 20], + [461, 3], + 53, + c, + [843, 20], c, - [469, 3], + [480, 3], c, - [460, 16], + [474, 16], c, - [159, 14], + [163, 14], c, - [491, 18], + [505, 18], 6, 8 ]), @@ -2694,33 +2882,35 @@ table: bt({ c, [15, 12], s, - [2, 19], + [2, 20], c, - [31, 14], + [32, 14], s, [0, 8], c, [23, 3], c, - [56, 31], + [57, 32], c, - [62, 10], + [62, 9], c, - [112, 13], + [113, 13], c, [67, 4], c, [40, 20], c, - [78, 36], + [21, 18], c, - [123, 7], + [96, 36], + c, + [141, 7], c, [30, 28], c, - [203, 43], + [221, 43], c, - [205, 9], + [223, 9], c, [22, 34], c, @@ -2732,45 +2922,47 @@ table: bt({ c, [139, 19], c, - [655, 16], + [673, 16], c, [14, 5], c, [180, 13], c, - [194, 34], - s, - [0, 9], + [764, 35], + c, + [751, 9], + c, + [98, 19], c, - [98, 21], + [632, 31], c, - [643, 86], + [662, 75], c, - [492, 151], + [511, 151], c, - [494, 34], + [513, 34], c, [231, 35], c, - [802, 238], + [821, 238], c, - [716, 74], + [735, 74], c, - [44, 28], + [43, 27], c, - [708, 37], + [740, 39], c, - [522, 78], + [1202, 78], c, - [454, 163], + [756, 30], c, - [164, 19], + [696, 140], c, - [973, 11], + [1001, 31], c, - [830, 147], - s, - [2, 21] + [461, 114], + c, + [121, 58] ]), state: u([ s, @@ -2779,112 +2971,119 @@ table: bt({ 11, 12, 20, - 21, 22, - 24, + 23, 25, - 30, + 26, 31, + 32, + 37, 36, - 35, - 42, - 44, - 46, - 50, - 54, + 43, + 45, + 47, + 51, 55, 56, - 60, + 57, 61, + 62, 64, + 66, c, - [15, 5], - 65, + [16, 5], + 67, c, [5, 4], - 69, 71, - 72, + 73, + 74, c, [13, 5], - 73, + 75, c, [7, 6], - 74, + 76, c, [5, 4], - 75, + 77, c, [5, 4], + 81, + 78, 79, - 76, - 77, - 82, - 86, - 87, - 96, - 101, - 56, + 84, + 88, + 89, + 98, 103, + 57, 105, - 104, 108, + 107, 110, + 112, c, - [66, 7], - 111, - 114, + [67, 7], + 113, + 61, + 62, + 117, c, - [58, 11], + [60, 11], c, [6, 6], - 69, - 79, - 122, - 129, - 131, - 133, + 71, + 81, + 125, + 132, + 135, + 137, + 143, + 108, + 107, c, - [12, 5], - 139, + [15, 5], + 145, c, - [29, 5], - 105, - 140, - 142, + [32, 5], + 108, + 146, + 148, c, - [47, 8], + [52, 8], + 132, c, - [22, 5] + [23, 5] ]), mode: u([ s, [2, 23], s, [1, 12], - s, - [2, 28], - s, - [1, 15], - s, - [2, 33], c, - [39, 17], + [24, 13], + c, + [41, 28], c, - [13, 6], + [44, 15], c, - [18, 7], + [89, 27], c, - [64, 21], + [17, 13], c, - [21, 10], + [88, 11], c, - [106, 15], + [64, 34], c, - [75, 12], + [38, 14], + c, + [123, 15], + c, + [92, 12], 1, c, - [90, 10], + [107, 10], c, [27, 6], c, @@ -2912,141 +3111,152 @@ table: bt({ c, [409, 15], c, - [568, 9], + [585, 9], c, [47, 20], c, - [454, 17], + [45, 25], + c, + [36, 14], c, - [561, 23], + [578, 18], c, - [585, 53], + [602, 53], c, - [442, 145], + [459, 145], c, - [718, 19], + [735, 19], c, - [780, 33], + [797, 33], c, [29, 25], c, - [759, 238], + [776, 238], c, - [796, 51], + [813, 51], c, [289, 5], c, - [1211, 12], + [648, 7], c, - [722, 35], + [298, 21], c, - [340, 9], + [738, 18], c, - [648, 24], + [621, 8], c, - [854, 59], + [376, 7], c, - [1199, 170], + [651, 22], c, - [311, 6], + [874, 59], c, - [969, 23], + [1219, 170], c, - [1128, 90], + [960, 9], c, - [291, 66] + [947, 23], + c, + [1151, 89], + c, + [805, 17], + s, + [2, 53] ]), goto: u([ s, - [6, 11], + [9, 11], s, - [8, 11], - 5, + [11, 11], + 8, 5, s, [7, 4, 1], s, [13, 7, 1], s, - [7, 11], - s, - [31, 17], - 23, - 26, - 28, - 32, - 33, + [10, 11], 34, - 39, + 21, + s, + [34, 16], + 24, 27, 29, - 37, + 33, + 34, + 35, + 40, + 28, + 30, 38, + 39, + 42, 41, - 40, - 43, - 45, + 44, + 46, s, - [12, 11], + [15, 11], s, - [13, 11], + [16, 11], s, - [14, 11], - 47, + [17, 11], 48, 49, - 51, + 50, 52, 53, s, - [51, 11], + [54, 12], + 59, 58, - 57, 1, 2, - 4, - 55, - 62, + 7, + 58, + 63, s, - [55, 6], - 59, + [58, 6], + 60, s, - [55, 7], + [58, 7], s, - [9, 11], - 58, - 58, - 63, + [34, 17], + s, + [12, 11], + 61, + 61, + 65, s, - [58, 9], + [61, 9], c, - [108, 12], + [125, 12], s, - [66, 3], + [69, 3], c, [15, 5], s, - [66, 7], - 39, - 66, + [69, 7], + 40, + 69, c, [23, 7], - 68, - 68, - 67, - s, - [68, 3], + 71, + 71, c, - [7, 3], - s, - [68, 17], - 70, - 68, + [3, 3], + 71, 68, - 62, - 62, - 26, - 62, + 70, + s, + [71, 18], + 72, + 71, + 71, + 65, + 65, + 27, + 65, c, [68, 11], c, @@ -3056,197 +3266,200 @@ table: bt({ c, [12, 12], s, - [78, 29], - s, - [80, 29], - s, [81, 29], s, - [82, 29], - s, [83, 29], s, [84, 29], s, [85, 29], s, - [86, 31], - 37, - 78, - s, - [95, 29], + [86, 29], s, - [96, 29], + [87, 29], s, - [93, 29], + [88, 29], s, - [10, 9], + [89, 31], + 38, 80, - 10, - 10, s, - [26, 12], + [98, 29], s, - [11, 9], - 81, - 11, - 11, + [99, 29], + s, + [96, 29], s, - [28, 12], + [13, 9], + 82, + 13, + 13, + s, + [29, 12], + s, + [14, 9], 83, - 84, + 14, + 14, + s, + [31, 12], 85, + 86, + 87, s, - [17, 11], + [20, 11], s, - [22, 3], + [25, 3], s, - [23, 3], + [26, 3], 16, 16, - 20, - 21, - 98, + 23, + 24, + 100, s, - [88, 8, 1], - 97, + [90, 8, 1], 99, - 100, + 101, + 102, + 59, 58, - 57, - 99, - 100, 102, - 100, - 100, + 103, + 104, + 103, + 103, s, - [105, 3], - 114, - 107, - 114, + [108, 3], + 117, 106, - s, - [30, 17], + 117, 109, + s, + [33, 17], + 111, c, - [667, 13], - 112, - 113, + [684, 13], + 114, + 115, + 6, + c, + [630, 8], + 116, + s, + [58, 7], s, - [64, 3], + [67, 3], c, - [17, 5], + [34, 5], s, - [64, 7], - 39, - 64, + [67, 7], + 40, + 67, c, - [25, 6], - 64, + [42, 6], + 67, s, - [65, 3], + [68, 3], c, [24, 5], s, - [65, 7], - 39, - 65, + [68, 7], + 40, + 68, c, [24, 6], - 65, - s, - [67, 6], - 66, 68, + 70, + 70, + 69, s, - [67, 18], + [70, 3], + c, + [7, 3], + s, + [70, 17], + 72, + 70, 70, - 67, - 67, s, - [73, 29], + [76, 29], s, - [74, 29], + [77, 29], s, - [75, 29], + [78, 29], s, - [79, 29], + [82, 29], s, - [94, 29], - 116, - 117, - 115, - 61, - 61, - 26, - 61, - c, - [242, 11], + [97, 29], 119, - 117, + 120, 118, - 76, - 76, - 67, + 64, + 64, + 27, + 64, + c, + [259, 11], + 122, + 120, + 121, + 79, + 79, + 69, s, - [76, 3], - 66, + [79, 3], 68, - s, - [76, 18], 70, - 76, - 76, - 77, - 77, - 67, s, - [77, 3], - 66, - 68, + [79, 18], + 72, + 79, + 79, + 80, + 80, + 69, s, - [77, 18], + [80, 3], + 68, 70, - 77, - 77, - 121, - 37, - 120, - 78, - s, - [90, 4], s, - [91, 4], - s, - [92, 4], - s, - [27, 12], + [80, 18], + 72, + 80, + 80, + 124, + 38, + 123, + 80, s, - [29, 12], + [93, 4], s, - [15, 11], + [94, 4], s, - [16, 11], + [95, 4], s, - [24, 11], + [30, 12], s, - [25, 11], + [32, 12], s, [18, 11], s, [19, 11], s, - [40, 27], + [27, 11], + s, + [28, 11], s, - [41, 27], + [21, 11], s, - [42, 27], + [22, 11], s, - [43, 11], + [43, 27], s, - [44, 11], + [44, 27], s, - [45, 11], + [45, 27], s, [46, 11], s, @@ -3257,121 +3470,136 @@ table: bt({ [49, 11], s, [50, 11], - 124, - 123, s, - [97, 11], - 98, - 128, + [51, 11], + s, + [52, 11], + s, + [53, 11], 127, - 125, 126, - 3, - 99, - 106, - 106, - 113, - 113, - 130, s, - [110, 3], - s, - [112, 3], + [100, 11], + 101, + 131, + 130, + 128, + 129, + 3, + 101, + 5, + 133, + 109, + 109, + 116, + 116, + 134, s, - [32, 17], - 132, + [113, 3], s, - [37, 14], - 134, - 16, - 136, - 135, - 137, + [35, 17], + 136, + s, + [40, 14], 138, + 16, + 140, + 139, + 141, + 142, s, - [56, 3], + [59, 3], + 117, + 144, + 117, + 109, s, - [63, 3], + [66, 3], c, - [624, 5], + [627, 5], s, - [63, 7], - 39, - 63, + [66, 7], + 40, + 66, c, - [431, 6], - 63, + [434, 6], + 66, s, - [69, 29], + [72, 29], s, - [71, 29], - 60, - 60, - 26, - 60, + [74, 29], + 63, + 63, + 27, + 63, c, - [505, 11], + [508, 11], s, - [70, 29], + [73, 29], s, - [72, 29], + [75, 29], s, - [87, 29], + [90, 29], s, - [88, 29], + [91, 29], s, - [89, 4], + [92, 4], s, - [108, 13], + [111, 13], s, - [109, 13], + [112, 13], s, - [101, 3], + [104, 3], s, - [102, 3], + [105, 3], s, - [103, 3], + [106, 3], s, - [104, 3], + [107, 3], c, - [940, 4], + [259, 4], s, - [111, 3], - 141, + [115, 3], + s, + [114, 3], + 147, c, - [926, 13], - 35, - 35, - 143, + [949, 13], + 38, + 38, + 149, s, - [35, 15], + [38, 15], s, - [38, 18], + [41, 18], s, - [39, 18], + [42, 18], s, - [52, 14], + [55, 14], s, - [53, 14], - 144, + [56, 14], + 150, s, - [54, 14], - 59, - 59, - 26, - 59, + [57, 14], + 4, + 101, + 133, + 62, + 62, + 27, + 62, c, - [112, 11], - 107, - 107, + [115, 11], + 110, + 110, s, - [33, 17], + [36, 17], s, - [36, 14], + [39, 14], s, - [34, 17], + [37, 17], s, - [57, 3] + [60, 3] ]) }), defaultActions: bda({ @@ -3379,7 +3607,6 @@ defaultActions: bda({ 0, 2, 6, - 7, 11, 12, 13, @@ -3387,114 +3614,115 @@ defaultActions: bda({ 18, 19, 21, + 22, s, - [30, 8, 1], - 39, + [31, 8, 1], 40, + 41, s, - [41, 4, 2], - 48, + [42, 4, 2], 49, - 52, + 50, 53, - 58, - 60, + 54, + 59, + 61, s, - [66, 5, 1], + [68, 5, 1], s, - [77, 22, 1], - 100, - 101, - 104, - 106, + [79, 22, 1], + 102, + 103, 107, - 108, - 113, + 109, + 110, 115, - 116, + 118, + 119, s, - [118, 11, 1], - 130, + [121, 11, 1], + 133, + 134, s, - [133, 4, 1], - 138, + [137, 4, 1], + 142, s, - [140, 5, 1] + [146, 5, 1] ]), goto: u([ - 6, - 8, - 7, - 31, - 12, - 13, - 14, - 51, + 9, + 11, + 10, + 15, + 16, + 17, + 54, 1, 2, - 9, - 78, + 34, + 12, + 81, s, - [80, 7, 1], - 95, + [83, 7, 1], + 98, + 99, 96, - 93, + 29, + 31, + 20, + 25, 26, - 28, - 17, - 22, 23, - 20, - 21, - 105, + 24, + 108, + 33, + 76, + 77, + 78, + 82, + 97, + 93, + 94, + 95, 30, - 73, + 32, + 18, + 19, + 27, + 28, + 21, + 22, + s, + [43, 11, 1], + 100, + 101, + 109, + 113, + 35, + 59, + 72, 74, + 73, 75, - 79, - 94, 90, 91, 92, - 27, - 29, - 15, - 16, - 24, - 25, - 18, - 19, - s, - [40, 11, 1], - 97, - 98, - 106, - 110, + 111, 112, - 32, - 56, - 69, - 71, - 70, - 72, - 87, - 88, - 89, - 108, - 109, s, - [101, 4, 1], - 111, - 38, - 39, - 52, - 53, - 54, - 107, - 33, + [104, 4, 1], + 115, + 114, + 41, + 42, + 55, + 56, + 57, + 110, 36, - 34, - 57 + 39, + 37, + 60 ]) }), parseError: function parseError(str, hash, ExceptionClass) { @@ -3527,7 +3755,7 @@ parse: function parse(input) { var TERROR = this.TERROR; var EOF = this.EOF; var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; - var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + var NO_ACTION = [0, 151 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -4854,6 +5082,8 @@ parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; var rmCommonWS = helpers.rmCommonWS; +var checkActionBlock = helpers.checkActionBlock; + function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); @@ -4907,7 +5137,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-204 */ +/* lexer generated by jison-lex 0.6.1-205 */ /* * Returns a Lexer object of the following structure: @@ -5265,7 +5495,37 @@ EOF: 1, * @public * @this {RegExpLexer} */ - constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) { + msg = '' + msg; + + // heuristic to determine if the error message already contains a (partial) source code dump + // as produced by either `showPosition()` or `prettyPrintRange()`: + if (show_input_position == undefined) { + show_input_position = !(msg.indexOf('\n') > 0 && msg.indexOf('^') > 0); + } + + if (this.yylloc && show_input_position) { + if (typeof this.prettyPrintRange === 'function') { + var pretty_src = this.prettyPrintRange(this.yylloc); + + if (!/\n\s*$/.test(msg)) { + msg += '\n'; + } + + msg += '\n Erroneous area:\n' + this.prettyPrintRange(this.yylloc); + } else if (typeof this.showPosition === 'function') { + var pos_str = this.showPosition(); + + if (pos_str) { + if (msg.length && msg[msg.length - 1] !== '\n' && pos_str[0] !== '\n') { + msg += '\n' + pos_str; + } else { + msg += pos_str; + } + } + } + } + /** @constructor */ var pei = { errStr: msg, @@ -5343,7 +5603,7 @@ EOF: 1, yyerror: function yyError(str /*, ...args */) { var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } @@ -5630,7 +5890,12 @@ EOF: 1, if (lines.length > 1) { this.yylineno -= lines.length - 1; this.yylloc.last_line = this.yylineno + 1; + + // Get last entirely matched line into the `pre_lines[]` array's + // last index slot; we don't mind when other previously + // matched lines end up in the array too. var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); if (pre_lines.length === 1) { @@ -5675,22 +5940,12 @@ EOF: 1, // `.lex()` run. var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, + 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).', false ); @@ -5894,35 +6149,23 @@ EOF: 1, var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ': ' + line; var errpfx = new Array(lineno_display_width + 1).join('^'); + var offset = 2 + 1; + var len = 0; if (lno === loc.first_line) { - var offset = loc.first_column + 2; + offset += loc.first_column; - var len = Math.max( + len = Math.max( 2, ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 ); - - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } + len = Math.max(2, loc.last_column + 1); } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); + len = Math.max(2, line.length + 1); + } + + if (len) { var lead = new Array(offset).join('.'); var mark = new Array(len).join('^'); rv += '\n' + errpfx + lead + mark; @@ -5941,15 +6184,6 @@ EOF: 1, if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; - - console.log('clip off: ', { - start: clip_start, - end: clip_end, - len: clip_end - clip_start + 1, - arr: nonempty_line_indexes, - rv - }); - var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); @@ -6165,18 +6399,8 @@ EOF: 1, lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, + 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!', false ); @@ -6238,27 +6462,24 @@ EOF: 1, lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, + 'Lexical error' + lineno_msg + ': Unrecognized text.', this.options.lexerErrorsAreRecoverable ); + var pendingInput = this._input; + var activeCondition = this.topState(); + var conditionStackDepth = this.conditionStack.length; token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us - // by moving forward at least one character at a time: - if (!this.match.length) { + // by moving forward at least one character at a time IFF the (user-specified?) `parseError()` + // has not consumed/modified any pending input or changed state in the error handler: + if (!this.matches && // and make sure the input has been modified/consumed ... + pendingInput === this._input && // ...or the lexer state has been modified significantly enough + // to merit a non-consuming error handling action right now. + activeCondition === this.topState() && conditionStackDepth === this.conditionStack.length) { this.input(); } } @@ -6395,7 +6616,7 @@ EOF: 1, case 0: /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %\{ */ - yy.dept = 0; + yy.depth = 0; yy.include_command_allowed = false; this.pushState('action'); @@ -6407,7 +6628,7 @@ EOF: 1, case 1: /*! Conditions:: action */ /*! Rule:: %\{([^]*?)%\} */ - yy_.yytext = this.matches[1]; + yy_.yytext = this.matches[1].replace(/%\\\}/g, '%}'); // unescape any literal '%\}' that exists within the action code block yy.include_command_allowed = true; return 32; @@ -6544,13 +6765,13 @@ EOF: 1, too many closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse - easily; we suggest you wrap the action code chunk in '%{...%\}' + easily; we suggest you wrap the action code chunk in '%{...%}' to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); - return 'BRACKETS_SURPLUS'; + return 30; } else { yy.depth--; } @@ -6593,14 +6814,14 @@ EOF: 1, missing ${yy.depth} closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse - easily; we suggest you wrap the action code chunk in '%{...%\}' + easily; we suggest you wrap the action code chunk in '%{...%}' to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = ''; - return 'BRACKETS_MISSING'; + return 29; } this.popState(); @@ -6896,7 +7117,7 @@ EOF: 1, while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = [ this.matches[1], // {NAME} @@ -6976,7 +7197,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -6988,7 +7209,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7000,7 +7221,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7012,7 +7233,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7024,7 +7245,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7036,7 +7257,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7051,7 +7272,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7066,7 +7287,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7081,7 +7302,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7104,7 +7325,7 @@ EOF: 1, regex expression here in jison-lex ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); break; @@ -7116,7 +7337,7 @@ EOF: 1, while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); break; diff --git a/dist/lex-parser-es6.js b/dist/lex-parser-es6.js index 348d6b6..543d5d9 100644 --- a/dist/lex-parser-es6.js +++ b/dist/lex-parser-es6.js @@ -5,7 +5,7 @@ import fs from 'fs'; // hack: var assert; -/* parser generated by jison 0.6.1-204 */ +/* parser generated by jison 0.6.1-205 */ /* * Returns a Parser object of the following structure: @@ -859,7 +859,7 @@ productions_: bp({ 54, 54, s, - [55, 3], + [55, 6], 56, 57, 57, @@ -926,7 +926,8 @@ productions_: bp({ rule: u([ s, [4, 3], - 2, + s, + [5, 4, -1], 0, 0, 2, @@ -948,12 +949,12 @@ productions_: bp({ c, [23, 3], 4, - 4, - 3, c, - [29, 4], - s, - [3, 3], + [32, 4], + 2, + c, + [22, 3], + 3, s, [2, 8], 0, @@ -988,7 +989,8 @@ productions_: bp({ c, [10, 4], c, - [32, 5], + [82, 4], + 1, 0 ]) }), @@ -1056,6 +1058,7 @@ case 2: yyparser.yyError(rmCommonWS` + There's an error in your lexer regex rules or epilogue. Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: @@ -1064,10 +1067,10 @@ case 2: %% rules %% // <-- optional! - extra_module_code // <-- optional! + extra_module_code // <-- optional epilogue! Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp - 1].errStr} @@ -1082,7 +1085,7 @@ case 3: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + if (yyvstack[yysp].trim() !== '') { this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; } else { this.$ = { rules: yyvstack[yysp - 2] }; @@ -1090,6 +1093,86 @@ case 3: break; case 4: + /*! Production:: rules_and_epilogue : "%%" error rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 4]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 4, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp - 3])} + + Technical error report: + ${yyvstack[yysp - 3].errStr} + `); + break; + +case 5: + /*! Production:: rules_and_epilogue : "%%" rules "%%" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's an error in your lexer epilogue a.k.a. 'extra_module_code' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 6: + /*! Production:: rules_and_epilogue : "%%" error rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 7: /*! Production:: rules_and_epilogue : "%%" rules */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1100,7 +1183,7 @@ case 4: this.$ = { rules: yyvstack[yysp] }; break; -case 5: +case 8: /*! Production:: rules_and_epilogue : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1111,7 +1194,7 @@ case 5: this.$ = { rules: [] }; break; -case 6: +case 9: /*! Production:: init : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1124,7 +1207,7 @@ case 6: if (!yy.options) yy.options = {}; break; -case 7: +case 10: /*! Production:: definitions : definitions definition */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1146,7 +1229,7 @@ case 7: } break; -case 8: +case 11: /*! Production:: definitions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1161,10 +1244,8 @@ case 8: }; break; -case 9: +case 12: /*! Production:: definition : NAME regex */ -case 38: - /*! Production:: rule : regex action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); @@ -1174,9 +1255,9 @@ case 38: this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; -case 10: +case 13: /*! Production:: definition : START_INC names_inclusive */ -case 11: +case 14: /*! Production:: definition : START_EXC names_exclusive */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1187,7 +1268,7 @@ case 11: this.$ = yyvstack[yysp]; break; -case 12: +case 15: /*! Production:: definition : action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1195,12 +1276,22 @@ case 12: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - yy.actionInclude.push(yyvstack[yysp]); this.$ = null; + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The '%{...%}' lexer setup action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + yy.actionInclude.push(yyvstack[yysp]); + this.$ = null; break; -case 13: +case 16: /*! Production:: definition : options */ -case 99: +case 102: /*! Production:: option_list : option */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1211,7 +1302,7 @@ case 99: this.$ = null; break; -case 14: +case 17: /*! Production:: definition : UNKNOWN_DECL */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1222,7 +1313,7 @@ case 14: this.$ = {type: 'unknown', body: yyvstack[yysp]}; break; -case 15: +case 18: /*! Production:: definition : IMPORT import_name import_path */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1233,7 +1324,7 @@ case 15: this.$ = {type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp]}; break; -case 16: +case 19: /*! Production:: definition : IMPORT import_name error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1247,14 +1338,14 @@ case 16: %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 17: +case 20: /*! Production:: definition : IMPORT error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1270,14 +1361,14 @@ case 17: %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 18: +case 21: /*! Production:: definition : INIT_CODE init_code_name action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1285,14 +1376,23 @@ case 18: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The '%code ${$init_code_name}' action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} + `); + } this.$ = { - type: 'codesection', + type: 'codesection', qualifier: yyvstack[yysp - 1], include: yyvstack[yysp] }; break; -case 19: +case 22: /*! Production:: definition : INIT_CODE error action */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1306,40 +1406,38 @@ case 19: %code qualifier_name {action code} Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} Technical error report: ${yyvstack[yysp - 1].errStr} `); break; -case 20: +case 23: /*! Production:: init_code_name : NAME */ -case 21: +case 24: /*! Production:: init_code_name : STRING_LIT */ -case 22: +case 25: /*! Production:: import_name : NAME */ -case 23: +case 26: /*! Production:: import_name : STRING_LIT */ -case 24: +case 27: /*! Production:: import_path : NAME */ -case 25: +case 28: /*! Production:: import_path : STRING_LIT */ -case 61: +case 64: /*! Production:: regex_list : regex_concat */ -case 66: +case 69: /*! Production:: nonempty_regex_list : regex_concat */ -case 68: +case 71: /*! Production:: regex_concat : regex_base */ -case 93: +case 96: /*! Production:: escape_char : ESCAPE_CHAR */ -case 94: +case 97: /*! Production:: range_regex : RANGE_REGEX */ -case 106: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 110: - /*! Production:: module_code_chunk : CODE */ case 113: + /*! Production:: module_code_chunk : CODE */ +case 116: /*! Production:: optional_module_code_chunk : module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1350,7 +1448,7 @@ case 113: this.$ = yyvstack[yysp]; break; -case 26: +case 29: /*! Production:: names_inclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1361,7 +1459,7 @@ case 26: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; break; -case 27: +case 30: /*! Production:: names_inclusive : names_inclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1372,7 +1470,7 @@ case 27: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; break; -case 28: +case 31: /*! Production:: names_exclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1383,7 +1481,7 @@ case 28: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; break; -case 29: +case 32: /*! Production:: names_exclusive : names_exclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1394,7 +1492,7 @@ case 29: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; break; -case 30: +case 33: /*! Production:: rules : rules rules_collective */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1405,9 +1503,9 @@ case 30: this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; -case 31: +case 34: /*! Production:: rules : %epsilon */ -case 37: +case 40: /*! Production:: rule_block : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1418,7 +1516,7 @@ case 37: this.$ = []; break; -case 32: +case 35: /*! Production:: rules_collective : start_conditions rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1432,7 +1530,7 @@ case 32: this.$ = [yyvstack[yysp]]; break; -case 33: +case 36: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1448,7 +1546,7 @@ case 33: this.$ = yyvstack[yysp - 1]; break; -case 34: +case 37: /*! Production:: rules_collective : start_conditions "{" error "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1464,14 +1562,14 @@ case 34: block. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} + ${yylexer.prettyPrintRange(yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} Technical error report: ${yyvstack[yysp - 1].errStr} `); break; -case 35: +case 38: /*! Production:: rules_collective : start_conditions "{" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1487,14 +1585,14 @@ case 35: as a terminating curly brace '}' could not be found. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 36: +case 39: /*! Production:: rule_block : rule_block rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1505,7 +1603,27 @@ case 36: this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); break; -case 39: +case 41: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The rule's action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + +case 42: /*! Production:: rule : regex error */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1518,14 +1636,14 @@ case 39: Lexer rule regex action code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 40: +case 43: /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1538,11 +1656,11 @@ case 40: Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} `); break; -case 41: +case 44: /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1555,11 +1673,11 @@ case 41: Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} `); break; -case 42: +case 45: /*! Production:: action : ACTION_START action_body ACTION_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1585,9 +1703,9 @@ case 42: } break; -case 43: +case 46: /*! Production:: action_body : action_body ACTION */ -case 48: +case 51: /*! Production:: action_body : action_body include_macro_code */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1598,21 +1716,21 @@ case 48: this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; break; -case 44: +case 47: /*! Production:: action_body : action_body ACTION_BODY */ -case 45: +case 48: /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ -case 46: +case 49: /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ -case 47: +case 50: /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ -case 67: +case 70: /*! Production:: regex_concat : regex_concat regex_base */ -case 79: +case 82: /*! Production:: regex_base : regex_base range_regex */ -case 89: +case 92: /*! Production:: regex_set : regex_set regex_set_atom */ -case 111: +case 114: /*! Production:: module_code_chunk : module_code_chunk CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1623,7 +1741,7 @@ case 111: this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 49: +case 52: /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1636,11 +1754,11 @@ case 49: You may place the '%include' instruction only at the start/front of a line. It's use is not permitted at this position: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} `); break; -case 50: +case 53: /*! Production:: action_body : action_body error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1653,18 +1771,18 @@ case 50: Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 51: +case 54: /*! Production:: action_body : %epsilon */ -case 62: +case 65: /*! Production:: regex_list : %epsilon */ -case 114: +case 117: /*! Production:: optional_module_code_chunk : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1675,7 +1793,7 @@ case 114: this.$ = ''; break; -case 52: +case 55: /*! Production:: start_conditions : "<" name_list ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1686,7 +1804,7 @@ case 52: this.$ = yyvstack[yysp - 1]; break; -case 53: +case 56: /*! Production:: start_conditions : "<" name_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1699,14 +1817,14 @@ case 53: Seems you did not correctly terminate the start condition set <${yyvstack[yysp - 1].join(',')},???> with a terminating '>' Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 54: +case 57: /*! Production:: start_conditions : "<" "*" ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1717,7 +1835,7 @@ case 54: this.$ = ['*']; break; -case 55: +case 58: /*! Production:: start_conditions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1726,7 +1844,7 @@ case 55: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 56: +case 59: /*! Production:: name_list : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1737,7 +1855,7 @@ case 56: this.$ = [yyvstack[yysp]]; break; -case 57: +case 60: /*! Production:: name_list : name_list "," NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1748,7 +1866,7 @@ case 57: this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; -case 58: +case 61: /*! Production:: regex : nonempty_regex_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1819,9 +1937,9 @@ case 58: } break; -case 59: +case 62: /*! Production:: regex_list : regex_list "|" regex_concat */ -case 63: +case 66: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1832,9 +1950,9 @@ case 63: this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; -case 60: +case 63: /*! Production:: regex_list : regex_list "|" */ -case 64: +case 67: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1845,7 +1963,7 @@ case 64: this.$ = yyvstack[yysp - 1] + '|'; break; -case 65: +case 68: /*! Production:: nonempty_regex_list : "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1856,7 +1974,7 @@ case 65: this.$ = '|' + yyvstack[yysp]; break; -case 69: +case 72: /*! Production:: regex_base : "(" regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1867,7 +1985,7 @@ case 69: this.$ = '(' + yyvstack[yysp - 1] + ')'; break; -case 70: +case 73: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1878,9 +1996,9 @@ case 70: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; -case 71: +case 74: /*! Production:: regex_base : "(" regex_list error */ -case 72: +case 75: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1893,14 +2011,14 @@ case 72: Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 73: +case 76: /*! Production:: regex_base : regex_base "+" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1911,7 +2029,7 @@ case 73: this.$ = yyvstack[yysp - 1] + '+'; break; -case 74: +case 77: /*! Production:: regex_base : regex_base "*" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1922,7 +2040,7 @@ case 74: this.$ = yyvstack[yysp - 1] + '*'; break; -case 75: +case 78: /*! Production:: regex_base : regex_base "?" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1933,7 +2051,7 @@ case 75: this.$ = yyvstack[yysp - 1] + '?'; break; -case 76: +case 79: /*! Production:: regex_base : "/" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1944,7 +2062,7 @@ case 76: this.$ = '(?=' + yyvstack[yysp] + ')'; break; -case 77: +case 80: /*! Production:: regex_base : "/!" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1955,21 +2073,21 @@ case 77: this.$ = '(?!' + yyvstack[yysp] + ')'; break; -case 78: +case 81: /*! Production:: regex_base : name_expansion */ -case 80: +case 83: /*! Production:: regex_base : any_group_regex */ -case 84: +case 87: /*! Production:: regex_base : string */ -case 85: +case 88: /*! Production:: regex_base : escape_char */ -case 86: +case 89: /*! Production:: name_expansion : NAME_BRACE */ -case 90: +case 93: /*! Production:: regex_set : regex_set_atom */ -case 91: +case 94: /*! Production:: regex_set_atom : REGEX_SET */ -case 96: +case 99: /*! Production:: string : CHARACTER_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1978,7 +2096,7 @@ case 96: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 81: +case 84: /*! Production:: regex_base : "." */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1989,7 +2107,7 @@ case 81: this.$ = '.'; break; -case 82: +case 85: /*! Production:: regex_base : "^" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2000,7 +2118,7 @@ case 82: this.$ = '^'; break; -case 83: +case 86: /*! Production:: regex_base : "$" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2011,10 +2129,8 @@ case 83: this.$ = '$'; break; -case 87: +case 90: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 107: - /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); @@ -2024,7 +2140,7 @@ case 107: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 88: +case 91: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2037,14 +2153,14 @@ case 88: Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 92: +case 95: /*! Production:: regex_set_atom : name_expansion */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2063,7 +2179,7 @@ case 92: //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 95: +case 98: /*! Production:: string : STRING_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2074,7 +2190,7 @@ case 95: this.$ = prepareString(yyvstack[yysp]); break; -case 97: +case 100: /*! Production:: options : OPTIONS option_list OPTIONS_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2085,7 +2201,7 @@ case 97: this.$ = null; break; -case 98: +case 101: /*! Production:: option_list : option option_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2096,7 +2212,7 @@ case 98: this.$ = null; break; -case 100: +case 103: /*! Production:: option : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2108,7 +2224,7 @@ case 100: yy.options[yyvstack[yysp]] = true; break; -case 101: +case 104: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2120,9 +2236,9 @@ case 101: yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; -case 102: +case 105: /*! Production:: option : NAME "=" OPTION_VALUE */ -case 103: +case 106: /*! Production:: option : NAME "=" NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2134,7 +2250,7 @@ case 103: yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; -case 104: +case 107: /*! Production:: option : NAME "=" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2148,14 +2264,14 @@ case 104: Internal error: option "${$option}" value assignment failure. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 105: +case 108: /*! Production:: option : error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2169,14 +2285,67 @@ case 105: Expected a valid option name (with optional value assignment). Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 108: +case 109: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = yyvstack[yysp]; + break; + +case 110: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Each of the 3 chunks should be parse-able as a JS snippet on its own. + // + // Note: we have already checked the first section in a previous reduction + // of this rule, so we don't need to check that one again! + var rv = checkActionBlock(yyvstack[yysp - 1], yylstack[yysp - 1]); + if (rv) { + yyparser.yyError(rmCommonWS` + The source code %include-d into the extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} + `); + } + rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 111: /*! Production:: include_macro_code : INCLUDE PATH */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2189,7 +2358,7 @@ case 108: this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; -case 109: +case 112: /*! Production:: include_macro_code : INCLUDE error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2202,19 +2371,19 @@ case 109: %include MUST be followed by a valid file path. Erroneous path: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 112: - /*! Production:: module_code_chunk : error */ +case 115: + /*! Production:: module_code_chunk : error CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): - this.$ = yyvstack[yysp]; - this._$ = yylstack[yysp]; + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) @@ -2223,14 +2392,14 @@ case 112: Module code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} Technical error report: - ${yyvstack[yysp].errStr} + ${yyvstack[yysp - 1].errStr} `); break; -case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! +case 151: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -2249,7 +2418,7 @@ table: bt({ 1, 1, 11, - 18, + 19, 21, 2, 2, @@ -2262,6 +2431,7 @@ table: bt({ 1, 1, 19, + 18, 11, 12, 18, @@ -2296,6 +2466,7 @@ table: bt({ 17, 23, 3, + 19, 30, 29, 30, @@ -2321,16 +2492,17 @@ table: bt({ 11, 1, 4, + c, + [55, 3], + 3, 3, - 2, - s, - [3, 3], 17, 16, 3, 3, 1, 3, + 7, s, [29, 3], 21, @@ -2343,6 +2515,7 @@ table: bt({ [3, 4], 6, 3, + 3, 23, s, [18, 3], @@ -2350,6 +2523,8 @@ table: bt({ 14, 1, 14, + 3, + 1, 20, 2, 17, @@ -2381,6 +2556,7 @@ table: bt({ c, [17, 10], 1, + 2, 3, 5, 9, @@ -2408,9 +2584,9 @@ table: bt({ 27, 63, c, - [54, 12], + [55, 13], c, - [11, 21], + [11, 20], 2, 20, 26, @@ -2434,18 +2610,21 @@ table: bt({ 65, 70, c, - [67, 13], + [19, 17], + 64, + c, + [85, 13], 9, c, [12, 9], c, - [125, 12], + [143, 12], c, - [123, 6], + [141, 6], c, [30, 3], c, - [59, 6], + [58, 6], s, [20, 7, 1], 28, @@ -2494,14 +2673,14 @@ table: bt({ [19, 7], 27, c, - [572, 11], + [590, 11], c, [12, 27], c, - [593, 3], + [611, 3], 61, c, - [612, 14], + [630, 14], c, [3, 3], 28, @@ -2511,7 +2690,7 @@ table: bt({ 28, 28, c, - [616, 11], + [634, 11], 88, 48, 2, @@ -2532,29 +2711,31 @@ table: bt({ 89, 90, c, - [630, 17], + [629, 17], 3, c, - [732, 13], + [750, 13], 67, c, - [733, 8], + [751, 8], 7, 20, 71, c, - [613, 24], + [691, 20], c, - [643, 65], + [632, 23], c, - [507, 145], + [662, 65], + c, + [526, 145], 2, 9, 11, c, - [769, 15], + [788, 15], c, - [789, 7], + [808, 7], 11, c, [201, 59], @@ -2570,44 +2751,46 @@ table: bt({ c, [4, 8], c, - [476, 33], + [495, 33], c, [11, 59], 3, 4, c, - [473, 8], + [449, 8], c, [401, 15], c, [27, 54], c, - [584, 11], + [603, 11], c, [11, 78], 52, c, [182, 11], c, - [664, 3], + [683, 3], 49, 50, 1, 51, 88, 1, + 53, + 1, 51, 1, 51, - 53, c, - [3, 7], + [5, 3], + 53, c, - [672, 16], + [647, 17], 2, 4, c, - [673, 13], + [691, 13], 66, 2, 28, @@ -2619,60 +2802,65 @@ table: bt({ c, [4, 3], c, - [642, 58], + [740, 8], + c, + [648, 57], c, - [525, 31], + [531, 31], c, - [522, 13], + [528, 13], c, - [750, 8], + [756, 8], c, - [662, 115], + [668, 115], c, - [562, 5], + [568, 5], c, - [315, 10], + [321, 10], 53, c, [13, 13], c, - [979, 3], + [1004, 3], c, [3, 9], c, - [988, 4], + [273, 4], c, - [987, 3], - 51, - 53, + [272, 3], c, - [300, 14], + [328, 5], c, - [973, 9], + [310, 14], + c, + [1001, 9], 1, c, - [487, 10], + [496, 10], c, [27, 7], c, [18, 36], c, - [1050, 14], + [1078, 14], c, [14, 14], 20, c, [15, 14], c, - [830, 20], + [461, 3], + 53, + c, + [843, 20], c, - [469, 3], + [480, 3], c, - [460, 16], + [474, 16], c, - [159, 14], + [163, 14], c, - [491, 18], + [505, 18], 6, 8 ]), @@ -2690,33 +2878,35 @@ table: bt({ c, [15, 12], s, - [2, 19], + [2, 20], c, - [31, 14], + [32, 14], s, [0, 8], c, [23, 3], c, - [56, 31], + [57, 32], c, - [62, 10], + [62, 9], c, - [112, 13], + [113, 13], c, [67, 4], c, [40, 20], c, - [78, 36], + [21, 18], c, - [123, 7], + [96, 36], + c, + [141, 7], c, [30, 28], c, - [203, 43], + [221, 43], c, - [205, 9], + [223, 9], c, [22, 34], c, @@ -2728,45 +2918,47 @@ table: bt({ c, [139, 19], c, - [655, 16], + [673, 16], c, [14, 5], c, [180, 13], c, - [194, 34], - s, - [0, 9], + [764, 35], + c, + [751, 9], + c, + [98, 19], c, - [98, 21], + [632, 31], c, - [643, 86], + [662, 75], c, - [492, 151], + [511, 151], c, - [494, 34], + [513, 34], c, [231, 35], c, - [802, 238], + [821, 238], c, - [716, 74], + [735, 74], c, - [44, 28], + [43, 27], c, - [708, 37], + [740, 39], c, - [522, 78], + [1202, 78], c, - [454, 163], + [756, 30], c, - [164, 19], + [696, 140], c, - [973, 11], + [1001, 31], c, - [830, 147], - s, - [2, 21] + [461, 114], + c, + [121, 58] ]), state: u([ s, @@ -2775,112 +2967,119 @@ table: bt({ 11, 12, 20, - 21, 22, - 24, + 23, 25, - 30, + 26, 31, + 32, + 37, 36, - 35, - 42, - 44, - 46, - 50, - 54, + 43, + 45, + 47, + 51, 55, 56, - 60, + 57, 61, + 62, 64, + 66, c, - [15, 5], - 65, + [16, 5], + 67, c, [5, 4], - 69, 71, - 72, + 73, + 74, c, [13, 5], - 73, + 75, c, [7, 6], - 74, + 76, c, [5, 4], - 75, + 77, c, [5, 4], + 81, + 78, 79, - 76, - 77, - 82, - 86, - 87, - 96, - 101, - 56, + 84, + 88, + 89, + 98, 103, + 57, 105, - 104, 108, + 107, 110, + 112, c, - [66, 7], - 111, - 114, + [67, 7], + 113, + 61, + 62, + 117, c, - [58, 11], + [60, 11], c, [6, 6], - 69, - 79, - 122, - 129, - 131, - 133, + 71, + 81, + 125, + 132, + 135, + 137, + 143, + 108, + 107, c, - [12, 5], - 139, + [15, 5], + 145, c, - [29, 5], - 105, - 140, - 142, + [32, 5], + 108, + 146, + 148, c, - [47, 8], + [52, 8], + 132, c, - [22, 5] + [23, 5] ]), mode: u([ s, [2, 23], s, [1, 12], - s, - [2, 28], - s, - [1, 15], - s, - [2, 33], c, - [39, 17], + [24, 13], + c, + [41, 28], c, - [13, 6], + [44, 15], c, - [18, 7], + [89, 27], c, - [64, 21], + [17, 13], c, - [21, 10], + [88, 11], c, - [106, 15], + [64, 34], c, - [75, 12], + [38, 14], + c, + [123, 15], + c, + [92, 12], 1, c, - [90, 10], + [107, 10], c, [27, 6], c, @@ -2908,141 +3107,152 @@ table: bt({ c, [409, 15], c, - [568, 9], + [585, 9], c, [47, 20], c, - [454, 17], + [45, 25], + c, + [36, 14], c, - [561, 23], + [578, 18], c, - [585, 53], + [602, 53], c, - [442, 145], + [459, 145], c, - [718, 19], + [735, 19], c, - [780, 33], + [797, 33], c, [29, 25], c, - [759, 238], + [776, 238], c, - [796, 51], + [813, 51], c, [289, 5], c, - [1211, 12], + [648, 7], c, - [722, 35], + [298, 21], c, - [340, 9], + [738, 18], c, - [648, 24], + [621, 8], c, - [854, 59], + [376, 7], c, - [1199, 170], + [651, 22], c, - [311, 6], + [874, 59], c, - [969, 23], + [1219, 170], c, - [1128, 90], + [960, 9], c, - [291, 66] + [947, 23], + c, + [1151, 89], + c, + [805, 17], + s, + [2, 53] ]), goto: u([ s, - [6, 11], + [9, 11], s, - [8, 11], - 5, + [11, 11], + 8, 5, s, [7, 4, 1], s, [13, 7, 1], s, - [7, 11], - s, - [31, 17], - 23, - 26, - 28, - 32, - 33, + [10, 11], 34, - 39, + 21, + s, + [34, 16], + 24, 27, 29, - 37, + 33, + 34, + 35, + 40, + 28, + 30, 38, + 39, + 42, 41, - 40, - 43, - 45, + 44, + 46, s, - [12, 11], + [15, 11], s, - [13, 11], + [16, 11], s, - [14, 11], - 47, + [17, 11], 48, 49, - 51, + 50, 52, 53, s, - [51, 11], + [54, 12], + 59, 58, - 57, 1, 2, - 4, - 55, - 62, + 7, + 58, + 63, s, - [55, 6], - 59, + [58, 6], + 60, s, - [55, 7], + [58, 7], s, - [9, 11], - 58, - 58, - 63, + [34, 17], + s, + [12, 11], + 61, + 61, + 65, s, - [58, 9], + [61, 9], c, - [108, 12], + [125, 12], s, - [66, 3], + [69, 3], c, [15, 5], s, - [66, 7], - 39, - 66, + [69, 7], + 40, + 69, c, [23, 7], - 68, - 68, - 67, - s, - [68, 3], + 71, + 71, c, - [7, 3], - s, - [68, 17], - 70, - 68, + [3, 3], + 71, 68, - 62, - 62, - 26, - 62, + 70, + s, + [71, 18], + 72, + 71, + 71, + 65, + 65, + 27, + 65, c, [68, 11], c, @@ -3052,197 +3262,200 @@ table: bt({ c, [12, 12], s, - [78, 29], - s, - [80, 29], - s, [81, 29], s, - [82, 29], - s, [83, 29], s, [84, 29], s, [85, 29], s, - [86, 31], - 37, - 78, - s, - [95, 29], + [86, 29], s, - [96, 29], + [87, 29], s, - [93, 29], + [88, 29], s, - [10, 9], + [89, 31], + 38, 80, - 10, - 10, s, - [26, 12], + [98, 29], s, - [11, 9], - 81, - 11, - 11, + [99, 29], + s, + [96, 29], s, - [28, 12], + [13, 9], + 82, + 13, + 13, + s, + [29, 12], + s, + [14, 9], 83, - 84, + 14, + 14, + s, + [31, 12], 85, + 86, + 87, s, - [17, 11], + [20, 11], s, - [22, 3], + [25, 3], s, - [23, 3], + [26, 3], 16, 16, - 20, - 21, - 98, + 23, + 24, + 100, s, - [88, 8, 1], - 97, + [90, 8, 1], 99, - 100, + 101, + 102, + 59, 58, - 57, - 99, - 100, 102, - 100, - 100, + 103, + 104, + 103, + 103, s, - [105, 3], - 114, - 107, - 114, + [108, 3], + 117, 106, - s, - [30, 17], + 117, 109, + s, + [33, 17], + 111, c, - [667, 13], - 112, - 113, + [684, 13], + 114, + 115, + 6, + c, + [630, 8], + 116, + s, + [58, 7], s, - [64, 3], + [67, 3], c, - [17, 5], + [34, 5], s, - [64, 7], - 39, - 64, + [67, 7], + 40, + 67, c, - [25, 6], - 64, + [42, 6], + 67, s, - [65, 3], + [68, 3], c, [24, 5], s, - [65, 7], - 39, - 65, + [68, 7], + 40, + 68, c, [24, 6], - 65, - s, - [67, 6], - 66, 68, + 70, + 70, + 69, s, - [67, 18], + [70, 3], + c, + [7, 3], + s, + [70, 17], + 72, + 70, 70, - 67, - 67, s, - [73, 29], + [76, 29], s, - [74, 29], + [77, 29], s, - [75, 29], + [78, 29], s, - [79, 29], + [82, 29], s, - [94, 29], - 116, - 117, - 115, - 61, - 61, - 26, - 61, - c, - [242, 11], + [97, 29], 119, - 117, + 120, 118, - 76, - 76, - 67, + 64, + 64, + 27, + 64, + c, + [259, 11], + 122, + 120, + 121, + 79, + 79, + 69, s, - [76, 3], - 66, + [79, 3], 68, - s, - [76, 18], 70, - 76, - 76, - 77, - 77, - 67, s, - [77, 3], - 66, - 68, + [79, 18], + 72, + 79, + 79, + 80, + 80, + 69, s, - [77, 18], + [80, 3], + 68, 70, - 77, - 77, - 121, - 37, - 120, - 78, - s, - [90, 4], s, - [91, 4], - s, - [92, 4], - s, - [27, 12], + [80, 18], + 72, + 80, + 80, + 124, + 38, + 123, + 80, s, - [29, 12], + [93, 4], s, - [15, 11], + [94, 4], s, - [16, 11], + [95, 4], s, - [24, 11], + [30, 12], s, - [25, 11], + [32, 12], s, [18, 11], s, [19, 11], s, - [40, 27], + [27, 11], + s, + [28, 11], s, - [41, 27], + [21, 11], s, - [42, 27], + [22, 11], s, - [43, 11], + [43, 27], s, - [44, 11], + [44, 27], s, - [45, 11], + [45, 27], s, [46, 11], s, @@ -3253,121 +3466,136 @@ table: bt({ [49, 11], s, [50, 11], - 124, - 123, s, - [97, 11], - 98, - 128, + [51, 11], + s, + [52, 11], + s, + [53, 11], 127, - 125, 126, - 3, - 99, - 106, - 106, - 113, - 113, - 130, s, - [110, 3], - s, - [112, 3], + [100, 11], + 101, + 131, + 130, + 128, + 129, + 3, + 101, + 5, + 133, + 109, + 109, + 116, + 116, + 134, s, - [32, 17], - 132, + [113, 3], s, - [37, 14], - 134, - 16, - 136, - 135, - 137, + [35, 17], + 136, + s, + [40, 14], 138, + 16, + 140, + 139, + 141, + 142, s, - [56, 3], + [59, 3], + 117, + 144, + 117, + 109, s, - [63, 3], + [66, 3], c, - [624, 5], + [627, 5], s, - [63, 7], - 39, - 63, + [66, 7], + 40, + 66, c, - [431, 6], - 63, + [434, 6], + 66, s, - [69, 29], + [72, 29], s, - [71, 29], - 60, - 60, - 26, - 60, + [74, 29], + 63, + 63, + 27, + 63, c, - [505, 11], + [508, 11], s, - [70, 29], + [73, 29], s, - [72, 29], + [75, 29], s, - [87, 29], + [90, 29], s, - [88, 29], + [91, 29], s, - [89, 4], + [92, 4], s, - [108, 13], + [111, 13], s, - [109, 13], + [112, 13], s, - [101, 3], + [104, 3], s, - [102, 3], + [105, 3], s, - [103, 3], + [106, 3], s, - [104, 3], + [107, 3], c, - [940, 4], + [259, 4], s, - [111, 3], - 141, + [115, 3], + s, + [114, 3], + 147, c, - [926, 13], - 35, - 35, - 143, + [949, 13], + 38, + 38, + 149, s, - [35, 15], + [38, 15], s, - [38, 18], + [41, 18], s, - [39, 18], + [42, 18], s, - [52, 14], + [55, 14], s, - [53, 14], - 144, + [56, 14], + 150, s, - [54, 14], - 59, - 59, - 26, - 59, + [57, 14], + 4, + 101, + 133, + 62, + 62, + 27, + 62, c, - [112, 11], - 107, - 107, + [115, 11], + 110, + 110, s, - [33, 17], + [36, 17], s, - [36, 14], + [39, 14], s, - [34, 17], + [37, 17], s, - [57, 3] + [60, 3] ]) }), defaultActions: bda({ @@ -3375,7 +3603,6 @@ defaultActions: bda({ 0, 2, 6, - 7, 11, 12, 13, @@ -3383,114 +3610,115 @@ defaultActions: bda({ 18, 19, 21, + 22, s, - [30, 8, 1], - 39, + [31, 8, 1], 40, + 41, s, - [41, 4, 2], - 48, + [42, 4, 2], 49, - 52, + 50, 53, - 58, - 60, + 54, + 59, + 61, s, - [66, 5, 1], + [68, 5, 1], s, - [77, 22, 1], - 100, - 101, - 104, - 106, + [79, 22, 1], + 102, + 103, 107, - 108, - 113, + 109, + 110, 115, - 116, + 118, + 119, s, - [118, 11, 1], - 130, + [121, 11, 1], + 133, + 134, s, - [133, 4, 1], - 138, + [137, 4, 1], + 142, s, - [140, 5, 1] + [146, 5, 1] ]), goto: u([ - 6, - 8, - 7, - 31, - 12, - 13, - 14, - 51, + 9, + 11, + 10, + 15, + 16, + 17, + 54, 1, 2, - 9, - 78, + 34, + 12, + 81, s, - [80, 7, 1], - 95, + [83, 7, 1], + 98, + 99, 96, - 93, + 29, + 31, + 20, + 25, 26, - 28, - 17, - 22, 23, - 20, - 21, - 105, + 24, + 108, + 33, + 76, + 77, + 78, + 82, + 97, + 93, + 94, + 95, 30, - 73, + 32, + 18, + 19, + 27, + 28, + 21, + 22, + s, + [43, 11, 1], + 100, + 101, + 109, + 113, + 35, + 59, + 72, 74, + 73, 75, - 79, - 94, 90, 91, 92, - 27, - 29, - 15, - 16, - 24, - 25, - 18, - 19, - s, - [40, 11, 1], - 97, - 98, - 106, - 110, + 111, 112, - 32, - 56, - 69, - 71, - 70, - 72, - 87, - 88, - 89, - 108, - 109, s, - [101, 4, 1], - 111, - 38, - 39, - 52, - 53, - 54, - 107, - 33, + [104, 4, 1], + 115, + 114, + 41, + 42, + 55, + 56, + 57, + 110, 36, - 34, - 57 + 39, + 37, + 60 ]) }), parseError: function parseError(str, hash, ExceptionClass) { @@ -3523,7 +3751,7 @@ parse: function parse(input) { var TERROR = this.TERROR; var EOF = this.EOF; var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; - var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + var NO_ACTION = [0, 151 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -4850,6 +5078,8 @@ parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; var rmCommonWS = helpers.rmCommonWS; +var checkActionBlock = helpers.checkActionBlock; + function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); @@ -4903,7 +5133,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-204 */ +/* lexer generated by jison-lex 0.6.1-205 */ /* * Returns a Lexer object of the following structure: @@ -5261,7 +5491,37 @@ EOF: 1, * @public * @this {RegExpLexer} */ - constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) { + msg = '' + msg; + + // heuristic to determine if the error message already contains a (partial) source code dump + // as produced by either `showPosition()` or `prettyPrintRange()`: + if (show_input_position == undefined) { + show_input_position = !(msg.indexOf('\n') > 0 && msg.indexOf('^') > 0); + } + + if (this.yylloc && show_input_position) { + if (typeof this.prettyPrintRange === 'function') { + var pretty_src = this.prettyPrintRange(this.yylloc); + + if (!/\n\s*$/.test(msg)) { + msg += '\n'; + } + + msg += '\n Erroneous area:\n' + this.prettyPrintRange(this.yylloc); + } else if (typeof this.showPosition === 'function') { + var pos_str = this.showPosition(); + + if (pos_str) { + if (msg.length && msg[msg.length - 1] !== '\n' && pos_str[0] !== '\n') { + msg += '\n' + pos_str; + } else { + msg += pos_str; + } + } + } + } + /** @constructor */ var pei = { errStr: msg, @@ -5339,7 +5599,7 @@ EOF: 1, yyerror: function yyError(str /*, ...args */) { var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } @@ -5626,7 +5886,12 @@ EOF: 1, if (lines.length > 1) { this.yylineno -= lines.length - 1; this.yylloc.last_line = this.yylineno + 1; + + // Get last entirely matched line into the `pre_lines[]` array's + // last index slot; we don't mind when other previously + // matched lines end up in the array too. var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); if (pre_lines.length === 1) { @@ -5671,22 +5936,12 @@ EOF: 1, // `.lex()` run. var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, + 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).', false ); @@ -5890,35 +6145,23 @@ EOF: 1, var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ': ' + line; var errpfx = new Array(lineno_display_width + 1).join('^'); + var offset = 2 + 1; + var len = 0; if (lno === loc.first_line) { - var offset = loc.first_column + 2; + offset += loc.first_column; - var len = Math.max( + len = Math.max( 2, ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 ); - - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } + len = Math.max(2, loc.last_column + 1); } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); + len = Math.max(2, line.length + 1); + } + + if (len) { var lead = new Array(offset).join('.'); var mark = new Array(len).join('^'); rv += '\n' + errpfx + lead + mark; @@ -5937,15 +6180,6 @@ EOF: 1, if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; - - console.log('clip off: ', { - start: clip_start, - end: clip_end, - len: clip_end - clip_start + 1, - arr: nonempty_line_indexes, - rv - }); - var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); @@ -6161,18 +6395,8 @@ EOF: 1, lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, + 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!', false ); @@ -6234,27 +6458,24 @@ EOF: 1, lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, + 'Lexical error' + lineno_msg + ': Unrecognized text.', this.options.lexerErrorsAreRecoverable ); + var pendingInput = this._input; + var activeCondition = this.topState(); + var conditionStackDepth = this.conditionStack.length; token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us - // by moving forward at least one character at a time: - if (!this.match.length) { + // by moving forward at least one character at a time IFF the (user-specified?) `parseError()` + // has not consumed/modified any pending input or changed state in the error handler: + if (!this.matches && // and make sure the input has been modified/consumed ... + pendingInput === this._input && // ...or the lexer state has been modified significantly enough + // to merit a non-consuming error handling action right now. + activeCondition === this.topState() && conditionStackDepth === this.conditionStack.length) { this.input(); } } @@ -6391,7 +6612,7 @@ EOF: 1, case 0: /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %\{ */ - yy.dept = 0; + yy.depth = 0; yy.include_command_allowed = false; this.pushState('action'); @@ -6403,7 +6624,7 @@ EOF: 1, case 1: /*! Conditions:: action */ /*! Rule:: %\{([^]*?)%\} */ - yy_.yytext = this.matches[1]; + yy_.yytext = this.matches[1].replace(/%\\\}/g, '%}'); // unescape any literal '%\}' that exists within the action code block yy.include_command_allowed = true; return 32; @@ -6540,13 +6761,13 @@ EOF: 1, too many closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse - easily; we suggest you wrap the action code chunk in '%{...%\}' + easily; we suggest you wrap the action code chunk in '%{...%}' to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); - return 'BRACKETS_SURPLUS'; + return 30; } else { yy.depth--; } @@ -6589,14 +6810,14 @@ EOF: 1, missing ${yy.depth} closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse - easily; we suggest you wrap the action code chunk in '%{...%\}' + easily; we suggest you wrap the action code chunk in '%{...%}' to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = ''; - return 'BRACKETS_MISSING'; + return 29; } this.popState(); @@ -6892,7 +7113,7 @@ EOF: 1, while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = [ this.matches[1], // {NAME} @@ -6972,7 +7193,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -6984,7 +7205,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -6996,7 +7217,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7008,7 +7229,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7020,7 +7241,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7032,7 +7253,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7047,7 +7268,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7062,7 +7283,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7077,7 +7298,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7100,7 +7321,7 @@ EOF: 1, regex expression here in jison-lex ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); break; @@ -7112,7 +7333,7 @@ EOF: 1, while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); break; diff --git a/dist/lex-parser-umd-es5.js b/dist/lex-parser-umd-es5.js index 5a60721..8a1d26d 100644 --- a/dist/lex-parser-umd-es5.js +++ b/dist/lex-parser-umd-es5.js @@ -2,32 +2,39 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; -var _templateObject = _taggedTemplateLiteral(['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject2 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject3 = _taggedTemplateLiteral(['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject4 = _taggedTemplateLiteral(['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject5 = _taggedTemplateLiteral(['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject6 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject7 = _taggedTemplateLiteral(['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject8 = _taggedTemplateLiteral(['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), - _templateObject9 = _taggedTemplateLiteral(['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), - _templateObject10 = _taggedTemplateLiteral(['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n '], ['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n ']), - _templateObject11 = _taggedTemplateLiteral(['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject12 = _taggedTemplateLiteral(['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject13 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject14 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject15 = _taggedTemplateLiteral(['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject16 = _taggedTemplateLiteral(['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject17 = _taggedTemplateLiteral(['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject18 = _taggedTemplateLiteral(['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), - _templateObject19 = _taggedTemplateLiteral(['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%\\}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), - _templateObject20 = _taggedTemplateLiteral(['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%\\}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), - _templateObject21 = _taggedTemplateLiteral(['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n ']), - _templateObject22 = _taggedTemplateLiteral(['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n '], ['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n ']), - _templateObject23 = _taggedTemplateLiteral(['\n unterminated string constant in %options entry.\n\n Erroneous area:\n '], ['\n unterminated string constant in %options entry.\n\n Erroneous area:\n ']), - _templateObject24 = _taggedTemplateLiteral(['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n '], ['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n ']), - _templateObject25 = _taggedTemplateLiteral(['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n '], ['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n ']), - _templateObject26 = _taggedTemplateLiteral(['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n ']); +var _templateObject = _taggedTemplateLiteral(['\n There\'s an error in your lexer regex rules or epilogue.\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional epilogue!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n There\'s an error in your lexer regex rules or epilogue.\n Maybe you did not correctly separate the lexer sections with a \'%%\'\n on an otherwise empty line?\n The lexer spec file should have this structure:\n \n definitions\n %%\n rules\n %% // <-- optional!\n extra_module_code // <-- optional epilogue!\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject2 = _taggedTemplateLiteral(['\n There\'s probably an error in one or more of your lexer regex rules.\n The lexer rule spec should have this structure:\n \n regex action_code\n \n where \'regex\' is a lex-style regex expression (see the\n jison and jison-lex documentation) which is intended to match a chunk\n of the input to lex, while the \'action_code\' block is the JS code\n which will be invoked when the regex is matched. The \'action_code\' block\n may be any (indented!) set of JS statements, optionally surrounded \n by \'{...}\' curly braces or otherwise enclosed in a \'%{...%}\' block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n There\'s probably an error in one or more of your lexer regex rules.\n The lexer rule spec should have this structure:\n \n regex action_code\n \n where \'regex\' is a lex-style regex expression (see the\n jison and jison-lex documentation) which is intended to match a chunk\n of the input to lex, while the \'action_code\' block is the JS code\n which will be invoked when the regex is matched. The \'action_code\' block\n may be any (indented!) set of JS statements, optionally surrounded \n by \'{...}\' curly braces or otherwise enclosed in a \'%{...%}\' block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject3 = _taggedTemplateLiteral(['\n There\'s an error in your lexer epilogue a.k.a. \'extra_module_code\' block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n There\'s an error in your lexer epilogue a.k.a. \'extra_module_code\' block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject4 = _taggedTemplateLiteral(['\n The \'%{...%}\' lexer setup action code section does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The \'%{...%}\' lexer setup action code section does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject5 = _taggedTemplateLiteral(['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n You did not specify a legal file path for the \'%import\' initialization code statement, which must have the format:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject6 = _taggedTemplateLiteral(['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %import name or source filename missing maybe?\n \n Note: each \'%import\'-ed initialization code section must be qualified by a name, e.g. \'required\' before the import path itself:\n %import qualifier_name file_path\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject7 = _taggedTemplateLiteral(['\n The \'%code ', '\' action code section does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The \'%code ', '\' action code section does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject8 = _taggedTemplateLiteral(['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Each \'%code\' initialization code section must be qualified by a name, e.g. \'required\' before the action code itself:\n %code qualifier_name {action code}\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject9 = _taggedTemplateLiteral(['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you made a mistake while specifying one of the lexer rules inside\n the start condition\n <', '> { rules... }\n block.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject10 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lexer rules set inside\n the start condition\n <', '> { rules... }\n as a terminating curly brace \'}\' could not be found.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject11 = _taggedTemplateLiteral(['\n The rule\'s action code section does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The rule\'s action code section does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject12 = _taggedTemplateLiteral(['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Lexer rule regex action code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject13 = _taggedTemplateLiteral(['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), + _templateObject14 = _taggedTemplateLiteral(['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n '], ['\n Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: \'{ ... }\'.\n \n Offending action body:\n ', '\n ']), + _templateObject15 = _taggedTemplateLiteral(['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n '], ['\n You may place the \'%include\' instruction only at the start/front of a line.\n \n It\'s use is not permitted at this position:\n ', '\n ']), + _templateObject16 = _taggedTemplateLiteral(['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly match curly braces \'{ ... }\' in a lexer rule action block.\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject17 = _taggedTemplateLiteral(['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly terminate the start condition set <', ',???> with a terminating \'>\'\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject18 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex part in \'(...)\' braces.\n \n Unterminated regex part:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject19 = _taggedTemplateLiteral(['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Seems you did not correctly bracket a lex rule regex set in \'[...]\' brackets.\n \n Unterminated regex set:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject20 = _taggedTemplateLiteral(['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Internal error: option "', '" value assignment failure.\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject21 = _taggedTemplateLiteral(['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Expected a valid option name (with optional value assignment).\n \n Erroneous area:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject22 = _taggedTemplateLiteral(['\n The extra lexer module code section (a.k.a. \'epilogue\') does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The extra lexer module code section (a.k.a. \'epilogue\') does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject23 = _taggedTemplateLiteral(['\n The source code %include-d into the extra lexer module code section (a.k.a. \'epilogue\') does not compile: ', '\n \n Erroneous area:\n ', '\n '], ['\n The source code %include-d into the extra lexer module code section (a.k.a. \'epilogue\') does not compile: ', '\n \n Erroneous area:\n ', '\n ']), + _templateObject24 = _taggedTemplateLiteral(['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n '], ['\n %include MUST be followed by a valid file path.\n \n Erroneous path:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject25 = _taggedTemplateLiteral(['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n '], ['\n Module code declaration error?\n \n Erroneous code:\n ', '\n \n Technical error report:\n ', '\n ']), + _templateObject26 = _taggedTemplateLiteral(['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n too many closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), + _templateObject27 = _taggedTemplateLiteral(['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n '], ['\n missing ', ' closing curly braces in lexer rule action block.\n\n Note: the action code chunk may be too complex for jison to parse\n easily; we suggest you wrap the action code chunk in \'%{...%}\'\n to help jison grok more or less complex action code chunks.\n\n Erroneous area:\n ']), + _templateObject28 = _taggedTemplateLiteral(['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n LEX: ignoring unsupported lexer option ', '\n while lexing in ', ' state.\n\n Erroneous area:\n ']), + _templateObject29 = _taggedTemplateLiteral(['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n '], ['\n unterminated string constant in lexer rule action block.\n\n Erroneous area:\n ']), + _templateObject30 = _taggedTemplateLiteral(['\n unterminated string constant in %options entry.\n\n Erroneous area:\n '], ['\n unterminated string constant in %options entry.\n\n Erroneous area:\n ']), + _templateObject31 = _taggedTemplateLiteral(['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n '], ['\n unterminated string constant encountered while lexing\n ', '.\n\n Erroneous area:\n ']), + _templateObject32 = _taggedTemplateLiteral(['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n '], ['\n unsupported lexer input encountered while lexing\n ', ' (i.e. jison lex regexes).\n\n NOTE: When you want this input to be interpreted as a LITERAL part\n of a lex rule regex, you MUST enclose it in double or\n single quotes.\n\n If not, then know that this input is not accepted as a valid\n regex expression here in jison-lex ', '.\n\n Erroneous area:\n ']), + _templateObject33 = _taggedTemplateLiteral(['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n '], ['\n unsupported lexer input: ', ' \n while lexing in ', ' state.\n\n Erroneous area:\n ']); function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); } @@ -43,7 +50,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // hack: var assert; - /* parser generated by jison 0.6.1-204 */ + /* parser generated by jison 0.6.1-205 */ /* * Returns a Parser object of the following structure: @@ -876,8 +883,8 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi return tokenset; }, productions_: bp({ - pop: u([54, 54, s, [55, 3], 56, 57, 57, s, [58, 11], 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, s, [65, 4], 66, 66, 67, 67, s, [68, 3], s, [69, 9], s, [70, 4], 71, 71, 72, s, [73, 4], s, [74, 4], 75, 75, s, [76, 17], 77, 78, 78, 79, 79, 80, s, [80, 4, 1], 83, 84, 85, 85, s, [86, 6], 87, 87, 88, 88, s, [89, 3], 90, 90]), - rule: u([s, [4, 3], 2, 0, 0, 2, 0, s, [2, 3], s, [1, 3], 3, 3, 2, 3, 3, s, [1, 7], 2, 1, 2, c, [23, 3], 4, 4, 3, c, [29, 4], s, [3, 3], s, [2, 8], 0, s, [3, 3], 0, 1, 3, 1, s, [3, 4, -1], c, [21, 3], c, [40, 3], s, [3, 4], s, [2, 5], c, [12, 3], s, [1, 6], c, [16, 3], c, [10, 8], c, [9, 3], s, [3, 4], c, [10, 4], c, [32, 5], 0]) + pop: u([54, 54, s, [55, 6], 56, 57, 57, s, [58, 11], 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 64, s, [65, 4], 66, 66, 67, 67, s, [68, 3], s, [69, 9], s, [70, 4], 71, 71, 72, s, [73, 4], s, [74, 4], 75, 75, s, [76, 17], 77, 78, 78, 79, 79, 80, s, [80, 4, 1], 83, 84, 85, 85, s, [86, 6], 87, 87, 88, 88, s, [89, 3], 90, 90]), + rule: u([s, [4, 3], s, [5, 4, -1], 0, 0, 2, 0, s, [2, 3], s, [1, 3], 3, 3, 2, 3, 3, s, [1, 7], 2, 1, 2, c, [23, 3], 4, c, [32, 4], 2, c, [22, 3], 3, s, [2, 8], 0, s, [3, 3], 0, 1, 3, 1, s, [3, 4, -1], c, [21, 3], c, [40, 3], s, [3, 4], s, [2, 5], c, [12, 3], s, [1, 6], c, [16, 3], c, [10, 8], c, [9, 3], s, [3, 4], c, [10, 4], c, [82, 4], 1, 0]) }), performAction: function parser__PerformAction(yyloc, yystate /* action[1] */, yysp, yyvstack, yylstack) { @@ -940,7 +947,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject, yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); + yyparser.yyError(rmCommonWS(_templateObject, yylexer.prettyPrintRange(yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); break; case 3: @@ -951,7 +958,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + if (yyvstack[yysp].trim() !== '') { this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; } else { this.$ = { rules: yyvstack[yysp - 2] }; @@ -959,6 +966,42 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi break; case 4: + /*! Production:: rules_and_epilogue : "%%" error rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 4]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 4, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject2, yylexer.prettyPrintRange(yylstack[yysp - 3]), yyvstack[yysp - 3].errStr)); + break; + + case 5: + /*! Production:: rules_and_epilogue : "%%" rules "%%" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject3, yylexer.prettyPrintRange(yylstack[yysp]), yyvstack[yysp].errStr)); + break; + + case 6: + /*! Production:: rules_and_epilogue : "%%" error rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS(_templateObject2, yylexer.prettyPrintRange(yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); + break; + + case 7: /*! Production:: rules_and_epilogue : "%%" rules */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -969,7 +1012,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = { rules: yyvstack[yysp] }; break; - case 5: + case 8: /*! Production:: rules_and_epilogue : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -980,7 +1023,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = { rules: [] }; break; - case 6: + case 9: /*! Production:: init : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -993,7 +1036,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi if (!yy.options) yy.options = {}; break; - case 7: + case 10: /*! Production:: definitions : definitions definition */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1015,7 +1058,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi } break; - case 8: + case 11: /*! Production:: definitions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1030,10 +1073,8 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; break; - case 9: - /*! Production:: definition : NAME regex */ - case 38: - /*! Production:: rule : regex action */ + case 12: + /*! Production:: definition : NAME regex */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); @@ -1043,9 +1084,9 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; - case 10: + case 13: /*! Production:: definition : START_INC names_inclusive */ - case 11: + case 14: /*! Production:: definition : START_EXC names_exclusive */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1056,7 +1097,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp]; break; - case 12: + case 15: /*! Production:: definition : action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1064,12 +1105,17 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - yy.actionInclude.push(yyvstack[yysp]);this.$ = null; + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject4, rv, yylexer.prettyPrintRange(yylstack[yysp]))); + } + yy.actionInclude.push(yyvstack[yysp]); + this.$ = null; break; - case 13: + case 16: /*! Production:: definition : options */ - case 99: + case 102: /*! Production:: option_list : option */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1080,7 +1126,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = null; break; - case 14: + case 17: /*! Production:: definition : UNKNOWN_DECL */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1091,7 +1137,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = { type: 'unknown', body: yyvstack[yysp] }; break; - case 15: + case 18: /*! Production:: definition : IMPORT import_name import_path */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1102,7 +1148,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = { type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp] }; break; - case 16: + case 19: /*! Production:: definition : IMPORT import_name error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1111,10 +1157,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject2, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject5, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 17: + case 20: /*! Production:: definition : IMPORT error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1123,10 +1169,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject3, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject6, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); break; - case 18: + case 21: /*! Production:: definition : INIT_CODE init_code_name action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1134,6 +1180,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject7, $init_code_name, rv, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]))); + } this.$ = { type: 'codesection', qualifier: yyvstack[yysp - 1], @@ -1141,7 +1191,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi }; break; - case 19: + case 22: /*! Production:: definition : INIT_CODE error action */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1150,36 +1200,34 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject4, yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp]), yyvstack[yysp - 1].errStr)); + yyparser.yyError(rmCommonWS(_templateObject8, yylexer.prettyPrintRange(yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp]), yyvstack[yysp - 1].errStr)); break; - case 20: + case 23: /*! Production:: init_code_name : NAME */ - case 21: + case 24: /*! Production:: init_code_name : STRING_LIT */ - case 22: + case 25: /*! Production:: import_name : NAME */ - case 23: + case 26: /*! Production:: import_name : STRING_LIT */ - case 24: + case 27: /*! Production:: import_path : NAME */ - case 25: + case 28: /*! Production:: import_path : STRING_LIT */ - case 61: + case 64: /*! Production:: regex_list : regex_concat */ - case 66: + case 69: /*! Production:: nonempty_regex_list : regex_concat */ - case 68: + case 71: /*! Production:: regex_concat : regex_base */ - case 93: + case 96: /*! Production:: escape_char : ESCAPE_CHAR */ - case 94: + case 97: /*! Production:: range_regex : RANGE_REGEX */ - case 106: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ - case 110: - /*! Production:: module_code_chunk : CODE */ case 113: + /*! Production:: module_code_chunk : CODE */ + case 116: /*! Production:: optional_module_code_chunk : module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1190,7 +1238,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp]; break; - case 26: + case 29: /*! Production:: names_inclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1201,7 +1249,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = { type: 'names', names: {} };this.$.names[yyvstack[yysp]] = 0; break; - case 27: + case 30: /*! Production:: names_inclusive : names_inclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1212,7 +1260,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1];this.$.names[yyvstack[yysp]] = 0; break; - case 28: + case 31: /*! Production:: names_exclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1223,7 +1271,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = { type: 'names', names: {} };this.$.names[yyvstack[yysp]] = 1; break; - case 29: + case 32: /*! Production:: names_exclusive : names_exclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1234,7 +1282,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1];this.$.names[yyvstack[yysp]] = 1; break; - case 30: + case 33: /*! Production:: rules : rules rules_collective */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1245,9 +1293,9 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; - case 31: + case 34: /*! Production:: rules : %epsilon */ - case 37: + case 40: /*! Production:: rule_block : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1258,7 +1306,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = []; break; - case 32: + case 35: /*! Production:: rules_collective : start_conditions rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1272,7 +1320,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = [yyvstack[yysp]]; break; - case 33: + case 36: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1288,7 +1336,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1]; break; - case 34: + case 37: /*! Production:: rules_collective : start_conditions "{" error "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1297,10 +1345,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject5, yyvstack[yysp - 3].join(','), yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo(yysp - 3, yysp), yylstack[yysp - 3]), yyvstack[yysp - 1].errStr)); + yyparser.yyError(rmCommonWS(_templateObject9, yyvstack[yysp - 3].join(','), yylexer.prettyPrintRange(yylexer.mergeLocationInfo(yysp - 3, yysp), yylstack[yysp - 3]), yyvstack[yysp - 1].errStr)); break; - case 35: + case 38: /*! Production:: rules_collective : start_conditions "{" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1309,10 +1357,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject6, yyvstack[yysp - 2].join(','), yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject10, yyvstack[yysp - 2].join(','), yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 36: + case 39: /*! Production:: rule_block : rule_block rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1323,7 +1371,22 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1];this.$.push(yyvstack[yysp]); break; - case 39: + case 41: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject11, rv, yylexer.prettyPrintRange(yylstack[yysp]))); + } + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + + case 42: /*! Production:: rule : regex error */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1332,10 +1395,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; - yyparser.yyError(rmCommonWS(_templateObject7, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject12, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); break; - case 40: + case 43: /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1344,10 +1407,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject8, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]))); + yyparser.yyError(rmCommonWS(_templateObject13, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]))); break; - case 41: + case 44: /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1356,10 +1419,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject9, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]))); + yyparser.yyError(rmCommonWS(_templateObject14, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]))); break; - case 42: + case 45: /*! Production:: action : ACTION_START action_body ACTION_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1385,9 +1448,9 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi } break; - case 43: + case 46: /*! Production:: action_body : action_body ACTION */ - case 48: + case 51: /*! Production:: action_body : action_body include_macro_code */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1398,21 +1461,21 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; break; - case 44: + case 47: /*! Production:: action_body : action_body ACTION_BODY */ - case 45: + case 48: /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ - case 46: + case 49: /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ - case 47: + case 50: /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ - case 67: + case 70: /*! Production:: regex_concat : regex_concat regex_base */ - case 79: + case 82: /*! Production:: regex_base : regex_base range_regex */ - case 89: + case 92: /*! Production:: regex_set : regex_set regex_set_atom */ - case 111: + case 114: /*! Production:: module_code_chunk : module_code_chunk CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1423,7 +1486,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; - case 49: + case 52: /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1432,10 +1495,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject10, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]))); + yyparser.yyError(rmCommonWS(_templateObject15, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]))); break; - case 50: + case 53: /*! Production:: action_body : action_body error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1444,14 +1507,14 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject11, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject16, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); break; - case 51: + case 54: /*! Production:: action_body : %epsilon */ - case 62: + case 65: /*! Production:: regex_list : %epsilon */ - case 114: + case 117: /*! Production:: optional_module_code_chunk : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1462,7 +1525,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = ''; break; - case 52: + case 55: /*! Production:: start_conditions : "<" name_list ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1473,7 +1536,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1]; break; - case 53: + case 56: /*! Production:: start_conditions : "<" name_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1482,10 +1545,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject12, yyvstack[yysp - 1].join(','), yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject17, yyvstack[yysp - 1].join(','), yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 54: + case 57: /*! Production:: start_conditions : "<" "*" ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1496,7 +1559,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = ['*']; break; - case 55: + case 58: /*! Production:: start_conditions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1505,7 +1568,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; - case 56: + case 59: /*! Production:: name_list : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1516,7 +1579,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = [yyvstack[yysp]]; break; - case 57: + case 60: /*! Production:: name_list : name_list "," NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1527,7 +1590,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 2];this.$.push(yyvstack[yysp]); break; - case 58: + case 61: /*! Production:: regex : nonempty_regex_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1593,9 +1656,9 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi } break; - case 59: + case 62: /*! Production:: regex_list : regex_list "|" regex_concat */ - case 63: + case 66: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1606,9 +1669,9 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; - case 60: + case 63: /*! Production:: regex_list : regex_list "|" */ - case 64: + case 67: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1619,7 +1682,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1] + '|'; break; - case 65: + case 68: /*! Production:: nonempty_regex_list : "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1630,7 +1693,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = '|' + yyvstack[yysp]; break; - case 69: + case 72: /*! Production:: regex_base : "(" regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1641,7 +1704,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = '(' + yyvstack[yysp - 1] + ')'; break; - case 70: + case 73: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1652,9 +1715,9 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; - case 71: + case 74: /*! Production:: regex_base : "(" regex_list error */ - case 72: + case 75: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1663,10 +1726,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject13, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject18, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 73: + case 76: /*! Production:: regex_base : regex_base "+" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1677,7 +1740,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1] + '+'; break; - case 74: + case 77: /*! Production:: regex_base : regex_base "*" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1688,7 +1751,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1] + '*'; break; - case 75: + case 78: /*! Production:: regex_base : regex_base "?" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1699,7 +1762,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 1] + '?'; break; - case 76: + case 79: /*! Production:: regex_base : "/" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1710,7 +1773,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = '(?=' + yyvstack[yysp] + ')'; break; - case 77: + case 80: /*! Production:: regex_base : "/!" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1721,21 +1784,21 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = '(?!' + yyvstack[yysp] + ')'; break; - case 78: + case 81: /*! Production:: regex_base : name_expansion */ - case 80: + case 83: /*! Production:: regex_base : any_group_regex */ - case 84: + case 87: /*! Production:: regex_base : string */ - case 85: + case 88: /*! Production:: regex_base : escape_char */ - case 86: + case 89: /*! Production:: name_expansion : NAME_BRACE */ - case 90: + case 93: /*! Production:: regex_set : regex_set_atom */ - case 91: + case 94: /*! Production:: regex_set_atom : REGEX_SET */ - case 96: + case 99: /*! Production:: string : CHARACTER_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1744,7 +1807,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; - case 81: + case 84: /*! Production:: regex_base : "." */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1755,7 +1818,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = '.'; break; - case 82: + case 85: /*! Production:: regex_base : "^" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1766,7 +1829,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = '^'; break; - case 83: + case 86: /*! Production:: regex_base : "$" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1777,10 +1840,8 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = '$'; break; - case 87: - /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ - case 107: - /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + case 90: + /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); @@ -1790,7 +1851,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; - case 88: + case 91: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1799,10 +1860,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject14, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject19, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 92: + case 95: /*! Production:: regex_set_atom : name_expansion */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1819,7 +1880,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; - case 95: + case 98: /*! Production:: string : STRING_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1830,7 +1891,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = prepareString(yyvstack[yysp]); break; - case 97: + case 100: /*! Production:: options : OPTIONS option_list OPTIONS_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1841,7 +1902,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = null; break; - case 98: + case 101: /*! Production:: option_list : option option_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1852,7 +1913,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = null; break; - case 100: + case 103: /*! Production:: option : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1864,7 +1925,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi yy.options[yyvstack[yysp]] = true; break; - case 101: + case 104: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1876,9 +1937,9 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; - case 102: + case 105: /*! Production:: option : NAME "=" OPTION_VALUE */ - case 103: + case 106: /*! Production:: option : NAME "=" NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1890,7 +1951,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; - case 104: + case 107: /*! Production:: option : NAME "=" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1900,10 +1961,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // TODO ... - yyparser.yyError(rmCommonWS(_templateObject15, $option, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject20, $option, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2]), yyvstack[yysp].errStr)); break; - case 105: + case 108: /*! Production:: option : error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1913,10 +1974,48 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // TODO ... - yyparser.yyError(rmCommonWS(_templateObject16, yylexer.prettyPrintRange(yylexer, yylstack[yysp]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject21, yylexer.prettyPrintRange(yylstack[yysp]), yyvstack[yysp].errStr)); break; - case 108: + case 109: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject22, rv, yylexer.prettyPrintRange(yylstack[yysp]))); + } + this.$ = yyvstack[yysp]; + break; + + case 110: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Each of the 3 chunks should be parse-able as a JS snippet on its own. + // + // Note: we have already checked the first section in a previous reduction + // of this rule, so we don't need to check that one again! + var rv = checkActionBlock(yyvstack[yysp - 1], yylstack[yysp - 1]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject23, rv, yylexer.prettyPrintRange(yylstack[yysp - 1]))); + } + rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS(_templateObject22, rv, yylexer.prettyPrintRange(yylstack[yysp]))); + } + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + + case 111: /*! Production:: include_macro_code : INCLUDE PATH */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1929,7 +2028,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; - case 109: + case 112: /*! Production:: include_macro_code : INCLUDE error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1938,23 +2037,23 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) - yyparser.yyError(rmCommonWS(_templateObject17, yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject24, yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1]), yyvstack[yysp].errStr)); break; - case 112: - /*! Production:: module_code_chunk : error */ + case 115: + /*! Production:: module_code_chunk : error CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): - this.$ = yyvstack[yysp]; - this._$ = yylstack[yysp]; + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) // TODO ... - yyparser.yyError(rmCommonWS(_templateObject18, yylexer.prettyPrintRange(yylexer, yylstack[yysp]), yyvstack[yysp].errStr)); + yyparser.yyError(rmCommonWS(_templateObject25, yylexer.prettyPrintRange(yylstack[yysp - 1]), yyvstack[yysp - 1].errStr)); break; - case 145: + case 151: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} @@ -1966,16 +2065,16 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi } }, table: bt({ - len: u([13, 1, 12, 15, 1, 1, 11, 18, 21, 2, 2, s, [11, 3], 4, 4, 12, 4, 1, 1, 19, 11, 12, 18, 29, 30, 22, 22, 17, 17, s, [29, 7], 31, 5, s, [29, 3], s, [12, 4], 4, 11, 3, 3, 2, 2, 1, 1, 12, 1, 5, 4, 3, 7, 17, 23, 3, 30, 29, 30, s, [29, 5], 3, 20, 3, 30, 30, 6, s, [4, 3], 12, 12, s, [11, 6], s, [27, 3], s, [11, 8], 2, 11, 1, 4, 3, 2, s, [3, 3], 17, 16, 3, 3, 1, 3, s, [29, 3], 21, s, [29, 4], 4, 13, 13, s, [3, 4], 6, 3, 23, s, [18, 3], 14, 14, 1, 14, 20, 2, 17, 14, 17, 3]), - symbol: u([1, 2, s, [19, 7, 1], 28, 47, 54, 56, 1, c, [14, 11], 57, c, [12, 11], 55, 58, 68, 84, s, [1, 3], c, [17, 10], 1, 3, 5, 9, 10, s, [14, 4, 1], 19, 26, s, [38, 4, 1], 44, 46, 64, c, [15, 6], c, [14, 7], 72, s, [74, 5, 1], 81, 83, 27, 62, 27, 63, c, [54, 12], c, [11, 21], 2, 20, 26, 60, c, [4, 3], 59, 2, s, [29, 9, 1], 51, 69, 2, 20, 85, 86, s, [1, 3], c, [102, 16], 65, 70, c, [67, 13], 9, c, [12, 9], c, [125, 12], c, [123, 6], c, [30, 3], c, [59, 6], s, [20, 7, 1], 28, c, [29, 6], 47, c, [29, 7], 7, s, [9, 9, 1], c, [33, 14], 45, 46, 47, 82, c, [58, 3], 11, c, [80, 11], 73, c, [81, 6], c, [22, 22], c, [121, 12], c, [17, 22], c, [108, 29], c, [29, 199], s, [42, 6, 1], 40, 43, 77, 79, 80, c, [123, 89], c, [19, 7], 27, c, [572, 11], c, [12, 27], c, [593, 3], 61, c, [612, 14], c, [3, 3], 28, 68, 28, 68, 28, 28, c, [616, 11], 88, 48, 2, 20, 48, 85, 86, 2, 18, 20, c, [9, 4], 1, 2, 51, 53, 87, 89, 90, c, [630, 17], 3, c, [732, 13], 67, c, [733, 8], 7, 20, 71, c, [613, 24], c, [643, 65], c, [507, 145], 2, 9, 11, c, [769, 15], c, [789, 7], 11, c, [201, 59], 82, 2, 40, 42, 43, 77, 80, c, [6, 4], c, [4, 8], c, [476, 33], c, [11, 59], 3, 4, c, [473, 8], c, [401, 15], c, [27, 54], c, [584, 11], c, [11, 78], 52, c, [182, 11], c, [664, 3], 49, 50, 1, 51, 88, 1, 51, 1, 51, 53, c, [3, 7], c, [672, 16], 2, 4, c, [673, 13], 66, 2, 28, 68, 2, 6, 8, 6, c, [4, 3], c, [642, 58], c, [525, 31], c, [522, 13], c, [750, 8], c, [662, 115], c, [562, 5], c, [315, 10], 53, c, [13, 13], c, [979, 3], c, [3, 9], c, [988, 4], c, [987, 3], 51, 53, c, [300, 14], c, [973, 9], 1, c, [487, 10], c, [27, 7], c, [18, 36], c, [1050, 14], c, [14, 14], 20, c, [15, 14], c, [830, 20], c, [469, 3], c, [460, 16], c, [159, 14], c, [491, 18], 6, 8]), - type: u([s, [2, 11], 0, 0, 1, c, [14, 12], c, [26, 13], 0, c, [15, 12], s, [2, 19], c, [31, 14], s, [0, 8], c, [23, 3], c, [56, 31], c, [62, 10], c, [112, 13], c, [67, 4], c, [40, 20], c, [78, 36], c, [123, 7], c, [30, 28], c, [203, 43], c, [205, 9], c, [22, 34], c, [17, 34], s, [2, 224], c, [239, 141], c, [139, 19], c, [655, 16], c, [14, 5], c, [180, 13], c, [194, 34], s, [0, 9], c, [98, 21], c, [643, 86], c, [492, 151], c, [494, 34], c, [231, 35], c, [802, 238], c, [716, 74], c, [44, 28], c, [708, 37], c, [522, 78], c, [454, 163], c, [164, 19], c, [973, 11], c, [830, 147], s, [2, 21]]), - state: u([s, [1, 4, 1], 6, 11, 12, 20, 21, 22, 24, 25, 30, 31, 36, 35, 42, 44, 46, 50, 54, 55, 56, 60, 61, 64, c, [15, 5], 65, c, [5, 4], 69, 71, 72, c, [13, 5], 73, c, [7, 6], 74, c, [5, 4], 75, c, [5, 4], 79, 76, 77, 82, 86, 87, 96, 101, 56, 103, 105, 104, 108, 110, c, [66, 7], 111, 114, c, [58, 11], c, [6, 6], 69, 79, 122, 129, 131, 133, c, [12, 5], 139, c, [29, 5], 105, 140, 142, c, [47, 8], c, [22, 5]]), - mode: u([s, [2, 23], s, [1, 12], s, [2, 28], s, [1, 15], s, [2, 33], c, [39, 17], c, [13, 6], c, [18, 7], c, [64, 21], c, [21, 10], c, [106, 15], c, [75, 12], 1, c, [90, 10], c, [27, 6], c, [72, 23], c, [40, 8], c, [45, 7], c, [15, 13], s, [1, 24], s, [2, 234], c, [236, 98], c, [97, 24], c, [24, 15], c, [374, 20], c, [432, 5], c, [409, 15], c, [568, 9], c, [47, 20], c, [454, 17], c, [561, 23], c, [585, 53], c, [442, 145], c, [718, 19], c, [780, 33], c, [29, 25], c, [759, 238], c, [796, 51], c, [289, 5], c, [1211, 12], c, [722, 35], c, [340, 9], c, [648, 24], c, [854, 59], c, [1199, 170], c, [311, 6], c, [969, 23], c, [1128, 90], c, [291, 66]]), - goto: u([s, [6, 11], s, [8, 11], 5, 5, s, [7, 4, 1], s, [13, 7, 1], s, [7, 11], s, [31, 17], 23, 26, 28, 32, 33, 34, 39, 27, 29, 37, 38, 41, 40, 43, 45, s, [12, 11], s, [13, 11], s, [14, 11], 47, 48, 49, 51, 52, 53, s, [51, 11], 58, 57, 1, 2, 4, 55, 62, s, [55, 6], 59, s, [55, 7], s, [9, 11], 58, 58, 63, s, [58, 9], c, [108, 12], s, [66, 3], c, [15, 5], s, [66, 7], 39, 66, c, [23, 7], 68, 68, 67, s, [68, 3], c, [7, 3], s, [68, 17], 70, 68, 68, 62, 62, 26, 62, c, [68, 11], c, [15, 15], c, [95, 12], c, [12, 12], s, [78, 29], s, [80, 29], s, [81, 29], s, [82, 29], s, [83, 29], s, [84, 29], s, [85, 29], s, [86, 31], 37, 78, s, [95, 29], s, [96, 29], s, [93, 29], s, [10, 9], 80, 10, 10, s, [26, 12], s, [11, 9], 81, 11, 11, s, [28, 12], 83, 84, 85, s, [17, 11], s, [22, 3], s, [23, 3], 16, 16, 20, 21, 98, s, [88, 8, 1], 97, 99, 100, 58, 57, 99, 100, 102, 100, 100, s, [105, 3], 114, 107, 114, 106, s, [30, 17], 109, c, [667, 13], 112, 113, s, [64, 3], c, [17, 5], s, [64, 7], 39, 64, c, [25, 6], 64, s, [65, 3], c, [24, 5], s, [65, 7], 39, 65, c, [24, 6], 65, s, [67, 6], 66, 68, s, [67, 18], 70, 67, 67, s, [73, 29], s, [74, 29], s, [75, 29], s, [79, 29], s, [94, 29], 116, 117, 115, 61, 61, 26, 61, c, [242, 11], 119, 117, 118, 76, 76, 67, s, [76, 3], 66, 68, s, [76, 18], 70, 76, 76, 77, 77, 67, s, [77, 3], 66, 68, s, [77, 18], 70, 77, 77, 121, 37, 120, 78, s, [90, 4], s, [91, 4], s, [92, 4], s, [27, 12], s, [29, 12], s, [15, 11], s, [16, 11], s, [24, 11], s, [25, 11], s, [18, 11], s, [19, 11], s, [40, 27], s, [41, 27], s, [42, 27], s, [43, 11], s, [44, 11], s, [45, 11], s, [46, 11], s, [47, 11], s, [48, 11], s, [49, 11], s, [50, 11], 124, 123, s, [97, 11], 98, 128, 127, 125, 126, 3, 99, 106, 106, 113, 113, 130, s, [110, 3], s, [112, 3], s, [32, 17], 132, s, [37, 14], 134, 16, 136, 135, 137, 138, s, [56, 3], s, [63, 3], c, [624, 5], s, [63, 7], 39, 63, c, [431, 6], 63, s, [69, 29], s, [71, 29], 60, 60, 26, 60, c, [505, 11], s, [70, 29], s, [72, 29], s, [87, 29], s, [88, 29], s, [89, 4], s, [108, 13], s, [109, 13], s, [101, 3], s, [102, 3], s, [103, 3], s, [104, 3], c, [940, 4], s, [111, 3], 141, c, [926, 13], 35, 35, 143, s, [35, 15], s, [38, 18], s, [39, 18], s, [52, 14], s, [53, 14], 144, s, [54, 14], 59, 59, 26, 59, c, [112, 11], 107, 107, s, [33, 17], s, [36, 14], s, [34, 17], s, [57, 3]]) + len: u([13, 1, 12, 15, 1, 1, 11, 19, 21, 2, 2, s, [11, 3], 4, 4, 12, 4, 1, 1, 19, 18, 11, 12, 18, 29, 30, 22, 22, 17, 17, s, [29, 7], 31, 5, s, [29, 3], s, [12, 4], 4, 11, 3, 3, 2, 2, 1, 1, 12, 1, 5, 4, 3, 7, 17, 23, 3, 19, 30, 29, 30, s, [29, 5], 3, 20, 3, 30, 30, 6, s, [4, 3], 12, 12, s, [11, 6], s, [27, 3], s, [11, 8], 2, 11, 1, 4, c, [55, 3], 3, 3, 17, 16, 3, 3, 1, 3, 7, s, [29, 3], 21, s, [29, 4], 4, 13, 13, s, [3, 4], 6, 3, 3, 23, s, [18, 3], 14, 14, 1, 14, 3, 1, 20, 2, 17, 14, 17, 3]), + symbol: u([1, 2, s, [19, 7, 1], 28, 47, 54, 56, 1, c, [14, 11], 57, c, [12, 11], 55, 58, 68, 84, s, [1, 3], c, [17, 10], 1, 2, 3, 5, 9, 10, s, [14, 4, 1], 19, 26, s, [38, 4, 1], 44, 46, 64, c, [15, 6], c, [14, 7], 72, s, [74, 5, 1], 81, 83, 27, 62, 27, 63, c, [55, 13], c, [11, 20], 2, 20, 26, 60, c, [4, 3], 59, 2, s, [29, 9, 1], 51, 69, 2, 20, 85, 86, s, [1, 3], c, [102, 16], 65, 70, c, [19, 17], 64, c, [85, 13], 9, c, [12, 9], c, [143, 12], c, [141, 6], c, [30, 3], c, [58, 6], s, [20, 7, 1], 28, c, [29, 6], 47, c, [29, 7], 7, s, [9, 9, 1], c, [33, 14], 45, 46, 47, 82, c, [58, 3], 11, c, [80, 11], 73, c, [81, 6], c, [22, 22], c, [121, 12], c, [17, 22], c, [108, 29], c, [29, 199], s, [42, 6, 1], 40, 43, 77, 79, 80, c, [123, 89], c, [19, 7], 27, c, [590, 11], c, [12, 27], c, [611, 3], 61, c, [630, 14], c, [3, 3], 28, 68, 28, 68, 28, 28, c, [634, 11], 88, 48, 2, 20, 48, 85, 86, 2, 18, 20, c, [9, 4], 1, 2, 51, 53, 87, 89, 90, c, [629, 17], 3, c, [750, 13], 67, c, [751, 8], 7, 20, 71, c, [691, 20], c, [632, 23], c, [662, 65], c, [526, 145], 2, 9, 11, c, [788, 15], c, [808, 7], 11, c, [201, 59], 82, 2, 40, 42, 43, 77, 80, c, [6, 4], c, [4, 8], c, [495, 33], c, [11, 59], 3, 4, c, [449, 8], c, [401, 15], c, [27, 54], c, [603, 11], c, [11, 78], 52, c, [182, 11], c, [683, 3], 49, 50, 1, 51, 88, 1, 53, 1, 51, 1, 51, c, [5, 3], 53, c, [647, 17], 2, 4, c, [691, 13], 66, 2, 28, 68, 2, 6, 8, 6, c, [4, 3], c, [740, 8], c, [648, 57], c, [531, 31], c, [528, 13], c, [756, 8], c, [668, 115], c, [568, 5], c, [321, 10], 53, c, [13, 13], c, [1004, 3], c, [3, 9], c, [273, 4], c, [272, 3], c, [328, 5], c, [310, 14], c, [1001, 9], 1, c, [496, 10], c, [27, 7], c, [18, 36], c, [1078, 14], c, [14, 14], 20, c, [15, 14], c, [461, 3], 53, c, [843, 20], c, [480, 3], c, [474, 16], c, [163, 14], c, [505, 18], 6, 8]), + type: u([s, [2, 11], 0, 0, 1, c, [14, 12], c, [26, 13], 0, c, [15, 12], s, [2, 20], c, [32, 14], s, [0, 8], c, [23, 3], c, [57, 32], c, [62, 9], c, [113, 13], c, [67, 4], c, [40, 20], c, [21, 18], c, [96, 36], c, [141, 7], c, [30, 28], c, [221, 43], c, [223, 9], c, [22, 34], c, [17, 34], s, [2, 224], c, [239, 141], c, [139, 19], c, [673, 16], c, [14, 5], c, [180, 13], c, [764, 35], c, [751, 9], c, [98, 19], c, [632, 31], c, [662, 75], c, [511, 151], c, [513, 34], c, [231, 35], c, [821, 238], c, [735, 74], c, [43, 27], c, [740, 39], c, [1202, 78], c, [756, 30], c, [696, 140], c, [1001, 31], c, [461, 114], c, [121, 58]]), + state: u([s, [1, 4, 1], 6, 11, 12, 20, 22, 23, 25, 26, 31, 32, 37, 36, 43, 45, 47, 51, 55, 56, 57, 61, 62, 64, 66, c, [16, 5], 67, c, [5, 4], 71, 73, 74, c, [13, 5], 75, c, [7, 6], 76, c, [5, 4], 77, c, [5, 4], 81, 78, 79, 84, 88, 89, 98, 103, 57, 105, 108, 107, 110, 112, c, [67, 7], 113, 61, 62, 117, c, [60, 11], c, [6, 6], 71, 81, 125, 132, 135, 137, 143, 108, 107, c, [15, 5], 145, c, [32, 5], 108, 146, 148, c, [52, 8], 132, c, [23, 5]]), + mode: u([s, [2, 23], s, [1, 12], c, [24, 13], c, [41, 28], c, [44, 15], c, [89, 27], c, [17, 13], c, [88, 11], c, [64, 34], c, [38, 14], c, [123, 15], c, [92, 12], 1, c, [107, 10], c, [27, 6], c, [72, 23], c, [40, 8], c, [45, 7], c, [15, 13], s, [1, 24], s, [2, 234], c, [236, 98], c, [97, 24], c, [24, 15], c, [374, 20], c, [432, 5], c, [409, 15], c, [585, 9], c, [47, 20], c, [45, 25], c, [36, 14], c, [578, 18], c, [602, 53], c, [459, 145], c, [735, 19], c, [797, 33], c, [29, 25], c, [776, 238], c, [813, 51], c, [289, 5], c, [648, 7], c, [298, 21], c, [738, 18], c, [621, 8], c, [376, 7], c, [651, 22], c, [874, 59], c, [1219, 170], c, [960, 9], c, [947, 23], c, [1151, 89], c, [805, 17], s, [2, 53]]), + goto: u([s, [9, 11], s, [11, 11], 8, 5, s, [7, 4, 1], s, [13, 7, 1], s, [10, 11], 34, 21, s, [34, 16], 24, 27, 29, 33, 34, 35, 40, 28, 30, 38, 39, 42, 41, 44, 46, s, [15, 11], s, [16, 11], s, [17, 11], 48, 49, 50, 52, 53, s, [54, 12], 59, 58, 1, 2, 7, 58, 63, s, [58, 6], 60, s, [58, 7], s, [34, 17], s, [12, 11], 61, 61, 65, s, [61, 9], c, [125, 12], s, [69, 3], c, [15, 5], s, [69, 7], 40, 69, c, [23, 7], 71, 71, c, [3, 3], 71, 68, 70, s, [71, 18], 72, 71, 71, 65, 65, 27, 65, c, [68, 11], c, [15, 15], c, [95, 12], c, [12, 12], s, [81, 29], s, [83, 29], s, [84, 29], s, [85, 29], s, [86, 29], s, [87, 29], s, [88, 29], s, [89, 31], 38, 80, s, [98, 29], s, [99, 29], s, [96, 29], s, [13, 9], 82, 13, 13, s, [29, 12], s, [14, 9], 83, 14, 14, s, [31, 12], 85, 86, 87, s, [20, 11], s, [25, 3], s, [26, 3], 16, 16, 23, 24, 100, s, [90, 8, 1], 99, 101, 102, 59, 58, 102, 103, 104, 103, 103, s, [108, 3], 117, 106, 117, 109, s, [33, 17], 111, c, [684, 13], 114, 115, 6, c, [630, 8], 116, s, [58, 7], s, [67, 3], c, [34, 5], s, [67, 7], 40, 67, c, [42, 6], 67, s, [68, 3], c, [24, 5], s, [68, 7], 40, 68, c, [24, 6], 68, 70, 70, 69, s, [70, 3], c, [7, 3], s, [70, 17], 72, 70, 70, s, [76, 29], s, [77, 29], s, [78, 29], s, [82, 29], s, [97, 29], 119, 120, 118, 64, 64, 27, 64, c, [259, 11], 122, 120, 121, 79, 79, 69, s, [79, 3], 68, 70, s, [79, 18], 72, 79, 79, 80, 80, 69, s, [80, 3], 68, 70, s, [80, 18], 72, 80, 80, 124, 38, 123, 80, s, [93, 4], s, [94, 4], s, [95, 4], s, [30, 12], s, [32, 12], s, [18, 11], s, [19, 11], s, [27, 11], s, [28, 11], s, [21, 11], s, [22, 11], s, [43, 27], s, [44, 27], s, [45, 27], s, [46, 11], s, [47, 11], s, [48, 11], s, [49, 11], s, [50, 11], s, [51, 11], s, [52, 11], s, [53, 11], 127, 126, s, [100, 11], 101, 131, 130, 128, 129, 3, 101, 5, 133, 109, 109, 116, 116, 134, s, [113, 3], s, [35, 17], 136, s, [40, 14], 138, 16, 140, 139, 141, 142, s, [59, 3], 117, 144, 117, 109, s, [66, 3], c, [627, 5], s, [66, 7], 40, 66, c, [434, 6], 66, s, [72, 29], s, [74, 29], 63, 63, 27, 63, c, [508, 11], s, [73, 29], s, [75, 29], s, [90, 29], s, [91, 29], s, [92, 4], s, [111, 13], s, [112, 13], s, [104, 3], s, [105, 3], s, [106, 3], s, [107, 3], c, [259, 4], s, [115, 3], s, [114, 3], 147, c, [949, 13], 38, 38, 149, s, [38, 15], s, [41, 18], s, [42, 18], s, [55, 14], s, [56, 14], 150, s, [57, 14], 4, 101, 133, 62, 62, 27, 62, c, [115, 11], 110, 110, s, [36, 17], s, [39, 14], s, [37, 17], s, [60, 3]]) }), defaultActions: bda({ - idx: u([0, 2, 6, 7, 11, 12, 13, 16, 18, 19, 21, s, [30, 8, 1], 39, 40, s, [41, 4, 2], 48, 49, 52, 53, 58, 60, s, [66, 5, 1], s, [77, 22, 1], 100, 101, 104, 106, 107, 108, 113, 115, 116, s, [118, 11, 1], 130, s, [133, 4, 1], 138, s, [140, 5, 1]]), - goto: u([6, 8, 7, 31, 12, 13, 14, 51, 1, 2, 9, 78, s, [80, 7, 1], 95, 96, 93, 26, 28, 17, 22, 23, 20, 21, 105, 30, 73, 74, 75, 79, 94, 90, 91, 92, 27, 29, 15, 16, 24, 25, 18, 19, s, [40, 11, 1], 97, 98, 106, 110, 112, 32, 56, 69, 71, 70, 72, 87, 88, 89, 108, 109, s, [101, 4, 1], 111, 38, 39, 52, 53, 54, 107, 33, 36, 34, 57]) + idx: u([0, 2, 6, 11, 12, 13, 16, 18, 19, 21, 22, s, [31, 8, 1], 40, 41, s, [42, 4, 2], 49, 50, 53, 54, 59, 61, s, [68, 5, 1], s, [79, 22, 1], 102, 103, 107, 109, 110, 115, 118, 119, s, [121, 11, 1], 133, 134, s, [137, 4, 1], 142, s, [146, 5, 1]]), + goto: u([9, 11, 10, 15, 16, 17, 54, 1, 2, 34, 12, 81, s, [83, 7, 1], 98, 99, 96, 29, 31, 20, 25, 26, 23, 24, 108, 33, 76, 77, 78, 82, 97, 93, 94, 95, 30, 32, 18, 19, 27, 28, 21, 22, s, [43, 11, 1], 100, 101, 109, 113, 35, 59, 72, 74, 73, 75, 90, 91, 92, 111, 112, s, [104, 4, 1], 115, 114, 41, 42, 55, 56, 57, 110, 36, 39, 37, 60]) }), parseError: function parseError(str, hash, ExceptionClass) { if (hash.recoverable && typeof this.trace === 'function') { @@ -2007,7 +2106,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi var TERROR = this.TERROR; var EOF = this.EOF; var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = this.options.errorRecoveryTokenDiscardCount | 0 || 3; - var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + var NO_ACTION = [0, 151 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -3095,6 +3194,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi parser.originalQuoteName = parser.quoteName; var rmCommonWS = helpers.rmCommonWS; + var checkActionBlock = helpers.checkActionBlock; function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); @@ -3147,7 +3247,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; - /* lexer generated by jison-lex 0.6.1-204 */ + /* lexer generated by jison-lex 0.6.1-205 */ /* * Returns a Lexer object of the following structure: @@ -3503,7 +3603,37 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi * @public * @this {RegExpLexer} */ - constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) { + msg = '' + msg; + + // heuristic to determine if the error message already contains a (partial) source code dump + // as produced by either `showPosition()` or `prettyPrintRange()`: + if (show_input_position == undefined) { + show_input_position = !(msg.indexOf('\n') > 0 && msg.indexOf('^') > 0); + } + + if (this.yylloc && show_input_position) { + if (typeof this.prettyPrintRange === 'function') { + var pretty_src = this.prettyPrintRange(this.yylloc); + + if (!/\n\s*$/.test(msg)) { + msg += '\n'; + } + + msg += '\n Erroneous area:\n' + this.prettyPrintRange(this.yylloc); + } else if (typeof this.showPosition === 'function') { + var pos_str = this.showPosition(); + + if (pos_str) { + if (msg.length && msg[msg.length - 1] !== '\n' && pos_str[0] !== '\n') { + msg += '\n' + pos_str; + } else { + msg += pos_str; + } + } + } + } + /** @constructor */ var pei = { errStr: msg, @@ -3581,7 +3711,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi yyerror: function yyError(str /*, ...args */) { var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } @@ -3865,7 +3995,12 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi if (lines.length > 1) { this.yylineno -= lines.length - 1; this.yylloc.last_line = this.yylineno + 1; + + // Get last entirely matched line into the `pre_lines[]` array's + // last index slot; we don't mind when other previously + // matched lines end up in the array too. var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); if (pre_lines.length === 1) { @@ -3910,21 +4045,11 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi // `.lex()` run. var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - - var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, false); + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).', false); this._signaled_error_token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; } @@ -4116,32 +4241,20 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ': ' + line; var errpfx = new Array(lineno_display_width + 1).join('^'); + var offset = 2 + 1; + var len = 0; if (lno === loc.first_line) { - var offset = loc.first_column + 2; - - var len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); + offset += loc.first_column; - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } + len = Math.max(2, (lno === loc.last_line ? loc.last_column : line.length) - loc.first_column + 1); } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } + len = Math.max(2, loc.last_column + 1); } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); + len = Math.max(2, line.length + 1); + } + + if (len) { var lead = new Array(offset).join('.'); var mark = new Array(len).join('^'); rv += '\n' + errpfx + lead + mark; @@ -4160,15 +4273,6 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; - - console.log('clip off: ', { - start: clip_start, - end: clip_end, - len: clip_end - clip_start + 1, - arr: nonempty_line_indexes, - rv: rv - }); - var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); @@ -4380,17 +4484,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - - var p = this.constructLexErrorInfo('Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, false); + var p = this.constructLexErrorInfo('Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!', false); // produce one 'error' token until this situation has been resolved, most probably by parse termination! return this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; @@ -4450,24 +4544,21 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - - var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, this.options.lexerErrorsAreRecoverable); + var p = this.constructLexErrorInfo('Lexical error' + lineno_msg + ': Unrecognized text.', this.options.lexerErrorsAreRecoverable); + var pendingInput = this._input; + var activeCondition = this.topState(); + var conditionStackDepth = this.conditionStack.length; token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us - // by moving forward at least one character at a time: - if (!this.match.length) { + // by moving forward at least one character at a time IFF the (user-specified?) `parseError()` + // has not consumed/modified any pending input or changed state in the error handler: + if (!this.matches && // and make sure the input has been modified/consumed ... + pendingInput === this._input && // ...or the lexer state has been modified significantly enough + // to merit a non-consuming error handling action right now. + activeCondition === this.topState() && conditionStackDepth === this.conditionStack.length) { this.input(); } } @@ -4604,7 +4695,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 0: /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %\{ */ - yy.dept = 0; + yy.depth = 0; yy.include_command_allowed = false; this.pushState('action'); @@ -4616,7 +4707,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 1: /*! Conditions:: action */ /*! Rule:: %\{([^]*?)%\} */ - yy_.yytext = this.matches[1]; + yy_.yytext = this.matches[1].replace(/%\\\}/g, '%}'); // unescape any literal '%\}' that exists within the action code block yy.include_command_allowed = true; return 32; @@ -4749,9 +4840,9 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi yy.include_command_allowed = false; if (yy.depth <= 0) { - yy_.yyerror(rmCommonWS(_templateObject19) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject26) + this.prettyPrintRange(yy_.yylloc)); - return 'BRACKETS_SURPLUS'; + return 30; } else { yy.depth--; } @@ -4790,10 +4881,10 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi yy.include_command_allowed = false; if (yy.depth !== 0) { - yy_.yyerror(rmCommonWS(_templateObject20, yy.depth) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject27, yy.depth) + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = ''; - return 'BRACKETS_MISSING'; + return 29; } this.popState(); @@ -5084,7 +5175,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi /*! Conditions:: INITIAL rules code */ /*! Rule:: %{NAME}([^\r\n]*) */ /* ignore unrecognized decl */ - this.warn(rmCommonWS(_templateObject21, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(this, yy_.yylloc)); + this.warn(rmCommonWS(_templateObject28, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = [this.matches[1], // {NAME} this.matches[2].trim() // optional value/parameters @@ -5159,7 +5250,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 97: /*! Conditions:: action */ /*! Rule:: " */ - yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject29) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5167,7 +5258,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 98: /*! Conditions:: action */ /*! Rule:: ' */ - yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject29) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5175,7 +5266,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 99: /*! Conditions:: action */ /*! Rule:: ` */ - yy_.yyerror(rmCommonWS(_templateObject22) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject29) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5183,7 +5274,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 100: /*! Conditions:: options */ /*! Rule:: " */ - yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject30) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5191,7 +5282,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 101: /*! Conditions:: options */ /*! Rule:: ' */ - yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject30) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5199,7 +5290,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi case 102: /*! Conditions:: options */ /*! Rule:: ` */ - yy_.yyerror(rmCommonWS(_templateObject23) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject30) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5209,7 +5300,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi /*! Rule:: " */ var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); - yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject31, rules) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5219,7 +5310,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi /*! Rule:: ' */ var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); - yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject31, rules) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5229,7 +5320,7 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi /*! Rule:: ` */ var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); - yy_.yyerror(rmCommonWS(_templateObject24, rules) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject31, rules) + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -5240,14 +5331,14 @@ function _taggedTemplateLiteral(strings, raw) { return Object.freeze(Object.defi /* b0rk on bad characters */ var rules = this.topState() === 'macro' ? 'macro\'s' : this.topState(); - yy_.yyerror(rmCommonWS(_templateObject25, rules, rules) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject32, rules, rules) + this.prettyPrintRange(yy_.yylloc)); break; case 107: /*! Conditions:: * */ /*! Rule:: . */ - yy_.yyerror(rmCommonWS(_templateObject26, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(this, yy_.yylloc)); + yy_.yyerror(rmCommonWS(_templateObject33, dquote(yy_.yytext), dquote(this.topState())) + this.prettyPrintRange(yy_.yylloc)); break; diff --git a/dist/lex-parser-umd.js b/dist/lex-parser-umd.js index 8229a77..3f6266e 100644 --- a/dist/lex-parser-umd.js +++ b/dist/lex-parser-umd.js @@ -11,7 +11,7 @@ fs = fs && fs.hasOwnProperty('default') ? fs['default'] : fs; // hack: var assert; -/* parser generated by jison 0.6.1-204 */ +/* parser generated by jison 0.6.1-205 */ /* * Returns a Parser object of the following structure: @@ -865,7 +865,7 @@ productions_: bp({ 54, 54, s, - [55, 3], + [55, 6], 56, 57, 57, @@ -932,7 +932,8 @@ productions_: bp({ rule: u([ s, [4, 3], - 2, + s, + [5, 4, -1], 0, 0, 2, @@ -954,12 +955,12 @@ productions_: bp({ c, [23, 3], 4, - 4, - 3, c, - [29, 4], - s, - [3, 3], + [32, 4], + 2, + c, + [22, 3], + 3, s, [2, 8], 0, @@ -994,7 +995,8 @@ productions_: bp({ c, [10, 4], c, - [32, 5], + [82, 4], + 1, 0 ]) }), @@ -1062,6 +1064,7 @@ case 2: yyparser.yyError(rmCommonWS` + There's an error in your lexer regex rules or epilogue. Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: @@ -1070,10 +1073,10 @@ case 2: %% rules %% // <-- optional! - extra_module_code // <-- optional! + extra_module_code // <-- optional epilogue! Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp - 1].errStr} @@ -1088,7 +1091,7 @@ case 3: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + if (yyvstack[yysp].trim() !== '') { this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; } else { this.$ = { rules: yyvstack[yysp - 2] }; @@ -1096,6 +1099,86 @@ case 3: break; case 4: + /*! Production:: rules_and_epilogue : "%%" error rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 4]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 4, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp - 3])} + + Technical error report: + ${yyvstack[yysp - 3].errStr} + `); + break; + +case 5: + /*! Production:: rules_and_epilogue : "%%" rules "%%" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's an error in your lexer epilogue a.k.a. 'extra_module_code' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 6: + /*! Production:: rules_and_epilogue : "%%" error rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 7: /*! Production:: rules_and_epilogue : "%%" rules */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1106,7 +1189,7 @@ case 4: this.$ = { rules: yyvstack[yysp] }; break; -case 5: +case 8: /*! Production:: rules_and_epilogue : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1117,7 +1200,7 @@ case 5: this.$ = { rules: [] }; break; -case 6: +case 9: /*! Production:: init : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1130,7 +1213,7 @@ case 6: if (!yy.options) yy.options = {}; break; -case 7: +case 10: /*! Production:: definitions : definitions definition */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1152,7 +1235,7 @@ case 7: } break; -case 8: +case 11: /*! Production:: definitions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1167,10 +1250,8 @@ case 8: }; break; -case 9: +case 12: /*! Production:: definition : NAME regex */ -case 38: - /*! Production:: rule : regex action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); @@ -1180,9 +1261,9 @@ case 38: this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; -case 10: +case 13: /*! Production:: definition : START_INC names_inclusive */ -case 11: +case 14: /*! Production:: definition : START_EXC names_exclusive */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1193,7 +1274,7 @@ case 11: this.$ = yyvstack[yysp]; break; -case 12: +case 15: /*! Production:: definition : action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1201,12 +1282,22 @@ case 12: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - yy.actionInclude.push(yyvstack[yysp]); this.$ = null; + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The '%{...%}' lexer setup action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + yy.actionInclude.push(yyvstack[yysp]); + this.$ = null; break; -case 13: +case 16: /*! Production:: definition : options */ -case 99: +case 102: /*! Production:: option_list : option */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1217,7 +1308,7 @@ case 99: this.$ = null; break; -case 14: +case 17: /*! Production:: definition : UNKNOWN_DECL */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1228,7 +1319,7 @@ case 14: this.$ = {type: 'unknown', body: yyvstack[yysp]}; break; -case 15: +case 18: /*! Production:: definition : IMPORT import_name import_path */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1239,7 +1330,7 @@ case 15: this.$ = {type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp]}; break; -case 16: +case 19: /*! Production:: definition : IMPORT import_name error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1253,14 +1344,14 @@ case 16: %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 17: +case 20: /*! Production:: definition : IMPORT error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1276,14 +1367,14 @@ case 17: %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 18: +case 21: /*! Production:: definition : INIT_CODE init_code_name action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1291,14 +1382,23 @@ case 18: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The '%code ${$init_code_name}' action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} + `); + } this.$ = { - type: 'codesection', + type: 'codesection', qualifier: yyvstack[yysp - 1], include: yyvstack[yysp] }; break; -case 19: +case 22: /*! Production:: definition : INIT_CODE error action */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1312,40 +1412,38 @@ case 19: %code qualifier_name {action code} Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} Technical error report: ${yyvstack[yysp - 1].errStr} `); break; -case 20: +case 23: /*! Production:: init_code_name : NAME */ -case 21: +case 24: /*! Production:: init_code_name : STRING_LIT */ -case 22: +case 25: /*! Production:: import_name : NAME */ -case 23: +case 26: /*! Production:: import_name : STRING_LIT */ -case 24: +case 27: /*! Production:: import_path : NAME */ -case 25: +case 28: /*! Production:: import_path : STRING_LIT */ -case 61: +case 64: /*! Production:: regex_list : regex_concat */ -case 66: +case 69: /*! Production:: nonempty_regex_list : regex_concat */ -case 68: +case 71: /*! Production:: regex_concat : regex_base */ -case 93: +case 96: /*! Production:: escape_char : ESCAPE_CHAR */ -case 94: +case 97: /*! Production:: range_regex : RANGE_REGEX */ -case 106: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 110: - /*! Production:: module_code_chunk : CODE */ case 113: + /*! Production:: module_code_chunk : CODE */ +case 116: /*! Production:: optional_module_code_chunk : module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1356,7 +1454,7 @@ case 113: this.$ = yyvstack[yysp]; break; -case 26: +case 29: /*! Production:: names_inclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1367,7 +1465,7 @@ case 26: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; break; -case 27: +case 30: /*! Production:: names_inclusive : names_inclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1378,7 +1476,7 @@ case 27: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; break; -case 28: +case 31: /*! Production:: names_exclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1389,7 +1487,7 @@ case 28: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; break; -case 29: +case 32: /*! Production:: names_exclusive : names_exclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1400,7 +1498,7 @@ case 29: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; break; -case 30: +case 33: /*! Production:: rules : rules rules_collective */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1411,9 +1509,9 @@ case 30: this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; -case 31: +case 34: /*! Production:: rules : %epsilon */ -case 37: +case 40: /*! Production:: rule_block : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1424,7 +1522,7 @@ case 37: this.$ = []; break; -case 32: +case 35: /*! Production:: rules_collective : start_conditions rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1438,7 +1536,7 @@ case 32: this.$ = [yyvstack[yysp]]; break; -case 33: +case 36: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1454,7 +1552,7 @@ case 33: this.$ = yyvstack[yysp - 1]; break; -case 34: +case 37: /*! Production:: rules_collective : start_conditions "{" error "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1470,14 +1568,14 @@ case 34: block. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} + ${yylexer.prettyPrintRange(yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} Technical error report: ${yyvstack[yysp - 1].errStr} `); break; -case 35: +case 38: /*! Production:: rules_collective : start_conditions "{" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1493,14 +1591,14 @@ case 35: as a terminating curly brace '}' could not be found. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 36: +case 39: /*! Production:: rule_block : rule_block rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1511,7 +1609,27 @@ case 36: this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); break; -case 39: +case 41: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The rule's action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + +case 42: /*! Production:: rule : regex error */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1524,14 +1642,14 @@ case 39: Lexer rule regex action code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 40: +case 43: /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1544,11 +1662,11 @@ case 40: Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} `); break; -case 41: +case 44: /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1561,11 +1679,11 @@ case 41: Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} `); break; -case 42: +case 45: /*! Production:: action : ACTION_START action_body ACTION_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1591,9 +1709,9 @@ case 42: } break; -case 43: +case 46: /*! Production:: action_body : action_body ACTION */ -case 48: +case 51: /*! Production:: action_body : action_body include_macro_code */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1604,21 +1722,21 @@ case 48: this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; break; -case 44: +case 47: /*! Production:: action_body : action_body ACTION_BODY */ -case 45: +case 48: /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ -case 46: +case 49: /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ -case 47: +case 50: /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ -case 67: +case 70: /*! Production:: regex_concat : regex_concat regex_base */ -case 79: +case 82: /*! Production:: regex_base : regex_base range_regex */ -case 89: +case 92: /*! Production:: regex_set : regex_set regex_set_atom */ -case 111: +case 114: /*! Production:: module_code_chunk : module_code_chunk CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1629,7 +1747,7 @@ case 111: this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 49: +case 52: /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1642,11 +1760,11 @@ case 49: You may place the '%include' instruction only at the start/front of a line. It's use is not permitted at this position: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} `); break; -case 50: +case 53: /*! Production:: action_body : action_body error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1659,18 +1777,18 @@ case 50: Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 51: +case 54: /*! Production:: action_body : %epsilon */ -case 62: +case 65: /*! Production:: regex_list : %epsilon */ -case 114: +case 117: /*! Production:: optional_module_code_chunk : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1681,7 +1799,7 @@ case 114: this.$ = ''; break; -case 52: +case 55: /*! Production:: start_conditions : "<" name_list ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1692,7 +1810,7 @@ case 52: this.$ = yyvstack[yysp - 1]; break; -case 53: +case 56: /*! Production:: start_conditions : "<" name_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1705,14 +1823,14 @@ case 53: Seems you did not correctly terminate the start condition set <${yyvstack[yysp - 1].join(',')},???> with a terminating '>' Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 54: +case 57: /*! Production:: start_conditions : "<" "*" ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1723,7 +1841,7 @@ case 54: this.$ = ['*']; break; -case 55: +case 58: /*! Production:: start_conditions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1732,7 +1850,7 @@ case 55: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 56: +case 59: /*! Production:: name_list : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1743,7 +1861,7 @@ case 56: this.$ = [yyvstack[yysp]]; break; -case 57: +case 60: /*! Production:: name_list : name_list "," NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1754,7 +1872,7 @@ case 57: this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; -case 58: +case 61: /*! Production:: regex : nonempty_regex_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1825,9 +1943,9 @@ case 58: } break; -case 59: +case 62: /*! Production:: regex_list : regex_list "|" regex_concat */ -case 63: +case 66: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1838,9 +1956,9 @@ case 63: this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; -case 60: +case 63: /*! Production:: regex_list : regex_list "|" */ -case 64: +case 67: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1851,7 +1969,7 @@ case 64: this.$ = yyvstack[yysp - 1] + '|'; break; -case 65: +case 68: /*! Production:: nonempty_regex_list : "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1862,7 +1980,7 @@ case 65: this.$ = '|' + yyvstack[yysp]; break; -case 69: +case 72: /*! Production:: regex_base : "(" regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1873,7 +1991,7 @@ case 69: this.$ = '(' + yyvstack[yysp - 1] + ')'; break; -case 70: +case 73: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1884,9 +2002,9 @@ case 70: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; -case 71: +case 74: /*! Production:: regex_base : "(" regex_list error */ -case 72: +case 75: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1899,14 +2017,14 @@ case 72: Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 73: +case 76: /*! Production:: regex_base : regex_base "+" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1917,7 +2035,7 @@ case 73: this.$ = yyvstack[yysp - 1] + '+'; break; -case 74: +case 77: /*! Production:: regex_base : regex_base "*" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1928,7 +2046,7 @@ case 74: this.$ = yyvstack[yysp - 1] + '*'; break; -case 75: +case 78: /*! Production:: regex_base : regex_base "?" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1939,7 +2057,7 @@ case 75: this.$ = yyvstack[yysp - 1] + '?'; break; -case 76: +case 79: /*! Production:: regex_base : "/" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1950,7 +2068,7 @@ case 76: this.$ = '(?=' + yyvstack[yysp] + ')'; break; -case 77: +case 80: /*! Production:: regex_base : "/!" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1961,21 +2079,21 @@ case 77: this.$ = '(?!' + yyvstack[yysp] + ')'; break; -case 78: +case 81: /*! Production:: regex_base : name_expansion */ -case 80: +case 83: /*! Production:: regex_base : any_group_regex */ -case 84: +case 87: /*! Production:: regex_base : string */ -case 85: +case 88: /*! Production:: regex_base : escape_char */ -case 86: +case 89: /*! Production:: name_expansion : NAME_BRACE */ -case 90: +case 93: /*! Production:: regex_set : regex_set_atom */ -case 91: +case 94: /*! Production:: regex_set_atom : REGEX_SET */ -case 96: +case 99: /*! Production:: string : CHARACTER_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1984,7 +2102,7 @@ case 96: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 81: +case 84: /*! Production:: regex_base : "." */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1995,7 +2113,7 @@ case 81: this.$ = '.'; break; -case 82: +case 85: /*! Production:: regex_base : "^" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2006,7 +2124,7 @@ case 82: this.$ = '^'; break; -case 83: +case 86: /*! Production:: regex_base : "$" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2017,10 +2135,8 @@ case 83: this.$ = '$'; break; -case 87: +case 90: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 107: - /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); @@ -2030,7 +2146,7 @@ case 107: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 88: +case 91: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2043,14 +2159,14 @@ case 88: Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 92: +case 95: /*! Production:: regex_set_atom : name_expansion */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2069,7 +2185,7 @@ case 92: //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 95: +case 98: /*! Production:: string : STRING_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2080,7 +2196,7 @@ case 95: this.$ = prepareString(yyvstack[yysp]); break; -case 97: +case 100: /*! Production:: options : OPTIONS option_list OPTIONS_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2091,7 +2207,7 @@ case 97: this.$ = null; break; -case 98: +case 101: /*! Production:: option_list : option option_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2102,7 +2218,7 @@ case 98: this.$ = null; break; -case 100: +case 103: /*! Production:: option : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2114,7 +2230,7 @@ case 100: yy.options[yyvstack[yysp]] = true; break; -case 101: +case 104: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2126,9 +2242,9 @@ case 101: yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; -case 102: +case 105: /*! Production:: option : NAME "=" OPTION_VALUE */ -case 103: +case 106: /*! Production:: option : NAME "=" NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2140,7 +2256,7 @@ case 103: yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; -case 104: +case 107: /*! Production:: option : NAME "=" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2154,14 +2270,14 @@ case 104: Internal error: option "${$option}" value assignment failure. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 105: +case 108: /*! Production:: option : error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2175,14 +2291,67 @@ case 105: Expected a valid option name (with optional value assignment). Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 108: +case 109: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = yyvstack[yysp]; + break; + +case 110: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Each of the 3 chunks should be parse-able as a JS snippet on its own. + // + // Note: we have already checked the first section in a previous reduction + // of this rule, so we don't need to check that one again! + var rv = checkActionBlock(yyvstack[yysp - 1], yylstack[yysp - 1]); + if (rv) { + yyparser.yyError(rmCommonWS` + The source code %include-d into the extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} + `); + } + rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 111: /*! Production:: include_macro_code : INCLUDE PATH */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2195,7 +2364,7 @@ case 108: this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; -case 109: +case 112: /*! Production:: include_macro_code : INCLUDE error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2208,19 +2377,19 @@ case 109: %include MUST be followed by a valid file path. Erroneous path: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 112: - /*! Production:: module_code_chunk : error */ +case 115: + /*! Production:: module_code_chunk : error CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): - this.$ = yyvstack[yysp]; - this._$ = yylstack[yysp]; + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) @@ -2229,14 +2398,14 @@ case 112: Module code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} Technical error report: - ${yyvstack[yysp].errStr} + ${yyvstack[yysp - 1].errStr} `); break; -case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! +case 151: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -2255,7 +2424,7 @@ table: bt({ 1, 1, 11, - 18, + 19, 21, 2, 2, @@ -2268,6 +2437,7 @@ table: bt({ 1, 1, 19, + 18, 11, 12, 18, @@ -2302,6 +2472,7 @@ table: bt({ 17, 23, 3, + 19, 30, 29, 30, @@ -2327,16 +2498,17 @@ table: bt({ 11, 1, 4, + c, + [55, 3], + 3, 3, - 2, - s, - [3, 3], 17, 16, 3, 3, 1, 3, + 7, s, [29, 3], 21, @@ -2349,6 +2521,7 @@ table: bt({ [3, 4], 6, 3, + 3, 23, s, [18, 3], @@ -2356,6 +2529,8 @@ table: bt({ 14, 1, 14, + 3, + 1, 20, 2, 17, @@ -2387,6 +2562,7 @@ table: bt({ c, [17, 10], 1, + 2, 3, 5, 9, @@ -2414,9 +2590,9 @@ table: bt({ 27, 63, c, - [54, 12], + [55, 13], c, - [11, 21], + [11, 20], 2, 20, 26, @@ -2440,18 +2616,21 @@ table: bt({ 65, 70, c, - [67, 13], + [19, 17], + 64, + c, + [85, 13], 9, c, [12, 9], c, - [125, 12], + [143, 12], c, - [123, 6], + [141, 6], c, [30, 3], c, - [59, 6], + [58, 6], s, [20, 7, 1], 28, @@ -2500,14 +2679,14 @@ table: bt({ [19, 7], 27, c, - [572, 11], + [590, 11], c, [12, 27], c, - [593, 3], + [611, 3], 61, c, - [612, 14], + [630, 14], c, [3, 3], 28, @@ -2517,7 +2696,7 @@ table: bt({ 28, 28, c, - [616, 11], + [634, 11], 88, 48, 2, @@ -2538,29 +2717,31 @@ table: bt({ 89, 90, c, - [630, 17], + [629, 17], 3, c, - [732, 13], + [750, 13], 67, c, - [733, 8], + [751, 8], 7, 20, 71, c, - [613, 24], + [691, 20], c, - [643, 65], + [632, 23], c, - [507, 145], + [662, 65], + c, + [526, 145], 2, 9, 11, c, - [769, 15], + [788, 15], c, - [789, 7], + [808, 7], 11, c, [201, 59], @@ -2576,44 +2757,46 @@ table: bt({ c, [4, 8], c, - [476, 33], + [495, 33], c, [11, 59], 3, 4, c, - [473, 8], + [449, 8], c, [401, 15], c, [27, 54], c, - [584, 11], + [603, 11], c, [11, 78], 52, c, [182, 11], c, - [664, 3], + [683, 3], 49, 50, 1, 51, 88, 1, + 53, + 1, 51, 1, 51, - 53, c, - [3, 7], + [5, 3], + 53, c, - [672, 16], + [647, 17], 2, 4, c, - [673, 13], + [691, 13], 66, 2, 28, @@ -2625,60 +2808,65 @@ table: bt({ c, [4, 3], c, - [642, 58], + [740, 8], + c, + [648, 57], c, - [525, 31], + [531, 31], c, - [522, 13], + [528, 13], c, - [750, 8], + [756, 8], c, - [662, 115], + [668, 115], c, - [562, 5], + [568, 5], c, - [315, 10], + [321, 10], 53, c, [13, 13], c, - [979, 3], + [1004, 3], c, [3, 9], c, - [988, 4], + [273, 4], c, - [987, 3], - 51, - 53, + [272, 3], c, - [300, 14], + [328, 5], c, - [973, 9], + [310, 14], + c, + [1001, 9], 1, c, - [487, 10], + [496, 10], c, [27, 7], c, [18, 36], c, - [1050, 14], + [1078, 14], c, [14, 14], 20, c, [15, 14], c, - [830, 20], + [461, 3], + 53, + c, + [843, 20], c, - [469, 3], + [480, 3], c, - [460, 16], + [474, 16], c, - [159, 14], + [163, 14], c, - [491, 18], + [505, 18], 6, 8 ]), @@ -2696,33 +2884,35 @@ table: bt({ c, [15, 12], s, - [2, 19], + [2, 20], c, - [31, 14], + [32, 14], s, [0, 8], c, [23, 3], c, - [56, 31], + [57, 32], c, - [62, 10], + [62, 9], c, - [112, 13], + [113, 13], c, [67, 4], c, [40, 20], c, - [78, 36], + [21, 18], c, - [123, 7], + [96, 36], + c, + [141, 7], c, [30, 28], c, - [203, 43], + [221, 43], c, - [205, 9], + [223, 9], c, [22, 34], c, @@ -2734,45 +2924,47 @@ table: bt({ c, [139, 19], c, - [655, 16], + [673, 16], c, [14, 5], c, [180, 13], c, - [194, 34], - s, - [0, 9], + [764, 35], + c, + [751, 9], + c, + [98, 19], c, - [98, 21], + [632, 31], c, - [643, 86], + [662, 75], c, - [492, 151], + [511, 151], c, - [494, 34], + [513, 34], c, [231, 35], c, - [802, 238], + [821, 238], c, - [716, 74], + [735, 74], c, - [44, 28], + [43, 27], c, - [708, 37], + [740, 39], c, - [522, 78], + [1202, 78], c, - [454, 163], + [756, 30], c, - [164, 19], + [696, 140], c, - [973, 11], + [1001, 31], c, - [830, 147], - s, - [2, 21] + [461, 114], + c, + [121, 58] ]), state: u([ s, @@ -2781,112 +2973,119 @@ table: bt({ 11, 12, 20, - 21, 22, - 24, + 23, 25, - 30, + 26, 31, + 32, + 37, 36, - 35, - 42, - 44, - 46, - 50, - 54, + 43, + 45, + 47, + 51, 55, 56, - 60, + 57, 61, + 62, 64, + 66, c, - [15, 5], - 65, + [16, 5], + 67, c, [5, 4], - 69, 71, - 72, + 73, + 74, c, [13, 5], - 73, + 75, c, [7, 6], - 74, + 76, c, [5, 4], - 75, + 77, c, [5, 4], + 81, + 78, 79, - 76, - 77, - 82, - 86, - 87, - 96, - 101, - 56, + 84, + 88, + 89, + 98, 103, + 57, 105, - 104, 108, + 107, 110, + 112, c, - [66, 7], - 111, - 114, + [67, 7], + 113, + 61, + 62, + 117, c, - [58, 11], + [60, 11], c, [6, 6], - 69, - 79, - 122, - 129, - 131, - 133, + 71, + 81, + 125, + 132, + 135, + 137, + 143, + 108, + 107, c, - [12, 5], - 139, + [15, 5], + 145, c, - [29, 5], - 105, - 140, - 142, + [32, 5], + 108, + 146, + 148, c, - [47, 8], + [52, 8], + 132, c, - [22, 5] + [23, 5] ]), mode: u([ s, [2, 23], s, [1, 12], - s, - [2, 28], - s, - [1, 15], - s, - [2, 33], c, - [39, 17], + [24, 13], + c, + [41, 28], c, - [13, 6], + [44, 15], c, - [18, 7], + [89, 27], c, - [64, 21], + [17, 13], c, - [21, 10], + [88, 11], c, - [106, 15], + [64, 34], c, - [75, 12], + [38, 14], + c, + [123, 15], + c, + [92, 12], 1, c, - [90, 10], + [107, 10], c, [27, 6], c, @@ -2914,141 +3113,152 @@ table: bt({ c, [409, 15], c, - [568, 9], + [585, 9], c, [47, 20], c, - [454, 17], + [45, 25], + c, + [36, 14], c, - [561, 23], + [578, 18], c, - [585, 53], + [602, 53], c, - [442, 145], + [459, 145], c, - [718, 19], + [735, 19], c, - [780, 33], + [797, 33], c, [29, 25], c, - [759, 238], + [776, 238], c, - [796, 51], + [813, 51], c, [289, 5], c, - [1211, 12], + [648, 7], c, - [722, 35], + [298, 21], c, - [340, 9], + [738, 18], c, - [648, 24], + [621, 8], c, - [854, 59], + [376, 7], c, - [1199, 170], + [651, 22], c, - [311, 6], + [874, 59], c, - [969, 23], + [1219, 170], c, - [1128, 90], + [960, 9], c, - [291, 66] + [947, 23], + c, + [1151, 89], + c, + [805, 17], + s, + [2, 53] ]), goto: u([ s, - [6, 11], + [9, 11], s, - [8, 11], - 5, + [11, 11], + 8, 5, s, [7, 4, 1], s, [13, 7, 1], s, - [7, 11], - s, - [31, 17], - 23, - 26, - 28, - 32, - 33, + [10, 11], 34, - 39, + 21, + s, + [34, 16], + 24, 27, 29, - 37, + 33, + 34, + 35, + 40, + 28, + 30, 38, + 39, + 42, 41, - 40, - 43, - 45, + 44, + 46, s, - [12, 11], + [15, 11], s, - [13, 11], + [16, 11], s, - [14, 11], - 47, + [17, 11], 48, 49, - 51, + 50, 52, 53, s, - [51, 11], + [54, 12], + 59, 58, - 57, 1, 2, - 4, - 55, - 62, + 7, + 58, + 63, s, - [55, 6], - 59, + [58, 6], + 60, s, - [55, 7], + [58, 7], s, - [9, 11], - 58, - 58, - 63, + [34, 17], + s, + [12, 11], + 61, + 61, + 65, s, - [58, 9], + [61, 9], c, - [108, 12], + [125, 12], s, - [66, 3], + [69, 3], c, [15, 5], s, - [66, 7], - 39, - 66, + [69, 7], + 40, + 69, c, [23, 7], - 68, - 68, - 67, - s, - [68, 3], + 71, + 71, c, - [7, 3], - s, - [68, 17], - 70, - 68, + [3, 3], + 71, 68, - 62, - 62, - 26, - 62, + 70, + s, + [71, 18], + 72, + 71, + 71, + 65, + 65, + 27, + 65, c, [68, 11], c, @@ -3058,197 +3268,200 @@ table: bt({ c, [12, 12], s, - [78, 29], - s, - [80, 29], - s, [81, 29], s, - [82, 29], - s, [83, 29], s, [84, 29], s, [85, 29], s, - [86, 31], - 37, - 78, - s, - [95, 29], + [86, 29], s, - [96, 29], + [87, 29], s, - [93, 29], + [88, 29], s, - [10, 9], + [89, 31], + 38, 80, - 10, - 10, s, - [26, 12], + [98, 29], s, - [11, 9], - 81, - 11, - 11, + [99, 29], + s, + [96, 29], s, - [28, 12], + [13, 9], + 82, + 13, + 13, + s, + [29, 12], + s, + [14, 9], 83, - 84, + 14, + 14, + s, + [31, 12], 85, + 86, + 87, s, - [17, 11], + [20, 11], s, - [22, 3], + [25, 3], s, - [23, 3], + [26, 3], 16, 16, - 20, - 21, - 98, + 23, + 24, + 100, s, - [88, 8, 1], - 97, + [90, 8, 1], 99, - 100, + 101, + 102, + 59, 58, - 57, - 99, - 100, 102, - 100, - 100, + 103, + 104, + 103, + 103, s, - [105, 3], - 114, - 107, - 114, + [108, 3], + 117, 106, - s, - [30, 17], + 117, 109, + s, + [33, 17], + 111, c, - [667, 13], - 112, - 113, + [684, 13], + 114, + 115, + 6, + c, + [630, 8], + 116, + s, + [58, 7], s, - [64, 3], + [67, 3], c, - [17, 5], + [34, 5], s, - [64, 7], - 39, - 64, + [67, 7], + 40, + 67, c, - [25, 6], - 64, + [42, 6], + 67, s, - [65, 3], + [68, 3], c, [24, 5], s, - [65, 7], - 39, - 65, + [68, 7], + 40, + 68, c, [24, 6], - 65, - s, - [67, 6], - 66, 68, + 70, + 70, + 69, s, - [67, 18], + [70, 3], + c, + [7, 3], + s, + [70, 17], + 72, + 70, 70, - 67, - 67, s, - [73, 29], + [76, 29], s, - [74, 29], + [77, 29], s, - [75, 29], + [78, 29], s, - [79, 29], + [82, 29], s, - [94, 29], - 116, - 117, - 115, - 61, - 61, - 26, - 61, - c, - [242, 11], + [97, 29], 119, - 117, + 120, 118, - 76, - 76, - 67, + 64, + 64, + 27, + 64, + c, + [259, 11], + 122, + 120, + 121, + 79, + 79, + 69, s, - [76, 3], - 66, + [79, 3], 68, - s, - [76, 18], 70, - 76, - 76, - 77, - 77, - 67, s, - [77, 3], - 66, - 68, + [79, 18], + 72, + 79, + 79, + 80, + 80, + 69, s, - [77, 18], + [80, 3], + 68, 70, - 77, - 77, - 121, - 37, - 120, - 78, - s, - [90, 4], s, - [91, 4], - s, - [92, 4], - s, - [27, 12], + [80, 18], + 72, + 80, + 80, + 124, + 38, + 123, + 80, s, - [29, 12], + [93, 4], s, - [15, 11], + [94, 4], s, - [16, 11], + [95, 4], s, - [24, 11], + [30, 12], s, - [25, 11], + [32, 12], s, [18, 11], s, [19, 11], s, - [40, 27], + [27, 11], + s, + [28, 11], s, - [41, 27], + [21, 11], s, - [42, 27], + [22, 11], s, - [43, 11], + [43, 27], s, - [44, 11], + [44, 27], s, - [45, 11], + [45, 27], s, [46, 11], s, @@ -3259,121 +3472,136 @@ table: bt({ [49, 11], s, [50, 11], - 124, - 123, s, - [97, 11], - 98, - 128, + [51, 11], + s, + [52, 11], + s, + [53, 11], 127, - 125, 126, - 3, - 99, - 106, - 106, - 113, - 113, - 130, s, - [110, 3], - s, - [112, 3], + [100, 11], + 101, + 131, + 130, + 128, + 129, + 3, + 101, + 5, + 133, + 109, + 109, + 116, + 116, + 134, s, - [32, 17], - 132, + [113, 3], s, - [37, 14], - 134, - 16, - 136, - 135, - 137, + [35, 17], + 136, + s, + [40, 14], 138, + 16, + 140, + 139, + 141, + 142, s, - [56, 3], + [59, 3], + 117, + 144, + 117, + 109, s, - [63, 3], + [66, 3], c, - [624, 5], + [627, 5], s, - [63, 7], - 39, - 63, + [66, 7], + 40, + 66, c, - [431, 6], - 63, + [434, 6], + 66, s, - [69, 29], + [72, 29], s, - [71, 29], - 60, - 60, - 26, - 60, + [74, 29], + 63, + 63, + 27, + 63, c, - [505, 11], + [508, 11], s, - [70, 29], + [73, 29], s, - [72, 29], + [75, 29], s, - [87, 29], + [90, 29], s, - [88, 29], + [91, 29], s, - [89, 4], + [92, 4], s, - [108, 13], + [111, 13], s, - [109, 13], + [112, 13], s, - [101, 3], + [104, 3], s, - [102, 3], + [105, 3], s, - [103, 3], + [106, 3], s, - [104, 3], + [107, 3], c, - [940, 4], + [259, 4], s, - [111, 3], - 141, + [115, 3], + s, + [114, 3], + 147, c, - [926, 13], - 35, - 35, - 143, + [949, 13], + 38, + 38, + 149, s, - [35, 15], + [38, 15], s, - [38, 18], + [41, 18], s, - [39, 18], + [42, 18], s, - [52, 14], + [55, 14], s, - [53, 14], - 144, + [56, 14], + 150, s, - [54, 14], - 59, - 59, - 26, - 59, + [57, 14], + 4, + 101, + 133, + 62, + 62, + 27, + 62, c, - [112, 11], - 107, - 107, + [115, 11], + 110, + 110, s, - [33, 17], + [36, 17], s, - [36, 14], + [39, 14], s, - [34, 17], + [37, 17], s, - [57, 3] + [60, 3] ]) }), defaultActions: bda({ @@ -3381,7 +3609,6 @@ defaultActions: bda({ 0, 2, 6, - 7, 11, 12, 13, @@ -3389,114 +3616,115 @@ defaultActions: bda({ 18, 19, 21, + 22, s, - [30, 8, 1], - 39, + [31, 8, 1], 40, + 41, s, - [41, 4, 2], - 48, + [42, 4, 2], 49, - 52, + 50, 53, - 58, - 60, + 54, + 59, + 61, s, - [66, 5, 1], + [68, 5, 1], s, - [77, 22, 1], - 100, - 101, - 104, - 106, + [79, 22, 1], + 102, + 103, 107, - 108, - 113, + 109, + 110, 115, - 116, + 118, + 119, s, - [118, 11, 1], - 130, + [121, 11, 1], + 133, + 134, s, - [133, 4, 1], - 138, + [137, 4, 1], + 142, s, - [140, 5, 1] + [146, 5, 1] ]), goto: u([ - 6, - 8, - 7, - 31, - 12, - 13, - 14, - 51, + 9, + 11, + 10, + 15, + 16, + 17, + 54, 1, 2, - 9, - 78, + 34, + 12, + 81, s, - [80, 7, 1], - 95, + [83, 7, 1], + 98, + 99, 96, - 93, + 29, + 31, + 20, + 25, 26, - 28, - 17, - 22, 23, - 20, - 21, - 105, + 24, + 108, + 33, + 76, + 77, + 78, + 82, + 97, + 93, + 94, + 95, 30, - 73, + 32, + 18, + 19, + 27, + 28, + 21, + 22, + s, + [43, 11, 1], + 100, + 101, + 109, + 113, + 35, + 59, + 72, 74, + 73, 75, - 79, - 94, 90, 91, 92, - 27, - 29, - 15, - 16, - 24, - 25, - 18, - 19, - s, - [40, 11, 1], - 97, - 98, - 106, - 110, + 111, 112, - 32, - 56, - 69, - 71, - 70, - 72, - 87, - 88, - 89, - 108, - 109, s, - [101, 4, 1], - 111, - 38, - 39, - 52, - 53, - 54, - 107, - 33, + [104, 4, 1], + 115, + 114, + 41, + 42, + 55, + 56, + 57, + 110, 36, - 34, - 57 + 39, + 37, + 60 ]) }), parseError: function parseError(str, hash, ExceptionClass) { @@ -3529,7 +3757,7 @@ parse: function parse(input) { var TERROR = this.TERROR; var EOF = this.EOF; var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; - var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + var NO_ACTION = [0, 151 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -4856,6 +5084,8 @@ parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; var rmCommonWS = helpers.rmCommonWS; +var checkActionBlock = helpers.checkActionBlock; + function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); @@ -4909,7 +5139,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-204 */ +/* lexer generated by jison-lex 0.6.1-205 */ /* * Returns a Lexer object of the following structure: @@ -5267,7 +5497,37 @@ EOF: 1, * @public * @this {RegExpLexer} */ - constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable) { + constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) { + msg = '' + msg; + + // heuristic to determine if the error message already contains a (partial) source code dump + // as produced by either `showPosition()` or `prettyPrintRange()`: + if (show_input_position == undefined) { + show_input_position = !(msg.indexOf('\n') > 0 && msg.indexOf('^') > 0); + } + + if (this.yylloc && show_input_position) { + if (typeof this.prettyPrintRange === 'function') { + var pretty_src = this.prettyPrintRange(this.yylloc); + + if (!/\n\s*$/.test(msg)) { + msg += '\n'; + } + + msg += '\n Erroneous area:\n' + this.prettyPrintRange(this.yylloc); + } else if (typeof this.showPosition === 'function') { + var pos_str = this.showPosition(); + + if (pos_str) { + if (msg.length && msg[msg.length - 1] !== '\n' && pos_str[0] !== '\n') { + msg += '\n' + pos_str; + } else { + msg += pos_str; + } + } + } + } + /** @constructor */ var pei = { errStr: msg, @@ -5345,7 +5605,7 @@ EOF: 1, yyerror: function yyError(str /*, ...args */) { var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } @@ -5632,7 +5892,12 @@ EOF: 1, if (lines.length > 1) { this.yylineno -= lines.length - 1; this.yylloc.last_line = this.yylineno + 1; + + // Get last entirely matched line into the `pre_lines[]` array's + // last index slot; we don't mind when other previously + // matched lines end up in the array too. var pre = this.match; + var pre_lines = pre.split(/(?:\r\n?|\n)/g); if (pre_lines.length === 1) { @@ -5677,22 +5942,12 @@ EOF: 1, // `.lex()` run. var lineno_msg = ''; - if (this.options.trackPosition) { + if (this.yylloc) { lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).' + pos_str, + 'Lexical error' + lineno_msg + ': You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).', false ); @@ -5896,35 +6151,23 @@ EOF: 1, var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ': ' + line; var errpfx = new Array(lineno_display_width + 1).join('^'); + var offset = 2 + 1; + var len = 0; if (lno === loc.first_line) { - var offset = loc.first_column + 2; + offset += loc.first_column; - var len = Math.max( + len = Math.max( 2, ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 ); - - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } + len = Math.max(2, loc.last_column + 1); } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); + len = Math.max(2, line.length + 1); + } + + if (len) { var lead = new Array(offset).join('.'); var mark = new Array(len).join('^'); rv += '\n' + errpfx + lead + mark; @@ -5943,15 +6186,6 @@ EOF: 1, if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; - - console.log('clip off: ', { - start: clip_start, - end: clip_end, - len: clip_end - clip_start + 1, - arr: nonempty_line_indexes, - rv - }); - var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); @@ -6167,18 +6401,8 @@ EOF: 1, lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!' + pos_str, + 'Internal lexer engine error' + lineno_msg + ': The lex grammar programmer pushed a non-existing condition name "' + this.topState() + '"; this is a fatal error and should be reported to the application programmer team!', false ); @@ -6240,27 +6464,24 @@ EOF: 1, lineno_msg = ' on line ' + (this.yylineno + 1); } - var pos_str = ''; - - if (typeof this.showPosition === 'function') { - pos_str = this.showPosition(); - - if (pos_str && pos_str[0] !== '\n') { - pos_str = '\n' + pos_str; - } - } - var p = this.constructLexErrorInfo( - 'Lexical error' + lineno_msg + ': Unrecognized text.' + pos_str, + 'Lexical error' + lineno_msg + ': Unrecognized text.', this.options.lexerErrorsAreRecoverable ); + var pendingInput = this._input; + var activeCondition = this.topState(); + var conditionStackDepth = this.conditionStack.length; token = this.parseError(p.errStr, p, this.JisonLexerError) || this.ERROR; if (token === this.ERROR) { // we can try to recover from a lexer error that `parseError()` did not 'recover' for us - // by moving forward at least one character at a time: - if (!this.match.length) { + // by moving forward at least one character at a time IFF the (user-specified?) `parseError()` + // has not consumed/modified any pending input or changed state in the error handler: + if (!this.matches && // and make sure the input has been modified/consumed ... + pendingInput === this._input && // ...or the lexer state has been modified significantly enough + // to merit a non-consuming error handling action right now. + activeCondition === this.topState() && conditionStackDepth === this.conditionStack.length) { this.input(); } } @@ -6397,7 +6618,7 @@ EOF: 1, case 0: /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %\{ */ - yy.dept = 0; + yy.depth = 0; yy.include_command_allowed = false; this.pushState('action'); @@ -6409,7 +6630,7 @@ EOF: 1, case 1: /*! Conditions:: action */ /*! Rule:: %\{([^]*?)%\} */ - yy_.yytext = this.matches[1]; + yy_.yytext = this.matches[1].replace(/%\\\}/g, '%}'); // unescape any literal '%\}' that exists within the action code block yy.include_command_allowed = true; return 32; @@ -6546,13 +6767,13 @@ EOF: 1, too many closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse - easily; we suggest you wrap the action code chunk in '%{...%\}' + easily; we suggest you wrap the action code chunk in '%{...%}' to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); - return 'BRACKETS_SURPLUS'; + return 30; } else { yy.depth--; } @@ -6595,14 +6816,14 @@ EOF: 1, missing ${yy.depth} closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse - easily; we suggest you wrap the action code chunk in '%{...%\}' + easily; we suggest you wrap the action code chunk in '%{...%}' to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = ''; - return 'BRACKETS_MISSING'; + return 29; } this.popState(); @@ -6898,7 +7119,7 @@ EOF: 1, while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = [ this.matches[1], // {NAME} @@ -6978,7 +7199,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -6990,7 +7211,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7002,7 +7223,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7014,7 +7235,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7026,7 +7247,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7038,7 +7259,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7053,7 +7274,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7068,7 +7289,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7083,7 +7304,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7106,7 +7327,7 @@ EOF: 1, regex expression here in jison-lex ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); break; @@ -7118,7 +7339,7 @@ EOF: 1, while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); break; diff --git a/lex-parser.js b/lex-parser.js index 3ac42c2..a568521 100644 --- a/lex-parser.js +++ b/lex-parser.js @@ -2,7 +2,7 @@ // hack: var assert; -/* parser generated by jison 0.6.1-204 */ +/* parser generated by jison 0.6.1-205 */ /* * Returns a Parser object of the following structure: @@ -860,7 +860,7 @@ productions_: bp({ 54, 54, s, - [55, 3], + [55, 6], 56, 57, 57, @@ -927,7 +927,8 @@ productions_: bp({ rule: u([ s, [4, 3], - 2, + s, + [5, 4, -1], 0, 0, 2, @@ -949,12 +950,12 @@ productions_: bp({ c, [23, 3], 4, - 4, - 3, c, - [29, 4], - s, - [3, 3], + [32, 4], + 2, + c, + [22, 3], + 3, s, [2, 8], 0, @@ -989,7 +990,8 @@ productions_: bp({ c, [10, 4], c, - [32, 5], + [82, 4], + 1, 0 ]) }), @@ -1057,6 +1059,7 @@ case 2: yyparser.yyError(rmCommonWS` + There's an error in your lexer regex rules or epilogue. Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: @@ -1065,10 +1068,10 @@ case 2: %% rules %% // <-- optional! - extra_module_code // <-- optional! + extra_module_code // <-- optional epilogue! Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp - 1].errStr} @@ -1083,7 +1086,7 @@ case 3: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - if (yyvstack[yysp] && yyvstack[yysp].trim() !== '') { + if (yyvstack[yysp].trim() !== '') { this.$ = { rules: yyvstack[yysp - 2], moduleInclude: yyvstack[yysp] }; } else { this.$ = { rules: yyvstack[yysp - 2] }; @@ -1091,6 +1094,86 @@ case 3: break; case 4: + /*! Production:: rules_and_epilogue : "%%" error rules "%%" extra_lexer_module_code */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 4]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 4, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp - 3])} + + Technical error report: + ${yyvstack[yysp - 3].errStr} + `); + break; + +case 5: + /*! Production:: rules_and_epilogue : "%%" rules "%%" error */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 3]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 3, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's an error in your lexer epilogue a.k.a. 'extra_module_code' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp])} + + Technical error report: + ${yyvstack[yysp].errStr} + `); + break; + +case 6: + /*! Production:: rules_and_epilogue : "%%" error rules */ + + // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): + this.$ = yyvstack[yysp - 2]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) + + + yyparser.yyError(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} + + Technical error report: + ${yyvstack[yysp - 1].errStr} + `); + break; + +case 7: /*! Production:: rules_and_epilogue : "%%" rules */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1101,7 +1184,7 @@ case 4: this.$ = { rules: yyvstack[yysp] }; break; -case 5: +case 8: /*! Production:: rules_and_epilogue : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1112,7 +1195,7 @@ case 5: this.$ = { rules: [] }; break; -case 6: +case 9: /*! Production:: init : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1125,7 +1208,7 @@ case 6: if (!yy.options) yy.options = {}; break; -case 7: +case 10: /*! Production:: definitions : definitions definition */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1147,7 +1230,7 @@ case 7: } break; -case 8: +case 11: /*! Production:: definitions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1162,10 +1245,8 @@ case 8: }; break; -case 9: +case 12: /*! Production:: definition : NAME regex */ -case 38: - /*! Production:: rule : regex action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); @@ -1175,9 +1256,9 @@ case 38: this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; break; -case 10: +case 13: /*! Production:: definition : START_INC names_inclusive */ -case 11: +case 14: /*! Production:: definition : START_EXC names_exclusive */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1188,7 +1269,7 @@ case 11: this.$ = yyvstack[yysp]; break; -case 12: +case 15: /*! Production:: definition : action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1196,12 +1277,22 @@ case 12: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) - yy.actionInclude.push(yyvstack[yysp]); this.$ = null; + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The '%{...%}' lexer setup action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + yy.actionInclude.push(yyvstack[yysp]); + this.$ = null; break; -case 13: +case 16: /*! Production:: definition : options */ -case 99: +case 102: /*! Production:: option_list : option */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1212,7 +1303,7 @@ case 99: this.$ = null; break; -case 14: +case 17: /*! Production:: definition : UNKNOWN_DECL */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1223,7 +1314,7 @@ case 14: this.$ = {type: 'unknown', body: yyvstack[yysp]}; break; -case 15: +case 18: /*! Production:: definition : IMPORT import_name import_path */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1234,7 +1325,7 @@ case 15: this.$ = {type: 'imports', name: yyvstack[yysp - 1], path: yyvstack[yysp]}; break; -case 16: +case 19: /*! Production:: definition : IMPORT import_name error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1248,14 +1339,14 @@ case 16: %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 17: +case 20: /*! Production:: definition : IMPORT error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1271,14 +1362,14 @@ case 17: %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 18: +case 21: /*! Production:: definition : INIT_CODE init_code_name action */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1286,14 +1377,23 @@ case 18: // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The '%code ${$init_code_name}' action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} + `); + } this.$ = { - type: 'codesection', + type: 'codesection', qualifier: yyvstack[yysp - 1], include: yyvstack[yysp] }; break; -case 19: +case 22: /*! Production:: definition : INIT_CODE error action */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1307,40 +1407,38 @@ case 19: %code qualifier_name {action code} Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1], yylstack[yysp - 2], yylstack[yysp])} Technical error report: ${yyvstack[yysp - 1].errStr} `); break; -case 20: +case 23: /*! Production:: init_code_name : NAME */ -case 21: +case 24: /*! Production:: init_code_name : STRING_LIT */ -case 22: +case 25: /*! Production:: import_name : NAME */ -case 23: +case 26: /*! Production:: import_name : STRING_LIT */ -case 24: +case 27: /*! Production:: import_path : NAME */ -case 25: +case 28: /*! Production:: import_path : STRING_LIT */ -case 61: +case 64: /*! Production:: regex_list : regex_concat */ -case 66: +case 69: /*! Production:: nonempty_regex_list : regex_concat */ -case 68: +case 71: /*! Production:: regex_concat : regex_base */ -case 93: +case 96: /*! Production:: escape_char : ESCAPE_CHAR */ -case 94: +case 97: /*! Production:: range_regex : RANGE_REGEX */ -case 106: - /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ -case 110: - /*! Production:: module_code_chunk : CODE */ case 113: + /*! Production:: module_code_chunk : CODE */ +case 116: /*! Production:: optional_module_code_chunk : module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1351,7 +1449,7 @@ case 113: this.$ = yyvstack[yysp]; break; -case 26: +case 29: /*! Production:: names_inclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1362,7 +1460,7 @@ case 26: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 0; break; -case 27: +case 30: /*! Production:: names_inclusive : names_inclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1373,7 +1471,7 @@ case 27: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 0; break; -case 28: +case 31: /*! Production:: names_exclusive : START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1384,7 +1482,7 @@ case 28: this.$ = {type: 'names', names: {}}; this.$.names[yyvstack[yysp]] = 1; break; -case 29: +case 32: /*! Production:: names_exclusive : names_exclusive START_COND */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1395,7 +1493,7 @@ case 29: this.$ = yyvstack[yysp - 1]; this.$.names[yyvstack[yysp]] = 1; break; -case 30: +case 33: /*! Production:: rules : rules rules_collective */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1406,9 +1504,9 @@ case 30: this.$ = yyvstack[yysp - 1].concat(yyvstack[yysp]); break; -case 31: +case 34: /*! Production:: rules : %epsilon */ -case 37: +case 40: /*! Production:: rule_block : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1419,7 +1517,7 @@ case 37: this.$ = []; break; -case 32: +case 35: /*! Production:: rules_collective : start_conditions rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1433,7 +1531,7 @@ case 32: this.$ = [yyvstack[yysp]]; break; -case 33: +case 36: /*! Production:: rules_collective : start_conditions "{" rule_block "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1449,7 +1547,7 @@ case 33: this.$ = yyvstack[yysp - 1]; break; -case 34: +case 37: /*! Production:: rules_collective : start_conditions "{" error "}" */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1465,14 +1563,14 @@ case 34: block. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} + ${yylexer.prettyPrintRange(yylexer.mergeLocationInfo((yysp - 3), (yysp)), yylstack[yysp - 3])} Technical error report: ${yyvstack[yysp - 1].errStr} `); break; -case 35: +case 38: /*! Production:: rules_collective : start_conditions "{" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1488,14 +1586,14 @@ case 35: as a terminating curly brace '}' could not be found. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 36: +case 39: /*! Production:: rule_block : rule_block rule */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1506,7 +1604,27 @@ case 36: this.$ = yyvstack[yysp - 1]; this.$.push(yyvstack[yysp]); break; -case 39: +case 41: + /*! Production:: rule : regex action */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The rule's action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = [yyvstack[yysp - 1], yyvstack[yysp]]; + break; + +case 42: /*! Production:: rule : regex error */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1519,14 +1637,14 @@ case 39: Lexer rule regex action code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 40: +case 43: /*! Production:: action : ACTION_START action_body BRACKET_MISSING */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1539,11 +1657,11 @@ case 40: Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} `); break; -case 41: +case 44: /*! Production:: action : ACTION_START action_body BRACKET_SURPLUS */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1556,11 +1674,11 @@ case 41: Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} `); break; -case 42: +case 45: /*! Production:: action : ACTION_START action_body ACTION_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1586,9 +1704,9 @@ case 42: } break; -case 43: +case 46: /*! Production:: action_body : action_body ACTION */ -case 48: +case 51: /*! Production:: action_body : action_body include_macro_code */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1599,21 +1717,21 @@ case 48: this.$ = yyvstack[yysp - 1] + '\n\n' + yyvstack[yysp] + '\n\n'; break; -case 44: +case 47: /*! Production:: action_body : action_body ACTION_BODY */ -case 45: +case 48: /*! Production:: action_body : action_body ACTION_BODY_C_COMMENT */ -case 46: +case 49: /*! Production:: action_body : action_body ACTION_BODY_CPP_COMMENT */ -case 47: +case 50: /*! Production:: action_body : action_body ACTION_BODY_WHITESPACE */ -case 67: +case 70: /*! Production:: regex_concat : regex_concat regex_base */ -case 79: +case 82: /*! Production:: regex_base : regex_base range_regex */ -case 89: +case 92: /*! Production:: regex_set : regex_set regex_set_atom */ -case 111: +case 114: /*! Production:: module_code_chunk : module_code_chunk CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1624,7 +1742,7 @@ case 111: this.$ = yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 49: +case 52: /*! Production:: action_body : action_body INCLUDE_PLACEMENT_ERROR */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1637,11 +1755,11 @@ case 49: You may place the '%include' instruction only at the start/front of a line. It's use is not permitted at this position: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} `); break; -case 50: +case 53: /*! Production:: action_body : action_body error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1654,18 +1772,18 @@ case 50: Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 51: +case 54: /*! Production:: action_body : %epsilon */ -case 62: +case 65: /*! Production:: regex_list : %epsilon */ -case 114: +case 117: /*! Production:: optional_module_code_chunk : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1676,7 +1794,7 @@ case 114: this.$ = ''; break; -case 52: +case 55: /*! Production:: start_conditions : "<" name_list ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1687,7 +1805,7 @@ case 52: this.$ = yyvstack[yysp - 1]; break; -case 53: +case 56: /*! Production:: start_conditions : "<" name_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1700,14 +1818,14 @@ case 53: Seems you did not correctly terminate the start condition set <${yyvstack[yysp - 1].join(',')},???> with a terminating '>' Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 54: +case 57: /*! Production:: start_conditions : "<" "*" ">" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1718,7 +1836,7 @@ case 54: this.$ = ['*']; break; -case 55: +case 58: /*! Production:: start_conditions : %epsilon */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1727,7 +1845,7 @@ case 55: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 56: +case 59: /*! Production:: name_list : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1738,7 +1856,7 @@ case 56: this.$ = [yyvstack[yysp]]; break; -case 57: +case 60: /*! Production:: name_list : name_list "," NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1749,7 +1867,7 @@ case 57: this.$ = yyvstack[yysp - 2]; this.$.push(yyvstack[yysp]); break; -case 58: +case 61: /*! Production:: regex : nonempty_regex_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1820,9 +1938,9 @@ case 58: } break; -case 59: +case 62: /*! Production:: regex_list : regex_list "|" regex_concat */ -case 63: +case 66: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1833,9 +1951,9 @@ case 63: this.$ = yyvstack[yysp - 2] + '|' + yyvstack[yysp]; break; -case 60: +case 63: /*! Production:: regex_list : regex_list "|" */ -case 64: +case 67: /*! Production:: nonempty_regex_list : nonempty_regex_list "|" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1846,7 +1964,7 @@ case 64: this.$ = yyvstack[yysp - 1] + '|'; break; -case 65: +case 68: /*! Production:: nonempty_regex_list : "|" regex_concat */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1857,7 +1975,7 @@ case 65: this.$ = '|' + yyvstack[yysp]; break; -case 69: +case 72: /*! Production:: regex_base : "(" regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1868,7 +1986,7 @@ case 69: this.$ = '(' + yyvstack[yysp - 1] + ')'; break; -case 70: +case 73: /*! Production:: regex_base : SPECIAL_GROUP regex_list ")" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1879,9 +1997,9 @@ case 70: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + ')'; break; -case 71: +case 74: /*! Production:: regex_base : "(" regex_list error */ -case 72: +case 75: /*! Production:: regex_base : SPECIAL_GROUP regex_list error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1894,14 +2012,14 @@ case 72: Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 73: +case 76: /*! Production:: regex_base : regex_base "+" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1912,7 +2030,7 @@ case 73: this.$ = yyvstack[yysp - 1] + '+'; break; -case 74: +case 77: /*! Production:: regex_base : regex_base "*" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1923,7 +2041,7 @@ case 74: this.$ = yyvstack[yysp - 1] + '*'; break; -case 75: +case 78: /*! Production:: regex_base : regex_base "?" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1934,7 +2052,7 @@ case 75: this.$ = yyvstack[yysp - 1] + '?'; break; -case 76: +case 79: /*! Production:: regex_base : "/" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1945,7 +2063,7 @@ case 76: this.$ = '(?=' + yyvstack[yysp] + ')'; break; -case 77: +case 80: /*! Production:: regex_base : "/!" regex_base */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1956,21 +2074,21 @@ case 77: this.$ = '(?!' + yyvstack[yysp] + ')'; break; -case 78: +case 81: /*! Production:: regex_base : name_expansion */ -case 80: +case 83: /*! Production:: regex_base : any_group_regex */ -case 84: +case 87: /*! Production:: regex_base : string */ -case 85: +case 88: /*! Production:: regex_base : escape_char */ -case 86: +case 89: /*! Production:: name_expansion : NAME_BRACE */ -case 90: +case 93: /*! Production:: regex_set : regex_set_atom */ -case 91: +case 94: /*! Production:: regex_set_atom : REGEX_SET */ -case 96: +case 99: /*! Production:: string : CHARACTER_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -1979,7 +2097,7 @@ case 96: // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) break; -case 81: +case 84: /*! Production:: regex_base : "." */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -1990,7 +2108,7 @@ case 81: this.$ = '.'; break; -case 82: +case 85: /*! Production:: regex_base : "^" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2001,7 +2119,7 @@ case 82: this.$ = '^'; break; -case 83: +case 86: /*! Production:: regex_base : "$" */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2012,10 +2130,8 @@ case 83: this.$ = '$'; break; -case 87: +case 90: /*! Production:: any_group_regex : REGEX_SET_START regex_set REGEX_SET_END */ -case 107: - /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); @@ -2025,7 +2141,7 @@ case 107: this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; break; -case 88: +case 91: /*! Production:: any_group_regex : REGEX_SET_START regex_set error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2038,14 +2154,14 @@ case 88: Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 92: +case 95: /*! Production:: regex_set_atom : name_expansion */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2064,7 +2180,7 @@ case 92: //yyparser.log("name expansion for: ", { name: $name_expansion, redux: $name_expansion.replace(/[{}]/g, ''), output: $$ }); break; -case 95: +case 98: /*! Production:: string : STRING_LIT */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2075,7 +2191,7 @@ case 95: this.$ = prepareString(yyvstack[yysp]); break; -case 97: +case 100: /*! Production:: options : OPTIONS option_list OPTIONS_END */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2086,7 +2202,7 @@ case 97: this.$ = null; break; -case 98: +case 101: /*! Production:: option_list : option option_list */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2097,7 +2213,7 @@ case 98: this.$ = null; break; -case 100: +case 103: /*! Production:: option : NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2109,7 +2225,7 @@ case 100: yy.options[yyvstack[yysp]] = true; break; -case 101: +case 104: /*! Production:: option : NAME "=" OPTION_STRING_VALUE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2121,9 +2237,9 @@ case 101: yy.options[yyvstack[yysp - 2]] = yyvstack[yysp]; break; -case 102: +case 105: /*! Production:: option : NAME "=" OPTION_VALUE */ -case 103: +case 106: /*! Production:: option : NAME "=" NAME */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2135,7 +2251,7 @@ case 103: yy.options[yyvstack[yysp - 2]] = parseValue(yyvstack[yysp]); break; -case 104: +case 107: /*! Production:: option : NAME "=" error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2149,14 +2265,14 @@ case 104: Internal error: option "${$option}" value assignment failure. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 2])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 2])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 105: +case 108: /*! Production:: option : error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2170,14 +2286,67 @@ case 105: Expected a valid option name (with optional value assignment). Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 108: +case 109: + /*! Production:: extra_lexer_module_code : optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yylstack[yysp]; + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + var rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = yyvstack[yysp]; + break; + +case 110: + /*! Production:: extra_lexer_module_code : extra_lexer_module_code include_macro_code optional_module_code_chunk */ + + // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): + this._$ = yyparser.yyMergeLocationInfo(yysp - 2, yysp); + // END of default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-) + + + // Each of the 3 chunks should be parse-able as a JS snippet on its own. + // + // Note: we have already checked the first section in a previous reduction + // of this rule, so we don't need to check that one again! + var rv = checkActionBlock(yyvstack[yysp - 1], yylstack[yysp - 1]); + if (rv) { + yyparser.yyError(rmCommonWS` + The source code %include-d into the extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} + `); + } + rv = checkActionBlock(yyvstack[yysp], yylstack[yysp]); + if (rv) { + yyparser.yyError(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(yylstack[yysp])} + `); + } + this.$ = yyvstack[yysp - 2] + yyvstack[yysp - 1] + yyvstack[yysp]; + break; + +case 111: /*! Production:: include_macro_code : INCLUDE PATH */ // default action (generated by JISON mode classic/merge :: VT,VA,VU,-,LT,LA,-,-): @@ -2190,7 +2359,7 @@ case 108: this.$ = '\n// Included by Jison: ' + yyvstack[yysp] + ':\n\n' + fileContent + '\n\n// End Of Include by Jison: ' + yyvstack[yysp] + '\n\n'; break; -case 109: +case 112: /*! Production:: include_macro_code : INCLUDE error */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): @@ -2203,19 +2372,19 @@ case 109: %include MUST be followed by a valid file path. Erroneous path: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp], yylstack[yysp - 1])} + ${yylexer.prettyPrintRange(yylstack[yysp], yylstack[yysp - 1])} Technical error report: ${yyvstack[yysp].errStr} `); break; -case 112: - /*! Production:: module_code_chunk : error */ +case 115: + /*! Production:: module_code_chunk : error CODE */ // default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-): - this.$ = yyvstack[yysp]; - this._$ = yylstack[yysp]; + this.$ = yyvstack[yysp - 1]; + this._$ = yyparser.yyMergeLocationInfo(yysp - 1, yysp); // END of default action (generated by JISON mode classic/merge :: VT,VA,-,-,LT,LA,-,-) @@ -2224,14 +2393,14 @@ case 112: Module code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, yylstack[yysp])} + ${yylexer.prettyPrintRange(yylstack[yysp - 1])} Technical error report: - ${yyvstack[yysp].errStr} + ${yyvstack[yysp - 1].errStr} `); break; -case 145: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! +case 151: // === NO_ACTION[1] :: ensures that anyone (but us) using this new state will fail dramatically! // error recovery reduction action (action generated by jison, // using the user-specified `%code error_recovery_reduction` %{...%} // code chunk below. @@ -2250,7 +2419,7 @@ table: bt({ 1, 1, 11, - 18, + 19, 21, 2, 2, @@ -2263,6 +2432,7 @@ table: bt({ 1, 1, 19, + 18, 11, 12, 18, @@ -2297,6 +2467,7 @@ table: bt({ 17, 23, 3, + 19, 30, 29, 30, @@ -2322,16 +2493,17 @@ table: bt({ 11, 1, 4, + c, + [55, 3], + 3, 3, - 2, - s, - [3, 3], 17, 16, 3, 3, 1, 3, + 7, s, [29, 3], 21, @@ -2344,6 +2516,7 @@ table: bt({ [3, 4], 6, 3, + 3, 23, s, [18, 3], @@ -2351,6 +2524,8 @@ table: bt({ 14, 1, 14, + 3, + 1, 20, 2, 17, @@ -2382,6 +2557,7 @@ table: bt({ c, [17, 10], 1, + 2, 3, 5, 9, @@ -2409,9 +2585,9 @@ table: bt({ 27, 63, c, - [54, 12], + [55, 13], c, - [11, 21], + [11, 20], 2, 20, 26, @@ -2435,18 +2611,21 @@ table: bt({ 65, 70, c, - [67, 13], + [19, 17], + 64, + c, + [85, 13], 9, c, [12, 9], c, - [125, 12], + [143, 12], c, - [123, 6], + [141, 6], c, [30, 3], c, - [59, 6], + [58, 6], s, [20, 7, 1], 28, @@ -2495,14 +2674,14 @@ table: bt({ [19, 7], 27, c, - [572, 11], + [590, 11], c, [12, 27], c, - [593, 3], + [611, 3], 61, c, - [612, 14], + [630, 14], c, [3, 3], 28, @@ -2512,7 +2691,7 @@ table: bt({ 28, 28, c, - [616, 11], + [634, 11], 88, 48, 2, @@ -2533,29 +2712,31 @@ table: bt({ 89, 90, c, - [630, 17], + [629, 17], 3, c, - [732, 13], + [750, 13], 67, c, - [733, 8], + [751, 8], 7, 20, 71, c, - [613, 24], + [691, 20], + c, + [632, 23], c, - [643, 65], + [662, 65], c, - [507, 145], + [526, 145], 2, 9, 11, c, - [769, 15], + [788, 15], c, - [789, 7], + [808, 7], 11, c, [201, 59], @@ -2571,44 +2752,46 @@ table: bt({ c, [4, 8], c, - [476, 33], + [495, 33], c, [11, 59], 3, 4, c, - [473, 8], + [449, 8], c, [401, 15], c, [27, 54], c, - [584, 11], + [603, 11], c, [11, 78], 52, c, [182, 11], c, - [664, 3], + [683, 3], 49, 50, 1, 51, 88, 1, + 53, + 1, 51, 1, 51, - 53, c, - [3, 7], + [5, 3], + 53, c, - [672, 16], + [647, 17], 2, 4, c, - [673, 13], + [691, 13], 66, 2, 28, @@ -2620,60 +2803,65 @@ table: bt({ c, [4, 3], c, - [642, 58], + [740, 8], c, - [525, 31], + [648, 57], c, - [522, 13], + [531, 31], c, - [750, 8], + [528, 13], c, - [662, 115], + [756, 8], c, - [562, 5], + [668, 115], c, - [315, 10], + [568, 5], + c, + [321, 10], 53, c, [13, 13], c, - [979, 3], + [1004, 3], c, [3, 9], c, - [988, 4], + [273, 4], c, - [987, 3], - 51, - 53, + [272, 3], c, - [300, 14], + [328, 5], c, - [973, 9], + [310, 14], + c, + [1001, 9], 1, c, - [487, 10], + [496, 10], c, [27, 7], c, [18, 36], c, - [1050, 14], + [1078, 14], c, [14, 14], 20, c, [15, 14], c, - [830, 20], + [461, 3], + 53, + c, + [843, 20], c, - [469, 3], + [480, 3], c, - [460, 16], + [474, 16], c, - [159, 14], + [163, 14], c, - [491, 18], + [505, 18], 6, 8 ]), @@ -2691,33 +2879,35 @@ table: bt({ c, [15, 12], s, - [2, 19], + [2, 20], c, - [31, 14], + [32, 14], s, [0, 8], c, [23, 3], c, - [56, 31], + [57, 32], c, - [62, 10], + [62, 9], c, - [112, 13], + [113, 13], c, [67, 4], c, [40, 20], c, - [78, 36], + [21, 18], c, - [123, 7], + [96, 36], + c, + [141, 7], c, [30, 28], c, - [203, 43], + [221, 43], c, - [205, 9], + [223, 9], c, [22, 34], c, @@ -2729,45 +2919,47 @@ table: bt({ c, [139, 19], c, - [655, 16], + [673, 16], c, [14, 5], c, [180, 13], c, - [194, 34], - s, - [0, 9], + [764, 35], + c, + [751, 9], + c, + [98, 19], c, - [98, 21], + [632, 31], c, - [643, 86], + [662, 75], c, - [492, 151], + [511, 151], c, - [494, 34], + [513, 34], c, [231, 35], c, - [802, 238], + [821, 238], c, - [716, 74], + [735, 74], c, - [44, 28], + [43, 27], c, - [708, 37], + [740, 39], c, - [522, 78], + [1202, 78], c, - [454, 163], + [756, 30], c, - [164, 19], + [696, 140], c, - [973, 11], + [1001, 31], c, - [830, 147], - s, - [2, 21] + [461, 114], + c, + [121, 58] ]), state: u([ s, @@ -2776,112 +2968,119 @@ table: bt({ 11, 12, 20, - 21, 22, - 24, + 23, 25, - 30, + 26, 31, + 32, + 37, 36, - 35, - 42, - 44, - 46, - 50, - 54, + 43, + 45, + 47, + 51, 55, 56, - 60, + 57, 61, + 62, 64, + 66, c, - [15, 5], - 65, + [16, 5], + 67, c, [5, 4], - 69, 71, - 72, + 73, + 74, c, [13, 5], - 73, + 75, c, [7, 6], - 74, + 76, c, [5, 4], - 75, + 77, c, [5, 4], + 81, + 78, 79, - 76, - 77, - 82, - 86, - 87, - 96, - 101, - 56, + 84, + 88, + 89, + 98, 103, + 57, 105, - 104, 108, + 107, 110, + 112, c, - [66, 7], - 111, - 114, + [67, 7], + 113, + 61, + 62, + 117, c, - [58, 11], + [60, 11], c, [6, 6], - 69, - 79, - 122, - 129, - 131, - 133, + 71, + 81, + 125, + 132, + 135, + 137, + 143, + 108, + 107, c, - [12, 5], - 139, + [15, 5], + 145, c, - [29, 5], - 105, - 140, - 142, + [32, 5], + 108, + 146, + 148, c, - [47, 8], + [52, 8], + 132, c, - [22, 5] + [23, 5] ]), mode: u([ s, [2, 23], s, [1, 12], - s, - [2, 28], - s, - [1, 15], - s, - [2, 33], c, - [39, 17], + [24, 13], + c, + [41, 28], + c, + [44, 15], c, - [13, 6], + [89, 27], c, - [18, 7], + [17, 13], c, - [64, 21], + [88, 11], c, - [21, 10], + [64, 34], c, - [106, 15], + [38, 14], c, - [75, 12], + [123, 15], + c, + [92, 12], 1, c, - [90, 10], + [107, 10], c, [27, 6], c, @@ -2909,141 +3108,152 @@ table: bt({ c, [409, 15], c, - [568, 9], + [585, 9], c, [47, 20], c, - [454, 17], + [45, 25], + c, + [36, 14], c, - [561, 23], + [578, 18], c, - [585, 53], + [602, 53], c, - [442, 145], + [459, 145], c, - [718, 19], + [735, 19], c, - [780, 33], + [797, 33], c, [29, 25], c, - [759, 238], + [776, 238], c, - [796, 51], + [813, 51], c, [289, 5], c, - [1211, 12], + [648, 7], + c, + [298, 21], c, - [722, 35], + [738, 18], c, - [340, 9], + [621, 8], c, - [648, 24], + [376, 7], c, - [854, 59], + [651, 22], c, - [1199, 170], + [874, 59], c, - [311, 6], + [1219, 170], c, - [969, 23], + [960, 9], c, - [1128, 90], + [947, 23], c, - [291, 66] + [1151, 89], + c, + [805, 17], + s, + [2, 53] ]), goto: u([ s, - [6, 11], + [9, 11], s, - [8, 11], - 5, + [11, 11], + 8, 5, s, [7, 4, 1], s, [13, 7, 1], s, - [7, 11], - s, - [31, 17], - 23, - 26, - 28, - 32, - 33, + [10, 11], 34, - 39, + 21, + s, + [34, 16], + 24, 27, 29, - 37, + 33, + 34, + 35, + 40, + 28, + 30, 38, + 39, + 42, 41, - 40, - 43, - 45, + 44, + 46, s, - [12, 11], + [15, 11], s, - [13, 11], + [16, 11], s, - [14, 11], - 47, + [17, 11], 48, 49, - 51, + 50, 52, 53, s, - [51, 11], + [54, 12], + 59, 58, - 57, 1, 2, - 4, - 55, - 62, + 7, + 58, + 63, s, - [55, 6], - 59, + [58, 6], + 60, s, - [55, 7], + [58, 7], s, - [9, 11], - 58, - 58, - 63, + [34, 17], s, - [58, 9], + [12, 11], + 61, + 61, + 65, + s, + [61, 9], c, - [108, 12], + [125, 12], s, - [66, 3], + [69, 3], c, [15, 5], s, - [66, 7], - 39, - 66, + [69, 7], + 40, + 69, c, [23, 7], - 68, - 68, - 67, - s, - [68, 3], + 71, + 71, c, - [7, 3], - s, - [68, 17], - 70, - 68, + [3, 3], + 71, 68, - 62, - 62, - 26, - 62, + 70, + s, + [71, 18], + 72, + 71, + 71, + 65, + 65, + 27, + 65, c, [68, 11], c, @@ -3053,197 +3263,200 @@ table: bt({ c, [12, 12], s, - [78, 29], - s, - [80, 29], - s, [81, 29], s, - [82, 29], - s, [83, 29], s, [84, 29], s, [85, 29], s, - [86, 31], - 37, - 78, + [86, 29], s, - [95, 29], - s, - [96, 29], + [87, 29], s, - [93, 29], + [88, 29], s, - [10, 9], + [89, 31], + 38, 80, - 10, - 10, s, - [26, 12], + [98, 29], s, - [11, 9], - 81, - 11, - 11, + [99, 29], + s, + [96, 29], + s, + [13, 9], + 82, + 13, + 13, s, - [28, 12], + [29, 12], + s, + [14, 9], 83, - 84, + 14, + 14, + s, + [31, 12], 85, + 86, + 87, s, - [17, 11], + [20, 11], s, - [22, 3], + [25, 3], s, - [23, 3], + [26, 3], 16, 16, - 20, - 21, - 98, + 23, + 24, + 100, s, - [88, 8, 1], - 97, + [90, 8, 1], 99, - 100, + 101, + 102, + 59, 58, - 57, - 99, - 100, 102, - 100, - 100, + 103, + 104, + 103, + 103, s, - [105, 3], - 114, - 107, - 114, + [108, 3], + 117, 106, - s, - [30, 17], + 117, 109, + s, + [33, 17], + 111, c, - [667, 13], - 112, - 113, + [684, 13], + 114, + 115, + 6, + c, + [630, 8], + 116, s, - [64, 3], + [58, 7], + s, + [67, 3], c, - [17, 5], + [34, 5], s, - [64, 7], - 39, - 64, + [67, 7], + 40, + 67, c, - [25, 6], - 64, + [42, 6], + 67, s, - [65, 3], + [68, 3], c, [24, 5], s, - [65, 7], - 39, - 65, + [68, 7], + 40, + 68, c, [24, 6], - 65, - s, - [67, 6], - 66, 68, + 70, + 70, + 69, + s, + [70, 3], + c, + [7, 3], s, - [67, 18], + [70, 17], + 72, + 70, 70, - 67, - 67, s, - [73, 29], + [76, 29], s, - [74, 29], + [77, 29], s, - [75, 29], + [78, 29], s, - [79, 29], + [82, 29], s, - [94, 29], - 116, - 117, - 115, - 61, - 61, - 26, - 61, - c, - [242, 11], + [97, 29], 119, - 117, + 120, 118, - 76, - 76, - 67, + 64, + 64, + 27, + 64, + c, + [259, 11], + 122, + 120, + 121, + 79, + 79, + 69, s, - [76, 3], - 66, + [79, 3], 68, - s, - [76, 18], 70, - 76, - 76, - 77, - 77, - 67, s, - [77, 3], - 66, - 68, + [79, 18], + 72, + 79, + 79, + 80, + 80, + 69, s, - [77, 18], + [80, 3], + 68, 70, - 77, - 77, - 121, - 37, - 120, - 78, - s, - [90, 4], - s, - [91, 4], - s, - [92, 4], s, - [27, 12], + [80, 18], + 72, + 80, + 80, + 124, + 38, + 123, + 80, s, - [29, 12], + [93, 4], s, - [15, 11], + [94, 4], s, - [16, 11], + [95, 4], s, - [24, 11], + [30, 12], s, - [25, 11], + [32, 12], s, [18, 11], s, [19, 11], s, - [40, 27], + [27, 11], s, - [41, 27], + [28, 11], s, - [42, 27], + [21, 11], s, - [43, 11], + [22, 11], s, - [44, 11], + [43, 27], s, - [45, 11], + [44, 27], + s, + [45, 27], s, [46, 11], s, @@ -3251,124 +3464,139 @@ table: bt({ s, [48, 11], s, - [49, 11], - s, - [50, 11], - 124, - 123, - s, - [97, 11], - 98, - 128, - 127, - 125, - 126, - 3, - 99, - 106, - 106, - 113, - 113, - 130, - s, - [110, 3], + [49, 11], s, - [112, 3], + [50, 11], s, - [32, 17], - 132, + [51, 11], + s, + [52, 11], + s, + [53, 11], + 127, + 126, s, - [37, 14], + [100, 11], + 101, + 131, + 130, + 128, + 129, + 3, + 101, + 5, + 133, + 109, + 109, + 116, + 116, 134, - 16, + s, + [113, 3], + s, + [35, 17], 136, - 135, - 137, + s, + [40, 14], 138, + 16, + 140, + 139, + 141, + 142, s, - [56, 3], + [59, 3], + 117, + 144, + 117, + 109, s, - [63, 3], + [66, 3], c, - [624, 5], + [627, 5], s, - [63, 7], - 39, - 63, + [66, 7], + 40, + 66, c, - [431, 6], - 63, + [434, 6], + 66, s, - [69, 29], + [72, 29], s, - [71, 29], - 60, - 60, - 26, - 60, + [74, 29], + 63, + 63, + 27, + 63, c, - [505, 11], + [508, 11], s, - [70, 29], + [73, 29], s, - [72, 29], + [75, 29], s, - [87, 29], + [90, 29], s, - [88, 29], + [91, 29], s, - [89, 4], + [92, 4], s, - [108, 13], + [111, 13], s, - [109, 13], + [112, 13], s, - [101, 3], + [104, 3], s, - [102, 3], + [105, 3], s, - [103, 3], + [106, 3], s, - [104, 3], + [107, 3], c, - [940, 4], + [259, 4], s, - [111, 3], - 141, + [115, 3], + s, + [114, 3], + 147, c, - [926, 13], - 35, - 35, - 143, + [949, 13], + 38, + 38, + 149, s, - [35, 15], + [38, 15], s, - [38, 18], + [41, 18], s, - [39, 18], + [42, 18], s, - [52, 14], + [55, 14], s, - [53, 14], - 144, + [56, 14], + 150, s, - [54, 14], - 59, - 59, - 26, - 59, + [57, 14], + 4, + 101, + 133, + 62, + 62, + 27, + 62, c, - [112, 11], - 107, - 107, + [115, 11], + 110, + 110, s, - [33, 17], + [36, 17], s, - [36, 14], + [39, 14], s, - [34, 17], + [37, 17], s, - [57, 3] + [60, 3] ]) }), defaultActions: bda({ @@ -3376,7 +3604,6 @@ defaultActions: bda({ 0, 2, 6, - 7, 11, 12, 13, @@ -3384,114 +3611,115 @@ defaultActions: bda({ 18, 19, 21, + 22, s, - [30, 8, 1], - 39, + [31, 8, 1], 40, + 41, s, - [41, 4, 2], - 48, + [42, 4, 2], 49, - 52, + 50, 53, - 58, - 60, + 54, + 59, + 61, s, - [66, 5, 1], + [68, 5, 1], s, - [77, 22, 1], - 100, - 101, - 104, - 106, + [79, 22, 1], + 102, + 103, 107, - 108, - 113, + 109, + 110, 115, - 116, + 118, + 119, s, - [118, 11, 1], - 130, + [121, 11, 1], + 133, + 134, s, - [133, 4, 1], - 138, + [137, 4, 1], + 142, s, - [140, 5, 1] + [146, 5, 1] ]), goto: u([ - 6, - 8, - 7, - 31, - 12, - 13, - 14, - 51, + 9, + 11, + 10, + 15, + 16, + 17, + 54, 1, 2, - 9, - 78, + 34, + 12, + 81, s, - [80, 7, 1], - 95, + [83, 7, 1], + 98, + 99, 96, - 93, + 29, + 31, + 20, + 25, 26, - 28, - 17, - 22, 23, - 20, - 21, - 105, + 24, + 108, + 33, + 76, + 77, + 78, + 82, + 97, + 93, + 94, + 95, 30, - 73, + 32, + 18, + 19, + 27, + 28, + 21, + 22, + s, + [43, 11, 1], + 100, + 101, + 109, + 113, + 35, + 59, + 72, 74, + 73, 75, - 79, - 94, 90, 91, 92, - 27, - 29, - 15, - 16, - 24, - 25, - 18, - 19, - s, - [40, 11, 1], - 97, - 98, - 106, - 110, + 111, 112, - 32, - 56, - 69, - 71, - 70, - 72, - 87, - 88, - 89, - 108, - 109, s, - [101, 4, 1], - 111, - 38, - 39, - 52, - 53, - 54, - 107, - 33, + [104, 4, 1], + 115, + 114, + 41, + 42, + 55, + 56, + 57, + 110, 36, - 34, - 57 + 39, + 37, + 60 ]) }), parseError: function parseError(str, hash, ExceptionClass) { @@ -3527,7 +3755,7 @@ parse: function parse(input) { var TERROR = this.TERROR; var EOF = this.EOF; var ERROR_RECOVERY_TOKEN_DISCARD_COUNT = (this.options.errorRecoveryTokenDiscardCount | 0) || 3; - var NO_ACTION = [0, 145 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; + var NO_ACTION = [0, 151 /* === table.length :: ensures that anyone using this new state will fail dramatically! */]; var lexer; if (this.__lexer__) { @@ -4863,6 +5091,8 @@ parser.originalParseError = parser.parseError; parser.originalQuoteName = parser.quoteName; var rmCommonWS = helpers.rmCommonWS; +var checkActionBlock = helpers.checkActionBlock; + function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); @@ -4916,7 +5146,7 @@ parser.yy.pre_parse = function p_lex() { parser.yy.post_lex = function p_lex() { if (parser.yydebug) parser.log('post_lex:', arguments); }; -/* lexer generated by jison-lex 0.6.1-204 */ +/* lexer generated by jison-lex 0.6.1-205 */ /* * Returns a Lexer object of the following structure: @@ -5277,8 +5507,22 @@ EOF: 1, constructLexErrorInfo: function lexer_constructLexErrorInfo(msg, recoverable, show_input_position) { msg = '' + msg; - if (this.yylloc) { - if (typeof this.showPosition === 'function') { + // heuristic to determine if the error message already contains a (partial) source code dump + // as produced by either `showPosition()` or `prettyPrintRange()`: + if (show_input_position == undefined) { + show_input_position = !(msg.indexOf('\n') > 0 && msg.indexOf('^') > 0); + } + + if (this.yylloc && show_input_position) { + if (typeof this.prettyPrintRange === 'function') { + var pretty_src = this.prettyPrintRange(this.yylloc); + + if (!/\n\s*$/.test(msg)) { + msg += '\n'; + } + + msg += '\n Erroneous area:\n' + this.prettyPrintRange(this.yylloc); + } else if (typeof this.showPosition === 'function') { var pos_str = this.showPosition(); if (pos_str) { @@ -5915,35 +6159,23 @@ EOF: 1, var lno_pfx = (ws_prefix + lno).substr(-lineno_display_width); var rv = lno_pfx + ': ' + line; var errpfx = new Array(lineno_display_width + 1).join('^'); + var offset = 2 + 1; + var len = 0; if (lno === loc.first_line) { - var offset = loc.first_column + 2; + offset += loc.first_column; - var len = Math.max( + len = Math.max( 2, ((lno === loc.last_line ? loc.last_column : line.length)) - loc.first_column + 1 ); - - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } } else if (lno === loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, loc.last_column + 1); - var lead = new Array(offset).join('.'); - var mark = new Array(len).join('^'); - rv += '\n' + errpfx + lead + mark; - - if (line.trim().length > 0) { - nonempty_line_indexes.push(index); - } + len = Math.max(2, loc.last_column + 1); } else if (lno > loc.first_line && lno < loc.last_line) { - var offset = 2 + 1; - var len = Math.max(2, line.length + 1); + len = Math.max(2, line.length + 1); + } + + if (len) { var lead = new Array(offset).join('.'); var mark = new Array(len).join('^'); rv += '\n' + errpfx + lead + mark; @@ -5962,15 +6194,6 @@ EOF: 1, if (nonempty_line_indexes.length > 2 * MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT) { var clip_start = nonempty_line_indexes[MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT - 1] + 1; var clip_end = nonempty_line_indexes[nonempty_line_indexes.length - MINIMUM_VISIBLE_NONEMPTY_LINE_COUNT] - 1; - - console.log('clip off: ', { - start: clip_start, - end: clip_end, - len: clip_end - clip_start + 1, - arr: nonempty_line_indexes, - rv - }); - var intermediate_line = new Array(lineno_display_width + 1).join(' ') + ' (...continued...)'; intermediate_line += '\n' + new Array(lineno_display_width + 1).join('-') + ' (---------------)'; rv.splice(clip_start, clip_end - clip_start + 1, intermediate_line); @@ -6405,7 +6628,7 @@ EOF: 1, case 0: /*! Conditions:: rules macro named_chunk INITIAL */ /*! Rule:: %\{ */ - yy.dept = 0; + yy.depth = 0; yy.include_command_allowed = false; this.pushState('action'); @@ -6417,7 +6640,7 @@ EOF: 1, case 1: /*! Conditions:: action */ /*! Rule:: %\{([^]*?)%\} */ - yy_.yytext = this.matches[1]; + yy_.yytext = this.matches[1].replace(/%\\\}/g, '%}'); // unescape any literal '%\}' that exists within the action code block yy.include_command_allowed = true; return 32; @@ -6554,13 +6777,13 @@ EOF: 1, too many closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse - easily; we suggest you wrap the action code chunk in '%{...%\}' + easily; we suggest you wrap the action code chunk in '%{...%}' to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); - return 'BRACKETS_SURPLUS'; + return 30; } else { yy.depth--; } @@ -6603,14 +6826,14 @@ EOF: 1, missing ${yy.depth} closing curly braces in lexer rule action block. Note: the action code chunk may be too complex for jison to parse - easily; we suggest you wrap the action code chunk in '%{...%\}' + easily; we suggest you wrap the action code chunk in '%{...%}' to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = ''; - return 'BRACKETS_MISSING'; + return 29; } this.popState(); @@ -6906,7 +7129,7 @@ EOF: 1, while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); yy_.yytext = [ this.matches[1], // {NAME} @@ -6986,7 +7209,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -6998,7 +7221,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7010,7 +7233,7 @@ EOF: 1, unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7022,7 +7245,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7034,7 +7257,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7046,7 +7269,7 @@ EOF: 1, unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7061,7 +7284,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7076,7 +7299,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7091,7 +7314,7 @@ EOF: 1, ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); return 2; break; @@ -7114,7 +7337,7 @@ EOF: 1, regex expression here in jison-lex ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); break; @@ -7126,7 +7349,7 @@ EOF: 1, while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yy_.yylloc)); + ` + this.prettyPrintRange(yy_.yylloc)); break; diff --git a/lex.l b/lex.l index d06d309..1bf5685 100644 --- a/lex.l +++ b/lex.l @@ -47,13 +47,13 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] %% -"%{" yy.dept = 0; +"%{" yy.depth = 0; yy.include_command_allowed = false; this.pushState('action'); this.unput(yytext); yytext = ''; return 'ACTION_START'; -"%{"([^]*?)"%}" yytext = this.matches[1]; +"%{"([^]*?)"%}" yytext = this.matches[1].replace(/%\\\}/g, '%}'); // unescape any literal '%\}' that exists within the action code block yy.include_command_allowed = true; return 'ACTION'; "%include" %{ @@ -134,8 +134,8 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); - return 'BRACKETS_SURPLUS'; + ` + this.prettyPrintRange(yylloc)); + return 'BRACKET_SURPLUS'; } else { yy.depth--; } @@ -170,9 +170,9 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] to help jison grok more or less complex action code chunks. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); yytext = ''; - return 'BRACKETS_MISSING'; + return 'BRACKET_MISSING'; } this.popState(); yytext = ''; @@ -193,10 +193,10 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] {BR}+ /* empty */ {WS}+{BR}+ /* empty */ -"//"[^\r\n]* - /* skip single-line comment */ -"/*"[^]*?"*/" - /* skip multi-line comment */ + +"//"[^\r\n]* /* skip single-line comment */ +"/*"[^]*?"*/" /* skip multi-line comment */ + // ACTION code chunks follow rules and are generally indented, but // never start with characters special to the lex language itself: // - `%` can start options, commands, etc., e.g. `%include` or `%options` @@ -206,13 +206,14 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] yy.include_command_allowed = true; this.pushState('action'); return 'ACTION_START'; + "%%" this.popState(); this.pushState('code'); return '%%'; + // Accept any non-regex-special character as a direct literal without // the need to put quotes around it: -{ANY_LITERAL_CHAR}+ - %{ +{ANY_LITERAL_CHAR}+ %{ // accept any non-regex, non-lex, non-string-delim, // non-escape-starter, non-space character as-is return 'CHARACTER_LIT'; @@ -304,7 +305,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); yytext = [ this.matches[1], // {NAME} this.matches[2].trim() // optional value/parameters @@ -357,38 +358,38 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); return 'error'; \' yyerror(rmCommonWS` unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); return 'error'; \` yyerror(rmCommonWS` unterminated string constant in lexer rule action block. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); return 'error'; \" yyerror(rmCommonWS` unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); return 'error'; \' yyerror(rmCommonWS` unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); return 'error'; \` yyerror(rmCommonWS` unterminated string constant in %options entry. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); return 'error'; <*>\" var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); @@ -397,7 +398,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); return 'error'; <*>\' var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); yyerror(rmCommonWS` @@ -405,7 +406,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); return 'error'; <*>\` var rules = (this.topState() === 'macro' ? 'macro\'s' : this.topState()); yyerror(rmCommonWS` @@ -413,7 +414,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); return 'error'; @@ -432,7 +433,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] regex expression here in jison-lex ${rules}. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); %} <*>. %{ @@ -441,7 +442,7 @@ ANY_LITERAL_CHAR [^\s\r\n<>\[\](){}.*+?:!=|%\/\\^$,\'\";] while lexing in ${dquote(this.topState())} state. Erroneous area: - ` + this.prettyPrintRange(this, yylloc)); + ` + this.prettyPrintRange(yylloc)); %} <*><> return 'EOF'; diff --git a/lex.y b/lex.y index d6bb19c..19e950f 100644 --- a/lex.y +++ b/lex.y @@ -51,6 +51,7 @@ lex | init definitions error EOF { yyerror(rmCommonWS` + There's an error in your lexer regex rules or epilogue. Maybe you did not correctly separate the lexer sections with a '%%' on an otherwise empty line? The lexer spec file should have this structure: @@ -59,10 +60,10 @@ lex %% rules %% // <-- optional! - extra_module_code // <-- optional! + extra_module_code // <-- optional epilogue! Erroneous code: - ${yylexer.prettyPrintRange(yylexer, @error)} + ${yylexer.prettyPrintRange(@error)} Technical error report: ${$error.errStr} @@ -73,12 +74,68 @@ lex rules_and_epilogue : '%%' rules '%%' extra_lexer_module_code { - if ($extra_lexer_module_code && $extra_lexer_module_code.trim() !== '') { + if ($extra_lexer_module_code.trim() !== '') { $$ = { rules: $rules, moduleInclude: $extra_lexer_module_code }; } else { $$ = { rules: $rules }; } } + | '%%' error rules '%%' extra_lexer_module_code + { + yyerror(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(@error)} + + Technical error report: + ${$error.errStr} + `); + } + | '%%' rules '%%' error + { + yyerror(rmCommonWS` + There's an error in your lexer epilogue a.k.a. 'extra_module_code' block. + + Erroneous code: + ${yylexer.prettyPrintRange(@error)} + + Technical error report: + ${$error.errStr} + `); + } + | '%%' error rules + { + yyerror(rmCommonWS` + There's probably an error in one or more of your lexer regex rules. + The lexer rule spec should have this structure: + + regex action_code + + where 'regex' is a lex-style regex expression (see the + jison and jison-lex documentation) which is intended to match a chunk + of the input to lex, while the 'action_code' block is the JS code + which will be invoked when the regex is matched. The 'action_code' block + may be any (indented!) set of JS statements, optionally surrounded + by '{...}' curly braces or otherwise enclosed in a '%{...%}' block. + + Erroneous code: + ${yylexer.prettyPrintRange(@error)} + + Technical error report: + ${$error.errStr} + `); + } | '%%' rules /* Note: an empty rules set is allowed when you are setting up an `%options custom_lexer` */ { @@ -135,7 +192,19 @@ definition | START_EXC names_exclusive { $$ = $names_exclusive; } | action - { yy.actionInclude.push($action); $$ = null; } + { + var rv = checkActionBlock($action, @action); + if (rv) { + yyerror(rmCommonWS` + The '%{...%}' lexer setup action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(@action)} + `); + } + yy.actionInclude.push($action); + $$ = null; + } | options { $$ = null; } | UNKNOWN_DECL @@ -149,7 +218,7 @@ definition %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, @error, @IMPORT)} + ${yylexer.prettyPrintRange(@error, @IMPORT)} Technical error report: ${$error.errStr} @@ -164,7 +233,7 @@ definition %import qualifier_name file_path Erroneous code: - ${yylexer.prettyPrintRange(yylexer, @error, @IMPORT)} + ${yylexer.prettyPrintRange(@error, @IMPORT)} Technical error report: ${$error.errStr} @@ -172,8 +241,17 @@ definition } | INIT_CODE init_code_name action { + var rv = checkActionBlock($action, @action); + if (rv) { + yyerror(rmCommonWS` + The '%code ${$init_code_name}' action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(@action, @INIT_CODE)} + `); + } $$ = { - type: 'codesection', + type: 'codesection', qualifier: $init_code_name, include: $action }; @@ -185,7 +263,7 @@ definition %code qualifier_name {action code} Erroneous code: - ${yylexer.prettyPrintRange(yylexer, @error, @INIT_CODE, @action)} + ${yylexer.prettyPrintRange(@error, @INIT_CODE, @action)} Technical error report: ${$error.errStr} @@ -261,7 +339,7 @@ rules_collective block. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, yylexer.mergeLocationInfo(##start_conditions, ##4), @start_conditions)} + ${yylexer.prettyPrintRange(yylexer.mergeLocationInfo(##start_conditions, ##4), @start_conditions)} Technical error report: ${$error.errStr} @@ -276,7 +354,7 @@ rules_collective as a terminating curly brace '}' could not be found. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, @error, @start_conditions)} + ${yylexer.prettyPrintRange(@error, @start_conditions)} Technical error report: ${$error.errStr} @@ -294,6 +372,15 @@ rule_block rule : regex action { + var rv = checkActionBlock($action, @action); + if (rv) { + yyerror(rmCommonWS` + The rule's action code section does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(@action)} + `); + } $$ = [$regex, $action]; } | regex error @@ -303,7 +390,7 @@ rule Lexer rule regex action code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, @error, @regex)} + ${yylexer.prettyPrintRange(@error, @regex)} Technical error report: ${$error.errStr} @@ -318,7 +405,7 @@ action Missing curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, @BRACKET_MISSING, @1)} + ${yylexer.prettyPrintRange(@BRACKET_MISSING, @1)} `); } | ACTION_START action_body BRACKET_SURPLUS @@ -327,7 +414,7 @@ action Too many curly braces: seems you did not correctly bracket a lexer rule action block in curly braces: '{ ... }'. Offending action body: - ${yylexer.prettyPrintRange(yylexer, @BRACKET_SURPLUS, @1)} + ${yylexer.prettyPrintRange(@BRACKET_SURPLUS, @1)} `); } | ACTION_START action_body ACTION_END @@ -370,7 +457,7 @@ action_body You may place the '%include' instruction only at the start/front of a line. It's use is not permitted at this position: - ${yylexer.prettyPrintRange(yylexer, @INCLUDE_PLACEMENT_ERROR, @action_body)} + ${yylexer.prettyPrintRange(@INCLUDE_PLACEMENT_ERROR, @action_body)} `); } | action_body error @@ -379,7 +466,7 @@ action_body Seems you did not correctly match curly braces '{ ... }' in a lexer rule action block. Erroneous code: - ${yylexer.prettyPrintRange(yylexer, @error, @action_body)} + ${yylexer.prettyPrintRange(@error, @action_body)} Technical error report: ${$error.errStr} @@ -398,7 +485,7 @@ start_conditions Seems you did not correctly terminate the start condition set <${$name_list.join(',')},???> with a terminating '>' Erroneous code: - ${yylexer.prettyPrintRange(yylexer, @error, @1)} + ${yylexer.prettyPrintRange(@error, @1)} Technical error report: ${$error.errStr} @@ -523,7 +610,7 @@ regex_base Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: - ${yylexer.prettyPrintRange(yylexer, @error, @1)} + ${yylexer.prettyPrintRange(@error, @1)} Technical error report: ${$error.errStr} @@ -535,7 +622,7 @@ regex_base Seems you did not correctly bracket a lex rule regex part in '(...)' braces. Unterminated regex part: - ${yylexer.prettyPrintRange(yylexer, @error, @SPECIAL_GROUP)} + ${yylexer.prettyPrintRange(@error, @SPECIAL_GROUP)} Technical error report: ${$error.errStr} @@ -578,7 +665,7 @@ any_group_regex Seems you did not correctly bracket a lex rule regex set in '[...]' brackets. Unterminated regex set: - ${yylexer.prettyPrintRange(yylexer, @error, @REGEX_SET_START)} + ${yylexer.prettyPrintRange(@error, @REGEX_SET_START)} Technical error report: ${$error.errStr} @@ -652,7 +739,7 @@ option Internal error: option "${$option}" value assignment failure. Erroneous area: - ${yylexer.prettyPrintRange(yylexer, @error, @option)} + ${yylexer.prettyPrintRange(@error, @option)} Technical error report: ${$error.errStr} @@ -665,7 +752,7 @@ option Expected a valid option name (with optional value assignment). Erroneous area: - ${yylexer.prettyPrintRange(yylexer, @error)} + ${yylexer.prettyPrintRange(@error)} Technical error report: ${$error.errStr} @@ -675,9 +762,44 @@ option extra_lexer_module_code : optional_module_code_chunk - { $$ = $optional_module_code_chunk; } + { + var rv = checkActionBlock($optional_module_code_chunk, @optional_module_code_chunk); + if (rv) { + yyerror(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(@optional_module_code_chunk)} + `); + } + $$ = $optional_module_code_chunk; + } | extra_lexer_module_code include_macro_code optional_module_code_chunk - { $$ = $extra_lexer_module_code + $include_macro_code + $optional_module_code_chunk; } + { + // Each of the 3 chunks should be parse-able as a JS snippet on its own. + // + // Note: we have already checked the first section in a previous reduction + // of this rule, so we don't need to check that one again! + var rv = checkActionBlock($include_macro_code, @include_macro_code); + if (rv) { + yyerror(rmCommonWS` + The source code %include-d into the extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(@include_macro_code)} + `); + } + rv = checkActionBlock($optional_module_code_chunk, @optional_module_code_chunk); + if (rv) { + yyerror(rmCommonWS` + The extra lexer module code section (a.k.a. 'epilogue') does not compile: ${rv} + + Erroneous area: + ${yylexer.prettyPrintRange(@optional_module_code_chunk)} + `); + } + $$ = $extra_lexer_module_code + $include_macro_code + $optional_module_code_chunk; + } ; include_macro_code @@ -693,7 +815,7 @@ include_macro_code %include MUST be followed by a valid file path. Erroneous path: - ${yylexer.prettyPrintRange(yylexer, @error, @INCLUDE)} + ${yylexer.prettyPrintRange(@error, @INCLUDE)} Technical error report: ${$error.errStr} @@ -706,14 +828,14 @@ module_code_chunk { $$ = $CODE; } | module_code_chunk CODE { $$ = $module_code_chunk + $CODE; } - | error + | error CODE { // TODO ... yyerror(rmCommonWS` Module code declaration error? Erroneous code: - ${yylexer.prettyPrintRange(yylexer, @error)} + ${yylexer.prettyPrintRange(@error)} Technical error report: ${$error.errStr} @@ -732,6 +854,8 @@ optional_module_code_chunk var rmCommonWS = helpers.rmCommonWS; +var checkActionBlock = helpers.checkActionBlock; + function encodeRE(s) { return s.replace(/([.*+?^${}()|\[\]\/\\])/g, '\\$1').replace(/\\\\u([a-fA-F0-9]{4})/g, '\\u$1'); diff --git a/package-lock.json b/package-lock.json index d34d2a2..6cd2370 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@gerhobbelt/lex-parser", - "version": "0.6.1-202", + "version": "0.6.1-205", "lockfileVersion": 1, "dependencies": { "@gerhobbelt/ast-types": { @@ -38,9 +38,9 @@ "dev": true }, "supports-color": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.4.0.tgz", - "integrity": "sha512-rKC3+DyXWgK0ZLKwmRsrkyHVZAjNkfzeehuFWdGGcqGDTZFH73+RH6S/RDAAxl9GusSjZSUWYLmT9N5pzXFOXQ==", + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-4.5.0.tgz", + "integrity": "sha1-vnoN5ITexcXN34s9WRJQRJEvY1s=", "dev": true } } @@ -49,11 +49,13 @@ "version": "0.12.7-11", "resolved": "https://registry.npmjs.org/@gerhobbelt/recast/-/recast-0.12.7-11.tgz", "integrity": "sha512-vjk3AMqq8bgg8Wf5B6n2OdWmpa9iyBYX+/N5+vTf9mz/+etm0YUHcgGdzX98f8tSTCUl+LEdMKNN4vteLbUsxg==", + "dev": true, "dependencies": { "@gerhobbelt/ast-types": { "version": "0.9.13-7", "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.13-7.tgz", - "integrity": "sha512-OKLyvezcD1X9WHXsKfDm2nLhwt1ybNRvErTqVeM5wlq6vQvNMkWKG6SLwG3Y08gkseZWKfe7enhPiJWoJORf3A==" + "integrity": "sha512-OKLyvezcD1X9WHXsKfDm2nLhwt1ybNRvErTqVeM5wlq6vQvNMkWKG6SLwG3Y08gkseZWKfe7enhPiJWoJORf3A==", + "dev": true } } }, @@ -259,6 +261,12 @@ "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", "dev": true }, + "babel-plugin-syntax-object-rest-spread": { + "version": "6.13.0", + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", + "dev": true + }, "babel-plugin-syntax-trailing-function-commas": { "version": "6.22.0", "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", @@ -409,6 +417,12 @@ "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", "dev": true }, + "babel-plugin-transform-object-rest-spread": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz", + "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", + "dev": true + }, "babel-plugin-transform-regenerator": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.26.0.tgz", @@ -436,15 +450,15 @@ } }, "babel-preset-env": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.0.tgz", - "integrity": "sha512-OVgtQRuOZKckrILgMA5rvctvFZPv72Gua9Rt006AiPoB0DJKGN07UmaQA+qRrYgK71MVct8fFhT0EyNWYorVew==", + "version": "1.6.1", + "resolved": "https://registry.npmjs.org/babel-preset-env/-/babel-preset-env-1.6.1.tgz", + "integrity": "sha512-W6VIyA6Ch9ePMI7VptNn2wBM6dbG0eSz25HEiL40nQXCsXGTGZSTZu1Iap+cj3Q0S5a7T9+529l/5Bkvd+afNA==", "dev": true }, "babel-preset-modern-browsers": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/babel-preset-modern-browsers/-/babel-preset-modern-browsers-9.0.2.tgz", - "integrity": "sha1-/YvgliILIM4jH8f8ZZ0v7Ehs/gQ=", + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-modern-browsers/-/babel-preset-modern-browsers-10.0.1.tgz", + "integrity": "sha512-OwJlaopcYWBjgw4jLkPRXaArpFzpdAdgn7ZDQdY6a284uAjpKGsFP3eRo7rxrXsvmDMcXXQu1CsQzg09IUQelQ==", "dev": true }, "babel-register": { @@ -548,9 +562,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30000746", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000746.tgz", - "integrity": "sha1-xk+Vo5Jc/TAgejCO12wa6W6gnqA=", + "version": "1.0.30000749", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000749.tgz", + "integrity": "sha1-L/OChlrq2MyjXaz7qwT1jv+kwBw=", "dev": true }, "chai": { @@ -677,9 +691,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.26", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.26.tgz", - "integrity": "sha1-mWQnKUhhp02cfIK5Jg6jAejALWY=", + "version": "1.3.27", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.27.tgz", + "integrity": "sha1-eOy4o5kGYYe7N07t412ccFZagD0=", "dev": true }, "error-ex": { @@ -1687,9 +1701,26 @@ } }, "jison-helpers-lib": { - "version": "0.6.1-203", - "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.6.1-203.tgz", - "integrity": "sha512-Pc8JW2rGm3ZpFtcYD3+uoZdVRmnyBPwzZc2SaPvriWbSPwsQpLOZjSGOq5WK6fuPZH0FhifHwr0YwHwiXS3hWw==" + "version": "0.6.1-205", + "resolved": "https://registry.npmjs.org/jison-helpers-lib/-/jison-helpers-lib-0.6.1-205.tgz", + "integrity": "sha512-b4iWlapl1cAU0/pZJmIDeJnEUXKMnt7NkwnNahG7gMZWQKV3ogaQOl3ByGWyThYQKQLgGWO4rTUDUlzwgrv4SQ==", + "dependencies": { + "@gerhobbelt/ast-types": { + "version": "0.9.14-9", + "resolved": "https://registry.npmjs.org/@gerhobbelt/ast-types/-/ast-types-0.9.14-9.tgz", + "integrity": "sha512-5TmMhHOh6OE5VbGJuKnbQ2LEzN5z15CB1zGpA3hUYb00jN+G6qk/Z0ZhRFubS8GTp0h+JJaqnxUIbxneoNnTIQ==" + }, + "@gerhobbelt/recast": { + "version": "0.12.7-14", + "resolved": "https://registry.npmjs.org/@gerhobbelt/recast/-/recast-0.12.7-14.tgz", + "integrity": "sha512-U1PM+EXUYDXWxLYZiEdd+y5Gk4XHBiAjxolWeCviq3kbxobZiQJI7DWWjG72Ptow3gpXZYi7tMSeumOkoxnPwQ==" + }, + "private": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", + "integrity": "sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg==" + } + } }, "js-tokens": { "version": "3.0.2", diff --git a/package.json b/package.json index 077bb42..3fc285e 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "url": "http://zaa.ch" }, "name": "@gerhobbelt/lex-parser", - "version": "0.6.1-204", + "version": "0.6.1-205", "description": "A parser for lexical grammars used by jison", "main": "dist/lex-parser-cjs-es5.js", "module": "lex-parser.js", @@ -29,14 +29,14 @@ }, "dependencies": { "@gerhobbelt/xregexp": "3.2.0-22", - "jison-helpers-lib": "0.6.1-203" + "jison-helpers-lib": "0.6.1-205" }, "devDependencies": { "babel-cli": "6.26.0", - "babel-preset-env": "1.6.0", - "babel-preset-modern-browsers": "9.0.2", + "babel-preset-env": "1.6.1", + "babel-preset-modern-browsers": "10.0.1", "chai": "4.1.2", - "jison-gho": "0.6.1-203", + "jison-gho": "0.6.1-205", "mocha": "4.0.1", "rollup-plugin-node-resolve": "3.0.0", "rollup": "0.50.0" diff --git a/tests/all-tests.js b/tests/all-tests.js index b945311..374e01d 100644 --- a/tests/all-tests.js +++ b/tests/all-tests.js @@ -244,10 +244,10 @@ describe("LEX Parser", function () { }); it("test include", function () { - var lexgrammar = '\nRULE [0-9]\n\n%{\n hi \n%}\n%%\n"["[^\\]]"]" %{\nreturn true;\n%}\n'; + var lexgrammar = '\nRULE [0-9]\n\n%{\n hi; {stuff;} \n%}\n%%\n"["[^\\]]"]" %{\nreturn true;\n%}\n'; var expected = { macros: {"RULE": "[0-9]"}, - actionInclude: "hi ", + actionInclude: "hi; {stuff;}", rules: [ ["\\[[^\\]]\\]", "return true;"] ], diff --git a/tests/lex/ansic.jisonlex b/tests/lex/ansic.jisonlex index 1b8e783..55ade4f 100644 --- a/tests/lex/ansic.jisonlex +++ b/tests/lex/ansic.jisonlex @@ -6,8 +6,8 @@ FS [fFlL] IS [uUlL]* %{ -#include -#include "y.tab.h" +//#include +//#include "y.tab.h" void count(); %} From 65716b1f96f361fe4d609fedd4f25b922a48309f Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Tue, 24 Oct 2017 10:28:33 +0200 Subject: [PATCH 416/417] obsoleted. point at jison monorepo. --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 284f22d..d67cbb6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# lex-parser \[SECONDARY SOURCE REPO] +# lex-parser \[OBSOLETED] [![Join the chat at https://gitter.im/jison-parsers-lexers/Lobby](https://badges.gitter.im/jison-parsers-lexers/Lobby.svg)](https://gitter.im/jison-parsers-lexers/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) @@ -14,13 +14,13 @@ A parser for lexical grammars used by [jison](http://jison.org) and jison-lex. > -> # deprecation ~ secondary-source notice +> # deprecation notice > -> From today (2017/oct/15) the lex-parser repository is only a **secondary source** +> From today (2017/oct/15) the lex-parser repository is **obsoleted** > for the `lex-parser` package/codebase: the **primary source** is the > [jison](https://github.com/GerHobbelt/jison) > [monorepo](https://medium.com/netscape/the-case-for-monorepos-907c1361708a)'s `packages/lex-parser/` -> directory. +> directory. See also https://github.com/GerHobbelt/jison/issues/16. > > (For a comparable argument, see also ["Why is Babel a monorepo?"](https://github.com/babel/babel/blob/master/doc/design/monorepo.md)) > From ef905a12326acf6060e7aff67b86f41507aa5ae2 Mon Sep 17 00:00:00 2001 From: Ger Hobbelt Date: Wed, 13 Dec 2017 02:50:02 +0100 Subject: [PATCH 417/417] reference the correct package to show the active npm version --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d67cbb6..88b99c3 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Join the chat at https://gitter.im/jison-parsers-lexers/Lobby](https://badges.gitter.im/jison-parsers-lexers/Lobby.svg)](https://gitter.im/jison-parsers-lexers/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://travis-ci.org/GerHobbelt/lex-parser.svg?branch=master)](https://travis-ci.org/GerHobbelt/lex-parser) -[![NPM version](https://badge.fury.io/js/@gerhobbelt/lex-parser.svg)](http://badge.fury.io/js/@gerhobbelt/lex-parser) +[![NPM version](https://badge.fury.io/js/jison-gho.svg)](https://badge.fury.io/js/jison-gho) [![Dependency Status](https://img.shields.io/david/GerHobbelt/lex-parser.svg)](https://david-dm.org/GerHobbelt/lex-parser) [![npm](https://img.shields.io/npm/dm/@gerhobbelt/lex-parser.svg?maxAge=2592000)]()