diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 3c3629e..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/Makefile b/Makefile deleted file mode 100644 index 6660a8e..0000000 --- a/Makefile +++ /dev/null @@ -1,17 +0,0 @@ - -all: build test site - -build: - ./node_modules/jison/lib/cli.js src/jsonlint.y src/jsonlint.l - mv jsonlint.js lib/jsonlint.js - node scripts/bundle.js | ./node_modules/uglify-js/bin/uglifyjs > web/jsonlint.js - -site: - cp web/jsonlint.js ../jsonlint-pages/jsonlint.js - -deploy: site - cd ../jsonlint-pages && git commit -a -m 'deploy site updates' && git push origin gh-pages - -test: lib/jsonlint.js test/all-tests.js - node test/all-tests.js - diff --git a/README.md b/README.md deleted file mode 100644 index 5a51966..0000000 --- a/README.md +++ /dev/null @@ -1,65 +0,0 @@ -JSON Lint -========= - -A pure [JavaScript version](http://zaach.github.com/jsonlint/) of the service provided at [jsonlint.com](http://jsonlint.com). - -## Command line interface -Install jsonlint with npm to use the command line interface: - - npm install jsonlint -g - -Validate a file like so: - - jsonlint myfile.json - -or pipe input into stdin: - - cat myfile.json | jsonlint - -jsonlint will either report a syntax error with details or pretty print the source if it is valid. - -### Options - - $ jsonlint -h - - Usage: jsonlint [file] [options] - - file file to parse; otherwise uses stdin - - Options: - -v, --version print version and exit - -s, --sort-keys sort object keys - -i, --in-place overwrite the file - -t CHAR, --indent CHAR character(s) to use for indentation [ ] - -c, --compact compact error display - -V, --validate a JSON schema to use for validation - -e, --environment which specification of JSON Schema the validation file uses [json-schema-draft-03] - -q, --quiet do not print the parsed json to STDOUT [false] - -p, --pretty-print force pretty printing even if invalid - - -## Module interface - -I'm not sure why you wouldn't use the built in `JSON.parse` but you can use jsonlint from a CommonJS module: - - var jsonlint = require("jsonlint"); - - jsonlint.parse('{"creative?": false}'); - -It returns the parsed object or throws an `Error`. - -## Vim Plugins - -* [Syntastic](http://www.vim.org/scripts/script.php?script_id=2736) -* [sourcebeautify](http://www.vim.org/scripts/script.php?script_id=4079) -* [ALE](https://github.com/w0rp/ale) - -## MIT License - -Copyright (C) 2012 Zachary Carter - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/bower.json b/bower.json deleted file mode 100644 index b25b3cd..0000000 --- a/bower.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "jsonlint", - "version": "1.6.0", - "main": "lib/jsonlint.js", - "ignore": [ - "**/.*", - "node_modules", - "scripts", - "src", - "test", - "web", - "package.json", - "Makefile", - "README.md" - ] -} diff --git a/web/jsonlint.html b/index.html similarity index 96% rename from web/jsonlint.html rename to index.html index b088066..4f6f6e8 100644 --- a/web/jsonlint.html +++ b/index.html @@ -45,9 +45,7 @@
A pure JavaScript version of the service provided at jsonlint.com.
- +
diff --git a/web/json2.js b/json2.js
similarity index 100%
rename from web/json2.js
rename to json2.js
diff --git a/web/jsonlint.js b/jsonlint.js
similarity index 100%
rename from web/jsonlint.js
rename to jsonlint.js
diff --git a/lib/cli.js b/lib/cli.js
deleted file mode 100755
index 2e6fafc..0000000
--- a/lib/cli.js
+++ /dev/null
@@ -1,179 +0,0 @@
-#!/usr/bin/env node
-
-var fs = require("fs");
-var path = require("path");
-var parser = require("./jsonlint").parser;
-var JSV = require("JSV").JSV;
-var formatter = require("./formatter.js").formatter;
-
-var options = require("@gerhobbelt/nomnom")
- .script("jsonlint")
- .options({
- file: {
- position: 0,
- help: "file to parse; otherwise uses stdin"
- },
- version: {
- flag : true,
- string: '-v, --version',
- help: 'print version and exit',
- callback: function() {
- return require("../package").version;
- }
- },
- sort : {
- flag : true,
- string: '-s, --sort-keys',
- help: 'sort object keys'
- },
- inplace : {
- flag : true,
- string: '-i, --in-place',
- help: 'overwrite the file'
- },
- indent : {
- string: '-t CHAR, --indent CHAR',
- "default": " ",
- help: 'character(s) to use for indentation'
- },
- compact : {
- flag : true,
- string: '-c, --compact',
- help : 'compact error display'
- },
- validate : {
- string: '-V, --validate',
- help : 'a JSON schema to use for validation'
- },
- env : {
- string: '-e, --environment',
- "default": "json-schema-draft-03",
- help: 'which specification of JSON Schema the validation file uses'
- },
- quiet: {
- flag: true,
- key: "value",
- string: '-q, --quiet',
- "default": false,
- help: 'do not print the parsed json to STDOUT'
- },
- forcePrettyPrint: {
- flag: true,
- string: '-p, --pretty-print',
- help: 'force pretty printing even if invalid'
- }
- }).parse();
-
-if (options.compact) {
- var fileName = options.file? options.file + ': ' : '';
- parser.parseError = parser.lexer.parseError = function(str, hash) {
- console.error(fileName + 'line '+ hash.loc.first_line +', col '+ hash.loc.last_column +', found: \''+ hash.token +'\' - expected: '+ hash.expected.join(', ') +'.');
- throw new Error(str);
- };
-}
-
-function parse (source) {
- var parsed,
- formatted;
-
- try {
- parsed = options.sort ?
- sortObject(parser.parse(source)) :
- parser.parse(source);
-
- if (options.validate) {
- var env = JSV.createEnvironment(options.env);
- var schema = JSON.parse(fs.readFileSync(path.normalize(options.validate), "utf8"));
- var report = env.validate(parsed, schema);
- if (report.errors.length) {
- throw report.errors.reduce(schemaError, 'Validation Errors:');
- }
- }
-
- return JSON.stringify(parsed, null, options.indent);
- } catch (e) {
- if (options.forcePrettyPrint) {
- /* From https://github.com/umbrae/jsonlintdotcom:
- * If we failed to validate, run our manual formatter and then re-validate so that we
- * can get a better line number. On a successful validate, we don't want to run our
- * manual formatter because the automatic one is faster and probably more reliable.
- */
-
- try {
- formatted = formatter.formatJson(source, options.indent);
- // Re-parse so exception output gets better line numbers
- parsed = parser.parse(formatted);
- } catch (e) {
- if (! options.compact) {
- console.error(e);
- }
- // force the pretty print before exiting
- console.log(formatted);
- }
- } else {
- if (! options.compact) {
- console.error(e);
- }
- }
- process.exit(1);
- }
-}
-
-function schemaError (str, err) {
- return str +
- "\n\n"+err.message +
- "\nuri: " + err.uri +
- "\nschemaUri: " + err.schemaUri +
- "\nattribute: " + err.attribute +
- "\ndetails: " + JSON.stringify(err.details);
-}
-
-function main (args) {
- var source = '';
- if (options.file) {
- var json = path.normalize(options.file);
- source = parse(fs.readFileSync(json, "utf8"));
- if (options.inplace) {
- fs.writeSync(fs.openSync(json,'w+'), source, 0, "utf8");
- } else {
- if (! options.quiet) { console.log(source)};
- }
- } else {
- var stdin = process.openStdin();
- stdin.setEncoding('utf8');
-
- stdin.on('data', function (chunk) {
- source += chunk.toString('utf8');
- });
- stdin.on('end', function () {
- if (! options.quiet) {console.log(parse(source))};
- });
- }
-}
-
-// from http://stackoverflow.com/questions/1359761/sorting-a-json-object-in-javascript
-function sortObject(o) {
- if (Array.isArray(o)) {
- return o.map(sortObject);
- } else if (Object.prototype.toString.call(o) !== '[object Object]') {
- return o;
- }
-
- var sorted = {},
- key, a = [];
-
- for (key in o) {
- if (o.hasOwnProperty(key)) {
- a.push(key);
- }
- }
-
- a.sort();
-
- for (key = 0; key < a.length; key++) {
- sorted[a[key]] = sortObject(o[a[key]]);
- }
- return sorted;
-}
-
-main(process.argv.slice(1));
diff --git a/lib/formatter.js b/lib/formatter.js
deleted file mode 100644
index e6e2726..0000000
--- a/lib/formatter.js
+++ /dev/null
@@ -1,92 +0,0 @@
-#!/usr/bin/env node
-
-/**
- * Manual formatter taken straight from https://github.com/umbrae/jsonlintdotcom
-**/
-
-/*jslint white: true, devel: true, onevar: true, browser: true, undef: true, nomen: true, regexp: true, plusplus: false, bitwise: true, newcap: true, maxerr: 50, indent: 4 */
-
-/**
- * jsl.format - Provide json reformatting in a character-by-character approach, so that even invalid JSON may be reformatted (to the best of its ability).
- *
-**/
-var formatter = (function () {
-
- function repeat(s, count) {
- return new Array(count + 1).join(s);
- }
-
- function formatJson(json, indentChars) {
- var i = 0,
- il = 0,
- tab = (typeof indentChars !== "undefined") ? indentChars : " ",
- newJson = "",
- indentLevel = 0,
- inString = false,
- currentChar = null;
-
- for (i = 0, il = json.length; i < il; i += 1) {
- currentChar = json.charAt(i);
-
- switch (currentChar) {
- case '{':
- case '[':
- if (!inString) {
- newJson += currentChar + "\n" + repeat(tab, indentLevel + 1);
- indentLevel += 1;
- } else {
- newJson += currentChar;
- }
- break;
- case '}':
- case ']':
- if (!inString) {
- indentLevel -= 1;
- newJson += "\n" + repeat(tab, indentLevel) + currentChar;
- } else {
- newJson += currentChar;
- }
- break;
- case ',':
- if (!inString) {
- newJson += ",\n" + repeat(tab, indentLevel);
- } else {
- newJson += currentChar;
- }
- break;
- case ':':
- if (!inString) {
- newJson += ": ";
- } else {
- newJson += currentChar;
- }
- break;
- case ' ':
- case "\n":
- case "\t":
- if (inString) {
- newJson += currentChar;
- }
- break;
- case '"':
- if (i > 0 && json.charAt(i - 1) !== '\\') {
- inString = !inString;
- }
- newJson += currentChar;
- break;
- default:
- newJson += currentChar;
- break;
- }
- }
-
- return newJson;
- }
-
- return { "formatJson": formatJson };
-
-}());
-
-if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
- exports.formatter = formatter;
-}
\ No newline at end of file
diff --git a/lib/jsonlint.js b/lib/jsonlint.js
deleted file mode 100644
index 598c18c..0000000
--- a/lib/jsonlint.js
+++ /dev/null
@@ -1,432 +0,0 @@
-/* Jison generated parser */
-var jsonlint = (function(){
-var parser = {trace: function trace() { },
-yy: {},
-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},
-terminals_: {2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},
-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]],
-performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
-
-var $0 = $$.length - 1;
-switch (yystate) {
-case 1: // replace escaped characters with actual character
- this.$ = yytext.replace(/\\(\\|")/g, "$"+"1")
- .replace(/\\n/g,'\n')
- .replace(/\\r/g,'\r')
- .replace(/\\t/g,'\t')
- .replace(/\\v/g,'\v')
- .replace(/\\f/g,'\f')
- .replace(/\\b/g,'\b');
-
-break;
-case 2:this.$ = Number(yytext);
-break;
-case 3:this.$ = null;
-break;
-case 4:this.$ = true;
-break;
-case 5:this.$ = false;
-break;
-case 6:return this.$ = $$[$0-1];
-break;
-case 13:this.$ = {};
-break;
-case 14:this.$ = $$[$0-1];
-break;
-case 15:this.$ = [$$[$0-2], $$[$0]];
-break;
-case 16:this.$ = {}; this.$[$$[$0][0]] = $$[$0][1];
-break;
-case 17:this.$ = $$[$0-2]; $$[$0-2][$$[$0][0]] = $$[$0][1];
-break;
-case 18:this.$ = [];
-break;
-case 19:this.$ = $$[$0-1];
-break;
-case 20:this.$ = [$$[$0]];
-break;
-case 21:this.$ = $$[$0-2]; $$[$0-2].push($$[$0]);
-break;
-}
-},
-table: [{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],
-defaultActions: {16:[2,6]},
-parseError: function parseError(str, hash) {
- throw new Error(str);
-},
-parse: function parse(input) {
- var self = this,
- stack = [0],
- vstack = [null], // semantic value stack
- lstack = [], // location stack
- table = this.table,
- yytext = '',
- yylineno = 0,
- yyleng = 0,
- recovering = 0,
- TERROR = 2,
- EOF = 1;
-
- //this.reductionCount = this.shiftCount = 0;
-
- this.lexer.setInput(input);
- this.lexer.yy = this.yy;
- this.yy.lexer = this.lexer;
- if (typeof this.lexer.yylloc == 'undefined')
- this.lexer.yylloc = {};
- var yyloc = this.lexer.yylloc;
- lstack.push(yyloc);
-
- if (typeof this.yy.parseError === 'function')
- this.parseError = this.yy.parseError;
-
- function popStack (n) {
- stack.length = stack.length - 2*n;
- vstack.length = vstack.length - n;
- lstack.length = lstack.length - n;
- }
-
- function lex() {
- var token;
- token = self.lexer.lex() || 1; // $end = 1
- // if token isn't its numeric value, convert
- if (typeof token !== 'number') {
- token = self.symbols_[token] || token;
- }
- return token;
- }
-
- var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected;
- while (true) {
- // retreive state number from top of stack
- state = stack[stack.length-1];
-
- // use default actions if available
- if (this.defaultActions[state]) {
- action = this.defaultActions[state];
- } else {
- if (symbol == null)
- symbol = lex();
- // read action for current state and first input
- action = table[state] && table[state][symbol];
- }
-
- // handle parse error
- _handle_error:
- if (typeof action === 'undefined' || !action.length || !action[0]) {
-
- if (!recovering) {
- // Report error
- expected = [];
- for (p in table[state]) if (this.terminals_[p] && p > 2) {
- expected.push("'"+this.terminals_[p]+"'");
- }
- var errStr = '';
- if (this.lexer.showPosition) {
- errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
- } else {
- errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
- (symbol == 1 /*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});
- }
-
- // just recovered from another error
- if (recovering == 3) {
- if (symbol == EOF) {
- throw new Error(errStr || 'Parsing halted.');
- }
-
- // discard current lookahead and grab another
- yyleng = this.lexer.yyleng;
- yytext = this.lexer.yytext;
- yylineno = this.lexer.yylineno;
- yyloc = this.lexer.yylloc;
- symbol = lex();
- }
-
- // try to recover from error
- while (1) {
- // check for error recovery rule in this state
- if ((TERROR.toString()) in table[state]) {
- break;
- }
- if (state == 0) {
- throw new Error(errStr || 'Parsing halted.');
- }
- popStack(1);
- state = stack[stack.length-1];
- }
-
- preErrorSymbol = symbol; // save the lookahead token
- symbol = TERROR; // insert generic error symbol as new lookahead
- state = stack[stack.length-1];
- action = table[state] && table[state][TERROR];
- recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
- }
-
- // this shouldn't happen, unless resolve defaults are off
- if (action[0] instanceof Array && action.length > 1) {
- throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
- }
-
- switch (action[0]) {
-
- case 1: // shift
- //this.shiftCount++;
-
- stack.push(symbol);
- vstack.push(this.lexer.yytext);
- lstack.push(this.lexer.yylloc);
- stack.push(action[1]); // push state
- symbol = null;
- if (!preErrorSymbol) { // normal execution/no error
- yyleng = this.lexer.yyleng;
- yytext = this.lexer.yytext;
- yylineno = this.lexer.yylineno;
- yyloc = this.lexer.yylloc;
- if (recovering > 0)
- recovering--;
- } else { // error just occurred, resume old lookahead f/ before error
- symbol = preErrorSymbol;
- preErrorSymbol = null;
- }
- break;
-
- case 2: // reduce
- //this.reductionCount++;
-
- len = this.productions_[action[1]][1];
-
- // perform semantic action
- yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
- // default location, uses first token for firsts, last for lasts
- yyval._$ = {
- first_line: lstack[lstack.length-(len||1)].first_line,
- last_line: lstack[lstack.length-1].last_line,
- first_column: lstack[lstack.length-(len||1)].first_column,
- last_column: lstack[lstack.length-1].last_column
- };
- r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
-
- if (typeof r !== 'undefined') {
- return r;
- }
-
- // pop off stack
- if (len) {
- stack = stack.slice(0,-1*len*2);
- vstack = vstack.slice(0, -1*len);
- lstack = lstack.slice(0, -1*len);
- }
-
- stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
- vstack.push(yyval.$);
- lstack.push(yyval._$);
- // goto new state = table[STATE][NONTERMINAL]
- newState = table[stack[stack.length-2]][stack[stack.length-1]];
- stack.push(newState);
- break;
-
- case 3: // accept
- return true;
- }
-
- }
-
- return true;
-}};
-/* Jison generated lexer */
-var lexer = (function(){
-var lexer = ({EOF:1,
-parseError:function parseError(str, hash) {
- if (this.yy.parseError) {
- this.yy.parseError(str, hash);
- } else {
- throw new Error(str);
- }
- },
-setInput:function (input) {
- this._input = input;
- this._more = this._less = 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};
- return this;
- },
-input:function () {
- var ch = this._input[0];
- this.yytext+=ch;
- this.yyleng++;
- this.match+=ch;
- this.matched+=ch;
- var lines = ch.match(/\n/);
- if (lines) this.yylineno++;
- this._input = this._input.slice(1);
- return ch;
- },
-unput:function (ch) {
- this._input = ch + this._input;
- return this;
- },
-more:function () {
- this._more = true;
- return this;
- },
-less:function (n) {
- this._input = this.match.slice(n) + this._input;
- },
-pastInput:function () {
- var past = this.matched.substr(0, this.matched.length - this.match.length);
- return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
- },
-upcomingInput:function () {
- var next = this.match;
- if (next.length < 20) {
- next += this._input.substr(0, 20-next.length);
- }
- return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
- },
-showPosition:function () {
- var pre = this.pastInput();
- var c = new Array(pre.length + 1).join("-");
- return pre + this.upcomingInput() + "\n" + c+"^";
- },
-next:function () {
- if (this.done) {
- return this.EOF;
- }
- if (!this._input) this.done = true;
-
- var token,
- match,
- tempMatch,
- index,
- col,
- lines;
- if (!this._more) {
- this.yytext = '';
- this.match = '';
- }
- var rules = this._currentRules();
- for (var i=0;i < rules.length; i++) {
- tempMatch = this._input.match(this.rules[rules[i]]);
- if (tempMatch && (!match || tempMatch[0].length > match[0].length)) {
- match = tempMatch;
- index = i;
- if (!this.options.flex) break;
- }
- }
- if (match) {
- lines = match[0].match(/\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-1 : this.yylloc.last_column + match[0].length}
- this.yytext += match[0];
- this.match += match[0];
- this.yyleng = this.yytext.length;
- 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;
- }
- if (this._input === "") {
- return this.EOF;
- } else {
- this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
- {text: "", token: null, line: this.yylineno});
- }
- },
-lex:function lex() {
- var r = this.next();
- if (typeof r !== 'undefined') {
- return r;
- } else {
- return this.lex();
- }
- },
-begin:function begin(condition) {
- this.conditionStack.push(condition);
- },
-popState:function popState() {
- return this.conditionStack.pop();
- },
-_currentRules:function _currentRules() {
- return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
- },
-topState:function () {
- return this.conditionStack[this.conditionStack.length-2];
- },
-pushState:function begin(condition) {
- this.begin(condition);
- }});
-lexer.options = {};
-lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
-
-var YYSTATE=YY_START
-switch($avoiding_name_collisions) {
-case 0:/* skip whitespace */
-break;
-case 1:return 6
-break;
-case 2:yy_.yytext = yy_.yytext.substr(1,yy_.yyleng-2); return 4
-break;
-case 3:return 17
-break;
-case 4:return 18
-break;
-case 5:return 23
-break;
-case 6:return 24
-break;
-case 7:return 22
-break;
-case 8:return 21
-break;
-case 9:return 10
-break;
-case 10:return 11
-break;
-case 11:return 8
-break;
-case 12:return 14
-break;
-case 13:return 'INVALID'
-break;
-}
-};
-lexer.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)/,/^(?:$)/,/^(?:.)/];
-lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13],"inclusive":true}};
-
-
-;
-return lexer;})()
-parser.lexer = lexer;
-return parser;
-})();
-if (typeof require !== 'undefined' && typeof exports !== 'undefined') {
-exports.parser = jsonlint;
-exports.parse = function () { return jsonlint.parse.apply(jsonlint, arguments); }
-exports.main = function commonjsMain(args) {
- if (!args[1])
- throw new Error('Usage: '+args[0]+' FILE');
- if (typeof process !== 'undefined') {
- var source = require('fs').readFileSync(require('path').join(process.cwd(), args[1]), "utf8");
- } else {
- var cwd = require("file").path(require("file").cwd());
- var source = cwd.join(args[1]).read({charset: "utf-8"});
- }
- return exports.parser.parse(source);
-}
-if (typeof module !== 'undefined' && require.main === module) {
- exports.main(typeof process !== 'undefined' ? process.argv.slice(1) : require("system").args);
-}
-}
\ No newline at end of file
diff --git a/package-lock.json b/package-lock.json
deleted file mode 100644
index 5139c33..0000000
--- a/package-lock.json
+++ /dev/null
@@ -1,243 +0,0 @@
-{
- "name": "jsonlint",
- "version": "1.6.3",
- "lockfileVersion": 1,
- "requires": true,
- "dependencies": {
- "JSONSelect": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/JSONSelect/-/JSONSelect-0.4.0.tgz",
- "integrity": "sha1-oI7cxn6z/L6Z7WMIVTRKDPKCu40=",
- "dev": true
- },
- "JSV": {
- "version": "4.0.2",
- "resolved": "https://registry.npmjs.org/JSV/-/JSV-4.0.2.tgz",
- "integrity": "sha1-0Hf2glVx+CEy+d/67Vh7QCn+/1c="
- },
- "amdefine": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/amdefine/-/amdefine-1.0.1.tgz",
- "integrity": "sha1-SlKCrBZHKek2Gbz9OtFR+BfOkfU=",
- "dev": true,
- "optional": true
- },
- "ansi-font": {
- "version": "0.0.2",
- "resolved": "https://registry.npmjs.org/ansi-font/-/ansi-font-0.0.2.tgz",
- "integrity": "sha1-iQMBvVhBRi/TnAt3Ca/R9SUUMzE=",
- "dev": true
- },
- "ansi-styles": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-1.0.0.tgz",
- "integrity": "sha1-yxAt8cVvUSPquLZ817mAJ6AnkXg="
- },
- "chalk": {
- "version": "0.4.0",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-0.4.0.tgz",
- "integrity": "sha1-UZmj3c0MHv4jvAjBsCewYXbgxk8=",
- "requires": {
- "ansi-styles": "1.0.0",
- "has-color": "0.1.7",
- "strip-ansi": "0.1.1"
- }
- },
- "cjson": {
- "version": "0.3.0",
- "resolved": "https://registry.npmjs.org/cjson/-/cjson-0.3.0.tgz",
- "integrity": "sha1-5kObkHA9MS/24iJAl76pLOPQKhQ=",
- "dev": true,
- "requires": {
- "jsonlint": "1.6.0"
- }
- },
- "colors": {
- "version": "0.5.1",
- "resolved": "https://registry.npmjs.org/colors/-/colors-0.5.1.tgz",
- "integrity": "sha1-fQAj6usVTo7p/Oddy5I9DtFmd3Q=",
- "dev": true
- },
- "commander": {
- "version": "2.14.1",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.14.1.tgz",
- "integrity": "sha512-+YR16o3rK53SmWHU3rEM3tPAh2rwb1yPcQX5irVn7mb0gXbwuCCrnkbV5+PBfETdfg1vui07nM6PCG1zndcjQw==",
- "dev": true
- },
- "ebnf-parser": {
- "version": "0.1.10",
- "resolved": "https://registry.npmjs.org/ebnf-parser/-/ebnf-parser-0.1.10.tgz",
- "integrity": "sha1-zR9rpHfFY4xAyX7ZtXLbW6tdgzE=",
- "dev": true
- },
- "escodegen": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/escodegen/-/escodegen-1.3.3.tgz",
- "integrity": "sha1-8CQBb1qI4Eb9EgBQVek5gC5sXyM=",
- "dev": true,
- "requires": {
- "esprima": "1.1.1",
- "estraverse": "1.5.1",
- "esutils": "1.0.0",
- "source-map": "0.1.43"
- }
- },
- "esprima": {
- "version": "1.1.1",
- "resolved": "https://registry.npmjs.org/esprima/-/esprima-1.1.1.tgz",
- "integrity": "sha1-W28VR/TRAuZw4UDFCb5ncdautUk=",
- "dev": true
- },
- "estraverse": {
- "version": "1.5.1",
- "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-1.5.1.tgz",
- "integrity": "sha1-hno+jlip+EYYr7bC3bzZFrfLr3E=",
- "dev": true
- },
- "esutils": {
- "version": "1.0.0",
- "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.0.0.tgz",
- "integrity": "sha1-gVHTWOIMisx/t0XnRywAJf5JZXA=",
- "dev": true
- },
- "has-color": {
- "version": "0.1.7",
- "resolved": "https://registry.npmjs.org/has-color/-/has-color-0.1.7.tgz",
- "integrity": "sha1-ZxRKUmDDT8PMpnfQQdr1L+e3iy8="
- },
- "jison": {
- "version": "0.4.18",
- "resolved": "https://registry.npmjs.org/jison/-/jison-0.4.18.tgz",
- "integrity": "sha512-FKkCiJvozgC7VTHhMJ00a0/IApSxhlGsFIshLW6trWJ8ONX2TQJBBz6DlcO1Gffy4w9LT+uL+PA+CVnUSJMF7w==",
- "dev": true,
- "requires": {
- "JSONSelect": "0.4.0",
- "cjson": "0.3.0",
- "ebnf-parser": "0.1.10",
- "escodegen": "1.3.3",
- "esprima": "1.1.1",
- "jison-lex": "0.3.4",
- "lex-parser": "0.1.4",
- "nomnom": "1.5.2"
- },
- "dependencies": {
- "nomnom": {
- "version": "1.5.2",
- "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz",
- "integrity": "sha1-9DRUSKhTz71cDSYyDyR3qwUm/i8=",
- "dev": true,
- "requires": {
- "colors": "0.5.1",
- "underscore": "1.1.7"
- }
- },
- "underscore": {
- "version": "1.1.7",
- "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.1.7.tgz",
- "integrity": "sha1-QLq4S60Z0jAJbo1u9ii/8FXYPbA=",
- "dev": true
- }
- }
- },
- "jison-lex": {
- "version": "0.3.4",
- "resolved": "https://registry.npmjs.org/jison-lex/-/jison-lex-0.3.4.tgz",
- "integrity": "sha1-gcoo2E+ESZ36jFlNzePYo/Jux6U=",
- "dev": true,
- "requires": {
- "lex-parser": "0.1.4",
- "nomnom": "1.5.2"
- },
- "dependencies": {
- "nomnom": {
- "version": "1.5.2",
- "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.5.2.tgz",
- "integrity": "sha1-9DRUSKhTz71cDSYyDyR3qwUm/i8=",
- "dev": true,
- "requires": {
- "colors": "0.5.1",
- "underscore": "1.1.7"
- }
- },
- "underscore": {
- "version": "1.1.7",
- "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.1.7.tgz",
- "integrity": "sha1-QLq4S60Z0jAJbo1u9ii/8FXYPbA=",
- "dev": true
- }
- }
- },
- "jsonlint": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/jsonlint/-/jsonlint-1.6.0.tgz",
- "integrity": "sha1-iKpGvCiaesk7tGyuLVihh6m7SUo=",
- "dev": true,
- "requires": {
- "JSV": "4.0.2",
- "nomnom": "1.8.1"
- }
- },
- "lex-parser": {
- "version": "0.1.4",
- "resolved": "https://registry.npmjs.org/lex-parser/-/lex-parser-0.1.4.tgz",
- "integrity": "sha1-ZMTwJfF/1Tv7RXY/rrFvAVp0dVA=",
- "dev": true
- },
- "nomnom": {
- "version": "1.8.1",
- "resolved": "https://registry.npmjs.org/nomnom/-/nomnom-1.8.1.tgz",
- "integrity": "sha1-IVH3Ikcrp55Qp2/BJbuMjy5Nwqc=",
- "requires": {
- "chalk": "0.4.0",
- "underscore": "1.6.0"
- }
- },
- "source-map": {
- "version": "0.1.43",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.1.43.tgz",
- "integrity": "sha1-wkvBRspRfBRx9drL4lcbK3+eM0Y=",
- "dev": true,
- "optional": true,
- "requires": {
- "amdefine": "1.0.1"
- }
- },
- "strip-ansi": {
- "version": "0.1.1",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-0.1.1.tgz",
- "integrity": "sha1-OeipjQRNFQZgq+SmgIrPcLt7yZE="
- },
- "test": {
- "version": "0.6.0",
- "resolved": "https://registry.npmjs.org/test/-/test-0.6.0.tgz",
- "integrity": "sha1-WYasRF7Bd1QyJRLRBLoyyKY+k44=",
- "dev": true,
- "requires": {
- "ansi-font": "0.0.2"
- }
- },
- "uglify-js": {
- "version": "3.3.11",
- "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.3.11.tgz",
- "integrity": "sha512-AKLsYcdV+sS5eAE4NtVXF6f2u/DCQynQm0jTGxF261+Vltu1dYNuHzjqDmk11gInj+H/zJIM2EAwXG3MzPb3VA==",
- "dev": true,
- "requires": {
- "commander": "2.14.1",
- "source-map": "0.6.1"
- },
- "dependencies": {
- "source-map": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
- "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
- "dev": true
- }
- }
- },
- "underscore": {
- "version": "1.6.0",
- "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz",
- "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag="
- }
- }
-}
diff --git a/package.json b/package.json
deleted file mode 100644
index 7a064ed..0000000
--- a/package.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "author": "Zach Carter