Comparing version 0.2.0 to 0.3.0
@@ -1,19 +0,97 @@ | ||
/* Jison generated parser */ | ||
/* 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=[1,9],$V1=[1,10],$V2=[1,11],$V3=[1,12],$V4=[1,13],$V5=[5,12,15,17,45,48],$V6=[1,21],$V7=[1,23],$V8=[1,24],$V9=[1,25],$Va=[1,18],$Vb=[1,20],$Vc=[1,26],$Vd=[14,32,34],$Ve=[14,30,32,34],$Vf=[1,38],$Vg=[1,34],$Vh=[1,35],$Vi=[1,36],$Vj=[1,37],$Vk=[13,38,41,42,43,44],$Vl=[17,20,22,45,48],$Vm=[1,47],$Vn=[13,20],$Vo=[5,12,15,17,20,22,45,48],$Vp=[1,70],$Vq=[32,34]; | ||
var parser = {trace: function trace() { }, | ||
yy: {}, | ||
symbols_: {"error":2,"file":3,"file_elements":4,"EOF":5,"element":6,"package":7,"import":8,"message":9,"enum":10,"option":11,"PACKAGE":12,"NAME":13,";":14,"IMPORT":15,"constant":16,"MESSAGE":17,"{":18,"message_body":19,"}":20,"message_field":21,"RULE":22,"=":23,"int":24,"message_field_options":25,"DEC":26,"HEX":27,"OCT":28,"[":29,"message_field_options_list":30,"]":31,"message_field_option":32,",":33,"FLOAT":34,"BOOL":35,"string":36,"QUOTE":37,"string_quoted":38,"string_quoted_char":39,"HEX_ESCAPE":40,"OCT_ESCAPE":41,"CHAR_ESCAPE":42,"NON_ESCAPED":43,"ENUM":44,"enum_fields":45,"enum_field":46,"OPTION":47,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",12:"PACKAGE",13:"NAME",14:";",15:"IMPORT",17:"MESSAGE",18:"{",20:"}",22:"RULE",23:"=",26:"DEC",27:"HEX",28:"OCT",29:"[",31:"]",33:",",34:"FLOAT",35:"BOOL",37:"QUOTE",40:"HEX_ESCAPE",41:"OCT_ESCAPE",42:"CHAR_ESCAPE",43:"NON_ESCAPED",44:"ENUM",47:"OPTION"}, | ||
productions_: [0,[3,2],[4,1],[4,2],[6,1],[6,1],[6,1],[6,1],[6,1],[7,3],[8,3],[9,5],[19,0],[19,2],[19,2],[19,2],[19,2],[21,7],[24,1],[24,1],[24,1],[25,0],[25,3],[30,1],[30,3],[32,3],[16,1],[16,1],[16,1],[16,1],[16,1],[36,3],[38,1],[38,2],[39,1],[39,1],[39,1],[39,1],[39,1],[10,5],[45,1],[45,2],[46,4],[11,5]], | ||
performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) { | ||
symbols_: {"error":2,"file":3,"file_elements":4,"EOF":5,"element":6,"package":7,"import":8,"message":9,"enum":10,"option":11,"PACKAGE":12,"NAME":13,";":14,"IMPORT":15,"constant":16,"MESSAGE":17,"{":18,"message_body":19,"}":20,"message_field":21,"RULE":22,"TYPE":23,"=":24,"int":25,"message_field_options":26,"DEC":27,"HEX":28,"OCT":29,"[":30,"message_field_options_list":31,"]":32,"message_field_option":33,",":34,"FLOAT":35,"BOOL":36,"string":37,"QUOTE":38,"string_quoted":39,"string_quoted_char":40,"HEX_ESCAPE":41,"OCT_ESCAPE":42,"CHAR_ESCAPE":43,"NON_ESCAPED":44,"ENUM":45,"enum_fields":46,"enum_field":47,"OPTION":48,"$accept":0,"$end":1}, | ||
terminals_: {2:"error",5:"EOF",12:"PACKAGE",13:"NAME",14:";",15:"IMPORT",17:"MESSAGE",18:"{",20:"}",22:"RULE",23:"TYPE",24:"=",27:"DEC",28:"HEX",29:"OCT",30:"[",32:"]",34:",",35:"FLOAT",36:"BOOL",38:"QUOTE",41:"HEX_ESCAPE",42:"OCT_ESCAPE",43:"CHAR_ESCAPE",44:"NON_ESCAPED",45:"ENUM",48:"OPTION"}, | ||
productions_: [0,[3,2],[4,1],[4,2],[6,1],[6,1],[6,1],[6,1],[6,1],[7,3],[8,3],[9,5],[19,0],[19,2],[19,2],[19,2],[19,2],[21,7],[25,1],[25,1],[25,1],[26,0],[26,3],[31,1],[31,3],[33,3],[16,1],[16,1],[16,1],[16,1],[16,1],[37,3],[39,1],[39,2],[40,1],[40,1],[40,1],[40,1],[40,1],[10,5],[46,1],[46,2],[47,4],[11,5]], | ||
performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { | ||
/* this == yyval */ | ||
var $0 = $$.length - 1; | ||
switch (yystate) { | ||
case 1: return this.$; | ||
case 1: | ||
return this.$; | ||
break; | ||
case 2: this.$ = [$$[$0]]; | ||
case 2: case 23: case 40: | ||
this.$ = [$$[$0]]; | ||
break; | ||
case 3: this.$ = $$[$0-1]; this.$.push($$[$0]); | ||
case 3: case 41: | ||
this.$ = $$[$0-1]; this.$.push($$[$0]); | ||
break; | ||
case 9: | ||
this.$ = { | ||
@@ -26,2 +104,3 @@ type: 'package', | ||
case 10: | ||
this.$ = { | ||
@@ -34,2 +113,3 @@ type: 'import', | ||
case 11: | ||
this.$ = { | ||
@@ -45,13 +125,19 @@ type: 'message', | ||
break; | ||
case 12: this.$ = {enums: [], options: [], messages: [], fields: []}; | ||
case 12: | ||
this.$ = {enums: [], options: [], messages: [], fields: []}; | ||
break; | ||
case 13: this.$ = $$[$0-1]; this.$.enums.push($$[$0]); | ||
case 13: | ||
this.$ = $$[$0-1]; this.$.enums.push($$[$0]); | ||
break; | ||
case 14: this.$ = $$[$0-1]; this.$.options.push($$[$0]); | ||
case 14: | ||
this.$ = $$[$0-1]; this.$.options.push($$[$0]); | ||
break; | ||
case 15: this.$ = $$[$0-1]; this.$.messages.push($$[$0]); | ||
case 15: | ||
this.$ = $$[$0-1]; this.$.messages.push($$[$0]); | ||
break; | ||
case 16: this.$ = $$[$0-1]; this.$.fields.push($$[$0]); | ||
case 16: | ||
this.$ = $$[$0-1]; this.$.fields.push($$[$0]); | ||
break; | ||
case 17: | ||
this.$ = { | ||
@@ -66,11 +152,13 @@ rule: $$[$0-6], | ||
break; | ||
case 21: this.$ = []; | ||
case 21: | ||
this.$ = []; | ||
break; | ||
case 22: this.$ = $$[$0-1]; | ||
case 22: case 31: | ||
this.$ = $$[$0-1]; | ||
break; | ||
case 23: this.$ = [$$[$0]]; | ||
case 24: | ||
this.$ = $$[$0-2]; this.$.push($$[$0]); | ||
break; | ||
case 24: this.$ = $$[$0-2]; this.$.push($$[$0]); | ||
break; | ||
case 25: | ||
this.$ = { | ||
@@ -83,29 +171,22 @@ type: 'option', | ||
break; | ||
case 26: this.$ = parseFloat($$[$0]); | ||
case 26: | ||
this.$ = parseFloat($$[$0]); | ||
break; | ||
case 27: this.$ = parseInt($$[$0]); | ||
case 27: | ||
this.$ = parseInt($$[$0]); | ||
break; | ||
case 28: this.$ = ($$[$0] == 'true'); | ||
case 28: | ||
this.$ = ($$[$0] == 'true'); | ||
break; | ||
case 29: this.$ = $$[$0]; | ||
case 29: case 30: case 32: case 37: case 38: | ||
this.$ = $$[$0]; | ||
break; | ||
case 30: this.$ = $$[$0]; | ||
case 33: | ||
this.$ = $$[$0-1] + $$[$0]; | ||
break; | ||
case 31: this.$ = $$[$0-1]; | ||
case 34: case 35: case 36: | ||
this.$ = parser.protobufCharUnescape($$[$0]); | ||
break; | ||
case 32: this.$ = $$[$0]; | ||
break; | ||
case 33: this.$ = $$[$0-1] + $$[$0]; | ||
break; | ||
case 34: this.$ = parser.protobufCharUnescape($$[$0]); | ||
break; | ||
case 35: this.$ = parser.protobufCharUnescape($$[$0]); | ||
break; | ||
case 36: this.$ = parser.protobufCharUnescape($$[$0]); | ||
break; | ||
case 37: this.$ = $$[$0]; | ||
break; | ||
case 38: this.$ = $$[$0]; | ||
break; | ||
case 39: | ||
this.$ = { | ||
@@ -118,7 +199,4 @@ type: 'enum', | ||
break; | ||
case 40: this.$ = [$$[$0]]; | ||
break; | ||
case 41: this.$ = $$[$0-1]; this.$.push($$[$0]); | ||
break; | ||
case 42: | ||
this.$ = {}; | ||
@@ -130,2 +208,3 @@ this.$.name = $$[$0-3]; | ||
case 43: | ||
this.$ = { | ||
@@ -140,20 +219,35 @@ type: 'option', | ||
}, | ||
table: [{3:1,4:2,6:3,7:4,8:5,9:6,10:7,11:8,12:[1,9],15:[1,10],17:[1,11],44:[1,12],47:[1,13]},{1:[3]},{5:[1,14],6:15,7:4,8:5,9:6,10:7,11:8,12:[1,9],15:[1,10],17:[1,11],44:[1,12],47:[1,13]},{5:[2,2],12:[2,2],15:[2,2],17:[2,2],44:[2,2],47:[2,2]},{5:[2,4],12:[2,4],15:[2,4],17:[2,4],44:[2,4],47:[2,4]},{5:[2,5],12:[2,5],15:[2,5],17:[2,5],44:[2,5],47:[2,5]},{5:[2,6],12:[2,6],15:[2,6],17:[2,6],44:[2,6],47:[2,6]},{5:[2,7],12:[2,7],15:[2,7],17:[2,7],44:[2,7],47:[2,7]},{5:[2,8],12:[2,8],15:[2,8],17:[2,8],44:[2,8],47:[2,8]},{13:[1,16]},{13:[1,21],16:17,24:19,26:[1,23],27:[1,24],28:[1,25],34:[1,18],35:[1,20],36:22,37:[1,26]},{13:[1,27]},{13:[1,28]},{13:[1,29]},{1:[2,1]},{5:[2,3],12:[2,3],15:[2,3],17:[2,3],44:[2,3],47:[2,3]},{14:[1,30]},{14:[1,31]},{14:[2,26],31:[2,26],33:[2,26]},{14:[2,27],31:[2,27],33:[2,27]},{14:[2,28],31:[2,28],33:[2,28]},{14:[2,29],31:[2,29],33:[2,29]},{14:[2,30],31:[2,30],33:[2,30]},{14:[2,18],29:[2,18],31:[2,18],33:[2,18]},{14:[2,19],29:[2,19],31:[2,19],33:[2,19]},{14:[2,20],29:[2,20],31:[2,20],33:[2,20]},{13:[1,38],38:32,39:33,40:[1,34],41:[1,35],42:[1,36],43:[1,37]},{18:[1,39]},{18:[1,40]},{23:[1,41]},{5:[2,9],12:[2,9],15:[2,9],17:[2,9],44:[2,9],47:[2,9]},{5:[2,10],12:[2,10],15:[2,10],17:[2,10],44:[2,10],47:[2,10]},{13:[1,38],37:[1,42],39:43,40:[1,34],41:[1,35],42:[1,36],43:[1,37]},{13:[2,32],37:[2,32],40:[2,32],41:[2,32],42:[2,32],43:[2,32]},{13:[2,34],37:[2,34],40:[2,34],41:[2,34],42:[2,34],43:[2,34]},{13:[2,35],37:[2,35],40:[2,35],41:[2,35],42:[2,35],43:[2,35]},{13:[2,36],37:[2,36],40:[2,36],41:[2,36],42:[2,36],43:[2,36]},{13:[2,37],37:[2,37],40:[2,37],41:[2,37],42:[2,37],43:[2,37]},{13:[2,38],37:[2,38],40:[2,38],41:[2,38],42:[2,38],43:[2,38]},{17:[2,12],19:44,20:[2,12],22:[2,12],44:[2,12],47:[2,12]},{13:[1,47],45:45,46:46},{13:[1,21],16:48,24:19,26:[1,23],27:[1,24],28:[1,25],34:[1,18],35:[1,20],36:22,37:[1,26]},{14:[2,31],31:[2,31],33:[2,31]},{13:[2,33],37:[2,33],40:[2,33],41:[2,33],42:[2,33],43:[2,33]},{9:52,10:50,11:51,17:[1,11],20:[1,49],21:53,22:[1,54],44:[1,12],47:[1,13]},{13:[1,47],20:[1,55],46:56},{13:[2,40],20:[2,40]},{23:[1,57]},{14:[1,58]},{5:[2,11],12:[2,11],15:[2,11],17:[2,11],20:[2,11],22:[2,11],44:[2,11],47:[2,11]},{17:[2,13],20:[2,13],22:[2,13],44:[2,13],47:[2,13]},{17:[2,14],20:[2,14],22:[2,14],44:[2,14],47:[2,14]},{17:[2,15],20:[2,15],22:[2,15],44:[2,15],47:[2,15]},{17:[2,16],20:[2,16],22:[2,16],44:[2,16],47:[2,16]},{13:[1,59]},{5:[2,39],12:[2,39],15:[2,39],17:[2,39],20:[2,39],22:[2,39],44:[2,39],47:[2,39]},{13:[2,41],20:[2,41]},{24:60,26:[1,23],27:[1,24],28:[1,25]},{5:[2,43],12:[2,43],15:[2,43],17:[2,43],20:[2,43],22:[2,43],44:[2,43],47:[2,43]},{13:[1,61]},{14:[1,62]},{23:[1,63]},{13:[2,42],20:[2,42]},{24:64,26:[1,23],27:[1,24],28:[1,25]},{14:[2,21],25:65,29:[1,66]},{14:[1,67]},{13:[1,70],30:68,32:69},{17:[2,17],20:[2,17],22:[2,17],44:[2,17],47:[2,17]},{31:[1,71],33:[1,72]},{31:[2,23],33:[2,23]},{23:[1,73]},{14:[2,22]},{13:[1,70],32:74},{13:[1,21],16:75,24:19,26:[1,23],27:[1,24],28:[1,25],34:[1,18],35:[1,20],36:22,37:[1,26]},{31:[2,24],33:[2,24]},{31:[2,25],33:[2,25]}], | ||
table: [{3:1,4:2,6:3,7:4,8:5,9:6,10:7,11:8,12:$V0,15:$V1,17:$V2,45:$V3,48:$V4},{1:[3]},{5:[1,14],6:15,7:4,8:5,9:6,10:7,11:8,12:$V0,15:$V1,17:$V2,45:$V3,48:$V4},o($V5,[2,2]),o($V5,[2,4]),o($V5,[2,5]),o($V5,[2,6]),o($V5,[2,7]),o($V5,[2,8]),{13:[1,16]},{13:$V6,16:17,25:19,27:$V7,28:$V8,29:$V9,35:$Va,36:$Vb,37:22,38:$Vc},{13:[1,27]},{13:[1,28]},{13:[1,29]},{1:[2,1]},o($V5,[2,3]),{14:[1,30]},{14:[1,31]},o($Vd,[2,26]),o($Vd,[2,27]),o($Vd,[2,28]),o($Vd,[2,29]),o($Vd,[2,30]),o($Ve,[2,18]),o($Ve,[2,19]),o($Ve,[2,20]),{13:$Vf,39:32,40:33,41:$Vg,42:$Vh,43:$Vi,44:$Vj},{18:[1,39]},{18:[1,40]},{24:[1,41]},o($V5,[2,9]),o($V5,[2,10]),{13:$Vf,38:[1,42],40:43,41:$Vg,42:$Vh,43:$Vi,44:$Vj},o($Vk,[2,32]),o($Vk,[2,34]),o($Vk,[2,35]),o($Vk,[2,36]),o($Vk,[2,37]),o($Vk,[2,38]),o($Vl,[2,12],{19:44}),{13:$Vm,46:45,47:46},{13:$V6,16:48,25:19,27:$V7,28:$V8,29:$V9,35:$Va,36:$Vb,37:22,38:$Vc},o($Vd,[2,31]),o($Vk,[2,33]),{9:52,10:50,11:51,17:$V2,20:[1,49],21:53,22:[1,54],45:$V3,48:$V4},{13:$Vm,20:[1,55],47:56},o($Vn,[2,40]),{24:[1,57]},{14:[1,58]},o($Vo,[2,11]),o($Vl,[2,13]),o($Vl,[2,14]),o($Vl,[2,15]),o($Vl,[2,16]),{23:[1,59]},o($Vo,[2,39]),o($Vn,[2,41]),{25:60,27:$V7,28:$V8,29:$V9},o($Vo,[2,43]),{13:[1,61]},{14:[1,62]},{24:[1,63]},o($Vn,[2,42]),{25:64,27:$V7,28:$V8,29:$V9},{14:[2,21],26:65,30:[1,66]},{14:[1,67]},{13:$Vp,31:68,33:69},o($Vl,[2,17]),{32:[1,71],34:[1,72]},o($Vq,[2,23]),{24:[1,73]},{14:[2,22]},{13:$Vp,33:74},{13:$V6,16:75,25:19,27:$V7,28:$V8,29:$V9,35:$Va,36:$Vb,37:22,38:$Vc},o($Vq,[2,24]),o($Vq,[2,25])], | ||
defaultActions: {14:[2,1],71:[2,22]}, | ||
parseError: function parseError(str, hash) { | ||
throw new Error(str); | ||
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; | ||
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 = 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; | ||
} | ||
function popStack(n) { | ||
@@ -164,10 +258,11 @@ stack.length = stack.length - 2 * n; | ||
} | ||
function lex() { | ||
var token; | ||
token = self.lexer.lex() || 1; | ||
if (typeof token !== "number") { | ||
token = self.symbols_[token] || token; | ||
_token_stack: | ||
function lex() { | ||
var token; | ||
token = lexer.lex() || EOF; | ||
if (typeof token !== 'number') { | ||
token = self.symbols_[token] || token; | ||
} | ||
return token; | ||
} | ||
return token; | ||
} | ||
var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; | ||
@@ -179,3 +274,3 @@ while (true) { | ||
} else { | ||
if (symbol === null || typeof symbol == "undefined") { | ||
if (symbol === null || typeof symbol == 'undefined') { | ||
symbol = lex(); | ||
@@ -185,20 +280,25 @@ } | ||
} | ||
if (typeof action === "undefined" || !action.length || !action[0]) { | ||
var errStr = ""; | ||
if (!recovering) { | ||
if (typeof action === 'undefined' || !action.length || !action[0]) { | ||
var errStr = ''; | ||
expected = []; | ||
for (p in table[state]) | ||
if (this.terminals_[p] && p > 2) { | ||
expected.push("'" + this.terminals_[p] + "'"); | ||
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) + "'"; | ||
} | ||
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 == 1?"end of input":"'" + (this.terminals_[symbol] || symbol) + "'"); | ||
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}); | ||
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); | ||
throw new Error('Parse Error: multiple actions possible at state: ' + state + ', token: ' + symbol); | ||
} | ||
@@ -208,13 +308,14 @@ switch (action[0]) { | ||
stack.push(symbol); | ||
vstack.push(this.lexer.yytext); | ||
lstack.push(this.lexer.yylloc); | ||
vstack.push(lexer.yytext); | ||
lstack.push(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) | ||
yyleng = lexer.yyleng; | ||
yytext = lexer.yytext; | ||
yylineno = lexer.yylineno; | ||
yyloc = lexer.yylloc; | ||
if (recovering > 0) { | ||
recovering--; | ||
} | ||
} else { | ||
@@ -228,8 +329,24 @@ symbol = preErrorSymbol; | ||
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}; | ||
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]]; | ||
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") { | ||
r = this.performAction.apply(yyval, [ | ||
yytext, | ||
yyleng, | ||
yylineno, | ||
sharedState.yy, | ||
action[1], | ||
vstack, | ||
lstack | ||
].concat(args)); | ||
if (typeof r !== 'undefined') { | ||
return r; | ||
@@ -253,7 +370,9 @@ } | ||
return true; | ||
} | ||
}; | ||
/* Jison generated lexer */ | ||
}}; | ||
/* generated by jison-lex 0.3.4 */ | ||
var lexer = (function(){ | ||
var lexer = ({EOF:1, | ||
var lexer = ({ | ||
EOF:1, | ||
parseError:function parseError(str, hash) { | ||
@@ -266,13 +385,25 @@ if (this.yy.parser) { | ||
}, | ||
setInput:function (input) { | ||
// resets the lexer, sets new input | ||
setInput:function (input, yy) { | ||
this.yy = yy || this.yy || {}; | ||
this._input = input; | ||
this._more = this._less = this.done = false; | ||
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.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 () { | ||
@@ -292,3 +423,5 @@ var ch = this._input[0]; | ||
} | ||
if (this.options.ranges) this.yylloc.range[1]++; | ||
if (this.options.ranges) { | ||
this.yylloc.range[1]++; | ||
} | ||
@@ -298,2 +431,4 @@ this._input = this._input.slice(1); | ||
}, | ||
// unshifts one char (or a string) into the input | ||
unput:function (ch) { | ||
@@ -304,19 +439,23 @@ var len = ch.length; | ||
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); | ||
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 - 1); | ||
this.matched = this.matched.substr(0, this.matched.length - 1); | ||
if (lines.length-1) this.yylineno -= lines.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_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 | ||
}; | ||
}; | ||
@@ -326,4 +465,7 @@ if (this.options.ranges) { | ||
} | ||
this.yyleng = this.yytext.length; | ||
return this; | ||
}, | ||
// When called from action, caches matched text and appends it on next action | ||
more:function () { | ||
@@ -333,5 +475,24 @@ this._more = true; | ||
}, | ||
// 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 () { | ||
@@ -341,2 +502,4 @@ var past = this.matched.substr(0, this.matched.length - this.match.length); | ||
}, | ||
// displays upcoming input, i.e. for error messages | ||
upcomingInput:function () { | ||
@@ -347,9 +510,85 @@ var next = this.match; | ||
} | ||
return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, ""); | ||
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+"^"; | ||
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 () { | ||
@@ -359,3 +598,5 @@ if (this.done) { | ||
} | ||
if (!this._input) this.done = true; | ||
if (!this._input) { | ||
this.done = true; | ||
} | ||
@@ -365,5 +606,3 @@ var token, | ||
tempMatch, | ||
index, | ||
col, | ||
lines; | ||
index; | ||
if (!this._more) { | ||
@@ -374,3 +613,3 @@ this.yytext = ''; | ||
var rules = this._currentRules(); | ||
for (var i=0;i < rules.length; i++) { | ||
for (var i = 0; i < rules.length; i++) { | ||
tempMatch = this._input.match(this.rules[rules[i]]); | ||
@@ -380,26 +619,25 @@ if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { | ||
index = i; | ||
if (!this.options.flex) break; | ||
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) { | ||
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]; | ||
token = this.test_match(match, rules[index]); | ||
if (token !== false) { | ||
return token; | ||
} | ||
this._more = false; | ||
this._input = this._input.slice(match[0].length); | ||
this.matched += match[0]; | ||
token = this.performAction.call(this, this.yy, this, rules[index],this.conditionStack[this.conditionStack.length-1]); | ||
if (this.done && this._input) this.done = false; | ||
if (token) return token; | ||
else return; | ||
// else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) | ||
return false; | ||
} | ||
@@ -409,9 +647,14 @@ if (this._input === "") { | ||
} else { | ||
return this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(), | ||
{text: "", token: null, line: this.yylineno}); | ||
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 (typeof r !== 'undefined') { | ||
if (r) { | ||
return r; | ||
@@ -422,20 +665,48 @@ } else { | ||
}, | ||
// 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() { | ||
return this.conditionStack.pop(); | ||
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() { | ||
return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules; | ||
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; | ||
} | ||
}, | ||
topState:function () { | ||
return this.conditionStack[this.conditionStack.length-2]; | ||
// 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"; | ||
} | ||
}, | ||
pushState:function begin(condition) { | ||
// alias for begin(condition) | ||
pushState:function pushState(condition) { | ||
this.begin(condition); | ||
}}); | ||
lexer.options = {}; | ||
lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { | ||
}, | ||
// 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) { | ||
parser.protobufCharUnescape = function (chr) { | ||
@@ -481,3 +752,3 @@ if (chr[0] !== "\\") { | ||
var YYSTATE=YY_START | ||
var YYSTATE=YY_START; | ||
switch($avoiding_name_collisions) { | ||
@@ -488,13 +759,13 @@ case 0:return 5; | ||
break; | ||
case 2:this.popState(); return 14; | ||
case 2:return 13; | ||
break; | ||
case 3:return 13; | ||
case 3:this.begin('string_quoted_content'); parser.protobufCharUnescapeCurrentQuote = this.match; return 38; | ||
break; | ||
case 4:this.begin('string_quoted_content'); parser.protobufCharUnescapeCurrentQuote = this.match; return 37; | ||
case 4:this.popState(); return 14; | ||
break; | ||
case 5:this.begin('package'); return 12; | ||
break; | ||
case 6:this.popState(); return 14; | ||
case 6:return 13; | ||
break; | ||
case 7:return 13; | ||
case 7:this.popState(); return 14; | ||
break; | ||
@@ -509,35 +780,35 @@ case 8:this.begin('message'); return 17; | ||
break; | ||
case 12:this.begin('enum'); return 44; | ||
case 12:this.begin('enum'); return 45; | ||
break; | ||
case 13:this.begin('option'); return 47; | ||
case 13:this.begin('option'); return 48; | ||
break; | ||
case 14:this.begin('message'); return 17; | ||
break; | ||
case 15:this.begin('message_field'); return 22; | ||
case 15:this.begin('message_field_type'); return 22; | ||
break; | ||
case 16:this.popState(); return 14; | ||
case 16:this.begin('message_field_after_type'); return 23; | ||
break; | ||
case 17:return 13; | ||
break; | ||
case 18:return 23; | ||
case 18:return 24; | ||
break; | ||
case 19:return 26; | ||
case 19:return 27; | ||
break; | ||
case 20:return 27; | ||
case 20:return 28; | ||
break; | ||
case 21:return 28; | ||
case 21:return 29; | ||
break; | ||
case 22:return 34; | ||
case 22:return 35; | ||
break; | ||
case 23:return 35; | ||
case 23:return 36; | ||
break; | ||
case 24:this.begin('message_field_options'); return 29; | ||
case 24:this.popState(); this.popState(); return 14; | ||
break; | ||
case 25:this.begin('message_field_option'); return 13; | ||
case 25:this.begin('message_field_options'); return 30; | ||
break; | ||
case 26:this.begin('message_field_option_value'); return 23; | ||
case 26:this.begin('message_field_option'); return 13; | ||
break; | ||
case 27:return 34; | ||
case 27:this.begin('message_field_option_value'); return 24; | ||
break; | ||
case 28:return 26; | ||
case 28:return 35; | ||
break; | ||
@@ -548,15 +819,15 @@ case 29:return 27; | ||
break; | ||
case 31:return 35; | ||
case 31:return 29; | ||
break; | ||
case 32:return 13; | ||
case 32:return 36; | ||
break; | ||
case 33:this.begin('string_quoted_content'); parser.protobufCharUnescapeCurrentQuote = this.match; return 37; | ||
case 33:return 13; | ||
break; | ||
case 34:this.popState(); this.popState(); return 33; | ||
case 34:this.begin('string_quoted_content'); parser.protobufCharUnescapeCurrentQuote = this.match; return 38; | ||
break; | ||
case 35:this.popState(); this.popState(); this.popState(); return 31; | ||
case 35:this.popState(); this.popState(); return 34; | ||
break; | ||
case 36:return 43; | ||
case 36:this.popState(); this.popState(); this.popState(); return 32; | ||
break; | ||
case 37:return 40; | ||
case 37:return 44; | ||
break; | ||
@@ -567,21 +838,21 @@ case 38:return 41; | ||
break; | ||
case 40:if (parser.protobufCharUnescapeCurrentQuote === this.match) { this.popState(); return 37; } else { return 'NON_ESCAPED'; } | ||
case 40:return 43; | ||
break; | ||
case 41:return 43; | ||
case 41:if (parser.protobufCharUnescapeCurrentQuote === this.match) { this.popState(); return 38; } else { return 44; } | ||
break; | ||
case 42:this.begin('enum'); return 44; | ||
case 42:return 44; | ||
break; | ||
case 43:return 13; | ||
case 43:this.begin('enum'); return 45; | ||
break; | ||
case 44:this.begin('enum_body'); return 18; | ||
case 44:return 13; | ||
break; | ||
case 45:this.popState(); this.popState(); return 20; | ||
case 45:this.begin('enum_body'); return 18; | ||
break; | ||
case 46:this.begin('enum_field'); return 13; | ||
case 46:this.popState(); this.popState(); return 20; | ||
break; | ||
case 47:this.popState(); return 14; | ||
case 47:this.begin('enum_field'); return 13; | ||
break; | ||
case 48:return 23; | ||
case 48:this.popState(); return 14; | ||
break; | ||
case 49:return 26; | ||
case 49:return 24; | ||
break; | ||
@@ -592,13 +863,13 @@ case 50:return 27; | ||
break; | ||
case 52:this.begin('option'); return 47; | ||
case 52:return 29; | ||
break; | ||
case 53:this.popState(); this.popState(); return 14; | ||
case 53:this.begin('option'); return 48; | ||
break; | ||
case 54:return 13; | ||
case 54:this.popState(); this.popState(); return 14; | ||
break; | ||
case 55:this.begin('option_value'); return 23; | ||
case 55:return 13; | ||
break; | ||
case 56:return 34; | ||
case 56:this.begin('option_value'); return 24; | ||
break; | ||
case 57:return 26; | ||
case 57:return 35; | ||
break; | ||
@@ -609,9 +880,11 @@ case 58:return 27; | ||
break; | ||
case 60:return 35; | ||
case 60:return 29; | ||
break; | ||
case 61:return 13; | ||
case 61:return 36; | ||
break; | ||
case 62:this.begin('string_quoted_content'); parser.protobufCharUnescapeCurrentQuote = this.match; return 37; | ||
case 62:return 13; | ||
break; | ||
case 63: | ||
case 63:this.begin('string_quoted_content'); parser.protobufCharUnescapeCurrentQuote = this.match; return 38; | ||
break; | ||
case 64: | ||
if (yy_.yytext.match(/\r|\n/) && parser.restricted) { | ||
@@ -624,3 +897,3 @@ parser.restricted = false; | ||
break; | ||
case 64: | ||
case 65: | ||
if (yy_.yytext.match(/\r|\n/) && parser.restricted) { | ||
@@ -633,33 +906,37 @@ parser.restricted = false; | ||
break; | ||
case 65:/* skip whitespaces */ | ||
case 66:/* skip whitespaces */ | ||
break; | ||
case 66:return 'INVALID' | ||
case 67:return 'INVALID' | ||
break; | ||
} | ||
}; | ||
lexer.rules = [/^(?:$)/,/^(?:import\b)/,/^(?:;)/,/^(?:(([A-Za-z0-9\-_\/\.]+)))/,/^(?:((['"])))/,/^(?:package\b)/,/^(?:;)/,/^(?:(([A-Za-z_][A-Za-z0-9_]*)))/,/^(?:message\b)/,/^(?:(([A-Za-z_][A-Za-z0-9_]*)))/,/^(?:\{)/,/^(?:\})/,/^(?:enum\b)/,/^(?:option\b)/,/^(?:message\b)/,/^(?:((required|optional|repeated)))/,/^(?:;)/,/^(?:(([A-Za-z_][A-Za-z0-9_]*)))/,/^(?:=)/,/^(?:(([1-9][0-9]*)))/,/^(?:(([xX][A-Fa-f0-9]+)))/,/^(?:(([0-7]+)))/,/^(?:((\d+(\.\d+)?([Ee][\+-]?\d+)?)))/,/^(?:((true|false)))/,/^(?:\[)/,/^(?:(([A-Za-z_][A-Za-z0-9_]*)))/,/^(?:=)/,/^(?:((\d+(\.\d+)?([Ee][\+-]?\d+)?)))/,/^(?:(([1-9][0-9]*)))/,/^(?:(([xX][A-Fa-f0-9]+)))/,/^(?:(([0-7]+)))/,/^(?:((true|false)))/,/^(?:(([A-Za-z_][A-Za-z0-9_]*)))/,/^(?:((['"])))/,/^(?:,)/,/^(?:\])/,/^(?:\s+)/,/^(?:((\\[Xx][A-Fa-f0-9]{1,2})))/,/^(?:((\\?[0-7]{1,3})))/,/^(?:((\\[abfnrtv\\/'"])))/,/^(?:((['"])))/,/^(?:(([^\0\n])))/,/^(?:enum\b)/,/^(?:(([A-Za-z_][A-Za-z0-9_]*)))/,/^(?:\{)/,/^(?:\})/,/^(?:(([A-Za-z_][A-Za-z0-9_]*)))/,/^(?:;)/,/^(?:=)/,/^(?:(([1-9][0-9]*)))/,/^(?:(([xX][A-Fa-f0-9]+)))/,/^(?:(([0-7]+)))/,/^(?:option\b)/,/^(?:;)/,/^(?:(([A-Za-z_][A-Za-z0-9_]*)))/,/^(?:=)/,/^(?:((\d+(\.\d+)?([Ee][\+-]?\d+)?)))/,/^(?:(([1-9][0-9]*)))/,/^(?:(([xX][A-Fa-f0-9]+)))/,/^(?:(([0-7]+)))/,/^(?:((true|false)))/,/^(?:(([A-Za-z_][A-Za-z0-9_]*)))/,/^(?:((['"])))/,/^(?:\/\*(.|\r|\n)*?\*\/)/,/^(?:\/\/.*($|\r|\n))/,/^(?:\s+)/,/^(?:.)/]; | ||
lexer.conditions = {"enum":{"rules":[0,43,44,63,64,65,66],"inclusive":false},"enum_body":{"rules":[0,45,46,63,64,65,66],"inclusive":false},"enum_field":{"rules":[0,47,48,49,50,51,63,64,65,66],"inclusive":false},"string_quoted_content":{"rules":[0,36,37,38,39,40,41,63,64,65,66],"inclusive":false},"option":{"rules":[0,54,55,63,64,65,66],"inclusive":false},"option_value":{"rules":[0,53,56,57,58,59,60,61,62,63,64,65,66],"inclusive":false},"message":{"rules":[0,9,10,63,64,65,66],"inclusive":false},"message_body":{"rules":[0,11,12,13,14,15,63,64,65,66],"inclusive":false},"message_field":{"rules":[0,16,17,18,19,20,21,22,23,24,63,64,65,66],"inclusive":false},"message_field_options":{"rules":[0,25,63,64,65,66],"inclusive":false},"message_field_option":{"rules":[0,26,63,64,65,66],"inclusive":false},"message_field_option_value":{"rules":[0,27,28,29,30,31,32,33,34,35,63,64,65,66],"inclusive":false},"INITIAL":{"rules":[0,1,5,8,42,52,63,64,65,66],"inclusive":true},"package":{"rules":[0,6,7,63,64,65,66],"inclusive":false},"import":{"rules":[0,2,3,4,63,64,65,66],"inclusive":false}}; | ||
return lexer;})() | ||
}, | ||
rules: [/^(?:$)/,/^(?:import\b)/,/^(?:(([A-Za-z_][A-Za-z_0-9\-\.]+)))/,/^(?:((['"])))/,/^(?:;)/,/^(?:package\b)/,/^(?:(([A-Za-z_][A-Za-z_0-9\-\.]+)))/,/^(?:;)/,/^(?:message\b)/,/^(?:(([A-Za-z_][A-Za-z_0-9]*)))/,/^(?:\{)/,/^(?:\})/,/^(?:enum\b)/,/^(?:option\b)/,/^(?:message\b)/,/^(?:((required|optional|repeated)))/,/^(?:(([A-Za-z_][A-Za-z_0-9\-\.]+)))/,/^(?:(([A-Za-z_][A-Za-z_0-9]*)))/,/^(?:=)/,/^(?:(([1-9][0-9]*)))/,/^(?:(([xX][A-Fa-f0-9]+)))/,/^(?:(([0-7]+)))/,/^(?:((\d+(\.\d+)?([Ee][\+-]?\d+)?)))/,/^(?:((true|false)))/,/^(?:;)/,/^(?:\[)/,/^(?:(([A-Za-z_][A-Za-z_0-9]*)))/,/^(?:=)/,/^(?:((\d+(\.\d+)?([Ee][\+-]?\d+)?)))/,/^(?:(([1-9][0-9]*)))/,/^(?:(([xX][A-Fa-f0-9]+)))/,/^(?:(([0-7]+)))/,/^(?:((true|false)))/,/^(?:(([A-Za-z_][A-Za-z_0-9]*)))/,/^(?:((['"])))/,/^(?:,)/,/^(?:\])/,/^(?:\s+)/,/^(?:((\\[Xx][A-Fa-f0-9]{1,2})))/,/^(?:((\\?[0-7]{1,3})))/,/^(?:((\\[abfnrtv\\/'"])))/,/^(?:((['"])))/,/^(?:(([^\0\n])))/,/^(?:enum\b)/,/^(?:(([A-Za-z_][A-Za-z_0-9]*)))/,/^(?:\{)/,/^(?:\})/,/^(?:(([A-Za-z_][A-Za-z_0-9]*)))/,/^(?:;)/,/^(?:=)/,/^(?:(([1-9][0-9]*)))/,/^(?:(([xX][A-Fa-f0-9]+)))/,/^(?:(([0-7]+)))/,/^(?:option\b)/,/^(?:;)/,/^(?:(([A-Za-z_][A-Za-z_0-9]*)))/,/^(?:=)/,/^(?:((\d+(\.\d+)?([Ee][\+-]?\d+)?)))/,/^(?:(([1-9][0-9]*)))/,/^(?:(([xX][A-Fa-f0-9]+)))/,/^(?:(([0-7]+)))/,/^(?:((true|false)))/,/^(?:(([A-Za-z_][A-Za-z_0-9]*)))/,/^(?:((['"])))/,/^(?:\/\*(.|\r|\n)*?\*\/)/,/^(?:\/\/.*($|\r|\n))/,/^(?:\s+)/,/^(?:.)/], | ||
conditions: {"enum":{"rules":[0,44,45,64,65,66,67],"inclusive":false},"enum_body":{"rules":[0,46,47,64,65,66,67],"inclusive":false},"enum_field":{"rules":[0,48,49,50,51,52,64,65,66,67],"inclusive":false},"string_quoted_content":{"rules":[0,37,38,39,40,41,42,64,65,66,67],"inclusive":false},"option":{"rules":[0,55,56,64,65,66,67],"inclusive":false},"option_value":{"rules":[0,54,57,58,59,60,61,62,63,64,65,66,67],"inclusive":false},"message_field_options":{"rules":[0,26,64,65,66,67],"inclusive":false},"message_field_option":{"rules":[0,27,64,65,66,67],"inclusive":false},"message_field_option_value":{"rules":[0,28,29,30,31,32,33,34,35,36,64,65,66,67],"inclusive":false},"message":{"rules":[0,9,10,64,65,66,67],"inclusive":false},"message_body":{"rules":[0,11,12,13,14,15,64,65,66,67],"inclusive":false},"message_field_type":{"rules":[0,16,64,65,66,67],"inclusive":false},"message_field_after_type":{"rules":[0,17,18,19,20,21,22,23,24,25,64,65,66,67],"inclusive":false},"INITIAL":{"rules":[0,1,5,8,43,53,64,65,66,67],"inclusive":true},"package":{"rules":[0,6,7,64,65,66,67],"inclusive":false},"import":{"rules":[0,2,3,4,64,65,66,67],"inclusive":false}} | ||
}); | ||
return lexer; | ||
})(); | ||
parser.lexer = lexer; | ||
function Parser () { this.yy = {}; }Parser.prototype = parser;parser.Parser = Parser; | ||
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.parse = function () { return parser.parse.apply(parser, arguments); }; | ||
exports.main = function commonjsMain(args) { | ||
if (!args[1]) | ||
throw new Error('Usage: '+args[0]+' FILE'); | ||
var source, cwd; | ||
if (typeof process !== 'undefined') { | ||
source = require('fs').readFileSync(require('path').resolve(args[1]), "utf8"); | ||
} else { | ||
source = require("file").path(require("file").cwd()).join(args[1]).read({charset: "utf-8"}); | ||
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(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args); | ||
exports.main(process.argv.slice(1)); | ||
} | ||
} |
@@ -149,8 +149,12 @@ /*! | ||
} catch (err) { | ||
if (typeof callback === 'function') callback(err); | ||
if (typeof callback === 'function') { | ||
callback(err); | ||
} | ||
return err; | ||
} | ||
$$ = normalizeAll($$); | ||
if (typeof callback === 'function') callback(null, $$); | ||
if (typeof callback === 'function') { | ||
callback(null, $$); | ||
} | ||
return $$; | ||
}; |
{ | ||
"name": "proto2json", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Google Protocol Buffers .proto files to JSON converter", | ||
@@ -24,9 +24,11 @@ "main": "lib/proto2json.js", | ||
"dependencies": { | ||
"argparse": "~0.1.6" | ||
"argparse": "~0.1.15" | ||
}, | ||
"devDependencies": { | ||
"jison": "~0.3.12", | ||
"mocha": "~1.4.2", | ||
"difflet": "~0.2.2", | ||
"nodelint": "~0.6.2" | ||
"mocha": "~1.21.4", | ||
"difflet": "~0.2.6", | ||
"nodelint": "~0.6.2", | ||
"jison": "~0.4.15", | ||
"ebnf-parser": "~0.1.10", | ||
"lex-parser": "0.1.x" | ||
}, | ||
@@ -33,0 +35,0 @@ "author": "Oleg Efimov", |
@@ -37,3 +37,3 @@ /*! | ||
assert.doesNotThrow(function () { | ||
require("jison/lib/jison/bnf").parse(jison_source); | ||
require("ebnf-parser").parse(jison_source); | ||
}); | ||
@@ -40,0 +40,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
104876
56
1502
0
6
Updatedargparse@~0.1.15