UnitTest( orderly.asp )

Output

Validating
----------
{
  "name": "Fabio Zendhi Nagao",
  "description": "A big enthusiast of programming and mathematics.",
  "homepage": "http://zend.lojcomm.com.br/"
}

Against
-------
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "default": "nagaozen"
    },
    "description": {
      "type": "string",
      "optional": true
    },
    "homepage": {
      "type": "string",
      "pattern": "^http:"
    }
  },
  "additionalProperties": false
}

Results
-------
isValid: True


**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 


Validating
----------
{
  "name": "Fabio Zendhi Nagao",
  "homepage": "http://zend.lojcomm.com.br/"
}

Against
-------
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "default": "nagaozen"
    },
    "description": {
      "type": "string",
      "optional": true
    },
    "homepage": {
      "type": "string",
      "pattern": "^http:"
    }
  },
  "additionalProperties": false
}

Results
-------
isValid: True


**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 


Validating
----------
{
  "name": "Fabio Zendhi Nagao",
  "description": "A big enthusiast of programming and mathematics.",
  "homepage": "zend[at]lojcomm.com.br"
}

Against
-------
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "default": "nagaozen"
    },
    "description": {
      "type": "string",
      "optional": true
    },
    "homepage": {
      "type": "string",
      "pattern": "^http:"
    }
  },
  "additionalProperties": false
}

Results
-------
isValid: False
homepage - does not match the regex pattern ^http:


**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 


Validating
----------
{
  "name": "Fabio Zendhi Nagao",
  "description": "A big enthusiast of programming and mathematics."
}

Against
-------
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "default": "nagaozen"
    },
    "description": {
      "type": "string",
      "optional": true
    },
    "homepage": {
      "type": "string",
      "pattern": "^http:"
    }
  },
  "additionalProperties": false
}

Results
-------
isValid: False
homepage - is missing and it is not optional


**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 


Validating
----------
{
  "name": "Fabio Zendhi Nagao",
  "age": 29,
  "homepage": "http://zend.lojcomm.com.br/"
}

Against
-------
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string",
      "default": "nagaozen"
    },
    "description": {
      "type": "string",
      "optional": true
    },
    "homepage": {
      "type": "string",
      "pattern": "^http:"
    }
  },
  "additionalProperties": false
}

Results
-------
isValid: False
 - The property age is not defined in the schema and the schema does not allow additional properties


**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** 


Sources

/axe-ut/orderly.unit.test.asp

<!--#include virtual="/lib/unit-tests.asp"-->
<!--#include virtual="/lib/axe/classes/Parsers/json2.asp"-->
<!--#include virtual="/lib/axe/classes/Parsers/jsonschema.asp"-->
<!--#include virtual="/lib/axe/classes/Parsers/orderly.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xml:lang="en">
    <head>
        <title>AXE - Unit Test - Orderly</title>
        <!--// meta tags //-->
        <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
        <!--// link tags //-->
        <link rel="stylesheet" type="text/css" media="screen" href="/lib/unit-tests.css" />
    </head>
    <body>
        <div id="container">
            <div id="container-hd">
                <h1>UnitTest( orderly.asp )</h1>
            </div>
            <div id="container-bd">
 
<h2>Output</h2>
<div class="code"><pre><%
 
public sub evaluate(def, data)
    dim Schema, Obj, Result, ex
 
    set Schema = Orderly.parse(def)
    set Obj = JSON.parse(data)
 
    Response.write( "Validating" & vbNewLine )
    Response.write( "----------" & vbNewLine )
    Response.write( JSON.stringify( Obj, null, 2 ) & vbNewLine )
 
    Response.write( vbNewLine )
 
    Response.write( "Against" & vbNewLine )
    Response.write( "-------" & vbNewLine )
'    Response.write( def & vbNewLine )
    Response.write( JSON.stringify( Schema, null, 2 ) & vbNewLine )
 
    Response.write( vbNewLine )
 
    Response.write( "Results" & vbNewLine )
    Response.write( "-------" & vbNewLine )
 
    set Result = JSONSchema.validate(Obj, Schema)
 
    Response.write( strsubstitute("isValid: {0}", array(Result.valid)) )
    Response.write( vbNewLine )
 
    if( not Result.valid ) then
        for each ex in Result.errors.enumerate()
            Response.write( strsubstitute( _
                "{0} - {1}", array( _
                    Result.errors.get(ex).property, _
                    Result.errors.get(ex).message _
                ) _
            ) )
            Response.write( vbNewline )
        next
    end if
    set Result = nothing
 
    set Obj = nothing
    set Schema = nothing
 
    Response.write(vbNewLine)
    Response.write(vbNewLine)
    Response.write( "**** **** **** **** **** **** **** **** **** **** **** **** **** **** **** **** " )
    Response.write(vbNewLine)
    Response.write(vbNewLine)
    Response.write(vbNewLine)
end sub
 
 
 
 
 
dim source_orderly : source_orderly = join(array( _
    "object {", _
    "  string name = ""nagaozen"";", _
    "  string description?;", _
    "  string homepage /^http:/;", _
    "};" _
), vbNewline)
 
 
 
call evaluate( source_orderly, join( array( _
    "{", _
    "    ""name"": ""Fabio Zendhi Nagao"",", _
    "    ""description"": ""A big enthusiast of programming and mathematics."",", _
    "    ""homepage"": ""http://zend.lojcomm.com.br/""", _
    "}" _
), vbNewline) )
 
call evaluate( source_orderly, join( array( _
    "{", _
    "    ""name"": ""Fabio Zendhi Nagao"",", _
    "    ""homepage"": ""http://zend.lojcomm.com.br/""", _
    "}" _
), vbNewline) )
 
call evaluate( source_orderly, join( array( _
    "{", _
    "    ""name"": ""Fabio Zendhi Nagao"",", _
    "    ""description"": ""A big enthusiast of programming and mathematics."",", _
    "    ""homepage"": ""zend[at]lojcomm.com.br""", _
    "}" _
), vbNewline) )
 
call evaluate( source_orderly, join( array( _
    "{", _
    "    ""name"": ""Fabio Zendhi Nagao"",", _
    "    ""description"": ""A big enthusiast of programming and mathematics.""", _
    "}" _
), vbNewline) )
 
call evaluate( source_orderly, join( array( _
    "{", _
    "    ""name"": ""Fabio Zendhi Nagao"",", _
    "    ""age"": 29,", _
    "    ""homepage"": ""http://zend.lojcomm.com.br/""", _
    "}" _
), vbNewline) )
 
%></pre></div>
 
            </div>
            <div id="container-ft">
                <h2>Sources</h2>
                <h3><%= Request.ServerVariables("SCRIPT_NAME") %></h3>
                <div class="code"><%= geshify( loadTextFile( Server.mapPath( Request.ServerVariables("SCRIPT_NAME") ) ), "asp" ) %></div>
                <h3>orderly.asp</h3>
                <div class="code"><%= geshify( loadTextFile( Server.mapPath( "/lib/axe/classes/Parsers/orderly.asp" ) ), "javascript" ) %></div>
                <h3>json2.asp</h3>
                <div class="code"><%= geshify( loadTextFile( Server.mapPath( "/lib/axe/classes/Parsers/json2.asp" ) ), "javascript" ) %></div>
            </div>
        </div>
        <!--// javascript tags //-->
    </body>
</html>
 
 

orderly.asp

<script language="Javascript" runat="server">
 
