1/* parser generated by jison 0.4.18 */ 2/* 3 Returns a Parser object of the following structure: 4 5 Parser: { 6 yy: {} 7 } 8 9 Parser.prototype: { 10 yy: {}, 11 trace: function(), 12 symbols_: {associative list: name ==> number}, 13 terminals_: {associative list: number ==> name}, 14 productions_: [...], 15 performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate, $$, _$), 16 table: [...], 17 defaultActions: {...}, 18 parseError: function(str, hash), 19 parse: function(input), 20 21 lexer: { 22 EOF: 1, 23 parseError: function(str, hash), 24 setInput: function(input), 25 input: function(), 26 unput: function(str), 27 more: function(), 28 less: function(n), 29 pastInput: function(), 30 upcomingInput: function(), 31 showPosition: function(), 32 test_match: function(regex_match_array, rule_index), 33 next: function(), 34 lex: function(), 35 begin: function(condition), 36 popState: function(), 37 _currentRules: function(), 38 topState: function(), 39 pushState: function(condition), 40 41 options: { 42 ranges: boolean (optional: true ==> token location info will include a .range[] member) 43 flex: boolean (optional: true ==> flex-like lexing behaviour where the rules are tested exhaustively to find the longest match) 44 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) 45 }, 46 47 performAction: function(yy, yy_, $avoiding_name_collisions, YY_START), 48 rules: [...], 49 conditions: {associative list: name ==> set}, 50 } 51 } 52 53 54 token location info (@$, _$, etc.): { 55 first_line: n, 56 last_line: n, 57 first_column: n, 58 last_column: n, 59 range: [start_number, end_number] (where the numbers are indexes into the input string, regular zero-based) 60 } 61 62 63 the parseError function receives a 'hash' object with these members for lexer and parser errors: { 64 text: (matched text) 65 token: (the produced terminal token, if any) 66 line: (yylineno) 67 } 68 while parser (grammar) errors will also provide these members, i.e. parser errors deliver a superset of attributes: { 69 loc: (yylloc) 70 expected: (string describing the set of expected tokens) 71 recoverable: (boolean: TRUE when the parser has a error recovery rule available for this particular error) 72 } 73*/ 74var jsonlint = (function(){ 75var o=function(k,v,o,l){for(o=o||{},l=k.length;l--;o[k[l]]=v);return o},$V0=[1,12],$V1=[1,13],$V2=[1,9],$V3=[1,10],$V4=[1,11],$V5=[1,14],$V6=[1,15],$V7=[14,18,22,24],$V8=[18,22],$V9=[22,24]; 76var parser = {trace: function trace () { }, 77yy: {}, 78symbols_: {"error":2,"JSONString":3,"STRING":4,"JSONNumber":5,"NUMBER":6,"JSONNullLiteral":7,"NULL":8,"JSONBooleanLiteral":9,"TRUE":10,"FALSE":11,"JSONText":12,"JSONValue":13,"EOF":14,"JSONObject":15,"JSONArray":16,"{":17,"}":18,"JSONMemberList":19,"JSONMember":20,":":21,",":22,"[":23,"]":24,"JSONElementList":25,"$accept":0,"$end":1}, 79terminals_: {2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"}, 80productions_: [0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]], 81performAction: function anonymous(yytext, yyleng, yylineno, yy, yystate /* action[1] */, $$ /* vstack */, _$ /* lstack */) { 82/* this == yyval */ 83 84var $0 = $$.length - 1; 85switch (yystate) { 86case 1: 87 // replace escaped characters with actual character 88 this.$ = yytext.replace(/\\(\\|")/g, "$"+"1")
89 .replace(/\\n/g,'\n') 90 .replace(/\\r/g,'\r') 91 .replace(/\\t/g,'\t') 92 .replace(/\\v/g,'\v') 93 .replace(/\\f/g,'\f') 94 .replace(/\\b/g,'\b'); 95 96break; 97case 2: 98this.$ = yytext == String(Number(yytext))? Number(yytext): yytext; 99break; 100case 3: 101this.$ = null; 102break; 103case 4: 104this.$ = true; 105break; 106case 5: 107this.$ = false; 108break; 109case 6: 110return this.$ = $$[$0-1]; 111break; 112case 13: 113this.$ = {}; 114break; 115case 14: case 19: 116this.$ = $$[$0-1]; 117break; 118case 15: 119this.$ = [$$[$0-2], $$[$0]]; 120break; 121case 16: 122this.$ = {}; this.$[$$[$0][0]] = $$[$0][1]; 123break; 124case 17: 125this.$ = $$[$0-2]; $$[$0-2][$$[$0][0]] = $$[$0][1]; 126break; 127case 18: 128this.$ = []; 129break; 130case 20: 131this.$ = [$$[$0]]; 132break; 133case 21: 134this.$ = $$[$0-2]; $$[$0-2].push($$[$0]); 135break; 136} 137}, 138table: [{3:5,4:$V0,5:6,6:$V1,7:3,8:$V2,9:4,10:$V3,11:$V4,12:1,13:2,15:7,16:8,17:$V5,23:$V6},{1:[3]},{14:[1,16]},o($V7,[2,7]),o($V7,[2,8]),o($V7,[2,9]),o($V7,[2,10]),o($V7,[2,11]),o($V7,[2,12]),o($V7,[2,3]),o($V7,[2,4]),o($V7,[2,5]),o([14,18,21,22,24],[2,1]),o($V7,[2,2]),{3:20,4:$V0,18:[1,17],19:18,20:19},{3:5,4:$V0,5:6,6:$V1,7:3,8:$V2,9:4,10:$V3,11:$V4,13:23,15:7,16:8,17:$V5,23:$V6,24:[1,21],25:22},{1:[2,6]},o($V7,[2,13]),{18:[1,24],22:[1,25]},o($V8,[2,16]),{21:[1,26]},o($V7,[2,18]),{22:[1,28],24:[1,27]},o($V9,[2,20]),o($V7,[2,14]),{3:20,4:$V0,20:29},{3:5,4:$V0,5:6,6:$V1,7:3,8:$V2,9:4,10:$V3,11:$V4,13:30,15:7,16:8,17:$V5,23:$V6},o($V7,[2,19]),{3:5,4:$V0,5:6,6:$V1,7:3,8:$V2,9:4,10:$V3,11:$V4,13:31,15:7,16:8,17:$V5,23:$V6},o($V8,[2,17]),o($V8,[2,15]),o($V9,[2,21])], 139defaultActions: {16:[2,6]}, 140parseError: function parseError (str, hash) { 141 if (hash.recoverable) { 142 this.trace(str); 143 } else { 144 var error = new Error(str); 145 error.hash = hash; 146 throw error; 147 } 148}, 149parse: function parse(input) { 150 var self = this, stack = [0], tstack = [], vstack = [null], lstack = [], table = this.table, yytext = '', yylineno = 0, yyleng = 0, recovering = 0, TERROR = 2, EOF = 1; 151 var args = lstack.slice.call(arguments, 1); 152 var lexer = Object.create(this.lexer); 153 var sharedState = { yy: {} }; 154 for (var k in this.yy) { 155 if (Object.prototype.hasOwnProperty.call(this.yy, k)) { 156 sharedState.yy[k] = this.yy[k]; 157 } 158 } 159 lexer.setInput(input, sharedState.yy); 160 sharedState.yy.lexer = lexer; 161 sharedState.yy.parser = this; 162 if (typeof lexer.yylloc == 'undefined') { 163 lexer.yylloc = {}; 164 } 165 var yyloc = lexer.yylloc; 166 lstack.push(yyloc); 167 var ranges = lexer.options && lexer.options.ranges; 168 if (typeof sharedState.yy.parseError === 'function') { 169 this.parseError = sharedState.yy.parseError; 170 } else { 171 this.parseError = Object.getPrototypeOf(this).parseError; 172 } 173 function popStack(n) { 174 stack.length = stack.length - 2 * n; 175 vstack.length = vstack.length - n; 176 lstack.length = lstack.length - n; 177 } 178 _token_stack: 179 var lex = function () { 180 var token; 181 token = lexer.lex() || EOF; 182 if (typeof token !== 'number') { 183 token = self.symbols_[token] || token; 184 } 185 return token; 186 }; 187 var symbol, preErrorSymbol, state, action, a, r, yyval = {}, p, len, newState, expected; 188 while (true) { 189 state = stack[stack.length - 1]; 190 if (this.defaultActions[state]) { 191 action = this.defaultActions[state]; 192 } else { 193 if (symbol === null || typeof symbol == 'undefined') { 194 symbol = lex(); 195 } 196 action = table[state] && table[state][symbol]; 197 } 198 if (typeof action === 'undefined' || !action.length || !action[0]) { 199 var errStr = ''; 200 expected = []; 201 for (p in table[state]) { 202 if (this.terminals_[p] && p > TERROR) { 203 expected.push('\'' + this.terminals_[p] + '\''); 204 } 205 } 206 if (lexer.showPosition) { 207 errStr = 'Parse error on line ' + (yylineno + 1) + ':\n' + lexer.showPosition() + '\nExpecting ' + expected.join(', ') + ', got \'' + (this.terminals_[symbol] || symbol) + '\''; 208 } else { 209 errStr = 'Parse error on line ' + (yylineno + 1) + ': Unexpected ' + (symbol == EOF ? 'end of input' : '\'' + (this.terminals_[symbol] || symbol) + '\''); 210 } 211 this.parseError(errStr, { 212 text: lexer.match, 213 token: this.terminals_[symbol] || symbol, 214 line: lexer.yylineno, 215 loc: yyloc, 216 expected: expected 217 }); 218 } 219 if (action[0] instanceof Array && action.length > 1) { 220 throw new Error('Parse Error: multiple actions possible at state: ' + state
vendor: 8,624 bytes, lines 220-479
220+ ', token: ' + symbol); 221 } 222 switch (action[0]) { 223 case 1: 224 stack.push(symbol); 225 vstack.push(lexer.yytext); 226 lstack.push(lexer.yylloc); 227 stack.push(action[1]); 228 symbol = null; 229 if (!preErrorSymbol) { 230 yyleng = lexer.yyleng; 231 yytext = lexer.yytext; 232 yylineno = lexer.yylineno; 233 yyloc = lexer.yylloc; 234 if (recovering > 0) { 235 recovering--; 236 } 237 } else { 238 symbol = preErrorSymbol; 239 preErrorSymbol = null; 240 } 241 break; 242 case 2: 243 len = this.productions_[action[1]][1]; 244 yyval.$ = vstack[vstack.length - len]; 245 yyval._$ = { 246 first_line: lstack[lstack.length - (len || 1)].first_line, 247 last_line: lstack[lstack.length - 1].last_line, 248 first_column: lstack[lstack.length - (len || 1)].first_column, 249 last_column: lstack[lstack.length - 1].last_column 250 }; 251 if (ranges) { 252 yyval._$.range = [ 253 lstack[lstack.length - (len || 1)].range[0], 254 lstack[lstack.length - 1].range[1] 255 ]; 256 } 257 r = this.performAction.apply(yyval, [ 258 yytext, 259 yyleng, 260 yylineno, 261 sharedState.yy, 262 action[1], 263 vstack, 264 lstack 265 ].concat(args)); 266 if (typeof r !== 'undefined') { 267 return r; 268 } 269 if (len) { 270 stack = stack.slice(0, -1 * len * 2); 271 vstack = vstack.slice(0, -1 * len); 272 lstack = lstack.slice(0, -1 * len); 273 } 274 stack.push(this.productions_[action[1]][0]); 275 vstack.push(yyval.$); 276 lstack.push(yyval._$); 277 newState = table[stack[stack.length - 2]][stack[stack.length - 1]]; 278 stack.push(newState); 279 break; 280 case 3: 281 return true; 282 } 283 } 284 return true; 285}}; 286/* generated by jison-lex 0.3.4 */ 287var lexer = (function(){ 288var lexer = ({ 289 290EOF:1, 291 292parseError:function parseError(str, hash) { 293 if (this.yy.parser) { 294 this.yy.parser.parseError(str, hash); 295 } else { 296 throw new Error(str); 297 } 298 }, 299 300// resets the lexer, sets new input 301setInput:function (input, yy) { 302 this.yy = yy || this.yy || {}; 303 this._input = input; 304 this._more = this._backtrack = this.done = false; 305 this.yylineno = this.yyleng = 0; 306 this.yytext = this.matched = this.match = ''; 307 this.conditionStack = ['INITIAL']; 308 this.yylloc = { 309 first_line: 1, 310 first_column: 0, 311 last_line: 1, 312 last_column: 0 313 }; 314 if (this.options.ranges) { 315 this.yylloc.range = [0,0]; 316 } 317 this.offset = 0; 318 return this; 319 }, 320 321// consumes and returns one char from the input 322input:function () { 323 var ch = this._input[0]; 324 this.yytext += ch; 325 this.yyleng++; 326 this.offset++; 327 this.match += ch; 328 this.matched += ch; 329 var lines = ch.match(/(?:\r\n?|\n).*/g); 330 if (lines) { 331 this.yylineno++; 332 this.yylloc.last_line++; 333 } else { 334 this.yylloc.last_column++; 335 } 336 if (this.options.ranges) { 337 this.yylloc.range[1]++; 338 } 339 340 this._input = this._input.slice(1); 341 return ch; 342 }, 343 344// unshifts one char (or a string) into the input 345unput:function (ch) { 346 var len = ch.length; 347 var lines = ch.split(/(?:\r\n?|\n)/g); 348 349 this._input = ch + this._input; 350 this.yytext = this.yytext.substr(0, this.yytext.length - len); 351 //this.yyleng -= len; 352 this.offset -= len; 353 var oldLines = this.match.split(/(?:\r\n?|\n)/g); 354 this.match = this.match.substr(0, this.match.length - 1); 355 this.matched = this.matched.substr(0, this.matched.length - 1); 356 357 if (lines.length - 1) { 358 this.yylineno -= lines.length - 1; 359 } 360 var r = this.yylloc.range; 361 362 this.yylloc = { 363 first_line: this.yylloc.first_line, 364 last_line: this.yylineno + 1, 365 first_column: this.yylloc.first_column, 366 last_column: lines ? 367 (lines.length === oldLines.length ? this.yylloc.first_column : 0) 368 + oldLines[oldLines.length - lines.length].length - lines[0].length : 369 this.yylloc.first_column - len 370 }; 371 372 if (this.options.ranges) { 373 this.yylloc.range = [r[0], r[0] + this.yyleng - len]; 374 } 375 this.yyleng = this.yytext.length; 376 return this; 377 }, 378 379// When called from action, caches matched text and appends it on next action 380more:function () { 381 this._more = true; 382 return this; 383 }, 384 385// 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. 386reject:function () { 387 if (this.options.backtrack_lexer) { 388 this._backtrack = true; 389 } else { 390 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(), { 391 text: "", 392 token: null, 393 line: this.yylineno 394 }); 395 396 } 397 return this; 398 }, 399 400// retain first n characters of the match 401less:function (n) { 402 this.unput(this.match.slice(n)); 403 }, 404 405// displays already matched input, i.e. for error messages 406pastInput:function () { 407 var past = this.matched.substr(0, this.matched.length - this.match.length); 408 return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, ""); 409 }, 410 411// displays upcoming input, i.e. for error messages 412upcomingInput:function () { 413 var next = this.match; 414 if (next.length < 20) { 415 next += this._input.substr(0, 20-next.length); 416 } 417 return (next.substr(0,20) + (next.length > 20 ? '...' : '')).replace(/\n/g, ""); 418 }, 419 420// displays the character position where the lexing error occurred, i.e. for error messages 421showPosition:function () { 422 var pre = this.pastInput(); 423 var c = new Array(pre.length + 1).join("-"); 424 return pre + this.upcomingInput() + "\n" + c + "^"; 425 }, 426 427// test the lexed token: return FALSE when not a match, otherwise return token 428test_match:function(match, indexed_rule) { 429 var token, 430 lines, 431 backup; 432 433 if (this.options.backtrack_lexer) { 434 // save context 435 backup = { 436 yylineno: this.yylineno, 437 yylloc: { 438 first_line: this.yylloc.first_line, 439 last_line: this.last_line, 440 first_column: this.yylloc.first_column, 441 last_column: this.yylloc.last_column 442 }, 443 yytext: this.yytext, 444 match: this.match, 445 matches: this.matches, 446 matched: this.matched, 447 yyleng: this.yyleng, 448 offset: this.offset, 449 _more: this._more, 450 _input: this._input, 451 yy: this.yy, 452 conditionStack: this.conditionStack.slice(0), 453 done: this.done 454 }; 455 if (this.options.ranges) { 456 backup.yylloc.range = this.yylloc.range.slice(0); 457 } 458 } 459 460 lines = match[0].match(/(?:\r\n?|\n).*/g); 461 if (lines) { 462 this.yylineno += lines.length; 463 } 464 this.yylloc = { 465 first_line: this.yylloc.last_line, 466 last_line: this.yylineno + 1, 467 first_column: this.yylloc.last_column, 468 last_column: lines ? 469 lines[lines.length - 1].length - lines[lines.length - 1].match(/\r?\n?/)[0].length : 470 this.yylloc.last_column + match[0].length 471 }; 472 this.yytext += match[0]; 473 this.match += match[0]; 474 this.matches = match; 475 this.yyleng = this.yytext.length; 476 if (this.options.ranges) { 477 this.yylloc.range = [this.offset, this.offset += this.yyleng]; 478 } 479 this._more = false;
vendor: 5,356 bytes, lines 480-647
480 this._backtrack = false; 481 this._input = this._input.slice(match[0].length); 482 this.matched += match[0]; 483 token = this.performAction.call(this, this.yy, this, indexed_rule, this.conditionStack[this.conditionStack.length - 1]); 484 if (this.done && this._input) { 485 this.done = false; 486 } 487 if (token) { 488 return token; 489 } else if (this._backtrack) { 490 // recover context 491 for (var k in backup) { 492 this[k] = backup[k]; 493 } 494 return false; // rule action called reject() implying the next rule should be tested instead. 495 } 496 return false; 497 }, 498 499// return next match in input 500next:function () { 501 if (this.done) { 502 return this.EOF; 503 } 504 if (!this._input) { 505 this.done = true; 506 } 507 508 var token, 509 match, 510 tempMatch, 511 index; 512 if (!this._more) { 513 this.yytext = ''; 514 this.match = ''; 515 } 516 var rules = this._currentRules(); 517 for (var i = 0; i < rules.length; i++) { 518 tempMatch = this._input.match(this.rules[rules[i]]); 519 if (tempMatch && (!match || tempMatch[0].length > match[0].length)) { 520 match = tempMatch; 521 index = i; 522 if (this.options.backtrack_lexer) { 523 token = this.test_match(tempMatch, rules[i]); 524 if (token !== false) { 525 return token; 526 } else if (this._backtrack) { 527 match = false; 528 continue; // rule action called reject() implying a rule MISmatch. 529 } else { 530 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) 531 return false; 532 } 533 } else if (!this.options.flex) { 534 break; 535 } 536 } 537 } 538 if (match) { 539 token = this.test_match(match, rules[index]); 540 if (token !== false) { 541 return token; 542 } 543 // else: this is a lexer rule which consumes input without producing a token (e.g. whitespace) 544 return false; 545 } 546 if (this._input === "") { 547 return this.EOF; 548 } else { 549 return this.parseError('Lexical error on line ' + (this.yylineno + 1) + '. Unrecognized text.\n' + this.showPosition(), { 550 text: "", 551 token: null, 552 line: this.yylineno 553 }); 554 } 555 }, 556 557// return next match that has a token 558lex:function lex () { 559 var r = this.next(); 560 if (r) { 561 return r; 562 } else { 563 return this.lex(); 564 } 565 }, 566 567// activates a new lexer condition state (pushes the new lexer condition state onto the condition stack) 568begin:function begin (condition) { 569 this.conditionStack.push(condition); 570 }, 571 572// pop the previously active lexer condition state off the condition stack 573popState:function popState () { 574 var n = this.conditionStack.length - 1; 575 if (n > 0) { 576 return this.conditionStack.pop(); 577 } else { 578 return this.conditionStack[0]; 579 } 580 }, 581 582// produce the lexer rule set which is active for the currently active lexer condition state 583_currentRules:function _currentRules () { 584 if (this.conditionStack.length && this.conditionStack[this.conditionStack.length - 1]) { 585 return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules; 586 } else { 587 return this.conditions["INITIAL"].rules; 588 } 589 }, 590 591// return the currently active lexer condition state; when an index argument is provided it produces the N-th previous condition state, if available 592topState:function topState (n) { 593 n = this.conditionStack.length - 1 - Math.abs(n || 0); 594 if (n >= 0) { 595 return this.conditionStack[n]; 596 } else { 597 return "INITIAL"; 598 } 599 }, 600 601// alias for begin(condition) 602pushState:function pushState (condition) { 603 this.begin(condition); 604 }, 605 606// return the number of states currently on the stack 607stateStackSize:function stateStackSize() { 608 return this.conditionStack.length; 609 }, 610options: {}, 611performAction: function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) { 612var YYSTATE=YY_START; 613switch($avoiding_name_collisions) { 614case 0:/* skip whitespace */ 615break; 616case 1:return 6 617break; 618case 2:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 4 619break; 620case 3:return 17 621break; 622case 4:return 18 623break; 624case 5:return 23 625break; 626case 6:return 24 627break; 628case 7:return 22 629break; 630case 8:return 21 631break; 632case 9:return 10 633break; 634case 10:return 11 635break; 636case 11:return 8 637break; 638case 12:return 14 639break; 640case 13:return 'INVALID' 641break; 642} 643}, 644rules: [/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/], 645conditions: {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"inclusive":true}} 646}); 647return lexer;
vendor: 744 bytes, lines 648-673
648})(); 649parser.lexer = lexer; 650function Parser () { 651 this.yy = {}; 652} 653Parser.prototype = parser;parser.Parser = Parser; 654return new Parser; 655})(); 656 657 658if (typeof require !== 'undefined' && typeof exports !== 'undefined') { 659exports.parser = jsonlint; 660exports.Parser = jsonlint.Parser; 661exports.parse = function () { return jsonlint.parse.apply(jsonlint, arguments); }; 662exports.main = function commonjsMain (args) { 663 if (!args[1]) { 664 console.log('Usage: '+args[0]+' FILE'); 665 process.exit(1); 666 } 667 var source = require('fs').readFileSync(require('path').normalize(args[1]), "utf8"); 668 return exports.parser.parse(source); 669}; 670if (typeof module !== 'undefined' && require.main === module) { 671 exports.main(process.argv.slice(1)); 672} 673}
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.