UNPKG

json-tots

Version:

Template of Templates, a.k.a Template Should Eat Itself

1,682 lines (1,680 loc) 59.2 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault"); var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat")); var _sort = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/sort")); var _slice = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/slice")); var _trim = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/trim")); var _parseInt2 = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/parse-int")); var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map")); module.exports = /* * Generated by PEG.js 0.10.0. * * http://pegjs.org/ */ function () { 'use strict'; function peg$subclass(child, parent) { function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); } function peg$SyntaxError(message, expected, found, location) { this.message = message; this.expected = expected; this.found = found; this.location = location; this.name = 'SyntaxError'; if (typeof Error.captureStackTrace === 'function') { Error.captureStackTrace(this, peg$SyntaxError); } } peg$subclass(peg$SyntaxError, Error); peg$SyntaxError.buildMessage = function (expected, found) { var _context5; var DESCRIBE_EXPECTATION_FNS = { literal: function literal(expectation) { return "\"".concat(literalEscape(expectation.text), "\""); }, "class": function _class(expectation) { var _context2; var escapedParts = '', i; for (i = 0; i < expectation.parts.length; i++) { var _context; escapedParts += expectation.parts[i] instanceof Array ? (0, _concat["default"])(_context = "".concat(classEscape(expectation.parts[i][0]), "-")).call(_context, classEscape(expectation.parts[i][1])) : classEscape(expectation.parts[i]); } return (0, _concat["default"])(_context2 = "[".concat(expectation.inverted ? '^' : '')).call(_context2, escapedParts, "]"); }, any: function any(expectation) { return 'any character'; }, end: function end(expectation) { return 'end of input'; }, other: function other(expectation) { return expectation.description; } }; function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); } function literalEscape(s) { return s.replace(/\\/g, '\\\\').replace(/"/g, '\\"').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { return "\\x0".concat(hex(ch)); }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x".concat(hex(ch)); }); } function classEscape(s) { return s.replace(/\\/g, '\\\\').replace(/\]/g, '\\]').replace(/\^/g, '\\^').replace(/-/g, '\\-').replace(/\0/g, '\\0').replace(/\t/g, '\\t').replace(/\n/g, '\\n').replace(/\r/g, '\\r').replace(/[\x00-\x0F]/g, function (ch) { return "\\x0".concat(hex(ch)); }).replace(/[\x10-\x1F\x7F-\x9F]/g, function (ch) { return "\\x".concat(hex(ch)); }); } function describeExpectation(expectation) { return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); } function describeExpected(expected) { var _context3, _context4; var descriptions = new Array(expected.length), i, j; for (i = 0; i < expected.length; i++) { descriptions[i] = describeExpectation(expected[i]); } (0, _sort["default"])(descriptions).call(descriptions); if (descriptions.length > 0) { for (i = 1, j = 1; i < descriptions.length; i++) { if (descriptions[i - 1] !== descriptions[i]) { descriptions[j] = descriptions[i]; j++; } } descriptions.length = j; } switch (descriptions.length) { case 1: return descriptions[0]; case 2: return (0, _concat["default"])(_context3 = "".concat(descriptions[0], " or ")).call(_context3, descriptions[1]); default: return (0, _concat["default"])(_context4 = "".concat((0, _slice["default"])(descriptions).call(descriptions, 0, -1).join(', '), ", or ")).call(_context4, descriptions[descriptions.length - 1]); } } function describeFound(found) { return found ? "\"".concat(literalEscape(found), "\"") : 'end of input'; } return (0, _concat["default"])(_context5 = "Expected ".concat(describeExpected(expected), " but ")).call(_context5, describeFound(found), " found."); }; function peg$parse(input, options) { options = options !== void 0 ? options : {}; var peg$FAILED = {}, peg$startRuleFunctions = { tots: peg$parsetots }, peg$startRuleFunction = peg$parsetots, peg$c0 = '{', peg$c1 = peg$literalExpectation('{', false), peg$c2 = peg$anyExpectation(), peg$c3 = function peg$c3(template) { return template; }, peg$c4 = '}', peg$c5 = peg$literalExpectation('}', false), peg$c6 = function peg$c6(ops, jp, pipes) { return { operators: ops, path: jp, pipes: pipes, source: text(), value: null }; }, peg$c7 = function peg$c7(inc, enu, sym, con, qry) { return { inception: inc, enumeration: enu, symbol: sym, constraint: con, query: qry }; }, peg$c8 = '.', peg$c9 = peg$literalExpectation('.', false), peg$c10 = function peg$c10(inc, rep) { return { operator: inc, repeat: rep }; }, peg$c11 = '*', peg$c12 = peg$literalExpectation('*', false), peg$c13 = function peg$c13(inc, rep) { return { operator: inc, repeat: rep.length }; }, peg$c14 = '>', peg$c15 = peg$literalExpectation('>', false), peg$c16 = '%', peg$c17 = peg$literalExpectation('%', false), peg$c18 = function peg$c18(enu, rep) { return { operator: enu, repeat: rep ? 1 : 0 }; }, peg$c19 = ':', peg$c20 = peg$literalExpectation(':', false), peg$c21 = function peg$c21(op, sym) { return { operator: op, tag: sym }; }, peg$c22 = /^[#|@]/, peg$c23 = peg$classExpectation(['#', '|', '@'], false, false), peg$c24 = function peg$c24(dVal) { return dVal; }, peg$c25 = /^[!?]/, peg$c26 = peg$classExpectation(['!', '?'], false, false), peg$c27 = /^[=~]/, peg$c28 = peg$classExpectation(['=', '~'], false, false), peg$c29 = function peg$c29(op, eq, src, dVal) { return { operator: op, equal: eq, source: src, defaultValue: dVal ? (0, _trim["default"])(dVal).call(dVal) : dVal }; }, peg$c30 = /^[+\-]/, peg$c31 = peg$classExpectation(['+', '-'], false, false), peg$c32 = function peg$c32(op, count) { return { operator: op, count: count }; }, peg$c33 = function peg$c33() { var _context6; return (0, _trim["default"])(_context6 = text()).call(_context6); }, peg$c34 = function peg$c34(fn, args) { return { "function": fn, type: 'inline', args: args }; }, peg$c35 = '@', peg$c36 = peg$literalExpectation('@', false), peg$c37 = function peg$c37(fn) { return { "function": fn, type: 'extended', args: [] }; }, peg$c38 = function peg$c38(spread) { return { "function": spread }; }, peg$c39 = '**', peg$c40 = peg$literalExpectation('**', false), peg$c41 = peg$otherExpectation('integer'), peg$c42 = /^[0-9]/, peg$c43 = peg$classExpectation([['0', '9']], false, false), peg$c44 = function peg$c44() { return (0, _parseInt2["default"])(text(), 10); }, peg$c45 = peg$otherExpectation('whitespace'), peg$c46 = /^[ \t]/, peg$c47 = peg$classExpectation([' ', '\t'], false, false), peg$c48 = '|', peg$c49 = peg$literalExpectation('|', false), peg$c50 = /^[a-zA-Z0-9_-s$.]/, peg$c51 = peg$classExpectation([['a', 'z'], ['A', 'Z'], ['0', '9'], ['_', 's'], '$', '.'], false, false), peg$c52 = function peg$c52() { var _context7; return (0, _trim["default"])(_context7 = text()).call(_context7); }, peg$c53 = function peg$c53(arg) { return (0, _trim["default"])(arg).call(arg); }, peg$c54 = /^[a-zA-Z0-9_-s$.[\]"s]/, peg$c55 = peg$classExpectation([['a', 'z'], ['A', 'Z'], ['0', '9'], ['_', 's'], '$', '.', '[', ']', '"', 's'], false, false), peg$c56 = function peg$c56(sym) { var _context8; return (0, _trim["default"])(_context8 = sym.join('')).call(_context8); }, peg$c57 = '"', peg$c58 = peg$literalExpectation('"', false), peg$c59 = /^[a-zA-Z0-9_-s\\$]/, peg$c60 = peg$classExpectation([['a', 'z'], ['A', 'Z'], ['0', '9'], ['_', 's'], '\\', '$'], false, false), peg$c61 = function peg$c61(q1, name, q2) { var _context9; return (q1 || '') + (0, _trim["default"])(_context9 = name.join('')).call(_context9) + (q2 || ''); }, peg$c62 = function peg$c62(value) { return value.length === 0 ? null : (0, _map["default"])(value).call(value, function (arr) { return arr[1]; }).join(''); }, peg$currPos = 0, peg$savedPos = 0, peg$posDetailsCache = [{ line: 1, column: 1 }], peg$maxFailPos = 0, peg$maxFailExpected = [], peg$silentFails = 0, peg$result; if ('startRule' in options) { if (!(options.startRule in peg$startRuleFunctions)) { throw new Error("Can't start parsing from rule \"".concat(options.startRule, "\".")); } peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; } function text() { return input.substring(peg$savedPos, peg$currPos); } function location() { return peg$computeLocation(peg$savedPos, peg$currPos); } function expected(description, location) { location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildStructuredError([peg$otherExpectation(description)], input.substring(peg$savedPos, peg$currPos), location); } function error(message, location) { location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildSimpleError(message, location); } function peg$literalExpectation(text, ignoreCase) { return { type: 'literal', text: text, ignoreCase: ignoreCase }; } function peg$classExpectation(parts, inverted, ignoreCase) { return { type: 'class', parts: parts, inverted: inverted, ignoreCase: ignoreCase }; } function peg$anyExpectation() { return { type: 'any' }; } function peg$endExpectation() { return { type: 'end' }; } function peg$otherExpectation(description) { return { type: 'other', description: description }; } function peg$computePosDetails(pos) { var details = peg$posDetailsCache[pos], p; if (details) { return details; } else { p = pos - 1; while (!peg$posDetailsCache[p]) { p--; } details = peg$posDetailsCache[p]; details = { line: details.line, column: details.column }; while (p < pos) { if (input.charCodeAt(p) === 10) { details.line++; details.column = 1; } else { details.column++; } p++; } peg$posDetailsCache[pos] = details; return details; } } function peg$computeLocation(startPos, endPos) { var startPosDetails = peg$computePosDetails(startPos), endPosDetails = peg$computePosDetails(endPos); return { start: { offset: startPos, line: startPosDetails.line, column: startPosDetails.column }, end: { offset: endPos, line: endPosDetails.line, column: endPosDetails.column } }; } function peg$fail(expected) { if (peg$currPos < peg$maxFailPos) { return; } if (peg$currPos > peg$maxFailPos) { peg$maxFailPos = peg$currPos; peg$maxFailExpected = []; } peg$maxFailExpected.push(expected); } function peg$buildSimpleError(message, location) { return new peg$SyntaxError(message, null, null, location); } function peg$buildStructuredError(expected, found, location) { return new peg$SyntaxError(peg$SyntaxError.buildMessage(expected, found), expected, found, location); } function peg$parsetots() { var s0, s1; s0 = []; s1 = peg$parsetot(); if (s1 !== peg$FAILED) { while (s1 !== peg$FAILED) { s0.push(s1); s1 = peg$parsetot(); } } else { s0 = peg$FAILED; } return s0; } function peg$parsetot() { var s0, s1, s2, s3, s4, s5, s6; s0 = peg$currPos; s1 = []; s2 = peg$currPos; s3 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 123) { s4 = peg$c0; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c1); } } peg$silentFails--; if (s4 === peg$FAILED) { s3 = void 0; } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { if (input.length > peg$currPos) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c2); } } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$currPos; s3 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 123) { s4 = peg$c0; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c1); } } peg$silentFails--; if (s4 === peg$FAILED) { s3 = void 0; } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { if (input.length > peg$currPos) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c2); } } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } if (s1 !== peg$FAILED) { s2 = peg$parseTEMPLATE(); if (s2 !== peg$FAILED) { s3 = []; s4 = peg$currPos; s5 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 123) { s6 = peg$c0; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c1); } } peg$silentFails--; if (s6 === peg$FAILED) { s5 = void 0; } else { peg$currPos = s5; s5 = peg$FAILED; } if (s5 !== peg$FAILED) { if (input.length > peg$currPos) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c2); } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$currPos; s5 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 123) { s6 = peg$c0; peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c1); } } peg$silentFails--; if (s6 === peg$FAILED) { s5 = void 0; } else { peg$currPos = s5; s5 = peg$FAILED; } if (s5 !== peg$FAILED) { if (input.length > peg$currPos) { s6 = input.charAt(peg$currPos); peg$currPos++; } else { s6 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c2); } } if (s6 !== peg$FAILED) { s5 = [s5, s6]; s4 = s5; } else { peg$currPos = s4; s4 = peg$FAILED; } } else { peg$currPos = s4; s4 = peg$FAILED; } } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c3(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseTEMPLATE() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { s1 = peg$c0; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c1); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); if (s2 !== peg$FAILED) { s3 = peg$parseOPERATORS(); if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { s4 = peg$parse_(); if (s4 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 123) { s5 = peg$c0; peg$currPos++; } else { s5 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c1); } } if (s5 !== peg$FAILED) { s6 = peg$parse_(); if (s6 !== peg$FAILED) { s7 = peg$parseJP(); if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { s8 = peg$parse_(); if (s8 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { s9 = peg$c4; peg$currPos++; } else { s9 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s9 !== peg$FAILED) { s10 = peg$parse_(); if (s10 !== peg$FAILED) { s11 = peg$parsePIPES(); if (s11 === peg$FAILED) { s11 = null; } if (s11 !== peg$FAILED) { s12 = peg$parse_(); if (s12 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { s13 = peg$c4; peg$currPos++; } else { s13 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c5); } } if (s13 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c6(s3, s7, s11); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseOPERATORS() { var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; s0 = peg$currPos; s1 = peg$parseINCEPTION_OP(); if (s1 === peg$FAILED) { s1 = null; } if (s1 !== peg$FAILED) { s2 = peg$parsePIPE_SEPARATOR(); if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = peg$parseENUMERATION_OP(); if (s3 === peg$FAILED) { s3 = null; } if (s3 !== peg$FAILED) { s4 = peg$parsePIPE_SEPARATOR(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parseSYMBOL_OP(); if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { s6 = peg$parsePIPE_SEPARATOR(); if (s6 === peg$FAILED) { s6 = null; } if (s6 !== peg$FAILED) { s7 = peg$parseCONSTRAINT_OP(); if (s7 === peg$FAILED) { s7 = null; } if (s7 !== peg$FAILED) { s8 = peg$parsePIPE_SEPARATOR(); if (s8 === peg$FAILED) { s8 = null; } if (s8 !== peg$FAILED) { s9 = peg$parseQUERY_OP(); if (s9 === peg$FAILED) { s9 = null; } if (s9 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c7(s1, s3, s5, s7, s9); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseINCEPTION_OP() { var s0, s1, s2, s3; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s1 = peg$c8; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s1 !== peg$FAILED) { s2 = peg$parseINTEGER(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c10(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s1 = peg$c8; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 42) { s2 = peg$c11; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c10(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 46) { s1 = peg$c8; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } if (s1 !== peg$FAILED) { s2 = []; if (input.charCodeAt(peg$currPos) === 46) { s3 = peg$c8; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } while (s3 !== peg$FAILED) { s2.push(s3); if (input.charCodeAt(peg$currPos) === 46) { s3 = peg$c8; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c9); } } } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c13(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { s1 = peg$c14; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c15); } } if (s1 !== peg$FAILED) { s2 = peg$parseINTEGER(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c10(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { s1 = peg$c14; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c15); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 42) { s2 = peg$c11; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c10(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { s1 = peg$c14; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c15); } } if (s1 !== peg$FAILED) { s2 = []; if (input.charCodeAt(peg$currPos) === 62) { s3 = peg$c14; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c15); } } while (s3 !== peg$FAILED) { s2.push(s3); if (input.charCodeAt(peg$currPos) === 62) { s3 = peg$c14; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c15); } } } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c13(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 37) { s1 = peg$c16; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c17); } } if (s1 !== peg$FAILED) { s2 = peg$parseINTEGER(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c10(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 37) { s1 = peg$c16; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c17); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 42) { s2 = peg$c11; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c10(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 37) { s1 = peg$c16; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c17); } } if (s1 !== peg$FAILED) { s2 = []; if (input.charCodeAt(peg$currPos) === 37) { s3 = peg$c16; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c17); } } while (s3 !== peg$FAILED) { s2.push(s3); if (input.charCodeAt(peg$currPos) === 37) { s3 = peg$c16; peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c17); } } } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c13(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } } } } } } } } return s0; } function peg$parseENUMERATION_OP() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 42) { s1 = peg$c11; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 42) { s2 = peg$c11; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c18(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseSYMBOL_OP() { var s0, s1, s2; s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 58) { s1 = peg$c19; peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s1 !== peg$FAILED) { s2 = peg$parseSYMBOL(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c21(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; if (peg$c22.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c23); } } if (s1 !== peg$FAILED) { s2 = peg$parseSYMBOL(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c21(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } return s0; } function peg$parseDEFAULT_VALUE() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 58) { s2 = peg$c19; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c20); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { s4 = peg$parseVALUE(); if (s4 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c24(s4); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseCONSTRAINT_OP() { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; if (peg$c25.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c26); } } if (s1 !== peg$FAILED) { if (peg$c27.test(input.charAt(peg$currPos))) { s2 = input.charAt(peg$currPos); peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c28); } } if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { s4 = peg$parseSOURCE_NAME(); if (s4 === peg$FAILED) { s4 = null; } if (s4 !== peg$FAILED) { s5 = peg$parseDEFAULT_VALUE(); if (s5 === peg$FAILED) { s5 = null; } if (s5 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c29(s1, s2, s4, s5); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseQUERY_OP() { var s0, s1, s2; s0 = peg$currPos; if (peg$c30.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c31); } } if (s1 !== peg$FAILED) { s2 = peg$parseINTEGER(); if (s2 === peg$FAILED) { s2 = null; } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c32(s1, s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } return s0; } function peg$parseJP() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = []; s2 = peg$currPos; s3 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 125) { s4 = peg$c4; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c5); } } peg$silentFails--; if (s4 === peg$FAILED) { s3 = void 0; } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { if (input.length > peg$currPos) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c2); } } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } while (s2 !== peg$FAILED) { s1.push(s2); s2 = peg$currPos; s3 = peg$currPos; peg$silentFails++; if (input.charCodeAt(peg$currPos) === 125) { s4 = peg$c4; peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c5); } } peg$silentFails--; if (s4 === peg$FAILED) { s3 = void 0; } else { peg$currPos = s3; s3 = peg$FAILED; } if (s3 !== peg$FAILED) { if (input.length > peg$currPos) { s4 = input.charAt(peg$currPos); peg$currPos++; } else { s4 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c2); } } if (s4 !== peg$FAILED) { s3 = [s3, s4]; s2 = s3; } else { peg$currPos = s2; s2 = peg$FAILED; } } else { peg$currPos = s2; s2 = peg$FAILED; } } if (s1 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c33(); } s0 = s1; return s0; } function peg$parsePIPES() { var s0, s1; s0 = []; s1 = peg$parsePipe(); while (s1 !== peg$FAILED) { s0.push(s1); s1 = peg$parsePipe(); } if (s0 === peg$FAILED) { s0 = peg$parseSPREAD_OPERATOR(); } return s0; } function peg$parsePipe() { var s0, s1, s2, s3, s4; s0 = peg$currPos; s1 = peg$parsePIPE_SEPARATOR(); if (s1 !== peg$FAILED) { s2 = peg$parseFUNCTION_NAME(); if (s2 !== peg$FAILED) { s3 = []; s4 = peg$parseARG(); while (s4 !== peg$FAILED) { s3.push(s4); s4 = peg$parseARG(); } if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c34(s2, s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsePIPE_SEPARATOR(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 64) { s2 = peg$c35; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c36); } } if (s2 !== peg$FAILED) { s3 = peg$parseFUNCTION_NAME(); if (s3 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c37(s3); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parsePIPE_SEPARATOR(); if (s1 !== peg$FAILED) { s2 = peg$parseSPREAD_OPERATOR(); if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c38(s2); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } } } return s0; } function peg$parseSPREAD_OPERATOR() { var s0; if (input.substr(peg$currPos, 2) === peg$c39) { s0 = peg$c39; peg$currPos += 2; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c40); } } if (s0 === peg$FAILED) { if (input.charCodeAt(peg$currPos) === 42) { s0 = peg$c11; peg$currPos++; } else { s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c12); } } } return s0; } function peg$parseINTEGER() { var s0, s1, s2, s3; peg$silentFails++; s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { s2 = []; if (peg$c42.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c43); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); if (peg$c42.test(input.charAt(peg$currPos))) { s3 = input.charAt(peg$currPos); peg$currPos++; } else { s3 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c43); } } } } else { s2 = peg$FAILED; } if (s2 !== peg$FAILED) { peg$savedPos = s0; s1 = peg$c44(); s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; } } else { peg$currPos = s0; s0 = peg$FAILED; } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c41); } } return s0; } function peg$parse_() { var s0, s1; peg$silentFails++; s0 = []; if (peg$c46.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c47); } } while (s1 !== peg$FAILED) { s0.push(s1); if (peg$c46.test(input.charAt(peg$currPos))) { s1 = input.charAt(peg$currPos); peg$currPos++; } else { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c47); } } } peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c45); } } return s0; } function peg$parsePIPE_SEPARATOR() { var s0, s1, s2, s3; s0 = peg$currPos; s1 = peg$parse_(); if (s1 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 124) { s2 = peg$c48; peg$currPos++; } else { s2 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$c49); } } if (s2 !== peg$FAILED) { s3 = peg$parse_(); if (s3 !== peg$FAILED) { s1 =