/*
 
File: orderly.asp
 
AXE(ASP Xtreme Evolution) Orderly parser by Zach Carter and Validator by
Fabio Zendhi Nagao.
 
Orderly.ASP leverages javascript to implement, without any modification, Zach
Carter's orderly.js <http://github.com/zaach/orderly.js> plus an additional method
derived from Kris Zyp validate.js <http://github.com/kriszyp/json-schema/> to
validate an object against an Orderly definition. AXE documentation and
examples inserted by Fabio Zendhi Nagao (nagaozen).
 
License:
 
This file is part of ASP Xtreme Evolution.
Copyright (C) 2007-2012 Fabio Zendhi Nagao
 
ASP Xtreme Evolution is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
ASP Xtreme Evolution is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.
 
You should have received a copy of the GNU Lesser General Public License
along with ASP Xtreme Evolution. If not, see <http://www.gnu.org/licenses/>.
 
 
 
 
 
Class: Orderly
 
Orderly is an ergonomic micro-language that can represent a subset of JSONSchema.
Orderly is designed to feel familiar to the average programmer and to be
extremely easy to learn and remember.
 
License:
 
Copyright (c) 2009 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.
 
About:
 
	- Written by Zach Carter <http://zaa.ch/> @ March 2010
 
Notes:
 
	- Javascript compiler is based on the Orderly concepts from Lloyd Hilaiel of Yahoo! <http://orderly-json.org/> @ December 2009
 
 
 
 
 
Function: parse
 
This method parses an orderly source to build a javascript object which represents
the subset of JSONSchema <http://json-schema.org/> that Orderly is designed to
return.
 
Parameters:
 
	(string) - Valid Orderly text.
 
Returns:
 
	(mixed) - a JavaScript object.
 
Example:
 
(start code)
 
dim def : def = join(array( _
	"object {", _
	"  string name;", _
	"  string description?;", _
	"  string homepage /^http:/;", _
	"}*;" _
), vbNewline)
 
Response.write( typename(Orderly.parse(def)) )' prints JScriptTypeInfo
 
(end code)
 
 
 
 
 
Function: compile
 
This method parses an orderly source to build a string representation of the
javascript object which represents the subset of JSONSchema <http://json-schema.org/>
generated by Orderly.
 
Parameters:
 
	(string) - Valid Orderly text.
 
Returns:
 
	(string) - The stringified version of the JSONSchema subset.
 
Example:
 
(start code)
 
dim def : def = join(array( _
	"object {", _
	"  string name;", _
	"  string description?;", _
	"  string homepage /^http:/;", _
	"}*;" _
), vbNewline)
 
Response.write( Orderly.compile(def) )' prints the string below:
 
' {
'     "type": "object",
'     "properties": {
'         "name": {
'             "type": "string"
'         },
'         "description": {
'             "type": "string",
'             "optional": true
'         },
'         "homepage": {
'             "type": "string",
'             "pattern": "^http:"
'         }
'     },
'     "additionalProperties": true
' }
 
(end code)
 
Notes:
 
	- This method requires the JSON class to work.
 
*/
var Orderly = function() {
	var a = function() {
		var a = {},
		    b = {},
		    c = function(d) {
		    	a[d] || (null, a[d] = {}, b[d](c, a[d], {
		    		id: d
		    	}));
		    	return a[d]
		    };
		c.def = function(a, c) {
			null,
			b[a] = c.factory
		};
		return c
	}();
	a.def("orderly", {
		factory: function(a, b, c) {
			var d = a("parser").parser;
			d.yy = a("scope");
			var e = b.parse = function(a) {
			    	return d.parse(a)
			    },
			    f = b.compile = function(a, b) {
			    	return JSON.stringify(e(a), null, b || "    ")
			    };
			b.main = function(b) {
				var c = a("file"),
				    d = c.path(c.cwd());
				if(!b[1]) throw new Error("Usage: " + b[0] + " FILE [OUTFILE]");
				var e = d.join(b[1]).read({
				    	charset: "utf-8"
				    }),
				    g = f(e),
				    h = d.join(b[2] || c.basename(b[1], ".orderly") + ".jsonschema").open("w");
				h.print(g).close();
			}
		},
		requires: ["parser", "scope", "file"]
	}), a.def("parser", {
		factory: function(a, b, c) {
			var d = function() {
				var a = {
						trace: function() {},
						yy: {},
						symbols_: {
							error: 2,
							file: 3,
							orderly_schema: 4,
							EOF: 5,
							unnamed_entry: 6,
							";": 7,
							named_entries: 8,
							named_entry: 9,
							unnamed_entries: 10,
							definition_prefix: 11,
							property_name: 12,
							definition_suffix: 13,
							string_prefix: 14,
							string_suffix: 15,
							INTEGER: 16,
							optional_range: 17,
							NUMBER: 18,
							BOOLEAN: 19,
							NULL: 20,
							ANY: 21,
							ARRAY: 22,
							"{": 23,
							"}": 24,
							optional_additional_marker: 25,
							"[": 26,
							"]": 27,
							OBJECT: 28,
							UNION: 29,
							STRING: 30,
							optional_perl_regex: 31,
							optional_enum_values: 32,
							optional_default_value: 33,
							optional_requires: 34,
							optional_optional_marker: 35,
							optional_extra_properties: 36,
							csv_property_names: 37,
							",": 38,
							"`": 39,
							JSONObject: 40,
							"<": 41,
							">": 42,
							"?": 43,
							"*": 44,
							JSONArray: 45,
							"=": 46,
							JSONValue: 47,
							JSONNumber: 48,
							JSONString: 49,
							PROPERTY: 50,
							REGEX: 51,
							STRING_LIT: 52,
							NUMBER_LIT: 53,
							JSONNullLiteral: 54,
							JSONBooleanLiteral: 55,
							TRUE: 56,
							FALSE: 57,
							JSONText: 58,
							JSONMemberList: 59,
							JSONMember: 60,
							":": 61,
							JSONElementList: 62,
							$accept: 0,
							$end: 1
						},
						terminals_: {
							2: "error",
							5: "EOF",
							7: ";",
							16: "INTEGER",
							18: "NUMBER",
							19: "BOOLEAN",
							20: "NULL",
							21: "ANY",
							22: "ARRAY",
							23: "{",
							24: "}",
							26: "[",
							27: "]",
							28: "OBJECT",
							29: "UNION",
							30: "STRING",
							38: ",",
							39: "`",
							41: "<",
							42: ">",
							43: "?",
							44: "*",
							46: "=",
							50: "PROPERTY",
							51: "REGEX",
							52: "STRING_LIT",
							53: "NUMBER_LIT",
							56: "TRUE",
							57: "FALSE",
							61: ":"
						},
						productions_: [0, [3, 2],
							[4, 2],
							[4, 1],
							[8, 3],
							[8, 1],
							[8, 0],
							[10, 3],
							[10, 1],
							[10, 0],
							[9, 3],
							[9, 3],
							[6, 2],
							[6, 2],
							[11, 2],
							[11, 2],
							[11, 1],
							[11, 1],
							[11, 1],
							[11, 6],
							[11, 6],
							[11, 5],
							[11, 4],
							[14, 2],
							[15, 2],
							[13, 5],
							[37, 3],
							[37, 1],
							[36, 3],
							[36, 0],
							[34, 3],
							[34, 0],
							[35, 1],
							[35, 0],
							[25, 1],
							[25, 0],
							[32, 1],
							[32, 0],
							[33, 2],
							[33, 0],
							[17, 5],
							[17, 4],
							[17, 4],
							[17, 3],
							[17, 0],
							[12, 1],
							[12, 1],
							[31, 1],
							[31, 0],
							[49, 1],
							[48, 1],
							[54, 1],
							[55, 1],
							[55, 1],
							[58, 1],
							[47, 1],
							[47, 1],
							[47, 1],
							[47, 1],
							[47, 1],
							[47, 1],
							[40, 2],
							[40, 3],
							[60, 3],
							[59, 1],
							[59, 3],
							[45, 2],
							[45, 3],
							[62, 1],
							[62, 3]
						],
						performAction: function(a, b, c, d, e, f, g) {
							var h = f.length - 1;
							switch(e) {
								case 1:
									return f[h - 1];
								case 4:
									this.$ = f[h], this.$.unshift(f[h - 2]);
									break;
								case 5:
									this.$ = [f[h]];
									break;
								case 6:
									this.$ = [];
									break;
								case 7:
									this.$ = f[h], f[h].unshift(f[h - 2]);
									break;
								case 8:
									this.$ = [f[h]];
									break;
								case 9:
									this.$ = [];
									break;
								case 10:
									this.$ = [f[h - 1], f[h - 2]], d.Type.addOptionals(f[h - 2], f[h]);
									break;
								case 11:
									this.$ = [f[h - 1], f[h - 2]], d.Type.addOptionals(f[h - 2], f[h]);
									break;
								case 12:
									this.$ = f[h - 1], d.Type.addOptionals(this.$, f[h]);
									break;
								case 13:
									this.$ = f[h - 1], d.Type.addOptionals(this.$, f[h]);
									break;
								case 14:
									this.$ = new d.Type("integer", f[h]);
									break;
								case 15:
									this.$ = new d.Type("number", f[h]);
									break;
								case 16:
									this.$ = new d.Type("boolean");
									break;
								case 17:
									this.$ = new d.Type("null");
									break;
								case 18:
									this.$ = new d.Type("any");
									break;
								case 19:
									this.$ = new d.Type("array", f[h], f[h - 3], f[h - 1]);
									break;
								case 20:
									this.$ = new d.Type("array", f[h], f[h - 3], f[h - 1]);
									break;
								case 21:
									this.$ = new d.Type("object", null, f[h - 2], f[h]);
									break;
								case 22:
									this.$ = new d.Type(f[h - 1]);
									break;
								case 23:
									this.$ = new d.Type("string", f[h]);
									break;
								case 24:
									this.$ = f[h], this.$.pattern = f[h - 1];
									break;
								case 25:
									this.$ = {
										enums: f[h - 4],
										defaultv: f[h - 3],
										requires: f[h - 2],
										optional: f[h - 1],
										extras: f[h]
									};
									break;
								case 26:
									this.$ = f[h - 2], this.$.push(f[h]);
									break;
								case 27:
									this.$ = [f[h]];
									break;
								case 28:
									this.$ = f[h - 1];
									break;
								case 29:
									this.$ = null;
									break;
								case 30:
									this.$ = f[h - 1];
									break;
								case 31:
									this.$ = null;
									break;
								case 32:
									this.$ = !0;
									break;
								case 33:
									this.$ = null;
									break;
								case 34:
									this.$ = !0;
									break;
								case 35:
									this.$ = null;
									break;
								case 37:
									this.$ = null;
									break;
								case 38:
									this.$ = f[h];
									break;
								case 39:
									this.$ = d.NOVALUE;
									break;
								case 40:
									this.$ = [f[h - 3], f[h - 1]];
									break;
								case 41:
									this.$ = [f[h - 2], null];
									break;
								case 42:
									this.$ = [null, f[h - 1]];
									break;
								case 43:
									this.$ = null;
									break;
								case 44:
									this.$ = null;
									break;
								case 46:
									this.$ = a;
									break;
								case 47:
									this.$ = a.substr(1, a.length - 2);
									break;
								case 48:
									this.$ = null;
									break;
								case 49:
									this.$ = a;
									break;
								case 50:
									this.$ = Number(a);
									break;
								case 51:
									this.$ = null;
									break;
								case 52:
									this.$ = !0;
									break;
								case 53:
									this.$ = !1;
									break;
								case 61:
									this.$ = {};
									break;
								case 62:
									this.$ = f[h - 1];
									break;
								case 63:
									this.$ = [f[h - 2], f[h]];
									break;
								case 64:
									this.$ = {}, this.$[f[h][0]] = f[h][1];
									break;
								case 65:
									this.$ = f[h - 2], f[h - 2][f[h][0]] = f[h][1];
									break;
								case 66:
									this.$ = [];
									break;
								case 67:
									this.$ = f[h - 1];
									break;
								case 68:
									this.$ = [f[h]];
									break;
								case 69:
									this.$ = f[h - 2], f[h - 2].push(f[h])
							}
						},
						table: [{
							3: 1,
							4: 2,
							6: 3,
							11: 4,
							14: 5,
							16: [1, 6],
							18: [1, 7],
							19: [1, 8],
							20: [1, 9],
							21: [1, 10],
							22: [1, 11],
							28: [1, 12],
							29: [1, 13],
							30: [1, 14]
						}, {
							1: [3]
						}, {
							5: [1, 15]
						}, {
							5: [2, 3],
							7: [1, 16]
						}, {
							5: [2, 37],
							7: [2, 37],
							13: 17,
							24: [2, 37],
							26: [1, 20],
							27: [2, 37],
							32: 18,
							39: [2, 37],
							41: [2, 37],
							43: [2, 37],
							45: 19,
							46: [2, 37]
						}, {
							5: [2, 48],
							7: [2, 48],
							15: 21,
							24: [2, 48],
							26: [2, 48],
							27: [2, 48],
							31: 22,
							39: [2, 48],
							41: [2, 48],
							43: [2, 48],
							46: [2, 48],
							51: [1, 23]
						}, {
							5: [2, 44],
							7: [2, 44],
							17: 24,
							23: [1, 25],
							24: [2, 44],
							26: [2, 44],
							27: [2, 44],
							39: [2, 44],
							41: [2, 44],
							43: [2, 44],
							46: [2, 44],
							50: [2, 44],
							52: [2, 44]
						}, {
							5: [2, 44],
							7: [2, 44],
							17: 26,
							23: [1, 25],
							24: [2, 44],
							26: [2, 44],
							27: [2, 44],
							39: [2, 44],
							41: [2, 44],
							43: [2, 44],
							46: [2, 44],
							50: [2, 44],
							52: [2, 44]
						}, {
							5: [2, 16],
							7: [2, 16],
							24: [2, 16],
							26: [2, 16],
							27: [2, 16],
							39: [2, 16],
							41: [2, 16],
							43: [2, 16],
							46: [2, 16],
							50: [2, 16],
							52: [2, 16]
						}, {
							5: [2, 17],
							7: [2, 17],
							24: [2, 17],
							26: [2, 17],
							27: [2, 17],
							39: [2, 17],
							41: [2, 17],
							43: [2, 17],
							46: [2, 17],
							50: [2, 17],
							52: [2, 17]
						}, {
							5: [2, 18],
							7: [2, 18],
							24: [2, 18],
							26: [2, 18],
							27: [2, 18],
							39: [2, 18],
							41: [2, 18],
							43: [2, 18],
							46: [2, 18],
							50: [2, 18],
							52: [2, 18]
						}, {
							23: [1, 27],
							26: [1, 28]
						}, {
							23: [1, 29]
						}, {
							23: [1, 30]
						}, {
							5: [2, 44],
							7: [2, 44],
							17: 31,
							23: [1, 25],
							24: [2, 44],
							26: [2, 44],
							27: [2, 44],
							39: [2, 44],
							41: [2, 44],
							43: [2, 44],
							46: [2, 44],
							50: [2, 44],
							51: [2, 44],
							52: [2, 44]
						}, {
							1: [2, 1]
						}, {
							5: [2, 2]
						}, {
							5: [2, 12],
							7: [2, 12],
							24: [2, 12],
							27: [2, 12]
						}, {
							5: [2, 39],
							7: [2, 39],
							24: [2, 39],
							27: [2, 39],
							33: 32,
							39: [2, 39],
							41: [2, 39],
							43: [2, 39],
							46: [1, 33]
						}, {
							5: [2, 36],
							7: [2, 36],
							24: [2, 36],
							27: [2, 36],
							39: [2, 36],
							41: [2, 36],
							43: [2, 36],
							46: [2, 36]
						}, {
							20: [1, 43],
							23: [1, 48],
							26: [1, 20],
							27: [1, 34],
							40: 41,
							45: 42,
							47: 36,
							48: 40,
							49: 39,
							52: [1, 46],
							53: [1, 47],
							54: 37,
							55: 38,
							56: [1, 44],
							57: [1, 45],
							62: 35
						}, {
							5: [2, 13],
							7: [2, 13],
							24: [2, 13],
							27: [2, 13]
						}, {
							5: [2, 37],
							7: [2, 37],
							13: 49,
							24: [2, 37],
							26: [1, 20],
							27: [2, 37],
							32: 18,
							39: [2, 37],
							41: [2, 37],
							43: [2, 37],
							45: 19,
							46: [2, 37]
						}, {
							5: [2, 47],
							7: [2, 47],
							24: [2, 47],
							26: [2, 47],
							27: [2, 47],
							39: [2, 47],
							41: [2, 47],
							43: [2, 47],
							46: [2, 47]
						}, {
							5: [2, 14],
							7: [2, 14],
							24: [2, 14],
							26: [2, 14],
							27: [2, 14],
							39: [2, 14],
							41: [2, 14],
							43: [2, 14],
							46: [2, 14],
							50: [2, 14],
							52: [2, 14]
						}, {
							38: [1, 51],
							48: 50,
							53: [1, 47]
						}, {
							5: [2, 15],
							7: [2, 15],
							24: [2, 15],
							26: [2, 15],
							27: [2, 15],
							39: [2, 15],
							41: [2, 15],
							43: [2, 15],
							46: [2, 15],
							50: [2, 15],
							52: [2, 15]
						}, {
							6: 53,
							10: 52,
							11: 4,
							14: 5,
							16: [1, 6],
							18: [1, 7],
							19: [1, 8],
							20: [1, 9],
							21: [1, 10],
							22: [1, 11],
							24: [2, 9],
							28: [1, 12],
							29: [1, 13],
							30: [1, 14]
						}, {
							6: 54,
							11: 4,
							14: 5,
							16: [1, 6],
							18: [1, 7],
							19: [1, 8],
							20: [1, 9],
							21: [1, 10],
							22: [1, 11],
							28: [1, 12],
							29: [1, 13],
							30: [1, 14]
						}, {
							8: 55,
							9: 56,
							11: 57,
							14: 58,
							16: [1, 6],
							18: [1, 7],
							19: [1, 8],
							20: [1, 9],
							21: [1, 10],
							22: [1, 11],
							24: [2, 6],
							28: [1, 12],
							29: [1, 13],
							30: [1, 14]
						}, {
							6: 53,
							10: 59,
							11: 4,
							14: 5,
							16: [1, 6],
							18: [1, 7],
							19: [1, 8],
							20: [1, 9],
							21: [1, 10],
							22: [1, 11],
							24: [2, 9],
							28: [1, 12],
							29: [1, 13],
							30: [1, 14]
						}, {
							5: [2, 23],
							7: [2, 23],
							24: [2, 23],
							26: [2, 23],
							27: [2, 23],
							39: [2, 23],
							41: [2, 23],
							43: [2, 23],
							46: [2, 23],
							50: [2, 23],
							51: [2, 23],
							52: [2, 23]
						}, {
							5: [2, 31],
							7: [2, 31],
							24: [2, 31],
							27: [2, 31],
							34: 60,
							39: [2, 31],
							41: [1, 61],
							43: [2, 31]
						}, {
							20: [1, 43],
							23: [1, 48],
							26: [1, 20],
							40: 41,
							45: 42,
							47: 62,
							48: 40,
							49: 39,
							52: [1, 46],
							53: [1, 47],
							54: 37,
							55: 38,
							56: [1, 44],
							57: [1, 45]
						}, {
							5: [2, 66],
							7: [2, 66],
							24: [2, 66],
							27: [2, 66],
							38: [2, 66],
							39: [2, 66],
							41: [2, 66],
							43: [2, 66],
							46: [2, 66]
						}, {
							27: [1, 63],
							38: [1, 64]
						}, {
							27: [2, 68],
							38: [2, 68]
						}, {
							5: [2, 55],
							7: [2, 55],
							24: [2, 55],
							27: [2, 55],
							38: [2, 55],
							39: [2, 55],
							41: [2, 55],
							43: [2, 55]
						}, {
							5: [2, 56],
							7: [2, 56],
							24: [2, 56],
							27: [2, 56],
							38: [2, 56],
							39: [2, 56],
							41: [2, 56],
							43: [2, 56]
						}, {
							5: [2, 57],
							7: [2, 57],
							24: [2, 57],
							27: [2, 57],
							38: [2, 57],
							39: [2, 57],
							41: [2, 57],
							43: [2, 57]
						}, {
							5: [2, 58],
							7: [2, 58],
							24: [2, 58],
							27: [2, 58],
							38: [2, 58],
							39: [2, 58],
							41: [2, 58],
							43: [2, 58]
						}, {
							5: [2, 59],
							7: [2, 59],
							24: [2, 59],
							27: [2, 59],
							38: [2, 59],
							39: [2, 59],
							41: [2, 59],
							43: [2, 59]
						}, {
							5: [2, 60],
							7: [2, 60],
							24: [2, 60],
							27: [2, 60],
							38: [2, 60],
							39: [2, 60],
							41: [2, 60],
							43: [2, 60]
						}, {
							5: [2, 51],
							7: [2, 51],
							24: [2, 51],
							27: [2, 51],
							38: [2, 51],
							39: [2, 51],
							41: [2, 51],
							43: [2, 51]
						}, {
							5: [2, 52],
							7: [2, 52],
							24: [2, 52],
							27: [2, 52],
							38: [2, 52],
							39: [2, 52],
							41: [2, 52],
							43: [2, 52]
						}, {
							5: [2, 53],
							7: [2, 53],
							24: [2, 53],
							27: [2, 53],
							38: [2, 53],
							39: [2, 53],
							41: [2, 53],
							43: [2, 53]
						}, {
							5: [2, 49],
							7: [2, 49],
							24: [2, 49],
							26: [2, 49],
							27: [2, 49],
							38: [2, 49],
							39: [2, 49],
							41: [2, 49],
							42: [2, 49],
							43: [2, 49],
							46: [2, 49],
							51: [2, 49],
							61: [2, 49]
						}, {
							5: [2, 50],
							7: [2, 50],
							24: [2, 50],
							27: [2, 50],
							38: [2, 50],
							39: [2, 50],
							41: [2, 50],
							43: [2, 50]
						}, {
							24: [1, 65],
							49: 68,
							52: [1, 46],
							59: 66,
							60: 67
						}, {
							5: [2, 24],
							7: [2, 24],
							24: [2, 24],
							27: [2, 24]
						}, {
							38: [1, 69]
						}, {
							24: [1, 71],
							48: 70,
							53: [1, 47]
						}, {
							24: [1, 72]
						}, {
							7: [1, 73],
							24: [2, 8]
						}, {
							27: [1, 74]
						}, {
							24: [1, 75]
						}, {
							7: [1, 76],
							24: [2, 5]
						}, {
							12: 77,
							49: 78,
							50: [1, 79],
							52: [1, 46]
						}, {
							12: 80,
							49: 78,
							50: [1, 79],
							52: [1, 46]
						}, {
							24: [1, 81]
						}, {
							5: [2, 33],
							7: [2, 33],
							24: [2, 33],
							27: [2, 33],
							35: 82,
							39: [2, 33],
							43: [1, 83]
						}, {
							12: 85,
							37: 84,
							49: 78,
							50: [1, 79],
							52: [1, 46]
						}, {
							5: [2, 38],
							7: [2, 38],
							24: [2, 38],
							27: [2, 38],
							39: [2, 38],
							41: [2, 38],
							43: [2, 38]
						}, {
							5: [2, 67],
							7: [2, 67],
							24: [2, 67],
							27: [2, 67],
							38: [2, 67],
							39: [2, 67],
							41: [2, 67],
							43: [2, 67],
							46: [2, 67]
						}, {
							20: [1, 43],
							23: [1, 48],
							26: [1, 20],
							40: 41,
							45: 42,
							47: 86,
							48: 40,
							49: 39,
							52: [1, 46],
							53: [1, 47],
							54: 37,
							55: 38,
							56: [1, 44],
							57: [1, 45]
						}, {
							5: [2, 61],
							7: [2, 61],
							24: [2, 61],
							27: [2, 61],
							38: [2, 61],
							39: [2, 61],
							41: [2, 61],
							43: [2, 61]
						}, {
							24: [1, 87],
							38: [1, 88]
						}, {
							24: [2, 64],
							38: [2, 64]
						}, {
							61: [1, 89]
						}, {
							24: [1, 91],
							48: 90,
							53: [1, 47]
						}, {
							24: [1, 92]
						}, {
							5: [2, 43],
							7: [2, 43],
							24: [2, 43],
							26: [2, 43],
							27: [2, 43],
							39: [2, 43],
							41: [2, 43],
							43: [2, 43],
							46: [2, 43],
							50: [2, 43],
							51: [2, 43],
							52: [2, 43]
						}, {
							5: [2, 35],
							7: [2, 35],
							23: [2, 35],
							24: [2, 35],
							25: 93,
							26: [2, 35],
							27: [2, 35],
							39: [2, 35],
							41: [2, 35],
							43: [2, 35],
							44: [1, 94],
							46: [2, 35],
							50: [2, 35],
							52: [2, 35]
						}, {
							6: 53,
							10: 95,
							11: 4,
							14: 5,
							16: [1, 6],
							18: [1, 7],
							19: [1, 8],
							20: [1, 9],
							21: [1, 10],
							22: [1, 11],
							24: [2, 9],
							28: [1, 12],
							29: [1, 13],
							30: [1, 14]
						}, {
							5: [2, 35],
							7: [2, 35],
							23: [2, 35],
							24: [2, 35],
							25: 96,
							26: [2, 35],
							27: [2, 35],
							39: [2, 35],
							41: [2, 35],
							43: [2, 35],
							44: [1, 94],
							46: [2, 35],
							50: [2, 35],
							52: [2, 35]
						}, {
							5: [2, 35],
							7: [2, 35],
							24: [2, 35],
							25: 97,
							26: [2, 35],
							27: [2, 35],
							39: [2, 35],
							41: [2, 35],
							43: [2, 35],
							44: [1, 94],
							46: [2, 35],
							50: [2, 35],
							52: [2, 35]
						}, {
							8: 98,
							9: 56,
							11: 57,
							14: 58,
							16: [1, 6],
							18: [1, 7],
							19: [1, 8],
							20: [1, 9],
							21: [1, 10],
							22: [1, 11],
							24: [2, 6],
							28: [1, 12],
							29: [1, 13],
							30: [1, 14]
						}, {
							7: [2, 37],
							13: 99,
							24: [2, 37],
							26: [1, 20],
							32: 18,
							39: [2, 37],
							41: [2, 37],
							43: [2, 37],
							45: 19,
							46: [2, 37]
						}, {
							7: [2, 45],
							24: [2, 45],
							26: [2, 45],
							38: [2, 45],
							39: [2, 45],
							41: [2, 45],
							42: [2, 45],
							43: [2, 45],
							46: [2, 45],
							51: [2, 45]
						}, {
							7: [2, 46],
							24: [2, 46],
							26: [2, 46],
							38: [2, 46],
							39: [2, 46],
							41: [2, 46],
							42: [2, 46],
							43: [2, 46],
							46: [2, 46],
							51: [2, 46]
						}, {
							7: [2, 48],
							15: 100,
							24: [2, 48],
							26: [2, 48],
							31: 22,
							39: [2, 48],
							41: [2, 48],
							43: [2, 48],
							46: [2, 48],
							51: [1, 23]
						}, {
							5: [2, 22],
							7: [2, 22],
							24: [2, 22],
							26: [2, 22],
							27: [2, 22],
							39: [2, 22],
							41: [2, 22],
							43: [2, 22],
							46: [2, 22],
							50: [2, 22],
							52: [2, 22]
						}, {
							5: [2, 29],
							7: [2, 29],
							24: [2, 29],
							27: [2, 29],
							36: 101,
							39: [1, 102]
						}, {
							5: [2, 32],
							7: [2, 32],
							24: [2, 32],
							27: [2, 32],
							39: [2, 32]
						}, {
							38: [1, 104],
							42: [1, 103]
						}, {
							38: [2, 27],
							42: [2, 27]
						}, {
							27: [2, 69],
							38: [2, 69]
						}, {
							5: [2, 62],
							7: [2, 62],
							24: [2, 62],
							27: [2, 62],
							38: [2, 62],
							39: [2, 62],
							41: [2, 62],
							43: [2, 62]
						}, {
							49: 68,
							52: [1, 46],
							60: 105
						}, {
							20: [1, 43],
							23: [1, 48],
							26: [1, 20],
							40: 41,
							45: 42,
							47: 106,
							48: 40,
							49: 39,
							52: [1, 46],
							53: [1, 47],
							54: 37,
							55: 38,
							56: [1, 44],
							57: [1, 45]
						}, {
							24: [1, 107]
						}, {
							5: [2, 41],
							7: [2, 41],
							24: [2, 41],
							26: [2, 41],
							27: [2, 41],
							39: [2, 41],
							41: [2, 41],
							43: [2, 41],
							46: [2, 41],
							50: [2, 41],
							51: [2, 41],
							52: [2, 41]
						}, {
							5: [2, 42],
							7: [2, 42],
							24: [2, 42],
							26: [2, 42],
							27: [2, 42],
							39: [2, 42],
							41: [2, 42],
							43: [2, 42],
							46: [2, 42],
							50: [2, 42],
							51: [2, 42],
							52: [2, 42]
						}, {
							5: [2, 44],
							7: [2, 44],
							17: 108,
							23: [1, 25],
							24: [2, 44],
							26: [2, 44],
							27: [2, 44],
							39: [2, 44],
							41: [2, 44],
							43: [2, 44],
							46: [2, 44],
							50: [2, 44],
							52: [2, 44]
						}, {
							5: [2, 34],
							7: [2, 34],
							23: [2, 34],
							24: [2, 34],
							26: [2, 34],
							27: [2, 34],
							39: [2, 34],
							41: [2, 34],
							43: [2, 34],
							46: [2, 34],
							50: [2, 34],
							52: [2, 34]
						}, {
							24: [2, 7]
						}, {
							5: [2, 44],
							7: [2, 44],
							17: 109,
							23: [1, 25],
							24: [2, 44],
							26: [2, 44],
							27: [2, 44],
							39: [2, 44],
							41: [2, 44],
							43: [2, 44],
							46: [2, 44],
							50: [2, 44],
							52: [2, 44]
						}, {
							5: [2, 21],
							7: [2, 21],
							24: [2, 21],
							26: [2, 21],
							27: [2, 21],
							39: [2, 21],
							41: [2, 21],
							43: [2, 21],
							46: [2, 21],
							50: [2, 21],
							52: [2, 21]
						}, {
							24: [2, 4]
						}, {
							7: [2, 10],
							24: [2, 10]
						}, {
							7: [2, 11],
							24: [2, 11]
						}, {
							5: [2, 25],
							7: [2, 25],
							24: [2, 25],
							27: [2, 25]
						}, {
							23: [1, 48],
							40: 110
						}, {
							5: [2, 30],
							7: [2, 30],
							24: [2, 30],
							27: [2, 30],
							39: [2, 30],
							43: [2, 30]
						}, {
							12: 111,
							49: 78,
							50: [1, 79],
							52: [1, 46]
						}, {
							24: [2, 65],
							38: [2, 65]
						}, {
							24: [2, 63],
							38: [2, 63]
						}, {
							5: [2, 40],
							7: [2, 40],
							24: [2, 40],
							26: [2, 40],
							27: [2, 40],
							39: [2, 40],
							41: [2, 40],
							43: [2, 40],
							46: [2, 40],
							50: [2, 40],
							51: [2, 40],
							52: [2, 40]
						}, {
							5: [2, 19],
							7: [2, 19],
							24: [2, 19],
							26: [2, 19],
							27: [2, 19],
							39: [2, 19],
							41: [2, 19],
							43: [2, 19],
							46: [2, 19],
							50: [2, 19],
							52: [2, 19]
						}, {
							5: [2, 20],
							7: [2, 20],
							24: [2, 20],
							26: [2, 20],
							27: [2, 20],
							39: [2, 20],
							41: [2, 20],
							43: [2, 20],
							46: [2, 20],
							50: [2, 20],
							52: [2, 20]
						}, {
							39: [1, 112]
						}, {
							38: [2, 26],
							42: [2, 26]
						}, {
							5: [2, 28],
							7: [2, 28],
							24: [2, 28],
							27: [2, 28]
						}],
						defaultActions: {
							15: [2, 1],
							16: [2, 2],
							95: [2, 7],
							98: [2, 4]
						},
						parseError: function(a, b) {
							throw new Error(a)
						},
						parse: function(a) {
							function o() {
								var a;
								a = b.lexer.lex() || 1, typeof a != "number" && (a = b.symbols_[a] || a);
								return a
							}
 
							function n(a) {
								c.length = c.length - 2 * a, d.length = d.length - a, e.length = e.length - a
							}
							var b = this,
							    c = [0],
							    d = [null],
							    e = [],
							    f = this.table,
							    g = "",
							    h = 0,
							    i = 0,
							    j = 0,
							    k = 2,
							    l = 1;
							this.lexer.setInput(a), this.lexer.yy = this.yy, this.yy.lexer = this.lexer, typeof this.lexer.yylloc == "undefined" && (this.lexer.yylloc = {});
							var m = this.lexer.yylloc;
							e.push(m), typeof this.yy.parseError == "function" && (this.parseError = this.yy.parseError);
							var p, q, r, s, t, u, v = {},
								w, x, y, z;
							for(;;) {
								r = c[c.length - 1], this.defaultActions[r] ? s = this.defaultActions[r] : (p == null && (p = o()), s = f[r] && f[r][p]);
								if(typeof s == "undefined" || !s.length || !s[0]) {
									if(!j) {
										z = [];
										for(w in f[r]) this.terminals_[w] && w > 2 && z.push("'" + this.terminals_[w] + "'");
										var A = "";
										this.lexer.showPosition ? A = "Parse error on line " + (h + 1) + ":\n" + this.lexer.showPosition() + "\nExpecting " + z.join(", ") : A = "Parse error on line " + (h + 1) + ": Unexpected " + (p == 1 ? "end of input" : "'" + (this.terminals_[p] || p) + "'"), this.parseError(A, {
											text: this.lexer.match,
											token: this.terminals_[p] || p,
											line: this.lexer.yylineno,
											loc: m,
											expected: z
										})
									}
									if(j == 3) {
										if(p == l) throw new Error(A || "Parsing halted.");
										i = this.lexer.yyleng, g = this.lexer.yytext, h = this.lexer.yylineno, m = this.lexer.yylloc, p = o()
									}
									for(;;) {
										if(k.toString() in f[r]) break;
										if(r == 0) throw new Error(A || "Parsing halted.");
										n(1), r = c[c.length - 1]
									}
									q = p, p = k, r = c[c.length - 1], s = f[r] && f[r][k], j = 3
								}
								if(s[0] instanceof Array && s.length > 1) throw new Error("Parse Error: multiple actions possible at state: " + r + ", token: " + p);
								switch(s[0]) {
									case 1:
										c.push(p), d.push(this.lexer.yytext), e.push(this.lexer.yylloc), c.push(s[1]), p = null, q ? (p = q, q = null) : (i = this.lexer.yyleng, g = this.lexer.yytext, h = this.lexer.yylineno, m = this.lexer.yylloc, j > 0 && j--);
										break;
									case 2:
										x = this.productions_[s[1]][1], v.$ = d[d.length - x], v._$ = {
											first_line: e[e.length - (x || 1)].first_line,
											last_line: e[e.length - 1].last_line,
											first_column: e[e.length - (x || 1)].first_column,
											last_column: e[e.length - 1].last_column
										}, u = this.performAction.call(v, g, i, h, this.yy, s[1], d, e);
										if(typeof u != "undefined") return u;
										x && (c = c.slice(0, -1 * x * 2), d = d.slice(0, -1 * x), e = e.slice(0, -1 * x)), c.push(this.productions_[s[1]][0]), d.push(v.$), e.push(v._$), y = f[c[c.length - 2]][c[c.length - 1]], c.push(y);
										break;
									case 3:
										return !0
								}
							}
							return !0
						}
					},
					f = function() {
						var a = {
							EOF: 1,
							parseError: function(a, b) {
								if(this.yy.parseError) this.yy.parseError(a, b);
								else throw new Error(a)
							},
							setInput: function(a) {
								this._input = a, this._more = this._less = this.done = !1, 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 a = this._input[0];
								this.yytext += a, this.yyleng++, this.match += a, this.matched += a;
								var b = a.match(/\n/);
								b && this.yylineno++, this._input = this._input.slice(1);
								return a
							},
							unput: function(a) {
								this._input = a + this._input;
								return this
							},
							more: function() {
								this._more = !0;
								return this
							},
							pastInput: function() {
								var a = this.matched.substr(0, this.matched.length - this.match.length);
								return(a.length > 20 ? "..." : "") + a.substr(-20)
									.replace(/\n/g, "")
							},
							upcomingInput: function() {
								var a = this.match;
								a.length < 20 && (a += this._input.substr(0, 20 - a.length));
								return(a.substr(0, 20) + (a.length > 20 ? "..." : ""))
									.replace(/\n/g, "")
							},
							showPosition: function() {
								var a = this.pastInput(),
									b = Array(a.length + 1)
									.join("-");
								return a + this.upcomingInput() + "\n" + b + "^"
							},
							next: function() {
								if(this.done) return this.EOF;
								this._input || (this.done = !0);
								var a, b, c, d;
								this._more || (this.yytext = "", this.match = "");
								var e = this._currentRules();
								for(var f = 0; f < e.length; f++) {
									b = this._input.match(this.rules[e[f]]);
									if(b) {
										d = b[0].match(/\n.*/g), d && (this.yylineno += d.length), this.yylloc = {
											first_line: this.yylloc.last_line,
											last_line: this.yylineno + 1,
											first_column: this.yylloc.last_column,
											last_column: d ? d[d.length - 1].length - 1 : this.yylloc.last_column + b[0].length
										}, this.yytext += b[0], this.match += b[0], this.matches = b, this.yyleng = this.yytext.length, this._more = !1, this._input = this._input.slice(b[0].length), this.matched += b[0], a = this.performAction.call(this, this.yy, this, e[f], this.conditionStack[this.conditionStack.length - 1]);
										if(a) return a;
										return
									}
								}
								if(this._input === "") return this.EOF;
								this.parseError("Lexical error on line " + (this.yylineno + 1) + ". Unrecognized text.\n" + this.showPosition(), {
									text: "",
									token: null,
									line: this.yylineno
								})
							},
							lex: function() {
								var a = this.next();
								return typeof a != "undefined" ? a : this.lex()
							},
							begin: function(a) {
								this.conditionStack.push(a)
							},
							popState: function() {
								return this.conditionStack.pop()
							},
							_currentRules: function() {
								return this.conditions[this.conditionStack[this.conditionStack.length - 1]].rules
							}
						};
						a.performAction = function(a, b, c, d) {
							var e = d;
							switch(c) {
								case 0:
									break;
								case 1:
									break;
								case 2:
									break;
								case 3:
									return 7;
								case 4:
									return 38;
								case 5:
									return 23;
								case 6:
									return 24;
								case 7:
									return 26;
								case 8:
									return 27;
								case 9:
									return 39;
								case 10:
									return 41;
								case 11:
									return 42;
								case 12:
									return 61;
								case 13:
									return 28;
								case 14:
									return 16;
								case 15:
									return 18;
								case 16:
									return 20;
								case 17:
									return 19;
								case 18:
									return 21;
								case 19:
									return 22;
								case 20:
									return 29;
								case 21:
									return 30;
								case 22:
									return 56;
								case 23:
									return 57;
								case 24:
									b.yytext = b.yytext.substr(1, b.yyleng - 2);
									return 52;
								case 25:
									return 53;
								case 26:
									return 50;
								case 27:
									return 43;
								case 28:
									return 44;
								case 29:
									return 46;
								case 30:
									return 51;
								case 31:
									return 5
							}
						}, a.rules = [/^\s+/, /^\/\/[^\n]*/, /^#[^\n]*/, /^;/, /^,/, /^\{/, /^\}/, /^\[/, /^\]/, /^`/, /^</, /^>/, /^:/, /^object\b/, /^integer\b/, /^number\b/, /^null\b/, /^boolean\b/, /^any\b/, /^array\b/, /^union\b/, /^string\b/, /^true\b/, /^false\b/, /^"(?:\\["bfnrt/\\]|\\u[a-fA-F0-9]{4}|[^"\\])*"/, /^-?(?:[0-9]|[1-9][0-9]+)(?:\.[0-9]+)?(?:[eE][-+]?[0-9]+)?\b/, /^[A-Za-z_0-9-]+/, /^\?/, /^\*/, /^=/, /^\/(?:[^\/]|\\\/)*\//, /^$/], a.conditions = {
							INITIAL: {
								rules: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31],
								inclusive: !0
							}
						};
						return a
					}();
				a.lexer = f;
				return a
			}();
			typeof a != "undefined" && typeof b != "undefined" && (b.parser = d, b.parse = function() {
				return d.parse.apply(d, arguments)
			}, b.main = function(c) {
				if(!c[1]) throw new Error("Usage: " + c[0] + " FILE");
				if(typeof process != "undefined") var d = a("fs").readFileSync(a("path")
				                                                 .join(process.cwd(), c[1]), "utf8");
				else var e = a("file").path(a("file")
					                  .cwd()),
					     d = e.join(c[1]).read({
					     	charset: "utf-8"
					     });
				return b.parser.parse(d)
			}, typeof c != "undefined" && a.main === c && b.main(typeof process != "undefined" ? process.argv.slice(1) : a("system")
				.args))
		},
		requires: ["fs", "path", "file", "file", "system"]
	}), a.def("scope", {
		factory: function(a, b, c) {
			if(typeof a != "undefined") var d = b;
			else var d = parser.yy;
			d.NOVALUE = {}, d.Type = function() {
				return this.init.apply(this, arguments)
			}, d.Type.prototype = {
				init: function(a, b, c, d) {
					this.json = {}, this.json.type = a;
					if(a instanceof Array && a.length < 2) throw new Error("must have at least two members in a union");
					b && this.addRange(b), c && (this.addEntries(c), !d && (c.length || c.type) && (this.json.additionalProperties = !1));
					return this.json
				},
				addEntries: function(a) {
					if(this.json.type !== "array" || a instanceof Array && !(a.length > 0)) {
						if(a.length) {
							this.json.properties = {};
							for(var b = 0; b < a.length; b++) this.json.properties[a[b][0]] = a[b][1]
						}
					} else this.json.items = a
				},
				addRange: function(a) {
					var b = this.json.type === "array" ? "Items" : this.json.type === "string" ? "Length" : "imum";
					a[0] !== null && (this.json["min" + b] = a[0]), a[1] !== null && (this.json["max" + b] = a[1])
				}
			}, d.Type.addOptionals = function(a, b) {
				if(b.extras) {
					var c;
					for(c in b.extras) b.extras.hasOwnProperty(c) && (a[c] = b.extras[c])
				}
				b.optional && (a.optional = !0), b.enums && (a["enum"] = b.enums), b.requires && (a.requires = b.requires.length > 1 ? b.requires : b.requires[0]), b.defaultv !== d.NOVALUE && (a["default"] = b.defaultv), b.pattern && (a.pattern = b.pattern)
			}
		},
		requires: []
	});
	return a("orderly")
}();
 
 
 
 
 
 
 
 
 
 
/*
 
Function: validate
 
This method validates a json object against a JSONSchema.
 
Parameters:
 
	(object) - a JavaScript object.
	(object) - a JSONSchema object.
 
Returns:
 
	(object) - { valid: true|false, errors: [] }.
 
Example:
 
(start code)
 
dim def : def = join(array( _
	"object {", _
	"	string name;", _
	"	string description?;", _
	"	string homepage /^http:/;", _
	"}*;" _
), vbNewline)
 
dim obj : obj = join(array( _
	"{", _
	"	""name"": ""Fabio Zendhi Nagao"",", _
	"	""description"": ""A big enthusiast of programming and mathematics."",", _
	"	""homepage"": ""http://zend.lojcomm.com.br/""", _
	"}" _
), vbNewline)
 
Response.write( Orderly.validate( JSON.parse(obj), def ).valid )' prints true
 
(end code)
 
Notes:
 
	- This method requires the JSONSchema class to work.
 
*/
 
