jsonlint.js 23 KB

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