Initial commit
This commit is contained in:
20
node_modules/jsonic/LICENSE
generated
vendored
Normal file
20
node_modules/jsonic/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2013-2017 Richard Rodger
|
||||
|
||||
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.
|
||||
3
node_modules/jsonic/jsonic-min.js
generated
vendored
Normal file
3
node_modules/jsonic/jsonic-min.js
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/jsonic/jsonic-min.map
generated
vendored
Normal file
1
node_modules/jsonic/jsonic-min.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
2050
node_modules/jsonic/jsonic-parser.js
generated
vendored
Normal file
2050
node_modules/jsonic/jsonic-parser.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
178
node_modules/jsonic/jsonic-parser.pegjs
generated
vendored
Normal file
178
node_modules/jsonic/jsonic-parser.pegjs
generated
vendored
Normal file
@@ -0,0 +1,178 @@
|
||||
|
||||
|
||||
/* JSON parser based on the grammar described at http://json.org/. */
|
||||
|
||||
{
|
||||
/*
|
||||
* We can't return |null| in the |value| rule because that would mean parse
|
||||
* failure. So we return a special object instead and convert it to |null|
|
||||
* later.
|
||||
*/
|
||||
|
||||
var null_ = new Object;
|
||||
|
||||
function fixNull(value) {
|
||||
return value === null_ ? null : value;
|
||||
}
|
||||
}
|
||||
|
||||
/* ===== Syntactical Elements ===== */
|
||||
|
||||
start
|
||||
= _ object:object { return object; }
|
||||
/ _ array:array { return array; }
|
||||
|
||||
object
|
||||
= "{" _ "}" _ { return {}; }
|
||||
/ "{" _ members:members "}" _ { return members; }
|
||||
|
||||
members
|
||||
= ","? head:pair? tail:("," _ pair)* ","? _ {
|
||||
var result = {};
|
||||
if( head ) { result[head[0]] = fixNull(head[1]); }
|
||||
for (var i = 0; i < tail.length; i++) {
|
||||
result[tail[i][2][0]] = fixNull(tail[i][2][1]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
pair
|
||||
= name:key _ ":" _ value:value { return [name, value]; }
|
||||
|
||||
array
|
||||
= "[" _ "]" _ { return []; }
|
||||
/ "[" _ elements:elements "]" _ { return elements; }
|
||||
|
||||
elements
|
||||
= ","? head:value? tail:("," _ value)* ","? _ {
|
||||
var result = [];
|
||||
if( typeof head !== 'undefined' && head !== null ) { result.push( fixNull(head) ) }
|
||||
for (var i = 0; i < tail.length; i++) {
|
||||
result.push(fixNull(tail[i][2]));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
value
|
||||
= string
|
||||
/ single
|
||||
/ object
|
||||
/ array
|
||||
/ "true" _ { return true; }
|
||||
/ "false" _ { return false; }
|
||||
/ "null" _ { return null_; }
|
||||
/ number
|
||||
/ lit:literal { return lit.join('').trim() }
|
||||
|
||||
/* ===== Lexical Elements ===== */
|
||||
|
||||
string "double-quote string"
|
||||
= '"' '"' _ { return ""; }
|
||||
/ '"' chars:chars '"' _ { return chars; }
|
||||
|
||||
single "single-quote string"
|
||||
= '\'' '\'' _ { return ""; }
|
||||
/ '\'' chars:schars '\'' _ { return chars; }
|
||||
|
||||
chars
|
||||
= chars:char+ { return chars.join(""); }
|
||||
|
||||
char
|
||||
// In the original JSON grammar: "any-Unicode-character-except-"-or-\-or-control-character"
|
||||
= [^"\\\0-\x1F\x7f]
|
||||
/ '\\"' { return '"'; }
|
||||
/ "\\\\" { return "\\"; }
|
||||
/ "\\/" { return "/"; }
|
||||
/ "\\b" { return "\b"; }
|
||||
/ "\\f" { return "\f"; }
|
||||
/ "\\n" { return "\n"; }
|
||||
/ "\\r" { return "\r"; }
|
||||
/ "\\t" { return "\t"; }
|
||||
/ "\\u" h1:hexDigit h2:hexDigit h3:hexDigit h4:hexDigit {
|
||||
return String.fromCharCode(parseInt("0x" + h1 + h2 + h3 + h4)); }
|
||||
|
||||
schars
|
||||
= chars:schar+ { return chars.join(""); }
|
||||
|
||||
schar
|
||||
// In the original JSON grammar: "any-Unicode-character-except-"-or-\-or-control-character"
|
||||
= [^'\\\0-\x1F\x7f]
|
||||
/ '\\\'' { return '\''; }
|
||||
/ "\\\\" { return "\\"; }
|
||||
/ "\\/" { return "/"; }
|
||||
/ "\\b" { return "\b"; }
|
||||
/ "\\f" { return "\f"; }
|
||||
/ "\\n" { return "\n"; }
|
||||
/ "\\r" { return "\r"; }
|
||||
/ "\\t" { return "\t"; }
|
||||
/ "\\u" h1:hexDigit h2:hexDigit h3:hexDigit h4:hexDigit {
|
||||
return String.fromCharCode(parseInt("0x" + h1 + h2 + h3 + h4)); }
|
||||
|
||||
|
||||
key "key"
|
||||
= string
|
||||
/ single
|
||||
/ chars:[a-zA-Z0-9_\$\-]+ { return chars.join('') }
|
||||
|
||||
literal
|
||||
= lit:litchar+
|
||||
|
||||
litchar
|
||||
= [^,}\]]
|
||||
|
||||
|
||||
number "number"
|
||||
|
||||
= int_:int frac:frac exp:exp _ suffix:litchar*
|
||||
{ return 0 === suffix.length ? parseFloat(int_ + frac + exp) : (int_ + frac + exp + suffix.join('')).trim(); }
|
||||
|
||||
/ int_:int frac:frac _ suffix:litchar*
|
||||
{ return 0 === suffix.length ? parseFloat(int_ + frac) : (int_ + frac + suffix.join('')).trim(); }
|
||||
|
||||
/ int_:int exp:exp _ suffix:litchar*
|
||||
{ return 0 === suffix.length ? parseFloat(int_ + exp) : (int_ + exp + suffix.join('')).trim(); }
|
||||
|
||||
/ int_:int _ suffix:litchar*
|
||||
{ return 0 === suffix.length ? parseFloat(int_) : (int_ + suffix.join('')).trim(); }
|
||||
|
||||
|
||||
int
|
||||
= digit19:digit19 digits:digits { return digit19 + digits; }
|
||||
/ digit:digit
|
||||
/ "-" digit19:digit19 digits:digits { return "-" + digit19 + digits; }
|
||||
/ "-" digit:digit { return "-" + digit; }
|
||||
|
||||
frac
|
||||
= "." digits:digits { return "." + digits; }
|
||||
|
||||
exp
|
||||
= e:e digits:digits { return e + digits; }
|
||||
|
||||
digits
|
||||
= digits:digit+ { return digits.join(""); }
|
||||
|
||||
e
|
||||
= e:[eE] sign:[+-]? { return e + (sign?sign:''); }
|
||||
|
||||
digit
|
||||
= [0-9]
|
||||
|
||||
digit19
|
||||
= [1-9]
|
||||
|
||||
hexDigit
|
||||
= [0-9a-fA-F]
|
||||
|
||||
|
||||
|
||||
|
||||
/* ===== Whitespace ===== */
|
||||
|
||||
_ "whitespace"
|
||||
= whitespace*
|
||||
|
||||
// Whitespace is undefined in the original JSON grammar, so I assume a simple
|
||||
// conventional definition consistent with ECMA-262, 5th ed.
|
||||
whitespace
|
||||
= [ \t\n\r]
|
||||
|
||||
2212
node_modules/jsonic/jsonic.js
generated
vendored
Normal file
2212
node_modules/jsonic/jsonic.js
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
28
node_modules/jsonic/package.json
generated
vendored
Normal file
28
node_modules/jsonic/package.json
generated
vendored
Normal file
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"name": "jsonic",
|
||||
"version": "0.3.1",
|
||||
"description": "A JSON parser that isn't strict.",
|
||||
"main": "jsonic.js",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/rjrodger/jsonic.git"
|
||||
},
|
||||
"homepage": "https://github.com/rjrodger/jsonic",
|
||||
"author": "Richard Rodger (http://richardrodger.com)",
|
||||
"license": "MIT",
|
||||
"files": [
|
||||
"README.md",
|
||||
"LICENSE",
|
||||
"jsonic.js",
|
||||
"jsonic-min.js",
|
||||
"jsonic-min.map",
|
||||
"jsonic-parser.js",
|
||||
"jsonic-parser.pegjs"
|
||||
],
|
||||
"devDependencies": {
|
||||
"jasmine-node": "^1.14.5",
|
||||
"pegjs": "^0.8.0",
|
||||
"phantomjs": "^1.8.2-3",
|
||||
"underscore": "^1.8.3"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user