(function(){
	if(JSONSchema) {
		Orderly.validate = function(instance, orderly) {
			var Schema = Orderly.parse(orderly);
			return JSONSchema.validate(instance, Schema);
		}
	}
}());
 
</script>
 

json2.asp

<script language="Javascript" runat="server">
 
/*
 
File: json2.asp
 
AXE(ASP Xtreme Evolution) JSON parser based on Douglas Crockford json2.js.
 
This class is the result of Classic ASP JSON topic revisited by Fabio Zendhi
Nagao (nagaozen). JSON2.ASP is a better option over JSON.ASP because it embraces
the AXE philosophy of real collaboration over the languages. It works under the
original json parser, so this class is strict in the standard rules, it also
brings more of the Javascript json feeling to other ASP languages (eg. no more
oJson.getElement("foo") stuff, just oJson.foo and you get it).
 
License:
 
This file is part of ASP Xtreme Evolution.
Copyright (C) 2007-2012 Fabio Zendhi Nagao
 
ASP Xtreme Evolution is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
 
ASP Xtreme Evolution is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.
 
You should have received a copy of the GNU Lesser General Public License
along with ASP Xtreme Evolution. If not, see <http://www.gnu.org/licenses/>.
 
 
 
 
 
Class: JSON
 
JSON (Javascript Object Notation) is a lightweight data-interchange format. It
is easy for humans to read and write. It is easy for machines to parse and
generate. It is based on a subset of the Javascript Programming Language,
Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is
completely language independent but uses conventions that are familiar to
programmers of the C-family of languages, including C, C++, C#, Java,
Javascript, Perl, Python, and many others. These properties make JSON an ideal
data-interchange language.
 
Notes:
 
	- JSON parse/stringify from the Douglas Crockford json2.js <https://raw.githubusercontent.com/douglascrockford/JSON-js/master/json2.js>.
	- JSON.toXML is based on the Prof. Stefan Gössner "Converting Between XML and JSON" pragmatic approach <http://www.xml.com/pub/a/2006/05/31/converting-between-xml-and-json.html>.
	- JSON.minify is based on <https://github.com/getify/JSON.minify/blob/master/minify.json.js> and exists because of <https://plus.google.com/+DouglasCrockfordEsq/posts/RK8qyGVaGSr>.
 
About:
 
	- Written by Fabio Zendhi Nagao <http://zend.lojcomm.com.br/> @ August 2010
 
 
 
 
 
Function: parse
 
This method parses a JSON text to produce an object or array. It can throw a SyntaxError exception.
 
Parameters:
 
	(string) - Valid JSON text.
 
Returns:
 
	(mixed) - a Javascript value, usually an object or array.
 
Example:
 
(start code)
 
dim Info : set Info = JSON.parse(join(array( _
	"{", _
	"  ""firstname"": ""Fabio"",", _
	"  ""lastname"": ""長尾"",", _
	"  ""alive"": true,", _
	"  ""age"": 27,", _
	"  ""nickname"": ""nagaozen"",", _
	"  ""fruits"": [", _
	"    ""banana"",", _
	"    ""orange"",", _
	"    ""apple"",", _
	"    ""papaya"",", _
	"    ""pineapple""", _
	"  ],", _
	"  ""complex"": {", _
	"    ""real"": 1,", _
	"    ""imaginary"": 2", _
	"  }", _
	"}" _
)))
 
Response.write(Info.firstname & vbNewline) ' prints Fabio
Response.write(Info.alive & vbNewline) ' prints True
Response.write(Info.age & vbNewline) ' prints 27
Response.write(Info.fruits.get(0) & vbNewline) ' prints banana
Response.write(Info.fruits.get(1) & vbNewline) ' prints orange
Response.write(Info.complex.real & vbNewline) ' prints 1
Response.write(Info.complex.imaginary & vbNewline) ' prints 2
 
' You can also enumerate object properties ...
 
dim key : for each key in Info.enumerate()
	Response.write( key & vbNewline )
next
 
' which prints:
 
' firstname
' lastname
' alive
' age
' nickname
' fruits
' complex
 
set Info = nothing
 
(end code)
 
 
 
 
 
Function: stringify
 
This method produces a JSON text from a Javascript value.
 
Parameters:
 
	(mixed) - any Javascript value, usually an object or array.
	(mixed) - an optional parameter that determines how object values are stringified for objects. It can be a function or an array of strings.
	(mixed) - an optional parameter that specifies the indentation of nested structures. If it is omitted, the text will be packed without extra whitespace. If it is a number, it will specify the number of spaces to indent at each level. If it is a string (such as '\t' or '&nbsp;'), it contains the characters used to indent at each level.
 
Returns:
 
	(string) - a string that contains the serialized JSON text.
 
Example:
 
(start code)
 
dim Info : set Info = JSON.parse("{""firstname"":""Fabio"", ""lastname"":""長尾""}")
Info.set "alive", true
Info.set "age", 27
Info.set "nickname", "nagaozen"
Info.set "fruits", array("banana","orange","apple","papaya","pineapple")
Info.set "complex", JSON.parse("{""real"":1, ""imaginary"":1}")
 
Response.write( JSON.stringify(Info, null, 2) & vbNewline ) ' prints the text below:
'{
'  "firstname": "Fabio",
'  "lastname": "長尾",
'  "alive": true,
'  "age": 27,
'  "nickname": "nagaozen",
'  "fruits": [
'    "banana",
'    "orange",
'    "apple",
'    "papaya",
'    "pineapple"
'  ],
'  "complex": {
'    "real": 1,
'    "imaginary": 1
'  }
'}
 
set Info = nothing
 
(end code)
 
 
 
 
 
Function: toXML
 
This method produces a XML text from a Javascript value.
 
Parameters:
 
	(mixed) - any Javascript value, usually an object or array.
	(string) - an optional parameter that determines what tag should be used as a container for the output. Defaults to none.
 
Returns:
 
	(string) - a string that contains the serialized XML text.
 
Example:
 
(start code)
 
dim Info : set Info = JSON.parse("{""firstname"":""Fabio"", ""lastname"":""長尾""}")
Info.set "alive", true
Info.set "age", 27
Info.set "nickname", "nagaozen"
Info.set "fruits", array("banana","orange","apple","papaya","pineapple")
Info.set "complex", JSON.parse("{""real"":1, ""imaginary"":1}")
 
Response.write( JSON.toXML(Info) & vbNewline ) ' prints the text below:
'<firstname>Fabio</firstname>
'<lastname>長尾</lastname>
'<alive>true</alive>
'<age>27</age>
'<nickname>nagaozen</nickname>
'<fruits>banana</fruits>
'<fruits>orange</fruits>
'<fruits>apple</fruits>
'<fruits>papaya</fruits>
'<fruits>pineapple</fruits>
'<complex>
'    <real>1</real>
'    <imaginary>1</imaginary>
'</complex>
 
set Info = nothing
 
(end code)
 
 
 
 
 
Function: minify
 
This method can be used as a helper to enable comments in json-like
configuration files. According to Douglas Crockford, using comments are fine if
you pipe the code before handing it to your JSON parser. See
<https://plus.google.com/118095276221607585885/posts/RK8qyGVaGSr>
 
Parameters:
 
	(string) - a json-like configuration string
 
Returns:
 
	(json) - valid minified json
 
*/
 
