From 7093967bce9690781a629a123b9a936aa669b44b Mon Sep 17 00:00:00 2001 From: Felix Lee Date: Sat, 2 Sep 2017 18:03:03 -0700 Subject: [PATCH] faster grammar for #39 --- index.js | 3 +- lib/parser.js | 2789 +++++++++++++++++++++--------------------------- src/toml.pegjs | 131 ++- 3 files changed, 1275 insertions(+), 1648 deletions(-) diff --git a/index.js b/index.js index 6caf44a..d9b8b66 100644 --- a/index.js +++ b/index.js @@ -3,7 +3,8 @@ var compiler = require('./lib/compiler'); module.exports = { parse: function(input) { - var nodes = parser.parse(input.toString()); + var normalized = String(input).replace(/\r\n/g, '\n'); + var nodes = parser.parse(normalized); return compiler.compile(nodes); } }; diff --git a/lib/parser.js b/lib/parser.js index 69cbd6f..9513215 100644 --- a/lib/parser.js +++ b/lib/parser.js @@ -35,126 +35,137 @@ module.exports = (function() { peg$c0 = [], peg$c1 = function() { return nodes }, peg$c2 = peg$FAILED, - peg$c3 = "#", - peg$c4 = { type: "literal", value: "#", description: "\"#\"" }, - peg$c5 = void 0, - peg$c6 = { type: "any", description: "any character" }, - peg$c7 = "[", - peg$c8 = { type: "literal", value: "[", description: "\"[\"" }, - peg$c9 = "]", - peg$c10 = { type: "literal", value: "]", description: "\"]\"" }, - peg$c11 = function(name) { addNode(node('ObjectPath', name, line, column)) }, - peg$c12 = function(name) { addNode(node('ArrayPath', name, line, column)) }, - peg$c13 = function(parts, name) { return parts.concat(name) }, - peg$c14 = function(name) { return [name] }, - peg$c15 = function(name) { return name }, - peg$c16 = ".", - peg$c17 = { type: "literal", value: ".", description: "\".\"" }, - peg$c18 = "=", - peg$c19 = { type: "literal", value: "=", description: "\"=\"" }, - peg$c20 = function(key, value) { addNode(node('Assign', value, line, column, key)) }, - peg$c21 = function(chars) { return chars.join('') }, - peg$c22 = function(node) { return node.value }, - peg$c23 = "\"\"\"", - peg$c24 = { type: "literal", value: "\"\"\"", description: "\"\\\"\\\"\\\"\"" }, - peg$c25 = null, - peg$c26 = function(chars) { return node('String', chars.join(''), line, column) }, - peg$c27 = "\"", - peg$c28 = { type: "literal", value: "\"", description: "\"\\\"\"" }, - peg$c29 = "'''", - peg$c30 = { type: "literal", value: "'''", description: "\"'''\"" }, - peg$c31 = "'", - peg$c32 = { type: "literal", value: "'", description: "\"'\"" }, - peg$c33 = function(char) { return char }, - peg$c34 = function(char) { return char}, - peg$c35 = "\\", - peg$c36 = { type: "literal", value: "\\", description: "\"\\\\\"" }, - peg$c37 = function() { return '' }, - peg$c38 = "e", - peg$c39 = { type: "literal", value: "e", description: "\"e\"" }, - peg$c40 = "E", - peg$c41 = { type: "literal", value: "E", description: "\"E\"" }, - peg$c42 = function(left, right) { return node('Float', parseFloat(left + 'e' + right), line, column) }, - peg$c43 = function(text) { return node('Float', parseFloat(text), line, column) }, - peg$c44 = "+", - peg$c45 = { type: "literal", value: "+", description: "\"+\"" }, - peg$c46 = function(digits) { return digits.join('') }, - peg$c47 = "-", - peg$c48 = { type: "literal", value: "-", description: "\"-\"" }, - peg$c49 = function(digits) { return '-' + digits.join('') }, - peg$c50 = function(text) { return node('Integer', parseInt(text, 10), line, column) }, - peg$c51 = "true", - peg$c52 = { type: "literal", value: "true", description: "\"true\"" }, - peg$c53 = function() { return node('Boolean', true, line, column) }, - peg$c54 = "false", - peg$c55 = { type: "literal", value: "false", description: "\"false\"" }, - peg$c56 = function() { return node('Boolean', false, line, column) }, - peg$c57 = function() { return node('Array', [], line, column) }, - peg$c58 = function(value) { return node('Array', value ? [value] : [], line, column) }, - peg$c59 = function(values) { return node('Array', values, line, column) }, - peg$c60 = function(values, value) { return node('Array', values.concat(value), line, column) }, - peg$c61 = function(value) { return value }, - peg$c62 = ",", - peg$c63 = { type: "literal", value: ",", description: "\",\"" }, - peg$c64 = "{", - peg$c65 = { type: "literal", value: "{", description: "\"{\"" }, - peg$c66 = "}", - peg$c67 = { type: "literal", value: "}", description: "\"}\"" }, - peg$c68 = function(values) { return node('InlineTable', values, line, column) }, - peg$c69 = function(key, value) { return node('InlineTableValue', value, line, column, key) }, - peg$c70 = function(digits) { return "." + digits }, - peg$c71 = function(date) { return date.join('') }, - peg$c72 = ":", - peg$c73 = { type: "literal", value: ":", description: "\":\"" }, - peg$c74 = function(time) { return time.join('') }, - peg$c75 = "T", - peg$c76 = { type: "literal", value: "T", description: "\"T\"" }, - peg$c77 = "Z", - peg$c78 = { type: "literal", value: "Z", description: "\"Z\"" }, - peg$c79 = function(date, time) { return node('Date', new Date(date + "T" + time + "Z"), line, column) }, - peg$c80 = function(date, time) { return node('Date', new Date(date + "T" + time), line, column) }, - peg$c81 = /^[ \t]/, - peg$c82 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, - peg$c83 = "\n", - peg$c84 = { type: "literal", value: "\n", description: "\"\\n\"" }, - peg$c85 = "\r", - peg$c86 = { type: "literal", value: "\r", description: "\"\\r\"" }, - peg$c87 = /^[0-9a-f]/i, - peg$c88 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, - peg$c89 = /^[0-9]/, - peg$c90 = { type: "class", value: "[0-9]", description: "[0-9]" }, - peg$c91 = "_", - peg$c92 = { type: "literal", value: "_", description: "\"_\"" }, - peg$c93 = function() { return "" }, - peg$c94 = /^[A-Za-z0-9_\-]/, - peg$c95 = { type: "class", value: "[A-Za-z0-9_\\-]", description: "[A-Za-z0-9_\\-]" }, - peg$c96 = function(d) { return d.join('') }, - peg$c97 = "\\\"", - peg$c98 = { type: "literal", value: "\\\"", description: "\"\\\\\\\"\"" }, - peg$c99 = function() { return '"' }, - peg$c100 = "\\\\", - peg$c101 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" }, - peg$c102 = function() { return '\\' }, - peg$c103 = "\\b", - peg$c104 = { type: "literal", value: "\\b", description: "\"\\\\b\"" }, - peg$c105 = function() { return '\b' }, - peg$c106 = "\\t", - peg$c107 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, - peg$c108 = function() { return '\t' }, - peg$c109 = "\\n", - peg$c110 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, - peg$c111 = function() { return '\n' }, - peg$c112 = "\\f", - peg$c113 = { type: "literal", value: "\\f", description: "\"\\\\f\"" }, - peg$c114 = function() { return '\f' }, - peg$c115 = "\\r", - peg$c116 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, - peg$c117 = function() { return '\r' }, - peg$c118 = "\\U", - peg$c119 = { type: "literal", value: "\\U", description: "\"\\\\U\"" }, - peg$c120 = function(digits) { return convertCodePoint(digits.join('')) }, - peg$c121 = "\\u", - peg$c122 = { type: "literal", value: "\\u", description: "\"\\\\u\"" }, + peg$c3 = null, + peg$c4 = "\n", + peg$c5 = { type: "literal", value: "\n", description: "\"\\n\"" }, + peg$c6 = "#", + peg$c7 = { type: "literal", value: "#", description: "\"#\"" }, + peg$c8 = /^[^\n]/, + peg$c9 = { type: "class", value: "[^\\n]", description: "[^\\n]" }, + peg$c10 = "[", + peg$c11 = { type: "literal", value: "[", description: "\"[\"" }, + peg$c12 = "]", + peg$c13 = { type: "literal", value: "]", description: "\"]\"" }, + peg$c14 = function(name) { addNode(node('ObjectPath', name, line, column)) }, + peg$c15 = "[[", + peg$c16 = { type: "literal", value: "[[", description: "\"[[\"" }, + peg$c17 = "]]", + peg$c18 = { type: "literal", value: "]]", description: "\"]]\"" }, + peg$c19 = function(name) { addNode(node('ArrayPath', name, line, column)) }, + peg$c20 = ".", + peg$c21 = { type: "literal", value: ".", description: "\".\"" }, + peg$c22 = function(part) { return part }, + peg$c23 = function(first, rest) { return [first].concat(rest) }, + peg$c24 = "=", + peg$c25 = { type: "literal", value: "=", description: "\"=\"" }, + peg$c26 = function(key, value) { addNode(node('Assign', value, line, column, key)) }, + peg$c27 = function(chars) { return node('String', chars, line, column) }, + peg$c28 = "\"\"\"", + peg$c29 = { type: "literal", value: "\"\"\"", description: "\"\\\"\\\"\\\"\"" }, + peg$c30 = function(chars) { return chars.join('') }, + peg$c31 = "\"", + peg$c32 = { type: "literal", value: "\"", description: "\"\\\"\"" }, + peg$c33 = /^[^"\\]/, + peg$c34 = { type: "class", value: "[^\"\\\\]", description: "[^\"\\\\]" }, + peg$c35 = "'''", + peg$c36 = { type: "literal", value: "'''", description: "\"'''\"" }, + peg$c37 = "'", + peg$c38 = { type: "literal", value: "'", description: "\"'\"" }, + peg$c39 = /^[^']/, + peg$c40 = { type: "class", value: "[^']", description: "[^']" }, + peg$c41 = void 0, + peg$c42 = { type: "any", description: "any character" }, + peg$c43 = function(c) { return c }, + peg$c44 = "\\\n", + peg$c45 = { type: "literal", value: "\\\n", description: "\"\\\\\\n\"" }, + peg$c46 = /^[ \t\n]/, + peg$c47 = { type: "class", value: "[ \\t\\n]", description: "[ \\t\\n]" }, + peg$c48 = function() { return '' }, + peg$c49 = "e", + peg$c50 = { type: "literal", value: "e", description: "\"e\"" }, + peg$c51 = "E", + peg$c52 = { type: "literal", value: "E", description: "\"E\"" }, + peg$c53 = function(left, right) { return node('Float', parseFloat(left + 'e' + right), line, column) }, + peg$c54 = function(text) { return node('Float', parseFloat(text), line, column) }, + peg$c55 = "+", + peg$c56 = { type: "literal", value: "+", description: "\"+\"" }, + peg$c57 = function(digits) { return digits.join('') }, + peg$c58 = "-", + peg$c59 = { type: "literal", value: "-", description: "\"-\"" }, + peg$c60 = function(digits) { return '-' + digits.join('') }, + peg$c61 = function(text) { return node('Integer', parseInt(text, 10), line, column) }, + peg$c62 = function(digits) { return digits }, + peg$c63 = function(digits) { return '-' + digits }, + peg$c64 = "true", + peg$c65 = { type: "literal", value: "true", description: "\"true\"" }, + peg$c66 = function() { return node('Boolean', true, line, column) }, + peg$c67 = "false", + peg$c68 = { type: "literal", value: "false", description: "\"false\"" }, + peg$c69 = function() { return node('Boolean', false, line, column) }, + peg$c70 = function() { return node('Array', [], line, column) }, + peg$c71 = function(value) { return node('Array', value ? [value] : [], line, column) }, + peg$c72 = function(values) { return node('Array', values, line, column) }, + peg$c73 = function(values, value) { return node('Array', values.concat(value), line, column) }, + peg$c74 = function(value) { return value }, + peg$c75 = ",", + peg$c76 = { type: "literal", value: ",", description: "\",\"" }, + peg$c77 = "{", + peg$c78 = { type: "literal", value: "{", description: "\"{\"" }, + peg$c79 = "}", + peg$c80 = { type: "literal", value: "}", description: "\"}\"" }, + peg$c81 = function(values) { return node('InlineTable', values, line, column) }, + peg$c82 = function(key, value) { return node('InlineTableValue', value, line, column, key) }, + peg$c83 = function(digits) { return "." + digits }, + peg$c84 = function(date) { return date.join('') }, + peg$c85 = ":", + peg$c86 = { type: "literal", value: ":", description: "\":\"" }, + peg$c87 = function(time) { return time.join('') }, + peg$c88 = "T", + peg$c89 = { type: "literal", value: "T", description: "\"T\"" }, + peg$c90 = "Z", + peg$c91 = { type: "literal", value: "Z", description: "\"Z\"" }, + peg$c92 = function(date, time) { return node('Date', new Date(date + "T" + time + "Z"), line, column) }, + peg$c93 = function(date, time) { return node('Date', new Date(date + "T" + time), line, column) }, + peg$c94 = /^[ \t]/, + peg$c95 = { type: "class", value: "[ \\t]", description: "[ \\t]" }, + peg$c96 = /^[0-9a-f]/i, + peg$c97 = { type: "class", value: "[0-9a-f]i", description: "[0-9a-f]i" }, + peg$c98 = /^[0-9]/, + peg$c99 = { type: "class", value: "[0-9]", description: "[0-9]" }, + peg$c100 = /^[A-Za-z0-9_\-]/, + peg$c101 = { type: "class", value: "[A-Za-z0-9_\\-]", description: "[A-Za-z0-9_\\-]" }, + peg$c102 = function() { return text() }, + peg$c103 = /^[0-9_]/, + peg$c104 = { type: "class", value: "[0-9_]", description: "[0-9_]" }, + peg$c105 = function() { return text().replace(/_/g, '') }, + peg$c106 = "\\\"", + peg$c107 = { type: "literal", value: "\\\"", description: "\"\\\\\\\"\"" }, + peg$c108 = function() { return '"' }, + peg$c109 = "\\\\", + peg$c110 = { type: "literal", value: "\\\\", description: "\"\\\\\\\\\"" }, + peg$c111 = function() { return '\\' }, + peg$c112 = "\\b", + peg$c113 = { type: "literal", value: "\\b", description: "\"\\\\b\"" }, + peg$c114 = function() { return '\b' }, + peg$c115 = "\\t", + peg$c116 = { type: "literal", value: "\\t", description: "\"\\\\t\"" }, + peg$c117 = function() { return '\t' }, + peg$c118 = "\\n", + peg$c119 = { type: "literal", value: "\\n", description: "\"\\\\n\"" }, + peg$c120 = function() { return '\n' }, + peg$c121 = "\\f", + peg$c122 = { type: "literal", value: "\\f", description: "\"\\\\f\"" }, + peg$c123 = function() { return '\f' }, + peg$c124 = "\\r", + peg$c125 = { type: "literal", value: "\\r", description: "\"\\\\r\"" }, + peg$c126 = function() { return '\r' }, + peg$c127 = "\\U", + peg$c128 = { type: "literal", value: "\\U", description: "\"\\\\U\"" }, + peg$c129 = function(digits) { return convertCodePoint(digits.join('')) }, + peg$c130 = "\\u", + peg$c131 = { type: "literal", value: "\\u", description: "\"\\\\u\"" }, + peg$c132 = "\\", + peg$c133 = { type: "literal", value: "\\", description: "\"\\\\\"" }, peg$currPos = 0, peg$reportedPos = 0, @@ -326,7 +337,7 @@ module.exports = (function() { function peg$parsestart() { var s0, s1, s2; - var key = peg$currPos * 49 + 0, + var key = peg$currPos * 41 + 0, cached = peg$cache[key]; if (cached) { @@ -355,7 +366,7 @@ module.exports = (function() { function peg$parseline() { var s0, s1, s2, s3, s4, s5, s6; - var key = peg$currPos * 49 + 1, + var key = peg$currPos * 41 + 1, cached = peg$cache[key]; if (cached) { @@ -364,132 +375,92 @@ module.exports = (function() { } s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } + s1 = peg$parseWS(); if (s1 !== peg$FAILED) { - s2 = peg$parseexpression(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - s4 = []; + s2 = peg$currPos; + s3 = peg$parseexpression(); + if (s3 !== peg$FAILED) { + s4 = peg$parseWS(); + if (s4 !== peg$FAILED) { s5 = peg$parsecomment(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parsecomment(); + if (s5 === peg$FAILED) { + s5 = peg$c3; } - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseNL(); - if (s6 !== peg$FAILED) { - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseNL(); - } + if (s5 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 10) { + s6 = peg$c4; + peg$currPos++; } else { - s5 = peg$c2; + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } } - if (s5 === peg$FAILED) { - s5 = peg$parseEOF(); + if (s6 === peg$FAILED) { + s6 = peg$c3; } - if (s5 !== peg$FAILED) { - s1 = [s1, s2, s3, s4, s5]; - s0 = s1; + if (s6 !== peg$FAILED) { + s3 = [s3, s4, s5, s6]; + s2 = s3; } else { - peg$currPos = s0; - s0 = peg$c2; + peg$currPos = s2; + s2 = peg$c2; } } else { - peg$currPos = s0; - s0 = peg$c2; + peg$currPos = s2; + s2 = peg$c2; } } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); + peg$currPos = s2; + s2 = peg$c2; } } else { - s1 = peg$c2; + peg$currPos = s2; + s2 = peg$c2; } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseNL(); + if (s2 === peg$FAILED) { + s2 = peg$currPos; + s3 = peg$parsecomment(); if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseNL(); + if (input.charCodeAt(peg$currPos) === 10) { + s4 = peg$c4; + peg$currPos++; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s4 === peg$FAILED) { + s4 = peg$c3; + } + if (s4 !== peg$FAILED) { + s3 = [s3, s4]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c2; } } else { + peg$currPos = s2; s2 = peg$c2; } if (s2 === peg$FAILED) { - s2 = peg$parseEOF(); - } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; + if (input.charCodeAt(peg$currPos) === 10) { + s2 = peg$c4; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } } + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; } else { peg$currPos = s0; s0 = peg$c2; } - if (s0 === peg$FAILED) { - s0 = peg$parseNL(); - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseexpression() { - var s0; - - var key = peg$currPos * 49 + 2, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parsecomment(); - if (s0 === peg$FAILED) { - s0 = peg$parsepath(); - if (s0 === peg$FAILED) { - s0 = peg$parsetablearray(); - if (s0 === peg$FAILED) { - s0 = peg$parseassignment(); - } - } + } else { + peg$currPos = s0; + s0 = peg$c2; } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -498,9 +469,9 @@ module.exports = (function() { } function peg$parsecomment() { - var s0, s1, s2, s3, s4, s5; + var s0, s1, s2, s3; - var key = peg$currPos * 49 + 3, + var key = peg$currPos * 41 + 2, cached = peg$cache[key]; if (cached) { @@ -510,81 +481,29 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { - s1 = peg$c3; + s1 = peg$c6; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c4); } + if (peg$silentFails === 0) { peg$fail(peg$c7); } } if (s1 !== peg$FAILED) { s2 = []; - s3 = peg$currPos; - s4 = peg$currPos; - peg$silentFails++; - s5 = peg$parseNL(); - if (s5 === peg$FAILED) { - s5 = peg$parseEOF(); - } - peg$silentFails--; - if (s5 === peg$FAILED) { - s4 = peg$c5; - } else { - peg$currPos = s4; - s4 = peg$c2; - } - if (s4 !== peg$FAILED) { - if (input.length > peg$currPos) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s5 !== peg$FAILED) { - s4 = [s4, s5]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$c2; - } + if (peg$c8.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - peg$currPos = s3; - s3 = peg$c2; + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c9); } } while (s3 !== peg$FAILED) { s2.push(s3); - s3 = peg$currPos; - s4 = peg$currPos; - peg$silentFails++; - s5 = peg$parseNL(); - if (s5 === peg$FAILED) { - s5 = peg$parseEOF(); - } - peg$silentFails--; - if (s5 === peg$FAILED) { - s4 = peg$c5; - } else { - peg$currPos = s4; - s4 = peg$c2; - } - if (s4 !== peg$FAILED) { - if (input.length > peg$currPos) { - s5 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s5 !== peg$FAILED) { - s4 = [s4, s5]; - s3 = s4; - } else { - peg$currPos = s3; - s3 = peg$c2; - } + if (peg$c8.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - peg$currPos = s3; - s3 = peg$c2; + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c9); } } } if (s2 !== peg$FAILED) { @@ -604,10 +523,10 @@ module.exports = (function() { return s0; } - function peg$parsepath() { - var s0, s1, s2, s3, s4, s5; + function peg$parseexpression() { + var s0; - var key = peg$currPos * 49 + 4, + var key = peg$currPos * 41 + 3, cached = peg$cache[key]; if (cached) { @@ -615,61 +534,12 @@ module.exports = (function() { return cached.result; } - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseS(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseS(); - } - if (s2 !== peg$FAILED) { - s3 = peg$parsetable_key(); - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseS(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseS(); - } - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s5 = peg$c9; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c11(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; + s0 = peg$parsepath(); + if (s0 === peg$FAILED) { + s0 = peg$parsetablearray(); + if (s0 === peg$FAILED) { + s0 = peg$parseassignment(); } - } else { - peg$currPos = s0; - s0 = peg$c2; } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -677,10 +547,10 @@ module.exports = (function() { return s0; } - function peg$parsetablearray() { - var s0, s1, s2, s3, s4, s5, s6, s7; + function peg$parsepath() { + var s0, s1, s2, s3; - var key = peg$currPos * 49 + 5, + var key = peg$currPos * 41 + 4, cached = peg$cache[key]; if (cached) { @@ -690,72 +560,26 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; + s1 = peg$c10; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 91) { - s2 = peg$c7; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } - } + s2 = peg$parsetable_key(); if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); + if (input.charCodeAt(peg$currPos) === 93) { + s3 = peg$c12; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s3 !== peg$FAILED) { - s4 = peg$parsetable_key(); - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s6 = peg$c9; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s6 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s7 = peg$c9; - peg$currPos++; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } - } - if (s7 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c12(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } + peg$reportedPos = s0; + s1 = peg$c14(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$c2; @@ -774,10 +598,10 @@ module.exports = (function() { return s0; } - function peg$parsetable_key() { - var s0, s1, s2; + function peg$parsetablearray() { + var s0, s1, s2, s3; - var key = peg$currPos * 49 + 6, + var key = peg$currPos * 41 + 5, cached = peg$cache[key]; if (cached) { @@ -786,113 +610,27 @@ module.exports = (function() { } s0 = peg$currPos; - s1 = []; - s2 = peg$parsedot_ended_table_key_part(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parsedot_ended_table_key_part(); - } - } else { - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - s2 = peg$parsetable_key_part(); - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c13(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } + if (input.substr(peg$currPos, 2) === peg$c15) { + s1 = peg$c15; + peg$currPos += 2; } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parsetable_key_part(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c14(s1); - } - s0 = s1; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsetable_key_part() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 7, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c16); } } if (s1 !== peg$FAILED) { - s2 = peg$parsekey(); + s2 = peg$parsetable_key(); if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); + if (input.substr(peg$currPos, 2) === peg$c17) { + s3 = peg$c17; + peg$currPos += 2; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c18); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c15(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsequoted_key(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c15(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } + s1 = peg$c19(s2); + s0 = s1; } else { peg$currPos = s0; s0 = peg$c2; @@ -901,6 +639,9 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$c2; } + } else { + peg$currPos = s0; + s0 = peg$c2; } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -908,10 +649,10 @@ module.exports = (function() { return s0; } - function peg$parsedot_ended_table_key_part() { - var s0, s1, s2, s3, s4, s5, s6; + function peg$parsetable_key() { + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; - var key = peg$currPos * 49 + 8, + var key = peg$currPos * 41 + 6, cached = peg$cache[key]; if (cached) { @@ -920,104 +661,88 @@ module.exports = (function() { } s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } + s1 = peg$parseWS(); if (s1 !== peg$FAILED) { - s2 = peg$parsekey(); + s2 = peg$parsetable_key_part(); if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } + s3 = peg$parseWS(); if (s3 !== peg$FAILED) { + s4 = []; + s5 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; + s6 = peg$c20; peg$currPos++; } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c21); } } - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c15(s2); - s0 = s1; + if (s6 !== peg$FAILED) { + s7 = peg$parseWS(); + if (s7 !== peg$FAILED) { + s8 = peg$parsetable_key_part(); + if (s8 !== peg$FAILED) { + s9 = peg$parseWS(); + if (s9 !== peg$FAILED) { + peg$reportedPos = s5; + s6 = peg$c22(s8); + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$c2; + } + } else { + peg$currPos = s5; + s5 = peg$c2; + } } else { - peg$currPos = s0; - s0 = peg$c2; + peg$currPos = s5; + s5 = peg$c2; } } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } - if (s1 !== peg$FAILED) { - s2 = peg$parsequoted_key(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); + peg$currPos = s5; + s5 = peg$c2; } - if (s3 !== peg$FAILED) { + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; + s6 = peg$c20; peg$currPos++; } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c21); } } - if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } - if (s5 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c15(s2); - s0 = s1; + if (s6 !== peg$FAILED) { + s7 = peg$parseWS(); + if (s7 !== peg$FAILED) { + s8 = peg$parsetable_key_part(); + if (s8 !== peg$FAILED) { + s9 = peg$parseWS(); + if (s9 !== peg$FAILED) { + peg$reportedPos = s5; + s6 = peg$c22(s8); + s5 = s6; + } else { + peg$currPos = s5; + s5 = peg$c2; + } + } else { + peg$currPos = s5; + s5 = peg$c2; + } } else { - peg$currPos = s0; - s0 = peg$c2; + peg$currPos = s5; + s5 = peg$c2; } } else { - peg$currPos = s0; - s0 = peg$c2; + peg$currPos = s5; + s5 = peg$c2; } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c23(s2, s4); + s0 = s1; } else { peg$currPos = s0; s0 = peg$c2; @@ -1030,6 +755,30 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$c2; } + } else { + peg$currPos = s0; + s0 = peg$c2; + } + + peg$cache[key] = { nextPos: peg$currPos, result: s0 }; + + return s0; + } + + function peg$parsetable_key_part() { + var s0; + + var key = peg$currPos * 41 + 7, + cached = peg$cache[key]; + + if (cached) { + peg$currPos = cached.nextPos; + return cached.result; + } + + s0 = peg$parseASCII_BASIC(); + if (s0 === peg$FAILED) { + s0 = peg$parsequoted_key(); } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1040,7 +789,7 @@ module.exports = (function() { function peg$parseassignment() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 49 + 9, + var key = peg$currPos * 41 + 8, cached = peg$cache[key]; if (cached) { @@ -1049,34 +798,24 @@ module.exports = (function() { } s0 = peg$currPos; - s1 = peg$parsekey(); + s1 = peg$parseASCII_BASIC(); if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseS(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseS(); - } + s2 = peg$parseWS(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { - s3 = peg$c18; + s3 = peg$c24; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseS(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseS(); - } + s4 = peg$parseWS(); if (s4 !== peg$FAILED) { s5 = peg$parsevalue(); if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c20(s1, s5); + s1 = peg$c26(s1, s5); s0 = s1; } else { peg$currPos = s0; @@ -1102,32 +841,22 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$parsequoted_key(); if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseS(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseS(); - } + s2 = peg$parseWS(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { - s3 = peg$c18; + s3 = peg$c24; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseS(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseS(); - } + s4 = peg$parseWS(); if (s4 !== peg$FAILED) { s5 = peg$parsevalue(); if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c20(s1, s5); + s1 = peg$c26(s1, s5); s0 = s1; } else { peg$currPos = s0; @@ -1156,43 +885,10 @@ module.exports = (function() { return s0; } - function peg$parsekey() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 10, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - s1 = []; - s2 = peg$parseASCII_BASIC(); - if (s2 !== peg$FAILED) { - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseASCII_BASIC(); - } - } else { - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c21(s1); - } - s0 = s1; - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - function peg$parsequoted_key() { - var s0, s1; + var s0; - var key = peg$currPos * 49 + 11, + var key = peg$currPos * 41 + 9, cached = peg$cache[key]; if (cached) { @@ -1200,21 +896,9 @@ module.exports = (function() { return cached.result; } - s0 = peg$currPos; - s1 = peg$parsedouble_quoted_single_line_string(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c22(s1); - } - s0 = s1; + s0 = peg$parsedouble_quoted_single_line_string(); if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parsesingle_quoted_single_line_string(); - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c22(s1); - } - s0 = s1; + s0 = peg$parsesingle_quoted_single_line_string(); } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1225,7 +909,7 @@ module.exports = (function() { function peg$parsevalue() { var s0; - var key = peg$currPos * 49 + 12, + var key = peg$currPos * 41 + 10, cached = peg$cache[key]; if (cached) { @@ -1259,101 +943,9 @@ module.exports = (function() { } function peg$parsestring() { - var s0; - - var key = peg$currPos * 49 + 13, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parsedouble_quoted_multiline_string(); - if (s0 === peg$FAILED) { - s0 = peg$parsedouble_quoted_single_line_string(); - if (s0 === peg$FAILED) { - s0 = peg$parsesingle_quoted_multiline_string(); - if (s0 === peg$FAILED) { - s0 = peg$parsesingle_quoted_single_line_string(); - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsedouble_quoted_multiline_string() { - var s0, s1, s2, s3, s4; - - var key = peg$currPos * 49 + 14, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c23) { - s1 = peg$c23; - peg$currPos += 3; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parseNL(); - if (s2 === peg$FAILED) { - s2 = peg$c25; - } - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parsemultiline_string_char(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parsemultiline_string_char(); - } - if (s3 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c23) { - s4 = peg$c23; - peg$currPos += 3; - } else { - s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c26(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parsedouble_quoted_single_line_string() { - var s0, s1, s2, s3; + var s0, s1; - var key = peg$currPos * 49 + 15, + var key = peg$currPos * 41 + 11, cached = peg$cache[key]; if (cached) { @@ -1362,54 +954,31 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c27; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } - } - if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parsestring_char(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parsestring_char(); - } - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c27; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c26(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; + s1 = peg$parsedouble_quoted_multiline_string(); + if (s1 === peg$FAILED) { + s1 = peg$parsedouble_quoted_single_line_string(); + if (s1 === peg$FAILED) { + s1 = peg$parsesingle_quoted_multiline_string(); + if (s1 === peg$FAILED) { + s1 = peg$parsesingle_quoted_single_line_string(); } - } else { - peg$currPos = s0; - s0 = peg$c2; } - } else { - peg$currPos = s0; - s0 = peg$c2; } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c27(s1); + } + s0 = s1; peg$cache[key] = { nextPos: peg$currPos, result: s0 }; return s0; } - function peg$parsesingle_quoted_multiline_string() { + function peg$parsedouble_quoted_multiline_string() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 49 + 16, + var key = peg$currPos * 41 + 12, cached = peg$cache[key]; if (cached) { @@ -1418,36 +987,37 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c29) { - s1 = peg$c29; + if (input.substr(peg$currPos, 3) === peg$c28) { + s1 = peg$c28; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s1 !== peg$FAILED) { - s2 = peg$parseNL(); + if (input.charCodeAt(peg$currPos) === 10) { + s2 = peg$c4; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } if (s2 === peg$FAILED) { - s2 = peg$c25; + s2 = peg$c3; } if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parsemultiline_literal_char(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parsemultiline_literal_char(); - } + s3 = peg$parsemultiline_string_chars(); if (s3 !== peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c29) { - s4 = peg$c29; + if (input.substr(peg$currPos, 3) === peg$c28) { + s4 = peg$c28; peg$currPos += 3; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } + if (peg$silentFails === 0) { peg$fail(peg$c29); } } if (s4 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c26(s3); + s1 = peg$c30(s3); s0 = s1; } else { peg$currPos = s0; @@ -1471,10 +1041,10 @@ module.exports = (function() { return s0; } - function peg$parsesingle_quoted_single_line_string() { + function peg$parsedouble_quoted_single_line_string() { var s0, s1, s2, s3; - var key = peg$currPos * 49 + 17, + var key = peg$currPos * 41 + 13, cached = peg$cache[key]; if (cached) { @@ -1483,7 +1053,7 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 39) { + if (input.charCodeAt(peg$currPos) === 34) { s1 = peg$c31; peg$currPos++; } else { @@ -1492,13 +1062,31 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { s2 = []; - s3 = peg$parseliteral_char(); + if (peg$c33.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c34); } + } + if (s3 === peg$FAILED) { + s3 = peg$parseESCAPED(); + } while (s3 !== peg$FAILED) { s2.push(s3); - s3 = peg$parseliteral_char(); + if (peg$c33.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c34); } + } + if (s3 === peg$FAILED) { + s3 = peg$parseESCAPED(); + } } if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 39) { + if (input.charCodeAt(peg$currPos) === 34) { s3 = peg$c31; peg$currPos++; } else { @@ -1507,7 +1095,7 @@ module.exports = (function() { } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c26(s2); + s1 = peg$c30(s2); s0 = s1; } else { peg$currPos = s0; @@ -1527,10 +1115,10 @@ module.exports = (function() { return s0; } - function peg$parsestring_char() { - var s0, s1, s2; + function peg$parsesingle_quoted_multiline_string() { + var s0, s1, s2, s3, s4; - var key = peg$currPos * 49 + 18, + var key = peg$currPos * 41 + 14, cached = peg$cache[key]; if (cached) { @@ -1538,37 +1126,43 @@ module.exports = (function() { return cached.result; } - s0 = peg$parseESCAPED(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - if (input.charCodeAt(peg$currPos) === 34) { - s2 = peg$c27; + s0 = peg$currPos; + if (input.substr(peg$currPos, 3) === peg$c35) { + s1 = peg$c35; + peg$currPos += 3; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c36); } + } + if (s1 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 10) { + s2 = peg$c4; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } + if (peg$silentFails === 0) { peg$fail(peg$c5); } } - peg$silentFails--; if (s2 === peg$FAILED) { - s1 = peg$c5; - } else { - peg$currPos = s1; - s1 = peg$c2; + s2 = peg$c3; } - if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c33(s2); - s0 = s1; + if (s2 !== peg$FAILED) { + s3 = peg$parsemultiline_literal_chars(); + if (s3 !== peg$FAILED) { + if (input.substr(peg$currPos, 3) === peg$c35) { + s4 = peg$c35; + peg$currPos += 3; + } else { + s4 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c36); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c30(s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c2; + } } else { peg$currPos = s0; s0 = peg$c2; @@ -1577,6 +1171,9 @@ module.exports = (function() { peg$currPos = s0; s0 = peg$c2; } + } else { + peg$currPos = s0; + s0 = peg$c2; } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1584,10 +1181,10 @@ module.exports = (function() { return s0; } - function peg$parseliteral_char() { - var s0, s1, s2; + function peg$parsesingle_quoted_single_line_string() { + var s0, s1, s2, s3; - var key = peg$currPos * 49 + 19, + var key = peg$currPos * 41 + 15, cached = peg$cache[key]; if (cached) { @@ -1596,34 +1193,48 @@ module.exports = (function() { } s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; if (input.charCodeAt(peg$currPos) === 39) { - s2 = peg$c31; + s1 = peg$c37; peg$currPos++; } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } - } - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c5; - } else { - peg$currPos = s1; - s1 = peg$c2; + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c38); } } if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); + s2 = []; + if (peg$c39.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); peg$currPos++; } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c40); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c39.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c40); } + } } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c33(s2); - s0 = s1; + if (input.charCodeAt(peg$currPos) === 39) { + s3 = peg$c37; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c38); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c30(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c2; + } } else { peg$currPos = s0; s0 = peg$c2; @@ -1638,10 +1249,10 @@ module.exports = (function() { return s0; } - function peg$parsemultiline_string_char() { - var s0, s1, s2; + function peg$parsemultiline_string_chars() { + var s0, s1, s2, s3; - var key = peg$currPos * 49 + 20, + var key = peg$currPos * 41 + 16, cached = peg$cache[key]; if (cached) { @@ -1649,46 +1260,111 @@ module.exports = (function() { return cached.result; } - s0 = peg$parseESCAPED(); - if (s0 === peg$FAILED) { - s0 = peg$parsemultiline_string_delim(); - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - if (input.substr(peg$currPos, 3) === peg$c23) { - s2 = peg$c23; - peg$currPos += 3; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c24); } - } - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c5; - } else { - peg$currPos = s1; - s1 = peg$c2; - } - if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); - peg$currPos++; + s0 = []; + if (peg$c33.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c34); } + } + if (s1 === peg$FAILED) { + s1 = peg$parsemultiline_string_delim(); + if (s1 === peg$FAILED) { + s1 = peg$parseESCAPED(); + if (s1 === peg$FAILED) { + s1 = peg$currPos; + s2 = peg$currPos; + peg$silentFails++; + if (input.substr(peg$currPos, 3) === peg$c28) { + s3 = peg$c28; + peg$currPos += 3; } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c29); } + } + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = peg$c41; + } else { + peg$currPos = s2; + s2 = peg$c2; } if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c34(s2); - s0 = s1; + if (input.length > peg$currPos) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c42); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s1; + s2 = peg$c43(s3); + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c2; + } } else { - peg$currPos = s0; - s0 = peg$c2; + peg$currPos = s1; + s1 = peg$c2; + } + } + } + } + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c33.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c34); } + } + if (s1 === peg$FAILED) { + s1 = peg$parsemultiline_string_delim(); + if (s1 === peg$FAILED) { + s1 = peg$parseESCAPED(); + if (s1 === peg$FAILED) { + s1 = peg$currPos; + s2 = peg$currPos; + peg$silentFails++; + if (input.substr(peg$currPos, 3) === peg$c28) { + s3 = peg$c28; + peg$currPos += 3; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c29); } + } + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = peg$c41; + } else { + peg$currPos = s2; + s2 = peg$c2; + } + if (s2 !== peg$FAILED) { + if (input.length > peg$currPos) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c42); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s1; + s2 = peg$c43(s3); + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c2; + } + } else { + peg$currPos = s1; + s1 = peg$c2; + } } - } else { - peg$currPos = s0; - s0 = peg$c2; } } } @@ -1699,9 +1375,9 @@ module.exports = (function() { } function peg$parsemultiline_string_delim() { - var s0, s1, s2, s3, s4; + var s0, s1, s2, s3; - var key = peg$currPos * 49 + 21, + var key = peg$currPos * 41 + 17, cached = peg$cache[key]; if (cached) { @@ -1710,30 +1386,36 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 92) { - s1 = peg$c35; - peg$currPos++; + if (input.substr(peg$currPos, 2) === peg$c44) { + s1 = peg$c44; + peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c36); } + if (peg$silentFails === 0) { peg$fail(peg$c45); } } if (s1 !== peg$FAILED) { - s2 = peg$parseNL(); - if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseNLS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseNLS(); - } - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c37(); - s0 = s1; + s2 = []; + if (peg$c46.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } + } + while (s3 !== peg$FAILED) { + s2.push(s3); + if (peg$c46.test(input.charAt(peg$currPos))) { + s3 = input.charAt(peg$currPos); + peg$currPos++; } else { - peg$currPos = s0; - s0 = peg$c2; + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c47); } } + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c48(); + s0 = s1; } else { peg$currPos = s0; s0 = peg$c2; @@ -1748,10 +1430,10 @@ module.exports = (function() { return s0; } - function peg$parsemultiline_literal_char() { - var s0, s1, s2; + function peg$parsemultiline_literal_chars() { + var s0, s1, s2, s3; - var key = peg$currPos * 49 + 22, + var key = peg$currPos * 41 + 18, cached = peg$cache[key]; if (cached) { @@ -1759,42 +1441,101 @@ module.exports = (function() { return cached.result; } - s0 = peg$currPos; - s1 = peg$currPos; - peg$silentFails++; - if (input.substr(peg$currPos, 3) === peg$c29) { - s2 = peg$c29; - peg$currPos += 3; + s0 = []; + if (peg$c39.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c30); } + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c40); } } - peg$silentFails--; - if (s2 === peg$FAILED) { - s1 = peg$c5; - } else { - peg$currPos = s1; - s1 = peg$c2; + if (s1 === peg$FAILED) { + s1 = peg$currPos; + s2 = peg$currPos; + peg$silentFails++; + if (input.substr(peg$currPos, 3) === peg$c35) { + s3 = peg$c35; + peg$currPos += 3; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c36); } + } + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = peg$c41; + } else { + peg$currPos = s2; + s2 = peg$c2; + } + if (s2 !== peg$FAILED) { + if (input.length > peg$currPos) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c42); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s1; + s2 = peg$c43(s3); + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c2; + } + } else { + peg$currPos = s1; + s1 = peg$c2; + } } - if (s1 !== peg$FAILED) { - if (input.length > peg$currPos) { - s2 = input.charAt(peg$currPos); + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c39.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); peg$currPos++; } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c40); } } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c33(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; + if (s1 === peg$FAILED) { + s1 = peg$currPos; + s2 = peg$currPos; + peg$silentFails++; + if (input.substr(peg$currPos, 3) === peg$c35) { + s3 = peg$c35; + peg$currPos += 3; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c36); } + } + peg$silentFails--; + if (s3 === peg$FAILED) { + s2 = peg$c41; + } else { + peg$currPos = s2; + s2 = peg$c2; + } + if (s2 !== peg$FAILED) { + if (input.length > peg$currPos) { + s3 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c42); } + } + if (s3 !== peg$FAILED) { + peg$reportedPos = s1; + s2 = peg$c43(s3); + s1 = s2; + } else { + peg$currPos = s1; + s1 = peg$c2; + } + } else { + peg$currPos = s1; + s1 = peg$c2; + } } - } else { - peg$currPos = s0; - s0 = peg$c2; } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -1805,7 +1546,7 @@ module.exports = (function() { function peg$parsefloat() { var s0, s1, s2, s3; - var key = peg$currPos * 49 + 23, + var key = peg$currPos * 41 + 19, cached = peg$cache[key]; if (cached) { @@ -1820,26 +1561,26 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 101) { - s2 = peg$c38; + s2 = peg$c49; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c39); } + if (peg$silentFails === 0) { peg$fail(peg$c50); } } if (s2 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 69) { - s2 = peg$c40; + s2 = peg$c51; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c41); } + if (peg$silentFails === 0) { peg$fail(peg$c52); } } } if (s2 !== peg$FAILED) { s3 = peg$parseinteger_text(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c42(s1, s3); + s1 = peg$c53(s1, s3); s0 = s1; } else { peg$currPos = s0; @@ -1858,7 +1599,7 @@ module.exports = (function() { s1 = peg$parsefloat_text(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c43(s1); + s1 = peg$c54(s1); } s0 = s1; } @@ -1871,7 +1612,7 @@ module.exports = (function() { function peg$parsefloat_text() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 49 + 24, + var key = peg$currPos * 41 + 20, cached = peg$cache[key]; if (cached) { @@ -1881,25 +1622,25 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 43) { - s1 = peg$c44; + s1 = peg$c55; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { peg$fail(peg$c56); } } if (s1 === peg$FAILED) { - s1 = peg$c25; + s1 = peg$c3; } if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$parseDIGITS(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; + s4 = peg$c20; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s4 !== peg$FAILED) { s5 = peg$parseDIGITS(); @@ -1920,7 +1661,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c46(s2); + s1 = peg$c57(s2); s0 = s1; } else { peg$currPos = s0; @@ -1933,22 +1674,22 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c47; + s1 = peg$c58; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { peg$fail(peg$c59); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; s3 = peg$parseDIGITS(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; + s4 = peg$c20; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s4 !== peg$FAILED) { s5 = peg$parseDIGITS(); @@ -1969,7 +1710,7 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c49(s2); + s1 = peg$c60(s2); s0 = s1; } else { peg$currPos = s0; @@ -1989,7 +1730,7 @@ module.exports = (function() { function peg$parseinteger() { var s0, s1; - var key = peg$currPos * 49 + 25, + var key = peg$currPos * 41 + 21, cached = peg$cache[key]; if (cached) { @@ -2001,7 +1742,7 @@ module.exports = (function() { s1 = peg$parseinteger_text(); if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c50(s1); + s1 = peg$c61(s1); } s0 = s1; @@ -2013,7 +1754,7 @@ module.exports = (function() { function peg$parseinteger_text() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 49 + 26, + var key = peg$currPos * 41 + 22, cached = peg$cache[key]; if (cached) { @@ -2023,46 +1764,37 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 43) { - s1 = peg$c44; + s1 = peg$c55; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { peg$fail(peg$c56); } } if (s1 === peg$FAILED) { - s1 = peg$c25; + s1 = peg$c3; } if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseDIGIT_OR_UNDER(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseDIGIT_OR_UNDER(); - } - } else { - s2 = peg$c2; - } + s2 = peg$parseDIGITS(); if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; + s4 = peg$c20; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + if (peg$silentFails === 0) { peg$fail(peg$c21); } } peg$silentFails--; if (s4 === peg$FAILED) { - s3 = peg$c5; + s3 = peg$c41; } else { peg$currPos = s3; s3 = peg$c2; } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c46(s2); + s1 = peg$c62(s2); s0 = s1; } else { peg$currPos = s0; @@ -2079,43 +1811,34 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 45) { - s1 = peg$c47; + s1 = peg$c58; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { peg$fail(peg$c59); } } if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseDIGIT_OR_UNDER(); - if (s3 !== peg$FAILED) { - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseDIGIT_OR_UNDER(); - } - } else { - s2 = peg$c2; - } + s2 = peg$parseDIGITS(); if (s2 !== peg$FAILED) { s3 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 46) { - s4 = peg$c16; + s4 = peg$c20; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + if (peg$silentFails === 0) { peg$fail(peg$c21); } } peg$silentFails--; if (s4 === peg$FAILED) { - s3 = peg$c5; + s3 = peg$c41; } else { peg$currPos = s3; s3 = peg$c2; } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c49(s2); + s1 = peg$c63(s2); s0 = s1; } else { peg$currPos = s0; @@ -2139,7 +1862,7 @@ module.exports = (function() { function peg$parseboolean() { var s0, s1; - var key = peg$currPos * 49 + 27, + var key = peg$currPos * 41 + 23, cached = peg$cache[key]; if (cached) { @@ -2148,30 +1871,30 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c51) { - s1 = peg$c51; + if (input.substr(peg$currPos, 4) === peg$c64) { + s1 = peg$c64; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c52); } + if (peg$silentFails === 0) { peg$fail(peg$c65); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c53(); + s1 = peg$c66(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c54) { - s1 = peg$c54; + if (input.substr(peg$currPos, 5) === peg$c67) { + s1 = peg$c67; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c55); } + if (peg$silentFails === 0) { peg$fail(peg$c68); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c56(); + s1 = peg$c69(); } s0 = s1; } @@ -2184,7 +1907,7 @@ module.exports = (function() { function peg$parsearray() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 49 + 28, + var key = peg$currPos * 41 + 24, cached = peg$cache[key]; if (cached) { @@ -2194,30 +1917,25 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; + s1 = peg$c10; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parsearray_sep(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parsearray_sep(); - } + s2 = peg$parsearray_WS(); if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s3 = peg$c9; + s3 = peg$c12; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c57(); + s1 = peg$c70(); s0 = s1; } else { peg$currPos = s0; @@ -2234,28 +1952,28 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; + s1 = peg$c10; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s1 !== peg$FAILED) { s2 = peg$parsearray_value(); if (s2 === peg$FAILED) { - s2 = peg$c25; + s2 = peg$c3; } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s3 = peg$c9; + s3 = peg$c12; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c58(s2); + s1 = peg$c71(s2); s0 = s1; } else { peg$currPos = s0; @@ -2272,11 +1990,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; + s1 = peg$c10; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s1 !== peg$FAILED) { s2 = []; @@ -2291,15 +2009,15 @@ module.exports = (function() { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s3 = peg$c9; + s3 = peg$c12; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c59(s2); + s1 = peg$c72(s2); s0 = s1; } else { peg$currPos = s0; @@ -2316,11 +2034,11 @@ module.exports = (function() { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c7; + s1 = peg$c10; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c8); } + if (peg$silentFails === 0) { peg$fail(peg$c11); } } if (s1 !== peg$FAILED) { s2 = []; @@ -2337,15 +2055,15 @@ module.exports = (function() { s3 = peg$parsearray_value(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 93) { - s4 = peg$c9; + s4 = peg$c12; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c10); } + if (peg$silentFails === 0) { peg$fail(peg$c13); } } if (s4 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c60(s2, s3); + s1 = peg$c73(s2, s3); s0 = s1; } else { peg$currPos = s0; @@ -2373,9 +2091,9 @@ module.exports = (function() { } function peg$parsearray_value() { - var s0, s1, s2, s3, s4; + var s0, s1, s2, s3; - var key = peg$currPos * 49 + 29, + var key = peg$currPos * 41 + 25, cached = peg$cache[key]; if (cached) { @@ -2384,24 +2102,14 @@ module.exports = (function() { } s0 = peg$currPos; - s1 = []; - s2 = peg$parsearray_sep(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parsearray_sep(); - } + s1 = peg$parsearray_WS(); if (s1 !== peg$FAILED) { s2 = peg$parsevalue(); if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parsearray_sep(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parsearray_sep(); - } + s3 = peg$parsearray_WS(); if (s3 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c61(s2); + s1 = peg$c74(s2); s0 = s1; } else { peg$currPos = s0; @@ -2422,9 +2130,9 @@ module.exports = (function() { } function peg$parsearray_value_list() { - var s0, s1, s2, s3, s4, s5, s6; + var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 49 + 30, + var key = peg$currPos * 41 + 26, cached = peg$cache[key]; if (cached) { @@ -2433,39 +2141,24 @@ module.exports = (function() { } s0 = peg$currPos; - s1 = []; - s2 = peg$parsearray_sep(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parsearray_sep(); - } + s1 = peg$parsearray_WS(); if (s1 !== peg$FAILED) { s2 = peg$parsevalue(); if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parsearray_sep(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parsearray_sep(); - } + s3 = peg$parsearray_WS(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { - s4 = peg$c62; + s4 = peg$c75; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } + if (peg$silentFails === 0) { peg$fail(peg$c76); } } if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parsearray_sep(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parsearray_sep(); - } + s5 = peg$parsearray_WS(); if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c61(s2); + s1 = peg$c74(s2); s0 = s1; } else { peg$currPos = s0; @@ -2493,10 +2186,10 @@ module.exports = (function() { return s0; } - function peg$parsearray_sep() { - var s0; + function peg$parsearray_WS() { + var s0, s1, s2, s3, s4, s5, s6; - var key = peg$currPos * 49 + 31, + var key = peg$currPos * 41 + 27, cached = peg$cache[key]; if (cached) { @@ -2504,12 +2197,83 @@ module.exports = (function() { return cached.result; } - s0 = peg$parseS(); - if (s0 === peg$FAILED) { - s0 = peg$parseNL(); - if (s0 === peg$FAILED) { - s0 = peg$parsecomment(); + s0 = peg$currPos; + s1 = peg$parseWS(); + if (s1 !== peg$FAILED) { + s2 = []; + s3 = peg$currPos; + s4 = peg$parsecomment(); + if (s4 === peg$FAILED) { + s4 = peg$c3; + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 10) { + s5 = peg$c4; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseWS(); + if (s6 !== peg$FAILED) { + s4 = [s4, s5, s6]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$c2; + } + } else { + peg$currPos = s3; + s3 = peg$c2; + } + } else { + peg$currPos = s3; + s3 = peg$c2; + } + while (s3 !== peg$FAILED) { + s2.push(s3); + s3 = peg$currPos; + s4 = peg$parsecomment(); + if (s4 === peg$FAILED) { + s4 = peg$c3; + } + if (s4 !== peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 10) { + s5 = peg$c4; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c5); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parseWS(); + if (s6 !== peg$FAILED) { + s4 = [s4, s5, s6]; + s3 = s4; + } else { + peg$currPos = s3; + s3 = peg$c2; + } + } else { + peg$currPos = s3; + s3 = peg$c2; + } + } else { + peg$currPos = s3; + s3 = peg$c2; + } + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c2; } + } else { + peg$currPos = s0; + s0 = peg$c2; } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -2520,7 +2284,7 @@ module.exports = (function() { function peg$parseinline_table() { var s0, s1, s2, s3, s4, s5; - var key = peg$currPos * 49 + 32, + var key = peg$currPos * 41 + 28, cached = peg$cache[key]; if (cached) { @@ -2530,19 +2294,14 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c64; + s1 = peg$c77; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c65); } + if (peg$silentFails === 0) { peg$fail(peg$c78); } } if (s1 !== peg$FAILED) { - s2 = []; - s3 = peg$parseS(); - while (s3 !== peg$FAILED) { - s2.push(s3); - s3 = peg$parseS(); - } + s2 = peg$parseWS(); if (s2 !== peg$FAILED) { s3 = []; s4 = peg$parseinline_table_assignment(); @@ -2551,23 +2310,18 @@ module.exports = (function() { s4 = peg$parseinline_table_assignment(); } if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseS(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseS(); - } + s4 = peg$parseWS(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { - s5 = peg$c66; + s5 = peg$c79; peg$currPos++; } else { s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } + if (peg$silentFails === 0) { peg$fail(peg$c80); } } if (s5 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c68(s3); + s1 = peg$c81(s3); s0 = s1; } else { peg$currPos = s0; @@ -2596,9 +2350,9 @@ module.exports = (function() { } function peg$parseinline_table_assignment() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; - var key = peg$currPos * 49 + 33, + var key = peg$currPos * 41 + 29, cached = peg$cache[key]; if (cached) { @@ -2607,63 +2361,38 @@ module.exports = (function() { } s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } + s1 = peg$parseWS(); if (s1 !== peg$FAILED) { - s2 = peg$parsekey(); + s2 = peg$parseASCII_BASIC(); if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } + s3 = peg$parseWS(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { - s4 = peg$c18; + s4 = peg$c24; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } + s5 = peg$parseWS(); if (s5 !== peg$FAILED) { s6 = peg$parsevalue(); if (s6 !== peg$FAILED) { - s7 = []; - s8 = peg$parseS(); - while (s8 !== peg$FAILED) { - s7.push(s8); - s8 = peg$parseS(); - } + s7 = peg$parseWS(); if (s7 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 44) { - s8 = peg$c62; + s8 = peg$c75; peg$currPos++; } else { s8 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c63); } + if (peg$silentFails === 0) { peg$fail(peg$c76); } } if (s8 !== peg$FAILED) { - s9 = []; - s10 = peg$parseS(); - while (s10 !== peg$FAILED) { - s9.push(s10); - s10 = peg$parseS(); - } + s9 = peg$parseWS(); if (s9 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c69(s2, s6); + s1 = peg$c82(s2, s6); s0 = s1; } else { peg$currPos = s0; @@ -2703,41 +2432,26 @@ module.exports = (function() { } if (s0 === peg$FAILED) { s0 = peg$currPos; - s1 = []; - s2 = peg$parseS(); - while (s2 !== peg$FAILED) { - s1.push(s2); - s2 = peg$parseS(); - } + s1 = peg$parseWS(); if (s1 !== peg$FAILED) { - s2 = peg$parsekey(); + s2 = peg$parseASCII_BASIC(); if (s2 !== peg$FAILED) { - s3 = []; - s4 = peg$parseS(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseS(); - } + s3 = peg$parseWS(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 61) { - s4 = peg$c18; + s4 = peg$c24; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } + if (peg$silentFails === 0) { peg$fail(peg$c25); } } if (s4 !== peg$FAILED) { - s5 = []; - s6 = peg$parseS(); - while (s6 !== peg$FAILED) { - s5.push(s6); - s6 = peg$parseS(); - } + s5 = peg$parseWS(); if (s5 !== peg$FAILED) { s6 = peg$parsevalue(); if (s6 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c69(s2, s6); + s1 = peg$c82(s2, s6); s0 = s1; } else { peg$currPos = s0; @@ -2773,7 +2487,7 @@ module.exports = (function() { function peg$parsesecfragment() { var s0, s1, s2; - var key = peg$currPos * 49 + 34, + var key = peg$currPos * 41 + 30, cached = peg$cache[key]; if (cached) { @@ -2783,17 +2497,17 @@ module.exports = (function() { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { - s1 = peg$c16; + s1 = peg$c20; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + if (peg$silentFails === 0) { peg$fail(peg$c21); } } if (s1 !== peg$FAILED) { s2 = peg$parseDIGITS(); if (s2 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c70(s2); + s1 = peg$c83(s2); s0 = s1; } else { peg$currPos = s0; @@ -2812,7 +2526,7 @@ module.exports = (function() { function peg$parsedate() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11; - var key = peg$currPos * 49 + 35, + var key = peg$currPos * 41 + 31, cached = peg$cache[key]; if (cached) { @@ -2822,37 +2536,37 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - s2 = peg$parseDIGIT_OR_UNDER(); + s2 = peg$parseDIGIT(); if (s2 !== peg$FAILED) { - s3 = peg$parseDIGIT_OR_UNDER(); + s3 = peg$parseDIGIT(); if (s3 !== peg$FAILED) { - s4 = peg$parseDIGIT_OR_UNDER(); + s4 = peg$parseDIGIT(); if (s4 !== peg$FAILED) { - s5 = peg$parseDIGIT_OR_UNDER(); + s5 = peg$parseDIGIT(); if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { - s6 = peg$c47; + s6 = peg$c58; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { peg$fail(peg$c59); } } if (s6 !== peg$FAILED) { - s7 = peg$parseDIGIT_OR_UNDER(); + s7 = peg$parseDIGIT(); if (s7 !== peg$FAILED) { - s8 = peg$parseDIGIT_OR_UNDER(); + s8 = peg$parseDIGIT(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { - s9 = peg$c47; + s9 = peg$c58; peg$currPos++; } else { s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { peg$fail(peg$c59); } } if (s9 !== peg$FAILED) { - s10 = peg$parseDIGIT_OR_UNDER(); + s10 = peg$parseDIGIT(); if (s10 !== peg$FAILED) { - s11 = peg$parseDIGIT_OR_UNDER(); + s11 = peg$parseDIGIT(); if (s11 !== peg$FAILED) { s2 = [s2, s3, s4, s5, s6, s7, s8, s9, s10, s11]; s1 = s2; @@ -2898,7 +2612,7 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c71(s1); + s1 = peg$c84(s1); } s0 = s1; @@ -2910,7 +2624,7 @@ module.exports = (function() { function peg$parsetime() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; - var key = peg$currPos * 49 + 36, + var key = peg$currPos * 41 + 32, cached = peg$cache[key]; if (cached) { @@ -2920,37 +2634,37 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - s2 = peg$parseDIGIT_OR_UNDER(); + s2 = peg$parseDIGIT(); if (s2 !== peg$FAILED) { - s3 = peg$parseDIGIT_OR_UNDER(); + s3 = peg$parseDIGIT(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c72; + s4 = peg$c85; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s4 !== peg$FAILED) { - s5 = peg$parseDIGIT_OR_UNDER(); + s5 = peg$parseDIGIT(); if (s5 !== peg$FAILED) { - s6 = peg$parseDIGIT_OR_UNDER(); + s6 = peg$parseDIGIT(); if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s7 = peg$c72; + s7 = peg$c85; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s7 !== peg$FAILED) { - s8 = peg$parseDIGIT_OR_UNDER(); + s8 = peg$parseDIGIT(); if (s8 !== peg$FAILED) { - s9 = peg$parseDIGIT_OR_UNDER(); + s9 = peg$parseDIGIT(); if (s9 !== peg$FAILED) { s10 = peg$parsesecfragment(); if (s10 === peg$FAILED) { - s10 = peg$c25; + s10 = peg$c3; } if (s10 !== peg$FAILED) { s2 = [s2, s3, s4, s5, s6, s7, s8, s9, s10]; @@ -2993,7 +2707,7 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c74(s1); + s1 = peg$c87(s1); } s0 = s1; @@ -3005,7 +2719,7 @@ module.exports = (function() { function peg$parsetime_with_offset() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16; - var key = peg$currPos * 49 + 37, + var key = peg$currPos * 41 + 33, cached = peg$cache[key]; if (cached) { @@ -3015,71 +2729,71 @@ module.exports = (function() { s0 = peg$currPos; s1 = peg$currPos; - s2 = peg$parseDIGIT_OR_UNDER(); + s2 = peg$parseDIGIT(); if (s2 !== peg$FAILED) { - s3 = peg$parseDIGIT_OR_UNDER(); + s3 = peg$parseDIGIT(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s4 = peg$c72; + s4 = peg$c85; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s4 !== peg$FAILED) { - s5 = peg$parseDIGIT_OR_UNDER(); + s5 = peg$parseDIGIT(); if (s5 !== peg$FAILED) { - s6 = peg$parseDIGIT_OR_UNDER(); + s6 = peg$parseDIGIT(); if (s6 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s7 = peg$c72; + s7 = peg$c85; peg$currPos++; } else { s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s7 !== peg$FAILED) { - s8 = peg$parseDIGIT_OR_UNDER(); + s8 = peg$parseDIGIT(); if (s8 !== peg$FAILED) { - s9 = peg$parseDIGIT_OR_UNDER(); + s9 = peg$parseDIGIT(); if (s9 !== peg$FAILED) { s10 = peg$parsesecfragment(); if (s10 === peg$FAILED) { - s10 = peg$c25; + s10 = peg$c3; } if (s10 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 45) { - s11 = peg$c47; + s11 = peg$c58; peg$currPos++; } else { s11 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } + if (peg$silentFails === 0) { peg$fail(peg$c59); } } if (s11 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 43) { - s11 = peg$c44; + s11 = peg$c55; peg$currPos++; } else { s11 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c45); } + if (peg$silentFails === 0) { peg$fail(peg$c56); } } } if (s11 !== peg$FAILED) { - s12 = peg$parseDIGIT_OR_UNDER(); + s12 = peg$parseDIGIT(); if (s12 !== peg$FAILED) { - s13 = peg$parseDIGIT_OR_UNDER(); + s13 = peg$parseDIGIT(); if (s13 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { - s14 = peg$c72; + s14 = peg$c85; peg$currPos++; } else { s14 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c73); } + if (peg$silentFails === 0) { peg$fail(peg$c86); } } if (s14 !== peg$FAILED) { - s15 = peg$parseDIGIT_OR_UNDER(); + s15 = peg$parseDIGIT(); if (s15 !== peg$FAILED) { - s16 = peg$parseDIGIT_OR_UNDER(); + s16 = peg$parseDIGIT(); if (s16 !== peg$FAILED) { s2 = [s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16]; s1 = s2; @@ -3145,7 +2859,7 @@ module.exports = (function() { } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c74(s1); + s1 = peg$c87(s1); } s0 = s1; @@ -3157,7 +2871,7 @@ module.exports = (function() { function peg$parsedatetime() { var s0, s1, s2, s3, s4; - var key = peg$currPos * 49 + 38, + var key = peg$currPos * 41 + 34, cached = peg$cache[key]; if (cached) { @@ -3169,140 +2883,63 @@ module.exports = (function() { s1 = peg$parsedate(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 84) { - s2 = peg$c75; + s2 = peg$c88; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c76); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s2 !== peg$FAILED) { s3 = peg$parsetime(); if (s3 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 90) { - s4 = peg$c77; + s4 = peg$c90; peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } - } - if (s4 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c79(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - s1 = peg$parsedate(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 84) { - s2 = peg$c75; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c76); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parsetime_with_offset(); - if (s3 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c80(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseS() { - var s0; - - var key = peg$currPos * 49 + 39, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - if (peg$c81.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c82); } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseNL() { - var s0, s1, s2; - - var key = peg$currPos * 49 + 40, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - if (input.charCodeAt(peg$currPos) === 10) { - s0 = peg$c83; - peg$currPos++; + if (peg$silentFails === 0) { peg$fail(peg$c91); } + } + if (s4 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c92(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c2; + } + } else { + peg$currPos = s0; + s0 = peg$c2; + } + } else { + peg$currPos = s0; + s0 = peg$c2; + } } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } + peg$currPos = s0; + s0 = peg$c2; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 13) { - s1 = peg$c85; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c86); } - } + s1 = peg$parsedate(); if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 10) { - s2 = peg$c83; + if (input.charCodeAt(peg$currPos) === 84) { + s2 = peg$c88; peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } + if (peg$silentFails === 0) { peg$fail(peg$c89); } } if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; + s3 = peg$parsetime_with_offset(); + if (s3 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c93(s1, s3); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c2; + } } else { peg$currPos = s0; s0 = peg$c2; @@ -3318,31 +2955,10 @@ module.exports = (function() { return s0; } - function peg$parseNLS() { - var s0; - - var key = peg$currPos * 49 + 41, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$parseNL(); - if (s0 === peg$FAILED) { - s0 = peg$parseS(); - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseEOF() { + function peg$parseWS() { var s0, s1; - var key = peg$currPos * 49 + 42, + var key = peg$currPos * 41 + 35, cached = peg$cache[key]; if (cached) { @@ -3350,21 +2966,23 @@ module.exports = (function() { return cached.result; } - s0 = peg$currPos; - peg$silentFails++; - if (input.length > peg$currPos) { + s0 = []; + if (peg$c94.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c6); } + if (peg$silentFails === 0) { peg$fail(peg$c95); } } - peg$silentFails--; - if (s1 === peg$FAILED) { - s0 = peg$c5; - } else { - peg$currPos = s0; - s0 = peg$c2; + while (s1 !== peg$FAILED) { + s0.push(s1); + if (peg$c94.test(input.charAt(peg$currPos))) { + s1 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c95); } + } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -3375,7 +2993,7 @@ module.exports = (function() { function peg$parseHEX() { var s0; - var key = peg$currPos * 49 + 43, + var key = peg$currPos * 41 + 36, cached = peg$cache[key]; if (cached) { @@ -3383,12 +3001,12 @@ module.exports = (function() { return cached.result; } - if (peg$c87.test(input.charAt(peg$currPos))) { + if (peg$c96.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c88); } + if (peg$silentFails === 0) { peg$fail(peg$c97); } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -3396,10 +3014,10 @@ module.exports = (function() { return s0; } - function peg$parseDIGIT_OR_UNDER() { - var s0, s1; + function peg$parseDIGIT() { + var s0; - var key = peg$currPos * 49 + 44, + var key = peg$currPos * 41 + 37, cached = peg$cache[key]; if (cached) { @@ -3407,27 +3025,12 @@ module.exports = (function() { return cached.result; } - if (peg$c89.test(input.charAt(peg$currPos))) { + if (peg$c98.test(input.charAt(peg$currPos))) { s0 = input.charAt(peg$currPos); peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.charCodeAt(peg$currPos) === 95) { - s1 = peg$c91; - peg$currPos++; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c92); } - } - if (s1 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c93(); - } - s0 = s1; + if (peg$silentFails === 0) { peg$fail(peg$c99); } } peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -3436,9 +3039,9 @@ module.exports = (function() { } function peg$parseASCII_BASIC() { - var s0; + var s0, s1, s2; - var key = peg$currPos * 49 + 45, + var key = peg$currPos * 41 + 38, cached = peg$cache[key]; if (cached) { @@ -3446,13 +3049,34 @@ module.exports = (function() { return cached.result; } - if (peg$c94.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); + s0 = peg$currPos; + s1 = []; + if (peg$c100.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); peg$currPos++; } else { - s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c95); } + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c101); } + } + if (s2 !== peg$FAILED) { + while (s2 !== peg$FAILED) { + s1.push(s2); + if (peg$c100.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c101); } + } + } + } else { + s1 = peg$c2; + } + if (s1 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c102(); } + s0 = s1; peg$cache[key] = { nextPos: peg$currPos, result: s0 }; @@ -3462,7 +3086,7 @@ module.exports = (function() { function peg$parseDIGITS() { var s0, s1, s2; - var key = peg$currPos * 49 + 46, + var key = peg$currPos * 41 + 39, cached = peg$cache[key]; if (cached) { @@ -3472,18 +3096,30 @@ module.exports = (function() { s0 = peg$currPos; s1 = []; - s2 = peg$parseDIGIT_OR_UNDER(); + if (peg$c103.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c104); } + } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); - s2 = peg$parseDIGIT_OR_UNDER(); + if (peg$c103.test(input.charAt(peg$currPos))) { + s2 = input.charAt(peg$currPos); + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c104); } + } } } else { s1 = peg$c2; } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c96(s1); + s1 = peg$c105(); } s0 = s1; @@ -3493,9 +3129,9 @@ module.exports = (function() { } function peg$parseESCAPED() { - var s0, s1; + var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; - var key = peg$currPos * 49 + 47, + var key = peg$currPos * 41 + 40, cached = peg$cache[key]; if (cached) { @@ -3504,248 +3140,239 @@ module.exports = (function() { } s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c97) { - s1 = peg$c97; + if (input.substr(peg$currPos, 2) === peg$c106) { + s1 = peg$c106; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c98); } + if (peg$silentFails === 0) { peg$fail(peg$c107); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c99(); + s1 = peg$c108(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c100) { - s1 = peg$c100; + if (input.substr(peg$currPos, 2) === peg$c109) { + s1 = peg$c109; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c101); } + if (peg$silentFails === 0) { peg$fail(peg$c110); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c102(); + s1 = peg$c111(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c103) { - s1 = peg$c103; + if (input.substr(peg$currPos, 2) === peg$c112) { + s1 = peg$c112; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c104); } + if (peg$silentFails === 0) { peg$fail(peg$c113); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c105(); + s1 = peg$c114(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c106) { - s1 = peg$c106; + if (input.substr(peg$currPos, 2) === peg$c115) { + s1 = peg$c115; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c107); } + if (peg$silentFails === 0) { peg$fail(peg$c116); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c108(); + s1 = peg$c117(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c109) { - s1 = peg$c109; + if (input.substr(peg$currPos, 2) === peg$c118) { + s1 = peg$c118; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } + if (peg$silentFails === 0) { peg$fail(peg$c119); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c111(); + s1 = peg$c120(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c112) { - s1 = peg$c112; + if (input.substr(peg$currPos, 2) === peg$c121) { + s1 = peg$c121; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c113); } + if (peg$silentFails === 0) { peg$fail(peg$c122); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c114(); + s1 = peg$c123(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c115) { - s1 = peg$c115; + if (input.substr(peg$currPos, 2) === peg$c124) { + s1 = peg$c124; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c116); } + if (peg$silentFails === 0) { peg$fail(peg$c125); } } if (s1 !== peg$FAILED) { peg$reportedPos = s0; - s1 = peg$c117(); + s1 = peg$c126(); } s0 = s1; if (s0 === peg$FAILED) { - s0 = peg$parseESCAPED_UNICODE(); - } - } - } - } - } - } - } - - peg$cache[key] = { nextPos: peg$currPos, result: s0 }; - - return s0; - } - - function peg$parseESCAPED_UNICODE() { - var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; - - var key = peg$currPos * 49 + 48, - cached = peg$cache[key]; - - if (cached) { - peg$currPos = cached.nextPos; - return cached.result; - } - - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c118) { - s1 = peg$c118; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c119); } - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$parseHEX(); - if (s3 !== peg$FAILED) { - s4 = peg$parseHEX(); - if (s4 !== peg$FAILED) { - s5 = peg$parseHEX(); - if (s5 !== peg$FAILED) { - s6 = peg$parseHEX(); - if (s6 !== peg$FAILED) { - s7 = peg$parseHEX(); - if (s7 !== peg$FAILED) { - s8 = peg$parseHEX(); - if (s8 !== peg$FAILED) { - s9 = peg$parseHEX(); - if (s9 !== peg$FAILED) { - s10 = peg$parseHEX(); - if (s10 !== peg$FAILED) { - s3 = [s3, s4, s5, s6, s7, s8, s9, s10]; - s2 = s3; + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c127) { + s1 = peg$c127; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c128); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = peg$parseHEX(); + if (s3 !== peg$FAILED) { + s4 = peg$parseHEX(); + if (s4 !== peg$FAILED) { + s5 = peg$parseHEX(); + if (s5 !== peg$FAILED) { + s6 = peg$parseHEX(); + if (s6 !== peg$FAILED) { + s7 = peg$parseHEX(); + if (s7 !== peg$FAILED) { + s8 = peg$parseHEX(); + if (s8 !== peg$FAILED) { + s9 = peg$parseHEX(); + if (s9 !== peg$FAILED) { + s10 = peg$parseHEX(); + if (s10 !== peg$FAILED) { + s3 = [s3, s4, s5, s6, s7, s8, s9, s10]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c2; + } + } else { + peg$currPos = s2; + s2 = peg$c2; + } + } else { + peg$currPos = s2; + s2 = peg$c2; + } + } else { + peg$currPos = s2; + s2 = peg$c2; + } + } else { + peg$currPos = s2; + s2 = peg$c2; + } + } else { + peg$currPos = s2; + s2 = peg$c2; + } + } else { + peg$currPos = s2; + s2 = peg$c2; + } } else { peg$currPos = s2; s2 = peg$c2; } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c129(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c2; + } } else { - peg$currPos = s2; - s2 = peg$c2; + peg$currPos = s0; + s0 = peg$c2; + } + if (s0 === peg$FAILED) { + s0 = peg$currPos; + if (input.substr(peg$currPos, 2) === peg$c130) { + s1 = peg$c130; + peg$currPos += 2; + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c131); } + } + if (s1 !== peg$FAILED) { + s2 = peg$currPos; + s3 = peg$parseHEX(); + if (s3 !== peg$FAILED) { + s4 = peg$parseHEX(); + if (s4 !== peg$FAILED) { + s5 = peg$parseHEX(); + if (s5 !== peg$FAILED) { + s6 = peg$parseHEX(); + if (s6 !== peg$FAILED) { + s3 = [s3, s4, s5, s6]; + s2 = s3; + } else { + peg$currPos = s2; + s2 = peg$c2; + } + } else { + peg$currPos = s2; + s2 = peg$c2; + } + } else { + peg$currPos = s2; + s2 = peg$c2; + } + } else { + peg$currPos = s2; + s2 = peg$c2; + } + if (s2 !== peg$FAILED) { + peg$reportedPos = s0; + s1 = peg$c129(s2); + s0 = s1; + } else { + peg$currPos = s0; + s0 = peg$c2; + } + } else { + peg$currPos = s0; + s0 = peg$c2; + } + if (s0 === peg$FAILED) { + if (input.charCodeAt(peg$currPos) === 92) { + s0 = peg$c132; + peg$currPos++; + } else { + s0 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$c133); } + } + } } - } else { - peg$currPos = s2; - s2 = peg$c2; } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c120(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; - } - } else { - peg$currPos = s0; - s0 = peg$c2; - } - if (s0 === peg$FAILED) { - s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c121) { - s1 = peg$c121; - peg$currPos += 2; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c122); } - } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - s3 = peg$parseHEX(); - if (s3 !== peg$FAILED) { - s4 = peg$parseHEX(); - if (s4 !== peg$FAILED) { - s5 = peg$parseHEX(); - if (s5 !== peg$FAILED) { - s6 = peg$parseHEX(); - if (s6 !== peg$FAILED) { - s3 = [s3, s4, s5, s6]; - s2 = s3; - } else { - peg$currPos = s2; - s2 = peg$c2; } - } else { - peg$currPos = s2; - s2 = peg$c2; } - } else { - peg$currPos = s2; - s2 = peg$c2; } - } else { - peg$currPos = s2; - s2 = peg$c2; - } - if (s2 !== peg$FAILED) { - peg$reportedPos = s0; - s1 = peg$c120(s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$c2; } - } else { - peg$currPos = s0; - s0 = peg$c2; } } diff --git a/src/toml.pegjs b/src/toml.pegjs index 7051707..4a2fadf 100644 --- a/src/toml.pegjs +++ b/src/toml.pegjs @@ -1,3 +1,5 @@ +// This grammar assumes \r\n has been normalized to \n. + { var nodes = []; @@ -69,77 +71,75 @@ start = line* { return nodes } line - = S* expr:expression S* comment* (NL+ / EOF) - / S+ (NL+ / EOF) - / NL - -expression - = comment / path / tablearray / assignment + = WS ( expression WS comment? "\n"? + / comment "\n"? + / "\n" ) comment - = '#' (!(NL / EOF) .)* + = '#' [^\n]* + +expression + = path / tablearray / assignment path - = '[' S* name:table_key S* ']' { addNode(node('ObjectPath', name, line, column)) } + = '[' name:table_key ']' { addNode(node('ObjectPath', name, line, column)) } tablearray - = '[' '[' S* name:table_key S* ']' ']' { addNode(node('ArrayPath', name, line, column)) } + = '[[' name:table_key ']]' { addNode(node('ArrayPath', name, line, column)) } table_key - = parts:dot_ended_table_key_part+ name:table_key_part { return parts.concat(name) } - / name:table_key_part { return [name] } + = WS first:table_key_part + WS rest:('.' WS part:table_key_part WS { return part })* + { return [first].concat(rest) } table_key_part - = S* name:key S* { return name } - / S* name:quoted_key S* { return name } - -dot_ended_table_key_part - = S* name:key S* '.' S* { return name } - / S* name:quoted_key S* '.' S* { return name } + = key / quoted_key assignment - = key:key S* '=' S* value:value { addNode(node('Assign', value, line, column, key)) } - / key:quoted_key S* '=' S* value:value { addNode(node('Assign', value, line, column, key)) } + = key:key WS '=' WS value:value { addNode(node('Assign', value, line, column, key)) } + / key:quoted_key WS '=' WS value:value { addNode(node('Assign', value, line, column, key)) } key - = chars:ASCII_BASIC+ { return chars.join('') } + = ASCII_BASIC quoted_key - = node:double_quoted_single_line_string { return node.value } - / node:single_quoted_single_line_string { return node.value } + = double_quoted_single_line_string + / single_quoted_single_line_string value = string / datetime / float / integer / boolean / array / inline_table string - = double_quoted_multiline_string - / double_quoted_single_line_string - / single_quoted_multiline_string - / single_quoted_single_line_string + = chars:( double_quoted_multiline_string + / double_quoted_single_line_string + / single_quoted_multiline_string + / single_quoted_single_line_string ) + { return node('String', chars, line, column) } double_quoted_multiline_string - = '"""' NL? chars:multiline_string_char* '"""' { return node('String', chars.join(''), line, column) } + = '"""' "\n"? + chars:multiline_string_chars + '"""' { return chars.join('') } + double_quoted_single_line_string - = '"' chars:string_char* '"' { return node('String', chars.join(''), line, column) } -single_quoted_multiline_string - = "'''" NL? chars:multiline_literal_char* "'''" { return node('String', chars.join(''), line, column) } -single_quoted_single_line_string - = "'" chars:literal_char* "'" { return node('String', chars.join(''), line, column) } + = '"' chars:( [^"\\] / ESCAPED )* '"' { return chars.join('') } -string_char - = ESCAPED / (!'"' char:. { return char }) +single_quoted_multiline_string + = "'''" "\n"? + chars:multiline_literal_chars + "'''" { return chars.join('') } -literal_char - = (!"'" char:. { return char }) +single_quoted_single_line_string + = "'" chars:[^']* "'" { return chars.join('') } -multiline_string_char - = ESCAPED / multiline_string_delim / (!'"""' char:. { return char}) +multiline_string_chars + = ( [^"\\] / multiline_string_delim / ESCAPED / !'"""' c:. { return c } )* multiline_string_delim - = '\\' NL NLS* { return '' } + = '\\\n' [ \t\n]* { return '' } -multiline_literal_char - = (!"'''" char:. { return char }) +multiline_literal_chars + = ( [^'] / !"'''" c:. { return c } )* float = left:(float_text / integer_text) ('e' / 'E') right:integer_text { return node('Float', parseFloat(left + 'e' + right), line, column) } @@ -153,37 +153,37 @@ integer = text:integer_text { return node('Integer', parseInt(text, 10), line, column) } integer_text - = '+'? digits:DIGIT+ !'.' { return digits.join('') } - / '-' digits:DIGIT+ !'.' { return '-' + digits.join('') } + = '+'? digits:DIGITS !'.' { return digits } + / '-' digits:DIGITS !'.' { return '-' + digits } boolean = 'true' { return node('Boolean', true, line, column) } / 'false' { return node('Boolean', false, line, column) } array - = '[' array_sep* ']' { return node('Array', [], line, column) } + = '[' array_WS ']' { return node('Array', [], line, column) } / '[' value:array_value? ']' { return node('Array', value ? [value] : [], line, column) } / '[' values:array_value_list+ ']' { return node('Array', values, line, column) } / '[' values:array_value_list+ value:array_value ']' { return node('Array', values.concat(value), line, column) } array_value - = array_sep* value:value array_sep* { return value } + = array_WS value:value array_WS { return value } array_value_list - = array_sep* value:value array_sep* ',' array_sep* { return value } + = array_WS value:value array_WS ',' array_WS { return value } -array_sep - = S / NL / comment +array_WS + = WS ( comment? "\n" WS )* inline_table - = '{' S* values:inline_table_assignment* S* '}' { return node('InlineTable', values, line, column) } + = '{' WS values:inline_table_assignment* WS '}' { return node('InlineTable', values, line, column) } inline_table_assignment - = S* key:key S* '=' S* value:value S* ',' S* { return node('InlineTableValue', value, line, column, key) } - / S* key:key S* '=' S* value:value { return node('InlineTableValue', value, line, column, key) } + = WS key:key WS '=' WS value:value WS ',' WS { return node('InlineTableValue', value, line, column, key) } + / WS key:key WS '=' WS value:value { return node('InlineTableValue', value, line, column, key) } secfragment - = '.' digits:DIGITS { return "." + digits } + = '.' digits:DIGITS { return "." + digits } date = date:( @@ -192,7 +192,7 @@ date DIGIT DIGIT '-' DIGIT DIGIT - ) { return date.join('') } + ) { return date.join('') } time = time:(DIGIT DIGIT ':' DIGIT DIGIT ':' DIGIT DIGIT secfragment?) { return time.join('') } @@ -208,17 +208,14 @@ datetime = date:date 'T' time:time 'Z' { return node('Date', new Date(date + "T" + time + "Z"), line, column) } / date:date 'T' time:time_with_offset { return node('Date', new Date(date + "T" + time), line, column) } - -S = [ \t] -NL = "\n" / "\r" "\n" -NLS = NL / S -EOF = !. +WS = [ \t]* HEX = [0-9a-f]i -DIGIT = DIGIT_OR_UNDER -DIGIT_OR_UNDER = [0-9] - / '_' { return "" } -ASCII_BASIC = [A-Za-z0-9_\-] -DIGITS = d:DIGIT_OR_UNDER+ { return d.join('') } +DIGIT = [0-9] + +ASCII_BASIC = [A-Za-z0-9_\-]+ { return text() } + +DIGITS = [0-9_]+ { return text().replace(/_/g, '') } + ESCAPED = '\\"' { return '"' } / '\\\\' { return '\\' } / '\\b' { return '\b' } @@ -226,6 +223,8 @@ ESCAPED = '\\"' { return '"' } / '\\n' { return '\n' } / '\\f' { return '\f' } / '\\r' { return '\r' } - / ESCAPED_UNICODE -ESCAPED_UNICODE = "\\U" digits:(HEX HEX HEX HEX HEX HEX HEX HEX) { return convertCodePoint(digits.join('')) } - / "\\u" digits:(HEX HEX HEX HEX) { return convertCodePoint(digits.join('')) } + / '\\U' digits:(HEX HEX HEX HEX HEX HEX HEX HEX) + { return convertCodePoint(digits.join('')) } + / '\\u' digits:(HEX HEX HEX HEX) + { return convertCodePoint(digits.join('')) } + / '\\'