| /* |
| * Generated by PEG.js 0.10.0. |
| * |
| * http://pegjs.org/ |
| */ |
| |
| "use strict"; |
| |
| function peg$subclass(child, parent) { |
| function ctor() { this.constructor = child; } |
| ctor.prototype = parent.prototype; |
| child.prototype = new ctor(); |
| } |
| |
| function peg$SyntaxError(message, expected, found, location) { |
| this.message = message; |
| this.expected = expected; |
| this.found = found; |
| this.location = location; |
| this.name = "SyntaxError"; |
| |
| if (typeof Error.captureStackTrace === "function") { |
| Error.captureStackTrace(this, peg$SyntaxError); |
| } |
| } |
| |
| peg$subclass(peg$SyntaxError, Error); |
| |
| peg$SyntaxError.buildMessage = function(expected, found) { |
| var 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]); |
| } |
| |
| return "[" + (expectation.inverted ? "^" : "") + escapedParts + "]"; |
| }, |
| |
| any: function(expectation) { |
| return "any character"; |
| }, |
| |
| end: function(expectation) { |
| return "end of input"; |
| }, |
| |
| other: function(expectation) { |
| return expectation.description; |
| } |
| }; |
| |
| function hex(ch) { |
| return ch.charCodeAt(0).toString(16).toUpperCase(); |
| } |
| |
| function literalEscape(s) { |
| return s |
| .replace(/\\/g, '\\\\') |
| .replace(/"/g, '\\"') |
| .replace(/\0/g, '\\0') |
| .replace(/\t/g, '\\t') |
| .replace(/\n/g, '\\n') |
| .replace(/\r/g, '\\r') |
| .replace(/[\x00-\x0F]/g, function(ch) { return '\\x0' + 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); }); |
| } |
| |
| function describeExpectation(expectation) { |
| return DESCRIBE_EXPECTATION_FNS[expectation.type](expectation); |
| } |
| |
| function describeExpected(expected) { |
| var descriptions = new Array(expected.length), |
| i, j; |
| |
| for (i = 0; i < expected.length; i++) { |
| descriptions[i] = describeExpectation(expected[i]); |
| } |
| |
| descriptions.sort(); |
| |
| if (descriptions.length > 0) { |
| for (i = 1, j = 1; i < descriptions.length; i++) { |
| if (descriptions[i - 1] !== descriptions[i]) { |
| descriptions[j] = descriptions[i]; |
| j++; |
| } |
| } |
| descriptions.length = j; |
| } |
| |
| switch (descriptions.length) { |
| case 1: |
| return descriptions[0]; |
| |
| case 2: |
| return descriptions[0] + " or " + descriptions[1]; |
| |
| default: |
| return descriptions.slice(0, -1).join(", ") |
| + ", or " |
| + descriptions[descriptions.length - 1]; |
| } |
| } |
| |
| function describeFound(found) { |
| return found ? "\"" + literalEscape(found) + "\"" : "end of input"; |
| } |
| |
| return "Expected " + describeExpected(expected) + " but " + describeFound(found) + " found."; |
| }; |
| |
| function peg$parse(input, options) { |
| options = options !== void 0 ? options : {}; |
| |
| var peg$FAILED = {}, |
| |
| peg$startRuleFunctions = { TopTypeExpr: peg$parseTopTypeExpr }, |
| peg$startRuleFunction = peg$parseTopTypeExpr, |
| |
| peg$c0 = function(expr) { |
| return expr; |
| }, |
| peg$c1 = /^[ \t]/, |
| peg$c2 = peg$classExpectation([" ", "\t"], false, false), |
| peg$c3 = /^[\r]/, |
| peg$c4 = peg$classExpectation(["\r"], false, false), |
| peg$c5 = /^[\n]/, |
| peg$c6 = peg$classExpectation(["\n"], false, false), |
| peg$c7 = /^[a-zA-Z_$]/, |
| peg$c8 = peg$classExpectation([["a", "z"], ["A", "Z"], "_", "$"], false, false), |
| peg$c9 = /^[a-zA-Z0-9_$]/, |
| peg$c10 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "$"], false, false), |
| peg$c11 = "event:", |
| peg$c12 = peg$literalExpectation("event:", false), |
| peg$c13 = function(rootOwner, memberPartWithOperators) { |
| return memberPartWithOperators.reduce(function(owner, tokens) { |
| const operatorType = tokens[1]; |
| const eventNamespace = tokens[3]; |
| const MemberName = tokens[5]; |
| const {quoteStyle, name: memberName} = MemberName; |
| |
| switch (operatorType) { |
| case NamepathOperatorType.MEMBER: |
| return { |
| type: NodeType.MEMBER, |
| owner, |
| name: memberName, |
| quoteStyle, |
| hasEventPrefix: Boolean(eventNamespace), |
| }; |
| case NamepathOperatorType.INSTANCE_MEMBER: |
| return { |
| type: NodeType.INSTANCE_MEMBER, |
| owner, |
| name: memberName, |
| quoteStyle, |
| hasEventPrefix: Boolean(eventNamespace), |
| }; |
| case NamepathOperatorType.INNER_MEMBER: |
| return { |
| type: NodeType.INNER_MEMBER, |
| owner, |
| name: memberName, |
| quoteStyle, |
| hasEventPrefix: Boolean(eventNamespace), |
| }; |
| default: |
| throw new Error('Unexpected operator type: "' + operatorType + '"'); |
| } |
| }, rootOwner); |
| }, |
| peg$c14 = function(name) { |
| return { |
| type: NodeType.NAME, |
| name |
| }; |
| }, |
| peg$c15 = /^[a-zA-Z0-9_$\-]/, |
| peg$c16 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "$", "-"], false, false), |
| peg$c17 = function(name) { |
| return { |
| type: NodeType.NAME, |
| name |
| }; |
| }, |
| peg$c18 = "'", |
| peg$c19 = peg$literalExpectation("'", false), |
| peg$c20 = /^[^\\']/, |
| peg$c21 = peg$classExpectation(["\\", "'"], true, false), |
| peg$c22 = "\\", |
| peg$c23 = peg$literalExpectation("\\", false), |
| peg$c24 = peg$anyExpectation(), |
| peg$c25 = function(name) { |
| return { |
| quoteStyle: 'single', |
| name: name.replace(/\\'/g, "'") |
| .replace(/\\\\/gu, '\\') |
| }; |
| }, |
| peg$c26 = "\"", |
| peg$c27 = peg$literalExpectation("\"", false), |
| peg$c28 = /^[^\\"]/, |
| peg$c29 = peg$classExpectation(["\\", "\""], true, false), |
| peg$c30 = function(name) { |
| return { |
| quoteStyle: 'double', |
| name: name.replace(/\\"/gu, '"') |
| .replace(/\\\\/gu, '\\') |
| }; |
| }, |
| peg$c31 = function(name) { |
| return { |
| quoteStyle: 'none', |
| name |
| }; |
| }, |
| peg$c32 = ".", |
| peg$c33 = peg$literalExpectation(".", false), |
| peg$c34 = function(rootOwner, memberPart) { |
| return memberPart.reduce(function(owner, tokens) { |
| return { |
| type: NodeType.MEMBER, |
| owner, |
| name: tokens[3] |
| } |
| }, rootOwner); |
| }, |
| peg$c35 = function() { |
| return NamepathOperatorType.MEMBER; |
| }, |
| peg$c36 = "~", |
| peg$c37 = peg$literalExpectation("~", false), |
| peg$c38 = function() { |
| return NamepathOperatorType.INNER_MEMBER; |
| }, |
| peg$c39 = "#", |
| peg$c40 = peg$literalExpectation("#", false), |
| peg$c41 = function() { |
| return NamepathOperatorType.INSTANCE_MEMBER; |
| }, |
| peg$c42 = "external", |
| peg$c43 = peg$literalExpectation("external", false), |
| peg$c44 = ":", |
| peg$c45 = peg$literalExpectation(":", false), |
| peg$c46 = function(external, memberPartWithOperators) { |
| return memberPartWithOperators.reduce(function(owner, tokens) { |
| const operatorType = tokens[1]; |
| const eventNamespace = tokens[3]; |
| const MemberName = tokens[5]; |
| const {quoteStyle, name: memberName} = MemberName; |
| |
| switch (operatorType) { |
| case NamepathOperatorType.MEMBER: |
| return { |
| type: NodeType.MEMBER, |
| owner, |
| name: memberName, |
| quoteStyle, |
| hasEventPrefix: Boolean(eventNamespace), |
| }; |
| case NamepathOperatorType.INSTANCE_MEMBER: |
| return { |
| type: NodeType.INSTANCE_MEMBER, |
| owner, |
| name: memberName, |
| quoteStyle, |
| hasEventPrefix: Boolean(eventNamespace), |
| }; |
| case NamepathOperatorType.INNER_MEMBER: |
| return { |
| type: NodeType.INNER_MEMBER, |
| owner, |
| name: memberName, |
| quoteStyle, |
| hasEventPrefix: Boolean(eventNamespace), |
| }; |
| default: |
| throw new Error('Unexpected operator type: "' + operatorType + '"'); |
| } |
| }, Object.assign({ |
| type: NodeType.EXTERNAL |
| }, external)); |
| }, |
| peg$c47 = "module", |
| peg$c48 = peg$literalExpectation("module", false), |
| peg$c49 = function(value) { |
| return { |
| type: NodeType.MODULE, |
| value, |
| }; |
| }, |
| peg$c50 = function(rootOwner, memberPartWithOperators) { |
| return memberPartWithOperators.reduce(function(owner, tokens) { |
| const operatorType = tokens[1]; |
| const eventNamespace = tokens[3]; |
| const MemberName = tokens[5]; |
| const {quoteStyle, name: memberName} = MemberName; |
| |
| switch (operatorType) { |
| case NamepathOperatorType.MEMBER: |
| return { |
| type: NodeType.MEMBER, |
| owner, |
| name: memberName, |
| quoteStyle, |
| hasEventPrefix: Boolean(eventNamespace), |
| }; |
| case NamepathOperatorType.INSTANCE_MEMBER: |
| return { |
| type: NodeType.INSTANCE_MEMBER, |
| owner, |
| name: memberName, |
| quoteStyle, |
| hasEventPrefix: Boolean(eventNamespace), |
| }; |
| case NamepathOperatorType.INNER_MEMBER: |
| return { |
| type: NodeType.INNER_MEMBER, |
| owner, |
| name: memberName, |
| quoteStyle, |
| hasEventPrefix: Boolean(eventNamespace), |
| }; |
| default: |
| throw new Error('Unexpected operator type: "' + operatorType + '"'); |
| } |
| }, rootOwner); |
| }, |
| peg$c51 = function(path) { |
| return { |
| quoteStyle: 'single', |
| type: NodeType.FILE_PATH, |
| path: path.replace(/\\'/g, "'") |
| .replace(/\\\\/gu, '\\') |
| }; |
| }, |
| peg$c52 = function(path) { |
| return { |
| quoteStyle: 'double', |
| type: NodeType.FILE_PATH, |
| path: path.replace(/\\"/gu, '"') |
| .replace(/\\\\/gu, '\\') |
| }; |
| }, |
| peg$c53 = /^[a-zA-Z0-9_$\/\-]/, |
| peg$c54 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"], "_", "$", "/", "-"], false, false), |
| peg$c55 = function(path) { |
| return { |
| quoteStyle: 'none', |
| type: NodeType.FILE_PATH, |
| path, |
| }; |
| }, |
| peg$c56 = "*", |
| peg$c57 = peg$literalExpectation("*", false), |
| peg$c58 = function() { |
| return { type: NodeType.ANY }; |
| }, |
| peg$c59 = "?", |
| peg$c60 = peg$literalExpectation("?", false), |
| peg$c61 = function() { |
| return { type: NodeType.UNKNOWN }; |
| }, |
| peg$c62 = function(value) { |
| return { |
| type: NodeType.STRING_VALUE, |
| quoteStyle: 'double', |
| string: value.replace(/\\"/gu, '"') |
| .replace(/\\\\/gu, '\\') |
| }; |
| }, |
| peg$c63 = function(value) { |
| return { |
| type: NodeType.STRING_VALUE, |
| quoteStyle: 'single', |
| string: value.replace(/\\'/g, "'") |
| .replace(/\\\\/gu, '\\') |
| }; |
| }, |
| peg$c64 = function(value) { |
| return { |
| type: NodeType.NUMBER_VALUE, |
| number: value |
| }; |
| }, |
| peg$c65 = "+", |
| peg$c66 = peg$literalExpectation("+", false), |
| peg$c67 = "-", |
| peg$c68 = peg$literalExpectation("-", false), |
| peg$c69 = /^[0-9]/, |
| peg$c70 = peg$classExpectation([["0", "9"]], false, false), |
| peg$c71 = "e", |
| peg$c72 = peg$literalExpectation("e", false), |
| peg$c73 = "0b", |
| peg$c74 = peg$literalExpectation("0b", false), |
| peg$c75 = /^[01]/, |
| peg$c76 = peg$classExpectation(["0", "1"], false, false), |
| peg$c77 = "0o", |
| peg$c78 = peg$literalExpectation("0o", false), |
| peg$c79 = /^[0-7]/, |
| peg$c80 = peg$classExpectation([["0", "7"]], false, false), |
| peg$c81 = "0x", |
| peg$c82 = peg$literalExpectation("0x", false), |
| peg$c83 = /^[0-9a-fA-F]/, |
| peg$c84 = peg$classExpectation([["0", "9"], ["a", "f"], ["A", "F"]], false, false), |
| peg$c85 = function(left, syntax, right) { |
| return { |
| type: NodeType.UNION, |
| left, |
| right, |
| meta: { syntax }, |
| }; |
| }, |
| peg$c86 = "|", |
| peg$c87 = peg$literalExpectation("|", false), |
| peg$c88 = function() { |
| return UnionTypeSyntax.PIPE; |
| }, |
| peg$c89 = "/", |
| peg$c90 = peg$literalExpectation("/", false), |
| peg$c91 = function() { |
| return UnionTypeSyntax.SLASH; |
| }, |
| peg$c92 = "typeof", |
| peg$c93 = peg$literalExpectation("typeof", false), |
| peg$c94 = function(operator, name) { |
| return { |
| type: NodeType.TYPE_QUERY, |
| name, |
| }; |
| }, |
| peg$c95 = "keyof", |
| peg$c96 = peg$literalExpectation("keyof", false), |
| peg$c97 = function(operator, operand) { |
| return { |
| type: NodeType.KEY_QUERY, |
| value: operand, |
| } |
| }, |
| peg$c98 = "import", |
| peg$c99 = peg$literalExpectation("import", false), |
| peg$c100 = "(", |
| peg$c101 = peg$literalExpectation("(", false), |
| peg$c102 = ")", |
| peg$c103 = peg$literalExpectation(")", false), |
| peg$c104 = function(operator, path) { |
| return { type: NodeType.IMPORT, path }; |
| }, |
| peg$c105 = function(operator, operand) { |
| return { |
| type: NodeType.NULLABLE, |
| value: operand, |
| meta: { syntax: NullableTypeSyntax.PREFIX_QUESTION_MARK }, |
| }; |
| }, |
| peg$c106 = "!", |
| peg$c107 = peg$literalExpectation("!", false), |
| peg$c108 = function(operator, operand) { |
| return { |
| type: NodeType.NOT_NULLABLE, |
| value: operand, |
| meta: { syntax: NotNullableTypeSyntax.PREFIX_BANG }, |
| }; |
| }, |
| peg$c109 = "=", |
| peg$c110 = peg$literalExpectation("=", false), |
| peg$c111 = function(operator, operand) { |
| return { |
| type: NodeType.OPTIONAL, |
| value: operand, |
| meta: { syntax: OptionalTypeSyntax.PREFIX_EQUALS_SIGN }, |
| }; |
| }, |
| peg$c112 = function(operand, operator) { |
| return { |
| type: NodeType.NULLABLE, |
| value: operand, |
| meta: { syntax: NullableTypeSyntax.SUFFIX_QUESTION_MARK }, |
| }; |
| }, |
| peg$c113 = function(operand, operator) { |
| return { |
| type: NodeType.NOT_NULLABLE, |
| value: operand, |
| meta: { syntax: NotNullableTypeSyntax.SUFFIX_BANG }, |
| }; |
| }, |
| peg$c114 = function(operand, operator) { |
| return { |
| type: NodeType.OPTIONAL, |
| value: operand, |
| meta: { syntax: OptionalTypeSyntax.SUFFIX_EQUALS_SIGN }, |
| }; |
| }, |
| peg$c115 = function(operand, syntax, params) { |
| return { |
| type: NodeType.GENERIC, |
| subject: operand, |
| objects: params, |
| meta: { syntax }, |
| }; |
| }, |
| peg$c116 = ",", |
| peg$c117 = peg$literalExpectation(",", false), |
| peg$c118 = function(first, restsWithComma) { |
| return restsWithComma.reduce(function(params, tokens) { |
| return params.concat([tokens[3]]); |
| }, [first]); |
| }, |
| peg$c119 = ".<", |
| peg$c120 = peg$literalExpectation(".<", false), |
| peg$c121 = function() { |
| return GenericTypeSyntax.ANGLE_BRACKET_WITH_DOT; |
| }, |
| peg$c122 = "<", |
| peg$c123 = peg$literalExpectation("<", false), |
| peg$c124 = function() { |
| return GenericTypeSyntax.ANGLE_BRACKET; |
| }, |
| peg$c125 = ">", |
| peg$c126 = peg$literalExpectation(">", false), |
| peg$c127 = "[", |
| peg$c128 = peg$literalExpectation("[", false), |
| peg$c129 = "]", |
| peg$c130 = peg$literalExpectation("]", false), |
| peg$c131 = function(operand, brackets) { |
| return brackets.reduce(function(operand) { |
| return { |
| type: NodeType.GENERIC, |
| subject: { |
| type: NodeType.NAME, |
| name: 'Array' |
| }, |
| objects: [ operand ], |
| meta: { syntax: GenericTypeSyntax.SQUARE_BRACKET }, |
| }; |
| }, operand); |
| }, |
| peg$c132 = "new", |
| peg$c133 = peg$literalExpectation("new", false), |
| peg$c134 = "=>", |
| peg$c135 = peg$literalExpectation("=>", false), |
| peg$c136 = function(newModifier, paramsPart, returnedTypeNode) { |
| return { |
| type: NodeType.ARROW, |
| params: paramsPart, |
| returns: returnedTypeNode, |
| new: newModifier |
| }; |
| }, |
| peg$c137 = function(params) { |
| return params; |
| }, |
| peg$c138 = function() { |
| return []; |
| }, |
| peg$c139 = function(paramsWithComma, lastParam) { |
| return paramsWithComma.reduceRight(function(params, tokens) { |
| const param = { type: NodeType.NAMED_PARAMETER, name: tokens[0], typeName: tokens[4] }; |
| return [param].concat(params); |
| }, lastParam ? [lastParam] : []); |
| }, |
| peg$c140 = "...", |
| peg$c141 = peg$literalExpectation("...", false), |
| peg$c142 = function(spread, id, type) { |
| const operand = { type: NodeType.NAMED_PARAMETER, name: id, typeName: type }; |
| if (spread) { |
| return { |
| type: NodeType.VARIADIC, |
| value: operand, |
| meta: { syntax: VariadicTypeSyntax.PREFIX_DOTS }, |
| }; |
| } |
| else { |
| return operand; |
| } |
| }, |
| peg$c143 = "function", |
| peg$c144 = peg$literalExpectation("function", false), |
| peg$c145 = function(paramsPart, returnedTypePart) { |
| const returnedTypeNode = returnedTypePart ? returnedTypePart[2] : null; |
| |
| return { |
| type: NodeType.FUNCTION, |
| params: paramsPart.params, |
| returns: returnedTypeNode, |
| this: paramsPart.modifier.nodeThis, |
| new: paramsPart.modifier.nodeNew, |
| }; |
| }, |
| peg$c146 = function(modifier, params) { |
| return { params, modifier }; |
| }, |
| peg$c147 = function(modifier) { |
| return { params: [], modifier }; |
| }, |
| peg$c148 = function(params) { |
| return { params, modifier: { nodeThis: null, nodeNew: null } }; |
| }, |
| peg$c149 = function() { |
| return { params: [], modifier: { nodeThis: null, nodeNew: null } }; |
| }, |
| peg$c150 = "this", |
| peg$c151 = peg$literalExpectation("this", false), |
| peg$c152 = function(modifierThis) { |
| return { nodeThis: modifierThis[4], nodeNew: null }; |
| }, |
| peg$c153 = function(modifierNew) { |
| return { nodeThis: null, nodeNew: modifierNew[4] }; |
| }, |
| peg$c154 = function(paramsWithComma, lastParam) { |
| return paramsWithComma.reduceRight(function(params, tokens) { |
| const [param] = tokens; |
| return [param].concat(params); |
| }, lastParam ? [lastParam] : []); |
| }, |
| peg$c155 = "{", |
| peg$c156 = peg$literalExpectation("{", false), |
| peg$c157 = "}", |
| peg$c158 = peg$literalExpectation("}", false), |
| peg$c159 = function(entries) { |
| return { |
| type: NodeType.RECORD, |
| entries: entries || [], |
| }; |
| }, |
| peg$c160 = ";", |
| peg$c161 = peg$literalExpectation(";", false), |
| peg$c162 = function(first, restWithComma) { |
| return restWithComma.reduce(function(entries, tokens) { |
| const entry = tokens[2]; |
| return entries.concat([entry]); |
| }, [first]); |
| }, |
| peg$c163 = function(keyInfo, optional, value) { |
| const {quoteStyle, key} = keyInfo; |
| return { |
| type: NodeType.RECORD_ENTRY, |
| key, |
| quoteStyle, |
| value: optional !== '?' ? value : { |
| type: NodeType.OPTIONAL, |
| value, |
| meta: { syntax: OptionalTypeSyntax.SUFFIX_KEY_QUESTION_MARK }, |
| } |
| }; |
| }, |
| peg$c164 = function(keyInfo) { |
| const {quoteStyle, key} = keyInfo; |
| return { |
| type: NodeType.RECORD_ENTRY, |
| key, |
| value: null, |
| quoteStyle |
| }; |
| }, |
| peg$c165 = function(key) { |
| return { |
| quoteStyle: 'double', |
| key: key.replace(/\\"/gu, '"') |
| .replace(/\\\\/gu, '\\') |
| }; |
| }, |
| peg$c166 = function(key) { |
| return { |
| quoteStyle: 'single', |
| key: key.replace(/\\'/g, "'") |
| .replace(/\\\\/gu, '\\') |
| }; |
| }, |
| peg$c167 = function(key) { |
| return { |
| quoteStyle: 'none', |
| key |
| }; |
| }, |
| peg$c168 = function(entries) { |
| return { |
| type: NodeType.TUPLE, |
| entries: entries || [], |
| } |
| }, |
| peg$c169 = function(restWithComma, last) { |
| return restWithComma.reduceRight((entries, tokens) => { |
| let [entry] = tokens; |
| return [entry].concat(entries); |
| }, last ? [last] : []); |
| }, |
| peg$c170 = function(wrapped) { |
| return { |
| type: NodeType.PARENTHESIS, |
| value: wrapped, |
| }; |
| }, |
| peg$c171 = function(operand) { |
| return { |
| type: NodeType.VARIADIC, |
| value: operand, |
| meta: { syntax: VariadicTypeSyntax.PREFIX_DOTS }, |
| }; |
| }, |
| peg$c172 = function(operand) { |
| return { |
| type: NodeType.VARIADIC, |
| value: operand, |
| meta: { syntax: VariadicTypeSyntax.SUFFIX_DOTS }, |
| }; |
| }, |
| peg$c173 = function() { |
| return { |
| type: NodeType.VARIADIC, |
| value: { type: NodeType.ANY }, |
| meta: { syntax: VariadicTypeSyntax.ONLY_DOTS }, |
| }; |
| }, |
| |
| peg$currPos = 0, |
| peg$savedPos = 0, |
| peg$posDetailsCache = [{ line: 1, column: 1 }], |
| peg$maxFailPos = 0, |
| peg$maxFailExpected = [], |
| peg$silentFails = 0, |
| |
| peg$resultsCache = {}, |
| |
| peg$result; |
| |
| if ("startRule" in options) { |
| if (!(options.startRule in peg$startRuleFunctions)) { |
| throw new Error("Can't start parsing from rule \"" + options.startRule + "\"."); |
| } |
| |
| peg$startRuleFunction = peg$startRuleFunctions[options.startRule]; |
| } |
| |
| function text() { |
| return input.substring(peg$savedPos, peg$currPos); |
| } |
| |
| function location() { |
| return peg$computeLocation(peg$savedPos, peg$currPos); |
| } |
| |
| function expected(description, location) { |
| location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) |
| |
| throw peg$buildStructuredError( |
| [peg$otherExpectation(description)], |
| input.substring(peg$savedPos, peg$currPos), |
| location |
| ); |
| } |
| |
| function error(message, location) { |
| location = location !== void 0 ? location : peg$computeLocation(peg$savedPos, peg$currPos) |
| |
| throw peg$buildSimpleError(message, location); |
| } |
| |
| function peg$literalExpectation(text, ignoreCase) { |
| return { type: "literal", text: text, ignoreCase: ignoreCase }; |
| } |
| |
| function peg$classExpectation(parts, inverted, ignoreCase) { |
| return { type: "class", parts: parts, inverted: inverted, ignoreCase: ignoreCase }; |
| } |
| |
| function peg$anyExpectation() { |
| return { type: "any" }; |
| } |
| |
| function peg$endExpectation() { |
| return { type: "end" }; |
| } |
| |
| function peg$otherExpectation(description) { |
| return { type: "other", description: description }; |
| } |
| |
| function peg$computePosDetails(pos) { |
| var details = peg$posDetailsCache[pos], p; |
| |
| if (details) { |
| return details; |
| } else { |
| p = pos - 1; |
| while (!peg$posDetailsCache[p]) { |
| p--; |
| } |
| |
| details = peg$posDetailsCache[p]; |
| details = { |
| line: details.line, |
| column: details.column |
| }; |
| |
| while (p < pos) { |
| if (input.charCodeAt(p) === 10) { |
| details.line++; |
| details.column = 1; |
| } else { |
| details.column++; |
| } |
| |
| p++; |
| } |
| |
| peg$posDetailsCache[pos] = details; |
| return details; |
| } |
| } |
| |
| function peg$computeLocation(startPos, endPos) { |
| var startPosDetails = peg$computePosDetails(startPos), |
| endPosDetails = peg$computePosDetails(endPos); |
| |
| return { |
| start: { |
| offset: startPos, |
| line: startPosDetails.line, |
| column: startPosDetails.column |
| }, |
| end: { |
| offset: endPos, |
| line: endPosDetails.line, |
| column: endPosDetails.column |
| } |
| }; |
| } |
| |
| function peg$fail(expected) { |
| if (peg$currPos < peg$maxFailPos) { return; } |
| |
| if (peg$currPos > peg$maxFailPos) { |
| peg$maxFailPos = peg$currPos; |
| peg$maxFailExpected = []; |
| } |
| |
| peg$maxFailExpected.push(expected); |
| } |
| |
| function peg$buildSimpleError(message, location) { |
| return new peg$SyntaxError(message, null, null, location); |
| } |
| |
| function peg$buildStructuredError(expected, found, location) { |
| return new peg$SyntaxError( |
| peg$SyntaxError.buildMessage(expected, found), |
| expected, |
| found, |
| location |
| ); |
| } |
| |
| function peg$parseTopTypeExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 0, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parse_(); |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parseVariadicTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseUnionTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseUnaryUnionTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseArrayTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseGenericTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseRecordTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseTupleTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseArrowTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseFunctionTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseTypeQueryExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseKeyQueryExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseBroadNamepathExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseParenthesizedExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseValueExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseAnyTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parse_(); |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c0(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseTopLevel() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 1, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parse_(); |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parseVariadicTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseUnionTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseUnaryUnionTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseArrayTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseGenericTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseRecordTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseTupleTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseArrowTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseFunctionTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseTypeQueryExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseKeyQueryExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseBroadNamepathExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseParenthesizedExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseValueExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseAnyTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parse_(); |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c0(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parse_() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 2, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = []; |
| if (peg$c1.test(input.charAt(peg$currPos))) { |
| s1 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c2); } |
| } |
| if (s1 === peg$FAILED) { |
| s1 = peg$currPos; |
| if (peg$c3.test(input.charAt(peg$currPos))) { |
| s2 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c4); } |
| } |
| if (s2 === peg$FAILED) { |
| s2 = null; |
| } |
| if (s2 !== peg$FAILED) { |
| if (peg$c5.test(input.charAt(peg$currPos))) { |
| s3 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c6); } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = [s2, s3]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } |
| while (s1 !== peg$FAILED) { |
| s0.push(s1); |
| if (peg$c1.test(input.charAt(peg$currPos))) { |
| s1 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c2); } |
| } |
| if (s1 === peg$FAILED) { |
| s1 = peg$currPos; |
| if (peg$c3.test(input.charAt(peg$currPos))) { |
| s2 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c4); } |
| } |
| if (s2 === peg$FAILED) { |
| s2 = null; |
| } |
| if (s2 !== peg$FAILED) { |
| if (peg$c5.test(input.charAt(peg$currPos))) { |
| s3 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c6); } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = [s2, s3]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseJsIdentifier() { |
| var s0, s1, s2, s3, s4; |
| |
| var key = peg$currPos * 84 + 3, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| if (peg$c7.test(input.charAt(peg$currPos))) { |
| s2 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c8); } |
| } |
| if (s2 !== peg$FAILED) { |
| s3 = []; |
| if (peg$c9.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c10); } |
| } |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c9.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c10); } |
| } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = [s2, s3]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| if (s1 !== peg$FAILED) { |
| s0 = input.substring(s0, peg$currPos); |
| } else { |
| s0 = s1; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseNamepathExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; |
| |
| var key = peg$currPos * 84 + 4, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseParenthesizedExpr(); |
| if (s1 === peg$FAILED) { |
| s1 = peg$parseImportTypeExpr(); |
| if (s1 === peg$FAILED) { |
| s1 = peg$parseTypeNameExpr(); |
| } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = []; |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parseInfixNamepathOperator(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 6) === peg$c11) { |
| s7 = peg$c11; |
| peg$currPos += 6; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c12); } |
| } |
| if (s7 === peg$FAILED) { |
| s7 = null; |
| } |
| if (s7 !== peg$FAILED) { |
| s8 = peg$parse_(); |
| if (s8 !== peg$FAILED) { |
| s9 = peg$parseMemberName(); |
| if (s9 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7, s8, s9]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| while (s3 !== peg$FAILED) { |
| s2.push(s3); |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parseInfixNamepathOperator(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 6) === peg$c11) { |
| s7 = peg$c11; |
| peg$currPos += 6; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c12); } |
| } |
| if (s7 === peg$FAILED) { |
| s7 = null; |
| } |
| if (s7 !== peg$FAILED) { |
| s8 = peg$parse_(); |
| if (s8 !== peg$FAILED) { |
| s9 = peg$parseMemberName(); |
| if (s9 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7, s8, s9]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c13(s1, s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseTypeNameExpr() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 5, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseTypeNameExprJsDocFlavored(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeNameExprStrict(); |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseTypeNameExprStrict() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 6, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseJsIdentifier(); |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c14(s1); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseTypeNameExprJsDocFlavored() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 7, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| s2 = peg$currPos; |
| if (peg$c7.test(input.charAt(peg$currPos))) { |
| s3 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c8); } |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = []; |
| if (peg$c15.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c16); } |
| } |
| while (s5 !== peg$FAILED) { |
| s4.push(s5); |
| if (peg$c15.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c16); } |
| } |
| } |
| if (s4 !== peg$FAILED) { |
| s3 = [s3, s4]; |
| s2 = s3; |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| if (s2 !== peg$FAILED) { |
| s1 = input.substring(s1, peg$currPos); |
| } else { |
| s1 = s2; |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c17(s1); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseMemberName() { |
| var s0, s1, s2, s3, s4, s5, s6; |
| |
| var key = peg$currPos * 84 + 8, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 39) { |
| s1 = peg$c18; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c19); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$currPos; |
| s3 = []; |
| if (peg$c20.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c21); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c20.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c21); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = input.substring(s2, peg$currPos); |
| } else { |
| s2 = s3; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 39) { |
| s3 = peg$c18; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c19); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c25(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 34) { |
| s1 = peg$c26; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c27); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$currPos; |
| s3 = []; |
| if (peg$c28.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c29); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c28.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c29); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = input.substring(s2, peg$currPos); |
| } else { |
| s2 = s3; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 34) { |
| s3 = peg$c26; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c27); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c30(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| s1 = peg$parseJsIdentifier(); |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c31(s1); |
| } |
| s0 = s1; |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseInfixNamepathOperator() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 9, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseMemberTypeOperator(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseInstanceMemberTypeOperator(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseInnerMemberTypeOperator(); |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseQualifiedMemberName() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 10, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseTypeNameExpr(); |
| if (s1 !== peg$FAILED) { |
| s2 = []; |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 46) { |
| s5 = peg$c32; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c33); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseTypeNameExpr(); |
| if (s7 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| while (s3 !== peg$FAILED) { |
| s2.push(s3); |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 46) { |
| s5 = peg$c32; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c33); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseTypeNameExpr(); |
| if (s7 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c34(s1, s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseMemberTypeOperator() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 11, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 46) { |
| s1 = peg$c32; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c33); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c35(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseInnerMemberTypeOperator() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 12, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 126) { |
| s1 = peg$c36; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c37); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c38(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseInstanceMemberTypeOperator() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 13, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 35) { |
| s1 = peg$c39; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c40); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c41(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseBroadNamepathExpr() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 14, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseExternalNameExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseModuleNameExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseNamepathExpr(); |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseExternalNameExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13; |
| |
| var key = peg$currPos * 84 + 15, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 8) === peg$c42) { |
| s1 = peg$c42; |
| peg$currPos += 8; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c43); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 58) { |
| s3 = peg$c44; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c45); } |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parseMemberName(); |
| if (s5 !== peg$FAILED) { |
| s6 = []; |
| s7 = peg$currPos; |
| s8 = peg$parse_(); |
| if (s8 !== peg$FAILED) { |
| s9 = peg$parseInfixNamepathOperator(); |
| if (s9 !== peg$FAILED) { |
| s10 = peg$parse_(); |
| if (s10 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 6) === peg$c11) { |
| s11 = peg$c11; |
| peg$currPos += 6; |
| } else { |
| s11 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c12); } |
| } |
| if (s11 === peg$FAILED) { |
| s11 = null; |
| } |
| if (s11 !== peg$FAILED) { |
| s12 = peg$parse_(); |
| if (s12 !== peg$FAILED) { |
| s13 = peg$parseMemberName(); |
| if (s13 !== peg$FAILED) { |
| s8 = [s8, s9, s10, s11, s12, s13]; |
| s7 = s8; |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| while (s7 !== peg$FAILED) { |
| s6.push(s7); |
| s7 = peg$currPos; |
| s8 = peg$parse_(); |
| if (s8 !== peg$FAILED) { |
| s9 = peg$parseInfixNamepathOperator(); |
| if (s9 !== peg$FAILED) { |
| s10 = peg$parse_(); |
| if (s10 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 6) === peg$c11) { |
| s11 = peg$c11; |
| peg$currPos += 6; |
| } else { |
| s11 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c12); } |
| } |
| if (s11 === peg$FAILED) { |
| s11 = null; |
| } |
| if (s11 !== peg$FAILED) { |
| s12 = peg$parse_(); |
| if (s12 !== peg$FAILED) { |
| s13 = peg$parseMemberName(); |
| if (s13 !== peg$FAILED) { |
| s8 = [s8, s9, s10, s11, s12, s13]; |
| s7 = s8; |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s7; |
| s7 = peg$FAILED; |
| } |
| } |
| if (s6 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c46(s5, s6); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseModuleNameExpr() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 16, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 6) === peg$c47) { |
| s1 = peg$c47; |
| peg$currPos += 6; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c48); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 58) { |
| s3 = peg$c44; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c45); } |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parseModulePathExpr(); |
| if (s5 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c49(s5); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseModulePathExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; |
| |
| var key = peg$currPos * 84 + 17, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseFilePathExpr(); |
| if (s1 !== peg$FAILED) { |
| s2 = []; |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parseInfixNamepathOperator(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 6) === peg$c11) { |
| s7 = peg$c11; |
| peg$currPos += 6; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c12); } |
| } |
| if (s7 === peg$FAILED) { |
| s7 = null; |
| } |
| if (s7 !== peg$FAILED) { |
| s8 = peg$parse_(); |
| if (s8 !== peg$FAILED) { |
| s9 = peg$parseMemberName(); |
| if (s9 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7, s8, s9]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| while (s3 !== peg$FAILED) { |
| s2.push(s3); |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parseInfixNamepathOperator(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 6) === peg$c11) { |
| s7 = peg$c11; |
| peg$currPos += 6; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c12); } |
| } |
| if (s7 === peg$FAILED) { |
| s7 = null; |
| } |
| if (s7 !== peg$FAILED) { |
| s8 = peg$parse_(); |
| if (s8 !== peg$FAILED) { |
| s9 = peg$parseMemberName(); |
| if (s9 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7, s8, s9]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c50(s1, s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseFilePathExpr() { |
| var s0, s1, s2, s3, s4, s5, s6; |
| |
| var key = peg$currPos * 84 + 18, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 39) { |
| s1 = peg$c18; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c19); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$currPos; |
| s3 = []; |
| if (peg$c20.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c21); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c20.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c21); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = input.substring(s2, peg$currPos); |
| } else { |
| s2 = s3; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 39) { |
| s3 = peg$c18; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c19); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c51(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 34) { |
| s1 = peg$c26; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c27); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$currPos; |
| s3 = []; |
| if (peg$c28.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c29); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c28.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c29); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = input.substring(s2, peg$currPos); |
| } else { |
| s2 = s3; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 34) { |
| s3 = peg$c26; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c27); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c52(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| s2 = []; |
| if (peg$c53.test(input.charAt(peg$currPos))) { |
| s3 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c54); } |
| } |
| if (s3 !== peg$FAILED) { |
| while (s3 !== peg$FAILED) { |
| s2.push(s3); |
| if (peg$c53.test(input.charAt(peg$currPos))) { |
| s3 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c54); } |
| } |
| } |
| } else { |
| s2 = peg$FAILED; |
| } |
| if (s2 !== peg$FAILED) { |
| s1 = input.substring(s1, peg$currPos); |
| } else { |
| s1 = s2; |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c55(s1); |
| } |
| s0 = s1; |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseAnyTypeExpr() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 19, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 42) { |
| s1 = peg$c56; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c57); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c58(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseUnknownTypeExpr() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 20, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 63) { |
| s1 = peg$c59; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c60); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c61(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseValueExpr() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 21, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseStringLiteralExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseNumberLiteralExpr(); |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseStringLiteralExpr() { |
| var s0, s1, s2, s3, s4, s5, s6; |
| |
| var key = peg$currPos * 84 + 22, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 34) { |
| s1 = peg$c26; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c27); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$currPos; |
| s3 = []; |
| if (peg$c28.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c29); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c28.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c29); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = input.substring(s2, peg$currPos); |
| } else { |
| s2 = s3; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 34) { |
| s3 = peg$c26; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c27); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c62(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 39) { |
| s1 = peg$c18; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c19); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$currPos; |
| s3 = []; |
| if (peg$c20.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c21); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c20.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c21); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = input.substring(s2, peg$currPos); |
| } else { |
| s2 = s3; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 39) { |
| s3 = peg$c18; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c19); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c63(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseNumberLiteralExpr() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 23, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseBinNumberLiteralExpr(); |
| if (s1 === peg$FAILED) { |
| s1 = peg$parseOctNumberLiteralExpr(); |
| if (s1 === peg$FAILED) { |
| s1 = peg$parseHexNumberLiteralExpr(); |
| if (s1 === peg$FAILED) { |
| s1 = peg$parseDecimalNumberLiteralExpr(); |
| } |
| } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c64(s1); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseDecimalNumberLiteralExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 24, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 43) { |
| s2 = peg$c65; |
| peg$currPos++; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c66); } |
| } |
| if (s2 === peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 45) { |
| s2 = peg$c67; |
| peg$currPos++; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c68); } |
| } |
| } |
| if (s2 === peg$FAILED) { |
| s2 = null; |
| } |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseUnsignedDecimalNumberLiteralExpr(); |
| if (s3 !== peg$FAILED) { |
| s2 = [s2, s3]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| if (s1 !== peg$FAILED) { |
| s0 = input.substring(s0, peg$currPos); |
| } else { |
| s0 = s1; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseUnsignedDecimalNumberLiteralExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 25, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| s2 = peg$currPos; |
| s3 = []; |
| if (peg$c69.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c70); } |
| } |
| if (s4 !== peg$FAILED) { |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c69.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c70); } |
| } |
| } |
| } else { |
| s3 = peg$FAILED; |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 46) { |
| s5 = peg$c32; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c33); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = []; |
| if (peg$c69.test(input.charAt(peg$currPos))) { |
| s7 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c70); } |
| } |
| if (s7 !== peg$FAILED) { |
| while (s7 !== peg$FAILED) { |
| s6.push(s7); |
| if (peg$c69.test(input.charAt(peg$currPos))) { |
| s7 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c70); } |
| } |
| } |
| } else { |
| s6 = peg$FAILED; |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| if (s4 === peg$FAILED) { |
| s4 = null; |
| } |
| if (s4 !== peg$FAILED) { |
| s3 = [s3, s4]; |
| s2 = s3; |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| if (s2 === peg$FAILED) { |
| s2 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 46) { |
| s3 = peg$c32; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c33); } |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = []; |
| if (peg$c69.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c70); } |
| } |
| if (s5 !== peg$FAILED) { |
| while (s5 !== peg$FAILED) { |
| s4.push(s5); |
| if (peg$c69.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c70); } |
| } |
| } |
| } else { |
| s4 = peg$FAILED; |
| } |
| if (s4 !== peg$FAILED) { |
| s3 = [s3, s4]; |
| s2 = s3; |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } |
| if (s2 !== peg$FAILED) { |
| s3 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 101) { |
| s4 = peg$c71; |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c72); } |
| } |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 43) { |
| s5 = peg$c65; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c66); } |
| } |
| if (s5 === peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 45) { |
| s5 = peg$c67; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c68); } |
| } |
| } |
| if (s5 === peg$FAILED) { |
| s5 = null; |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = []; |
| if (peg$c69.test(input.charAt(peg$currPos))) { |
| s7 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c70); } |
| } |
| if (s7 !== peg$FAILED) { |
| while (s7 !== peg$FAILED) { |
| s6.push(s7); |
| if (peg$c69.test(input.charAt(peg$currPos))) { |
| s7 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c70); } |
| } |
| } |
| } else { |
| s6 = peg$FAILED; |
| } |
| if (s6 !== peg$FAILED) { |
| s4 = [s4, s5, s6]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| if (s3 === peg$FAILED) { |
| s3 = null; |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = [s2, s3]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| if (s1 !== peg$FAILED) { |
| s0 = input.substring(s0, peg$currPos); |
| } else { |
| s0 = s1; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseBinNumberLiteralExpr() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 26, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 45) { |
| s2 = peg$c67; |
| peg$currPos++; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c68); } |
| } |
| if (s2 === peg$FAILED) { |
| s2 = null; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 2) === peg$c73) { |
| s3 = peg$c73; |
| peg$currPos += 2; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c74); } |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = []; |
| if (peg$c75.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c76); } |
| } |
| if (s5 !== peg$FAILED) { |
| while (s5 !== peg$FAILED) { |
| s4.push(s5); |
| if (peg$c75.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c76); } |
| } |
| } |
| } else { |
| s4 = peg$FAILED; |
| } |
| if (s4 !== peg$FAILED) { |
| s2 = [s2, s3, s4]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| if (s1 !== peg$FAILED) { |
| s0 = input.substring(s0, peg$currPos); |
| } else { |
| s0 = s1; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseOctNumberLiteralExpr() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 27, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 45) { |
| s2 = peg$c67; |
| peg$currPos++; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c68); } |
| } |
| if (s2 === peg$FAILED) { |
| s2 = null; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 2) === peg$c77) { |
| s3 = peg$c77; |
| peg$currPos += 2; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c78); } |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = []; |
| if (peg$c79.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c80); } |
| } |
| if (s5 !== peg$FAILED) { |
| while (s5 !== peg$FAILED) { |
| s4.push(s5); |
| if (peg$c79.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c80); } |
| } |
| } |
| } else { |
| s4 = peg$FAILED; |
| } |
| if (s4 !== peg$FAILED) { |
| s2 = [s2, s3, s4]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| if (s1 !== peg$FAILED) { |
| s0 = input.substring(s0, peg$currPos); |
| } else { |
| s0 = s1; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseHexNumberLiteralExpr() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 28, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 45) { |
| s2 = peg$c67; |
| peg$currPos++; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c68); } |
| } |
| if (s2 === peg$FAILED) { |
| s2 = null; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 2) === peg$c81) { |
| s3 = peg$c81; |
| peg$currPos += 2; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c82); } |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = []; |
| if (peg$c83.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c84); } |
| } |
| if (s5 !== peg$FAILED) { |
| while (s5 !== peg$FAILED) { |
| s4.push(s5); |
| if (peg$c83.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c84); } |
| } |
| } |
| } else { |
| s4 = peg$FAILED; |
| } |
| if (s4 !== peg$FAILED) { |
| s2 = [s2, s3, s4]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| if (s1 !== peg$FAILED) { |
| s0 = input.substring(s0, peg$currPos); |
| } else { |
| s0 = s1; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseUnionTypeExpr() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 29, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseUnionTypeExprOperand(); |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseUnionTypeOperator(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parseUnionTypeExpr(); |
| if (s5 === peg$FAILED) { |
| s5 = peg$parseUnionTypeExprOperand(); |
| } |
| if (s5 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c85(s1, s3, s5); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseUnionTypeOperator() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 30, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnionTypeOperatorClosureLibraryFlavored(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnionTypeOperatorJSDuckFlavored(); |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseUnionTypeOperatorClosureLibraryFlavored() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 31, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 124) { |
| s1 = peg$c86; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c87); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c88(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseUnionTypeOperatorJSDuckFlavored() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 32, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 47) { |
| s1 = peg$c89; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c90); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c91(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseUnionTypeExprOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 33, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseKeyQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrayTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseUnaryUnionTypeExpr() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 34, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseSuffixUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parsePrefixUnaryUnionTypeExpr(); |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parsePrefixUnaryUnionTypeExpr() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 35, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parsePrefixOptionalTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parsePrefixNotNullableTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parsePrefixNullableTypeExpr(); |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parsePrefixUnaryUnionTypeExprOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 36, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseTypeQueryExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 37, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 6) === peg$c92) { |
| s1 = peg$c92; |
| peg$currPos += 6; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c93); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseQualifiedMemberName(); |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c94(s1, s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseKeyQueryExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 38, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 5) === peg$c95) { |
| s1 = peg$c95; |
| peg$currPos += 5; |
| } 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$parseKeyQueryExprOperand(); |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c97(s1, s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseKeyQueryExprOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 39, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseKeyQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrayTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseImportTypeExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 40, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 6) === peg$c98) { |
| s1 = peg$c98; |
| peg$currPos += 6; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c99); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 40) { |
| s3 = peg$c100; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c101); } |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parseStringLiteralExpr(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 41) { |
| s7 = peg$c102; |
| peg$currPos++; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c103); } |
| } |
| if (s7 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c104(s1, s5); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parsePrefixNullableTypeExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 41, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 63) { |
| s1 = peg$c59; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c60); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parsePrefixUnaryUnionTypeExprOperand(); |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c105(s1, s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parsePrefixNotNullableTypeExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 42, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 33) { |
| s1 = peg$c106; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c107); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parsePrefixUnaryUnionTypeExprOperand(); |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c108(s1, s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parsePrefixOptionalTypeExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 43, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 61) { |
| s1 = peg$c109; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c110); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parsePrefixUnaryUnionTypeExprOperand(); |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c111(s1, s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseSuffixUnaryUnionTypeExpr() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 44, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseSuffixOptionalTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseSuffixNullableTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseSuffixNotNullableTypeExpr(); |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseSuffixUnaryUnionTypeExprOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 45, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parsePrefixUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseSuffixNullableTypeExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 46, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseSuffixUnaryUnionTypeExprOperand(); |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 63) { |
| s3 = peg$c59; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c60); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c112(s1, s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseSuffixNotNullableTypeExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 47, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseSuffixUnaryUnionTypeExprOperand(); |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 33) { |
| s3 = peg$c106; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c107); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c113(s1, s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseSuffixOptionalTypeExpr() { |
| var s0, s1, s2, s3; |
| |
| var key = peg$currPos * 84 + 48, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseSuffixNullableTypeExpr(); |
| if (s1 === peg$FAILED) { |
| s1 = peg$parseSuffixNotNullableTypeExpr(); |
| if (s1 === peg$FAILED) { |
| s1 = peg$parseSuffixUnaryUnionTypeExprOperand(); |
| } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 61) { |
| s3 = peg$c109; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c110); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c114(s1, s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseGenericTypeExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 49, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseGenericTypeExprOperand(); |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseGenericTypeStartToken(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parseGenericTypeExprTypeParamList(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseGenericTypeEndToken(); |
| if (s7 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c115(s1, s3, s5); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseGenericTypeExprOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 50, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseGenericTypeExprTypeParamOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 51, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrayTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseKeyQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseGenericTypeExprTypeParamList() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 52, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseGenericTypeExprTypeParamOperand(); |
| if (s1 !== peg$FAILED) { |
| s2 = []; |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s5 = peg$c116; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseGenericTypeExprTypeParamOperand(); |
| if (s7 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| while (s3 !== peg$FAILED) { |
| s2.push(s3); |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s5 = peg$c116; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseGenericTypeExprTypeParamOperand(); |
| if (s7 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c118(s1, s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseGenericTypeStartToken() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 53, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseGenericTypeEcmaScriptFlavoredStartToken(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeTypeScriptFlavoredStartToken(); |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseGenericTypeEcmaScriptFlavoredStartToken() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 54, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 2) === peg$c119) { |
| s1 = peg$c119; |
| peg$currPos += 2; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c120); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c121(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseGenericTypeTypeScriptFlavoredStartToken() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 55, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 60) { |
| s1 = peg$c122; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c123); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c124(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseGenericTypeEndToken() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 56, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| if (input.charCodeAt(peg$currPos) === 62) { |
| s0 = peg$c125; |
| peg$currPos++; |
| } else { |
| s0 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c126); } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseArrayTypeExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 57, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseArrayTypeExprOperand(); |
| if (s1 !== peg$FAILED) { |
| s2 = []; |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 91) { |
| s5 = peg$c127; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c128); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 93) { |
| s7 = peg$c129; |
| peg$currPos++; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c130); } |
| } |
| if (s7 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| if (s3 !== peg$FAILED) { |
| while (s3 !== peg$FAILED) { |
| s2.push(s3); |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 91) { |
| s5 = peg$c127; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c128); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 93) { |
| s7 = peg$c129; |
| peg$currPos++; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c130); } |
| } |
| if (s7 !== peg$FAILED) { |
| s4 = [s4, s5, s6, s7]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } |
| } else { |
| s2 = peg$FAILED; |
| } |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c131(s1, s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseArrayTypeExprOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 58, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseKeyQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseArrowTypeExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 59, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 3) === peg$c132) { |
| s1 = peg$c132; |
| peg$currPos += 3; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c133); } |
| } |
| if (s1 === peg$FAILED) { |
| s1 = null; |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseArrowTypeExprParamsList(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 2) === peg$c134) { |
| s5 = peg$c134; |
| peg$currPos += 2; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c135); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseFunctionTypeExprReturnableOperand(); |
| if (s7 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c136(s1, 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; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseArrowTypeExprParamsList() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 60, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 40) { |
| s1 = peg$c100; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c101); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseArrowTypeExprParams(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 41) { |
| s5 = peg$c102; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c103); } |
| } |
| if (s5 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c137(s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 40) { |
| s1 = peg$c100; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c101); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 41) { |
| s3 = peg$c102; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c103); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c138(); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseArrowTypeExprParams() { |
| var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10; |
| |
| var key = peg$currPos * 84 + 61, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = []; |
| s2 = peg$currPos; |
| s3 = peg$parseJsIdentifier(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 58) { |
| s5 = peg$c44; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c45); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseFunctionTypeExprParamOperand(); |
| if (s7 === peg$FAILED) { |
| s7 = null; |
| } |
| if (s7 !== peg$FAILED) { |
| s8 = peg$parse_(); |
| if (s8 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s9 = peg$c116; |
| peg$currPos++; |
| } else { |
| s9 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s9 !== peg$FAILED) { |
| s10 = peg$parse_(); |
| if (s10 !== peg$FAILED) { |
| s3 = [s3, s4, s5, s6, s7, s8, s9, s10]; |
| s2 = s3; |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| while (s2 !== peg$FAILED) { |
| s1.push(s2); |
| s2 = peg$currPos; |
| s3 = peg$parseJsIdentifier(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 58) { |
| s5 = peg$c44; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c45); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseFunctionTypeExprParamOperand(); |
| if (s7 === peg$FAILED) { |
| s7 = null; |
| } |
| if (s7 !== peg$FAILED) { |
| s8 = peg$parse_(); |
| if (s8 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s9 = peg$c116; |
| peg$currPos++; |
| } else { |
| s9 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s9 !== peg$FAILED) { |
| s10 = peg$parse_(); |
| if (s10 !== peg$FAILED) { |
| s3 = [s3, s4, s5, s6, s7, s8, s9, s10]; |
| s2 = s3; |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parseVariadicNameExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = null; |
| } |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c139(s1, s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseVariadicNameExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 62, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 3) === peg$c140) { |
| s1 = peg$c140; |
| peg$currPos += 3; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c141); } |
| } |
| if (s1 === peg$FAILED) { |
| s1 = null; |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseJsIdentifier(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 58) { |
| s5 = peg$c44; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c45); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseFunctionTypeExprParamOperand(); |
| if (s7 === peg$FAILED) { |
| s7 = null; |
| } |
| if (s7 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c142(s1, 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; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseFunctionTypeExpr() { |
| var s0, s1, s2, s3, s4, s5, s6, s7, s8; |
| |
| var key = peg$currPos * 84 + 63, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 8) === peg$c143) { |
| s1 = peg$c143; |
| peg$currPos += 8; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c144); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseFunctionTypeExprParamsList(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| s5 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 58) { |
| s6 = peg$c44; |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c45); } |
| } |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parse_(); |
| if (s7 !== peg$FAILED) { |
| s8 = peg$parseFunctionTypeExprReturnableOperand(); |
| if (s8 !== peg$FAILED) { |
| s6 = [s6, s7, s8]; |
| s5 = s6; |
| } else { |
| peg$currPos = s5; |
| s5 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s5; |
| s5 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s5; |
| s5 = peg$FAILED; |
| } |
| if (s5 === peg$FAILED) { |
| s5 = null; |
| } |
| if (s5 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c145(s3, s5); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseFunctionTypeExprParamsList() { |
| var s0, s1, s2, s3, s4, s5, s6, s7, s8, s9; |
| |
| var key = peg$currPos * 84 + 64, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 40) { |
| s1 = peg$c100; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c101); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseFunctionTypeExprModifier(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s5 = peg$c116; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseFunctionTypeExprParams(); |
| if (s7 !== peg$FAILED) { |
| s8 = peg$parse_(); |
| if (s8 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 41) { |
| s9 = peg$c102; |
| peg$currPos++; |
| } else { |
| s9 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c103); } |
| } |
| if (s9 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c146(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; |
| } |
| } 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 (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 40) { |
| s1 = peg$c100; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c101); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseFunctionTypeExprModifier(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 41) { |
| s5 = peg$c102; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c103); } |
| } |
| if (s5 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c147(s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 40) { |
| s1 = peg$c100; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c101); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseFunctionTypeExprParams(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 41) { |
| s5 = peg$c102; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c103); } |
| } |
| if (s5 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c148(s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 40) { |
| s1 = peg$c100; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c101); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 41) { |
| s3 = peg$c102; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c103); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c149(); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseFunctionTypeExprModifier() { |
| var s0, s1, s2, s3, s4, s5, s6; |
| |
| var key = peg$currPos * 84 + 65, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| if (input.substr(peg$currPos, 4) === peg$c150) { |
| s2 = peg$c150; |
| peg$currPos += 4; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c151); } |
| } |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parse_(); |
| if (s3 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 58) { |
| s4 = peg$c44; |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c45); } |
| } |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parse_(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parseFunctionTypeExprParamOperand(); |
| if (s6 !== peg$FAILED) { |
| s2 = [s2, s3, s4, s5, s6]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c152(s1); |
| } |
| s0 = s1; |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| if (input.substr(peg$currPos, 3) === peg$c132) { |
| s2 = peg$c132; |
| peg$currPos += 3; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c133); } |
| } |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parse_(); |
| if (s3 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 58) { |
| s4 = peg$c44; |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c45); } |
| } |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parse_(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parseFunctionTypeExprParamOperand(); |
| if (s6 !== peg$FAILED) { |
| s2 = [s2, s3, s4, s5, s6]; |
| s1 = s2; |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s1; |
| s1 = peg$FAILED; |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c153(s1); |
| } |
| s0 = s1; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseFunctionTypeExprParams() { |
| var s0, s1, s2, s3, s4, s5, s6; |
| |
| var key = peg$currPos * 84 + 66, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = []; |
| s2 = peg$currPos; |
| s3 = peg$parseFunctionTypeExprParamOperand(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s5 = peg$c116; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s3 = [s3, s4, s5, s6]; |
| s2 = s3; |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| while (s2 !== peg$FAILED) { |
| s1.push(s2); |
| s2 = peg$currPos; |
| s3 = peg$parseFunctionTypeExprParamOperand(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s5 = peg$c116; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s3 = [s3, s4, s5, s6]; |
| s2 = s3; |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parseVariadicTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseVariadicTypeExprOperand(); |
| } |
| if (s2 === peg$FAILED) { |
| s2 = null; |
| } |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c154(s1, s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseFunctionTypeExprParamOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 67, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseKeyQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrayTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseFunctionTypeExprReturnableOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 68, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parsePrefixUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrayTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseKeyQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseRecordTypeExpr() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 69, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 123) { |
| s1 = peg$c155; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c156); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseRecordTypeExprEntries(); |
| 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$c157; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c158); } |
| } |
| if (s5 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c159(s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseRecordTypeExprEntries() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 70, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseRecordTypeExprEntry(); |
| if (s1 !== peg$FAILED) { |
| s2 = []; |
| s3 = peg$currPos; |
| s4 = peg$currPos; |
| s5 = peg$parse_(); |
| if (s5 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s6 = peg$c116; |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| s5 = peg$parse_(); |
| if (s5 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 59) { |
| s6 = peg$c160; |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c161); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| s5 = []; |
| if (peg$c1.test(input.charAt(peg$currPos))) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c2); } |
| } |
| while (s6 !== peg$FAILED) { |
| s5.push(s6); |
| if (peg$c1.test(input.charAt(peg$currPos))) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c2); } |
| } |
| } |
| if (s5 !== peg$FAILED) { |
| if (peg$c3.test(input.charAt(peg$currPos))) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c4); } |
| } |
| if (s6 === peg$FAILED) { |
| s6 = null; |
| } |
| if (s6 !== peg$FAILED) { |
| if (peg$c5.test(input.charAt(peg$currPos))) { |
| s7 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c6); } |
| } |
| if (s7 !== peg$FAILED) { |
| s5 = [s5, s6, s7]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parse_(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parseRecordTypeExprEntry(); |
| if (s6 !== peg$FAILED) { |
| s4 = [s4, s5, s6]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| while (s3 !== peg$FAILED) { |
| s2.push(s3); |
| s3 = peg$currPos; |
| s4 = peg$currPos; |
| s5 = peg$parse_(); |
| if (s5 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s6 = peg$c116; |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| s5 = peg$parse_(); |
| if (s5 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 59) { |
| s6 = peg$c160; |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c161); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| s5 = []; |
| if (peg$c1.test(input.charAt(peg$currPos))) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c2); } |
| } |
| while (s6 !== peg$FAILED) { |
| s5.push(s6); |
| if (peg$c1.test(input.charAt(peg$currPos))) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c2); } |
| } |
| } |
| if (s5 !== peg$FAILED) { |
| if (peg$c3.test(input.charAt(peg$currPos))) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c4); } |
| } |
| if (s6 === peg$FAILED) { |
| s6 = null; |
| } |
| if (s6 !== peg$FAILED) { |
| if (peg$c5.test(input.charAt(peg$currPos))) { |
| s7 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s7 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c6); } |
| } |
| if (s7 !== peg$FAILED) { |
| s5 = [s5, s6, s7]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s4 !== peg$FAILED) { |
| s5 = peg$parse_(); |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parseRecordTypeExprEntry(); |
| if (s6 !== peg$FAILED) { |
| s4 = [s4, s5, s6]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } |
| if (s2 !== peg$FAILED) { |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s5 = peg$c116; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s5 !== peg$FAILED) { |
| s4 = [s4, s5]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| if (s3 === peg$FAILED) { |
| s3 = peg$currPos; |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 59) { |
| s5 = peg$c160; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c161); } |
| } |
| if (s5 !== peg$FAILED) { |
| s4 = [s4, s5]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| if (s3 === peg$FAILED) { |
| s3 = peg$currPos; |
| s4 = []; |
| if (peg$c1.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c2); } |
| } |
| while (s5 !== peg$FAILED) { |
| s4.push(s5); |
| if (peg$c1.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c2); } |
| } |
| } |
| if (s4 !== peg$FAILED) { |
| if (peg$c3.test(input.charAt(peg$currPos))) { |
| s5 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c4); } |
| } |
| if (s5 === peg$FAILED) { |
| s5 = null; |
| } |
| if (s5 !== peg$FAILED) { |
| if (peg$c5.test(input.charAt(peg$currPos))) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c6); } |
| } |
| if (s6 !== peg$FAILED) { |
| s4 = [s4, s5, s6]; |
| s3 = s4; |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s3; |
| s3 = peg$FAILED; |
| } |
| } |
| } |
| if (s3 === peg$FAILED) { |
| s3 = null; |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c162(s1, s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseRecordTypeExprEntry() { |
| var s0, s1, s2, s3, s4, s5, s6, s7; |
| |
| var key = peg$currPos * 84 + 71, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseRecordTypeExprEntryKey(); |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 63) { |
| s3 = peg$c59; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c60); } |
| } |
| if (s3 === peg$FAILED) { |
| s3 = null; |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 58) { |
| s5 = peg$c44; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c45); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s7 = peg$parseRecordTypeExprEntryOperand(); |
| if (s7 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c163(s1, 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; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| s1 = peg$parseRecordTypeExprEntryKey(); |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c164(s1); |
| } |
| s0 = s1; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseRecordTypeExprEntryKey() { |
| var s0, s1, s2, s3, s4, s5, s6; |
| |
| var key = peg$currPos * 84 + 72, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 34) { |
| s1 = peg$c26; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c27); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$currPos; |
| s3 = []; |
| if (peg$c28.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c29); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c28.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c29); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = input.substring(s2, peg$currPos); |
| } else { |
| s2 = s3; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 34) { |
| s3 = peg$c26; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c27); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c165(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 39) { |
| s1 = peg$c18; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c19); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$currPos; |
| s3 = []; |
| if (peg$c20.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c21); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| while (s4 !== peg$FAILED) { |
| s3.push(s4); |
| if (peg$c20.test(input.charAt(peg$currPos))) { |
| s4 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s4 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c21); } |
| } |
| if (s4 === peg$FAILED) { |
| s4 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 92) { |
| s5 = peg$c22; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c23); } |
| } |
| if (s5 !== peg$FAILED) { |
| if (input.length > peg$currPos) { |
| s6 = input.charAt(peg$currPos); |
| peg$currPos++; |
| } else { |
| s6 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c24); } |
| } |
| if (s6 !== peg$FAILED) { |
| s5 = [s5, s6]; |
| s4 = s5; |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s4; |
| s4 = peg$FAILED; |
| } |
| } |
| } |
| if (s3 !== peg$FAILED) { |
| s2 = input.substring(s2, peg$currPos); |
| } else { |
| s2 = s3; |
| } |
| if (s2 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 39) { |
| s3 = peg$c18; |
| peg$currPos++; |
| } else { |
| s3 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c19); } |
| } |
| if (s3 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c166(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| if (s0 === peg$FAILED) { |
| s0 = peg$currPos; |
| s1 = peg$currPos; |
| s2 = peg$parseJsIdentifier(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseUnsignedDecimalNumberLiteralExpr(); |
| } |
| if (s2 !== peg$FAILED) { |
| s1 = input.substring(s1, peg$currPos); |
| } else { |
| s1 = s2; |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c167(s1); |
| } |
| s0 = s1; |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseRecordTypeExprEntryOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 73, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrayTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseTupleTypeExpr() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 74, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 91) { |
| s1 = peg$c127; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c128); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseTupleTypeExprEntries(); |
| if (s3 === peg$FAILED) { |
| s3 = null; |
| } |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 93) { |
| s5 = peg$c129; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c130); } |
| } |
| if (s5 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c168(s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseTupleTypeExprEntries() { |
| var s0, s1, s2, s3, s4, s5, s6; |
| |
| var key = peg$currPos * 84 + 75, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = []; |
| s2 = peg$currPos; |
| s3 = peg$parseTupleTypeExprOperand(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s5 = peg$c116; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s3 = [s3, s4, s5, s6]; |
| s2 = s3; |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| while (s2 !== peg$FAILED) { |
| s1.push(s2); |
| s2 = peg$currPos; |
| s3 = peg$parseTupleTypeExprOperand(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 44) { |
| s5 = peg$c116; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c117); } |
| } |
| if (s5 !== peg$FAILED) { |
| s6 = peg$parse_(); |
| if (s6 !== peg$FAILED) { |
| s3 = [s3, s4, s5, s6]; |
| s2 = s3; |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s2; |
| s2 = peg$FAILED; |
| } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parseVariadicTypeExpr(); |
| if (s2 === peg$FAILED) { |
| s2 = peg$parseVariadicTypeExprOperand(); |
| } |
| if (s2 === peg$FAILED) { |
| s2 = null; |
| } |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c169(s1, s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseTupleTypeExprOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 76, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseKeyQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrayTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseParenthesizedExpr() { |
| var s0, s1, s2, s3, s4, s5; |
| |
| var key = peg$currPos * 84 + 77, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.charCodeAt(peg$currPos) === 40) { |
| s1 = peg$c100; |
| peg$currPos++; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c101); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parse_(); |
| if (s2 !== peg$FAILED) { |
| s3 = peg$parseParenthesizedExprOperand(); |
| if (s3 !== peg$FAILED) { |
| s4 = peg$parse_(); |
| if (s4 !== peg$FAILED) { |
| if (input.charCodeAt(peg$currPos) === 41) { |
| s5 = peg$c102; |
| peg$currPos++; |
| } else { |
| s5 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c103); } |
| } |
| if (s5 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c170(s3); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseParenthesizedExprOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 78, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrayTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseKeyQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseVariadicTypeExpr() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 79, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parsePrefixVariadicTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseSuffixVariadicTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyVariadicTypeExpr(); |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parsePrefixVariadicTypeExpr() { |
| var s0, s1, s2; |
| |
| var key = peg$currPos * 84 + 80, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 3) === peg$c140) { |
| s1 = peg$c140; |
| peg$currPos += 3; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c141); } |
| } |
| if (s1 !== peg$FAILED) { |
| s2 = peg$parseVariadicTypeExprOperand(); |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c171(s2); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseSuffixVariadicTypeExpr() { |
| var s0, s1, s2; |
| |
| var key = peg$currPos * 84 + 81, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| s1 = peg$parseVariadicTypeExprOperand(); |
| if (s1 !== peg$FAILED) { |
| if (input.substr(peg$currPos, 3) === peg$c140) { |
| s2 = peg$c140; |
| peg$currPos += 3; |
| } else { |
| s2 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c141); } |
| } |
| if (s2 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c172(s1); |
| s0 = s1; |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| } else { |
| peg$currPos = s0; |
| s0 = peg$FAILED; |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseAnyVariadicTypeExpr() { |
| var s0, s1; |
| |
| var key = peg$currPos * 84 + 82, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$currPos; |
| if (input.substr(peg$currPos, 3) === peg$c140) { |
| s1 = peg$c140; |
| peg$currPos += 3; |
| } else { |
| s1 = peg$FAILED; |
| if (peg$silentFails === 0) { peg$fail(peg$c141); } |
| } |
| if (s1 !== peg$FAILED) { |
| peg$savedPos = s0; |
| s1 = peg$c173(); |
| } |
| s0 = s1; |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| function peg$parseVariadicTypeExprOperand() { |
| var s0; |
| |
| var key = peg$currPos * 84 + 83, |
| cached = peg$resultsCache[key]; |
| |
| if (cached) { |
| peg$currPos = cached.nextPos; |
| |
| return cached.result; |
| } |
| |
| s0 = peg$parseUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnaryUnionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseRecordTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTupleTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrowTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseFunctionTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseParenthesizedExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseTypeQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseKeyQueryExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseArrayTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseGenericTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseBroadNamepathExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseValueExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseAnyTypeExpr(); |
| if (s0 === peg$FAILED) { |
| s0 = peg$parseUnknownTypeExpr(); |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| peg$resultsCache[key] = { nextPos: peg$currPos, result: s0 }; |
| |
| return s0; |
| } |
| |
| |
| const meta = require('../lib/SyntaxType.js'); |
| const { |
| GenericTypeSyntax, UnionTypeSyntax, |
| VariadicTypeSyntax, OptionalTypeSyntax, |
| NullableTypeSyntax, NotNullableTypeSyntax, |
| } = meta; |
| const NodeType = require('../lib/NodeType.js'); |
| |
| const NamepathOperatorType = { |
| MEMBER: 'MEMBER', |
| INNER_MEMBER: 'INNER_MEMBER', |
| INSTANCE_MEMBER: 'INSTANCE_MEMBER', |
| }; |
| |
| function reverse(array) { |
| const reversed = [].concat(array); |
| reversed.reverse(); |
| return reversed; |
| } |
| |
| |
| peg$result = peg$startRuleFunction(); |
| |
| if (peg$result !== peg$FAILED && peg$currPos === input.length) { |
| return peg$result; |
| } else { |
| if (peg$result !== peg$FAILED && peg$currPos < input.length) { |
| peg$fail(peg$endExpectation()); |
| } |
| |
| throw peg$buildStructuredError( |
| peg$maxFailExpected, |
| peg$maxFailPos < input.length ? input.charAt(peg$maxFailPos) : null, |
| peg$maxFailPos < input.length |
| ? peg$computeLocation(peg$maxFailPos, peg$maxFailPos + 1) |
| : peg$computeLocation(peg$maxFailPos, peg$maxFailPos) |
| ); |
| } |
| } |
| |
| module.exports = { |
| SyntaxError: peg$SyntaxError, |
| parse: peg$parse |
| }; |