if(!Object.prototype.get) {
	Object.prototype.get = function(k) {
		return this[k];
	}
}
 
if(!Object.prototype.set) {
	Object.prototype.set = function(k,v) {
		if(typeof(v) === "unknown") {
			try {
				v = (new VBArray(v)).toArray();
			} catch(e) {
				return;
			}
		}
		this[k] = v;
	}
}
 
if(!Object.prototype.purge) {
	Object.prototype.purge = function(k) {
		delete this[k];
	}
}
 
if(!Object.prototype.enumerate) {
	Object.prototype.enumerate = function() {
		var d = new ActiveXObject("Scripting.Dictionary");
		for(var key in this) {
			if(this.hasOwnProperty(key)) {
				d.add(key, this[key]);
			}
		}
		return d.keys();
	}
}
 
if(!String.prototype.sanitize) {
	String.prototype.sanitize = function(a, b) {
		var len = a.length,
			s = this;
		if(len !== b.length) throw new TypeError('Invalid procedure call. Both arrays should have the same size.');
		for(var i = 0; i < len; i++) {
			var re = new RegExp(a[i],'g');
			s = s.replace(re, b[i]);
		}
		return s;
	}
}
 
if(!String.prototype.substitute) {
	String.prototype.substitute = function(object, regexp){
		return this.replace(regexp || (/\\?\{([^{}]+)\}/g), function(match, name){
			if(match.charAt(0) == '\\') return match.slice(1);
			return (object[name] != undefined) ? object[name] : '';
		});
	}
}
 
 
 
 
 
 
 
 
 
 
//  json2.js
//  2016-10-28
//  Public Domain.
//  NO WARRANTY EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
//  See http://www.JSON.org/js.html
//  This code should be minified before deployment.
//  See http://javascript.crockford.com/jsmin.html
 
