Comparing version 0.1.1 to 0.1.2
@@ -1,3 +0,3 @@ | ||
/* Copyright (c) 2013 Richard Rodger, MIT License, https://github.com/rjrodger/jsonic */ | ||
/* Copyright (c) 2013-2015 Richard Rodger, MIT License, https://github.com/rjrodger/jsonic */ | ||
"use strict";(function(){var l=this,n=l.jsonic,u=l.jsonic=function(l){return l=""+l,"{"!=l[0]&&(l="{"+l+"}"),r.parse(l)};u.noConflict=function(){return l.previous_jsonic=n,self};var r=function(){function l(l){return'"'+l.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\x08/g,"\\b").replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\f/g,"\\f").replace(/\r/g,"\\r").replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g,escape)+'"'}var n={parse:function(n,u){function r(l){B>q||(q>B&&(B=q,D=[]),D.push(l))}function t(){var l,n,u,r;return u=q,r=q,l=_(),null!==l?(n=e(),null!==n?l=[l,n]:(l=null,q=r)):(l=null,q=r),null!==l&&(l=function(l,n){return n}(u,l[1])),null===l&&(q=u),l}function e(){var l,u,t,e,c,i,a;return i=q,a=q,123===n.charCodeAt(q)?(l="{",q++):(l=null,0===M&&r('"{"')),null!==l?(u=_(),null!==u?(125===n.charCodeAt(q)?(t="}",q++):(t=null,0===M&&r('"}"')),null!==t?(e=_(),null!==e?l=[l,u,t,e]:(l=null,q=a)):(l=null,q=a)):(l=null,q=a)):(l=null,q=a),null!==l&&(l=function(){return{}}(i)),null===l&&(q=i),null===l&&(i=q,a=q,123===n.charCodeAt(q)?(l="{",q++):(l=null,0===M&&r('"{"')),null!==l?(u=_(),null!==u?(t=o(),null!==t?(125===n.charCodeAt(q)?(e="}",q++):(e=null,0===M&&r('"}"')),null!==e?(c=_(),null!==c?l=[l,u,t,e,c]:(l=null,q=a)):(l=null,q=a)):(l=null,q=a)):(l=null,q=a)):(l=null,q=a),null!==l&&(l=function(l,n){return n}(i,l[2])),null===l&&(q=i)),l}function o(){var l,u,t,e,o,i,a,f;if(i=q,a=q,l=c(),null!==l){for(u=[],f=q,44===n.charCodeAt(q)?(t=",",q++):(t=null,0===M&&r('","')),null!==t?(e=_(),null!==e?(o=c(),null!==o?t=[t,e,o]:(t=null,q=f)):(t=null,q=f)):(t=null,q=f);null!==t;)u.push(t),f=q,44===n.charCodeAt(q)?(t=",",q++):(t=null,0===M&&r('","')),null!==t?(e=_(),null!==e?(o=c(),null!==o?t=[t,e,o]:(t=null,q=f)):(t=null,q=f)):(t=null,q=f);null!==u?(44===n.charCodeAt(q)?(t=",",q++):(t=null,0===M&&r('","')),t=null!==t?t:"",null!==t?(e=_(),null!==e?l=[l,u,t,e]:(l=null,q=a)):(l=null,q=a)):(l=null,q=a)}else l=null,q=a;return null!==l&&(l=function(l,n,u){var r={};r[n[0]]=$(n[1]);for(var t=0;t<u.length;t++)r[u[t][2][0]]=$(u[t][2][1]);return r}(i,l[0],l[1])),null===l&&(q=i),l}function c(){var l,u,t,e,o,c;return o=q,c=q,l=b(),null!==l?(58===n.charCodeAt(q)?(u=":",q++):(u=null,0===M&&r('":"')),null!==u?(t=_(),null!==t?(e=f(),null!==e?l=[l,u,t,e]:(l=null,q=c)):(l=null,q=c)):(l=null,q=c)):(l=null,q=c),null!==l&&(l=function(l,n,u){return[n,u]}(o,l[0],l[3])),null===l&&(q=o),l}function i(){var l,u,t,e,o,c,i;return c=q,i=q,91===n.charCodeAt(q)?(l="[",q++):(l=null,0===M&&r('"["')),null!==l?(u=_(),null!==u?(93===n.charCodeAt(q)?(t="]",q++):(t=null,0===M&&r('"]"')),null!==t?(e=_(),null!==e?l=[l,u,t,e]:(l=null,q=i)):(l=null,q=i)):(l=null,q=i)):(l=null,q=i),null!==l&&(l=function(){return[]}(c)),null===l&&(q=c),null===l&&(c=q,i=q,91===n.charCodeAt(q)?(l="[",q++):(l=null,0===M&&r('"["')),null!==l?(u=_(),null!==u?(t=a(),null!==t?(93===n.charCodeAt(q)?(e="]",q++):(e=null,0===M&&r('"]"')),null!==e?(o=_(),null!==o?l=[l,u,t,e,o]:(l=null,q=i)):(l=null,q=i)):(l=null,q=i)):(l=null,q=i)):(l=null,q=i),null!==l&&(l=function(l,n){return n}(c,l[2])),null===l&&(q=c)),l}function a(){var l,u,t,e,o,c,i,a;if(c=q,i=q,l=f(),null!==l){for(u=[],a=q,44===n.charCodeAt(q)?(t=",",q++):(t=null,0===M&&r('","')),null!==t?(e=_(),null!==e?(o=f(),null!==o?t=[t,e,o]:(t=null,q=a)):(t=null,q=a)):(t=null,q=a);null!==t;)u.push(t),a=q,44===n.charCodeAt(q)?(t=",",q++):(t=null,0===M&&r('","')),null!==t?(e=_(),null!==e?(o=f(),null!==o?t=[t,e,o]:(t=null,q=a)):(t=null,q=a)):(t=null,q=a);null!==u?l=[l,u]:(l=null,q=i)}else l=null,q=i;return null!==l&&(l=function(l,n,u){for(var r=[$(n)],t=0;t<u.length;t++)r.push($(u[t][2]));return r}(c,l[0],l[1])),null===l&&(q=c),l}function f(){var l,u,t,o;return l=s(),null===l&&(l=h(),null===l&&(l=g(),null===l&&(l=e(),null===l&&(l=i(),null===l&&(t=q,o=q,"true"===n.substr(q,4)?(l="true",q+=4):(l=null,0===M&&r('"true"')),null!==l?(u=_(),null!==u?l=[l,u]:(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(){return!0}(t)),null===l&&(q=t),null===l&&(t=q,o=q,"false"===n.substr(q,5)?(l="false",q+=5):(l=null,0===M&&r('"false"')),null!==l?(u=_(),null!==u?l=[l,u]:(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(){return!1}(t)),null===l&&(q=t),null===l&&(t=q,o=q,"null"===n.substr(q,4)?(l="null",q+=4):(l=null,0===M&&r('"null"')),null!==l?(u=_(),null!==u?l=[l,u]:(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(){return O}(t)),null===l&&(q=t),null===l&&(t=q,l=C(),null!==l&&(l=function(l,n){return n.join("")}(t,l)),null===l&&(q=t))))))))),l}function s(){var l,u,t,e,o,c;return M++,o=q,c=q,34===n.charCodeAt(q)?(l='"',q++):(l=null,0===M&&r('"\\""')),null!==l?(34===n.charCodeAt(q)?(u='"',q++):(u=null,0===M&&r('"\\""')),null!==u?(t=_(),null!==t?l=[l,u,t]:(l=null,q=c)):(l=null,q=c)):(l=null,q=c),null!==l&&(l=function(){return""}(o)),null===l&&(q=o),null===l&&(o=q,c=q,34===n.charCodeAt(q)?(l='"',q++):(l=null,0===M&&r('"\\""')),null!==l?(u=A(),null!==u?(34===n.charCodeAt(q)?(t='"',q++):(t=null,0===M&&r('"\\""')),null!==t?(e=_(),null!==e?l=[l,u,t,e]:(l=null,q=c)):(l=null,q=c)):(l=null,q=c)):(l=null,q=c),null!==l&&(l=function(l,n){return n}(o,l[1])),null===l&&(q=o)),M--,0===M&&null===l&&r("double-quote string"),l}function h(){var l,u,t,e,o,c;return M++,o=q,c=q,39===n.charCodeAt(q)?(l="'",q++):(l=null,0===M&&r('"\'"')),null!==l?(39===n.charCodeAt(q)?(u="'",q++):(u=null,0===M&&r('"\'"')),null!==u?(t=_(),null!==t?l=[l,u,t]:(l=null,q=c)):(l=null,q=c)):(l=null,q=c),null!==l&&(l=function(){return""}(o)),null===l&&(q=o),null===l&&(o=q,c=q,39===n.charCodeAt(q)?(l="'",q++):(l=null,0===M&&r('"\'"')),null!==l?(u=p(),null!==u?(39===n.charCodeAt(q)?(t="'",q++):(t=null,0===M&&r('"\'"')),null!==t?(e=_(),null!==e?l=[l,u,t,e]:(l=null,q=c)):(l=null,q=c)):(l=null,q=c)):(l=null,q=c),null!==l&&(l=function(l,n){return n}(o,l[1])),null===l&&(q=o)),M--,0===M&&null===l&&r("single-quote string"),l}function A(){var l,n,u;if(u=q,n=d(),null!==n)for(l=[];null!==n;)l.push(n),n=d();else l=null;return null!==l&&(l=function(l,n){return n.join("")}(u,l)),null===l&&(q=u),l}function d(){var l,u,t,e,o,c,i;return/^[^"\\\0-\x1F]/.test(n.charAt(q))?(l=n.charAt(q),q++):(l=null,0===M&&r('[^"\\\\\\0-\\x1F]')),null===l&&(c=q,'\\"'===n.substr(q,2)?(l='\\"',q+=2):(l=null,0===M&&r('"\\\\\\""')),null!==l&&(l=function(){return'"'}(c)),null===l&&(q=c),null===l&&(c=q,"\\\\"===n.substr(q,2)?(l="\\\\",q+=2):(l=null,0===M&&r('"\\\\\\\\"')),null!==l&&(l=function(){return"\\"}(c)),null===l&&(q=c),null===l&&(c=q,"\\/"===n.substr(q,2)?(l="\\/",q+=2):(l=null,0===M&&r('"\\\\/"')),null!==l&&(l=function(){return"/"}(c)),null===l&&(q=c),null===l&&(c=q,"\\b"===n.substr(q,2)?(l="\\b",q+=2):(l=null,0===M&&r('"\\\\b"')),null!==l&&(l=function(){return"\b"}(c)),null===l&&(q=c),null===l&&(c=q,"\\f"===n.substr(q,2)?(l="\\f",q+=2):(l=null,0===M&&r('"\\\\f"')),null!==l&&(l=function(){return"\f"}(c)),null===l&&(q=c),null===l&&(c=q,"\\n"===n.substr(q,2)?(l="\\n",q+=2):(l=null,0===M&&r('"\\\\n"')),null!==l&&(l=function(){return"\n"}(c)),null===l&&(q=c),null===l&&(c=q,"\\r"===n.substr(q,2)?(l="\\r",q+=2):(l=null,0===M&&r('"\\\\r"')),null!==l&&(l=function(){return"\r"}(c)),null===l&&(q=c),null===l&&(c=q,"\\t"===n.substr(q,2)?(l="\\t",q+=2):(l=null,0===M&&r('"\\\\t"')),null!==l&&(l=function(){return" "}(c)),null===l&&(q=c),null===l&&(c=q,i=q,"\\u"===n.substr(q,2)?(l="\\u",q+=2):(l=null,0===M&&r('"\\\\u"')),null!==l?(u=S(),null!==u?(t=S(),null!==t?(e=S(),null!==e?(o=S(),null!==o?l=[l,u,t,e,o]:(l=null,q=i)):(l=null,q=i)):(l=null,q=i)):(l=null,q=i)):(l=null,q=i),null!==l&&(l=function(l,n,u,r,t){return String.fromCharCode(parseInt("0x"+n+u+r+t))}(c,l[1],l[2],l[3],l[4])),null===l&&(q=c)))))))))),l}function p(){var l,n,u;if(u=q,n=v(),null!==n)for(l=[];null!==n;)l.push(n),n=v();else l=null;return null!==l&&(l=function(l,n){return n.join("")}(u,l)),null===l&&(q=u),l}function v(){var l,u,t,e,o,c,i;return/^[^'\\\0-\x1F]/.test(n.charAt(q))?(l=n.charAt(q),q++):(l=null,0===M&&r("[^'\\\\\\0-\\x1F]")),null===l&&(c=q,"\\'"===n.substr(q,2)?(l="\\'",q+=2):(l=null,0===M&&r('"\\\\\'"')),null!==l&&(l=function(){return"'"}(c)),null===l&&(q=c),null===l&&(c=q,"\\\\"===n.substr(q,2)?(l="\\\\",q+=2):(l=null,0===M&&r('"\\\\\\\\"')),null!==l&&(l=function(){return"\\"}(c)),null===l&&(q=c),null===l&&(c=q,"\\/"===n.substr(q,2)?(l="\\/",q+=2):(l=null,0===M&&r('"\\\\/"')),null!==l&&(l=function(){return"/"}(c)),null===l&&(q=c),null===l&&(c=q,"\\b"===n.substr(q,2)?(l="\\b",q+=2):(l=null,0===M&&r('"\\\\b"')),null!==l&&(l=function(){return"\b"}(c)),null===l&&(q=c),null===l&&(c=q,"\\f"===n.substr(q,2)?(l="\\f",q+=2):(l=null,0===M&&r('"\\\\f"')),null!==l&&(l=function(){return"\f"}(c)),null===l&&(q=c),null===l&&(c=q,"\\n"===n.substr(q,2)?(l="\\n",q+=2):(l=null,0===M&&r('"\\\\n"')),null!==l&&(l=function(){return"\n"}(c)),null===l&&(q=c),null===l&&(c=q,"\\r"===n.substr(q,2)?(l="\\r",q+=2):(l=null,0===M&&r('"\\\\r"')),null!==l&&(l=function(){return"\r"}(c)),null===l&&(q=c),null===l&&(c=q,"\\t"===n.substr(q,2)?(l="\\t",q+=2):(l=null,0===M&&r('"\\\\t"')),null!==l&&(l=function(){return" "}(c)),null===l&&(q=c),null===l&&(c=q,i=q,"\\u"===n.substr(q,2)?(l="\\u",q+=2):(l=null,0===M&&r('"\\\\u"')),null!==l?(u=S(),null!==u?(t=S(),null!==t?(e=S(),null!==e?(o=S(),null!==o?l=[l,u,t,e,o]:(l=null,q=i)):(l=null,q=i)):(l=null,q=i)):(l=null,q=i)):(l=null,q=i),null!==l&&(l=function(l,n,u,r,t){return String.fromCharCode(parseInt("0x"+n+u+r+t))}(c,l[1],l[2],l[3],l[4])),null===l&&(q=c)))))))))),l}function b(){var l,u,t;if(M++,l=s(),null===l){if(t=q,/^[a-zA-Z0-9_$]/.test(n.charAt(q))?(u=n.charAt(q),q++):(u=null,0===M&&r("[a-zA-Z0-9_$]")),null!==u)for(l=[];null!==u;)l.push(u),/^[a-zA-Z0-9_$]/.test(n.charAt(q))?(u=n.charAt(q),q++):(u=null,0===M&&r("[a-zA-Z0-9_$]"));else l=null;null!==l&&(l=function(l,n){return n.join("")}(t,l)),null===l&&(q=t)}return M--,0===M&&null===l&&r("key"),l}function C(){var l,u;if(/^[^,}]/.test(n.charAt(q))?(u=n.charAt(q),q++):(u=null,0===M&&r("[^,}]")),null!==u)for(l=[];null!==u;)l.push(u),/^[^,}]/.test(n.charAt(q))?(u=n.charAt(q),q++):(u=null,0===M&&r("[^,}]"));else l=null;return l}function g(){var l,n,u,t,e,o;return M++,e=q,o=q,l=x(),null!==l?(n=m(),null!==n?(u=F(),null!==u?(t=_(),null!==t?l=[l,n,u,t]:(l=null,q=o)):(l=null,q=o)):(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(l,n,u,r){return parseFloat(n+u+r)}(e,l[0],l[1],l[2])),null===l&&(q=e),null===l&&(e=q,o=q,l=x(),null!==l?(n=m(),null!==n?(u=_(),null!==u?l=[l,n,u]:(l=null,q=o)):(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(l,n,u){return parseFloat(n+u)}(e,l[0],l[1])),null===l&&(q=e),null===l&&(e=q,o=q,l=x(),null!==l?(n=F(),null!==n?(u=_(),null!==u?l=[l,n,u]:(l=null,q=o)):(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(l,n,u){return parseFloat(n+u)}(e,l[0],l[1])),null===l&&(q=e),null===l&&(e=q,o=q,l=x(),null!==l?(n=_(),null!==n?l=[l,n]:(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(l,n){return parseFloat(n)}(e,l[0])),null===l&&(q=e)))),M--,0===M&&null===l&&r("number"),l}function x(){var l,u,t,e,o;return e=q,o=q,l=w(),null!==l?(u=j(),null!==u?l=[l,u]:(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(l,n,u){return n+u}(e,l[0],l[1])),null===l&&(q=e),null===l&&(l=E(),null===l&&(e=q,o=q,45===n.charCodeAt(q)?(l="-",q++):(l=null,0===M&&r('"-"')),null!==l?(u=w(),null!==u?(t=j(),null!==t?l=[l,u,t]:(l=null,q=o)):(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(l,n,u){return"-"+n+u}(e,l[1],l[2])),null===l&&(q=e),null===l&&(e=q,o=q,45===n.charCodeAt(q)?(l="-",q++):(l=null,0===M&&r('"-"')),null!==l?(u=E(),null!==u?l=[l,u]:(l=null,q=o)):(l=null,q=o),null!==l&&(l=function(l,n){return"-"+n}(e,l[1])),null===l&&(q=e)))),l}function m(){var l,u,t,e;return t=q,e=q,46===n.charCodeAt(q)?(l=".",q++):(l=null,0===M&&r('"."')),null!==l?(u=j(),null!==u?l=[l,u]:(l=null,q=e)):(l=null,q=e),null!==l&&(l=function(l,n){return"."+n}(t,l[1])),null===l&&(q=t),l}function F(){var l,n,u,r;return u=q,r=q,l=y(),null!==l?(n=j(),null!==n?l=[l,n]:(l=null,q=r)):(l=null,q=r),null!==l&&(l=function(l,n,u){return n+u}(u,l[0],l[1])),null===l&&(q=u),l}function j(){var l,n,u;if(u=q,n=E(),null!==n)for(l=[];null!==n;)l.push(n),n=E();else l=null;return null!==l&&(l=function(l,n){return n.join("")}(u,l)),null===l&&(q=u),l}function y(){var l,u,t,e;return t=q,e=q,/^[eE]/.test(n.charAt(q))?(l=n.charAt(q),q++):(l=null,0===M&&r("[eE]")),null!==l?(/^[+\-]/.test(n.charAt(q))?(u=n.charAt(q),q++):(u=null,0===M&&r("[+\\-]")),u=null!==u?u:"",null!==u?l=[l,u]:(l=null,q=e)):(l=null,q=e),null!==l&&(l=function(l,n,u){return n+u}(t,l[0],l[1])),null===l&&(q=t),l}function E(){var l;return/^[0-9]/.test(n.charAt(q))?(l=n.charAt(q),q++):(l=null,0===M&&r("[0-9]")),l}function w(){var l;return/^[1-9]/.test(n.charAt(q))?(l=n.charAt(q),q++):(l=null,0===M&&r("[1-9]")),l}function S(){var l;return/^[0-9a-fA-F]/.test(n.charAt(q))?(l=n.charAt(q),q++):(l=null,0===M&&r("[0-9a-fA-F]")),l}function _(){var l,n;for(M++,l=[],n=k();null!==n;)l.push(n),n=k();return M--,0===M&&null===l&&r("whitespace"),l}function k(){var l;return/^[ \t\n\r]/.test(n.charAt(q))?(l=n.charAt(q),q++):(l=null,0===M&&r("[ \\t\\n\\r]")),l}function z(l){l.sort();for(var n=null,u=[],r=0;r<l.length;r++)l[r]!==n&&(u.push(l[r]),n=l[r]);return u}function Z(){for(var l=1,u=1,r=!1,t=0;t<Math.max(q,B);t++){var e=n.charAt(t);"\n"===e?(r||l++,u=1,r=!1):"\r"===e||"\u2028"===e||"\u2029"===e?(l++,u=1,r=!0):(u++,r=!1)}return{line:l,column:u}}function $(l){return l===O?null:l}var I={start:t,object:e,members:o,pair:c,array:i,elements:a,value:f,string:s,single:h,chars:A,"char":d,schars:p,schar:v,key:b,literal:C,number:g,"int":x,frac:m,exp:F,digits:j,e:y,digit:E,digit19:w,hexDigit:S,_:_,whitespace:k};if(void 0!==u){if(void 0===I[u])throw new Error("Invalid rule name: "+l(u)+".")}else u="start";var q=0,M=0,B=0,D=[],O=new Object,G=I[u]();if(null===G||q!==n.length){var H=Math.max(q,B),J=H<n.length?n.charAt(H):null,K=Z();throw new this.SyntaxError(z(D),J,H,K.line,K.column)}return G},toSource:function(){return this._source}};return n.SyntaxError=function(n,u,r,t,e){function o(n,u){var r,t;switch(n.length){case 0:r="end of input";break;case 1:r=n[0];break;default:r=n.slice(0,n.length-1).join(", ")+" or "+n[n.length-1]}return t=u?l(u):"end of input","Expected "+r+" but "+t+" found."}this.name="SyntaxError",this.expected=n,this.found=u,this.message=o(n,u),this.offset=r,this.line=t,this.column=e},n.SyntaxError.prototype=Error.prototype,n}();"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=u),exports.jsonic=u):l.jsonic=u}).call(this); | ||
//# sourceMappingURL=jsonic-min.map |
{ | ||
"name": "jsonic", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"description": "A JSON parser that isn't strict.", | ||
"main": "jsonic.js", | ||
"scripts": { | ||
"test": "./node_modules/.bin/jasmine-node ./test", | ||
"browser": "phantomjs test/run-jasmine.js test/jasmine.html", | ||
"build": "sh ./build.sh" | ||
"test": "./test.sh", | ||
"build": "./build.sh" | ||
}, | ||
@@ -22,7 +21,2 @@ "repository": { | ||
"license": "MIT", | ||
"devDependencies": { | ||
"pegjs": "~0.7.0", | ||
"underscore": "~1.5.2", | ||
"jasmine-node": "~1.11.0" | ||
}, | ||
"files": [ | ||
@@ -29,0 +23,0 @@ "README.md", |
@@ -39,7 +39,10 @@ # jsonic | ||
Current Version: 0.1.0 | ||
Current Version: 0.1.2 | ||
Tested on: node 0.10.6 | ||
Tested on: node 0.10.35, Chrome 40 | ||
[![Build Status](https://travis-ci.org/rjrodger/jsonic.png?branch=master)](https://travis-ci.org/rjrodger/jsonic) | ||
### Quick example | ||
@@ -46,0 +49,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
0
4089
94
172595