Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

jsonlint.js 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917
  1. 'use strict';
  2. // From: https://github.com/zaach/jsonlint
  3. // Vendored in Jest to avoid jsonlint's transitive dependencies.
  4. /* eslint-disable */
  5. var jsonlint = (function () {
  6. var parser = {
  7. trace: function trace() {},
  8. yy: {},
  9. symbols_: {
  10. error: 2,
  11. JSONString: 3,
  12. STRING: 4,
  13. JSONNumber: 5,
  14. NUMBER: 6,
  15. JSONNullLiteral: 7,
  16. NULL: 8,
  17. JSONBooleanLiteral: 9,
  18. TRUE: 10,
  19. FALSE: 11,
  20. JSONText: 12,
  21. JSONValue: 13,
  22. EOF: 14,
  23. JSONObject: 15,
  24. JSONArray: 16,
  25. '{': 17,
  26. '}': 18,
  27. JSONMemberList: 19,
  28. JSONMember: 20,
  29. ':': 21,
  30. ',': 22,
  31. '[': 23,
  32. ']': 24,
  33. JSONElementList: 25,
  34. $accept: 0,
  35. $end: 1
  36. },
  37. terminals_: {
  38. 2: 'error',
  39. 4: 'STRING',
  40. 6: 'NUMBER',
  41. 8: 'NULL',
  42. 10: 'TRUE',
  43. 11: 'FALSE',
  44. 14: 'EOF',
  45. 17: '{',
  46. 18: '}',
  47. 21: ':',
  48. 22: ',',
  49. 23: '[',
  50. 24: ']'
  51. },
  52. productions_: [
  53. 0,
  54. [3, 1],
  55. [5, 1],
  56. [7, 1],
  57. [9, 1],
  58. [9, 1],
  59. [12, 2],
  60. [13, 1],
  61. [13, 1],
  62. [13, 1],
  63. [13, 1],
  64. [13, 1],
  65. [13, 1],
  66. [15, 2],
  67. [15, 3],
  68. [20, 3],
  69. [19, 1],
  70. [19, 3],
  71. [16, 2],
  72. [16, 3],
  73. [25, 1],
  74. [25, 3]
  75. ],
  76. performAction: function anonymous(
  77. yytext,
  78. yyleng,
  79. yylineno,
  80. yy,
  81. yystate,
  82. $$,
  83. _$
  84. ) {
  85. var $0 = $$.length - 1;
  86. switch (yystate) {
  87. case 1:
  88. // replace escaped characters with actual character
  89. this.$ = yytext
  90. .replace(/\\(\\|")/g, '$' + '1')
  91. .replace(/\\n/g, '\n')
  92. .replace(/\\r/g, '\r')
  93. .replace(/\\t/g, '\t')
  94. .replace(/\\v/g, '\v')
  95. .replace(/\\f/g, '\f')
  96. .replace(/\\b/g, '\b');
  97. break;
  98. case 2:
  99. this.$ = Number(yytext);
  100. break;
  101. case 3:
  102. this.$ = null;
  103. break;
  104. case 4:
  105. this.$ = true;
  106. break;
  107. case 5:
  108. this.$ = false;
  109. break;
  110. case 6:
  111. return (this.$ = $$[$0 - 1]);
  112. break;
  113. case 13:
  114. this.$ = {};
  115. break;
  116. case 14:
  117. this.$ = $$[$0 - 1];
  118. break;
  119. case 15:
  120. this.$ = [$$[$0 - 2], $$[$0]];
  121. break;
  122. case 16:
  123. this.$ = {};
  124. this.$[$$[$0][0]] = $$[$0][1];
  125. break;
  126. case 17:
  127. this.$ = $$[$0 - 2];
  128. $$[$0 - 2][$$[$0][0]] = $$[$0][1];
  129. break;
  130. case 18:
  131. this.$ = [];
  132. break;
  133. case 19:
  134. this.$ = $$[$0 - 1];
  135. break;
  136. case 20:
  137. this.$ = [$$[$0]];
  138. break;
  139. case 21:
  140. this.$ = $$[$0 - 2];
  141. $$[$0 - 2].push($$[$0]);
  142. break;
  143. }
  144. },
  145. table: [
  146. {
  147. 3: 5,
  148. 4: [1, 12],
  149. 5: 6,
  150. 6: [1, 13],
  151. 7: 3,
  152. 8: [1, 9],
  153. 9: 4,
  154. 10: [1, 10],
  155. 11: [1, 11],
  156. 12: 1,
  157. 13: 2,
  158. 15: 7,
  159. 16: 8,
  160. 17: [1, 14],
  161. 23: [1, 15]
  162. },
  163. {
  164. 1: [3]
  165. },
  166. {
  167. 14: [1, 16]
  168. },
  169. {
  170. 14: [2, 7],
  171. 18: [2, 7],
  172. 22: [2, 7],
  173. 24: [2, 7]
  174. },
  175. {
  176. 14: [2, 8],
  177. 18: [2, 8],
  178. 22: [2, 8],
  179. 24: [2, 8]
  180. },
  181. {
  182. 14: [2, 9],
  183. 18: [2, 9],
  184. 22: [2, 9],
  185. 24: [2, 9]
  186. },
  187. {
  188. 14: [2, 10],
  189. 18: [2, 10],
  190. 22: [2, 10],
  191. 24: [2, 10]
  192. },
  193. {
  194. 14: [2, 11],
  195. 18: [2, 11],
  196. 22: [2, 11],
  197. 24: [2, 11]
  198. },
  199. {
  200. 14: [2, 12],
  201. 18: [2, 12],
  202. 22: [2, 12],
  203. 24: [2, 12]
  204. },
  205. {
  206. 14: [2, 3],
  207. 18: [2, 3],
  208. 22: [2, 3],
  209. 24: [2, 3]
  210. },
  211. {
  212. 14: [2, 4],
  213. 18: [2, 4],
  214. 22: [2, 4],
  215. 24: [2, 4]
  216. },
  217. {
  218. 14: [2, 5],
  219. 18: [2, 5],
  220. 22: [2, 5],
  221. 24: [2, 5]
  222. },
  223. {
  224. 14: [2, 1],
  225. 18: [2, 1],
  226. 21: [2, 1],
  227. 22: [2, 1],
  228. 24: [2, 1]
  229. },
  230. {
  231. 14: [2, 2],
  232. 18: [2, 2],
  233. 22: [2, 2],
  234. 24: [2, 2]
  235. },
  236. {
  237. 3: 20,
  238. 4: [1, 12],
  239. 18: [1, 17],
  240. 19: 18,
  241. 20: 19
  242. },
  243. {
  244. 3: 5,
  245. 4: [1, 12],
  246. 5: 6,
  247. 6: [1, 13],
  248. 7: 3,
  249. 8: [1, 9],
  250. 9: 4,
  251. 10: [1, 10],
  252. 11: [1, 11],
  253. 13: 23,
  254. 15: 7,
  255. 16: 8,
  256. 17: [1, 14],
  257. 23: [1, 15],
  258. 24: [1, 21],
  259. 25: 22
  260. },
  261. {
  262. 1: [2, 6]
  263. },
  264. {
  265. 14: [2, 13],
  266. 18: [2, 13],
  267. 22: [2, 13],
  268. 24: [2, 13]
  269. },
  270. {
  271. 18: [1, 24],
  272. 22: [1, 25]
  273. },
  274. {
  275. 18: [2, 16],
  276. 22: [2, 16]
  277. },
  278. {
  279. 21: [1, 26]
  280. },
  281. {
  282. 14: [2, 18],
  283. 18: [2, 18],
  284. 22: [2, 18],
  285. 24: [2, 18]
  286. },
  287. {
  288. 22: [1, 28],
  289. 24: [1, 27]
  290. },
  291. {
  292. 22: [2, 20],
  293. 24: [2, 20]
  294. },
  295. {
  296. 14: [2, 14],
  297. 18: [2, 14],
  298. 22: [2, 14],
  299. 24: [2, 14]
  300. },
  301. {
  302. 3: 20,
  303. 4: [1, 12],
  304. 20: 29
  305. },
  306. {
  307. 3: 5,
  308. 4: [1, 12],
  309. 5: 6,
  310. 6: [1, 13],
  311. 7: 3,
  312. 8: [1, 9],
  313. 9: 4,
  314. 10: [1, 10],
  315. 11: [1, 11],
  316. 13: 30,
  317. 15: 7,
  318. 16: 8,
  319. 17: [1, 14],
  320. 23: [1, 15]
  321. },
  322. {
  323. 14: [2, 19],
  324. 18: [2, 19],
  325. 22: [2, 19],
  326. 24: [2, 19]
  327. },
  328. {
  329. 3: 5,
  330. 4: [1, 12],
  331. 5: 6,
  332. 6: [1, 13],
  333. 7: 3,
  334. 8: [1, 9],
  335. 9: 4,
  336. 10: [1, 10],
  337. 11: [1, 11],
  338. 13: 31,
  339. 15: 7,
  340. 16: 8,
  341. 17: [1, 14],
  342. 23: [1, 15]
  343. },
  344. {
  345. 18: [2, 17],
  346. 22: [2, 17]
  347. },
  348. {
  349. 18: [2, 15],
  350. 22: [2, 15]
  351. },
  352. {
  353. 22: [2, 21],
  354. 24: [2, 21]
  355. }
  356. ],
  357. defaultActions: {
  358. 16: [2, 6]
  359. },
  360. parseError: function parseError(str, hash) {
  361. throw new Error(str);
  362. },
  363. parse: function parse(input) {
  364. var self = this,
  365. stack = [0],
  366. vstack = [null],
  367. // semantic value stack
  368. lstack = [],
  369. // location stack
  370. table = this.table,
  371. yytext = '',
  372. yylineno = 0,
  373. yyleng = 0,
  374. recovering = 0,
  375. TERROR = 2,
  376. EOF = 1; //this.reductionCount = this.shiftCount = 0;
  377. this.lexer.setInput(input);
  378. this.lexer.yy = this.yy;
  379. this.yy.lexer = this.lexer;
  380. if (typeof this.lexer.yylloc == 'undefined') this.lexer.yylloc = {};
  381. var yyloc = this.lexer.yylloc;
  382. lstack.push(yyloc);
  383. if (typeof this.yy.parseError === 'function')
  384. this.parseError = this.yy.parseError;
  385. function popStack(n) {
  386. stack.length = stack.length - 2 * n;
  387. vstack.length = vstack.length - n;
  388. lstack.length = lstack.length - n;
  389. }
  390. function lex() {
  391. var token;
  392. token = self.lexer.lex() || 1; // $end = 1
  393. // if token isn't its numeric value, convert
  394. if (typeof token !== 'number') {
  395. token = self.symbols_[token] || token;
  396. }
  397. return token;
  398. }
  399. var symbol,
  400. preErrorSymbol,
  401. state,
  402. action,
  403. a,
  404. r,
  405. yyval = {},
  406. p,
  407. len,
  408. newState,
  409. expected;
  410. while (true) {
  411. // retrieve state number from top of stack
  412. state = stack[stack.length - 1]; // use default actions if available
  413. if (this.defaultActions[state]) {
  414. action = this.defaultActions[state];
  415. } else {
  416. if (symbol == null) symbol = lex(); // read action for current state and first input
  417. action = table[state] && table[state][symbol];
  418. } // handle parse error
  419. _handle_error: if (
  420. typeof action === 'undefined' ||
  421. !action.length ||
  422. !action[0]
  423. ) {
  424. if (!recovering) {
  425. // Report error
  426. expected = [];
  427. for (p in table[state])
  428. if (this.terminals_[p] && p > 2) {
  429. expected.push("'" + this.terminals_[p] + "'");
  430. }
  431. var errStr = '';
  432. if (this.lexer.showPosition) {
  433. errStr =
  434. 'Parse error on line ' +
  435. (yylineno + 1) +
  436. ':\n' +
  437. this.lexer.showPosition() +
  438. '\nExpecting ' +
  439. expected.join(', ') +
  440. ", got '" +
  441. this.terminals_[symbol] +
  442. "'";
  443. } else {
  444. errStr =
  445. 'Parse error on line ' +
  446. (yylineno + 1) +
  447. ': Unexpected ' +
  448. (symbol == 1
  449. ? /*EOF*/
  450. 'end of input'
  451. : "'" + (this.terminals_[symbol] || symbol) + "'");
  452. }
  453. this.parseError(errStr, {
  454. text: this.lexer.match,
  455. token: this.terminals_[symbol] || symbol,
  456. line: this.lexer.yylineno,
  457. loc: yyloc,
  458. expected: expected
  459. });
  460. } // just recovered from another error
  461. if (recovering == 3) {
  462. if (symbol == EOF) {
  463. throw new Error(errStr || 'Parsing halted.');
  464. } // discard current lookahead and grab another
  465. yyleng = this.lexer.yyleng;
  466. yytext = this.lexer.yytext;
  467. yylineno = this.lexer.yylineno;
  468. yyloc = this.lexer.yylloc;
  469. symbol = lex();
  470. } // try to recover from error
  471. while (1) {
  472. // check for error recovery rule in this state
  473. if (TERROR.toString() in table[state]) {
  474. break;
  475. }
  476. if (state == 0) {
  477. throw new Error(errStr || 'Parsing halted.');
  478. }
  479. popStack(1);
  480. state = stack[stack.length - 1];
  481. }
  482. preErrorSymbol = symbol; // save the lookahead token
  483. symbol = TERROR; // insert generic error symbol as new lookahead
  484. state = stack[stack.length - 1];
  485. action = table[state] && table[state][TERROR];
  486. recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
  487. } // this shouldn't happen, unless resolve defaults are off
  488. if (action[0] instanceof Array && action.length > 1) {
  489. throw new Error(
  490. 'Parse Error: multiple actions possible at state: ' +
  491. state +
  492. ', token: ' +
  493. symbol
  494. );
  495. }
  496. switch (action[0]) {
  497. case 1:
  498. // shift
  499. //this.shiftCount++;
  500. stack.push(symbol);
  501. vstack.push(this.lexer.yytext);
  502. lstack.push(this.lexer.yylloc);
  503. stack.push(action[1]); // push state
  504. symbol = null;
  505. if (!preErrorSymbol) {
  506. // normal execution/no error
  507. yyleng = this.lexer.yyleng;
  508. yytext = this.lexer.yytext;
  509. yylineno = this.lexer.yylineno;
  510. yyloc = this.lexer.yylloc;
  511. if (recovering > 0) recovering--;
  512. } else {
  513. // error just occurred, resume old lookahead f/ before error
  514. symbol = preErrorSymbol;
  515. preErrorSymbol = null;
  516. }
  517. break;
  518. case 2:
  519. // reduce
  520. //this.reductionCount++;
  521. len = this.productions_[action[1]][1]; // perform semantic action
  522. yyval.$ = vstack[vstack.length - len]; // default to $$ = $1
  523. // default location, uses first token for firsts, last for lasts
  524. yyval._$ = {
  525. first_line: lstack[lstack.length - (len || 1)].first_line,
  526. last_line: lstack[lstack.length - 1].last_line,
  527. first_column: lstack[lstack.length - (len || 1)].first_column,
  528. last_column: lstack[lstack.length - 1].last_column
  529. };
  530. r = this.performAction.call(
  531. yyval,
  532. yytext,
  533. yyleng,
  534. yylineno,
  535. this.yy,
  536. action[1],
  537. vstack,
  538. lstack
  539. );
  540. if (typeof r !== 'undefined') {
  541. return r;
  542. } // pop off stack
  543. if (len) {
  544. stack = stack.slice(0, -1 * len * 2);
  545. vstack = vstack.slice(0, -1 * len);
  546. lstack = lstack.slice(0, -1 * len);
  547. }
  548. stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
  549. vstack.push(yyval.$);
  550. lstack.push(yyval._$); // goto new state = table[STATE][NONTERMINAL]
  551. newState = table[stack[stack.length - 2]][stack[stack.length - 1]];
  552. stack.push(newState);
  553. break;
  554. case 3:
  555. // accept
  556. return true;
  557. }
  558. }
  559. return true;
  560. }
  561. };
  562. /* Jison generated lexer */
  563. var lexer = (function () {
  564. var lexer = {
  565. EOF: 1,
  566. parseError: function parseError(str, hash) {
  567. if (this.yy.parseError) {
  568. this.yy.parseError(str, hash);
  569. } else {
  570. throw new Error(str);
  571. }
  572. },
  573. setInput: function (input) {
  574. this._input = input;
  575. this._more = this._less = this.done = false;
  576. this.yylineno = this.yyleng = 0;
  577. this.yytext = this.matched = this.match = '';
  578. this.conditionStack = ['INITIAL'];
  579. this.yylloc = {
  580. first_line: 1,
  581. first_column: 0,
  582. last_line: 1,
  583. last_column: 0
  584. };
  585. return this;
  586. },
  587. input: function () {
  588. var ch = this._input[0];
  589. this.yytext += ch;
  590. this.yyleng++;
  591. this.match += ch;
  592. this.matched += ch;
  593. var lines = ch.match(/\n/);
  594. if (lines) this.yylineno++;
  595. this._input = this._input.slice(1);
  596. return ch;
  597. },
  598. unput: function (ch) {
  599. this._input = ch + this._input;
  600. return this;
  601. },
  602. more: function () {
  603. this._more = true;
  604. return this;
  605. },
  606. less: function (n) {
  607. this._input = this.match.slice(n) + this._input;
  608. },
  609. pastInput: function () {
  610. var past = this.matched.substr(
  611. 0,
  612. this.matched.length - this.match.length
  613. );
  614. return (
  615. (past.length > 20 ? '...' : '') + past.substr(-20).replace(/\n/g, '')
  616. );
  617. },
  618. upcomingInput: function () {
  619. var next = this.match;
  620. if (next.length < 20) {
  621. next += this._input.substr(0, 20 - next.length);
  622. }
  623. return (next.substr(0, 20) + (next.length > 20 ? '...' : '')).replace(
  624. /\n/g,
  625. ''
  626. );
  627. },
  628. showPosition: function () {
  629. var pre = this.pastInput();
  630. var c = new Array(pre.length + 1).join('-');
  631. return pre + this.upcomingInput() + '\n' + c + '^';
  632. },
  633. next: function () {
  634. if (this.done) {
  635. return this.EOF;
  636. }
  637. if (!this._input) this.done = true;
  638. var token, match, tempMatch, index, col, lines;
  639. if (!this._more) {
  640. this.yytext = '';
  641. this.match = '';
  642. }
  643. var rules = this._currentRules();
  644. for (var i = 0; i < rules.length; i++) {
  645. tempMatch = this._input.match(this.rules[rules[i]]);
  646. if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
  647. match = tempMatch;
  648. index = i;
  649. if (!this.options.flex) break;
  650. }
  651. }
  652. if (match) {
  653. lines = match[0].match(/\n.*/g);
  654. if (lines) this.yylineno += lines.length;
  655. this.yylloc = {
  656. first_line: this.yylloc.last_line,
  657. last_line: this.yylineno + 1,
  658. first_column: this.yylloc.last_column,
  659. last_column: lines
  660. ? lines[lines.length - 1].length - 1
  661. : this.yylloc.last_column + match[0].length
  662. };
  663. this.yytext += match[0];
  664. this.match += match[0];
  665. this.yyleng = this.yytext.length;
  666. this._more = false;
  667. this._input = this._input.slice(match[0].length);
  668. this.matched += match[0];
  669. token = this.performAction.call(
  670. this,
  671. this.yy,
  672. this,
  673. rules[index],
  674. this.conditionStack[this.conditionStack.length - 1]
  675. );
  676. if (this.done && this._input) this.done = false;
  677. if (token) return token;
  678. else return;
  679. }
  680. if (this._input === '') {
  681. return this.EOF;
  682. } else {
  683. this.parseError(
  684. 'Lexical error on line ' +
  685. (this.yylineno + 1) +
  686. '. Unrecognized text.\n' +
  687. this.showPosition(),
  688. {
  689. text: '',
  690. token: null,
  691. line: this.yylineno
  692. }
  693. );
  694. }
  695. },
  696. lex: function lex() {
  697. var r = this.next();
  698. if (typeof r !== 'undefined') {
  699. return r;
  700. } else {
  701. return this.lex();
  702. }
  703. },
  704. begin: function begin(condition) {
  705. this.conditionStack.push(condition);
  706. },
  707. popState: function popState() {
  708. return this.conditionStack.pop();
  709. },
  710. _currentRules: function _currentRules() {
  711. return this.conditions[
  712. this.conditionStack[this.conditionStack.length - 1]
  713. ].rules;
  714. },
  715. topState: function () {
  716. return this.conditionStack[this.conditionStack.length - 2];
  717. },
  718. pushState: function begin(condition) {
  719. this.begin(condition);
  720. }
  721. };
  722. lexer.options = {};
  723. lexer.performAction = function anonymous(
  724. yy,
  725. yy_,
  726. $avoiding_name_collisions,
  727. YY_START
  728. ) {
  729. var YYSTATE = YY_START;
  730. switch ($avoiding_name_collisions) {
  731. case 0:
  732. /* skip whitespace */
  733. break;
  734. case 1:
  735. return 6;
  736. break;
  737. case 2:
  738. yy_.yytext = yy_.yytext.substr(1, yy_.yyleng - 2);
  739. return 4;
  740. break;
  741. case 3:
  742. return 17;
  743. break;
  744. case 4:
  745. return 18;
  746. break;
  747. case 5:
  748. return 23;
  749. break;
  750. case 6:
  751. return 24;
  752. break;
  753. case 7:
  754. return 22;
  755. break;
  756. case 8:
  757. return 21;
  758. break;
  759. case 9:
  760. return 10;
  761. break;
  762. case 10:
  763. return 11;
  764. break;
  765. case 11:
  766. return 8;
  767. break;
  768. case 12:
  769. return 14;
  770. break;
  771. case 13:
  772. return 'INVALID';
  773. break;
  774. }
  775. };
  776. lexer.rules = [
  777. /^(?:\s+)/,
  778. /^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,
  779. /^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,
  780. /^(?:\{)/,
  781. /^(?:\})/,
  782. /^(?:\[)/,
  783. /^(?:\])/,
  784. /^(?:,)/,
  785. /^(?::)/,
  786. /^(?:true\b)/,
  787. /^(?:false\b)/,
  788. /^(?:null\b)/,
  789. /^(?:$)/,
  790. /^(?:.)/
  791. ];
  792. lexer.conditions = {
  793. INITIAL: {
  794. rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13],
  795. inclusive: true
  796. }
  797. };
  798. return lexer;
  799. })();
  800. parser.lexer = lexer;
  801. return parser;
  802. })();
  803. exports.parser = jsonlint;
  804. exports.errors = function (input) {
  805. try {
  806. this.parse(input);
  807. } catch (e) {
  808. return e.stack;
  809. }
  810. };
  811. exports.parse = function () {
  812. return jsonlint.parse.apply(jsonlint, arguments);
  813. };
  814. exports.main = function commonjsMain(args) {
  815. if (!args[1]) throw new Error('Usage: ' + args[0] + ' FILE');
  816. if (typeof process !== 'undefined') {
  817. var source = require('fs').readFileSync(
  818. require('path').join(process.cwd(), args[1]),
  819. 'utf8'
  820. );
  821. } else {
  822. var cwd = require('file').path(require('file').cwd());
  823. var source = cwd.join(args[1]).read({
  824. charset: 'utf-8'
  825. });
  826. }
  827. return exports.parser.parse(source);
  828. };