//  USE YOUR OWN COPY. IT IS EXTREMELY UNWISE TO LOAD CODE FROM SERVERS YOU DO
//  NOT CONTROL.
 
//  This file creates a global JSON object containing two methods: stringify
//  and parse. This file provides the ES5 JSON capability to ES3 systems.
//  If a project might run on IE8 or earlier, then this file should be included.
//  This file does nothing on ES5 systems.
 
//      JSON.stringify(value, replacer, space)
//          value       any JavaScript value, usually an object or array.
//          replacer    an optional parameter that determines how object
//                      values are stringified for objects. It can be a
//                      function or an array of strings.
//          space       an optional parameter that specifies the indentation
//                      of nested structures. If it is omitted, the text will
//                      be packed without extra whitespace. If it is a number,
//                      it will specify the number of spaces to indent at each
//                      level. If it is a string (such as "\t" or "&nbsp;"),
//                      it contains the characters used to indent at each level.
//          This method produces a JSON text from a JavaScript value.
//          When an object value is found, if the object contains a toJSON
//          method, its toJSON method will be called and the result will be
//          stringified. A toJSON method does not serialize: it returns the
//          value represented by the name/value pair that should be serialized,
//          or undefined if nothing should be serialized. The toJSON method
//          will be passed the key associated with the value, and this will be
//          bound to the value.
 
