diff --git a/bin/to-js.js b/bin/to-js.js index 3f9b24f..beabae1 100644 --- a/bin/to-js.js +++ b/bin/to-js.js @@ -1,7 +1,7 @@ #!/usr/bin/env node import { readFile } from 'fs/promises' -import * as parser from '../lib/parser.cjs' +import parser from '../lib/parser.cjs' import { transformError } from '../lib/util.js' import { collectInput } from './collect-input.js' import { Builder, safeReference } from '../lib/typed.js' diff --git a/bin/to-json.js b/bin/to-json.js index a51e631..3e6b5a8 100755 --- a/bin/to-json.js +++ b/bin/to-json.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -import * as parser from '../lib/parser.cjs' +import parser from '../lib/parser.cjs' import { transformError } from '../lib/util.js' import { collectInput } from './collect-input.js' diff --git a/bin/to-schema.js b/bin/to-schema.js index a543587..87a4578 100644 --- a/bin/to-schema.js +++ b/bin/to-schema.js @@ -1,6 +1,6 @@ #!/usr/bin/env node -import * as parser from '../lib/parser.cjs' +import parser from '../lib/parser.cjs' import { toDSL } from '../lib/to-dsl.js' import { transformError } from '../lib/util.js' import { collectInput } from './collect-input.js' diff --git a/bin/validate.js b/bin/validate.js index e15c569..10af39e 100644 --- a/bin/validate.js +++ b/bin/validate.js @@ -1,4 +1,4 @@ -import * as parser from '../lib/parser.cjs' +import parser from '../lib/parser.cjs' import { transformError } from '../lib/util.js' import { collectInput } from './collect-input.js' diff --git a/lib/from-dsl.js b/lib/from-dsl.js index 2010c71..488a9e2 100644 --- a/lib/from-dsl.js +++ b/lib/from-dsl.js @@ -1,4 +1,4 @@ -import * as parser from './parser.cjs' +import parser from './parser.cjs' import { transformError } from './util.js' /** diff --git a/lib/parser.cjs b/lib/parser.cjs index b3eed80..e3a4dcd 100644 --- a/lib/parser.cjs +++ b/lib/parser.cjs @@ -1,63 +1,102 @@ // @ts-nocheck -/* - * Generated by PEG.js 0.10.0. - * - * http://pegjs.org/ - */ +// @generated by Peggy 4.0.3. +// +// https://peggyjs.org/ "use strict"; + function peg$subclass(child, parent) { - function ctor() { this.constructor = child; } - ctor.prototype = parent.prototype; - child.prototype = new ctor(); + function C() { this.constructor = child; } + C.prototype = parent.prototype; + child.prototype = new C(); } 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); - } + var self = Error.call(this, message); + // istanbul ignore next Check is a necessary evil to support older environments + if (Object.setPrototypeOf) { + Object.setPrototypeOf(self, peg$SyntaxError.prototype); + } + self.expected = expected; + self.found = found; + self.location = location; + self.name = "SyntaxError"; + return self; } peg$subclass(peg$SyntaxError, Error); +function peg$padEnd(str, targetLength, padString) { + padString = padString || " "; + if (str.length > targetLength) { return str; } + targetLength -= str.length; + padString += padString.repeat(targetLength); + return str + padString.slice(0, targetLength); +} + +peg$SyntaxError.prototype.format = function(sources) { + var str = "Error: " + this.message; + if (this.location) { + var src = null; + var k; + for (k = 0; k < sources.length; k++) { + if (sources[k].source === this.location.source) { + src = sources[k].text.split(/\r\n|\n|\r/g); + break; + } + } + var s = this.location.start; + var offset_s = (this.location.source && (typeof this.location.source.offset === "function")) + ? this.location.source.offset(s) + : s; + var loc = this.location.source + ":" + offset_s.line + ":" + offset_s.column; + if (src) { + var e = this.location.end; + var filler = peg$padEnd("", offset_s.line.toString().length, ' '); + var line = src[s.line - 1]; + var last = s.line === e.line ? e.column : line.length + 1; + var hatLen = (last - s.column) || 1; + str += "\n --> " + loc + "\n" + + filler + " |\n" + + offset_s.line + " | " + line + "\n" + + filler + " | " + peg$padEnd("", s.column - 1, ' ') + + peg$padEnd("", hatLen, "^"); + } else { + str += "\n at " + loc; + } + } + return str; +}; + peg$SyntaxError.buildMessage = function(expected, found) { var DESCRIBE_EXPECTATION_FNS = { - literal: function(expectation) { - return "\"" + literalEscape(expectation.text) + "\""; - }, - - "class": function(expectation) { - var escapedParts = "", - i; - - for (i = 0; i < expectation.parts.length; i++) { - escapedParts += expectation.parts[i] instanceof Array - ? classEscape(expectation.parts[i][0]) + "-" + classEscape(expectation.parts[i][1]) - : classEscape(expectation.parts[i]); - } + literal: function(expectation) { + return "\"" + literalEscape(expectation.text) + "\""; + }, - return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; - }, + class: function(expectation) { + var escapedParts = expectation.parts.map(function(part) { + return Array.isArray(part) + ? classEscape(part[0]) + "-" + classEscape(part[1]) + : classEscape(part); + }); - any: function(expectation) { - return "any character"; - }, + return "[" + (expectation.inverted ? "^" : "") + escapedParts.join("") + "]"; + }, - end: function(expectation) { - return "end of input"; - }, + any: function() { + return "any character"; + }, - other: function(expectation) { - return expectation.description; - } - }; + end: function() { + return "end of input"; + }, + + other: function(expectation) { + return expectation.description; + } + }; function hex(ch) { return ch.charCodeAt(0).toString(16).toUpperCase(); @@ -65,28 +104,28 @@ peg$SyntaxError.buildMessage = function(expected, found) { 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' + hex(ch); }) - .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + .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" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + 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' + hex(ch); }) - .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return '\\x' + hex(ch); }); + .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" + hex(ch); }) + .replace(/[\x10-\x1F\x7F-\x9F]/g, function(ch) { return "\\x" + hex(ch); }); } function describeExpectation(expectation) { @@ -94,12 +133,8 @@ peg$SyntaxError.buildMessage = function(expected, found) { } function describeExpected(expected) { - var descriptions = new Array(expected.length), - i, j; - - for (i = 0; i < expected.length; i++) { - descriptions[i] = describeExpectation(expected[i]); - } + var descriptions = expected.map(describeExpectation); + var i, j; descriptions.sort(); @@ -135,357 +170,390 @@ peg$SyntaxError.buildMessage = function(expected, found) { }; function peg$parse(input, options) { - options = options !== void 0 ? options : {}; - - var peg$FAILED = {}, - - peg$startRuleFunctions = { Root: peg$parseRoot }, - peg$startRuleFunction = peg$parseRoot, + options = options !== undefined ? options : {}; + + var peg$FAILED = {}; + var peg$source = options.grammarSource; + + var peg$startRuleFunctions = { Root: peg$parseRoot }; + var peg$startRuleFunction = peg$parseRoot; + + var peg$c0 = "type"; + var peg$c1 = "advanced"; + var peg$c2 = "map"; + var peg$c3 = "list"; + var peg$c4 = "enum"; + var peg$c5 = "union"; + var peg$c6 = "struct"; + var peg$c7 = "bytes"; + var peg$c8 = "["; + var peg$c9 = "]"; + var peg$c10 = "&"; + var peg$c11 = "="; + var peg$c12 = "{"; + var peg$c13 = "}"; + var peg$c14 = "|"; + var peg$c15 = "("; + var peg$c16 = ")"; + var peg$c17 = ":"; + var peg$c18 = "optional"; + var peg$c19 = "nullable"; + var peg$c20 = "implicit"; + var peg$c21 = "rename"; + var peg$c22 = "true"; + var peg$c23 = "false"; + var peg$c24 = "representation"; + var peg$c25 = "keyed"; + var peg$c26 = "kinded"; + var peg$c27 = "stringprefix"; + var peg$c28 = "bytesprefix"; + var peg$c29 = "inline"; + var peg$c30 = "envelope"; + var peg$c31 = "discriminantKey"; + var peg$c32 = "contentKey"; + var peg$c33 = "listpairs"; + var peg$c34 = "stringpairs"; + var peg$c35 = "innerDelim"; + var peg$c36 = "entryDelim"; + var peg$c37 = "tuple"; + var peg$c38 = "stringjoin"; + var peg$c39 = "field"; + var peg$c40 = "fieldOrder"; + var peg$c41 = "join"; + var peg$c42 = "string"; + var peg$c43 = "int"; + var peg$c44 = ","; + var peg$c45 = "\""; + var peg$c46 = "bool"; + var peg$c47 = "float"; + var peg$c48 = "link"; + var peg$c49 = "null"; + var peg$c50 = "any"; + var peg$c51 = "#"; + var peg$c52 = "\r"; + var peg$c53 = "\n"; + + var peg$r0 = /^[^"]/; + var peg$r1 = /^[a-zA-Z]/; + var peg$r2 = /^[a-zA-Z0-9_]/; + var peg$r3 = /^[0-9]/; + var peg$r4 = /^[ \t\n\r]/; + var peg$r5 = /^[^\r\n]/; + var peg$r6 = /^[\r\n]/; + + var peg$e0 = peg$literalExpectation("type", false); + var peg$e1 = peg$literalExpectation("advanced", false); + var peg$e2 = peg$literalExpectation("map", false); + var peg$e3 = peg$literalExpectation("list", false); + var peg$e4 = peg$literalExpectation("enum", false); + var peg$e5 = peg$literalExpectation("union", false); + var peg$e6 = peg$literalExpectation("struct", false); + var peg$e7 = peg$literalExpectation("bytes", false); + var peg$e8 = peg$literalExpectation("[", false); + var peg$e9 = peg$literalExpectation("]", false); + var peg$e10 = peg$literalExpectation("&", false); + var peg$e11 = peg$literalExpectation("=", false); + var peg$e12 = peg$literalExpectation("{", false); + var peg$e13 = peg$literalExpectation("}", false); + var peg$e14 = peg$literalExpectation("|", false); + var peg$e15 = peg$literalExpectation("(", false); + var peg$e16 = peg$literalExpectation(")", false); + var peg$e17 = peg$literalExpectation(":", false); + var peg$e18 = peg$literalExpectation("optional", false); + var peg$e19 = peg$literalExpectation("nullable", false); + var peg$e20 = peg$literalExpectation("implicit", false); + var peg$e21 = peg$literalExpectation("rename", false); + var peg$e22 = peg$literalExpectation("true", false); + var peg$e23 = peg$literalExpectation("false", false); + var peg$e24 = peg$literalExpectation("representation", false); + var peg$e25 = peg$literalExpectation("keyed", false); + var peg$e26 = peg$literalExpectation("kinded", false); + var peg$e27 = peg$literalExpectation("stringprefix", false); + var peg$e28 = peg$literalExpectation("bytesprefix", false); + var peg$e29 = peg$literalExpectation("inline", false); + var peg$e30 = peg$literalExpectation("envelope", false); + var peg$e31 = peg$literalExpectation("discriminantKey", false); + var peg$e32 = peg$literalExpectation("contentKey", false); + var peg$e33 = peg$literalExpectation("listpairs", false); + var peg$e34 = peg$literalExpectation("stringpairs", false); + var peg$e35 = peg$literalExpectation("innerDelim", false); + var peg$e36 = peg$literalExpectation("entryDelim", false); + var peg$e37 = peg$literalExpectation("tuple", false); + var peg$e38 = peg$literalExpectation("stringjoin", false); + var peg$e39 = peg$literalExpectation("field", false); + var peg$e40 = peg$literalExpectation("fieldOrder", false); + var peg$e41 = peg$literalExpectation("join", false); + var peg$e42 = peg$literalExpectation("string", false); + var peg$e43 = peg$literalExpectation("int", false); + var peg$e44 = peg$literalExpectation(",", false); + var peg$e45 = peg$literalExpectation("\"", false); + var peg$e46 = peg$classExpectation(["\""], true, false); + var peg$e47 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false); + var peg$e48 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false); + var peg$e49 = peg$classExpectation([["0", "9"]], false, false); + var peg$e50 = peg$literalExpectation("bool", false); + var peg$e51 = peg$literalExpectation("float", false); + var peg$e52 = peg$literalExpectation("link", false); + var peg$e53 = peg$literalExpectation("null", false); + var peg$e54 = peg$literalExpectation("any", false); + var peg$e55 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false); + var peg$e56 = peg$literalExpectation("#", false); + var peg$e57 = peg$classExpectation(["\r", "\n"], true, false); + var peg$e58 = peg$classExpectation(["\r", "\n"], false, false); + var peg$e59 = peg$literalExpectation("\r", false); + var peg$e60 = peg$literalExpectation("\n", false); + + var peg$f0 = function(roots) { + // merge 'type' and 'advanced' structures into one {types:{}, advanced:{}} + return roots.reduce((o1, o2) => { + if (o2.types) { + if (!o1.types) { + o1.types = {} + } + Object.assign(o1.types, o2.types) + } else if (o2.advanced) { + if (!o1.advanced) { + o1.advanced = {} + } + Object.assign(o1.advanced, o2.advanced) + } + return o1 + }, {}) +}; + var peg$f1 = function(types) { return { types } }; + var peg$f2 = function(advanced) { return { advanced } }; + var peg$f3 = function(name, definition) { + return { [name]: definition } +}; + var peg$f4 = function(name) { + return { [name]: { advanced: {} } } +}; + var peg$f5 = function(name) { + return { advanced: name } +}; + var peg$f6 = function(descriptor) { return descriptor }; + var peg$f7 = function(descriptor) { return descriptor }; + var peg$f8 = function(descriptor) { return descriptor }; + var peg$f9 = function(descriptor) { return descriptor }; + var peg$f10 = function(descriptor) { return descriptor }; + var peg$f11 = function(descriptor) { return descriptor }; + var peg$f12 = function(descriptor) { return descriptor }; + var peg$f13 = function(descriptor) { return descriptor }; + var peg$f14 = function(kind) { return { [kind]: {} } }; + var peg$f15 = function(kind) { return kind }; + var peg$f16 = function(fields, representation) { + return { list: Object.assign({}, fields, representation ? { representation } : null) } +}; + var peg$f17 = function(options, valueType) { + return options.reduce(extend, { valueType }) +}; + var peg$f18 = function(expectedType) { + return { link: { expectedType } } +}; + var peg$f19 = function(fromType) { + return { copy: { fromType } } +}; + var peg$f20 = function(members, representation) { + if (!representation || !(representation.string || representation.int)) { + representation = { string: {} } + } - peg$c0 = function(roots) { - // merge 'type' and 'advanced' structures into one {types:{}, advanced:{}} - return roots.reduce((o1, o2) => { - if (o2.types) { - if (!o1.types) { - o1.types = {} - } - Object.assign(o1.types, o2.types) - } else if (o2.advanced) { - if (!o1.advanced) { - o1.advanced = {} - } - Object.assign(o1.advanced, o2.advanced) - } - return o1 - }, {}) - }, - peg$c1 = function(types) { return { types } }, - peg$c2 = function(advanced) { return { advanced } }, - peg$c3 = "type", - peg$c4 = peg$literalExpectation("type", false), - peg$c5 = function(name, definition) { - return { [name]: definition } - }, - peg$c6 = "advanced", - peg$c7 = peg$literalExpectation("advanced", false), - peg$c8 = function(name) { - return { [name]: { advanced: {} } } - }, - peg$c9 = function(name) { - return { advanced: name } - }, - peg$c10 = function(descriptor) { return descriptor }, - peg$c11 = function(kind) { return { [kind]: {} } }, - peg$c12 = "map", - peg$c13 = peg$literalExpectation("map", false), - peg$c14 = "list", - peg$c15 = peg$literalExpectation("list", false), - peg$c16 = "enum", - peg$c17 = peg$literalExpectation("enum", false), - peg$c18 = "union", - peg$c19 = peg$literalExpectation("union", false), - peg$c20 = "struct", - peg$c21 = peg$literalExpectation("struct", false), - peg$c22 = "bytes", - peg$c23 = peg$literalExpectation("bytes", false), - peg$c24 = function(kind) { return kind }, - peg$c25 = "[", - peg$c26 = peg$literalExpectation("[", false), - peg$c27 = "]", - peg$c28 = peg$literalExpectation("]", false), - peg$c29 = function(fields, representation) { - return { list: Object.assign({}, fields, representation ? { representation } : null) } - }, - peg$c30 = function(options, valueType) { - return options.reduce(extend, { valueType }) - }, - peg$c31 = "&", - peg$c32 = peg$literalExpectation("&", false), - peg$c33 = function(expectedType) { - return { link: { expectedType } } - }, - peg$c34 = "=", - peg$c35 = peg$literalExpectation("=", false), - peg$c36 = function(fromType) { - return { copy: { fromType } } - }, - peg$c37 = "{", - peg$c38 = peg$literalExpectation("{", false), - peg$c39 = "}", - peg$c40 = peg$literalExpectation("}", false), - peg$c41 = function(members, representation) { - if (!representation || !(representation.string || representation.int)) { - representation = { string: {} } - } + const repr = members.filter((m) => Object.values(m)[0]).reduce(extend, {}) + members = Object.keys(members.reduce(extend, {})) - const repr = members.filter((m) => Object.values(m)[0]).reduce(extend, {}) - members = Object.keys(members.reduce(extend, {})) - - if (representation.string) { - representation.string = repr - } else if (representation.int) { - representation.int = repr - Object.entries(repr).forEach(([k, v]) => { - const i = parseInt(v, 10) - if (i != v) { - throw new Error('int representations only support integer representation values') - } - repr[k] = i - }) - } + if (representation.string) { + representation.string = repr + } else if (representation.int) { + representation.int = repr + Object.entries(repr).forEach(([k, v]) => { + const i = parseInt(v, 10) + if (i != v) { + throw new Error('int representations only support integer representation values') + } + repr[k] = i + }) + } - return { enum: { members, representation } } - }, - peg$c42 = "|", - peg$c43 = peg$literalExpectation("|", false), - peg$c44 = function(name, representationOptions) { - return { [name]: representationOptions } - }, - peg$c45 = "(", - peg$c46 = peg$literalExpectation("(", false), - peg$c47 = ")", - peg$c48 = peg$literalExpectation(")", false), - peg$c49 = function(value) { return value }, - peg$c50 = function(values, representation) { - let fields = values.reduce(extend, {}) - if (representation.keyed) { - representation.keyed = fields - } else if (representation.kinded) { - representation.kinded = fields - } else if (representation.stringprefix) { - representation.stringprefix = { prefixes: fields } - } else if (representation.bytesprefix) { - representation.bytesprefix = { prefixes: fields } - } else if (representation.inline) { - representation.inline.discriminantTable = fields - } else if (representation.envelope) { - representation.envelope.discriminantTable = fields - } else { - throw new Error('Unsupported union type') // we shouldn't get here if we're coded right - } - return { union: { members: Object.values(fields), representation } } - }, - peg$c51 = function(type, name) { - return { [name]: type } - }, - peg$c52 = ":", - peg$c53 = peg$literalExpectation(":", false), - peg$c54 = function(keyType, valueType, representation) { - let representationType = (representation && representation.type) - if (representationType) { - representation = { [representationType]: representation || {} } - delete representation[representationType].type - } - return { map: Object.assign({ keyType }, valueType, representation ? { representation } : null) } - }, - peg$c55 = function(values, representation) { - let fields = values.reduce(extend, {}) - // field representation options can come in from parens following field definitions, we need - // to lift them out into the 'representation' object - const representationFields = Object.entries(fields).reduce((p, fieldEntry) => { - if (fieldEntry[1].representationOptions) { - p[fieldEntry[0]] = fieldEntry[1].representationOptions - delete fieldEntry[1].representationOptions - } - return p - }, {}) - let representationType = (representation && representation.type) - if (representationType) { - // restructure from { type: 'foo', bar: 'baz' } to { foo: { bar: 'baz' } } - representation = { [representationType]: representation || {} } - delete representation[representationType].type - /* auto-fill fieldOrder? if (representationType === 'tuple' && !representation.tuple.fieldOrder) { - representation.tuple.fieldOrder = Object.keys(fields) - } */ - } - // handle inline field representation data - if (Object.keys(representationFields).length) { - if (!representation) { - representation = defaultStructRepresentation() - } - if (!representation.map) { - throw new Error('field modifiers only valid for struct map representation') - } - representation.map.fields = representationFields - } - return { struct: extend({ fields }, { representation: representation || defaultStructRepresentation() }) } - }, - peg$c56 = function(key, options, type, representationOptions) { - return { [key]: options.reduce(extend, extend({ type }, representationOptions ? { representationOptions } : null)) } - }, - peg$c57 = "optional", - peg$c58 = peg$literalExpectation("optional", false), - peg$c59 = function() { return { optional: true } }, - peg$c60 = "nullable", - peg$c61 = peg$literalExpectation("nullable", false), - peg$c62 = function() { return { nullable: true } }, - peg$c63 = function() { return { valueNullable: true } }, - peg$c64 = function(type) { return type }, - peg$c65 = function(options) { - return options.reduce(extend, {}) - }, - peg$c66 = "implicit", - peg$c67 = peg$literalExpectation("implicit", false), - peg$c68 = function(implicit) { return { implicit } }, - peg$c69 = "rename", - peg$c70 = peg$literalExpectation("rename", false), - peg$c71 = function(rename) { return { rename } }, - peg$c72 = function(implicit) { return implicit }, - peg$c73 = function(implicit) { return parseInt(implicit, 10) }, - peg$c74 = "true", - peg$c75 = peg$literalExpectation("true", false), - peg$c76 = function() { return true }, - peg$c77 = "false", - peg$c78 = peg$literalExpectation("false", false), - peg$c79 = function() { return false }, - peg$c80 = "representation", - peg$c81 = peg$literalExpectation("representation", false), - peg$c82 = function(representation) { - return representation - }, - peg$c83 = "keyed", - peg$c84 = peg$literalExpectation("keyed", false), - peg$c85 = function() { return { keyed: {} } }, - peg$c86 = "kinded", - peg$c87 = peg$literalExpectation("kinded", false), - peg$c88 = function() { return { kinded: {} } }, - peg$c89 = "stringprefix", - peg$c90 = peg$literalExpectation("stringprefix", false), - peg$c91 = function() { return { stringprefix: {} } }, - peg$c92 = "bytesprefix", - peg$c93 = peg$literalExpectation("bytesprefix", false), - peg$c94 = function() { return { bytesprefix: {} } }, - peg$c95 = "inline", - peg$c96 = peg$literalExpectation("inline", false), - peg$c97 = "envelope", - peg$c98 = peg$literalExpectation("envelope", false), - peg$c99 = "discriminantKey", - peg$c100 = peg$literalExpectation("discriminantKey", false), - peg$c101 = function(discriminantKey) { - return { inline: { discriminantKey } } - }, - peg$c102 = "contentKey", - peg$c103 = peg$literalExpectation("contentKey", false), - peg$c104 = function(discriminantKey, contentKey) { - return { envelope: { discriminantKey, contentKey } } - }, - peg$c105 = function() { return { type: 'map' } }, - peg$c106 = "listpairs", - peg$c107 = peg$literalExpectation("listpairs", false), - peg$c108 = function() { return { type: 'listpairs' } }, - peg$c109 = "stringpairs", - peg$c110 = peg$literalExpectation("stringpairs", false), - peg$c111 = function(representation) { return representation }, - peg$c112 = function(options) { - let representation = extend({ type: 'stringpairs' }, options.reduce(extend, {})) - if (!representation.innerDelim || !representation.entryDelim) { - throw new Error('"stringpairs" representation requires both "innerDelim" and "entryDelim" options') - } - return representation - }, - peg$c113 = "innerDelim", - peg$c114 = peg$literalExpectation("innerDelim", false), - peg$c115 = function(innerDelim) { return { innerDelim } }, - peg$c116 = "entryDelim", - peg$c117 = peg$literalExpectation("entryDelim", false), - peg$c118 = function(entryDelim) { return { entryDelim } }, - peg$c119 = "tuple", - peg$c120 = peg$literalExpectation("tuple", false), - peg$c121 = function(fieldOrder) { return extend({ type: 'tuple' }, fieldOrder ? { fieldOrder } : null) }, - peg$c122 = "stringjoin", - peg$c123 = peg$literalExpectation("stringjoin", false), - peg$c124 = function(fields) { return extend({ type: 'stringjoin' }, fields ) }, - peg$c125 = "field", - peg$c126 = peg$literalExpectation("field", false), - peg$c127 = function(field, isImplicit, implicitValue) { - return { [field]: extend({}, isImplicit ? { implicit: coerceValue(implicitValue) } : null) } - }, - peg$c128 = function(fieldOrder) { - return fieldOrder - }, - peg$c129 = "fieldOrder", - peg$c130 = peg$literalExpectation("fieldOrder", false), - peg$c131 = function(fields) { - fields = fields.reduce(extend, {}) - if (!fields.join) { - throw new Error('stringjoin representation needs a "join" specifier') - } - return fields - }, - peg$c132 = "join", - peg$c133 = peg$literalExpectation("join", false), - peg$c134 = function(join) { - return { join } - }, - peg$c135 = function(fieldOrder) { - return { fieldOrder } - }, - peg$c136 = "string", - peg$c137 = peg$literalExpectation("string", false), - peg$c138 = function() { return { string: {} } }, - peg$c139 = "int", - peg$c140 = peg$literalExpectation("int", false), - peg$c141 = function() { return { int: {} } }, - peg$c142 = function(representation) { return { bytes: { representation } } }, - peg$c143 = ",", - peg$c144 = peg$literalExpectation(",", false), - peg$c145 = function(firstElement, s) { return s }, - peg$c146 = function(firstElement, subsequentElements) { - if (!firstElement) { - return [] - } - if (!subsequentElements) { - return [ firstElement ] - } - return [ firstElement ].concat(subsequentElements) - }, - peg$c147 = "\"", - peg$c148 = peg$literalExpectation("\"", false), - peg$c149 = /^[^"]/, - peg$c150 = peg$classExpectation(["\""], true, false), - peg$c151 = function(chars) { return chars.join('') }, - peg$c152 = /^[a-zA-Z]/, - peg$c153 = peg$classExpectation([["a", "z"], ["A", "Z"]], false, false), - peg$c154 = /^[a-zA-Z0-9_]/, - peg$c155 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_"], false, false), - peg$c156 = function(first, remainder) { return first + remainder.join('') }, - peg$c157 = /^[0-9]/, - peg$c158 = peg$classExpectation([["0", "9"]], false, false), - peg$c159 = function(chars) { return parseInt(chars.join(''), 10) }, - peg$c160 = "bool", - peg$c161 = peg$literalExpectation("bool", false), - peg$c162 = "float", - peg$c163 = peg$literalExpectation("float", false), - peg$c164 = "link", - peg$c165 = peg$literalExpectation("link", false), - peg$c166 = "null", - peg$c167 = peg$literalExpectation("null", false), - peg$c168 = "any", - peg$c169 = peg$literalExpectation("any", false), - peg$c170 = /^[ \t\n\r]/, - peg$c171 = peg$classExpectation([" ", "\t", "\n", "\r"], false, false), - peg$c172 = "#", - peg$c173 = peg$literalExpectation("#", false), - peg$c174 = /^[^\r\n]/, - peg$c175 = peg$classExpectation(["\r", "\n"], true, false), - peg$c176 = /^[\r\n]/, - peg$c177 = peg$classExpectation(["\r", "\n"], false, false), - peg$c178 = function() { return }, - peg$c179 = "\r", - peg$c180 = peg$literalExpectation("\r", false), - peg$c181 = "\n", - peg$c182 = peg$literalExpectation("\n", false), - - 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) { + return { enum: { members, representation } } +}; + var peg$f21 = function(name, representationOptions) { + return { [name]: representationOptions } +}; + var peg$f22 = function(value) { return value }; + var peg$f23 = function(values, representation) { + let fields = values.reduce(extend, {}) + if (representation.keyed) { + representation.keyed = fields + } else if (representation.kinded) { + representation.kinded = fields + } else if (representation.stringprefix) { + representation.stringprefix = { prefixes: fields } + } else if (representation.bytesprefix) { + representation.bytesprefix = { prefixes: fields } + } else if (representation.inline) { + representation.inline.discriminantTable = fields + } else if (representation.envelope) { + representation.envelope.discriminantTable = fields + } else { + throw new Error('Unsupported union type') // we shouldn't get here if we're coded right + } + return { union: { members: Object.values(fields), representation } } +}; + var peg$f24 = function(type, name) { + return { [name]: type } +}; + var peg$f25 = function(keyType, valueType, representation) { + let representationType = (representation && representation.type) + if (representationType) { + representation = { [representationType]: representation || {} } + delete representation[representationType].type + } + return { map: Object.assign({ keyType }, valueType, representation ? { representation } : null) } +}; + var peg$f26 = function(values, representation) { + let fields = values.reduce(extend, {}) + // field representation options can come in from parens following field definitions, we need + // to lift them out into the 'representation' object + const representationFields = Object.entries(fields).reduce((p, fieldEntry) => { + if (fieldEntry[1].representationOptions) { + p[fieldEntry[0]] = fieldEntry[1].representationOptions + delete fieldEntry[1].representationOptions + } + return p + }, {}) + let representationType = (representation && representation.type) + if (representationType) { + // restructure from { type: 'foo', bar: 'baz' } to { foo: { bar: 'baz' } } + representation = { [representationType]: representation || {} } + delete representation[representationType].type + /* auto-fill fieldOrder? if (representationType === 'tuple' && !representation.tuple.fieldOrder) { + representation.tuple.fieldOrder = Object.keys(fields) + } */ + } + // handle inline field representation data + if (Object.keys(representationFields).length) { + if (!representation) { + representation = defaultStructRepresentation() + } + if (!representation.map) { + throw new Error('field modifiers only valid for struct map representation') + } + representation.map.fields = representationFields + } + return { struct: extend({ fields }, { representation: representation || defaultStructRepresentation() }) } +}; + var peg$f27 = function(key, options, type, representationOptions) { + return { [key]: options.reduce(extend, extend({ type }, representationOptions ? { representationOptions } : null)) } +}; + var peg$f28 = function() { return { optional: true } }; + var peg$f29 = function() { return { nullable: true } }; + var peg$f30 = function() { return { optional: true } }; + var peg$f31 = function() { return { valueNullable: true } }; + var peg$f32 = function(type) { return type }; + var peg$f33 = function(options) { + return options.reduce(extend, {}) +}; + var peg$f34 = function(implicit) { return { implicit } }; + var peg$f35 = function(rename) { return { rename } }; + var peg$f36 = function(implicit) { return implicit }; + var peg$f37 = function(implicit) { return parseInt(implicit, 10) }; + var peg$f38 = function() { return true }; + var peg$f39 = function() { return false }; + var peg$f40 = function(representation) { + return representation +}; + var peg$f41 = function(representation) { + return representation +}; + var peg$f42 = function(representation) { + return representation +}; + var peg$f43 = function(representation) { + return representation +}; + var peg$f44 = function(representation) { + return representation +}; + var peg$f45 = function() { return { keyed: {} } }; + var peg$f46 = function() { return { kinded: {} } }; + var peg$f47 = function() { return { stringprefix: {} } }; + var peg$f48 = function() { return { bytesprefix: {} } }; + var peg$f49 = function(descriptor) { return descriptor }; + var peg$f50 = function(descriptor) { return descriptor }; + var peg$f51 = function(discriminantKey) { + return { inline: { discriminantKey } } +}; + var peg$f52 = function(discriminantKey, contentKey) { + return { envelope: { discriminantKey, contentKey } } +}; + var peg$f53 = function() { return { type: 'map' } }; + var peg$f54 = function() { return { type: 'listpairs' } }; + var peg$f55 = function(representation) { return representation }; + var peg$f56 = function(representation) { return representation }; + var peg$f57 = function(options) { + let representation = extend({ type: 'stringpairs' }, options.reduce(extend, {})) + if (!representation.innerDelim || !representation.entryDelim) { + throw new Error('"stringpairs" representation requires both "innerDelim" and "entryDelim" options') + } + return representation +}; + var peg$f58 = function(innerDelim) { return { innerDelim } }; + var peg$f59 = function(entryDelim) { return { entryDelim } }; + var peg$f60 = function(representation) { return representation }; + var peg$f61 = function() { return { type: 'map' } }; + var peg$f62 = function(fieldOrder) { return extend({ type: 'tuple' }, fieldOrder ? { fieldOrder } : null) }; + var peg$f63 = function(fields) { return extend({ type: 'stringjoin' }, fields ) }; + var peg$f64 = function(representation) { return representation }; + var peg$f65 = function() { return { type: 'listpairs' } }; + var peg$f66 = function(field, isImplicit, implicitValue) { + return { [field]: extend({}, isImplicit ? { implicit: coerceValue(implicitValue) } : null) } +}; + var peg$f67 = function(fieldOrder) { + return fieldOrder +}; + var peg$f68 = function(fieldOrder) { + return fieldOrder +}; + var peg$f69 = function(fields) { + fields = fields.reduce(extend, {}) + if (!fields.join) { + throw new Error('stringjoin representation needs a "join" specifier') + } + return fields +}; + var peg$f70 = function(join) { + return { join } +}; + var peg$f71 = function(fieldOrder) { + return { fieldOrder } +}; + var peg$f72 = function() { return { string: {} } }; + var peg$f73 = function() { return { int: {} } }; + var peg$f74 = function(representation) { return { bytes: { representation } } }; + var peg$f75 = function(firstElement, s) { return s }; + var peg$f76 = function(firstElement, subsequentElements) { + if (!firstElement) { + return [] + } + if (!subsequentElements) { + return [ firstElement ] + } + return [ firstElement ].concat(subsequentElements) +}; + var peg$f77 = function(chars) { return chars.join('') }; + var peg$f78 = function(first, remainder) { return first + remainder.join('') }; + var peg$f79 = function(chars) { return parseInt(chars.join(''), 10) }; + var peg$f80 = function() { return }; + var peg$currPos = options.peg$currPos | 0; + var peg$savedPos = peg$currPos; + var peg$posDetailsCache = [{ line: 1, column: 1 }]; + var peg$maxFailPos = peg$currPos; + var peg$maxFailExpected = options.peg$maxFailExpected || []; + var peg$silentFails = options.peg$silentFails | 0; + + var peg$result; + + if (options.startRule) { if (!(options.startRule in peg$startRuleFunctions)) { throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); } @@ -497,12 +565,26 @@ function peg$parse(input, options) { return input.substring(peg$savedPos, peg$currPos); } + function offset() { + return peg$savedPos; + } + + function range() { + return { + source: peg$source, + start: peg$savedPos, + end: 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) + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildStructuredError( [peg$otherExpectation(description)], @@ -512,7 +594,9 @@ function peg$parse(input, options) { } function error(message, location) { - location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) + location = location !== undefined + ? location + : peg$computeLocation(peg$savedPos, peg$currPos); throw peg$buildSimpleError(message, location); } @@ -538,19 +622,22 @@ function peg$parse(input, options) { } function peg$computePosDetails(pos) { - var details = peg$posDetailsCache[pos], p; + var details = peg$posDetailsCache[pos]; + var p; if (details) { return details; } else { - p = pos - 1; - while (!peg$posDetailsCache[p]) { - p--; + if (pos >= peg$posDetailsCache.length) { + p = peg$posDetailsCache.length - 1; + } else { + p = pos; + while (!peg$posDetailsCache[--p]) {} } details = peg$posDetailsCache[p]; details = { - line: details.line, + line: details.line, column: details.column }; @@ -566,26 +653,33 @@ function peg$parse(input, options) { } peg$posDetailsCache[pos] = details; + return details; } } - function peg$computeLocation(startPos, endPos) { - var startPosDetails = peg$computePosDetails(startPos), - endPosDetails = peg$computePosDetails(endPos); + function peg$computeLocation(startPos, endPos, offset) { + var startPosDetails = peg$computePosDetails(startPos); + var endPosDetails = peg$computePosDetails(endPos); - return { + var res = { + source: peg$source, start: { offset: startPos, - line: startPosDetails.line, + line: startPosDetails.line, column: startPosDetails.column }, end: { offset: endPos, - line: endPosDetails.line, + line: endPosDetails.line, column: endPosDetails.column } }; + if (offset && peg$source && (typeof peg$source.offset === "function")) { + res.start = peg$source.offset(res.start); + res.end = peg$source.offset(res.end); + } + return res; } function peg$fail(expected) { @@ -628,7 +722,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c0(s1); + s1 = peg$f0(s1); } s0 = s1; @@ -642,7 +736,7 @@ function peg$parse(input, options) { s1 = peg$parseTypeDef(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c1(s1); + s1 = peg$f1(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -650,7 +744,7 @@ function peg$parse(input, options) { s1 = peg$parseAdvancedDef(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c2(s1); + s1 = peg$f2(s1); } s0 = s1; } @@ -663,44 +757,23 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c3) { - s2 = peg$c3; - peg$currPos += 4; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c4); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseStringName(); - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - s6 = peg$parseDefinition(); - if (s6 !== peg$FAILED) { - s7 = peg$parse_(); - if (s7 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c5(s4, s6); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.substr(peg$currPos, 4) === peg$c0) { + s2 = peg$c0; + peg$currPos += 4; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e0); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = peg$parseStringName(); + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + s6 = peg$parseDefinition(); + if (s6 !== peg$FAILED) { + s7 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f3(s4, s6); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -722,36 +795,20 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c6) { - s2 = peg$c6; - peg$currPos += 8; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseStringName(); - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c8(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.substr(peg$currPos, 8) === peg$c1) { + s2 = peg$c1; + peg$currPos += 8; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e1); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = peg$parseStringName(); + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f4(s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -771,7 +828,7 @@ function peg$parse(input, options) { s1 = peg$parseStringName(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c9(s1); + s1 = peg$f5(s1); } s0 = s1; @@ -785,7 +842,7 @@ function peg$parse(input, options) { s1 = peg$parseMapDescriptor(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c10(s1); + s1 = peg$f6(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -793,7 +850,7 @@ function peg$parse(input, options) { s1 = peg$parseListDescriptor(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c10(s1); + s1 = peg$f7(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -801,7 +858,7 @@ function peg$parse(input, options) { s1 = peg$parseLinkDescriptor(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c10(s1); + s1 = peg$f8(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -809,7 +866,7 @@ function peg$parse(input, options) { s1 = peg$parseCopyDescriptor(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c10(s1); + s1 = peg$f9(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -817,16 +874,10 @@ function peg$parse(input, options) { s1 = peg$parseEnumKind(); if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseEnumDescriptor(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c10(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseEnumDescriptor(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f10(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -840,16 +891,10 @@ function peg$parse(input, options) { s1 = peg$parseUnionKind(); if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseUnionDescriptor(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c10(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseUnionDescriptor(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f11(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -863,16 +908,10 @@ function peg$parse(input, options) { s1 = peg$parseStructKind(); if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseStructDescriptor(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c10(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseStructDescriptor(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f12(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -886,16 +925,10 @@ function peg$parse(input, options) { s1 = peg$parseBytesKind(); if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseBytesDescriptor(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c10(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseBytesDescriptor(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f13(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -909,7 +942,7 @@ function peg$parse(input, options) { s1 = peg$parseSimpleKind(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c11(s1); + s1 = peg$f14(s1); } s0 = s1; } @@ -927,12 +960,12 @@ function peg$parse(input, options) { function peg$parseMapKind() { var s0; - if (input.substr(peg$currPos, 3) === peg$c12) { - s0 = peg$c12; + if (input.substr(peg$currPos, 3) === peg$c2) { + s0 = peg$c2; peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } + if (peg$silentFails === 0) { peg$fail(peg$e2); } } return s0; @@ -941,12 +974,12 @@ function peg$parse(input, options) { function peg$parseListKind() { var s0; - if (input.substr(peg$currPos, 4) === peg$c14) { - s0 = peg$c14; + if (input.substr(peg$currPos, 4) === peg$c3) { + s0 = peg$c3; peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } + if (peg$silentFails === 0) { peg$fail(peg$e3); } } return s0; @@ -955,12 +988,12 @@ function peg$parse(input, options) { function peg$parseEnumKind() { var s0; - if (input.substr(peg$currPos, 4) === peg$c16) { - s0 = peg$c16; + if (input.substr(peg$currPos, 4) === peg$c4) { + s0 = peg$c4; peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c17); } + if (peg$silentFails === 0) { peg$fail(peg$e4); } } return s0; @@ -969,12 +1002,12 @@ function peg$parse(input, options) { function peg$parseUnionKind() { var s0; - if (input.substr(peg$currPos, 5) === peg$c18) { - s0 = peg$c18; + if (input.substr(peg$currPos, 5) === peg$c5) { + s0 = peg$c5; peg$currPos += 5; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c19); } + if (peg$silentFails === 0) { peg$fail(peg$e5); } } return s0; @@ -983,12 +1016,12 @@ function peg$parse(input, options) { function peg$parseStructKind() { var s0; - if (input.substr(peg$currPos, 6) === peg$c20) { - s0 = peg$c20; + if (input.substr(peg$currPos, 6) === peg$c6) { + s0 = peg$c6; peg$currPos += 6; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c21); } + if (peg$silentFails === 0) { peg$fail(peg$e6); } } return s0; @@ -997,12 +1030,12 @@ function peg$parse(input, options) { function peg$parseBytesKind() { var s0; - if (input.substr(peg$currPos, 5) === peg$c22) { - s0 = peg$c22; + if (input.substr(peg$currPos, 5) === peg$c7) { + s0 = peg$c7; peg$currPos += 5; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c23); } + if (peg$silentFails === 0) { peg$fail(peg$e7); } } return s0; @@ -1015,7 +1048,7 @@ function peg$parse(input, options) { s1 = peg$parseBaseType(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c24(s1); + s1 = peg$f15(s1); } s0 = s1; @@ -1027,53 +1060,32 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c25; + s1 = peg$c8; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } + if (peg$silentFails === 0) { peg$fail(peg$e8); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseTypeDescriptor(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s5 = peg$c27; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } - } - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - s7 = peg$parseListRepresentation(); - if (s7 === peg$FAILED) { - s7 = null; - } - if (s7 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c29(s3, s7); - 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; + s3 = peg$parseTypeDescriptor(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 93) { + s5 = peg$c9; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + s7 = peg$parseListRepresentation(); + if (s7 === peg$FAILED) { + s7 = null; } + peg$savedPos = s0; + s0 = peg$f16(s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1100,31 +1112,20 @@ function peg$parse(input, options) { s1.push(s2); s2 = peg$parseTypeOption(); } - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseStringName(); + s2 = peg$parse_(); + s3 = peg$parseStringName(); + if (s3 === peg$FAILED) { + s3 = peg$parseMapDescriptor(); + if (s3 === peg$FAILED) { + s3 = peg$parseListDescriptor(); if (s3 === peg$FAILED) { - s3 = peg$parseMapDescriptor(); - if (s3 === peg$FAILED) { - s3 = peg$parseListDescriptor(); - if (s3 === peg$FAILED) { - s3 = peg$parseLinkDescriptor(); - } - } - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c30(s1, s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; + s3 = peg$parseLinkDescriptor(); } - } else { - peg$currPos = s0; - s0 = peg$FAILED; } + } + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f17(s1, s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1138,18 +1139,17 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 38) { - s1 = peg$c31; + s1 = peg$c10; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c32); } + if (peg$silentFails === 0) { peg$fail(peg$e10); } } if (s1 !== peg$FAILED) { s2 = peg$parseStringName(); if (s2 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c33(s2); - s0 = s1; + s0 = peg$f18(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1167,24 +1167,18 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 61) { - s1 = peg$c34; + s1 = peg$c11; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c35); } + if (peg$silentFails === 0) { peg$fail(peg$e11); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseStringName(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c36(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseStringName(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f19(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1202,11 +1196,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1221,37 +1215,21 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { - s3 = peg$c39; + s3 = peg$c13; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s3 !== peg$FAILED) { s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseEnumRepresentation(); - if (s5 === peg$FAILED) { - s5 = null; - } - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c41(s2, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; + s5 = peg$parseEnumRepresentation(); + if (s5 === peg$FAILED) { + s5 = null; } + s6 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f20(s2, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1273,51 +1251,25 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 124) { - s2 = peg$c42; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c43); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseStringName(); - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - s6 = peg$parseEnumFieldRepresentationOptions(); - if (s6 === peg$FAILED) { - s6 = null; - } - if (s6 !== peg$FAILED) { - s7 = peg$parse_(); - if (s7 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c44(s4, s6); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.charCodeAt(peg$currPos) === 124) { + s2 = peg$c14; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = peg$parseStringName(); + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + s6 = peg$parseEnumFieldRepresentationOptions(); + if (s6 === peg$FAILED) { + s6 = null; + } + s7 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f21(s4, s6); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1335,38 +1287,27 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c45; + s1 = peg$c15; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } + if (peg$silentFails === 0) { peg$fail(peg$e15); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseQuotedString(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c47; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c49(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseQuotedString(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c16; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e16); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f22(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1388,11 +1329,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = []; @@ -1407,24 +1348,18 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { - s3 = peg$c39; + s3 = peg$c13; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s3 !== peg$FAILED) { s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseUnionRepresentation(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c50(s2, s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s5 = peg$parseUnionRepresentation(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f23(s2, s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1450,50 +1385,29 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 124) { - s2 = peg$c42; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c43); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseStringName(); - if (s4 === peg$FAILED) { - s4 = peg$parseLinkDescriptor(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - s6 = peg$parseQuotedString(); - if (s6 === peg$FAILED) { - s6 = peg$parseBaseType(); - } - if (s6 !== peg$FAILED) { - s7 = peg$parse_(); - if (s7 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c51(s4, s6); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.charCodeAt(peg$currPos) === 124) { + s2 = peg$c14; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e14); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = peg$parseStringName(); + if (s4 === peg$FAILED) { + s4 = peg$parseLinkDescriptor(); + } + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + s6 = peg$parseQuotedString(); + if (s6 === peg$FAILED) { + s6 = peg$parseBaseType(); + } + if (s6 !== peg$FAILED) { + s7 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f24(s4, s6); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1515,75 +1429,44 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseStringName(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 58) { - s5 = peg$c52; + s3 = peg$parseStringName(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 58) { + s5 = peg$c17; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e17); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + s7 = peg$parseTypeDescriptor(); + if (s7 !== peg$FAILED) { + s8 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 125) { + s9 = peg$c13; peg$currPos++; } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c53); } + s9 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } } - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - s7 = peg$parseTypeDescriptor(); - if (s7 !== peg$FAILED) { - s8 = peg$parse_(); - if (s8 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s9 = peg$c39; - peg$currPos++; - } else { - s9 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } - } - if (s9 !== peg$FAILED) { - s10 = peg$parse_(); - if (s10 !== peg$FAILED) { - s11 = peg$parseMapRepresentation(); - if (s11 === peg$FAILED) { - s11 = null; - } - if (s11 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c54(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; + if (s9 !== peg$FAILED) { + s10 = peg$parse_(); + s11 = peg$parseMapRepresentation(); + if (s11 === peg$FAILED) { + s11 = null; } + peg$savedPos = s0; + s0 = peg$f25(s3, s7, s11); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1613,62 +1496,36 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = []; + s3 = []; + s4 = peg$parseStructValue(); + while (s4 !== peg$FAILED) { + s3.push(s4); s4 = peg$parseStructValue(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseStructValue(); - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s5 = peg$c39; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } - } - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - s7 = peg$parseStructRepresentation(); - if (s7 === peg$FAILED) { - s7 = null; - } - if (s7 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c55(s3, s7); - 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; + } + s4 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c13; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + s7 = peg$parseStructRepresentation(); + if (s7 === peg$FAILED) { + s7 = null; } + peg$savedPos = s0; + s0 = peg$f26(s3, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1686,62 +1543,26 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - s2 = peg$parseStringName(); - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$parseStructFieldOption(); - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$parseStructFieldOption(); - } - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - s6 = peg$parseStructType(); - if (s6 !== peg$FAILED) { - s7 = peg$parse_(); - if (s7 !== peg$FAILED) { - s8 = peg$parseStructFieldRepresentationOptions(); - if (s8 === peg$FAILED) { - s8 = null; - } - if (s8 !== peg$FAILED) { - s9 = peg$parse_(); - if (s9 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c56(s2, s4, s6, s8); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s2 = peg$parseStringName(); + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = []; + s5 = peg$parseStructFieldOption(); + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$parseStructFieldOption(); + } + s5 = peg$parse_(); + s6 = peg$parseStructType(); + if (s6 !== peg$FAILED) { + s7 = peg$parse_(); + s8 = peg$parseStructFieldRepresentationOptions(); + if (s8 === peg$FAILED) { + s8 = null; + } + s9 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f27(s2, s4, s6, s8); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1758,30 +1579,30 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c57) { - s1 = peg$c57; + if (input.substr(peg$currPos, 8) === peg$c18) { + s1 = peg$c18; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c58); } + if (peg$silentFails === 0) { peg$fail(peg$e18); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(); + s1 = peg$f28(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c60) { - s1 = peg$c60; + if (input.substr(peg$currPos, 8) === peg$c19) { + s1 = peg$c19; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } + if (peg$silentFails === 0) { peg$fail(peg$e19); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c62(); + s1 = peg$f29(); } s0 = s1; } @@ -1793,30 +1614,30 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c57) { - s1 = peg$c57; + if (input.substr(peg$currPos, 8) === peg$c18) { + s1 = peg$c18; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c58); } + if (peg$silentFails === 0) { peg$fail(peg$e18); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c59(); + s1 = peg$f30(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c60) { - s1 = peg$c60; + if (input.substr(peg$currPos, 8) === peg$c19) { + s1 = peg$c19; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c61); } + if (peg$silentFails === 0) { peg$fail(peg$e19); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c63(); + s1 = peg$f31(); } s0 = s1; } @@ -1831,7 +1652,7 @@ function peg$parse(input, options) { s1 = peg$parseStringName(); if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c64(s1); + s1 = peg$f32(s1); } s0 = s1; if (s0 === peg$FAILED) { @@ -1852,47 +1673,31 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 40) { - s1 = peg$c45; + s1 = peg$c15; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c46); } + if (peg$silentFails === 0) { peg$fail(peg$e15); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = []; + s3 = []; + s4 = peg$parseStructFieldRepresentationOption(); + while (s4 !== peg$FAILED) { + s3.push(s4); s4 = peg$parseStructFieldRepresentationOption(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseStructFieldRepresentationOption(); - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 41) { - s5 = peg$c47; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c48); } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c65(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + s4 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 41) { + s5 = peg$c16; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e16); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f33(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1909,25 +1714,19 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4; s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c66) { - s1 = peg$c66; + if (input.substr(peg$currPos, 8) === peg$c20) { + s1 = peg$c20; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } + if (peg$silentFails === 0) { peg$fail(peg$e20); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseImplicitOption(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c68(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseImplicitOption(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f34(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1938,31 +1737,20 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c69) { - s1 = peg$c69; + if (input.substr(peg$currPos, 6) === peg$c21) { + s1 = peg$c21; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c70); } + if (peg$silentFails === 0) { peg$fail(peg$e21); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseQuotedString(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c71(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseQuotedString(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f35(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -1983,14 +1771,8 @@ function peg$parse(input, options) { s1 = peg$parseQuotedString(); if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c72(s1); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s0 = peg$f36(s1); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2000,44 +1782,38 @@ function peg$parse(input, options) { s1 = peg$parseInteger(); if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c73(s1); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s0 = peg$f37(s1); } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 4) === peg$c74) { - s1 = peg$c74; + if (input.substr(peg$currPos, 4) === peg$c22) { + s1 = peg$c22; peg$currPos += 4; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c75); } + if (peg$silentFails === 0) { peg$fail(peg$e22); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c76(); + s1 = peg$f38(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c77) { - s1 = peg$c77; + if (input.substr(peg$currPos, 5) === peg$c23) { + s1 = peg$c23; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c78); } + if (peg$silentFails === 0) { peg$fail(peg$e23); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c79(); + s1 = peg$f39(); } s0 = s1; } @@ -2051,31 +1827,20 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4; s0 = peg$currPos; - if (input.substr(peg$currPos, 14) === peg$c80) { - s1 = peg$c80; + if (input.substr(peg$currPos, 14) === peg$c24) { + s1 = peg$c24; peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$e24); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseUnionRepresentationType(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c82(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseUnionRepresentationType(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f40(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2092,31 +1857,20 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4; s0 = peg$currPos; - if (input.substr(peg$currPos, 14) === peg$c80) { - s1 = peg$c80; + if (input.substr(peg$currPos, 14) === peg$c24) { + s1 = peg$c24; peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$e24); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseMapRepresentationType(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c82(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseMapRepresentationType(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f41(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2133,31 +1887,20 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4; s0 = peg$currPos; - if (input.substr(peg$currPos, 14) === peg$c80) { - s1 = peg$c80; + if (input.substr(peg$currPos, 14) === peg$c24) { + s1 = peg$c24; peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$e24); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseListRepresentationType(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c82(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseListRepresentationType(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f42(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2174,31 +1917,20 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4; s0 = peg$currPos; - if (input.substr(peg$currPos, 14) === peg$c80) { - s1 = peg$c80; + if (input.substr(peg$currPos, 14) === peg$c24) { + s1 = peg$c24; peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$e24); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseStructRepresentationType(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c82(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseStructRepresentationType(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f43(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2215,31 +1947,20 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4; s0 = peg$currPos; - if (input.substr(peg$currPos, 14) === peg$c80) { - s1 = peg$c80; + if (input.substr(peg$currPos, 14) === peg$c24) { + s1 = peg$c24; peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$e24); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseEnumRepresentationType(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c82(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseEnumRepresentationType(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f44(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2256,81 +1977,75 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c83) { - s1 = peg$c83; + if (input.substr(peg$currPos, 5) === peg$c25) { + s1 = peg$c25; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c84); } + if (peg$silentFails === 0) { peg$fail(peg$e25); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c85(); + s1 = peg$f45(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c86) { - s1 = peg$c86; + if (input.substr(peg$currPos, 6) === peg$c26) { + s1 = peg$c26; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c87); } + if (peg$silentFails === 0) { peg$fail(peg$e26); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c88(); + s1 = peg$f46(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 12) === peg$c89) { - s1 = peg$c89; + if (input.substr(peg$currPos, 12) === peg$c27) { + s1 = peg$c27; peg$currPos += 12; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c90); } + if (peg$silentFails === 0) { peg$fail(peg$e27); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c91(); + s1 = peg$f47(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 11) === peg$c92) { - s1 = peg$c92; + if (input.substr(peg$currPos, 11) === peg$c28) { + s1 = peg$c28; peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c93); } + if (peg$silentFails === 0) { peg$fail(peg$e28); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c94(); + s1 = peg$f48(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c95) { - s1 = peg$c95; + if (input.substr(peg$currPos, 6) === peg$c29) { + s1 = peg$c29; peg$currPos += 6; - } else { - s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c96); } - } - if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseUnionInlineKeyDefinition(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c10(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } else { + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e29); } + } + if (s1 !== peg$FAILED) { + s2 = peg$parse_(); + s3 = peg$parseUnionInlineKeyDefinition(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f49(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2341,25 +2056,19 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c97) { - s1 = peg$c97; + if (input.substr(peg$currPos, 8) === peg$c30) { + s1 = peg$c30; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c98); } + if (peg$silentFails === 0) { peg$fail(peg$e30); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseUnionEnvelopeKeyDefinition(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c10(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseUnionEnvelopeKeyDefinition(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f50(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2382,61 +2091,45 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 15) === peg$c99) { - s3 = peg$c99; + if (input.substr(peg$currPos, 15) === peg$c31) { + s3 = peg$c31; + peg$currPos += 15; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e31); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 15) === peg$c31) { + s3 = peg$c31; peg$currPos += 15; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c100); } + if (peg$silentFails === 0) { peg$fail(peg$e31); } } - if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 15) === peg$c99) { - s3 = peg$c99; - peg$currPos += 15; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + s5 = peg$parseQuotedString(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 125) { + s7 = peg$c13; + peg$currPos++; } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c100); } + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } } - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseQuotedString(); - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s7 = peg$c39; - peg$currPos++; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } - } - if (s7 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c101(s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (s7 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f51(s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2462,83 +2155,57 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 15) === peg$c99) { - s3 = peg$c99; + if (input.substr(peg$currPos, 15) === peg$c31) { + s3 = peg$c31; + peg$currPos += 15; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e31); } + } + if (s3 === peg$FAILED) { + if (input.substr(peg$currPos, 15) === peg$c31) { + s3 = peg$c31; peg$currPos += 15; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c100); } + if (peg$silentFails === 0) { peg$fail(peg$e31); } } - if (s3 === peg$FAILED) { - if (input.substr(peg$currPos, 15) === peg$c99) { - s3 = peg$c99; - peg$currPos += 15; + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + s5 = peg$parseQuotedString(); + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + if (input.substr(peg$currPos, 10) === peg$c32) { + s7 = peg$c32; + peg$currPos += 10; } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c100); } + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e32); } } - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseQuotedString(); - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c102) { - s7 = peg$c102; - peg$currPos += 10; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c103); } - } - if (s7 !== peg$FAILED) { - s8 = peg$parse_(); - if (s8 !== peg$FAILED) { - s9 = peg$parseQuotedString(); - if (s9 !== peg$FAILED) { - s10 = peg$parse_(); - if (s10 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s11 = peg$c39; - peg$currPos++; - } else { - s11 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } - } - if (s11 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c104(s5, 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; - } + if (s7 !== peg$FAILED) { + s8 = peg$parse_(); + s9 = peg$parseQuotedString(); + if (s9 !== peg$FAILED) { + s10 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 125) { + s11 = peg$c13; + peg$currPos++; + } else { + s11 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s11 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f52(s5, s9); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2571,53 +2238,47 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c12) { - s1 = peg$c12; + if (input.substr(peg$currPos, 3) === peg$c2) { + s1 = peg$c2; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } + if (peg$silentFails === 0) { peg$fail(peg$e2); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c105(); + s1 = peg$f53(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 9) === peg$c106) { - s1 = peg$c106; + if (input.substr(peg$currPos, 9) === peg$c33) { + s1 = peg$c33; peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c107); } + if (peg$silentFails === 0) { peg$fail(peg$e33); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c108(); + s1 = peg$f54(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 11) === peg$c109) { - s1 = peg$c109; + if (input.substr(peg$currPos, 11) === peg$c34) { + s1 = peg$c34; peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } + if (peg$silentFails === 0) { peg$fail(peg$e34); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseMapStringpairsRepresentation(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c111(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseMapStringpairsRepresentation(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f55(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2628,25 +2289,19 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c6) { - s1 = peg$c6; + if (input.substr(peg$currPos, 8) === peg$c1) { + s1 = peg$c1; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } + if (peg$silentFails === 0) { peg$fail(peg$e1); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseAdvancedRepresentation(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c111(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseAdvancedRepresentation(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f56(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2667,47 +2322,31 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = []; + s3 = []; + s4 = peg$parseMapStringpairsRepresentationOptions(); + while (s4 !== peg$FAILED) { + s3.push(s4); s4 = peg$parseMapStringpairsRepresentationOptions(); - while (s4 !== peg$FAILED) { - s3.push(s4); - s4 = peg$parseMapStringpairsRepresentationOptions(); - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s5 = peg$c39; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c112(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + } + s4 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c13; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f57(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2725,30 +2364,19 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c113) { - s2 = peg$c113; - peg$currPos += 10; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c114); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseQuotedString(); - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c115(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.substr(peg$currPos, 10) === peg$c35) { + s2 = peg$c35; + peg$currPos += 10; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e35); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = peg$parseQuotedString(); + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f58(s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2760,30 +2388,19 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c116) { - s2 = peg$c116; - peg$currPos += 10; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c117); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseQuotedString(); - if (s4 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c118(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.substr(peg$currPos, 10) === peg$c36) { + s2 = peg$c36; + peg$currPos += 10; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e36); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = peg$parseQuotedString(); + if (s4 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f59(s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2801,25 +2418,19 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 8) === peg$c6) { - s1 = peg$c6; + if (input.substr(peg$currPos, 8) === peg$c1) { + s1 = peg$c1; peg$currPos += 8; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } + if (peg$silentFails === 0) { peg$fail(peg$e1); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseAdvancedRepresentation(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c111(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseAdvancedRepresentation(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f60(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2836,71 +2447,54 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c12) { - s1 = peg$c12; + if (input.substr(peg$currPos, 3) === peg$c2) { + s1 = peg$c2; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } + if (peg$silentFails === 0) { peg$fail(peg$e2); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c105(); + s1 = peg$f61(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c119) { - s1 = peg$c119; + if (input.substr(peg$currPos, 5) === peg$c37) { + s1 = peg$c37; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c120); } + if (peg$silentFails === 0) { peg$fail(peg$e37); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseStructTupleRepresentationFields(); - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c121(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; + s3 = peg$parseStructTupleRepresentationFields(); + if (s3 === peg$FAILED) { + s3 = null; } + peg$savedPos = s0; + s0 = peg$f62(s3); } else { peg$currPos = s0; s0 = peg$FAILED; } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 10) === peg$c122) { - s1 = peg$c122; + if (input.substr(peg$currPos, 10) === peg$c38) { + s1 = peg$c38; peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c123); } + if (peg$silentFails === 0) { peg$fail(peg$e38); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseStructStringjoinRepresentationFields(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c124(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseStructStringjoinRepresentationFields(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f63(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2911,25 +2505,19 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 11) === peg$c109) { - s1 = peg$c109; + if (input.substr(peg$currPos, 11) === peg$c34) { + s1 = peg$c34; peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c110); } + if (peg$silentFails === 0) { peg$fail(peg$e34); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseMapStringpairsRepresentation(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c111(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseMapStringpairsRepresentation(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f64(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -2940,16 +2528,16 @@ function peg$parse(input, options) { } if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 9) === peg$c106) { - s1 = peg$c106; + if (input.substr(peg$currPos, 9) === peg$c33) { + s1 = peg$c33; peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c107); } + if (peg$silentFails === 0) { peg$fail(peg$e33); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c108(); + s1 = peg$f65(); } s0 = s1; } @@ -2965,29 +2553,24 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s3 = peg$c39; - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } - } - if (s3 !== peg$FAILED) { - s1 = [s1, s2, s3]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.charCodeAt(peg$currPos) === 125) { + s3 = peg$c13; + peg$currPos++; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s3 !== peg$FAILED) { + s1 = [s1, s2, s3]; + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3004,53 +2587,32 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5, s6, s7, s8; s0 = peg$currPos; - if (input.substr(peg$currPos, 5) === peg$c125) { - s1 = peg$c125; + if (input.substr(peg$currPos, 5) === peg$c39) { + s1 = peg$c39; peg$currPos += 5; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c126); } + if (peg$silentFails === 0) { peg$fail(peg$e39); } } if (s1 !== peg$FAILED) { - s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseStringName(); - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c66) { - s5 = peg$c66; - peg$currPos += 8; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c67); } - } - if (s5 !== peg$FAILED) { - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - s7 = peg$parseQuotedString(); - if (s7 !== peg$FAILED) { - s8 = peg$parse_(); - if (s8 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c127(s3, s5, s7); - 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; - } + s2 = peg$parse_(); + s3 = peg$parseStringName(); + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + if (input.substr(peg$currPos, 8) === peg$c20) { + s5 = peg$c20; + peg$currPos += 8; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e20); } + } + if (s5 !== peg$FAILED) { + s6 = peg$parse_(); + s7 = peg$parseQuotedString(); + if (s7 !== peg$FAILED) { + s8 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f66(s3, s5, s7); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3076,45 +2638,29 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseStructTupleRepresentationFieldOrder(); - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 125) { - s5 = peg$c39; - peg$currPos++; - } else { - s5 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } - } - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c128(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseStructTupleRepresentationFieldOrder(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 125) { + s5 = peg$c13; + peg$currPos++; + } else { + s5 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e13); } + } + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f67(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3131,25 +2677,19 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (input.substr(peg$currPos, 10) === peg$c129) { - s1 = peg$c129; + if (input.substr(peg$currPos, 10) === peg$c40) { + s1 = peg$c40; peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c130); } + if (peg$silentFails === 0) { peg$fail(peg$e40); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseQuotedStringArray(); - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c128(s3); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = peg$parseQuotedStringArray(); + if (s3 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f68(s3); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3167,11 +2707,11 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 123) { - s1 = peg$c37; + s1 = peg$c12; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c38); } + if (peg$silentFails === 0) { peg$fail(peg$e12); } } if (s1 !== peg$FAILED) { s2 = []; @@ -3186,16 +2726,15 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 125) { - s3 = peg$c39; + s3 = peg$c13; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c40); } + if (peg$silentFails === 0) { peg$fail(peg$e13); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c131(s2); - s0 = s1; + s0 = peg$f69(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3228,36 +2767,20 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c132) { - s2 = peg$c132; - peg$currPos += 4; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c133); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseQuotedString(); - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c134(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.substr(peg$currPos, 4) === peg$c41) { + s2 = peg$c41; + peg$currPos += 4; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e41); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = peg$parseQuotedString(); + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f70(s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3275,36 +2798,20 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = peg$parse_(); - if (s1 !== peg$FAILED) { - if (input.substr(peg$currPos, 10) === peg$c129) { - s2 = peg$c129; - peg$currPos += 10; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c130); } - } - if (s2 !== peg$FAILED) { - s3 = peg$parse_(); - if (s3 !== peg$FAILED) { - s4 = peg$parseQuotedStringArray(); - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c135(s4); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.substr(peg$currPos, 10) === peg$c40) { + s2 = peg$c40; + peg$currPos += 10; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e40); } + } + if (s2 !== peg$FAILED) { + s3 = peg$parse_(); + s4 = peg$parseQuotedStringArray(); + if (s4 !== peg$FAILED) { + s5 = peg$parse_(); + peg$savedPos = s0; + s0 = peg$f71(s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3321,30 +2828,30 @@ function peg$parse(input, options) { var s0, s1; s0 = peg$currPos; - if (input.substr(peg$currPos, 6) === peg$c136) { - s1 = peg$c136; + if (input.substr(peg$currPos, 6) === peg$c42) { + s1 = peg$c42; peg$currPos += 6; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c137); } + if (peg$silentFails === 0) { peg$fail(peg$e42); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c138(); + s1 = peg$f72(); } s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 3) === peg$c139) { - s1 = peg$c139; + if (input.substr(peg$currPos, 3) === peg$c43) { + s1 = peg$c43; peg$currPos += 3; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c140); } + if (peg$silentFails === 0) { peg$fail(peg$e43); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c141(); + s1 = peg$f73(); } s0 = s1; } @@ -3356,39 +2863,28 @@ function peg$parse(input, options) { var s0, s1, s2, s3, s4, s5; s0 = peg$currPos; - if (input.substr(peg$currPos, 14) === peg$c80) { - s1 = peg$c80; + if (input.substr(peg$currPos, 14) === peg$c24) { + s1 = peg$c24; peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c81); } + if (peg$silentFails === 0) { peg$fail(peg$e24); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - if (input.substr(peg$currPos, 8) === peg$c6) { - s3 = peg$c6; - peg$currPos += 8; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c7); } - } - if (s3 !== peg$FAILED) { - s4 = peg$parse_(); - if (s4 !== peg$FAILED) { - s5 = peg$parseAdvancedRepresentation(); - if (s5 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c142(s5); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.substr(peg$currPos, 8) === peg$c1) { + s3 = peg$c1; + peg$currPos += 8; + } else { + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e1); } + } + if (s3 !== peg$FAILED) { + s4 = peg$parse_(); + s5 = peg$parseAdvancedRepresentation(); + if (s5 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f74(s5); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3410,134 +2906,81 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 91) { - s1 = peg$c25; + s1 = peg$c8; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c26); } + if (peg$silentFails === 0) { peg$fail(peg$e8); } } if (s1 !== peg$FAILED) { s2 = peg$parse_(); - if (s2 !== peg$FAILED) { - s3 = peg$parseQuotedString(); - if (s3 === peg$FAILED) { - s3 = null; + s3 = peg$parseQuotedString(); + if (s3 === peg$FAILED) { + s3 = null; + } + s4 = []; + s5 = peg$currPos; + s6 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 44) { + s7 = peg$c44; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e44); } + } + if (s7 !== peg$FAILED) { + s8 = peg$parse_(); + s9 = peg$parseQuotedString(); + if (s9 !== peg$FAILED) { + s10 = peg$parse_(); + peg$savedPos = s5; + s5 = peg$f75(s3, s9); + } else { + peg$currPos = s5; + s5 = peg$FAILED; } - if (s3 !== peg$FAILED) { - s4 = []; - s5 = peg$currPos; - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 44) { - s7 = peg$c143; - peg$currPos++; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c144); } - } - if (s7 !== peg$FAILED) { - s8 = peg$parse_(); - if (s8 !== peg$FAILED) { - s9 = peg$parseQuotedString(); - if (s9 !== peg$FAILED) { - s10 = peg$parse_(); - if (s10 !== peg$FAILED) { - peg$savedPos = s5; - s6 = peg$c145(s3, s9); - s5 = s6; - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } + } else { + peg$currPos = s5; + s5 = peg$FAILED; + } + while (s5 !== peg$FAILED) { + s4.push(s5); + s5 = peg$currPos; + s6 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 44) { + s7 = peg$c44; + peg$currPos++; + } else { + s7 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e44); } + } + if (s7 !== peg$FAILED) { + s8 = peg$parse_(); + s9 = peg$parseQuotedString(); + if (s9 !== peg$FAILED) { + s10 = peg$parse_(); + peg$savedPos = s5; + s5 = peg$f75(s3, s9); } else { peg$currPos = s5; s5 = peg$FAILED; } - while (s5 !== peg$FAILED) { - s4.push(s5); - s5 = peg$currPos; - s6 = peg$parse_(); - if (s6 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 44) { - s7 = peg$c143; - peg$currPos++; - } else { - s7 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c144); } - } - if (s7 !== peg$FAILED) { - s8 = peg$parse_(); - if (s8 !== peg$FAILED) { - s9 = peg$parseQuotedString(); - if (s9 !== peg$FAILED) { - s10 = peg$parse_(); - if (s10 !== peg$FAILED) { - peg$savedPos = s5; - s6 = peg$c145(s3, s9); - s5 = s6; - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - } else { - peg$currPos = s5; - s5 = peg$FAILED; - } - } - if (s4 !== peg$FAILED) { - s5 = peg$parse_(); - if (s5 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 93) { - s6 = peg$c27; - peg$currPos++; - } else { - s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c28); } - } - if (s6 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c146(s3, 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; + peg$currPos = s5; + s5 = peg$FAILED; } + } + s5 = peg$parse_(); + if (input.charCodeAt(peg$currPos) === 93) { + s6 = peg$c9; + peg$currPos++; + } else { + s6 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e9); } + } + if (s6 !== peg$FAILED) { + peg$savedPos = s0; + s0 = peg$f76(s3, s4); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3555,30 +2998,30 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 34) { - s1 = peg$c147; + s1 = peg$c45; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c148); } + if (peg$silentFails === 0) { peg$fail(peg$e45); } } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c149.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); + s3 = input.charAt(peg$currPos); + if (peg$r0.test(s3)) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c150); } + if (peg$silentFails === 0) { peg$fail(peg$e46); } } if (s3 !== peg$FAILED) { while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c149.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); + s3 = input.charAt(peg$currPos); + if (peg$r0.test(s3)) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c150); } + if (peg$silentFails === 0) { peg$fail(peg$e46); } } } } else { @@ -3586,16 +3029,15 @@ function peg$parse(input, options) { } if (s2 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s3 = peg$c147; + s3 = peg$c45; peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c148); } + if (peg$silentFails === 0) { peg$fail(peg$e45); } } if (s3 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c151(s2); - s0 = s1; + s0 = peg$f77(s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3616,40 +3058,34 @@ function peg$parse(input, options) { var s0, s1, s2, s3; s0 = peg$currPos; - if (peg$c152.test(input.charAt(peg$currPos))) { - s1 = input.charAt(peg$currPos); + s1 = input.charAt(peg$currPos); + if (peg$r1.test(s1)) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c153); } + if (peg$silentFails === 0) { peg$fail(peg$e47); } } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c154.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); + s3 = input.charAt(peg$currPos); + if (peg$r2.test(s3)) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c155); } + if (peg$silentFails === 0) { peg$fail(peg$e48); } } while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c154.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); + s3 = input.charAt(peg$currPos); + if (peg$r2.test(s3)) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c155); } + if (peg$silentFails === 0) { peg$fail(peg$e48); } } } - if (s2 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c156(s1, s2); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + peg$savedPos = s0; + s0 = peg$f78(s1, s2); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3663,22 +3099,22 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = []; - if (peg$c157.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); + s2 = input.charAt(peg$currPos); + if (peg$r3.test(s2)) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c158); } + if (peg$silentFails === 0) { peg$fail(peg$e49); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { s1.push(s2); - if (peg$c157.test(input.charAt(peg$currPos))) { - s2 = input.charAt(peg$currPos); + s2 = input.charAt(peg$currPos); + if (peg$r3.test(s2)) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c158); } + if (peg$silentFails === 0) { peg$fail(peg$e49); } } } } else { @@ -3686,7 +3122,7 @@ function peg$parse(input, options) { } if (s1 !== peg$FAILED) { peg$savedPos = s0; - s1 = peg$c159(s1); + s1 = peg$f79(s1); } s0 = s1; @@ -3696,84 +3132,84 @@ function peg$parse(input, options) { function peg$parseBaseType() { var s0; - if (input.substr(peg$currPos, 4) === peg$c160) { - s0 = peg$c160; + if (input.substr(peg$currPos, 4) === peg$c46) { + s0 = peg$c46; peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c161); } + if (peg$silentFails === 0) { peg$fail(peg$e50); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 6) === peg$c136) { - s0 = peg$c136; + if (input.substr(peg$currPos, 6) === peg$c42) { + s0 = peg$c42; peg$currPos += 6; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c137); } + if (peg$silentFails === 0) { peg$fail(peg$e42); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c22) { - s0 = peg$c22; + if (input.substr(peg$currPos, 5) === peg$c7) { + s0 = peg$c7; peg$currPos += 5; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c23); } + if (peg$silentFails === 0) { peg$fail(peg$e7); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c139) { - s0 = peg$c139; + if (input.substr(peg$currPos, 3) === peg$c43) { + s0 = peg$c43; peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c140); } + if (peg$silentFails === 0) { peg$fail(peg$e43); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 5) === peg$c162) { - s0 = peg$c162; + if (input.substr(peg$currPos, 5) === peg$c47) { + s0 = peg$c47; peg$currPos += 5; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c163); } + if (peg$silentFails === 0) { peg$fail(peg$e51); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c12) { - s0 = peg$c12; + if (input.substr(peg$currPos, 3) === peg$c2) { + s0 = peg$c2; peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c13); } + if (peg$silentFails === 0) { peg$fail(peg$e2); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c14) { - s0 = peg$c14; + if (input.substr(peg$currPos, 4) === peg$c3) { + s0 = peg$c3; peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c15); } + if (peg$silentFails === 0) { peg$fail(peg$e3); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c164) { - s0 = peg$c164; + if (input.substr(peg$currPos, 4) === peg$c48) { + s0 = peg$c48; peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c165); } + if (peg$silentFails === 0) { peg$fail(peg$e52); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 4) === peg$c166) { - s0 = peg$c166; + if (input.substr(peg$currPos, 4) === peg$c49) { + s0 = peg$c49; peg$currPos += 4; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c167); } + if (peg$silentFails === 0) { peg$fail(peg$e53); } } if (s0 === peg$FAILED) { - if (input.substr(peg$currPos, 3) === peg$c168) { - s0 = peg$c168; + if (input.substr(peg$currPos, 3) === peg$c50) { + s0 = peg$c50; peg$currPos += 3; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c169); } + if (peg$silentFails === 0) { peg$fail(peg$e54); } } } } @@ -3833,12 +3269,12 @@ function peg$parse(input, options) { function peg$parsewhitespace() { var s0; - if (peg$c170.test(input.charAt(peg$currPos))) { - s0 = input.charAt(peg$currPos); + s0 = input.charAt(peg$currPos); + if (peg$r4.test(s0)) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c171); } + if (peg$silentFails === 0) { peg$fail(peg$e55); } } return s0; @@ -3849,54 +3285,43 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 35) { - s1 = peg$c172; + s1 = peg$c51; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c173); } + if (peg$silentFails === 0) { peg$fail(peg$e56); } } if (s1 !== peg$FAILED) { s2 = []; - if (peg$c174.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); + s3 = input.charAt(peg$currPos); + if (peg$r5.test(s3)) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c175); } + if (peg$silentFails === 0) { peg$fail(peg$e57); } } while (s3 !== peg$FAILED) { s2.push(s3); - if (peg$c174.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); + s3 = input.charAt(peg$currPos); + if (peg$r5.test(s3)) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c175); } + if (peg$silentFails === 0) { peg$fail(peg$e57); } } } - if (s2 !== peg$FAILED) { - if (peg$c176.test(input.charAt(peg$currPos))) { - s3 = input.charAt(peg$currPos); - peg$currPos++; - } else { - s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c177); } - } - if (s3 === peg$FAILED) { - s3 = null; - } - if (s3 !== peg$FAILED) { - peg$savedPos = s0; - s1 = peg$c178(); - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + s3 = input.charAt(peg$currPos); + if (peg$r6.test(s3)) { + peg$currPos++; } else { - peg$currPos = s0; - s0 = peg$FAILED; + s3 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e58); } } + if (s3 === peg$FAILED) { + s3 = null; + } + peg$savedPos = s0; + s0 = peg$f80(); } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3910,30 +3335,25 @@ function peg$parse(input, options) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 13) { - s1 = peg$c179; + s1 = peg$c52; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c180); } + if (peg$silentFails === 0) { peg$fail(peg$e59); } } if (s1 === peg$FAILED) { s1 = null; } - if (s1 !== peg$FAILED) { - if (input.charCodeAt(peg$currPos) === 10) { - s2 = peg$c181; - peg$currPos++; - } else { - s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$c182); } - } - if (s2 !== peg$FAILED) { - s1 = [s1, s2]; - s0 = s1; - } else { - peg$currPos = s0; - s0 = peg$FAILED; - } + if (input.charCodeAt(peg$currPos) === 10) { + s2 = peg$c53; + peg$currPos++; + } else { + s2 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e60); } + } + if (s2 !== peg$FAILED) { + s1 = [s1, s2]; + s0 = s1; } else { peg$currPos = s0; s0 = peg$FAILED; @@ -3943,34 +3363,42 @@ function peg$parse(input, options) { } - function defaultStructRepresentation () { - return { map: {} } - } + function defaultStructRepresentation () { + return { map: {} } + } - function extend (o1, o2) { - // we only use a 2-argument form and this also lets us supply `extend` as an argument - // to Array#reduce and not worry about the additional reducer arguments - return Object.assign(o1, o2) - } + function extend (o1, o2) { + // we only use a 2-argument form and this also lets us supply `extend` as an argument + // to Array#reduce and not worry about the additional reducer arguments + return Object.assign(o1, o2) + } - // some values need coercion into proper forms, `default` being one of them - function coerceValue (value) { - if (value === 'true') { - return true - } - if (value === 'false') { - return false - } - // this isn't needed yet, just trying the concept - if (parseInt(value, 10) == value) { - return parseInt(value, 10) - } - return value + // some values need coercion into proper forms, `default` being one of them + function coerceValue (value) { + if (value === 'true') { + return true } - + if (value === 'false') { + return false + } + // this isn't needed yet, just trying the concept + if (parseInt(value, 10) == value) { + return parseInt(value, 10) + } + return value + } peg$result = peg$startRuleFunction(); + if (options.peg$library) { + return /** @type {any} */ ({ + peg$result, + peg$currPos, + peg$FAILED, + peg$maxFailExpected, + peg$maxFailPos + }); + } if (peg$result !== peg$FAILED && peg$currPos === input.length) { return peg$result; } else { @@ -3989,6 +3417,7 @@ function peg$parse(input, options) { } module.exports = { + StartRules: ["Root"], SyntaxError: peg$SyntaxError, - parse: peg$parse + parse: peg$parse }; diff --git a/package.json b/package.json index def8189..f6f3be9 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "build": "npm run build:types", "build:types": "tsc --build", "prepublishOnly": "npm run build", - "peg": "echo '// @ts-nocheck' > lib/parser.cjs && npm_config_yes=true npx pegjs -o tmp.cjs ipld-schema.pegjs && cat tmp.cjs >> lib/parser.cjs && rm tmp.cjs", + "peg": "echo '// @ts-nocheck' > lib/parser.cjs && npm_config_yes=true npx peggy -o tmp.cjs ipld-schema.pegjs && cat tmp.cjs >> lib/parser.cjs && rm tmp.cjs", "lint": "standard", "test:ci": "npm run test", "test:node": "c8 --check-coverage --exclude=lib/parser.cjs --exclude=test/** mocha test/test-*.js", diff --git a/types/lib/parser.d.cts b/types/lib/parser.d.cts index 99da10e..081e09d 100644 --- a/types/lib/parser.d.cts +++ b/types/lib/parser.d.cts @@ -1,15 +1,12 @@ -declare function peg$SyntaxError(message: any, expected: any, found: any, location: any): void; +declare function peg$SyntaxError(message: any, expected: any, found: any, location: any): Error; declare class peg$SyntaxError { constructor(message: any, expected: any, found: any, location: any); - message: any; - expected: any; - found: any; - location: any; - name: string; + format(sources: any): string; } declare namespace peg$SyntaxError { function buildMessage(expected: any, found: any): string; } declare function peg$parse(input: any, options: any): any; +export declare let StartRules: string[]; export { peg$SyntaxError as SyntaxError, peg$parse as parse }; //# sourceMappingURL=parser.d.cts.map \ No newline at end of file diff --git a/types/lib/parser.d.cts.map b/types/lib/parser.d.cts.map index 17e3b96..cd1dafc 100644 --- a/types/lib/parser.d.cts.map +++ b/types/lib/parser.d.cts.map @@ -1 +1 @@ -{"version":3,"file":"parser.d.cts","sourceRoot":"","sources":["../../lib/parser.cjs"],"names":[],"mappings":"AAeA,+FAUC;;IAVD,oEAUC;IATC,aAAuB;IACvB,cAAwB;IACxB,WAAqB;IACrB,cAAwB;IACxB,aAA6B;;;IAS/B,yDAyGC;;AAED,0DA4wHC"} \ No newline at end of file +{"version":3,"file":"parser.d.cts","sourceRoot":"","sources":["../../lib/parser.cjs"],"names":[],"mappings":"AAcA,gGAWC;;IAXD,oEAWC;IAYD,6BAgCC;;;IAED,yDAkGC;;AAED,0DA6qGC"} \ No newline at end of file