vrmlParser = (function() { "use strict"; /* * Generated by PEG.js 0.9.0. * * http://pegjs.org/ */ function peg$subclass(child, parent) { function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); } function peg$SyntaxError(message, expected, found, location) { this.message = message; this.expected = expected; this.found = found; this.location = location; this.name = "SyntaxError"; if (typeof Error.captureStackTrace === "function") { Error.captureStackTrace(this, peg$SyntaxError); } } peg$subclass(peg$SyntaxError, Error); function peg$parse(input) { var options = arguments.length > 1 ? arguments[1] : {}, parser = this, peg$FAILED = {}, peg$startRuleFunctions = { vrml: peg$parsevrml }, peg$startRuleFunction = peg$parsevrml, peg$c0 = "#VRML V2.0 utf8", peg$c1 = { type: "literal", value: "#VRML V2.0 utf8", description: "\"#VRML V2.0 utf8\"" }, peg$c2 = function(vrml) { // before returning the root vrml object, enricht it with routes and nodeDefinitions vrml.nodeDefinitions = nodeDefinitions; vrml.routes = routes; return vrml; }, peg$c3 = function(name) { return name; }, peg$c4 = function(name, n) { n.name = name; n.isDefinition = true; // store node for later re-use nodeDefinitions[name] = n; //console.log('Registered as ' + name + ' in nodeDefinitions:'); //console.log(n); return n; }, peg$c5 = function(t, pp) { var n = {node: t}; // node properties are in pp, if pp is not an Inline node, if pp is an inline node, it should be read from the url for (var i=0; i < pp.length; i++) { var p = pp[i]; // is p a node? if (undefined !== p.node) { //console.log(p.node + ' node found'); // if the node does not already have children, create children here if (undefined === n.children) { n.children = []; } // @todo for an Inline node, we could use the parser (named 'parser') and fs here, to fetch the inline file and parse it // on the other hand, it could be left up to the renderers what to do with the inline node. /* @see http://pegjs.org/documentation#grammar-syntax-and-semantics The code inside the predicate can also access the parser object using the parser variable and options passed to the parser using the options variable. */ n.children.push(p); } else if (undefined !== p.name) { // p is a property n[p.name] = p.value; if (undefined !== p.comment) { if (undefined === n.comments) { n.comments = {}; } if (undefined === n.comments[p.name]) { n.comments[p.name] = []; } n.comments[p.name].push(p.comment); } } else if (undefined !== p.src) { // p is a route // move it to global scope routes.push(p); } else { // p is a comment if (undefined === n.nodeComments) { n.nodeComments = []; } n.nodeComments.push(p); } } return n; }, peg$c6 = function(name, value, comment) { var p = { name:name, value:value }; // you could change a color property here by returning r g b instead of x y z if (null !== comment) { p.comment = comment; } return p; }, peg$c7 = { type: "other", description: "identifier" }, peg$c8 = /^[A-Za-z0-9_]/, peg$c9 = { type: "class", value: "[A-Za-z0-9_]", description: "[A-Za-z0-9_]" }, peg$c10 = function(o) { return o.join(''); }, peg$c11 = { type: "other", description: "array" }, peg$c12 = function(v) { return v; }, peg$c13 = function(it) { var a = []; for (var i=0; i < it.length; i++) { var value = it[i]; if (undefined !== value.src) { // value is a route, add to global routes routes.push(value); } else if (undefined !== value.comment) { // value is a comment if (undefined === a.comments) { a.comments = []; } a.comments.push(value); } else { // this is what we are looking for: a value for in our array! a.push(value); } } return a; }, peg$c14 = { type: "other", description: "value" }, peg$c15 = "false", peg$c16 = { type: "literal", value: "false", description: "\"false\"" }, peg$c17 = "FALSE", peg$c18 = { type: "literal", value: "FALSE", description: "\"FALSE\"" }, peg$c19 = function() { return false; }, peg$c20 = "null", peg$c21 = { type: "literal", value: "null", description: "\"null\"" }, peg$c22 = "NULL", peg$c23 = { type: "literal", value: "NULL", description: "\"NULL\"" }, peg$c24 = function() { return null; }, peg$c25 = "true", peg$c26 = { type: "literal", value: "true", description: "\"true\"" }, peg$c27 = "TRUE", peg$c28 = { type: "literal", value: "TRUE", description: "\"TRUE\"" }, peg$c29 = function() { return true; }, peg$c30 = { type: "other", description: "number" }, peg$c31 = function() { return parseFloat(text()); }, peg$c32 = ".", peg$c33 = { type: "literal", value: ".", description: "\".\"" }, peg$c34 = /^[1-9]/, peg$c35 = { type: "class", value: "[1-9]", description: "[1-9]" }, peg$c36 = /^[eE]/, peg$c37 = { type: "class", value: "[eE]", description: "[eE]" }, peg$c38 = "-", peg$c39 = { type: "literal", value: "-", description: "\"-\"" }, peg$c40 = "+", peg$c41 = { type: "literal", value: "+", description: "\"+\"" }, peg$c42 = "0", peg$c43 = { type: "literal", value: "0", description: "\"0\"" }, peg$c44 = "#", peg$c45 = { type: "literal", value: "#", description: "\"#\"" }, peg$c46 = /^[^\n]/, peg$c47 = { type: "class", value: "[^\\n]", description: "[^\\n]" }, peg$c48 = function(text) { return { comment: text.join('').trim() }; }, peg$c49 = "ROUTE", peg$c50 = { type: "literal", value: "ROUTE", description: "\"ROUTE\"" }, peg$c51 = "TO", peg$c52 = { type: "literal", value: "TO", description: "\"TO\"" }, peg$c53 = function(src, target) { var route = { source: src, target: target }; // put it in the global routes collection routes.push(route); return route; }, peg$c54 = function(name, property) { return { name: name, property: property }; }, peg$c55 = "[", peg$c56 = { type: "literal", value: "[", description: "\"[\"" }, peg$c57 = "{", peg$c58 = { type: "literal", value: "{", description: "\"{\"" }, peg$c59 = "]", peg$c60 = { type: "literal", value: "]", description: "\"]\"" }, peg$c61 = "}", peg$c62 = { type: "literal", value: "}", description: "\"}\"" }, peg$c63 = ",", peg$c64 = { type: "literal", value: ",", description: "\",\"" }, peg$c65 = { type: "other", description: "whitespace" }, peg$c66 = /^[ \t\n\r]/, peg$c67 = { type: "class", value: "[ \\t\\n\\r]", description: "[ \\t\\n\\r]" }, peg$c68 = function(ws) { return ws.join('');}, peg$c69 = " ", peg$c70 = { type: "literal", value: " ", description: "\" \"" }, peg$c71 = function(p) { return p; }, peg$c72 = function(x, y, z) { return {x:x, y:y, z:z}; }, peg$c73 = "DEF", peg$c74 = { type: "literal", value: "DEF", description: "\"DEF\"" }, peg$c75 = function() { return true; }, peg$c76 = function(name) { var obj = nodeDefinitions[name]; if (undefined === obj) { console.log(name + ' not found in nodeDefinitions'); return obj; // undefined obj } if ('function' === typeof obj.clone) { return obj.clone(); } return obj; }, peg$c77 = "USE", peg$c78 = { type: "literal", value: "USE", description: "\"USE\"" }, peg$c79 = "-1", peg$c80 = { type: "literal", value: "-1", description: "\"-1\"" }, peg$c81 = function(points) { return points; }, peg$c82 = function(i) { if (i==0) { return i; } return i.join(''); }, peg$c83 = function(x, y, z, radians) { return {x:x, y:y, z:z, radians:radians}; }, peg$c84 = function(uri) { return uri; }, peg$c85 = /^[^"]/, peg$c86 = { type: "class", value: "[^\"]", description: "[^\"]" }, peg$c87 = "jpg", peg$c88 = { type: "literal", value: "jpg", description: "\"jpg\"" }, peg$c89 = "jpeg", peg$c90 = { type: "literal", value: "jpeg", description: "\"jpeg\"" }, peg$c91 = "gif", peg$c92 = { type: "literal", value: "gif", description: "\"gif\"" }, peg$c93 = "wrl", peg$c94 = { type: "literal", value: "wrl", description: "\"wrl\"" }, peg$c95 = function(i, dot, ext) { return i + dot + ext + "BOOOO"; }, peg$c96 = function(s) { return '"' + s.join('') + '"'; }, peg$c97 = "\"", peg$c98 = { type: "literal", value: "\"", description: "\"\\\"\"" }, peg$c99 = /^[0-9]/, peg$c100 = { type: "class", value: "[0-9]", description: "[0-9]" }, peg$c101 = /^[0-9a-f]/i, peg$c102 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1, seenCR: false }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result; if ("startRule" in options) { if (!(options.startRule in peg$startRuleFunctions)) { throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); } peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; } function text() { return input.substring(peg$savedPos, peg$currPos); } function location() { return peg$computeLocation(peg$savedPos, peg$currPos); } function expected(description) { throw peg$buildException( null, [{ type: "other", description: description }], input.substring(peg$savedPos, peg$currPos), peg$computeLocation(peg$savedPos, peg$currPos) ); } function error(message) { throw peg$buildException( message, null, input.substring(peg$savedPos, peg$currPos), peg$computeLocation(peg$savedPos, peg$currPos) ); } function peg$computePosDetails(pos) { var details = peg$posDetailsCache[pos], p, ch; if (details) { return details; } else { p = pos - 1; while (!peg$posDetailsCache[p]) { p--; } details = peg$posDetailsCache[p]; details = { line: details.line, column: details.column, seenCR: details.seenCR }; while (p < pos) { ch = input.charAt(p); if (ch === "\n") { if (!details.seenCR) { details.line++; } details.column = 1; details.seenCR = false; } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { details.line++; details.column = 1; details.seenCR = true; } else { details.column++; details.seenCR = false; } p++; } peg$posDetailsCache[pos] = details; return details; } } function peg$computeLocation(startPos, endPos) { var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos); return { start: { offset: startPos, line: startPosDetails.line, column: startPosDetails.column }, end: { offset: endPos, line: endPosDetails.line, column: endPosDetails.column } }; } function peg$fail(expected) { if (peg$currPos < peg$maxFailPos) { return; } if (peg$currPos > peg$maxFailPos) { peg$maxFailPos = peg$currPos; peg$maxFailExpected = []; } peg$maxFailExpected.push(expected); } function peg$buildException(message, expected, found, location) { function cleanupExpected(expected) { var i = 1; expected.sort(function(a, b) { if (a.description < b.description) { return -1; } else if (a.description > b.description) { return 1; } else { return 0; } }); while (i < expected.length) { if (expected[i - 1] === expected[i]) { expected.splice(i, 1); } else { i++; } } } function buildMessage(expected, found) { function stringEscape(s) { function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } return s .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\x0F]/g, function(ch) { return '\\x0' + hex(ch); }) .replace(/[\x10-\x1F\x80-\xFF]/g, function(ch) { return '\\x' + hex(ch); }) .replace(/[\u0100-\u0FFF]/g, function(ch) { return '\\u0' + hex(ch); }) .replace(/[\u1000-\uFFFF]/g, function(ch) { return '\\u' + hex(ch); }); } var expectedDescs = new Array(expected.length), expectedDesc, foundDesc, i; for (i = 0; i < expected.length; i++) { expectedDescs[i] = expected[i].description; } expectedDesc = expected.length > 1 ? expectedDescs.slice(0, -1).join(", ") + " or " + expectedDescs[expected.length - 1] : expectedDescs[0]; foundDesc = found ? "\"" + stringEscape(found) + "\"" : "end of input"; return "Expected " + expectedDesc + " but " + foundDesc + " found."; } if (expected !== null) { cleanupExpected(expected); } return new peg$SyntaxError( message !== null ? message : buildMessage(expected, found), expected, found, location ); } function peg$parsevrml() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.substr(peg$currPos, 15) === peg$c0) { s1 = peg$c0; peg$currPos += 15; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c1); } } if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parsenodeDefinition(); if (s3 === peg$FAILED) { s3 = peg$parsenode(); if (s3 === peg$FAILED) { s3 = peg$parsecomment(); if (s3 === peg$FAILED) { s3 = peg$parseroute(); } } } while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsenodeDefinition(); if (s3 === peg$FAILED) { s3 = peg$parsenode(); if (s3 === peg$FAILED) { s3 = peg$parsecomment(); if (s3 === peg$FAILED) { s3 = peg$parseroute(); } } } } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c2(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsenodeDefinition() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$parsedef(); if (s3 !== peg$FAILED) { s4 = peg$parsews(); if (s4 !== peg$FAILED) { s5 = peg$parseidentifier(); if (s5 !== peg$FAILED) { s6 = peg$parsews(); if (s6 !== peg$FAILED) { peg$savedPos = s2; s3 = peg$c3(s5); s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s3 = peg$parsenode(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c4(s2, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsenode() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { s2 = peg$parseidentifier(); if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s4 = peg$parsebegin_node(); if (s4 !== peg$FAILED) { s5 = peg$parsews(); if (s5 !== peg$FAILED) { s6 = []; s7 = peg$parsenodeDefinition(); if (s7 === peg$FAILED) { s7 = peg$parseroute(); if (s7 === peg$FAILED) { s7 = peg$parseproperty(); if (s7 === peg$FAILED) { s7 = peg$parsenode(); if (s7 === peg$FAILED) { s7 = peg$parsecomment(); } } } } while (s7 !== peg$FAILED) { s6.push(s7); s7 = peg$parsenodeDefinition(); if (s7 === peg$FAILED) { s7 = peg$parseroute(); if (s7 === peg$FAILED) { s7 = peg$parseproperty(); if (s7 === peg$FAILED) { s7 = peg$parsenode(); if (s7 === peg$FAILED) { s7 = peg$parsecomment(); } } } } } if (s6 !== peg$FAILED) { s7 = peg$parsews(); if (s7 !== peg$FAILED) { s8 = peg$parseend_node(); if (s8 !== peg$FAILED) { s9 = peg$parsews(); if (s9 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c5(s2, s6); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseproperty() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { s2 = peg$parseidentifier(); if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s4 = peg$parsevalue(); if (s4 !== peg$FAILED) { s5 = peg$parsews(); if (s5 !== peg$FAILED) { s6 = peg$parsecomment(); if (s6 === peg$FAILED) { s6 = null; } if (s6 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c6(s2, s4, s6); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseidentifier() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = []; if (peg$c8.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); if (peg$c8.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } } } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c10(s1); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c7); } } return s0; } function peg$parsearray() { var s0, s1, s2, s3, s4, s5, s6; peg$silentFails++; s0 = peg$currPos; s1 = peg$parsebegin_array(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parsecomment(); if (s3 === peg$FAILED) { s3 = peg$parseroute(); if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$parsevalue(); if (s4 !== peg$FAILED) { s5 = peg$parsews(); if (s5 !== peg$FAILED) { s6 = peg$parsevalue_separator(); if (s6 === peg$FAILED) { s6 = null; } if (s6 !== peg$FAILED) { peg$savedPos = s3; s4 = peg$c12(s4); s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } } while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parsecomment(); if (s3 === peg$FAILED) { s3 = peg$parseroute(); if (s3 === peg$FAILED) { s3 = peg$currPos; s4 = peg$parsevalue(); if (s4 !== peg$FAILED) { s5 = peg$parsews(); if (s5 !== peg$FAILED) { s6 = peg$parsevalue_separator(); if (s6 === peg$FAILED) { s6 = null; } if (s6 !== peg$FAILED) { peg$savedPos = s3; s4 = peg$c12(s4); s3 = s4; } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } else { peg$currPos = s3; s3 = peg$FAILED; } } } } if (s2 !== peg$FAILED) { s3 = peg$parseend_array(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c13(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c11); } } return s0; } function peg$parsevalue() { var s0, s1; peg$silentFails++; s0 = peg$parsefalse(); if (s0 === peg$FAILED) { s0 = peg$parseface(); if (s0 === peg$FAILED) { s0 = peg$parsenull(); if (s0 === peg$FAILED) { s0 = peg$parsetrue(); if (s0 === peg$FAILED) { s0 = peg$parsenodeDefinition(); if (s0 === peg$FAILED) { s0 = peg$parsenode(); if (s0 === peg$FAILED) { s0 = peg$parserotation(); if (s0 === peg$FAILED) { s0 = peg$parsepoint(); if (s0 === peg$FAILED) { s0 = peg$parsevector(); if (s0 === peg$FAILED) { s0 = peg$parseuse_statement(); if (s0 === peg$FAILED) { s0 = peg$parsearray(); if (s0 === peg$FAILED) { s0 = peg$parsenumber(); if (s0 === peg$FAILED) { s0 = peg$parsefloat(); if (s0 === peg$FAILED) { s0 = peg$parseidentifier(); if (s0 === peg$FAILED) { s0 = peg$parseurl(); if (s0 === peg$FAILED) { s0 = peg$parsequoted_string(); } } } } } } } } } } } } } } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c14); } } return s0; } function peg$parsefalse() { var s0, s1; if (input.substr(peg$currPos, 5) === peg$c15) { s0 = peg$c15; peg$currPos += 5; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.substr(peg$currPos, 5) === peg$c17) { s1 = peg$c17; peg$currPos += 5; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c18); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c19(); } s0 = s1; } return s0; } function peg$parsenull() { var s0, s1; if (input.substr(peg$currPos, 4) === peg$c20) { s0 = peg$c20; peg$currPos += 4; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.substr(peg$currPos, 4) === peg$c22) { s1 = peg$c22; peg$currPos += 4; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c24(); } s0 = s1; } return s0; } function peg$parsetrue() { var s0, s1; if (input.substr(peg$currPos, 4) === peg$c25) { s0 = peg$c25; peg$currPos += 4; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.substr(peg$currPos, 4) === peg$c27) { s1 = peg$c27; peg$currPos += 4; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c28); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c29(); } s0 = s1; } return s0; } function peg$parsenumber() { var s0, s1, s2, s3, s4; peg$silentFails++; s0 = peg$currPos; s1 = peg$parseminus(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parseint(); if (s2 !== peg$FAILED) { s3 = peg$parsefrac(); if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { s4 = peg$parseexp(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c31(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c30); } } return s0; } function peg$parsedecimal_point() { var s0; if (input.charCodeAt(peg$currPos) === 46) { s0 = peg$c32; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c33); } } return s0; } function peg$parsedigit1_9() { var s0; if (peg$c34.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c35); } } return s0; } function peg$parsee() { var s0; if (peg$c36.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c37); } } return s0; } function peg$parseexp() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsee(); if (s1 !== peg$FAILED) { s2 = peg$parseminus(); if (s2 === peg$FAILED) { s2 = peg$parseplus(); } if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = []; s4 = peg$parseDIGIT(); if (s4 !== peg$FAILED) { while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$parseDIGIT(); } } else { s3 = peg$FAILED; } if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsefrac() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsedecimal_point(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseDIGIT(); if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseDIGIT(); } } else { s2 = peg$FAILED; } if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseint() { var s0, s1, s2, s3; s0 = peg$parsezero(); if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsedigit1_9(); if (s1 !== peg$FAILED) { s2 = []; s3 = peg$parseDIGIT(); while (s3 !== peg$FAILED) { s2.push(s3); s3 = peg$parseDIGIT(); } if (s2 !== peg$FAILED) { s1 = [s1, s2]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parseminus() { var s0; if (input.charCodeAt(peg$currPos) === 45) { s0 = peg$c38; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c39); } } return s0; } function peg$parseplus() { var s0; if (input.charCodeAt(peg$currPos) === 43) { s0 = peg$c40; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c41); } } return s0; } function peg$parsezero() { var s0; if (input.charCodeAt(peg$currPos) === 48) { s0 = peg$c42; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c43); } } return s0; } function peg$parsecomment() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 35) { s2 = peg$c44; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s2 !== peg$FAILED) { s3 = []; if (peg$c46.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c47); } } while (s4 !== peg$FAILED) { s3.push(s4); if (peg$c46.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c47); } } } if (s3 !== peg$FAILED) { s4 = peg$parsews(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c48(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseroute() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 5) === peg$c49) { s2 = peg$c49; peg$currPos += 5; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c50); } } if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s4 = peg$parseroute_part(); if (s4 !== peg$FAILED) { s5 = peg$parsews(); if (s5 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c51) { s6 = peg$c51; peg$currPos += 2; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c52); } } if (s6 !== peg$FAILED) { s7 = peg$parsews(); if (s7 !== peg$FAILED) { s8 = peg$parseroute_part(); if (s8 !== peg$FAILED) { s9 = peg$parsews(); if (s9 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c53(s4, s8); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseroute_part() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parseidentifier(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s2 = peg$c32; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c33); } } if (s2 !== peg$FAILED) { s3 = peg$parseidentifier(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c54(s1, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebegin_array() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 91) { s2 = peg$c55; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c56); } } if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsebegin_node() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { s2 = peg$c57; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c58); } } if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseend_array() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { s2 = peg$c59; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c60); } } if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseend_node() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { s2 = peg$c61; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c62); } } if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsevalue_separator() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s2 = peg$c63; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c64); } } if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s1 = [s1, s2, s3]; s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsews() { var s0, s1, s2; peg$silentFails++; s0 = peg$currPos; s1 = []; if (peg$c66.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c67); } } while (s2 !== peg$FAILED) { s1.push(s2); if (peg$c66.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c67); } } } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c68(s1); } s0 = s1; peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c65); } } return s0; } function peg$parsespace() { var s0; if (input.charCodeAt(peg$currPos) === 32) { s0 = peg$c69; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c70); } } return s0; } function peg$parsepoint() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsevector(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { s2 = peg$c63; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c64); } } if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s4 = peg$parsecomment(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c71(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsevector() { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { s2 = peg$parsenumber(); if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s4 = peg$parsenumber(); if (s4 !== peg$FAILED) { s5 = peg$parsews(); if (s5 !== peg$FAILED) { s6 = peg$parsenumber(); if (s6 !== peg$FAILED) { s7 = peg$parsews(); if (s7 !== peg$FAILED) { s8 = peg$parsecomment(); if (s8 === peg$FAILED) { s8 = null; } if (s8 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c72(s2, s4, s6); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsedef() { var s0, s1; s0 = peg$currPos; if (input.substr(peg$currPos, 3) === peg$c73) { s1 = peg$c73; peg$currPos += 3; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c74); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c75(); } s0 = s1; return s0; } function peg$parseuse_statement() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { s2 = peg$parseuse(); if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s4 = peg$parseidentifier(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c76(s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseuse() { var s0, s1; s0 = peg$currPos; if (input.substr(peg$currPos, 3) === peg$c77) { s1 = peg$c77; peg$currPos += 3; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c78); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c75(); } s0 = s1; return s0; } function peg$parseface() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = []; s2 = peg$parseindex(); if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$parseindex(); } } else { s1 = peg$FAILED; } if (s1 !== peg$FAILED) { if (input.substr(peg$currPos, 2) === peg$c79) { s2 = peg$c79; peg$currPos += 2; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c81(s1); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseindex() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { s2 = peg$parseint(); if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s4 = peg$parsevalue_separator(); if (s4 !== peg$FAILED) { s5 = peg$parsews(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c82(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parserotation() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { s2 = peg$parsenumber(); if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s4 = peg$parsenumber(); if (s4 !== peg$FAILED) { s5 = peg$parsews(); if (s5 !== peg$FAILED) { s6 = peg$parsenumber(); if (s6 !== peg$FAILED) { s7 = peg$parsews(); if (s7 !== peg$FAILED) { s8 = peg$parsenumber(); if (s8 !== peg$FAILED) { s9 = peg$parsews(); if (s9 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c83(s2, s4, s6, s8); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseurl() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { s2 = peg$parsebegin_array(); if (s2 !== peg$FAILED) { s3 = peg$parsews(); if (s3 !== peg$FAILED) { s4 = peg$parsequote(); if (s4 !== peg$FAILED) { s5 = peg$parseuri(); if (s5 !== peg$FAILED) { s6 = peg$parsequote(); if (s6 !== peg$FAILED) { s7 = peg$parsews(); if (s7 !== peg$FAILED) { s8 = peg$parseend_array(); if (s8 !== peg$FAILED) { s9 = peg$parsews(); if (s9 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c84(s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseuri() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = []; if (peg$c85.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } while (s2 !== peg$FAILED) { s1.push(s2); if (peg$c85.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { s2 = peg$c32; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c33); } } if (s2 !== peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c87) { s3 = peg$c87; peg$currPos += 3; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c88); } } if (s3 === peg$FAILED) { if (input.substr(peg$currPos, 4) === peg$c89) { s3 = peg$c89; peg$currPos += 4; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c90); } } if (s3 === peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c91) { s3 = peg$c91; peg$currPos += 3; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c92); } } if (s3 === peg$FAILED) { if (input.substr(peg$currPos, 3) === peg$c93) { s3 = peg$c93; peg$currPos += 3; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c94); } } } } } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c95(s1, s2, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsequoted_string() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; s1 = peg$parsews(); if (s1 !== peg$FAILED) { s2 = peg$parsequote(); if (s2 !== peg$FAILED) { s3 = []; if (peg$c85.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } while (s4 !== peg$FAILED) { s3.push(s4); if (peg$c85.test(input.charAt(peg$currPos))) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c86); } } } if (s3 !== peg$FAILED) { s4 = peg$parsequote(); if (s4 !== peg$FAILED) { s5 = peg$parsews(); if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c96(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parsequote() { var s0; if (input.charCodeAt(peg$currPos) === 34) { s0 = peg$c97; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c98); } } return s0; } function peg$parsefloat() { var s0, s1, s2; s0 = peg$currPos; s1 = peg$parseint(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parsefrac(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c31(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseDIGIT() { var s0; if (peg$c99.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c100); } } return s0; } function peg$parseHEXDIG() { var s0; if (peg$c101.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c102); } } return s0; } var nodeDefinitions = []; var routes = []; peg$result = peg$startRuleFunction(); if (peg$result !== peg$FAILED && peg$currPos === input.length) { return peg$result; } else { if (peg$result !== peg$FAILED && peg$currPos < input.length) { peg$fail({ type: "end", description: "end of input" }); } throw peg$buildException( null, peg$maxFailExpected, peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, peg$maxFailPos < input.length ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) ); } } return { SyntaxError: peg$SyntaxError, parse: peg$parse }; })();