//          For example, this would serialize Dates as ISO strings.
 
//              Date.prototype.toJSON = function (key) {
//                  function f(n) {
//                      // Format integers to have at least two digits.
//                      return (n < 10)
//                          ? "0" + n
//                          : n;
//                  }
//                  return this.getUTCFullYear()   + "-" +
//                       f(this.getUTCMonth() + 1) + "-" +
//                       f(this.getUTCDate())      + "T" +
//                       f(this.getUTCHours())     + ":" +
//                       f(this.getUTCMinutes())   + ":" +
//                       f(this.getUTCSeconds())   + "Z";
//              };
 
//          You can provide an optional replacer method. It will be passed the
//          key and value of each member, with this bound to the containing
//          object. The value that is returned from your method will be
//          serialized. If your method returns undefined, then the member will
//          be excluded from the serialization.
 
//          If the replacer parameter is an array of strings, then it will be
//          used to select the members to be serialized. It filters the results
//          such that only members with keys listed in the replacer array are
//          stringified.
 
//          Values that do not have JSON representations, such as undefined or
//          functions, will not be serialized. Such values in objects will be
//          dropped; in arrays they will be replaced with null. You can use
//          a replacer function to replace those with JSON values.
 
//          JSON.stringify(undefined) returns undefined.
 
//          The optional space parameter produces a stringification of the
//          value that is filled with line breaks and indentation to make it
//          easier to read.
 
//          If the space parameter is a non-empty string, then that string will
//          be used for indentation. If the space parameter is a number, then
//          the indentation will be that many spaces.
 
//          Example:
 
//          text = JSON.stringify(["e", {pluribus: "unum"}]);
//          // text is '["e",{"pluribus":"unum"}]'
 
//          text = JSON.stringify(["e", {pluribus: "unum"}], null, "\t");
//          // text is '[\n\t"e",\n\t{\n\t\t"pluribus": "unum"\n\t}\n]'
 
//          text = JSON.stringify([new Date()], function (key, value) {
//              return this[key] instanceof Date
//                  ? "Date(" + this[key] + ")"
//                  : value;
//          });
//          // text is '["Date(---current time---)"]'
 
//      JSON.parse(text, reviver)
//          This method parses a JSON text to produce an object or array.
//          It can throw a SyntaxError exception.
 
//          The optional reviver parameter is a function that can filter and
//          transform the results. It receives each of the keys and values,
//          and its return value is used instead of the original value.
//          If it returns what it received, then the structure is not modified.
//          If it returns undefined then the member is deleted.
 
//          Example:
 
//          // Parse the text. Values that look like ISO date strings will
//          // be converted to Date objects.
 
//          myData = JSON.parse(text, function (key, value) {
//              var a;
//              if (typeof value === "string") {
//                  a =
//   /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/.exec(value);
//                  if (a) {
//                      return new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4],
//                          +a[5], +a[6]));
//                  }
//              }
//              return value;
//          });
 
//          myData = JSON.parse('["Date(09/09/2001)"]', function (key, value) {
//              var d;
//              if (typeof value === "string" &&
//                      value.slice(0, 5) === "Date(" &&
//                      value.slice(-1) === ")") {
//                  d = new Date(value.slice(5, -1));
//                  if (d) {
//                      return d;
//                  }
//              }
//              return value;
//          });
 
//  This is a reference implementation. You are free to copy, modify, or
//  redistribute.
 
/*jslint
    eval, for, this
*/
 
/*property
    JSON, apply, call, charCodeAt, getUTCDate, getUTCFullYear, getUTCHours,
    getUTCMinutes, getUTCMonth, getUTCSeconds, hasOwnProperty, join,
    lastIndex, length, parse, prototype, push, replace, slice, stringify,
    test, toJSON, toString, valueOf
*/
 
 
// Create a JSON object only if one does not already exist. We create the
// methods in a closure to avoid creating global variables.
 
if (typeof JSON !== "object") {
    JSON = {};
}
 
(function () {
    "use strict";
 
    var rx_one = /^[\],:{}\s]*$/;
    var rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g;
    var rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g;
    var rx_four = /(?:^|:|,)(?:\s*\[)+/g;
    var rx_escapable = /[\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
    var rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
 
    function f(n) {
        // Format integers to have at least two digits.
        return n < 10
            ? "0" + n
            : n;
    }
 
    function this_value() {
        return this.valueOf();
    }
 
    if (typeof Date.prototype.toJSON !== "function") {
 
        Date.prototype.toJSON = function () {
 
            return isFinite(this.valueOf())
                ? this.getUTCFullYear() + "-" +
                        f(this.getUTCMonth() + 1) + "-" +
                        f(this.getUTCDate()) + "T" +
                        f(this.getUTCHours()) + ":" +
                        f(this.getUTCMinutes()) + ":" +
                        f(this.getUTCSeconds()) + "Z"
                : null;
        };
 
        Boolean.prototype.toJSON = this_value;
        Number.prototype.toJSON = this_value;
        String.prototype.toJSON = this_value;
    }
 
    var gap;
    var indent;
    var meta;
    var rep;
 
 
    function quote(string) {
 
// If the string contains no control characters, no quote characters, and no
// backslash characters, then we can safely slap some quotes around it.
// Otherwise we must also replace the offending characters with safe escape
// sequences.
 
        rx_escapable.lastIndex = 0;
        return rx_escapable.test(string)
            ? "\"" + string.replace(rx_escapable, function (a) {
                var c = meta[a];
                return typeof c === "string"
                    ? c
                    : "\\u" + ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
            }) + "\""
            : "\"" + string + "\"";
    }
 
 
    function str(key, holder) {
 
// Produce a string from holder[key].
 
        var i;          // The loop counter.
        var k;          // The member key.
        var v;          // The member value.
        var length;
        var mind = gap;
        var partial;
        var value = holder[key];
 
// If the value has a toJSON method, call it to obtain a replacement value.
 
        if (value && typeof value === "object" &&
                typeof value.toJSON === "function") {
            value = value.toJSON(key);
        }
 
// If we were called with a replacer function, then call the replacer to
// obtain a replacement value.
 
        if (typeof rep === "function") {
            value = rep.call(holder, key, value);
        }
 
// What happens next depends on the value's type.
 
        switch (typeof value) {
        case "string":
            return quote(value);
 
        case "number":
 
// JSON numbers must be finite. Encode non-finite numbers as null.
 
            return isFinite(value)
                ? String(value)
                : "null";
 
        case "boolean":
        case "null":
 
// If the value is a boolean or null, convert it to a string. Note:
// typeof null does not produce "null". The case is included here in
// the remote chance that this gets fixed someday.
 
            return String(value);
 
// If the type is "object", we might be dealing with an object or an array or
// null.
 
        case "object":
 
// Due to a specification blunder in ECMAScript, typeof null is "object",
// so watch out for that case.
 
            if (!value) {
                return "null";
            }
 
// Make an array to hold the partial results of stringifying this object value.
 
            gap += indent;
            partial = [];
 
// Is the value an array?
 
            if (Object.prototype.toString.apply(value) === "[object Array]") {
 
// The value is an array. Stringify every element. Use null as a placeholder
// for non-JSON values.
 
                length = value.length;
                for (i = 0; i < length; i += 1) {
                    partial[i] = str(i, value) || "null";
                }
 
// Join all of the elements together, separated with commas, and wrap them in
// brackets.
 
                v = partial.length === 0
                    ? "[]"
                    : gap
                        ? "[\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "]"
                        : "[" + partial.join(",") + "]";
                gap = mind;
                return v;
            }
 
// If the replacer is an array, use it to select the members to be stringified.
 
            if (rep && typeof rep === "object") {
                length = rep.length;
                for (i = 0; i < length; i += 1) {
                    if (typeof rep[i] === "string") {
                        k = rep[i];
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (
                                gap
                                    ? ": "
                                    : ":"
                            ) + v);
                        }
                    }
                }
            } else {
 
// Otherwise, iterate through all of the keys in the object.
 
                for (k in value) {
                    if (Object.prototype.hasOwnProperty.call(value, k)) {
                        v = str(k, value);
                        if (v) {
                            partial.push(quote(k) + (
                                gap
                                    ? ": "
                                    : ":"
                            ) + v);
                        }
                    }
                }
            }
 
// Join all of the member texts together, separated with commas,
// and wrap them in braces.
 
            v = partial.length === 0
                ? "{}"
                : gap
                    ? "{\n" + gap + partial.join(",\n" + gap) + "\n" + mind + "}"
                    : "{" + partial.join(",") + "}";
            gap = mind;
            return v;
        }
    }
 
// If the JSON object does not yet have a stringify method, give it one.
 
    if (typeof JSON.stringify !== "function") {
        meta = {    // table of character substitutions
            "\b": "\\b",
            "\t": "\\t",
            "\n": "\\n",
            "\f": "\\f",
            "\r": "\\r",
            "\"": "\\\"",
            "\\": "\\\\"
        };
        JSON.stringify = function (value, replacer, space) {
 
// The stringify method takes a value and an optional replacer, and an optional
// space parameter, and returns a JSON text. The replacer can be a function
// that can replace values, or an array of strings that will select the keys.
// A default replacer method can be provided. Use of the space parameter can
// produce text that is more easily readable.
 
            var i;
            gap = "";
            indent = "";
 
// If the space parameter is a number, make an indent string containing that
// many spaces.
 
            if (typeof space === "number") {
                for (i = 0; i < space; i += 1) {
                    indent += " ";
                }
 
// If the space parameter is a string, it will be used as the indent string.
 
            } else if (typeof space === "string") {
                indent = space;
            }
 
// If there is a replacer, it must be a function or an array.
// Otherwise, throw an error.
 
            rep = replacer;
            if (replacer && typeof replacer !== "function" &&
                    (typeof replacer !== "object" ||
                    typeof replacer.length !== "number")) {
                throw new Error("JSON.stringify");
            }
 
// Make a fake root object containing our value under the key of "".
// Return the result of stringifying the value.
 
            return str("", {"": value});
        };
    }
 
 
// If the JSON object does not yet have a parse method, give it one.
 
    if (typeof JSON.parse !== "function") {
        JSON.parse = function (text, reviver) {
 
// The parse method takes a text and an optional reviver function, and returns
// a JavaScript value if the text is a valid JSON text.
 
            var j;
 
            function walk(holder, key) {
 
// The walk method is used to recursively walk the resulting structure so
// that modifications can be made.
 
                var k;
                var v;
                var value = holder[key];
                if (value && typeof value === "object") {
                    for (k in value) {
                        if (Object.prototype.hasOwnProperty.call(value, k)) {
                            v = walk(value, k);
                            if (v !== undefined) {
                                value[k] = v;
                            } else {
                                delete value[k];
                            }
                        }
                    }
                }
                return reviver.call(holder, key, value);
            }
 
 
// Parsing happens in four stages. In the first stage, we replace certain
// Unicode characters with escape sequences. JavaScript handles many characters
// incorrectly, either silently deleting them, or treating them as line endings.
 
            text = String(text);
            rx_dangerous.lastIndex = 0;
            if (rx_dangerous.test(text)) {
                text = text.replace(rx_dangerous, function (a) {
                    return "\\u" +
                            ("0000" + a.charCodeAt(0).toString(16)).slice(-4);
                });
            }
 
// In the second stage, we run the text against regular expressions that look
// for non-JSON patterns. We are especially concerned with "()" and "new"
// because they can cause invocation, and "=" because it can cause mutation.
// But just to be safe, we want to reject all unexpected forms.
 
// We split the second stage into 4 regexp operations in order to work around
// crippling inefficiencies in IE's and Safari's regexp engines. First we
// replace the JSON backslash pairs with "@" (a non-JSON character). Second, we
// replace all simple value tokens with "]" characters. Third, we delete all
// open brackets that follow a colon or comma or that begin the text. Finally,
// we look to see that the remaining characters are only whitespace or "]" or
// "," or ":" or "{" or "}". If that is so, then the text is safe for eval.
 
            if (
                rx_one.test(
                    text
                        .replace(rx_two, "@")
                        .replace(rx_three, "]")
                        .replace(rx_four, "")
                )
            ) {
 
// In the third stage we use the eval function to compile the text into a
// JavaScript structure. The "{" operator is subject to a syntactic ambiguity
// in JavaScript: it can begin a block or an object literal. We wrap the text
// in parens to eliminate the ambiguity.
 
                j = eval("(" + text + ")");
 
// In the optional fourth stage, we recursively walk the new structure, passing
// each name/value pair to a reviver function for possible transformation.
 
                return (typeof reviver === "function")
                    ? walk({"": j}, "")
                    : j;
            }
 
// If the text is not JSON parseable, then a SyntaxError is thrown.
 
            throw new SyntaxError("JSON.parse");
        };
    }
}());
 
 
 
 
 
 
 
 
 
 
// Implement toXML
(function(){
 
/*
IMPORTANT: XML 1.0 name token is defined here <http://www.w3.org/TR/2008/REC-xml-20081126/#NT-Nmtoken>
			[#x10000-#xEFFFF] range is left out because ECMA 262 language specification (ECMAScript Edition 3)
			doesn't have a way to represent them as Regular Expressions Ranges.
*/
	function __tagize(value) {
		if( /^[_:A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][-.·_:0-9A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u0300-\u036F\u203F-\u2040]*$/.test(value) ) {
			return value;
		} else {
			// NOTE: just naively assuming that `value` has an invalid NameStartChar
			return "_INVALID_NAMESTARTCHAR_" + value;
		}
	}
 
	function __sanitize(value) {
		return value.sanitize(
			['&',    '<',   '>',    '\'',    '"'],
			['&amp;','&lt;','&gt;', '&apos;','&quot;']
		);
	};
 
	function __toXML(o, t) {
		var xml = [],
		    a   = [],
		    p, i, len;
 
		switch( typeof o ) {
			case "object":
				if( null === o ) {
					xml.push("<{tag}/>".substitute({"tag":__tagize(t)}));
				} else if(o.length) {
					a = o;
					if(a.length === 0) {
						xml.push("<{tag}/>".substitute({"tag":__tagize(t)}));
					} else {
						for(i = 0, len = a.length; i < len; i++) {
							xml.push(__toXML(a[i], t));
						}
					}
				} else {
					xml.push("<{tag}".substitute({"tag":__tagize(t)}));
					a = [];
					for(p in o) {
						if(o.hasOwnProperty(p)) {
							if(p.charAt(0) === "@") xml.push(" {param}='{content}'".substitute({"param":__tagize(p.substr(1)), "content":__sanitize(o[p].toString())}));
							else a.push(p);
						}
					}
					if(a.length === 0) {
						xml.push("/>");
					} else {
						xml.push(">");
						for(i = 0, len = a.length; i < len; i++) {
							p = a[i];
							if(p === "#text") {
								xml.push(__sanitize(o[p]));
							} else if(p === "#cdata") {
								xml.push("<![CDATA[{code}]]>".substitute({"code": o[p]}));
							} else {
								xml.push(__toXML(o[p], p));
							}
						}
						xml.push("</{tag}>".substitute({"tag":__tagize(t)}));
					}
				}
				break;
 
			default:
				var s = String(o);
				if(s.length === 0) {
					xml.push("<{tag}/>".substitute({"tag":__tagize(t)}));
				} else {
					xml.push("<{tag}>{value}</{tag}>".substitute({"tag":__tagize(t), "value":__sanitize(s)}));
				}
		}
		return xml.join('');
	}
 
	if(typeof JSON.toXML !== 'function') {
		JSON.toXML = function(o){
			var xml = [];
			for(var p in o) {
				if(o.hasOwnProperty(p)) {
					xml.push(__toXML(o[p], p));
				}
			}
			return xml.join('');
		}
	}
 
}());
 
 
 
 
 
 
 
 
 
 
// Implement minify ( strip comments from json-like configuration files )
(function(){
	if(typeof JSON.minify !== 'function') {
		JSON.minify = function(json) {
			var tokenizer = /"|(\/\*)|(\*\/)|(\/\/)|\n|\r/g,
				in_string = false,
				in_multiline_comment = false,
				in_singleline_comment = false,
				tmp, tmp2, new_str = [], ns = 0, from = 0, lc, rc;
 
			tokenizer.lastIndex = 0;
 
			while( tmp = tokenizer.exec(json) ) {
				lc = RegExp.leftContext;
				rc = RegExp.rightContext;
				if(!in_multiline_comment && !in_singleline_comment) {
					tmp2 = lc.substring(from);
					if(!in_string) {
						tmp2 = tmp2.replace(/(\n|\r|\s)*/g,"");
					}
					new_str[ns++] = tmp2;
				}
				from = tokenizer.lastIndex;
 
				if(tmp[0] == "\"" && !in_multiline_comment && !in_singleline_comment) {
					tmp2 = lc.match(/(\\)*$/);
					if(!in_string || !tmp2 || (tmp2[0].length % 2) == 0) { // start of string with ", or unescaped " character found to end string
						in_string = !in_string;
					}
					from--; // include " character in next catch
					rc = json.substring(from);
				} else if(tmp[0] == "/*" && !in_string && !in_multiline_comment && !in_singleline_comment) {
					in_multiline_comment = true;
				} else if(tmp[0] == "*/" && !in_string && in_multiline_comment && !in_singleline_comment) {
					in_multiline_comment = false;
				} else if(tmp[0] == "//" && !in_string && !in_multiline_comment && !in_singleline_comment) {
					in_singleline_comment = true;
				} else if((tmp[0] == "\n" || tmp[0] == "\r") && !in_string && !in_multiline_comment && in_singleline_comment) {
					in_singleline_comment = false;
				} else if(!in_multiline_comment && !in_singleline_comment && !(/\n|\r|\s/.test(tmp[0]))) {
					new_str[ns++] = tmp[0];
				}
			}
			new_str[ns++] = rc;
			return new_str.join("");
		}
	}
}());
 
</script>