From 893c53536b10105da5d2705b6d781a6e809b2889 Mon Sep 17 00:00:00 2001 From: Glenn Adams Date: Mon, 16 Jul 2012 19:49:05 -0600 Subject: [PATCH] (1) use w instead of S?; (2) enable string valued extended attribute values; (3) improve consistency of extended attribute handling on interface members; (4) enable extended attributes on typedef; (5) enable extended attributes on other extended attributes; (6) remove redundant definition of ExtAttrNamedArgList; (7) add clean target to makefile; --- Makefile | 2 + lib/grammar.peg | 51 +- node/WebIDLParser.js | 8518 ++++++++++++++++++++++++------------------ web/WebIDLParser.js | 8518 ++++++++++++++++++++++++------------------ 4 files changed, 9824 insertions(+), 7265 deletions(-) diff --git a/Makefile b/Makefile index 9c5edd3..6150b69 100644 --- a/Makefile +++ b/Makefile @@ -6,3 +6,5 @@ node/WebIDLParser.js: lib/grammar.peg web/WebIDLParser.js: lib/grammar.peg pegjs < lib/grammar.peg | sed -e 's/module.exports =/window.WebIDLParser =/' > web/WebIDLParser.js +clean: + $(RM) node/WebIDLParser.js web/WebIDLParser.js diff --git a/lib/grammar.peg b/lib/grammar.peg index ea872e6..b313857 100644 --- a/lib/grammar.peg +++ b/lib/grammar.peg @@ -168,40 +168,40 @@ definition // partial interface definition partialinterface - = extAttrs:extendedAttributeList? S? "partial" S "interface" S name:identifier w "{" w mem:ifMember* w "}" w ";" w + = extAttrs:extendedAttributeList? w "partial" S "interface" S name:identifier w "{" w mem:ifMember* w "}" w ";" w { return { type: "partialinterface", name: name, members: mem, extAttrs: extAttrs }; } // callback interface definition callbackinterface - = extAttrs:extendedAttributeList? S? "callback" S "interface" S name:identifier w "{" w mem:ifMember* w "}" w ";" w + = extAttrs:extendedAttributeList? w "callback" S "interface" S name:identifier w "{" w mem:ifMember* w "}" w ";" w { return { type: "callbackinterface", name: name, members: mem, extAttrs: extAttrs }; } // module definition module - = extAttrs:extendedAttributeList? S? "module" S name:identifier w "{" w defs:definitions w "}" w ";" w + = extAttrs:extendedAttributeList? w "module" S name:identifier w "{" w defs:definitions w "}" w ";" w { return { type: "module", name: name, definitions: defs, extAttrs: extAttrs }; } // implements definition implements - = extAttrs:extendedAttributeList? S? target:ScopedName S "implements" S impl:ScopedName w ";" w + = extAttrs:extendedAttributeList? w target:ScopedName S "implements" S impl:ScopedName w ";" w { return { type: 'implements', target: target, 'implements': impl, extAttrs: extAttrs }; } // interface definition interface - = extAttrs:extendedAttributeList? S? "interface" S name:identifier w herit:ifInheritance? w "{" w mem:ifMember* w "}" w ";" w + = extAttrs:extendedAttributeList? w "interface" S name:identifier w herit:ifInheritance? w "{" w mem:ifMember* w "}" w ";" w { return { type: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs }; } // enum definition enum - = extAttrs:extendedAttributeList? S? "enum" S name:identifier w "{" w values:EnumValues w "}" w ";" w + = extAttrs:extendedAttributeList? w "enum" S name:identifier w "{" w values:EnumValues w "}" w ";" w { return { type: "enum", name: name, values: values, extAttrs: extAttrs }; } // callback definition callback - = extAttrs:extendedAttributeList? S? "callback" S name:identifier w "=" w ret:ReturnType S "(" w args:Arguments w ")" w ";" w + = extAttrs:extendedAttributeList? w "callback" S name:identifier w "=" w ret:ReturnType S "(" w args:Arguments w ")" w ";" w { return { type: "callback", idlType: ret, name: name, args: args, extAttrs: extAttrs }; } EnumValues @@ -220,12 +220,15 @@ ifInheritance { return herit; } ifMember - = mem:(const / attrOrOp) - { return mem; } + = extAttrs:extendedAttributeList? w mem:(const / attrOrOp) + { + if ( extAttrs ) { mem.extAttrs = extAttrs }; + return mem; + } const - = extAttrs:extendedAttributeList? S? "const" S type:type S name:identifier w "=" w value:constExpr w ";" w - { return { type: "const", extAttrs: extAttrs, idlType: type, name: name, value: value }; } + = "const" S type:type S name:identifier w "=" w value:constExpr w ";" w + { return { type: "const", idlType: type, name: name, value: value }; } constExpr = value:(BooleanLiteral / float / integer / "NaN" / "null") @@ -246,8 +249,8 @@ Stringifier } Attribute - = extAttrs:extendedAttributeList? w ro:("readonly" S)? "attribute" S type:type S name:identifier w gr:GetRaises? w sr:SetRaises? w ";" w - { return { type: "attribute", extAttrs: extAttrs, idlType: type, name: name, readonly: (ro ? true : false), getraises: gr, setraises: sr }; } + = ro:("readonly" S)? "attribute" S type:type S name:identifier w gr:GetRaises? w sr:SetRaises? w ";" w + { return { type: "attribute", idlType: type, name: name, readonly: (ro ? true : false), getraises: gr, setraises: sr }; } GetRaises = "getraises" w "(" list:ScopedNameList ")" @@ -258,10 +261,9 @@ SetRaises { return list; } Operation - = extAttrs:extendedAttributeList? w quals:Qualifiers w rest:OperationRest + = quals:Qualifiers w rest:OperationRest { for (var k in quals) rest[k] = quals[k]; - if (extAttrs) rest.extAttrs = extAttrs; return rest; } @@ -328,8 +330,8 @@ defaultValue // typedef definition typedef - = "typedef" S type:type S name:identifier w ";" w - { return { type: 'typedef', name: name, idlType: type }; } + = "typedef" S extAttrs:extendedAttributeList? w type:type S name:identifier w ";" w + { return { type: 'typedef', name: name, idlType: type, extAttrs: extAttrs }; } // exception definition exception @@ -341,7 +343,7 @@ exMember { return mem; } field - = extAttrs:extendedAttributeList? S? type:type S name:identifier w ";" w + = extAttrs:extendedAttributeList? w type:type S name:identifier w ";" w { return { type: "field", extAttrs: extAttrs, idlType: type, name: name }; } @@ -361,25 +363,24 @@ ExtAttrsRest { return rest; } ExtAttr - = ea:(ExtAttrArgList / ExtAttrNamedArgList / ExtAttrNameValue / ExtAttrNoArg) - { return ea; } + = extAttrs:extendedAttributeList? w ea:(ExtAttrArgList / ExtAttrNamedArgList / ExtAttrNameValue / ExtAttrNoArg) + { + if ( extAttrs ) { ea.extAttrs = extAttrs }; + return ea; + } ExtAttrNoArg = name:identifier {return { name: name }; } ExtAttrNameValue - = name:identifier w "=" w value:ScopedName + = name:identifier w "=" w value:(ScopedName / string) {return { name: name, value: value }; } ExtAttrNamedArgList = name:identifier w "=" w value:identifier w "(" w args:Arguments? w ")" {return { name: name, value: value, arguments: args }; } -ExtAttrNamedArgList - = name:identifier w "=" w value:identifier w "(" w args:Arguments? w ")" - {return { name: name, value: value, arguments: args }; } - ExtAttrArgList = name:identifier w "(" w args:Arguments? w ")" {return { name: name, arguments: args }; } diff --git a/node/WebIDLParser.js b/node/WebIDLParser.js index f1a3116..395b2d1 100644 --- a/node/WebIDLParser.js +++ b/node/WebIDLParser.js @@ -1,32 +1,5 @@ exports.Parser = (function(){ - /* - * Generated by PEG.js 0.7.0. - * - * http://pegjs.majda.cz/ - */ - - function quote(s) { - /* - * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a - * string literal except for the closing quote character, backslash, - * carriage return, line separator, paragraph separator, and line feed. - * Any character may appear in the form of an escape sequence. - * - * For portability, we also escape escape all control and non-ASCII - * characters. Note that "\0" and "\v" escape sequences are not used - * because JSHint does not like the first and IE the second. - */ - return '"' + s - .replace(/\\/g, '\\\\') // backslash - .replace(/"/g, '\\"') // closing quote character - .replace(/\x08/g, '\\b') // backspace - .replace(/\t/g, '\\t') // horizontal tab - .replace(/\n/g, '\\n') // line feed - .replace(/\f/g, '\\f') // form feed - .replace(/\r/g, '\\r') // carriage return - .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape) - + '"'; - } + /* Generated by PEG.js 0.6.2 (http://pegjs.majda.cz/). */ var result = { /* @@ -37,85 +10,84 @@ exports.Parser = (function(){ */ parse: function(input, startRule) { var parseFunctions = { - "space": parse_space, - "s": parse_s, - "w": parse_w, - "identifier": parse_identifier, - "octal": parse_octal, - "hex": parse_hex, - "decimal": parse_decimal, - "integer": parse_integer, - "floatEe": parse_floatEe, - "expFloat": parse_expFloat, - "leadFloat": parse_leadFloat, - "dotFloat": parse_dotFloat, - "float": parse_float, - "string": parse_string, - "other": parse_other, - "type": parse_type, - "TypeDesc": parse_TypeDesc, - "Sequence": parse_Sequence, - "ArrayType": parse_ArrayType, - "UnionType": parse_UnionType, - "TypeList": parse_TypeList, - "TypeListRest": parse_TypeListRest, - "SimpleType": parse_SimpleType, - "PrimitiveType": parse_PrimitiveType, - "FloatType": parse_FloatType, - "UnsignedIntegerType": parse_UnsignedIntegerType, - "ScopedNameList": parse_ScopedNameList, - "ScopedNameListRest": parse_ScopedNameListRest, - "ScopedName": parse_ScopedName, "AbsoluteScopedName": parse_AbsoluteScopedName, - "RelativeScopedName": parse_RelativeScopedName, - "ScopedNameRest": parse_ScopedNameRest, + "Argument": parse_Argument, + "Arguments": parse_Arguments, + "ArgumentsRest": parse_ArgumentsRest, + "ArrayType": parse_ArrayType, + "Attribute": parse_Attribute, "BooleanLiteral": parse_BooleanLiteral, - "Nullable": parse_Nullable, - "ReturnType": parse_ReturnType, - "definitions": parse_definitions, - "definition": parse_definition, - "partialinterface": parse_partialinterface, - "callbackinterface": parse_callbackinterface, - "module": parse_module, - "implements": parse_implements, - "interface": parse_interface, - "enum": parse_enum, - "callback": parse_callback, "EnumValues": parse_EnumValues, "EnumValuesRest": parse_EnumValuesRest, - "ifInheritance": parse_ifInheritance, - "ifMember": parse_ifMember, - "const": parse_const, - "constExpr": parse_constExpr, - "attrOrOp": parse_attrOrOp, - "Stringifier": parse_Stringifier, - "Attribute": parse_Attribute, + "ExtAttr": parse_ExtAttr, + "ExtAttrArgList": parse_ExtAttrArgList, + "ExtAttrNameValue": parse_ExtAttrNameValue, + "ExtAttrNamedArgList": parse_ExtAttrNamedArgList, + "ExtAttrNoArg": parse_ExtAttrNoArg, + "ExtAttrs": parse_ExtAttrs, + "ExtAttrsRest": parse_ExtAttrsRest, + "FloatType": parse_FloatType, "GetRaises": parse_GetRaises, - "SetRaises": parse_SetRaises, + "Nullable": parse_Nullable, "Operation": parse_Operation, - "Qualifiers": parse_Qualifiers, - "Special": parse_Special, "OperationRest": parse_OperationRest, - "Arguments": parse_Arguments, - "ArgumentsRest": parse_ArgumentsRest, - "Argument": parse_Argument, + "PrimitiveType": parse_PrimitiveType, + "Qualifiers": parse_Qualifiers, "Raises": parse_Raises, + "RelativeScopedName": parse_RelativeScopedName, + "ReturnType": parse_ReturnType, + "ScopedName": parse_ScopedName, + "ScopedNameList": parse_ScopedNameList, + "ScopedNameListRest": parse_ScopedNameListRest, + "ScopedNameRest": parse_ScopedNameRest, + "Sequence": parse_Sequence, + "SetRaises": parse_SetRaises, + "SimpleType": parse_SimpleType, + "Special": parse_Special, + "Stringifier": parse_Stringifier, + "TypeDesc": parse_TypeDesc, + "TypeList": parse_TypeList, + "TypeListRest": parse_TypeListRest, + "UnionType": parse_UnionType, + "UnsignedIntegerType": parse_UnsignedIntegerType, + "attrOrOp": parse_attrOrOp, + "callback": parse_callback, + "callbackinterface": parse_callbackinterface, + "const": parse_const, + "constExpr": parse_constExpr, + "decimal": parse_decimal, + "defaultValue": parse_defaultValue, + "definition": parse_definition, + "definitions": parse_definitions, "dictionary": parse_dictionary, "dictionaryMember": parse_dictionaryMember, - "defaultValue": parse_defaultValue, - "typedef": parse_typedef, - "exception": parse_exception, + "dotFloat": parse_dotFloat, + "enum": parse_enum, "exMember": parse_exMember, - "field": parse_field, + "exception": parse_exception, + "expFloat": parse_expFloat, "extendedAttributeList": parse_extendedAttributeList, - "ExtAttrs": parse_ExtAttrs, - "ExtAttrsRest": parse_ExtAttrsRest, - "ExtAttr": parse_ExtAttr, - "ExtAttrNoArg": parse_ExtAttrNoArg, - "ExtAttrNameValue": parse_ExtAttrNameValue, - "ExtAttrNamedArgList": parse_ExtAttrNamedArgList, - "ExtAttrNamedArgList": parse_ExtAttrNamedArgList, - "ExtAttrArgList": parse_ExtAttrArgList + "field": parse_field, + "float": parse_float, + "floatEe": parse_floatEe, + "hex": parse_hex, + "identifier": parse_identifier, + "ifInheritance": parse_ifInheritance, + "ifMember": parse_ifMember, + "implements": parse_implements, + "integer": parse_integer, + "interface": parse_interface, + "leadFloat": parse_leadFloat, + "module": parse_module, + "octal": parse_octal, + "other": parse_other, + "partialinterface": parse_partialinterface, + "s": parse_s, + "space": parse_space, + "string": parse_string, + "type": parse_type, + "typedef": parse_typedef, + "w": parse_w }; if (startRule !== undefined) { @@ -127,9 +99,10 @@ exports.Parser = (function(){ } var pos = 0; - var reportFailures = 0; - var rightmostFailuresPos = 0; - var rightmostFailuresExpected = []; + var reportMatchFailures = true; + var rightmostMatchFailuresPos = 0; + var rightmostMatchFailuresExpected = []; + var cache = {}; function padLeft(input, padding, length) { var result = input; @@ -144,5472 +117,6805 @@ exports.Parser = (function(){ function escape(ch) { var charCode = ch.charCodeAt(0); - var escapeChar; - var length; if (charCode <= 0xFF) { - escapeChar = 'x'; - length = 2; + var escapeChar = 'x'; + var length = 2; } else { - escapeChar = 'u'; - length = 4; + var escapeChar = 'u'; + var length = 4; } return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length); } + function quote(s) { + /* + * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a + * string literal except for the closing quote character, backslash, + * carriage return, line separator, paragraph separator, and line feed. + * Any character may appear in the form of an escape sequence. + */ + return '"' + s + .replace(/\\/g, '\\\\') // backslash + .replace(/"/g, '\\"') // closing quote character + .replace(/\r/g, '\\r') // carriage return + .replace(/\n/g, '\\n') // line feed + .replace(/[\x80-\uFFFF]/g, escape) // non-ASCII characters + + '"'; + } + function matchFailed(failure) { - if (pos < rightmostFailuresPos) { + if (pos < rightmostMatchFailuresPos) { return; } - if (pos > rightmostFailuresPos) { - rightmostFailuresPos = pos; - rightmostFailuresExpected = []; + if (pos > rightmostMatchFailuresPos) { + rightmostMatchFailuresPos = pos; + rightmostMatchFailuresExpected = []; } - rightmostFailuresExpected.push(failure); + rightmostMatchFailuresExpected.push(failure); } function parse_space() { - var result0, result1, result2, result3; - var pos0, pos1, pos2; + var cacheKey = 'space@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - if (input.charCodeAt(pos) === 32) { - result0 = " "; - pos++; + + if (input.substr(pos, 1) === " ") { + var result20 = " "; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result20 = null; + if (reportMatchFailures) { matchFailed("\" \""); } } - if (result0 === null) { - if (input.charCodeAt(pos) === 9) { - result0 = "\t"; - pos++; + if (result20 !== null) { + var result0 = result20; + } else { + if (input.substr(pos, 1) === " ") { + var result19 = " "; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"\\t\""); + var result19 = null; + if (reportMatchFailures) { + matchFailed("\" \""); } } - if (result0 === null) { - if (input.charCodeAt(pos) === 13) { - result0 = "\r"; - pos++; + if (result19 !== null) { + var result0 = result19; + } else { + if (input.substr(pos, 1) === "\r") { + var result18 = "\r"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result18 = null; + if (reportMatchFailures) { matchFailed("\"\\r\""); } } - if (result0 === null) { - if (input.charCodeAt(pos) === 10) { - result0 = "\n"; - pos++; + if (result18 !== null) { + var result0 = result18; + } else { + if (input.substr(pos, 1) === "\n") { + var result17 = "\n"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\"\\n\""); } } - if (result0 === null) { - if (input.charCodeAt(pos) === 12) { - result0 = "\f"; - pos++; + if (result17 !== null) { + var result0 = result17; + } else { + if (input.substr(pos, 1) === " ") { + var result16 = " "; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"\\f\""); + var result16 = null; + if (reportMatchFailures) { + matchFailed("\" \""); } } - if (result0 === null) { - pos0 = pos; + if (result16 !== null) { + var result0 = result16; + } else { + var savedPos3 = pos; if (input.substr(pos, 2) === "//") { - result0 = "//"; + var result12 = "//"; pos += 2; } else { - result0 = null; - if (reportFailures === 0) { + var result12 = null; + if (reportMatchFailures) { matchFailed("\"//\""); } } - if (result0 !== null) { - result1 = []; - if (/^[^\n]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result12 !== null) { + var result13 = []; + if (input.substr(pos).match(/^[^\n]/) !== null) { + var result15 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("[^\\n]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[^\n]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result15 !== null) { + result13.push(result15); + if (input.substr(pos).match(/^[^\n]/) !== null) { + var result15 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("[^\\n]"); } } } - if (result1 !== null) { - if (input.charCodeAt(pos) === 10) { - result2 = "\n"; - pos++; + if (result13 !== null) { + if (input.substr(pos, 1) === "\n") { + var result14 = "\n"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result14 = null; + if (reportMatchFailures) { matchFailed("\"\\n\""); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result14 !== null) { + var result11 = [result12, result13, result14]; } else { - result0 = null; - pos = pos0; + var result11 = null; + pos = savedPos3; } } else { - result0 = null; - pos = pos0; + var result11 = null; + pos = savedPos3; } } else { - result0 = null; - pos = pos0; + var result11 = null; + pos = savedPos3; } - if (result0 === null) { - pos0 = pos; + if (result11 !== null) { + var result0 = result11; + } else { + var savedPos0 = pos; if (input.substr(pos, 2) === "/*") { - result0 = "/*"; + var result2 = "/*"; pos += 2; } else { - result0 = null; - if (reportFailures === 0) { + var result2 = null; + if (reportMatchFailures) { matchFailed("\"/*\""); } } - if (result0 !== null) { - result1 = []; - if (/^[^*]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result2 !== null) { + var result3 = []; + if (input.substr(pos).match(/^[^*]/) !== null) { + var result10 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("[^*]"); } } - if (result2 === null) { - pos1 = pos; - if (input.charCodeAt(pos) === 42) { - result2 = "*"; - pos++; + if (result10 !== null) { + var result5 = result10; + } else { + var savedPos1 = pos; + if (input.substr(pos, 1) === "*") { + var result7 = "*"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"*\""); } } - if (result2 !== null) { - pos2 = pos; - reportFailures++; - if (input.charCodeAt(pos) === 47) { - result3 = "/"; - pos++; + if (result7 !== null) { + var savedPos2 = pos; + var savedReportMatchFailuresVar0 = reportMatchFailures; + reportMatchFailures = false; + if (input.substr(pos, 1) === "/") { + var result9 = "/"; + pos += 1; } else { - result3 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"/\""); } } - reportFailures--; - if (result3 === null) { - result3 = ""; + reportMatchFailures = savedReportMatchFailuresVar0; + if (result9 === null) { + var result8 = ''; } else { - result3 = null; - pos = pos2; + var result8 = null; + pos = savedPos2; } - if (result3 !== null) { - result2 = [result2, result3]; + if (result8 !== null) { + var result6 = [result7, result8]; } else { - result2 = null; - pos = pos1; + var result6 = null; + pos = savedPos1; } } else { - result2 = null; - pos = pos1; + var result6 = null; + pos = savedPos1; } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; } - while (result2 !== null) { - result1.push(result2); - if (/^[^*]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result5 !== null) { + result3.push(result5); + if (input.substr(pos).match(/^[^*]/) !== null) { + var result10 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("[^*]"); } } - if (result2 === null) { - pos1 = pos; - if (input.charCodeAt(pos) === 42) { - result2 = "*"; - pos++; + if (result10 !== null) { + var result5 = result10; + } else { + var savedPos1 = pos; + if (input.substr(pos, 1) === "*") { + var result7 = "*"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"*\""); } } - if (result2 !== null) { - pos2 = pos; - reportFailures++; - if (input.charCodeAt(pos) === 47) { - result3 = "/"; - pos++; + if (result7 !== null) { + var savedPos2 = pos; + var savedReportMatchFailuresVar0 = reportMatchFailures; + reportMatchFailures = false; + if (input.substr(pos, 1) === "/") { + var result9 = "/"; + pos += 1; } else { - result3 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"/\""); } } - reportFailures--; - if (result3 === null) { - result3 = ""; + reportMatchFailures = savedReportMatchFailuresVar0; + if (result9 === null) { + var result8 = ''; } else { - result3 = null; - pos = pos2; + var result8 = null; + pos = savedPos2; } - if (result3 !== null) { - result2 = [result2, result3]; + if (result8 !== null) { + var result6 = [result7, result8]; } else { - result2 = null; - pos = pos1; + var result6 = null; + pos = savedPos1; } } else { - result2 = null; - pos = pos1; + var result6 = null; + pos = savedPos1; } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; } } - if (result1 !== null) { + if (result3 !== null) { if (input.substr(pos, 2) === "*/") { - result2 = "*/"; + var result4 = "*/"; pos += 2; } else { - result2 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"*/\""); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result4 !== null) { + var result1 = [result2, result3, result4]; } else { - result0 = null; - pos = pos0; + var result1 = null; + pos = savedPos0; } } else { - result0 = null; - pos = pos0; + var result1 = null; + pos = savedPos0; } } else { - result0 = null; - pos = pos0; + var result1 = null; + pos = savedPos0; } - } - } - } - } - } + if (result1 !== null) { + var result0 = result1; + } else { + var result0 = null;; + }; + }; + }; + }; + }; + }; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_s() { - var result0, result1; + var cacheKey = 's@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - result1 = parse_space(); + var result1 = parse_space(); if (result1 !== null) { - result0 = []; + var result0 = []; while (result1 !== null) { result0.push(result1); - result1 = parse_space(); + var result1 = parse_space(); } } else { - result0 = null; + var result0 = null; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_w() { - var result0; + var cacheKey = 'w@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var result1 = parse_s(); + var result0 = result1 !== null ? result1 : ''; - result0 = parse_s(); - result0 = result0 !== null ? result0 : ""; + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_identifier() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'identifier@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - if (/^[A-Z_a-z]/.test(input.charAt(pos))) { - result0 = input.charAt(pos); + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[A-Z_a-z]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("[A-Z_a-z]"); } } - if (result0 !== null) { - result1 = []; - if (/^[0-9A-Z_a-z]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result3 !== null) { + var result4 = []; + if (input.substr(pos).match(/^[0-9A-Z_a-z]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9A-Z_a-z]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[0-9A-Z_a-z]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result5 !== null) { + result4.push(result5); + if (input.substr(pos).match(/^[0-9A-Z_a-z]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9A-Z_a-z]"); } } } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, nmstart, nmchars) { return nmstart + nmchars.join(""); })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(nmstart, nmchars) { return nmstart + nmchars.join(""); })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_octal() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'octal@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 48) { - result0 = "0"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "0") { + var result3 = "0"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"0\""); } } - if (result0 !== null) { - result1 = []; - if (/^[0-7]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result3 !== null) { + var result4 = []; + if (input.substr(pos).match(/^[0-7]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-7]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[0-7]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result5 !== null) { + result4.push(result5); + if (input.substr(pos).match(/^[0-7]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-7]"); } } } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, value) { return "0" + value.join(""); })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(value) { return "0" + value.join(""); })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_hex() { - var result0, result1, result2, result3; - var pos0, pos1; + var cacheKey = 'hex@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 48) { - result0 = "0"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "0") { + var result3 = "0"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"0\""); } } - if (result0 !== null) { - if (/^[Xx]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result3 !== null) { + if (input.substr(pos).match(/^[Xx]/) !== null) { + var result4 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("[Xx]"); } } - if (result1 !== null) { - if (/^[0-9A-Fa-f]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result4 !== null) { + if (input.substr(pos).match(/^[0-9A-Fa-f]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[0-9A-Fa-f]"); } } - if (result3 !== null) { - result2 = []; - while (result3 !== null) { - result2.push(result3); - if (/^[0-9A-Fa-f]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result6 !== null) { + var result5 = []; + while (result6 !== null) { + result5.push(result6); + if (input.substr(pos).match(/^[0-9A-Fa-f]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[0-9A-Fa-f]"); } } } } else { - result2 = null; + var result5 = null; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, x, value) { return "0" + x + value.join(""); })(pos0, result0[1], result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(x, value) { return "0" + x + value.join(""); })(result1[1], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_decimal() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'decimal@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (/^[0-9]/.test(input.charAt(pos))) { - result0 = input.charAt(pos); + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result0 !== null) { - result1 = []; - if (/^[0-9]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result3 !== null) { + var result4 = []; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[0-9]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result5 !== null) { + result4.push(result5); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, numStart, numRest) { return numStart + numRest.join(""); })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(numStart, numRest) { return numStart + numRest.join(""); })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_integer() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'integer@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 45) { - result0 = "-"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "-") { + var result8 = "-"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"-\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_hex(); - if (result1 === null) { - result1 = parse_octal(); - if (result1 === null) { - result1 = parse_decimal(); - } + var result3 = result8 !== null ? result8 : ''; + if (result3 !== null) { + var result7 = parse_hex(); + if (result7 !== null) { + var result4 = result7; + } else { + var result6 = parse_octal(); + if (result6 !== null) { + var result4 = result6; + } else { + var result5 = parse_decimal(); + if (result5 !== null) { + var result4 = result5; + } else { + var result4 = null;; + }; + }; } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, neg, num) { return neg + num; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(neg, num) { return neg + num; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_floatEe() { - var result0, result1, result2, result3; - var pos0, pos1; + var cacheKey = 'floatEe@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - if (/^[Ee]/.test(input.charAt(pos))) { - result0 = input.charAt(pos); + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[Ee]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("[Ee]"); } } - if (result0 !== null) { - if (/^[+\-]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result3 !== null) { + if (input.substr(pos).match(/^[+\-]/) !== null) { + var result7 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("[+\\-]"); } } - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + var result4 = result7 !== null ? result7 : ''; + if (result4 !== null) { + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result3 !== null) { - result2 = []; - while (result3 !== null) { - result2.push(result3); - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result6 !== null) { + var result5 = []; + while (result6 !== null) { + result5.push(result6); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } } else { - result2 = null; + var result5 = null; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, e, sign, exp) { return e + sign + exp.join(""); })(pos0, result0[0], result0[1], result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(e, sign, exp) { return e + sign + exp.join(""); })(result1[0], result1[1], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_expFloat() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'expFloat@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result1 !== null) { - result0 = []; - while (result1 !== null) { - result0.push(result1); - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result5 !== null) { + var result3 = []; + while (result5 !== null) { + result3.push(result5); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } } else { - result0 = null; + var result3 = null; } - if (result0 !== null) { - result1 = parse_floatEe(); - if (result1 !== null) { - result0 = [result0, result1]; + if (result3 !== null) { + var result4 = parse_floatEe(); + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, num, fee) { return num.join("") + fee; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(num, fee) { return num.join("") + fee; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_leadFloat() { - var result0, result1, result2, result3; - var pos0, pos1; + var cacheKey = 'leadFloat@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result9 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result1 !== null) { - result0 = []; - while (result1 !== null) { - result0.push(result1); - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result9 !== null) { + var result3 = []; + while (result9 !== null) { + result3.push(result9); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result9 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } } else { - result0 = null; + var result3 = null; } - if (result0 !== null) { - if (input.charCodeAt(pos) === 46) { - result1 = "."; - pos++; + if (result3 !== null) { + if (input.substr(pos, 1) === ".") { + var result4 = "."; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\".\""); } } - if (result1 !== null) { - result2 = []; - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result4 !== null) { + var result5 = []; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result8 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - while (result3 !== null) { - result2.push(result3); - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + while (result8 !== null) { + result5.push(result8); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result8 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } - if (result2 !== null) { - result3 = parse_floatEe(); - result3 = result3 !== null ? result3 : ""; - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result5 !== null) { + var result7 = parse_floatEe(); + var result6 = result7 !== null ? result7 : ''; + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(pos0, result0[0], result0[2], result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(result1[0], result1[2], result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_dotFloat() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = []; - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + var cacheKey = 'dotFloat@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = []; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result9 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - while (result1 !== null) { - result0.push(result1); - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + while (result9 !== null) { + result3.push(result9); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result9 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } - if (result0 !== null) { - if (input.charCodeAt(pos) === 46) { - result1 = "."; - pos++; + if (result3 !== null) { + if (input.substr(pos, 1) === ".") { + var result4 = "."; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\".\""); } } - if (result1 !== null) { - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result4 !== null) { + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result8 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result3 !== null) { - result2 = []; - while (result3 !== null) { - result2.push(result3); - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result8 !== null) { + var result5 = []; + while (result8 !== null) { + result5.push(result8); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result8 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } } else { - result2 = null; + var result5 = null; } - if (result2 !== null) { - result3 = parse_floatEe(); - result3 = result3 !== null ? result3 : ""; - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result5 !== null) { + var result7 = parse_floatEe(); + var result6 = result7 !== null ? result7 : ''; + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(pos0, result0[0], result0[2], result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(result1[0], result1[2], result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_float() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'float@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 45) { - result0 = "-"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "-") { + var result9 = "-"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"-\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_leadFloat(); - if (result1 === null) { - result1 = parse_dotFloat(); - if (result1 === null) { - result1 = parse_expFloat(); - if (result1 === null) { + var result3 = result9 !== null ? result9 : ''; + if (result3 !== null) { + var result8 = parse_leadFloat(); + if (result8 !== null) { + var result4 = result8; + } else { + var result7 = parse_dotFloat(); + if (result7 !== null) { + var result4 = result7; + } else { + var result6 = parse_expFloat(); + if (result6 !== null) { + var result4 = result6; + } else { if (input.substr(pos, 8) === "Infinity") { - result1 = "Infinity"; + var result5 = "Infinity"; pos += 8; } else { - result1 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"Infinity\""); } } - } - } + if (result5 !== null) { + var result4 = result5; + } else { + var result4 = null;; + }; + }; + }; } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, neg, num) { return neg + num; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(neg, num) { return neg + num; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_string() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'string@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 34) { - result0 = "\""; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "\"") { + var result3 = "\""; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"\\\"\""); } } - if (result0 !== null) { - result1 = []; - if (/^[^""]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result3 !== null) { + var result4 = []; + if (input.substr(pos).match(/^[^""]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[^\"\"]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[^""]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result6 !== null) { + result4.push(result6); + if (input.substr(pos).match(/^[^""]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[^\"\"]"); } } } - if (result1 !== null) { - if (input.charCodeAt(pos) === 34) { - result2 = "\""; - pos++; + if (result4 !== null) { + if (input.substr(pos, 1) === "\"") { + var result5 = "\""; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"\\\"\""); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, str) { return str.join(""); })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(str) { return str.join(""); })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_other() { - var result0, result1; - var pos0; + var cacheKey = 'other@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - if (/^[^\t\n\r 0-9A-Z_a-z]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + var savedPos0 = pos; + if (input.substr(pos).match(/^[^ \n\r 0-9A-Z_a-z]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("[^\\t\\n\\r 0-9A-Z_a-z]"); + var result3 = null; + if (reportMatchFailures) { + matchFailed("[^ \\n\\r 0-9A-Z_a-z]"); } } - if (result1 !== null) { - result0 = []; - while (result1 !== null) { - result0.push(result1); - if (/^[^\t\n\r 0-9A-Z_a-z]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result3 !== null) { + var result1 = []; + while (result3 !== null) { + result1.push(result3); + if (input.substr(pos).match(/^[^ \n\r 0-9A-Z_a-z]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("[^\\t\\n\\r 0-9A-Z_a-z]"); + var result3 = null; + if (reportMatchFailures) { + matchFailed("[^ \\n\\r 0-9A-Z_a-z]"); } } } } else { - result0 = null; - } - if (result0 !== null) { - result0 = (function(offset, other) { return other.join(""); })(pos0, result0); + var result1 = null; } - if (result0 === null) { - pos = pos0; + var result2 = result1 !== null + ? (function(other) { return other.join(""); })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_type() { - var result0, result1; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_TypeDesc(); - if (result0 !== null) { - result1 = parse_Nullable(); - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'type@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_TypeDesc(); + if (result3 !== null) { + var result4 = parse_Nullable(); + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type, nullable) { - if (!type.sequence) type.sequence = false; - type.nullable = nullable; - return type; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type, nullable) { + if (!type.sequence) type.sequence = false; + type.nullable = nullable; + return type; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_TypeDesc() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_Sequence(); - if (result0 === null) { - result0 = parse_ArrayType(); - if (result0 === null) { - result0 = parse_SimpleType(); - if (result0 === null) { - result0 = parse_UnionType(); - } - } - } - if (result0 !== null) { - result0 = (function(offset, type) { return type; })(pos0, result0); + var cacheKey = 'TypeDesc@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result6 = parse_Sequence(); + if (result6 !== null) { + var result1 = result6; + } else { + var result5 = parse_ArrayType(); + if (result5 !== null) { + var result1 = result5; + } else { + var result4 = parse_SimpleType(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_UnionType(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + }; + } + var result2 = result1 !== null + ? (function(type) { return type; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Sequence() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'Sequence@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 9) === "sequence<") { - result0 = "sequence<"; + var result3 = "sequence<"; pos += 9; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"sequence<\""); } } - if (result0 !== null) { - result1 = parse_type(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 62) { - result2 = ">"; - pos++; + if (result3 !== null) { + var result4 = parse_type(); + if (result4 !== null) { + if (input.substr(pos, 1) === ">") { + var result5 = ">"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\">\""); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type) { return { sequence: true, array: false, idlType: type, members: [] }; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type) { return { sequence: true, array: false, idlType: type, members: [] }; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ArrayType() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'ArrayType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - result0 = parse_SimpleType(); - if (result0 !== null) { + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_SimpleType(); + if (result3 !== null) { if (input.substr(pos, 2) === "[]") { - result1 = "[]"; + var result4 = "[]"; pos += 2; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"[]\""); } } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type) { - type.array = true; - return type; - })(pos0, result0[0]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type) { + type.array = true; + return type; + })(result1[0]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_UnionType() { - var result0, result1, result2, result3, result4; - var pos0, pos1; + var cacheKey = 'UnionType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 40) { - result0 = "("; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "(") { + var result3 = "("; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_TypeList(); - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_TypeList(); + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + if (input.substr(pos, 1) === ")") { + var result7 = ")"; + pos += 1; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; + if (result7 !== null) { + var result1 = [result3, result4, result5, result6, result7]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, members) { return { idlType: "union", members: members, sequence: false, array: false }; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(members) { return { idlType: "union", members: members, sequence: false, array: false }; })(result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_TypeList() { - var result0, result1, result2, result3, result4, result5, result6; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_type(); - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { + var cacheKey = 'TypeList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_type(); + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { if (input.substr(pos, 2) === "or") { - result2 = "or"; + var result5 = "or"; pos += 2; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"or\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_type(); - if (result4 !== null) { - result5 = []; - result6 = parse_TypeListRest(); - while (result6 !== null) { - result5.push(result6); - result6 = parse_TypeListRest(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_type(); + if (result7 !== null) { + var result8 = []; + var result9 = parse_TypeListRest(); + while (result9 !== null) { + result8.push(result9); + var result9 = parse_TypeListRest(); } - if (result5 !== null) { - result0 = [result0, result1, result2, result3, result4, result5]; + if (result8 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, second, others) { var ret = [first, second]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[4], result0[5]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, second, others) { var ret = [first, second]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[4], result1[5]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_TypeListRest() { - var result0, result1, result2, result3; - var pos0, pos1; + var cacheKey = 'TypeListRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - result0 = parse_s(); - if (result0 !== null) { + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_s(); + if (result3 !== null) { if (input.substr(pos, 2) === "or") { - result1 = "or"; + var result4 = "or"; pos += 2; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"or\""); } } - if (result1 !== null) { - result2 = parse_s(); - if (result2 !== null) { - result3 = parse_type(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_s(); + if (result5 !== null) { + var result6 = parse_type(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_SimpleType() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_PrimitiveType(); - if (result0 === null) { - result0 = parse_UnsignedIntegerType(); - if (result0 === null) { - result0 = parse_FloatType(); - if (result0 === null) { - result0 = parse_ScopedName(); - } - } + var cacheKey = 'SimpleType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 !== null) { - result0 = (function(offset, type) { return { sequence: false, array: false, idlType: type, members: [] }; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result6 = parse_PrimitiveType(); + if (result6 !== null) { + var result1 = result6; + } else { + var result5 = parse_UnsignedIntegerType(); + if (result5 !== null) { + var result1 = result5; + } else { + var result4 = parse_FloatType(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_ScopedName(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + }; + } + var result2 = result1 !== null + ? (function(type) { return { sequence: false, array: false, idlType: type, members: [] }; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_PrimitiveType() { - var result0, result1; - var pos0, pos1, pos2; + var cacheKey = 'PrimitiveType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 3) === "any") { - result0 = "any"; + var result10 = "any"; pos += 3; } else { - result0 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("\"any\""); } } - if (result0 === null) { + if (result10 !== null) { + var result3 = result10; + } else { if (input.substr(pos, 6) === "object") { - result0 = "object"; + var result9 = "object"; pos += 6; } else { - result0 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"object\""); } } - if (result0 === null) { + if (result9 !== null) { + var result3 = result9; + } else { if (input.substr(pos, 7) === "boolean") { - result0 = "boolean"; + var result8 = "boolean"; pos += 7; } else { - result0 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"boolean\""); } } - if (result0 === null) { + if (result8 !== null) { + var result3 = result8; + } else { if (input.substr(pos, 5) === "octet") { - result0 = "octet"; + var result7 = "octet"; pos += 5; } else { - result0 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"octet\""); } } - if (result0 === null) { + if (result7 !== null) { + var result3 = result7; + } else { if (input.substr(pos, 9) === "DOMString") { - result0 = "DOMString"; + var result6 = "DOMString"; pos += 9; } else { - result0 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\"DOMString\""); } } - } - } - } - } - if (result0 !== null) { - pos2 = pos; - reportFailures++; - if (/^[A-Za-z0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result6 !== null) { + var result3 = result6; + } else { + var result3 = null;; + }; + }; + }; + }; + } + if (result3 !== null) { + var savedPos2 = pos; + var savedReportMatchFailuresVar0 = reportMatchFailures; + reportMatchFailures = false; + if (input.substr(pos).match(/^[A-Za-z0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[A-Za-z0-9]"); } } - reportFailures--; - if (result1 === null) { - result1 = ""; + reportMatchFailures = savedReportMatchFailuresVar0; + if (result5 === null) { + var result4 = ''; } else { - result1 = null; - pos = pos2; + var result4 = null; + pos = savedPos2; } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type) { return type; })(pos0, result0[0]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type) { return type; })(result1[0]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_FloatType() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'FloatType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 12) === "unrestricted") { - result0 = "unrestricted"; + var result8 = "unrestricted"; pos += 12; } else { - result0 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"unrestricted\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { + var result3 = result8 !== null ? result8 : ''; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { if (input.substr(pos, 5) === "float") { - result2 = "float"; + var result7 = "float"; pos += 5; } else { - result2 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"float\""); } } - if (result2 === null) { + if (result7 !== null) { + var result5 = result7; + } else { if (input.substr(pos, 6) === "double") { - result2 = "double"; + var result6 = "double"; pos += 6; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\"double\""); } } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, unr, kind) { return (unr ? "unrestricted " : "") + (kind); })(pos0, result0[0], result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(unr, kind) { return (unr ? "unrestricted " : "") + (kind); })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_UnsignedIntegerType() { - var result0, result1, result2, result3, result4; - var pos0, pos1, pos2; + var cacheKey = 'UnsignedIntegerType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 8) === "unsigned") { - result0 = "unsigned"; + var result13 = "unsigned"; pos += 8; } else { - result0 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"unsigned\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - pos2 = pos; + var result3 = result13 !== null ? result13 : ''; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var savedPos2 = pos; if (input.substr(pos, 4) === "long") { - result2 = "long"; + var result10 = "long"; pos += 4; } else { - result2 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("\"long\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { + if (result10 !== null) { + var result11 = parse_s(); + if (result11 !== null) { if (input.substr(pos, 4) === "long") { - result4 = "long"; + var result12 = "long"; pos += 4; } else { - result4 = null; - if (reportFailures === 0) { + var result12 = null; + if (reportMatchFailures) { matchFailed("\"long\""); } } - if (result4 !== null) { - result2 = [result2, result3, result4]; + if (result12 !== null) { + var result9 = [result10, result11, result12]; } else { - result2 = null; - pos = pos2; + var result9 = null; + pos = savedPos2; } } else { - result2 = null; - pos = pos2; + var result9 = null; + pos = savedPos2; } } else { - result2 = null; - pos = pos2; + var result9 = null; + pos = savedPos2; } - if (result2 === null) { + if (result9 !== null) { + var result5 = result9; + } else { if (input.substr(pos, 4) === "long") { - result2 = "long"; + var result8 = "long"; pos += 4; } else { - result2 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"long\""); } } - if (result2 === null) { + if (result8 !== null) { + var result5 = result8; + } else { if (input.substr(pos, 5) === "short") { - result2 = "short"; + var result7 = "short"; pos += 5; } else { - result2 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"short\""); } } - if (result2 === null) { + if (result7 !== null) { + var result5 = result7; + } else { if (input.substr(pos, 4) === "byte") { - result2 = "byte"; + var result6 = "byte"; pos += 4; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\"byte\""); } } - } - } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; + }; + }; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, uns, kind) { return (uns ? "unsigned " : "") + (kind.join ? kind.join("") : kind); })(pos0, result0[0], result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(uns, kind) { return (uns ? "unsigned " : "") + (kind.join ? kind.join("") : kind); })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ScopedNameList() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_ScopedName(); - if (result0 !== null) { - result1 = []; - result2 = parse_ScopedNameListRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_ScopedNameListRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'ScopedNameList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_ScopedName(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_ScopedNameListRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_ScopedNameListRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, others) { var ret = [first]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, others) { var ret = [first]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ScopedNameListRest() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 44) { - result1 = ","; - pos++; + var cacheKey = 'ScopedNameListRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === ",") { + var result4 = ","; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\",\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_ScopedName(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_ScopedName(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ScopedName() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_AbsoluteScopedName(); - if (result0 === null) { - result0 = parse_RelativeScopedName(); - } - if (result0 !== null) { - result0 = (function(offset, name) { return name; })(pos0, result0); + var cacheKey = 'ScopedName@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result4 = parse_AbsoluteScopedName(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_RelativeScopedName(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + } + var result2 = result1 !== null + ? (function(name) { return name; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_AbsoluteScopedName() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'AbsoluteScopedName@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 2) === "::") { - result0 = "::"; + var result3 = "::"; pos += 2; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"::\""); } } - if (result0 !== null) { - result1 = parse_RelativeScopedName(); - if (result1 !== null) { - result0 = [result0, result1]; + if (result3 !== null) { + var result4 = parse_RelativeScopedName(); + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rel) { return "::" + rel; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rel) { return "::" + rel; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_RelativeScopedName() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = []; - result2 = parse_ScopedNameRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_ScopedNameRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'RelativeScopedName@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_identifier(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_ScopedNameRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_ScopedNameRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, rest) { return name + rest.join(""); })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, rest) { return name + rest.join(""); })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ScopedNameRest() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'ScopedNameRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 2) === "::") { - result0 = "::"; + var result3 = "::"; pos += 2; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"::\""); } } - if (result0 !== null) { - result1 = parse_identifier(); - if (result1 !== null) { - result0 = [result0, result1]; + if (result3 !== null) { + var result4 = parse_identifier(); + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name) { return name.join(""); })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name) { return name.join(""); })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_BooleanLiteral() { - var result0; - var pos0; + var cacheKey = 'BooleanLiteral@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; + + var savedPos0 = pos; if (input.substr(pos, 4) === "true") { - result0 = "true"; + var result4 = "true"; pos += 4; } else { - result0 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"true\""); } } - if (result0 === null) { + if (result4 !== null) { + var result1 = result4; + } else { if (input.substr(pos, 5) === "false") { - result0 = "false"; + var result3 = "false"; pos += 5; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"false\""); } } + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + } + var result2 = result1 !== null + ? (function(value) { return value; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } - if (result0 !== null) { - result0 = (function(offset, value) { return value; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; - } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Nullable() { - var result0; - var pos0; + var cacheKey = 'Nullable@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - if (input.charCodeAt(pos) === 63) { - result0 = "?"; - pos++; + + var savedPos0 = pos; + if (input.substr(pos, 1) === "?") { + var result3 = "?"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"?\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result0 = (function(offset, nullable) { return nullable ? true : false; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + var result1 = result3 !== null ? result3 : ''; + var result2 = result1 !== null + ? (function(nullable) { return nullable ? true : false; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ReturnType() { - var result0; - var pos0; + var cacheKey = 'ReturnType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; + + var savedPos0 = pos; if (input.substr(pos, 4) === "void") { - result0 = "void"; + var result4 = "void"; pos += 4; } else { - result0 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"void\""); } } - if (result0 === null) { - result0 = parse_type(); - } - if (result0 !== null) { - result0 = (function(offset, ret) { return ret; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_type(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + } + var result2 = result1 !== null + ? (function(ret) { return ret; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_definitions() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - result1 = []; - result2 = parse_definition(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_definition(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'definitions@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_definition(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_definition(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, defs) { return defs; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(defs) { return defs; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_definition() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_partialinterface(); - if (result0 === null) { - result0 = parse_callbackinterface(); - if (result0 === null) { - result0 = parse_module(); - if (result0 === null) { - result0 = parse_interface(); - if (result0 === null) { - result0 = parse_dictionary(); - if (result0 === null) { - result0 = parse_typedef(); - if (result0 === null) { - result0 = parse_exception(); - if (result0 === null) { - result0 = parse_implements(); - if (result0 === null) { - result0 = parse_enum(); - if (result0 === null) { - result0 = parse_callback(); - } - } - } - } - } - } - } - } - } - if (result0 !== null) { - result0 = (function(offset, def) { return def; })(pos0, result0); + var cacheKey = 'definition@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result12 = parse_partialinterface(); + if (result12 !== null) { + var result1 = result12; + } else { + var result11 = parse_callbackinterface(); + if (result11 !== null) { + var result1 = result11; + } else { + var result10 = parse_module(); + if (result10 !== null) { + var result1 = result10; + } else { + var result9 = parse_interface(); + if (result9 !== null) { + var result1 = result9; + } else { + var result8 = parse_dictionary(); + if (result8 !== null) { + var result1 = result8; + } else { + var result7 = parse_typedef(); + if (result7 !== null) { + var result1 = result7; + } else { + var result6 = parse_exception(); + if (result6 !== null) { + var result1 = result6; + } else { + var result5 = parse_implements(); + if (result5 !== null) { + var result1 = result5; + } else { + var result4 = parse_enum(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_callback(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } + var result2 = result1 !== null + ? (function(def) { return def; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_partialinterface() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'partialinterface@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result20 = parse_extendedAttributeList(); + var result3 = result20 !== null ? result20 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 7) === "partial") { - result2 = "partial"; + var result5 = "partial"; pos += 7; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"partial\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { if (input.substr(pos, 9) === "interface") { - result4 = "interface"; + var result7 = "interface"; pos += 9; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"interface\""); } } - if (result4 !== null) { - result5 = parse_s(); - if (result5 !== null) { - result6 = parse_identifier(); - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 123) { - result8 = "{"; - pos++; + if (result7 !== null) { + var result8 = parse_s(); + if (result8 !== null) { + var result9 = parse_identifier(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === "{") { + var result11 = "{"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = []; - result11 = parse_ifMember(); - while (result11 !== null) { - result10.push(result11); - result11 = parse_ifMember(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result13 = []; + var result19 = parse_ifMember(); + while (result19 !== null) { + result13.push(result19); + var result19 = parse_ifMember(); } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 125) { - result12 = "}"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === "}") { + var result15 = "}"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - if (input.charCodeAt(pos) === 59) { - result14 = ";"; - pos++; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + if (input.substr(pos, 1) === ";") { + var result17 = ";"; + pos += 1; } else { - result14 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result14 !== null) { - result15 = parse_w(); - if (result15 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15]; + if (result17 !== null) { + var result18 = parse_w(); + if (result18 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17, result18]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, mem) { return { type: "partialinterface", name: name, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, mem) { return { type: "partialinterface", name: name, members: mem, extAttrs: extAttrs }; })(result1[0], result1[6], result1[10]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_callbackinterface() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'callbackinterface@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result20 = parse_extendedAttributeList(); + var result3 = result20 !== null ? result20 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 8) === "callback") { - result2 = "callback"; + var result5 = "callback"; pos += 8; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"callback\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { if (input.substr(pos, 9) === "interface") { - result4 = "interface"; + var result7 = "interface"; pos += 9; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"interface\""); } } - if (result4 !== null) { - result5 = parse_s(); - if (result5 !== null) { - result6 = parse_identifier(); - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 123) { - result8 = "{"; - pos++; + if (result7 !== null) { + var result8 = parse_s(); + if (result8 !== null) { + var result9 = parse_identifier(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === "{") { + var result11 = "{"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = []; - result11 = parse_ifMember(); - while (result11 !== null) { - result10.push(result11); - result11 = parse_ifMember(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result13 = []; + var result19 = parse_ifMember(); + while (result19 !== null) { + result13.push(result19); + var result19 = parse_ifMember(); } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 125) { - result12 = "}"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === "}") { + var result15 = "}"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - if (input.charCodeAt(pos) === 59) { - result14 = ";"; - pos++; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + if (input.substr(pos, 1) === ";") { + var result17 = ";"; + pos += 1; } else { - result14 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result14 !== null) { - result15 = parse_w(); - if (result15 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15]; + if (result17 !== null) { + var result18 = parse_w(); + if (result18 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17, result18]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, mem) { return { type: "callbackinterface", name: name, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, mem) { return { type: "callbackinterface", name: name, members: mem, extAttrs: extAttrs }; })(result1[0], result1[6], result1[10]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_module() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'module@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result17 = parse_extendedAttributeList(); + var result3 = result17 !== null ? result17 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 6) === "module") { - result2 = "module"; + var result5 = "module"; pos += 6; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"module\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 123) { - result6 = "{"; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "{") { + var result9 = "{"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_definitions(); - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 125) { - result10 = "}"; - pos++; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = parse_definitions(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === "}") { + var result13 = "}"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, defs) { return { type: "module", name: name, definitions: defs, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, defs) { return { type: "module", name: name, definitions: defs, extAttrs: extAttrs }; })(result1[0], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_implements() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { - result2 = parse_ScopedName(); - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { + var cacheKey = 'implements@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result13 = parse_extendedAttributeList(); + var result3 = result13 !== null ? result13 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_ScopedName(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { if (input.substr(pos, 10) === "implements") { - result4 = "implements"; + var result7 = "implements"; pos += 10; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"implements\""); } } - if (result4 !== null) { - result5 = parse_s(); - if (result5 !== null) { - result6 = parse_ScopedName(); - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 59) { - result8 = ";"; - pos++; + if (result7 !== null) { + var result8 = parse_s(); + if (result8 !== null) { + var result9 = parse_ScopedName(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === ";") { + var result11 = ";"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9]; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, target, impl) { return { type: 'implements', target: target, 'implements': impl, extAttrs: extAttrs }; })(pos0, result0[0], result0[2], result0[6]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, target, impl) { return { type: 'implements', target: target, 'implements': impl, extAttrs: extAttrs }; })(result1[0], result1[2], result1[6]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_interface() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'interface@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result21 = parse_extendedAttributeList(); + var result3 = result21 !== null ? result21 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 9) === "interface") { - result2 = "interface"; + var result5 = "interface"; pos += 9; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"interface\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - result6 = parse_ifInheritance(); - result6 = result6 !== null ? result6 : ""; - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 123) { - result8 = "{"; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + var result20 = parse_ifInheritance(); + var result9 = result20 !== null ? result20 : ''; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === "{") { + var result11 = "{"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = []; - result11 = parse_ifMember(); - while (result11 !== null) { - result10.push(result11); - result11 = parse_ifMember(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result13 = []; + var result19 = parse_ifMember(); + while (result19 !== null) { + result13.push(result19); + var result19 = parse_ifMember(); } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 125) { - result12 = "}"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === "}") { + var result15 = "}"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - if (input.charCodeAt(pos) === 59) { - result14 = ";"; - pos++; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + if (input.substr(pos, 1) === ";") { + var result17 = ";"; + pos += 1; } else { - result14 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result14 !== null) { - result15 = parse_w(); - if (result15 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15]; + if (result17 !== null) { + var result18 = parse_w(); + if (result18 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17, result18]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, herit, mem) { return { type: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, herit, mem) { return { type: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs }; })(result1[0], result1[4], result1[6], result1[10]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_enum() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'enum@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result17 = parse_extendedAttributeList(); + var result3 = result17 !== null ? result17 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 4) === "enum") { - result2 = "enum"; + var result5 = "enum"; pos += 4; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"enum\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 123) { - result6 = "{"; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "{") { + var result9 = "{"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_EnumValues(); - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 125) { - result10 = "}"; - pos++; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = parse_EnumValues(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === "}") { + var result13 = "}"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, values) { return { type: "enum", name: name, values: values, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, values) { return { type: "enum", name: name, values: values, extAttrs: extAttrs }; })(result1[0], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_callback() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'callback@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result21 = parse_extendedAttributeList(); + var result3 = result21 !== null ? result21 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 8) === "callback") { - result2 = "callback"; + var result5 = "callback"; pos += 8; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"callback\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 61) { - result6 = "="; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "=") { + var result9 = "="; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"=\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_ReturnType(); - if (result8 !== null) { - result9 = parse_s(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 40) { - result10 = "("; - pos++; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = parse_ReturnType(); + if (result11 !== null) { + var result12 = parse_s(); + if (result12 !== null) { + if (input.substr(pos, 1) === "(") { + var result13 = "("; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - result12 = parse_Arguments(); - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - if (input.charCodeAt(pos) === 41) { - result14 = ")"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + var result15 = parse_Arguments(); + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + if (input.substr(pos, 1) === ")") { + var result17 = ")"; + pos += 1; } else { - result14 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result14 !== null) { - result15 = parse_w(); - if (result15 !== null) { - if (input.charCodeAt(pos) === 59) { - result16 = ";"; - pos++; + if (result17 !== null) { + var result18 = parse_w(); + if (result18 !== null) { + if (input.substr(pos, 1) === ";") { + var result19 = ";"; + pos += 1; } else { - result16 = null; - if (reportFailures === 0) { + var result19 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result16 !== null) { - result17 = parse_w(); - if (result17 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17]; + if (result19 !== null) { + var result20 = parse_w(); + if (result20 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17, result18, result19, result20]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, ret, args) { return { type: "callback", idlType: ret, name: name, args: args, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8], result0[12]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, ret, args) { return { type: "callback", idlType: ret, name: name, args: args, extAttrs: extAttrs }; })(result1[0], result1[4], result1[8], result1[12]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_EnumValues() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_string(); - if (result0 !== null) { - result1 = []; - result2 = parse_EnumValuesRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_EnumValuesRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'EnumValues@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_string(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_EnumValuesRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_EnumValuesRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, others) { var ret = [first]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, others) { var ret = [first]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_EnumValuesRest() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 44) { - result1 = ","; - pos++; + var cacheKey = 'EnumValuesRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === ",") { + var result4 = ","; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\",\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_string(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_string(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ifInheritance() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'ifInheritance@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 58) { - result0 = ":"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === ":") { + var result3 = ":"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\":\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_ScopedNameList(); - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_ScopedNameList(); + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, herit) { return herit; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(herit) { return herit; })(result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ifMember() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_const(); - if (result0 === null) { - result0 = parse_attrOrOp(); + var cacheKey = 'ifMember@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 !== null) { - result0 = (function(offset, mem) { return mem; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var savedPos1 = pos; + var result8 = parse_extendedAttributeList(); + var result3 = result8 !== null ? result8 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result7 = parse_const(); + if (result7 !== null) { + var result5 = result7; + } else { + var result6 = parse_attrOrOp(); + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; + } + if (result5 !== null) { + var result1 = [result3, result4, result5]; + } else { + var result1 = null; + pos = savedPos1; + } + } else { + var result1 = null; + pos = savedPos1; + } + } else { + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, mem) { + if ( extAttrs ) { mem.extAttrs = extAttrs }; + return mem; + })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_const() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { - if (input.substr(pos, 5) === "const") { - result2 = "const"; - pos += 5; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"const\""); - } - } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_type(); - if (result4 !== null) { - result5 = parse_s(); - if (result5 !== null) { - result6 = parse_identifier(); - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 61) { - result8 = "="; - pos++; - } else { - result8 = null; - if (reportFailures === 0) { - matchFailed("\"=\""); - } - } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = parse_constExpr(); - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; - } else { - result12 = null; - if (reportFailures === 0) { - matchFailed("\";\""); - } - } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + var cacheKey = 'const@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 5) === "const") { + var result3 = "const"; + pos += 5; + } else { + var result3 = null; + if (reportMatchFailures) { + matchFailed("\"const\""); + } + } + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var result5 = parse_type(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "=") { + var result9 = "="; + pos += 1; + } else { + var result9 = null; + if (reportMatchFailures) { + matchFailed("\"=\""); + } + } + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = parse_constExpr(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === ";") { + var result13 = ";"; + pos += 1; + } else { + var result13 = null; + if (reportMatchFailures) { + matchFailed("\";\""); + } + } + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, type, name, value) { return { type: "const", extAttrs: extAttrs, idlType: type, name: name, value: value }; })(pos0, result0[0], result0[4], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type, name, value) { return { type: "const", idlType: type, name: name, value: value }; })(result1[2], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_constExpr() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_BooleanLiteral(); - if (result0 === null) { - result0 = parse_float(); - if (result0 === null) { - result0 = parse_integer(); - if (result0 === null) { + var cacheKey = 'constExpr@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var result7 = parse_BooleanLiteral(); + if (result7 !== null) { + var result1 = result7; + } else { + var result6 = parse_float(); + if (result6 !== null) { + var result1 = result6; + } else { + var result5 = parse_integer(); + if (result5 !== null) { + var result1 = result5; + } else { if (input.substr(pos, 3) === "NaN") { - result0 = "NaN"; + var result4 = "NaN"; pos += 3; } else { - result0 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"NaN\""); } } - if (result0 === null) { + if (result4 !== null) { + var result1 = result4; + } else { if (input.substr(pos, 4) === "null") { - result0 = "null"; + var result3 = "null"; pos += 4; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"null\""); } } - } - } - } - } - if (result0 !== null) { - result0 = (function(offset, value) { return value; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + }; + }; + } + var result2 = result1 !== null + ? (function(value) { return value; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_attrOrOp() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_Stringifier(); - if (result0 === null) { - result0 = parse_Attribute(); - if (result0 === null) { - result0 = parse_Operation(); - } - } - if (result0 !== null) { - result0 = (function(offset, ao) { return ao; })(pos0, result0); + var cacheKey = 'attrOrOp@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result5 = parse_Stringifier(); + if (result5 !== null) { + var result1 = result5; + } else { + var result4 = parse_Attribute(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_Operation(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + } + var result2 = result1 !== null + ? (function(ao) { return ao; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Stringifier() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'Stringifier@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 11) === "stringifier") { - result0 = "stringifier"; + var result3 = "stringifier"; pos += 11; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"stringifier\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_Attribute(); - if (result2 === null) { - result2 = parse_OperationRest(); - if (result2 === null) { - if (input.charCodeAt(pos) === 59) { - result2 = ";"; - pos++; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result8 = parse_Attribute(); + if (result8 !== null) { + var result5 = result8; + } else { + var result7 = parse_OperationRest(); + if (result7 !== null) { + var result5 = result7; + } else { + if (input.substr(pos, 1) === ";") { + var result6 = ";"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; + }; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { - if (rest === ";") return { type: "stringifier" }; - else { - rest.stringifier = true; - return rest; - } - })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { + if (rest === ";") return { type: "stringifier" }; + else { + rest.stringifier = true; + return rest; + } + })(result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Attribute() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14; - var pos0, pos1, pos2; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - pos2 = pos; - if (input.substr(pos, 8) === "readonly") { - result2 = "readonly"; - pos += 8; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"readonly\""); - } - } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result2 = [result2, result3]; - } else { - result2 = null; - pos = pos2; - } - } else { - result2 = null; - pos = pos2; + var cacheKey = 'Attribute@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var savedPos2 = pos; + if (input.substr(pos, 8) === "readonly") { + var result19 = "readonly"; + pos += 8; + } else { + var result19 = null; + if (reportMatchFailures) { + matchFailed("\"readonly\""); + } + } + if (result19 !== null) { + var result20 = parse_s(); + if (result20 !== null) { + var result18 = [result19, result20]; + } else { + var result18 = null; + pos = savedPos2; + } + } else { + var result18 = null; + pos = savedPos2; + } + var result3 = result18 !== null ? result18 : ''; + if (result3 !== null) { + if (input.substr(pos, 9) === "attribute") { + var result4 = "attribute"; + pos += 9; + } else { + var result4 = null; + if (reportMatchFailures) { + matchFailed("\"attribute\""); } - result2 = result2 !== null ? result2 : ""; - if (result2 !== null) { - if (input.substr(pos, 9) === "attribute") { - result3 = "attribute"; - pos += 9; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\"attribute\""); - } - } - if (result3 !== null) { - result4 = parse_s(); - if (result4 !== null) { - result5 = parse_type(); - if (result5 !== null) { - result6 = parse_s(); - if (result6 !== null) { - result7 = parse_identifier(); - if (result7 !== null) { - result8 = parse_w(); - if (result8 !== null) { - result9 = parse_GetRaises(); - result9 = result9 !== null ? result9 : ""; - if (result9 !== null) { - result10 = parse_w(); - if (result10 !== null) { - result11 = parse_SetRaises(); - result11 = result11 !== null ? result11 : ""; - if (result11 !== null) { - result12 = parse_w(); - if (result12 !== null) { - if (input.charCodeAt(pos) === 59) { - result13 = ";"; - pos++; - } else { - result13 = null; - if (reportFailures === 0) { - matchFailed("\";\""); - } - } - if (result13 !== null) { - result14 = parse_w(); - if (result14 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + } + if (result4 !== null) { + var result5 = parse_s(); + if (result5 !== null) { + var result6 = parse_type(); + if (result6 !== null) { + var result7 = parse_s(); + if (result7 !== null) { + var result8 = parse_identifier(); + if (result8 !== null) { + var result9 = parse_w(); + if (result9 !== null) { + var result17 = parse_GetRaises(); + var result10 = result17 !== null ? result17 : ''; + if (result10 !== null) { + var result11 = parse_w(); + if (result11 !== null) { + var result16 = parse_SetRaises(); + var result12 = result16 !== null ? result16 : ''; + if (result12 !== null) { + var result13 = parse_w(); + if (result13 !== null) { + if (input.substr(pos, 1) === ";") { + var result14 = ";"; + pos += 1; + } else { + var result14 = null; + if (reportMatchFailures) { + matchFailed("\";\""); + } + } + if (result14 !== null) { + var result15 = parse_w(); + if (result15 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, ro, type, name, gr, sr) { return { type: "attribute", extAttrs: extAttrs, idlType: type, name: name, readonly: (ro ? true : false), getraises: gr, setraises: sr }; })(pos0, result0[0], result0[2], result0[5], result0[7], result0[9], result0[11]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(ro, type, name, gr, sr) { return { type: "attribute", idlType: type, name: name, readonly: (ro ? true : false), getraises: gr, setraises: sr }; })(result1[0], result1[3], result1[5], result1[7], result1[9]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_GetRaises() { - var result0, result1, result2, result3, result4; - var pos0, pos1; + var cacheKey = 'GetRaises@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 9) === "getraises") { - result0 = "getraises"; + var result3 = "getraises"; pos += 9; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"getraises\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 40) { - result2 = "("; - pos++; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "(") { + var result5 = "("; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result2 !== null) { - result3 = parse_ScopedNameList(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; + if (result5 !== null) { + var result6 = parse_ScopedNameList(); + if (result6 !== null) { + if (input.substr(pos, 1) === ")") { + var result7 = ")"; + pos += 1; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; + if (result7 !== null) { + var result1 = [result3, result4, result5, result6, result7]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, list) { return list; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(list) { return list; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_SetRaises() { - var result0, result1, result2, result3, result4; - var pos0, pos1; + var cacheKey = 'SetRaises@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 9) === "setraises") { - result0 = "setraises"; + var result3 = "setraises"; pos += 9; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"setraises\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 40) { - result2 = "("; - pos++; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "(") { + var result5 = "("; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result2 !== null) { - result3 = parse_ScopedNameList(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; + if (result5 !== null) { + var result6 = parse_ScopedNameList(); + if (result6 !== null) { + if (input.substr(pos, 1) === ")") { + var result7 = ")"; + pos += 1; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; + if (result7 !== null) { + var result1 = [result3, result4, result5, result6, result7]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, list) { return list; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(list) { return list; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Operation() { - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_Qualifiers(); - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_OperationRest(); - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + var cacheKey = 'Operation@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_Qualifiers(); + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_OperationRest(); + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, quals, rest) { - for (var k in quals) rest[k] = quals[k]; - if (extAttrs) rest.extAttrs = extAttrs; - return rest; - })(pos0, result0[0], result0[2], result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(quals, rest) { + for (var k in quals) rest[k] = quals[k]; + return rest; + })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Qualifiers() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'Qualifiers@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { if (input.substr(pos, 6) === "static") { - result1 = "static"; + var result7 = "static"; pos += 6; } else { - result1 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"static\""); } } - if (result1 === null) { - result1 = []; - result2 = parse_Special(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_Special(); + if (result7 !== null) { + var result4 = result7; + } else { + var result5 = []; + var result6 = parse_Special(); + while (result6 !== null) { + result5.push(result6); + var result6 = parse_Special(); } + if (result5 !== null) { + var result4 = result5; + } else { + var result4 = null;; + }; } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, quals) { if (typeof quals == "string") return [quals]; - return quals; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(quals) { if (typeof quals == "string") return [quals]; + return quals; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Special() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'Special@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { if (input.substr(pos, 6) === "getter") { - result1 = "getter"; + var result10 = "getter"; pos += 6; } else { - result1 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("\"getter\""); } } - if (result1 === null) { + if (result10 !== null) { + var result4 = result10; + } else { if (input.substr(pos, 6) === "setter") { - result1 = "setter"; + var result9 = "setter"; pos += 6; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"setter\""); } } - if (result1 === null) { + if (result9 !== null) { + var result4 = result9; + } else { if (input.substr(pos, 7) === "creator") { - result1 = "creator"; + var result8 = "creator"; pos += 7; } else { - result1 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"creator\""); } } - if (result1 === null) { + if (result8 !== null) { + var result4 = result8; + } else { if (input.substr(pos, 7) === "deleter") { - result1 = "deleter"; + var result7 = "deleter"; pos += 7; } else { - result1 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"deleter\""); } } - if (result1 === null) { + if (result7 !== null) { + var result4 = result7; + } else { if (input.substr(pos, 12) === "legacycaller") { - result1 = "legacycaller"; + var result6 = "legacycaller"; pos += 12; } else { - result1 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\"legacycaller\""); } } - } - } - } - } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result6 !== null) { + var result4 = result6; + } else { + var result4 = null;; + }; + }; + }; + }; + } + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, spe) { return spe; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(spe) { return spe; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_OperationRest() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_ReturnType(); - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - result2 = parse_identifier(); - result2 = result2 !== null ? result2 : ""; - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 40) { - result4 = "("; - pos++; + var cacheKey = 'OperationRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_ReturnType(); + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var result19 = parse_identifier(); + var result5 = result19 !== null ? result19 : ''; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + if (input.substr(pos, 1) === "(") { + var result7 = "("; + pos += 1; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - result6 = parse_Arguments(); - result6 = result6 !== null ? result6 : ""; - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 41) { - result8 = ")"; - pos++; + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + var result18 = parse_Arguments(); + var result9 = result18 !== null ? result18 : ''; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === ")") { + var result11 = ")"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = parse_Raises(); - result10 = result10 !== null ? result10 : ""; - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result17 = parse_Raises(); + var result13 = result17 !== null ? result17 : ''; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, ret, name, args, exc) { return { type: "operation", idlType: ret, name: name, arguments: (args ? args : []), raises: exc }; })(pos0, result0[0], result0[2], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(ret, name, args, exc) { return { type: "operation", idlType: ret, name: name, arguments: (args ? args : []), raises: exc }; })(result1[0], result1[2], result1[6], result1[10]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Arguments() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_Argument(); - if (result0 !== null) { - result1 = []; - result2 = parse_ArgumentsRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_ArgumentsRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'Arguments@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_Argument(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_ArgumentsRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_ArgumentsRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, others) { var ret = [first]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, others) { var ret = [first]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ArgumentsRest() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 44) { - result1 = ","; - pos++; + var cacheKey = 'ArgumentsRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === ",") { + var result4 = ","; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\",\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_Argument(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_Argument(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Argument() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { + var cacheKey = 'Argument@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result16 = parse_extendedAttributeList(); + var result3 = result16 !== null ? result16 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 2) === "in") { - result2 = "in"; + var result15 = "in"; pos += 2; } else { - result2 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\"in\""); } } - result2 = result2 !== null ? result2 : ""; - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { + var result5 = result15 !== null ? result15 : ''; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { if (input.substr(pos, 8) === "optional") { - result4 = "optional"; + var result14 = "optional"; pos += 8; } else { - result4 = null; - if (reportFailures === 0) { + var result14 = null; + if (reportMatchFailures) { matchFailed("\"optional\""); } } - result4 = result4 !== null ? result4 : ""; - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - result6 = parse_type(); - if (result6 !== null) { + var result7 = result14 !== null ? result14 : ''; + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + var result9 = parse_type(); + if (result9 !== null) { if (input.substr(pos, 3) === "...") { - result7 = "..."; + var result13 = "..."; pos += 3; } else { - result7 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"...\""); } } - result7 = result7 !== null ? result7 : ""; - if (result7 !== null) { - result8 = parse_s(); - if (result8 !== null) { - result9 = parse_identifier(); - if (result9 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9]; + var result10 = result13 !== null ? result13 : ''; + if (result10 !== null) { + var result11 = parse_s(); + if (result11 !== null) { + var result12 = parse_identifier(); + if (result12 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, opt, type, ell, name) { return { name: name, type: type, variadic: (ell ? true : false), optional: (opt ? true : false), extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[6], result0[7], result0[9]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, opt, type, ell, name) { return { name: name, type: type, variadic: (ell ? true : false), optional: (opt ? true : false), extAttrs: extAttrs }; })(result1[0], result1[4], result1[6], result1[7], result1[9]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Raises() { - var result0, result1, result2, result3, result4, result5, result6; - var pos0, pos1; + var cacheKey = 'Raises@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 6) === "raises") { - result0 = "raises"; + var result3 = "raises"; pos += 6; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"raises\""); } } - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 40) { - result2 = "("; - pos++; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + if (input.substr(pos, 1) === "(") { + var result5 = "("; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_ScopedNameList(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 41) { - result6 = ")"; - pos++; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result7 = parse_ScopedNameList(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === ")") { + var result9 = ")"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result6 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6]; + if (result9 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, list) { return list; })(pos0, result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(list) { return list; })(result1[4]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_dictionary() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; + var cacheKey = 'dictionary@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 10) === "dictionary") { - result0 = "dictionary"; + var result3 = "dictionary"; pos += 10; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"dictionary\""); } } - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - result2 = parse_identifier(); - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_ifInheritance(); - result4 = result4 !== null ? result4 : ""; - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 123) { - result6 = "{"; - pos++; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var result5 = parse_identifier(); + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result18 = parse_ifInheritance(); + var result7 = result18 !== null ? result18 : ''; + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "{") { + var result9 = "{"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = []; - result9 = parse_dictionaryMember(); - while (result9 !== null) { - result8.push(result9); - result9 = parse_dictionaryMember(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = []; + var result17 = parse_dictionaryMember(); + while (result17 !== null) { + result11.push(result17); + var result17 = parse_dictionaryMember(); } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 125) { - result10 = "}"; - pos++; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === "}") { + var result13 = "}"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, superclass, members) { - return { - type: "dictionary", - name: name, - inheritance: superclass, - members: members - }; - })(pos0, result0[2], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, superclass, members) { + return { + type: "dictionary", + name: name, + inheritance: superclass, + members: members + }; + })(result1[2], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_dictionaryMember() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_type(); - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - result6 = parse_defaultValue(); - result6 = result6 !== null ? result6 : ""; - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 59) { - result8 = ";"; - pos++; + var cacheKey = 'dictionaryMember@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result14 = parse_extendedAttributeList(); + var result3 = result14 !== null ? result14 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_type(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + var result13 = parse_defaultValue(); + var result9 = result13 !== null ? result13 : ''; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === ";") { + var result11 = ";"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9]; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, type, name, defaultValue) { - return { - type: type, - name: name, - defaultValue: defaultValue - }; - })(pos0, result0[0], result0[2], result0[4], result0[6]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, type, name, defaultValue) { + return { + type: type, + name: name, + defaultValue: defaultValue + }; + })(result1[0], result1[2], result1[4], result1[6]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_defaultValue() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'defaultValue@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 61) { - result0 = "="; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "=") { + var result3 = "="; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"=\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_constExpr(); - if (result2 === null) { - result2 = parse_string(); - } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_constExpr(); + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, value) { return value; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(value) { return value; })(result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_typedef() { - var result0, result1, result2, result3, result4, result5, result6, result7; - var pos0, pos1; + var cacheKey = 'typedef@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 7) === "typedef") { - result0 = "typedef"; + var result3 = "typedef"; pos += 7; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"typedef\""); } } - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - result2 = parse_type(); - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 59) { - result6 = ";"; - pos++; - } else { - result6 = null; - if (reportFailures === 0) { - matchFailed("\";\""); - } - } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7]; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var result13 = parse_extendedAttributeList(); + var result5 = result13 !== null ? result13 : ''; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result7 = parse_type(); + if (result7 !== null) { + var result8 = parse_s(); + if (result8 !== null) { + var result9 = parse_identifier(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === ";") { + var result11 = ";"; + pos += 1; + } else { + var result11 = null; + if (reportMatchFailures) { + matchFailed("\";\""); + } + } + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12]; + } else { + var result1 = null; + pos = savedPos1; + } + } else { + var result1 = null; + pos = savedPos1; + } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type, name) { return { type: 'typedef', name: name, idlType: type }; })(pos0, result0[2], result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, type, name) { return { type: 'typedef', name: name, idlType: type, extAttrs: extAttrs }; })(result1[2], result1[4], result1[6]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_exception() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { + var cacheKey = 'exception@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result18 = parse_extendedAttributeList(); + var result3 = result18 !== null ? result18 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 9) === "exception") { - result2 = "exception"; + var result5 = "exception"; pos += 9; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"exception\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 123) { - result6 = "{"; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "{") { + var result9 = "{"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = []; - result9 = parse_exMember(); - while (result9 !== null) { - result8.push(result9); - result9 = parse_exMember(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = []; + var result17 = parse_exMember(); + while (result17 !== null) { + result11.push(result17); + var result17 = parse_exMember(); } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 125) { - result10 = "}"; - pos++; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === "}") { + var result13 = "}"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, mem) { return { type: 'exception', name: name, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, mem) { return { type: 'exception', name: name, members: mem, extAttrs: extAttrs }; })(result1[0], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_exMember() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_const(); - if (result0 === null) { - result0 = parse_field(); + var cacheKey = 'exMember@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 !== null) { - result0 = (function(offset, mem) { return mem; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result4 = parse_const(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_field(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + } + var result2 = result1 !== null + ? (function(mem) { return mem; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_field() { - var result0, result1, result2, result3, result4, result5, result6, result7; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { - result2 = parse_type(); - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 59) { - result6 = ";"; - pos++; + var cacheKey = 'field@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result11 = parse_extendedAttributeList(); + var result3 = result11 !== null ? result11 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_type(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === ";") { + var result9 = ";"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7]; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, type, name) { return { type: "field", extAttrs: extAttrs, idlType: type, name: name }; })(pos0, result0[0], result0[2], result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, type, name) { return { type: "field", extAttrs: extAttrs, idlType: type, name: name }; })(result1[0], result1[2], result1[4]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_extendedAttributeList() { - var result0, result1, result2, result3, result4, result5, result6; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 91) { - result1 = "["; - pos++; + var cacheKey = 'extendedAttributeList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === "[") { + var result4 = "["; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"[\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_ExtAttrs(); - if (result3 !== null) { - result4 = parse_w(); - if (result4 !== null) { - if (input.charCodeAt(pos) === 93) { - result5 = "]"; - pos++; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_ExtAttrs(); + if (result6 !== null) { + var result7 = parse_w(); + if (result7 !== null) { + if (input.substr(pos, 1) === "]") { + var result8 = "]"; + pos += 1; } else { - result5 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"]\""); } } - if (result5 !== null) { - result6 = parse_w(); - if (result6 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6]; + if (result8 !== null) { + var result9 = parse_w(); + if (result9 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, ea) { return ea; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(ea) { return ea; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttrs() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_ExtAttr(); - if (result0 !== null) { - result1 = []; - result2 = parse_ExtAttrsRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_ExtAttrsRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'ExtAttrs@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_ExtAttr(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_ExtAttrsRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_ExtAttrsRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, others) { var ret = [first]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, others) { var ret = [first]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttrsRest() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 44) { - result1 = ","; - pos++; + var cacheKey = 'ExtAttrsRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === ",") { + var result4 = ","; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\",\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_ExtAttr(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_ExtAttr(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttr() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_ExtAttrArgList(); - if (result0 === null) { - result0 = parse_ExtAttrNamedArgList(); - if (result0 === null) { - result0 = parse_ExtAttrNameValue(); - if (result0 === null) { - result0 = parse_ExtAttrNoArg(); - } - } - } - if (result0 !== null) { - result0 = (function(offset, ea) { return ea; })(pos0, result0); + var cacheKey = 'ExtAttr@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; - } - return result0; - } - - function parse_ExtAttrNoArg() { - var result0; - var pos0; - pos0 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result0 = (function(offset, name) {return { name: name }; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; - } - return result0; - } - - function parse_ExtAttrNameValue() { - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 61) { - result2 = "="; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + var result10 = parse_extendedAttributeList(); + var result3 = result10 !== null ? result10 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result9 = parse_ExtAttrArgList(); + if (result9 !== null) { + var result5 = result9; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"=\""); - } - } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_ScopedName(); - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } + var result8 = parse_ExtAttrNamedArgList(); + if (result8 !== null) { + var result5 = result8; } else { - result0 = null; - pos = pos1; - } + var result7 = parse_ExtAttrNameValue(); + if (result7 !== null) { + var result5 = result7; + } else { + var result6 = parse_ExtAttrNoArg(); + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; + }; + }; + } + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, ea) { + if ( extAttrs ) { ea.extAttrs = extAttrs }; + return ea; + })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } - if (result0 !== null) { - result0 = (function(offset, name, value) {return { name: name, value: value }; })(pos0, result0[0], result0[4]); + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; + return result0; + } + + function parse_ExtAttrNoArg() { + var cacheKey = 'ExtAttrNoArg@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result1 = parse_identifier(); + var result2 = result1 !== null + ? (function(name) {return { name: name }; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } - function parse_ExtAttrNamedArgList() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 61) { - result2 = "="; - pos++; + function parse_ExtAttrNameValue() { + var cacheKey = 'ExtAttrNameValue@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_identifier(); + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "=") { + var result5 = "="; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"=\""); } } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 40) { - result6 = "("; - pos++; - } else { - result6 = null; - if (reportFailures === 0) { - matchFailed("\"(\""); - } - } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_Arguments(); - result8 = result8 !== null ? result8 : ""; - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 41) { - result10 = ")"; - pos++; - } else { - result10 = null; - if (reportFailures === 0) { - matchFailed("\")\""); - } - } - if (result10 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result9 = parse_ScopedName(); + if (result9 !== null) { + var result7 = result9; + } else { + var result8 = parse_string(); + if (result8 !== null) { + var result7 = result8; } else { - result0 = null; - pos = pos1; - } + var result7 = null;; + }; + } + if (result7 !== null) { + var result1 = [result3, result4, result5, result6, result7]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, value, args) {return { name: name, value: value, arguments: args }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, value) {return { name: name, value: value }; })(result1[0], result1[4]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttrNamedArgList() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 61) { - result2 = "="; - pos++; + var cacheKey = 'ExtAttrNamedArgList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_identifier(); + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "=") { + var result5 = "="; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"=\""); } } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 40) { - result6 = "("; - pos++; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "(") { + var result9 = "("; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_Arguments(); - result8 = result8 !== null ? result8 : ""; - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 41) { - result10 = ")"; - pos++; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result14 = parse_Arguments(); + var result11 = result14 !== null ? result14 : ''; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === ")") { + var result13 = ")"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result10 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10]; + if (result13 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, value, args) {return { name: name, value: value, arguments: args }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, value, args) {return { name: name, value: value, arguments: args }; })(result1[0], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttrArgList() { - var result0, result1, result2, result3, result4, result5, result6; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 40) { - result2 = "("; - pos++; + var cacheKey = 'ExtAttrArgList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_identifier(); + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "(") { + var result5 = "("; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_Arguments(); - result4 = result4 !== null ? result4 : ""; - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 41) { - result6 = ")"; - pos++; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result10 = parse_Arguments(); + var result7 = result10 !== null ? result10 : ''; + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === ")") { + var result9 = ")"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result6 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6]; + if (result9 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, args) {return { name: name, arguments: args }; })(pos0, result0[0], result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, args) {return { name: name, arguments: args }; })(result1[0], result1[4]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } - - function cleanupExpected(expected) { - expected.sort(); - - var lastExpected = null; - var cleanExpected = []; - for (var i = 0; i < expected.length; i++) { - if (expected[i] !== lastExpected) { - cleanExpected.push(expected[i]); - lastExpected = expected[i]; + function buildErrorMessage() { + function buildExpected(failuresExpected) { + failuresExpected.sort(); + + var lastFailure = null; + var failuresExpectedUnique = []; + for (var i = 0; i < failuresExpected.length; i++) { + if (failuresExpected[i] !== lastFailure) { + failuresExpectedUnique.push(failuresExpected[i]); + lastFailure = failuresExpected[i]; + } + } + + switch (failuresExpectedUnique.length) { + case 0: + return 'end of input'; + case 1: + return failuresExpectedUnique[0]; + default: + return failuresExpectedUnique.slice(0, failuresExpectedUnique.length - 1).join(', ') + + ' or ' + + failuresExpectedUnique[failuresExpectedUnique.length - 1]; } } - return cleanExpected; + + var expected = buildExpected(rightmostMatchFailuresExpected); + var actualPos = Math.max(pos, rightmostMatchFailuresPos); + var actual = actualPos < input.length + ? quote(input.charAt(actualPos)) + : 'end of input'; + + return 'Expected ' + expected + ' but ' + actual + ' found.'; } function computeErrorPosition() { @@ -5624,13 +6930,13 @@ exports.Parser = (function(){ var column = 1; var seenCR = false; - for (var i = 0; i < Math.max(pos, rightmostFailuresPos); i++) { + for (var i = 0; i < rightmostMatchFailuresPos; i++) { var ch = input.charAt(i); - if (ch === "\n") { + if (ch === '\n') { if (!seenCR) { line++; } column = 1; seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { + } else if (ch === '\r' | ch === '\u2028' || ch === '\u2029') { line++; column = 1; seenCR = true; @@ -5644,6 +6950,7 @@ exports.Parser = (function(){ } + var result = parseFunctions[startRule](); /* @@ -5653,32 +6960,27 @@ exports.Parser = (function(){ * * - |result !== null| * - |pos === input.length| - * - |rightmostFailuresExpected| may or may not contain something + * - |rightmostMatchFailuresExpected| may or may not contain something * * 2. The parser successfully parsed only a part of the input. * * - |result !== null| * - |pos < input.length| - * - |rightmostFailuresExpected| may or may not contain something + * - |rightmostMatchFailuresExpected| may or may not contain something * * 3. The parser did not successfully parse any part of the input. * * - |result === null| * - |pos === 0| - * - |rightmostFailuresExpected| contains at least one failure + * - |rightmostMatchFailuresExpected| contains at least one failure * * All code following this comment (including called functions) must * handle these states. */ if (result === null || pos !== input.length) { - var offset = Math.max(pos, rightmostFailuresPos); - var found = offset < input.length ? input.charAt(offset) : null; var errorPosition = computeErrorPosition(); - throw new this.SyntaxError( - cleanupExpected(rightmostFailuresExpected), - found, - offset, + buildErrorMessage(), errorPosition.line, errorPosition.column ); @@ -5693,33 +6995,9 @@ exports.Parser = (function(){ /* Thrown when a parser encounters a syntax error. */ - result.SyntaxError = function(expected, found, offset, line, column) { - function buildMessage(expected, found) { - var expectedHumanized, foundHumanized; - - switch (expected.length) { - case 0: - expectedHumanized = "end of input"; - break; - case 1: - expectedHumanized = expected[0]; - break; - default: - expectedHumanized = expected.slice(0, expected.length - 1).join(", ") - + " or " - + expected[expected.length - 1]; - } - - foundHumanized = found ? quote(found) : "end of input"; - - return "Expected " + expectedHumanized + " but " + foundHumanized + " found."; - } - - this.name = "SyntaxError"; - this.expected = expected; - this.found = found; - this.message = buildMessage(expected, found); - this.offset = offset; + result.SyntaxError = function(message, line, column) { + this.name = 'SyntaxError'; + this.message = message; this.line = line; this.column = column; }; @@ -5727,4 +7005,4 @@ exports.Parser = (function(){ result.SyntaxError.prototype = Error.prototype; return result; -})() \ No newline at end of file +})(); diff --git a/web/WebIDLParser.js b/web/WebIDLParser.js index 05ac733..c5e8270 100644 --- a/web/WebIDLParser.js +++ b/web/WebIDLParser.js @@ -1,32 +1,5 @@ window.WebIDLParser = (function(){ - /* - * Generated by PEG.js 0.7.0. - * - * http://pegjs.majda.cz/ - */ - - function quote(s) { - /* - * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a - * string literal except for the closing quote character, backslash, - * carriage return, line separator, paragraph separator, and line feed. - * Any character may appear in the form of an escape sequence. - * - * For portability, we also escape escape all control and non-ASCII - * characters. Note that "\0" and "\v" escape sequences are not used - * because JSHint does not like the first and IE the second. - */ - return '"' + s - .replace(/\\/g, '\\\\') // backslash - .replace(/"/g, '\\"') // closing quote character - .replace(/\x08/g, '\\b') // backspace - .replace(/\t/g, '\\t') // horizontal tab - .replace(/\n/g, '\\n') // line feed - .replace(/\f/g, '\\f') // form feed - .replace(/\r/g, '\\r') // carriage return - .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape) - + '"'; - } + /* Generated by PEG.js 0.6.2 (http://pegjs.majda.cz/). */ var result = { /* @@ -37,85 +10,84 @@ window.WebIDLParser = (function(){ */ parse: function(input, startRule) { var parseFunctions = { - "space": parse_space, - "s": parse_s, - "w": parse_w, - "identifier": parse_identifier, - "octal": parse_octal, - "hex": parse_hex, - "decimal": parse_decimal, - "integer": parse_integer, - "floatEe": parse_floatEe, - "expFloat": parse_expFloat, - "leadFloat": parse_leadFloat, - "dotFloat": parse_dotFloat, - "float": parse_float, - "string": parse_string, - "other": parse_other, - "type": parse_type, - "TypeDesc": parse_TypeDesc, - "Sequence": parse_Sequence, - "ArrayType": parse_ArrayType, - "UnionType": parse_UnionType, - "TypeList": parse_TypeList, - "TypeListRest": parse_TypeListRest, - "SimpleType": parse_SimpleType, - "PrimitiveType": parse_PrimitiveType, - "FloatType": parse_FloatType, - "UnsignedIntegerType": parse_UnsignedIntegerType, - "ScopedNameList": parse_ScopedNameList, - "ScopedNameListRest": parse_ScopedNameListRest, - "ScopedName": parse_ScopedName, "AbsoluteScopedName": parse_AbsoluteScopedName, - "RelativeScopedName": parse_RelativeScopedName, - "ScopedNameRest": parse_ScopedNameRest, + "Argument": parse_Argument, + "Arguments": parse_Arguments, + "ArgumentsRest": parse_ArgumentsRest, + "ArrayType": parse_ArrayType, + "Attribute": parse_Attribute, "BooleanLiteral": parse_BooleanLiteral, - "Nullable": parse_Nullable, - "ReturnType": parse_ReturnType, - "definitions": parse_definitions, - "definition": parse_definition, - "partialinterface": parse_partialinterface, - "callbackinterface": parse_callbackinterface, - "module": parse_module, - "implements": parse_implements, - "interface": parse_interface, - "enum": parse_enum, - "callback": parse_callback, "EnumValues": parse_EnumValues, "EnumValuesRest": parse_EnumValuesRest, - "ifInheritance": parse_ifInheritance, - "ifMember": parse_ifMember, - "const": parse_const, - "constExpr": parse_constExpr, - "attrOrOp": parse_attrOrOp, - "Stringifier": parse_Stringifier, - "Attribute": parse_Attribute, + "ExtAttr": parse_ExtAttr, + "ExtAttrArgList": parse_ExtAttrArgList, + "ExtAttrNameValue": parse_ExtAttrNameValue, + "ExtAttrNamedArgList": parse_ExtAttrNamedArgList, + "ExtAttrNoArg": parse_ExtAttrNoArg, + "ExtAttrs": parse_ExtAttrs, + "ExtAttrsRest": parse_ExtAttrsRest, + "FloatType": parse_FloatType, "GetRaises": parse_GetRaises, - "SetRaises": parse_SetRaises, + "Nullable": parse_Nullable, "Operation": parse_Operation, - "Qualifiers": parse_Qualifiers, - "Special": parse_Special, "OperationRest": parse_OperationRest, - "Arguments": parse_Arguments, - "ArgumentsRest": parse_ArgumentsRest, - "Argument": parse_Argument, + "PrimitiveType": parse_PrimitiveType, + "Qualifiers": parse_Qualifiers, "Raises": parse_Raises, + "RelativeScopedName": parse_RelativeScopedName, + "ReturnType": parse_ReturnType, + "ScopedName": parse_ScopedName, + "ScopedNameList": parse_ScopedNameList, + "ScopedNameListRest": parse_ScopedNameListRest, + "ScopedNameRest": parse_ScopedNameRest, + "Sequence": parse_Sequence, + "SetRaises": parse_SetRaises, + "SimpleType": parse_SimpleType, + "Special": parse_Special, + "Stringifier": parse_Stringifier, + "TypeDesc": parse_TypeDesc, + "TypeList": parse_TypeList, + "TypeListRest": parse_TypeListRest, + "UnionType": parse_UnionType, + "UnsignedIntegerType": parse_UnsignedIntegerType, + "attrOrOp": parse_attrOrOp, + "callback": parse_callback, + "callbackinterface": parse_callbackinterface, + "const": parse_const, + "constExpr": parse_constExpr, + "decimal": parse_decimal, + "defaultValue": parse_defaultValue, + "definition": parse_definition, + "definitions": parse_definitions, "dictionary": parse_dictionary, "dictionaryMember": parse_dictionaryMember, - "defaultValue": parse_defaultValue, - "typedef": parse_typedef, - "exception": parse_exception, + "dotFloat": parse_dotFloat, + "enum": parse_enum, "exMember": parse_exMember, - "field": parse_field, + "exception": parse_exception, + "expFloat": parse_expFloat, "extendedAttributeList": parse_extendedAttributeList, - "ExtAttrs": parse_ExtAttrs, - "ExtAttrsRest": parse_ExtAttrsRest, - "ExtAttr": parse_ExtAttr, - "ExtAttrNoArg": parse_ExtAttrNoArg, - "ExtAttrNameValue": parse_ExtAttrNameValue, - "ExtAttrNamedArgList": parse_ExtAttrNamedArgList, - "ExtAttrNamedArgList": parse_ExtAttrNamedArgList, - "ExtAttrArgList": parse_ExtAttrArgList + "field": parse_field, + "float": parse_float, + "floatEe": parse_floatEe, + "hex": parse_hex, + "identifier": parse_identifier, + "ifInheritance": parse_ifInheritance, + "ifMember": parse_ifMember, + "implements": parse_implements, + "integer": parse_integer, + "interface": parse_interface, + "leadFloat": parse_leadFloat, + "module": parse_module, + "octal": parse_octal, + "other": parse_other, + "partialinterface": parse_partialinterface, + "s": parse_s, + "space": parse_space, + "string": parse_string, + "type": parse_type, + "typedef": parse_typedef, + "w": parse_w }; if (startRule !== undefined) { @@ -127,9 +99,10 @@ window.WebIDLParser = (function(){ } var pos = 0; - var reportFailures = 0; - var rightmostFailuresPos = 0; - var rightmostFailuresExpected = []; + var reportMatchFailures = true; + var rightmostMatchFailuresPos = 0; + var rightmostMatchFailuresExpected = []; + var cache = {}; function padLeft(input, padding, length) { var result = input; @@ -144,5472 +117,6805 @@ window.WebIDLParser = (function(){ function escape(ch) { var charCode = ch.charCodeAt(0); - var escapeChar; - var length; if (charCode <= 0xFF) { - escapeChar = 'x'; - length = 2; + var escapeChar = 'x'; + var length = 2; } else { - escapeChar = 'u'; - length = 4; + var escapeChar = 'u'; + var length = 4; } return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length); } + function quote(s) { + /* + * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a + * string literal except for the closing quote character, backslash, + * carriage return, line separator, paragraph separator, and line feed. + * Any character may appear in the form of an escape sequence. + */ + return '"' + s + .replace(/\\/g, '\\\\') // backslash + .replace(/"/g, '\\"') // closing quote character + .replace(/\r/g, '\\r') // carriage return + .replace(/\n/g, '\\n') // line feed + .replace(/[\x80-\uFFFF]/g, escape) // non-ASCII characters + + '"'; + } + function matchFailed(failure) { - if (pos < rightmostFailuresPos) { + if (pos < rightmostMatchFailuresPos) { return; } - if (pos > rightmostFailuresPos) { - rightmostFailuresPos = pos; - rightmostFailuresExpected = []; + if (pos > rightmostMatchFailuresPos) { + rightmostMatchFailuresPos = pos; + rightmostMatchFailuresExpected = []; } - rightmostFailuresExpected.push(failure); + rightmostMatchFailuresExpected.push(failure); } function parse_space() { - var result0, result1, result2, result3; - var pos0, pos1, pos2; + var cacheKey = 'space@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - if (input.charCodeAt(pos) === 32) { - result0 = " "; - pos++; + + if (input.substr(pos, 1) === " ") { + var result20 = " "; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result20 = null; + if (reportMatchFailures) { matchFailed("\" \""); } } - if (result0 === null) { - if (input.charCodeAt(pos) === 9) { - result0 = "\t"; - pos++; + if (result20 !== null) { + var result0 = result20; + } else { + if (input.substr(pos, 1) === " ") { + var result19 = " "; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"\\t\""); + var result19 = null; + if (reportMatchFailures) { + matchFailed("\" \""); } } - if (result0 === null) { - if (input.charCodeAt(pos) === 13) { - result0 = "\r"; - pos++; + if (result19 !== null) { + var result0 = result19; + } else { + if (input.substr(pos, 1) === "\r") { + var result18 = "\r"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result18 = null; + if (reportMatchFailures) { matchFailed("\"\\r\""); } } - if (result0 === null) { - if (input.charCodeAt(pos) === 10) { - result0 = "\n"; - pos++; + if (result18 !== null) { + var result0 = result18; + } else { + if (input.substr(pos, 1) === "\n") { + var result17 = "\n"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\"\\n\""); } } - if (result0 === null) { - if (input.charCodeAt(pos) === 12) { - result0 = "\f"; - pos++; + if (result17 !== null) { + var result0 = result17; + } else { + if (input.substr(pos, 1) === " ") { + var result16 = " "; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { - matchFailed("\"\\f\""); + var result16 = null; + if (reportMatchFailures) { + matchFailed("\" \""); } } - if (result0 === null) { - pos0 = pos; + if (result16 !== null) { + var result0 = result16; + } else { + var savedPos3 = pos; if (input.substr(pos, 2) === "//") { - result0 = "//"; + var result12 = "//"; pos += 2; } else { - result0 = null; - if (reportFailures === 0) { + var result12 = null; + if (reportMatchFailures) { matchFailed("\"//\""); } } - if (result0 !== null) { - result1 = []; - if (/^[^\n]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result12 !== null) { + var result13 = []; + if (input.substr(pos).match(/^[^\n]/) !== null) { + var result15 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("[^\\n]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[^\n]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result15 !== null) { + result13.push(result15); + if (input.substr(pos).match(/^[^\n]/) !== null) { + var result15 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("[^\\n]"); } } } - if (result1 !== null) { - if (input.charCodeAt(pos) === 10) { - result2 = "\n"; - pos++; + if (result13 !== null) { + if (input.substr(pos, 1) === "\n") { + var result14 = "\n"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result14 = null; + if (reportMatchFailures) { matchFailed("\"\\n\""); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result14 !== null) { + var result11 = [result12, result13, result14]; } else { - result0 = null; - pos = pos0; + var result11 = null; + pos = savedPos3; } } else { - result0 = null; - pos = pos0; + var result11 = null; + pos = savedPos3; } } else { - result0 = null; - pos = pos0; + var result11 = null; + pos = savedPos3; } - if (result0 === null) { - pos0 = pos; + if (result11 !== null) { + var result0 = result11; + } else { + var savedPos0 = pos; if (input.substr(pos, 2) === "/*") { - result0 = "/*"; + var result2 = "/*"; pos += 2; } else { - result0 = null; - if (reportFailures === 0) { + var result2 = null; + if (reportMatchFailures) { matchFailed("\"/*\""); } } - if (result0 !== null) { - result1 = []; - if (/^[^*]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result2 !== null) { + var result3 = []; + if (input.substr(pos).match(/^[^*]/) !== null) { + var result10 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("[^*]"); } } - if (result2 === null) { - pos1 = pos; - if (input.charCodeAt(pos) === 42) { - result2 = "*"; - pos++; + if (result10 !== null) { + var result5 = result10; + } else { + var savedPos1 = pos; + if (input.substr(pos, 1) === "*") { + var result7 = "*"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"*\""); } } - if (result2 !== null) { - pos2 = pos; - reportFailures++; - if (input.charCodeAt(pos) === 47) { - result3 = "/"; - pos++; + if (result7 !== null) { + var savedPos2 = pos; + var savedReportMatchFailuresVar0 = reportMatchFailures; + reportMatchFailures = false; + if (input.substr(pos, 1) === "/") { + var result9 = "/"; + pos += 1; } else { - result3 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"/\""); } } - reportFailures--; - if (result3 === null) { - result3 = ""; + reportMatchFailures = savedReportMatchFailuresVar0; + if (result9 === null) { + var result8 = ''; } else { - result3 = null; - pos = pos2; + var result8 = null; + pos = savedPos2; } - if (result3 !== null) { - result2 = [result2, result3]; + if (result8 !== null) { + var result6 = [result7, result8]; } else { - result2 = null; - pos = pos1; + var result6 = null; + pos = savedPos1; } } else { - result2 = null; - pos = pos1; + var result6 = null; + pos = savedPos1; } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; } - while (result2 !== null) { - result1.push(result2); - if (/^[^*]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result5 !== null) { + result3.push(result5); + if (input.substr(pos).match(/^[^*]/) !== null) { + var result10 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("[^*]"); } } - if (result2 === null) { - pos1 = pos; - if (input.charCodeAt(pos) === 42) { - result2 = "*"; - pos++; + if (result10 !== null) { + var result5 = result10; + } else { + var savedPos1 = pos; + if (input.substr(pos, 1) === "*") { + var result7 = "*"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"*\""); } } - if (result2 !== null) { - pos2 = pos; - reportFailures++; - if (input.charCodeAt(pos) === 47) { - result3 = "/"; - pos++; + if (result7 !== null) { + var savedPos2 = pos; + var savedReportMatchFailuresVar0 = reportMatchFailures; + reportMatchFailures = false; + if (input.substr(pos, 1) === "/") { + var result9 = "/"; + pos += 1; } else { - result3 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"/\""); } } - reportFailures--; - if (result3 === null) { - result3 = ""; + reportMatchFailures = savedReportMatchFailuresVar0; + if (result9 === null) { + var result8 = ''; } else { - result3 = null; - pos = pos2; + var result8 = null; + pos = savedPos2; } - if (result3 !== null) { - result2 = [result2, result3]; + if (result8 !== null) { + var result6 = [result7, result8]; } else { - result2 = null; - pos = pos1; + var result6 = null; + pos = savedPos1; } } else { - result2 = null; - pos = pos1; + var result6 = null; + pos = savedPos1; } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; } } - if (result1 !== null) { + if (result3 !== null) { if (input.substr(pos, 2) === "*/") { - result2 = "*/"; + var result4 = "*/"; pos += 2; } else { - result2 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"*/\""); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result4 !== null) { + var result1 = [result2, result3, result4]; } else { - result0 = null; - pos = pos0; + var result1 = null; + pos = savedPos0; } } else { - result0 = null; - pos = pos0; + var result1 = null; + pos = savedPos0; } } else { - result0 = null; - pos = pos0; + var result1 = null; + pos = savedPos0; } - } - } - } - } - } + if (result1 !== null) { + var result0 = result1; + } else { + var result0 = null;; + }; + }; + }; + }; + }; + }; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_s() { - var result0, result1; + var cacheKey = 's@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - result1 = parse_space(); + var result1 = parse_space(); if (result1 !== null) { - result0 = []; + var result0 = []; while (result1 !== null) { result0.push(result1); - result1 = parse_space(); + var result1 = parse_space(); } } else { - result0 = null; + var result0 = null; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_w() { - var result0; + var cacheKey = 'w@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var result1 = parse_s(); + var result0 = result1 !== null ? result1 : ''; - result0 = parse_s(); - result0 = result0 !== null ? result0 : ""; + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_identifier() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'identifier@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - if (/^[A-Z_a-z]/.test(input.charAt(pos))) { - result0 = input.charAt(pos); + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[A-Z_a-z]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("[A-Z_a-z]"); } } - if (result0 !== null) { - result1 = []; - if (/^[0-9A-Z_a-z]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result3 !== null) { + var result4 = []; + if (input.substr(pos).match(/^[0-9A-Z_a-z]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9A-Z_a-z]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[0-9A-Z_a-z]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result5 !== null) { + result4.push(result5); + if (input.substr(pos).match(/^[0-9A-Z_a-z]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9A-Z_a-z]"); } } } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, nmstart, nmchars) { return nmstart + nmchars.join(""); })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(nmstart, nmchars) { return nmstart + nmchars.join(""); })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_octal() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'octal@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 48) { - result0 = "0"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "0") { + var result3 = "0"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"0\""); } } - if (result0 !== null) { - result1 = []; - if (/^[0-7]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result3 !== null) { + var result4 = []; + if (input.substr(pos).match(/^[0-7]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-7]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[0-7]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result5 !== null) { + result4.push(result5); + if (input.substr(pos).match(/^[0-7]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-7]"); } } } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, value) { return "0" + value.join(""); })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(value) { return "0" + value.join(""); })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_hex() { - var result0, result1, result2, result3; - var pos0, pos1; + var cacheKey = 'hex@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 48) { - result0 = "0"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "0") { + var result3 = "0"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"0\""); } } - if (result0 !== null) { - if (/^[Xx]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result3 !== null) { + if (input.substr(pos).match(/^[Xx]/) !== null) { + var result4 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("[Xx]"); } } - if (result1 !== null) { - if (/^[0-9A-Fa-f]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result4 !== null) { + if (input.substr(pos).match(/^[0-9A-Fa-f]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[0-9A-Fa-f]"); } } - if (result3 !== null) { - result2 = []; - while (result3 !== null) { - result2.push(result3); - if (/^[0-9A-Fa-f]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result6 !== null) { + var result5 = []; + while (result6 !== null) { + result5.push(result6); + if (input.substr(pos).match(/^[0-9A-Fa-f]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[0-9A-Fa-f]"); } } } } else { - result2 = null; + var result5 = null; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, x, value) { return "0" + x + value.join(""); })(pos0, result0[1], result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(x, value) { return "0" + x + value.join(""); })(result1[1], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_decimal() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'decimal@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (/^[0-9]/.test(input.charAt(pos))) { - result0 = input.charAt(pos); + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result0 !== null) { - result1 = []; - if (/^[0-9]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result3 !== null) { + var result4 = []; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[0-9]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result5 !== null) { + result4.push(result5); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, numStart, numRest) { return numStart + numRest.join(""); })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(numStart, numRest) { return numStart + numRest.join(""); })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_integer() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'integer@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 45) { - result0 = "-"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "-") { + var result8 = "-"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"-\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_hex(); - if (result1 === null) { - result1 = parse_octal(); - if (result1 === null) { - result1 = parse_decimal(); - } + var result3 = result8 !== null ? result8 : ''; + if (result3 !== null) { + var result7 = parse_hex(); + if (result7 !== null) { + var result4 = result7; + } else { + var result6 = parse_octal(); + if (result6 !== null) { + var result4 = result6; + } else { + var result5 = parse_decimal(); + if (result5 !== null) { + var result4 = result5; + } else { + var result4 = null;; + }; + }; } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, neg, num) { return neg + num; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(neg, num) { return neg + num; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_floatEe() { - var result0, result1, result2, result3; - var pos0, pos1; + var cacheKey = 'floatEe@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - if (/^[Ee]/.test(input.charAt(pos))) { - result0 = input.charAt(pos); + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[Ee]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("[Ee]"); } } - if (result0 !== null) { - if (/^[+\-]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result3 !== null) { + if (input.substr(pos).match(/^[+\-]/) !== null) { + var result7 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("[+\\-]"); } } - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + var result4 = result7 !== null ? result7 : ''; + if (result4 !== null) { + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result3 !== null) { - result2 = []; - while (result3 !== null) { - result2.push(result3); - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result6 !== null) { + var result5 = []; + while (result6 !== null) { + result5.push(result6); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } } else { - result2 = null; + var result5 = null; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, e, sign, exp) { return e + sign + exp.join(""); })(pos0, result0[0], result0[1], result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(e, sign, exp) { return e + sign + exp.join(""); })(result1[0], result1[1], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_expFloat() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'expFloat@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result1 !== null) { - result0 = []; - while (result1 !== null) { - result0.push(result1); - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result5 !== null) { + var result3 = []; + while (result5 !== null) { + result3.push(result5); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } } else { - result0 = null; + var result3 = null; } - if (result0 !== null) { - result1 = parse_floatEe(); - if (result1 !== null) { - result0 = [result0, result1]; + if (result3 !== null) { + var result4 = parse_floatEe(); + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, num, fee) { return num.join("") + fee; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(num, fee) { return num.join("") + fee; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_leadFloat() { - var result0, result1, result2, result3; - var pos0, pos1; + var cacheKey = 'leadFloat@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result9 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result1 !== null) { - result0 = []; - while (result1 !== null) { - result0.push(result1); - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result9 !== null) { + var result3 = []; + while (result9 !== null) { + result3.push(result9); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result9 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } } else { - result0 = null; + var result3 = null; } - if (result0 !== null) { - if (input.charCodeAt(pos) === 46) { - result1 = "."; - pos++; + if (result3 !== null) { + if (input.substr(pos, 1) === ".") { + var result4 = "."; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\".\""); } } - if (result1 !== null) { - result2 = []; - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result4 !== null) { + var result5 = []; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result8 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - while (result3 !== null) { - result2.push(result3); - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + while (result8 !== null) { + result5.push(result8); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result8 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } - if (result2 !== null) { - result3 = parse_floatEe(); - result3 = result3 !== null ? result3 : ""; - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result5 !== null) { + var result7 = parse_floatEe(); + var result6 = result7 !== null ? result7 : ''; + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(pos0, result0[0], result0[2], result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(result1[0], result1[2], result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_dotFloat() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = []; - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + var cacheKey = 'dotFloat@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = []; + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result9 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - while (result1 !== null) { - result0.push(result1); - if (/^[0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + while (result9 !== null) { + result3.push(result9); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result9 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } - if (result0 !== null) { - if (input.charCodeAt(pos) === 46) { - result1 = "."; - pos++; + if (result3 !== null) { + if (input.substr(pos, 1) === ".") { + var result4 = "."; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\".\""); } } - if (result1 !== null) { - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result4 !== null) { + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result8 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } - if (result3 !== null) { - result2 = []; - while (result3 !== null) { - result2.push(result3); - if (/^[0-9]/.test(input.charAt(pos))) { - result3 = input.charAt(pos); + if (result8 !== null) { + var result5 = []; + while (result8 !== null) { + result5.push(result8); + if (input.substr(pos).match(/^[0-9]/) !== null) { + var result8 = input.charAt(pos); pos++; } else { - result3 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("[0-9]"); } } } } else { - result2 = null; + var result5 = null; } - if (result2 !== null) { - result3 = parse_floatEe(); - result3 = result3 !== null ? result3 : ""; - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result5 !== null) { + var result7 = parse_floatEe(); + var result6 = result7 !== null ? result7 : ''; + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(pos0, result0[0], result0[2], result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(num, dec, fee) { return num.join("") + "." + dec.join("") + fee; })(result1[0], result1[2], result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_float() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'float@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 45) { - result0 = "-"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "-") { + var result9 = "-"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"-\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_leadFloat(); - if (result1 === null) { - result1 = parse_dotFloat(); - if (result1 === null) { - result1 = parse_expFloat(); - if (result1 === null) { + var result3 = result9 !== null ? result9 : ''; + if (result3 !== null) { + var result8 = parse_leadFloat(); + if (result8 !== null) { + var result4 = result8; + } else { + var result7 = parse_dotFloat(); + if (result7 !== null) { + var result4 = result7; + } else { + var result6 = parse_expFloat(); + if (result6 !== null) { + var result4 = result6; + } else { if (input.substr(pos, 8) === "Infinity") { - result1 = "Infinity"; + var result5 = "Infinity"; pos += 8; } else { - result1 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"Infinity\""); } } - } - } + if (result5 !== null) { + var result4 = result5; + } else { + var result4 = null;; + }; + }; + }; } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, neg, num) { return neg + num; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(neg, num) { return neg + num; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_string() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'string@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 34) { - result0 = "\""; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "\"") { + var result3 = "\""; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"\\\"\""); } } - if (result0 !== null) { - result1 = []; - if (/^[^""]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + if (result3 !== null) { + var result4 = []; + if (input.substr(pos).match(/^[^""]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[^\"\"]"); } } - while (result2 !== null) { - result1.push(result2); - if (/^[^""]/.test(input.charAt(pos))) { - result2 = input.charAt(pos); + while (result6 !== null) { + result4.push(result6); + if (input.substr(pos).match(/^[^""]/) !== null) { + var result6 = input.charAt(pos); pos++; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("[^\"\"]"); } } } - if (result1 !== null) { - if (input.charCodeAt(pos) === 34) { - result2 = "\""; - pos++; + if (result4 !== null) { + if (input.substr(pos, 1) === "\"") { + var result5 = "\""; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"\\\"\""); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, str) { return str.join(""); })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(str) { return str.join(""); })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_other() { - var result0, result1; - var pos0; + var cacheKey = 'other@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - if (/^[^\t\n\r 0-9A-Z_a-z]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + var savedPos0 = pos; + if (input.substr(pos).match(/^[^ \n\r 0-9A-Z_a-z]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("[^\\t\\n\\r 0-9A-Z_a-z]"); + var result3 = null; + if (reportMatchFailures) { + matchFailed("[^ \\n\\r 0-9A-Z_a-z]"); } } - if (result1 !== null) { - result0 = []; - while (result1 !== null) { - result0.push(result1); - if (/^[^\t\n\r 0-9A-Z_a-z]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result3 !== null) { + var result1 = []; + while (result3 !== null) { + result1.push(result3); + if (input.substr(pos).match(/^[^ \n\r 0-9A-Z_a-z]/) !== null) { + var result3 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { - matchFailed("[^\\t\\n\\r 0-9A-Z_a-z]"); + var result3 = null; + if (reportMatchFailures) { + matchFailed("[^ \\n\\r 0-9A-Z_a-z]"); } } } } else { - result0 = null; - } - if (result0 !== null) { - result0 = (function(offset, other) { return other.join(""); })(pos0, result0); + var result1 = null; } - if (result0 === null) { - pos = pos0; + var result2 = result1 !== null + ? (function(other) { return other.join(""); })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_type() { - var result0, result1; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_TypeDesc(); - if (result0 !== null) { - result1 = parse_Nullable(); - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'type@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_TypeDesc(); + if (result3 !== null) { + var result4 = parse_Nullable(); + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type, nullable) { - if (!type.sequence) type.sequence = false; - type.nullable = nullable; - return type; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type, nullable) { + if (!type.sequence) type.sequence = false; + type.nullable = nullable; + return type; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_TypeDesc() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_Sequence(); - if (result0 === null) { - result0 = parse_ArrayType(); - if (result0 === null) { - result0 = parse_SimpleType(); - if (result0 === null) { - result0 = parse_UnionType(); - } - } - } - if (result0 !== null) { - result0 = (function(offset, type) { return type; })(pos0, result0); + var cacheKey = 'TypeDesc@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result6 = parse_Sequence(); + if (result6 !== null) { + var result1 = result6; + } else { + var result5 = parse_ArrayType(); + if (result5 !== null) { + var result1 = result5; + } else { + var result4 = parse_SimpleType(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_UnionType(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + }; + } + var result2 = result1 !== null + ? (function(type) { return type; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Sequence() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'Sequence@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 9) === "sequence<") { - result0 = "sequence<"; + var result3 = "sequence<"; pos += 9; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"sequence<\""); } } - if (result0 !== null) { - result1 = parse_type(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 62) { - result2 = ">"; - pos++; + if (result3 !== null) { + var result4 = parse_type(); + if (result4 !== null) { + if (input.substr(pos, 1) === ">") { + var result5 = ">"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\">\""); } } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type) { return { sequence: true, array: false, idlType: type, members: [] }; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type) { return { sequence: true, array: false, idlType: type, members: [] }; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ArrayType() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'ArrayType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - result0 = parse_SimpleType(); - if (result0 !== null) { + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_SimpleType(); + if (result3 !== null) { if (input.substr(pos, 2) === "[]") { - result1 = "[]"; + var result4 = "[]"; pos += 2; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"[]\""); } } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type) { - type.array = true; - return type; - })(pos0, result0[0]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type) { + type.array = true; + return type; + })(result1[0]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_UnionType() { - var result0, result1, result2, result3, result4; - var pos0, pos1; + var cacheKey = 'UnionType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 40) { - result0 = "("; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "(") { + var result3 = "("; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_TypeList(); - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_TypeList(); + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + if (input.substr(pos, 1) === ")") { + var result7 = ")"; + pos += 1; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; + if (result7 !== null) { + var result1 = [result3, result4, result5, result6, result7]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, members) { return { idlType: "union", members: members, sequence: false, array: false }; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(members) { return { idlType: "union", members: members, sequence: false, array: false }; })(result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_TypeList() { - var result0, result1, result2, result3, result4, result5, result6; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_type(); - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { + var cacheKey = 'TypeList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_type(); + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { if (input.substr(pos, 2) === "or") { - result2 = "or"; + var result5 = "or"; pos += 2; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"or\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_type(); - if (result4 !== null) { - result5 = []; - result6 = parse_TypeListRest(); - while (result6 !== null) { - result5.push(result6); - result6 = parse_TypeListRest(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_type(); + if (result7 !== null) { + var result8 = []; + var result9 = parse_TypeListRest(); + while (result9 !== null) { + result8.push(result9); + var result9 = parse_TypeListRest(); } - if (result5 !== null) { - result0 = [result0, result1, result2, result3, result4, result5]; + if (result8 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, second, others) { var ret = [first, second]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[4], result0[5]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, second, others) { var ret = [first, second]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[4], result1[5]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_TypeListRest() { - var result0, result1, result2, result3; - var pos0, pos1; + var cacheKey = 'TypeListRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - result0 = parse_s(); - if (result0 !== null) { + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_s(); + if (result3 !== null) { if (input.substr(pos, 2) === "or") { - result1 = "or"; + var result4 = "or"; pos += 2; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"or\""); } } - if (result1 !== null) { - result2 = parse_s(); - if (result2 !== null) { - result3 = parse_type(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_s(); + if (result5 !== null) { + var result6 = parse_type(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_SimpleType() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_PrimitiveType(); - if (result0 === null) { - result0 = parse_UnsignedIntegerType(); - if (result0 === null) { - result0 = parse_FloatType(); - if (result0 === null) { - result0 = parse_ScopedName(); - } - } + var cacheKey = 'SimpleType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 !== null) { - result0 = (function(offset, type) { return { sequence: false, array: false, idlType: type, members: [] }; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result6 = parse_PrimitiveType(); + if (result6 !== null) { + var result1 = result6; + } else { + var result5 = parse_UnsignedIntegerType(); + if (result5 !== null) { + var result1 = result5; + } else { + var result4 = parse_FloatType(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_ScopedName(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + }; + } + var result2 = result1 !== null + ? (function(type) { return { sequence: false, array: false, idlType: type, members: [] }; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_PrimitiveType() { - var result0, result1; - var pos0, pos1, pos2; + var cacheKey = 'PrimitiveType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 3) === "any") { - result0 = "any"; + var result10 = "any"; pos += 3; } else { - result0 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("\"any\""); } } - if (result0 === null) { + if (result10 !== null) { + var result3 = result10; + } else { if (input.substr(pos, 6) === "object") { - result0 = "object"; + var result9 = "object"; pos += 6; } else { - result0 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"object\""); } } - if (result0 === null) { + if (result9 !== null) { + var result3 = result9; + } else { if (input.substr(pos, 7) === "boolean") { - result0 = "boolean"; + var result8 = "boolean"; pos += 7; } else { - result0 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"boolean\""); } } - if (result0 === null) { + if (result8 !== null) { + var result3 = result8; + } else { if (input.substr(pos, 5) === "octet") { - result0 = "octet"; + var result7 = "octet"; pos += 5; } else { - result0 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"octet\""); } } - if (result0 === null) { + if (result7 !== null) { + var result3 = result7; + } else { if (input.substr(pos, 9) === "DOMString") { - result0 = "DOMString"; + var result6 = "DOMString"; pos += 9; } else { - result0 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\"DOMString\""); } } - } - } - } - } - if (result0 !== null) { - pos2 = pos; - reportFailures++; - if (/^[A-Za-z0-9]/.test(input.charAt(pos))) { - result1 = input.charAt(pos); + if (result6 !== null) { + var result3 = result6; + } else { + var result3 = null;; + }; + }; + }; + }; + } + if (result3 !== null) { + var savedPos2 = pos; + var savedReportMatchFailuresVar0 = reportMatchFailures; + reportMatchFailures = false; + if (input.substr(pos).match(/^[A-Za-z0-9]/) !== null) { + var result5 = input.charAt(pos); pos++; } else { - result1 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("[A-Za-z0-9]"); } } - reportFailures--; - if (result1 === null) { - result1 = ""; + reportMatchFailures = savedReportMatchFailuresVar0; + if (result5 === null) { + var result4 = ''; } else { - result1 = null; - pos = pos2; + var result4 = null; + pos = savedPos2; } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type) { return type; })(pos0, result0[0]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type) { return type; })(result1[0]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_FloatType() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'FloatType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 12) === "unrestricted") { - result0 = "unrestricted"; + var result8 = "unrestricted"; pos += 12; } else { - result0 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"unrestricted\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { + var result3 = result8 !== null ? result8 : ''; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { if (input.substr(pos, 5) === "float") { - result2 = "float"; + var result7 = "float"; pos += 5; } else { - result2 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"float\""); } } - if (result2 === null) { + if (result7 !== null) { + var result5 = result7; + } else { if (input.substr(pos, 6) === "double") { - result2 = "double"; + var result6 = "double"; pos += 6; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\"double\""); } } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, unr, kind) { return (unr ? "unrestricted " : "") + (kind); })(pos0, result0[0], result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(unr, kind) { return (unr ? "unrestricted " : "") + (kind); })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_UnsignedIntegerType() { - var result0, result1, result2, result3, result4; - var pos0, pos1, pos2; + var cacheKey = 'UnsignedIntegerType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 8) === "unsigned") { - result0 = "unsigned"; + var result13 = "unsigned"; pos += 8; } else { - result0 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"unsigned\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - pos2 = pos; + var result3 = result13 !== null ? result13 : ''; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var savedPos2 = pos; if (input.substr(pos, 4) === "long") { - result2 = "long"; + var result10 = "long"; pos += 4; } else { - result2 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("\"long\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { + if (result10 !== null) { + var result11 = parse_s(); + if (result11 !== null) { if (input.substr(pos, 4) === "long") { - result4 = "long"; + var result12 = "long"; pos += 4; } else { - result4 = null; - if (reportFailures === 0) { + var result12 = null; + if (reportMatchFailures) { matchFailed("\"long\""); } } - if (result4 !== null) { - result2 = [result2, result3, result4]; + if (result12 !== null) { + var result9 = [result10, result11, result12]; } else { - result2 = null; - pos = pos2; + var result9 = null; + pos = savedPos2; } } else { - result2 = null; - pos = pos2; + var result9 = null; + pos = savedPos2; } } else { - result2 = null; - pos = pos2; + var result9 = null; + pos = savedPos2; } - if (result2 === null) { + if (result9 !== null) { + var result5 = result9; + } else { if (input.substr(pos, 4) === "long") { - result2 = "long"; + var result8 = "long"; pos += 4; } else { - result2 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"long\""); } } - if (result2 === null) { + if (result8 !== null) { + var result5 = result8; + } else { if (input.substr(pos, 5) === "short") { - result2 = "short"; + var result7 = "short"; pos += 5; } else { - result2 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"short\""); } } - if (result2 === null) { + if (result7 !== null) { + var result5 = result7; + } else { if (input.substr(pos, 4) === "byte") { - result2 = "byte"; + var result6 = "byte"; pos += 4; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\"byte\""); } } - } - } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; + }; + }; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, uns, kind) { return (uns ? "unsigned " : "") + (kind.join ? kind.join("") : kind); })(pos0, result0[0], result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(uns, kind) { return (uns ? "unsigned " : "") + (kind.join ? kind.join("") : kind); })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ScopedNameList() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_ScopedName(); - if (result0 !== null) { - result1 = []; - result2 = parse_ScopedNameListRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_ScopedNameListRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'ScopedNameList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_ScopedName(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_ScopedNameListRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_ScopedNameListRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, others) { var ret = [first]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, others) { var ret = [first]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ScopedNameListRest() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 44) { - result1 = ","; - pos++; + var cacheKey = 'ScopedNameListRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === ",") { + var result4 = ","; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\",\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_ScopedName(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_ScopedName(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ScopedName() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_AbsoluteScopedName(); - if (result0 === null) { - result0 = parse_RelativeScopedName(); - } - if (result0 !== null) { - result0 = (function(offset, name) { return name; })(pos0, result0); + var cacheKey = 'ScopedName@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result4 = parse_AbsoluteScopedName(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_RelativeScopedName(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + } + var result2 = result1 !== null + ? (function(name) { return name; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_AbsoluteScopedName() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'AbsoluteScopedName@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 2) === "::") { - result0 = "::"; + var result3 = "::"; pos += 2; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"::\""); } } - if (result0 !== null) { - result1 = parse_RelativeScopedName(); - if (result1 !== null) { - result0 = [result0, result1]; + if (result3 !== null) { + var result4 = parse_RelativeScopedName(); + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rel) { return "::" + rel; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rel) { return "::" + rel; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_RelativeScopedName() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = []; - result2 = parse_ScopedNameRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_ScopedNameRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'RelativeScopedName@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_identifier(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_ScopedNameRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_ScopedNameRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, rest) { return name + rest.join(""); })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, rest) { return name + rest.join(""); })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ScopedNameRest() { - var result0, result1; - var pos0, pos1; + var cacheKey = 'ScopedNameRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 2) === "::") { - result0 = "::"; + var result3 = "::"; pos += 2; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"::\""); } } - if (result0 !== null) { - result1 = parse_identifier(); - if (result1 !== null) { - result0 = [result0, result1]; + if (result3 !== null) { + var result4 = parse_identifier(); + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name) { return name.join(""); })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name) { return name.join(""); })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_BooleanLiteral() { - var result0; - var pos0; + var cacheKey = 'BooleanLiteral@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; + + var savedPos0 = pos; if (input.substr(pos, 4) === "true") { - result0 = "true"; + var result4 = "true"; pos += 4; } else { - result0 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"true\""); } } - if (result0 === null) { + if (result4 !== null) { + var result1 = result4; + } else { if (input.substr(pos, 5) === "false") { - result0 = "false"; + var result3 = "false"; pos += 5; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"false\""); } } + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + } + var result2 = result1 !== null + ? (function(value) { return value; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } - if (result0 !== null) { - result0 = (function(offset, value) { return value; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; - } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Nullable() { - var result0; - var pos0; + var cacheKey = 'Nullable@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - if (input.charCodeAt(pos) === 63) { - result0 = "?"; - pos++; + + var savedPos0 = pos; + if (input.substr(pos, 1) === "?") { + var result3 = "?"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"?\""); } } - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result0 = (function(offset, nullable) { return nullable ? true : false; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + var result1 = result3 !== null ? result3 : ''; + var result2 = result1 !== null + ? (function(nullable) { return nullable ? true : false; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ReturnType() { - var result0; - var pos0; + var cacheKey = 'ReturnType@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; + + var savedPos0 = pos; if (input.substr(pos, 4) === "void") { - result0 = "void"; + var result4 = "void"; pos += 4; } else { - result0 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"void\""); } } - if (result0 === null) { - result0 = parse_type(); - } - if (result0 !== null) { - result0 = (function(offset, ret) { return ret; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_type(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + } + var result2 = result1 !== null + ? (function(ret) { return ret; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_definitions() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - result1 = []; - result2 = parse_definition(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_definition(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'definitions@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_definition(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_definition(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, defs) { return defs; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(defs) { return defs; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_definition() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_partialinterface(); - if (result0 === null) { - result0 = parse_callbackinterface(); - if (result0 === null) { - result0 = parse_module(); - if (result0 === null) { - result0 = parse_interface(); - if (result0 === null) { - result0 = parse_dictionary(); - if (result0 === null) { - result0 = parse_typedef(); - if (result0 === null) { - result0 = parse_exception(); - if (result0 === null) { - result0 = parse_implements(); - if (result0 === null) { - result0 = parse_enum(); - if (result0 === null) { - result0 = parse_callback(); - } - } - } - } - } - } - } - } - } - if (result0 !== null) { - result0 = (function(offset, def) { return def; })(pos0, result0); + var cacheKey = 'definition@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result12 = parse_partialinterface(); + if (result12 !== null) { + var result1 = result12; + } else { + var result11 = parse_callbackinterface(); + if (result11 !== null) { + var result1 = result11; + } else { + var result10 = parse_module(); + if (result10 !== null) { + var result1 = result10; + } else { + var result9 = parse_interface(); + if (result9 !== null) { + var result1 = result9; + } else { + var result8 = parse_dictionary(); + if (result8 !== null) { + var result1 = result8; + } else { + var result7 = parse_typedef(); + if (result7 !== null) { + var result1 = result7; + } else { + var result6 = parse_exception(); + if (result6 !== null) { + var result1 = result6; + } else { + var result5 = parse_implements(); + if (result5 !== null) { + var result1 = result5; + } else { + var result4 = parse_enum(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_callback(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + }; + }; + }; + }; + }; + }; + }; + } + var result2 = result1 !== null + ? (function(def) { return def; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_partialinterface() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'partialinterface@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result20 = parse_extendedAttributeList(); + var result3 = result20 !== null ? result20 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 7) === "partial") { - result2 = "partial"; + var result5 = "partial"; pos += 7; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"partial\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { if (input.substr(pos, 9) === "interface") { - result4 = "interface"; + var result7 = "interface"; pos += 9; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"interface\""); } } - if (result4 !== null) { - result5 = parse_s(); - if (result5 !== null) { - result6 = parse_identifier(); - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 123) { - result8 = "{"; - pos++; + if (result7 !== null) { + var result8 = parse_s(); + if (result8 !== null) { + var result9 = parse_identifier(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === "{") { + var result11 = "{"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = []; - result11 = parse_ifMember(); - while (result11 !== null) { - result10.push(result11); - result11 = parse_ifMember(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result13 = []; + var result19 = parse_ifMember(); + while (result19 !== null) { + result13.push(result19); + var result19 = parse_ifMember(); } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 125) { - result12 = "}"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === "}") { + var result15 = "}"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - if (input.charCodeAt(pos) === 59) { - result14 = ";"; - pos++; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + if (input.substr(pos, 1) === ";") { + var result17 = ";"; + pos += 1; } else { - result14 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result14 !== null) { - result15 = parse_w(); - if (result15 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15]; + if (result17 !== null) { + var result18 = parse_w(); + if (result18 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17, result18]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, mem) { return { type: "partialinterface", name: name, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, mem) { return { type: "partialinterface", name: name, members: mem, extAttrs: extAttrs }; })(result1[0], result1[6], result1[10]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_callbackinterface() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'callbackinterface@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result20 = parse_extendedAttributeList(); + var result3 = result20 !== null ? result20 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 8) === "callback") { - result2 = "callback"; + var result5 = "callback"; pos += 8; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"callback\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { if (input.substr(pos, 9) === "interface") { - result4 = "interface"; + var result7 = "interface"; pos += 9; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"interface\""); } } - if (result4 !== null) { - result5 = parse_s(); - if (result5 !== null) { - result6 = parse_identifier(); - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 123) { - result8 = "{"; - pos++; + if (result7 !== null) { + var result8 = parse_s(); + if (result8 !== null) { + var result9 = parse_identifier(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === "{") { + var result11 = "{"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = []; - result11 = parse_ifMember(); - while (result11 !== null) { - result10.push(result11); - result11 = parse_ifMember(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result13 = []; + var result19 = parse_ifMember(); + while (result19 !== null) { + result13.push(result19); + var result19 = parse_ifMember(); } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 125) { - result12 = "}"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === "}") { + var result15 = "}"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - if (input.charCodeAt(pos) === 59) { - result14 = ";"; - pos++; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + if (input.substr(pos, 1) === ";") { + var result17 = ";"; + pos += 1; } else { - result14 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result14 !== null) { - result15 = parse_w(); - if (result15 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15]; + if (result17 !== null) { + var result18 = parse_w(); + if (result18 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17, result18]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, mem) { return { type: "callbackinterface", name: name, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, mem) { return { type: "callbackinterface", name: name, members: mem, extAttrs: extAttrs }; })(result1[0], result1[6], result1[10]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_module() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'module@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result17 = parse_extendedAttributeList(); + var result3 = result17 !== null ? result17 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 6) === "module") { - result2 = "module"; + var result5 = "module"; pos += 6; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"module\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 123) { - result6 = "{"; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "{") { + var result9 = "{"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_definitions(); - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 125) { - result10 = "}"; - pos++; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = parse_definitions(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === "}") { + var result13 = "}"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, defs) { return { type: "module", name: name, definitions: defs, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, defs) { return { type: "module", name: name, definitions: defs, extAttrs: extAttrs }; })(result1[0], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_implements() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { - result2 = parse_ScopedName(); - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { + var cacheKey = 'implements@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result13 = parse_extendedAttributeList(); + var result3 = result13 !== null ? result13 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_ScopedName(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { if (input.substr(pos, 10) === "implements") { - result4 = "implements"; + var result7 = "implements"; pos += 10; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"implements\""); } } - if (result4 !== null) { - result5 = parse_s(); - if (result5 !== null) { - result6 = parse_ScopedName(); - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 59) { - result8 = ";"; - pos++; + if (result7 !== null) { + var result8 = parse_s(); + if (result8 !== null) { + var result9 = parse_ScopedName(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === ";") { + var result11 = ";"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9]; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, target, impl) { return { type: 'implements', target: target, 'implements': impl, extAttrs: extAttrs }; })(pos0, result0[0], result0[2], result0[6]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, target, impl) { return { type: 'implements', target: target, 'implements': impl, extAttrs: extAttrs }; })(result1[0], result1[2], result1[6]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_interface() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'interface@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result21 = parse_extendedAttributeList(); + var result3 = result21 !== null ? result21 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 9) === "interface") { - result2 = "interface"; + var result5 = "interface"; pos += 9; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"interface\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - result6 = parse_ifInheritance(); - result6 = result6 !== null ? result6 : ""; - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 123) { - result8 = "{"; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + var result20 = parse_ifInheritance(); + var result9 = result20 !== null ? result20 : ''; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === "{") { + var result11 = "{"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = []; - result11 = parse_ifMember(); - while (result11 !== null) { - result10.push(result11); - result11 = parse_ifMember(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result13 = []; + var result19 = parse_ifMember(); + while (result19 !== null) { + result13.push(result19); + var result19 = parse_ifMember(); } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 125) { - result12 = "}"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === "}") { + var result15 = "}"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - if (input.charCodeAt(pos) === 59) { - result14 = ";"; - pos++; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + if (input.substr(pos, 1) === ";") { + var result17 = ";"; + pos += 1; } else { - result14 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result14 !== null) { - result15 = parse_w(); - if (result15 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15]; + if (result17 !== null) { + var result18 = parse_w(); + if (result18 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17, result18]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, herit, mem) { return { type: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, herit, mem) { return { type: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs }; })(result1[0], result1[4], result1[6], result1[10]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_enum() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'enum@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result17 = parse_extendedAttributeList(); + var result3 = result17 !== null ? result17 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 4) === "enum") { - result2 = "enum"; + var result5 = "enum"; pos += 4; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"enum\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 123) { - result6 = "{"; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "{") { + var result9 = "{"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_EnumValues(); - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 125) { - result10 = "}"; - pos++; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = parse_EnumValues(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === "}") { + var result13 = "}"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, values) { return { type: "enum", name: name, values: values, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, values) { return { type: "enum", name: name, values: values, extAttrs: extAttrs }; })(result1[0], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_callback() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { + var cacheKey = 'callback@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result21 = parse_extendedAttributeList(); + var result3 = result21 !== null ? result21 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 8) === "callback") { - result2 = "callback"; + var result5 = "callback"; pos += 8; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"callback\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 61) { - result6 = "="; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "=") { + var result9 = "="; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"=\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_ReturnType(); - if (result8 !== null) { - result9 = parse_s(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 40) { - result10 = "("; - pos++; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = parse_ReturnType(); + if (result11 !== null) { + var result12 = parse_s(); + if (result12 !== null) { + if (input.substr(pos, 1) === "(") { + var result13 = "("; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - result12 = parse_Arguments(); - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - if (input.charCodeAt(pos) === 41) { - result14 = ")"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + var result15 = parse_Arguments(); + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + if (input.substr(pos, 1) === ")") { + var result17 = ")"; + pos += 1; } else { - result14 = null; - if (reportFailures === 0) { + var result17 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result14 !== null) { - result15 = parse_w(); - if (result15 !== null) { - if (input.charCodeAt(pos) === 59) { - result16 = ";"; - pos++; + if (result17 !== null) { + var result18 = parse_w(); + if (result18 !== null) { + if (input.substr(pos, 1) === ";") { + var result19 = ";"; + pos += 1; } else { - result16 = null; - if (reportFailures === 0) { + var result19 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result16 !== null) { - result17 = parse_w(); - if (result17 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17]; + if (result19 !== null) { + var result20 = parse_w(); + if (result20 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16, result17, result18, result19, result20]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, ret, args) { return { type: "callback", idlType: ret, name: name, args: args, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8], result0[12]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, ret, args) { return { type: "callback", idlType: ret, name: name, args: args, extAttrs: extAttrs }; })(result1[0], result1[4], result1[8], result1[12]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_EnumValues() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_string(); - if (result0 !== null) { - result1 = []; - result2 = parse_EnumValuesRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_EnumValuesRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'EnumValues@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_string(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_EnumValuesRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_EnumValuesRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, others) { var ret = [first]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, others) { var ret = [first]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_EnumValuesRest() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 44) { - result1 = ","; - pos++; + var cacheKey = 'EnumValuesRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === ",") { + var result4 = ","; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\",\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_string(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_string(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ifInheritance() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'ifInheritance@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 58) { - result0 = ":"; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === ":") { + var result3 = ":"; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\":\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_ScopedNameList(); - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_ScopedNameList(); + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, herit) { return herit; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(herit) { return herit; })(result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ifMember() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_const(); - if (result0 === null) { - result0 = parse_attrOrOp(); + var cacheKey = 'ifMember@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 !== null) { - result0 = (function(offset, mem) { return mem; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var savedPos1 = pos; + var result8 = parse_extendedAttributeList(); + var result3 = result8 !== null ? result8 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result7 = parse_const(); + if (result7 !== null) { + var result5 = result7; + } else { + var result6 = parse_attrOrOp(); + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; + } + if (result5 !== null) { + var result1 = [result3, result4, result5]; + } else { + var result1 = null; + pos = savedPos1; + } + } else { + var result1 = null; + pos = savedPos1; + } + } else { + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, mem) { + if ( extAttrs ) { mem.extAttrs = extAttrs }; + return mem; + })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_const() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { - if (input.substr(pos, 5) === "const") { - result2 = "const"; - pos += 5; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"const\""); - } - } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_type(); - if (result4 !== null) { - result5 = parse_s(); - if (result5 !== null) { - result6 = parse_identifier(); - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 61) { - result8 = "="; - pos++; - } else { - result8 = null; - if (reportFailures === 0) { - matchFailed("\"=\""); - } - } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = parse_constExpr(); - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; - } else { - result12 = null; - if (reportFailures === 0) { - matchFailed("\";\""); - } - } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + var cacheKey = 'const@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 5) === "const") { + var result3 = "const"; + pos += 5; + } else { + var result3 = null; + if (reportMatchFailures) { + matchFailed("\"const\""); + } + } + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var result5 = parse_type(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "=") { + var result9 = "="; + pos += 1; + } else { + var result9 = null; + if (reportMatchFailures) { + matchFailed("\"=\""); + } + } + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = parse_constExpr(); + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === ";") { + var result13 = ";"; + pos += 1; + } else { + var result13 = null; + if (reportMatchFailures) { + matchFailed("\";\""); + } + } + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, type, name, value) { return { type: "const", extAttrs: extAttrs, idlType: type, name: name, value: value }; })(pos0, result0[0], result0[4], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(type, name, value) { return { type: "const", idlType: type, name: name, value: value }; })(result1[2], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_constExpr() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_BooleanLiteral(); - if (result0 === null) { - result0 = parse_float(); - if (result0 === null) { - result0 = parse_integer(); - if (result0 === null) { + var cacheKey = 'constExpr@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var result7 = parse_BooleanLiteral(); + if (result7 !== null) { + var result1 = result7; + } else { + var result6 = parse_float(); + if (result6 !== null) { + var result1 = result6; + } else { + var result5 = parse_integer(); + if (result5 !== null) { + var result1 = result5; + } else { if (input.substr(pos, 3) === "NaN") { - result0 = "NaN"; + var result4 = "NaN"; pos += 3; } else { - result0 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"NaN\""); } } - if (result0 === null) { + if (result4 !== null) { + var result1 = result4; + } else { if (input.substr(pos, 4) === "null") { - result0 = "null"; + var result3 = "null"; pos += 4; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"null\""); } } - } - } - } - } - if (result0 !== null) { - result0 = (function(offset, value) { return value; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + }; + }; + } + var result2 = result1 !== null + ? (function(value) { return value; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_attrOrOp() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_Stringifier(); - if (result0 === null) { - result0 = parse_Attribute(); - if (result0 === null) { - result0 = parse_Operation(); - } - } - if (result0 !== null) { - result0 = (function(offset, ao) { return ao; })(pos0, result0); + var cacheKey = 'attrOrOp@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result5 = parse_Stringifier(); + if (result5 !== null) { + var result1 = result5; + } else { + var result4 = parse_Attribute(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_Operation(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + }; + } + var result2 = result1 !== null + ? (function(ao) { return ao; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Stringifier() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'Stringifier@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 11) === "stringifier") { - result0 = "stringifier"; + var result3 = "stringifier"; pos += 11; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"stringifier\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_Attribute(); - if (result2 === null) { - result2 = parse_OperationRest(); - if (result2 === null) { - if (input.charCodeAt(pos) === 59) { - result2 = ";"; - pos++; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result8 = parse_Attribute(); + if (result8 !== null) { + var result5 = result8; + } else { + var result7 = parse_OperationRest(); + if (result7 !== null) { + var result5 = result7; + } else { + if (input.substr(pos, 1) === ";") { + var result6 = ";"; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - } + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; + }; } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { - if (rest === ";") return { type: "stringifier" }; - else { - rest.stringifier = true; - return rest; - } - })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { + if (rest === ";") return { type: "stringifier" }; + else { + rest.stringifier = true; + return rest; + } + })(result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Attribute() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14; - var pos0, pos1, pos2; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - pos2 = pos; - if (input.substr(pos, 8) === "readonly") { - result2 = "readonly"; - pos += 8; - } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"readonly\""); - } - } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result2 = [result2, result3]; - } else { - result2 = null; - pos = pos2; - } - } else { - result2 = null; - pos = pos2; + var cacheKey = 'Attribute@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var savedPos2 = pos; + if (input.substr(pos, 8) === "readonly") { + var result19 = "readonly"; + pos += 8; + } else { + var result19 = null; + if (reportMatchFailures) { + matchFailed("\"readonly\""); + } + } + if (result19 !== null) { + var result20 = parse_s(); + if (result20 !== null) { + var result18 = [result19, result20]; + } else { + var result18 = null; + pos = savedPos2; + } + } else { + var result18 = null; + pos = savedPos2; + } + var result3 = result18 !== null ? result18 : ''; + if (result3 !== null) { + if (input.substr(pos, 9) === "attribute") { + var result4 = "attribute"; + pos += 9; + } else { + var result4 = null; + if (reportMatchFailures) { + matchFailed("\"attribute\""); } - result2 = result2 !== null ? result2 : ""; - if (result2 !== null) { - if (input.substr(pos, 9) === "attribute") { - result3 = "attribute"; - pos += 9; - } else { - result3 = null; - if (reportFailures === 0) { - matchFailed("\"attribute\""); - } - } - if (result3 !== null) { - result4 = parse_s(); - if (result4 !== null) { - result5 = parse_type(); - if (result5 !== null) { - result6 = parse_s(); - if (result6 !== null) { - result7 = parse_identifier(); - if (result7 !== null) { - result8 = parse_w(); - if (result8 !== null) { - result9 = parse_GetRaises(); - result9 = result9 !== null ? result9 : ""; - if (result9 !== null) { - result10 = parse_w(); - if (result10 !== null) { - result11 = parse_SetRaises(); - result11 = result11 !== null ? result11 : ""; - if (result11 !== null) { - result12 = parse_w(); - if (result12 !== null) { - if (input.charCodeAt(pos) === 59) { - result13 = ";"; - pos++; - } else { - result13 = null; - if (reportFailures === 0) { - matchFailed("\";\""); - } - } - if (result13 !== null) { - result14 = parse_w(); - if (result14 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + } + if (result4 !== null) { + var result5 = parse_s(); + if (result5 !== null) { + var result6 = parse_type(); + if (result6 !== null) { + var result7 = parse_s(); + if (result7 !== null) { + var result8 = parse_identifier(); + if (result8 !== null) { + var result9 = parse_w(); + if (result9 !== null) { + var result17 = parse_GetRaises(); + var result10 = result17 !== null ? result17 : ''; + if (result10 !== null) { + var result11 = parse_w(); + if (result11 !== null) { + var result16 = parse_SetRaises(); + var result12 = result16 !== null ? result16 : ''; + if (result12 !== null) { + var result13 = parse_w(); + if (result13 !== null) { + if (input.substr(pos, 1) === ";") { + var result14 = ";"; + pos += 1; + } else { + var result14 = null; + if (reportMatchFailures) { + matchFailed("\";\""); + } + } + if (result14 !== null) { + var result15 = parse_w(); + if (result15 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, ro, type, name, gr, sr) { return { type: "attribute", extAttrs: extAttrs, idlType: type, name: name, readonly: (ro ? true : false), getraises: gr, setraises: sr }; })(pos0, result0[0], result0[2], result0[5], result0[7], result0[9], result0[11]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(ro, type, name, gr, sr) { return { type: "attribute", idlType: type, name: name, readonly: (ro ? true : false), getraises: gr, setraises: sr }; })(result1[0], result1[3], result1[5], result1[7], result1[9]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_GetRaises() { - var result0, result1, result2, result3, result4; - var pos0, pos1; + var cacheKey = 'GetRaises@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; + + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 9) === "getraises") { - result0 = "getraises"; + var result3 = "getraises"; pos += 9; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"getraises\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 40) { - result2 = "("; - pos++; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "(") { + var result5 = "("; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result2 !== null) { - result3 = parse_ScopedNameList(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; + if (result5 !== null) { + var result6 = parse_ScopedNameList(); + if (result6 !== null) { + if (input.substr(pos, 1) === ")") { + var result7 = ")"; + pos += 1; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; + if (result7 !== null) { + var result1 = [result3, result4, result5, result6, result7]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, list) { return list; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(list) { return list; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_SetRaises() { - var result0, result1, result2, result3, result4; - var pos0, pos1; + var cacheKey = 'SetRaises@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 9) === "setraises") { - result0 = "setraises"; + var result3 = "setraises"; pos += 9; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"setraises\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 40) { - result2 = "("; - pos++; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "(") { + var result5 = "("; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result2 !== null) { - result3 = parse_ScopedNameList(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 41) { - result4 = ")"; - pos++; + if (result5 !== null) { + var result6 = parse_ScopedNameList(); + if (result6 !== null) { + if (input.substr(pos, 1) === ")") { + var result7 = ")"; + pos += 1; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; + if (result7 !== null) { + var result1 = [result3, result4, result5, result6, result7]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, list) { return list; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(list) { return list; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Operation() { - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_Qualifiers(); - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_OperationRest(); - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + var cacheKey = 'Operation@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_Qualifiers(); + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_OperationRest(); + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, quals, rest) { - for (var k in quals) rest[k] = quals[k]; - if (extAttrs) rest.extAttrs = extAttrs; - return rest; - })(pos0, result0[0], result0[2], result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(quals, rest) { + for (var k in quals) rest[k] = quals[k]; + return rest; + })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Qualifiers() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'Qualifiers@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { if (input.substr(pos, 6) === "static") { - result1 = "static"; + var result7 = "static"; pos += 6; } else { - result1 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"static\""); } } - if (result1 === null) { - result1 = []; - result2 = parse_Special(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_Special(); + if (result7 !== null) { + var result4 = result7; + } else { + var result5 = []; + var result6 = parse_Special(); + while (result6 !== null) { + result5.push(result6); + var result6 = parse_Special(); } + if (result5 !== null) { + var result4 = result5; + } else { + var result4 = null;; + }; } - if (result1 !== null) { - result0 = [result0, result1]; + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, quals) { if (typeof quals == "string") return [quals]; - return quals; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(quals) { if (typeof quals == "string") return [quals]; + return quals; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Special() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'Special@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { if (input.substr(pos, 6) === "getter") { - result1 = "getter"; + var result10 = "getter"; pos += 6; } else { - result1 = null; - if (reportFailures === 0) { + var result10 = null; + if (reportMatchFailures) { matchFailed("\"getter\""); } } - if (result1 === null) { + if (result10 !== null) { + var result4 = result10; + } else { if (input.substr(pos, 6) === "setter") { - result1 = "setter"; + var result9 = "setter"; pos += 6; } else { - result1 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"setter\""); } } - if (result1 === null) { + if (result9 !== null) { + var result4 = result9; + } else { if (input.substr(pos, 7) === "creator") { - result1 = "creator"; + var result8 = "creator"; pos += 7; } else { - result1 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"creator\""); } } - if (result1 === null) { + if (result8 !== null) { + var result4 = result8; + } else { if (input.substr(pos, 7) === "deleter") { - result1 = "deleter"; + var result7 = "deleter"; pos += 7; } else { - result1 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"deleter\""); } } - if (result1 === null) { + if (result7 !== null) { + var result4 = result7; + } else { if (input.substr(pos, 12) === "legacycaller") { - result1 = "legacycaller"; + var result6 = "legacycaller"; pos += 12; } else { - result1 = null; - if (reportFailures === 0) { + var result6 = null; + if (reportMatchFailures) { matchFailed("\"legacycaller\""); } } - } - } - } - } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result6 !== null) { + var result4 = result6; + } else { + var result4 = null;; + }; + }; + }; + }; + } + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, spe) { return spe; })(pos0, result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(spe) { return spe; })(result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_OperationRest() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_ReturnType(); - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - result2 = parse_identifier(); - result2 = result2 !== null ? result2 : ""; - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - if (input.charCodeAt(pos) === 40) { - result4 = "("; - pos++; + var cacheKey = 'OperationRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_ReturnType(); + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var result19 = parse_identifier(); + var result5 = result19 !== null ? result19 : ''; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + if (input.substr(pos, 1) === "(") { + var result7 = "("; + pos += 1; } else { - result4 = null; - if (reportFailures === 0) { + var result7 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - result6 = parse_Arguments(); - result6 = result6 !== null ? result6 : ""; - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 41) { - result8 = ")"; - pos++; + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + var result18 = parse_Arguments(); + var result9 = result18 !== null ? result18 : ''; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === ")") { + var result11 = ")"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result10 = parse_Raises(); - result10 = result10 !== null ? result10 : ""; - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result17 = parse_Raises(); + var result13 = result17 !== null ? result17 : ''; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, ret, name, args, exc) { return { type: "operation", idlType: ret, name: name, arguments: (args ? args : []), raises: exc }; })(pos0, result0[0], result0[2], result0[6], result0[10]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(ret, name, args, exc) { return { type: "operation", idlType: ret, name: name, arguments: (args ? args : []), raises: exc }; })(result1[0], result1[2], result1[6], result1[10]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Arguments() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_Argument(); - if (result0 !== null) { - result1 = []; - result2 = parse_ArgumentsRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_ArgumentsRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'Arguments@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_Argument(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_ArgumentsRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_ArgumentsRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, others) { var ret = [first]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, others) { var ret = [first]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ArgumentsRest() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 44) { - result1 = ","; - pos++; + var cacheKey = 'ArgumentsRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === ",") { + var result4 = ","; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\",\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_Argument(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_Argument(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Argument() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { + var cacheKey = 'Argument@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result16 = parse_extendedAttributeList(); + var result3 = result16 !== null ? result16 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 2) === "in") { - result2 = "in"; + var result15 = "in"; pos += 2; } else { - result2 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\"in\""); } } - result2 = result2 !== null ? result2 : ""; - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { + var result5 = result15 !== null ? result15 : ''; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { if (input.substr(pos, 8) === "optional") { - result4 = "optional"; + var result14 = "optional"; pos += 8; } else { - result4 = null; - if (reportFailures === 0) { + var result14 = null; + if (reportMatchFailures) { matchFailed("\"optional\""); } } - result4 = result4 !== null ? result4 : ""; - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - result6 = parse_type(); - if (result6 !== null) { + var result7 = result14 !== null ? result14 : ''; + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + var result9 = parse_type(); + if (result9 !== null) { if (input.substr(pos, 3) === "...") { - result7 = "..."; + var result13 = "..."; pos += 3; } else { - result7 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"...\""); } } - result7 = result7 !== null ? result7 : ""; - if (result7 !== null) { - result8 = parse_s(); - if (result8 !== null) { - result9 = parse_identifier(); - if (result9 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9]; + var result10 = result13 !== null ? result13 : ''; + if (result10 !== null) { + var result11 = parse_s(); + if (result11 !== null) { + var result12 = parse_identifier(); + if (result12 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, opt, type, ell, name) { return { name: name, type: type, variadic: (ell ? true : false), optional: (opt ? true : false), extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[6], result0[7], result0[9]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, opt, type, ell, name) { return { name: name, type: type, variadic: (ell ? true : false), optional: (opt ? true : false), extAttrs: extAttrs }; })(result1[0], result1[4], result1[6], result1[7], result1[9]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_Raises() { - var result0, result1, result2, result3, result4, result5, result6; - var pos0, pos1; + var cacheKey = 'Raises@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 6) === "raises") { - result0 = "raises"; + var result3 = "raises"; pos += 6; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"raises\""); } } - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 40) { - result2 = "("; - pos++; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + if (input.substr(pos, 1) === "(") { + var result5 = "("; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_ScopedNameList(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 41) { - result6 = ")"; - pos++; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result7 = parse_ScopedNameList(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === ")") { + var result9 = ")"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result6 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6]; + if (result9 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, list) { return list; })(pos0, result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(list) { return list; })(result1[4]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_dictionary() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; + var cacheKey = 'dictionary@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 10) === "dictionary") { - result0 = "dictionary"; + var result3 = "dictionary"; pos += 10; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"dictionary\""); } } - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - result2 = parse_identifier(); - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_ifInheritance(); - result4 = result4 !== null ? result4 : ""; - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 123) { - result6 = "{"; - pos++; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var result5 = parse_identifier(); + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result18 = parse_ifInheritance(); + var result7 = result18 !== null ? result18 : ''; + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "{") { + var result9 = "{"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = []; - result9 = parse_dictionaryMember(); - while (result9 !== null) { - result8.push(result9); - result9 = parse_dictionaryMember(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = []; + var result17 = parse_dictionaryMember(); + while (result17 !== null) { + result11.push(result17); + var result17 = parse_dictionaryMember(); } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 125) { - result10 = "}"; - pos++; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === "}") { + var result13 = "}"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, superclass, members) { - return { - type: "dictionary", - name: name, - inheritance: superclass, - members: members - }; - })(pos0, result0[2], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, superclass, members) { + return { + type: "dictionary", + name: name, + inheritance: superclass, + members: members + }; + })(result1[2], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_dictionaryMember() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_type(); - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - result6 = parse_defaultValue(); - result6 = result6 !== null ? result6 : ""; - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - if (input.charCodeAt(pos) === 59) { - result8 = ";"; - pos++; + var cacheKey = 'dictionaryMember@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result14 = parse_extendedAttributeList(); + var result3 = result14 !== null ? result14 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_type(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + var result13 = parse_defaultValue(); + var result9 = result13 !== null ? result13 : ''; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === ";") { + var result11 = ";"; + pos += 1; } else { - result8 = null; - if (reportFailures === 0) { + var result11 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9]; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, type, name, defaultValue) { - return { - type: type, - name: name, - defaultValue: defaultValue - }; - })(pos0, result0[0], result0[2], result0[4], result0[6]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, type, name, defaultValue) { + return { + type: type, + name: name, + defaultValue: defaultValue + }; + })(result1[0], result1[2], result1[4], result1[6]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_defaultValue() { - var result0, result1, result2; - var pos0, pos1; + var cacheKey = 'defaultValue@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } - pos0 = pos; - pos1 = pos; - if (input.charCodeAt(pos) === 61) { - result0 = "="; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + if (input.substr(pos, 1) === "=") { + var result3 = "="; + pos += 1; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"=\""); } } - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - result2 = parse_constExpr(); - if (result2 === null) { - result2 = parse_string(); - } - if (result2 !== null) { - result0 = [result0, result1, result2]; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_constExpr(); + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, value) { return value; })(pos0, result0[2]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(value) { return value; })(result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_typedef() { - var result0, result1, result2, result3, result4, result5, result6, result7; - var pos0, pos1; + var cacheKey = 'typedef@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + - pos0 = pos; - pos1 = pos; + var savedPos0 = pos; + var savedPos1 = pos; if (input.substr(pos, 7) === "typedef") { - result0 = "typedef"; + var result3 = "typedef"; pos += 7; } else { - result0 = null; - if (reportFailures === 0) { + var result3 = null; + if (reportMatchFailures) { matchFailed("\"typedef\""); } } - if (result0 !== null) { - result1 = parse_s(); - if (result1 !== null) { - result2 = parse_type(); - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 59) { - result6 = ";"; - pos++; - } else { - result6 = null; - if (reportFailures === 0) { - matchFailed("\";\""); - } - } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7]; + if (result3 !== null) { + var result4 = parse_s(); + if (result4 !== null) { + var result13 = parse_extendedAttributeList(); + var result5 = result13 !== null ? result13 : ''; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result7 = parse_type(); + if (result7 !== null) { + var result8 = parse_s(); + if (result8 !== null) { + var result9 = parse_identifier(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + if (input.substr(pos, 1) === ";") { + var result11 = ";"; + pos += 1; + } else { + var result11 = null; + if (reportMatchFailures) { + matchFailed("\";\""); + } + } + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12]; + } else { + var result1 = null; + pos = savedPos1; + } + } else { + var result1 = null; + pos = savedPos1; + } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, type, name) { return { type: 'typedef', name: name, idlType: type }; })(pos0, result0[2], result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, type, name) { return { type: 'typedef', name: name, idlType: type, extAttrs: extAttrs }; })(result1[2], result1[4], result1[6]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_exception() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { + var cacheKey = 'exception@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result18 = parse_extendedAttributeList(); + var result3 = result18 !== null ? result18 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { if (input.substr(pos, 9) === "exception") { - result2 = "exception"; + var result5 = "exception"; pos += 9; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"exception\""); } } - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 123) { - result6 = "{"; - pos++; + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "{") { + var result9 = "{"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"{\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = []; - result9 = parse_exMember(); - while (result9 !== null) { - result8.push(result9); - result9 = parse_exMember(); + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result11 = []; + var result17 = parse_exMember(); + while (result17 !== null) { + result11.push(result17); + var result17 = parse_exMember(); } - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 125) { - result10 = "}"; - pos++; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === "}") { + var result13 = "}"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\"}\""); } } - if (result10 !== null) { - result11 = parse_w(); - if (result11 !== null) { - if (input.charCodeAt(pos) === 59) { - result12 = ";"; - pos++; + if (result13 !== null) { + var result14 = parse_w(); + if (result14 !== null) { + if (input.substr(pos, 1) === ";") { + var result15 = ";"; + pos += 1; } else { - result12 = null; - if (reportFailures === 0) { + var result15 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result12 !== null) { - result13 = parse_w(); - if (result13 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; + if (result15 !== null) { + var result16 = parse_w(); + if (result16 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13, result14, result15, result16]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, name, mem) { return { type: 'exception', name: name, members: mem, extAttrs: extAttrs }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, name, mem) { return { type: 'exception', name: name, members: mem, extAttrs: extAttrs }; })(result1[0], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_exMember() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_const(); - if (result0 === null) { - result0 = parse_field(); + var cacheKey = 'exMember@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 !== null) { - result0 = (function(offset, mem) { return mem; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result4 = parse_const(); + if (result4 !== null) { + var result1 = result4; + } else { + var result3 = parse_field(); + if (result3 !== null) { + var result1 = result3; + } else { + var result1 = null;; + }; + } + var result2 = result1 !== null + ? (function(mem) { return mem; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_field() { - var result0, result1, result2, result3, result4, result5, result6, result7; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_extendedAttributeList(); - result0 = result0 !== null ? result0 : ""; - if (result0 !== null) { - result1 = parse_s(); - result1 = result1 !== null ? result1 : ""; - if (result1 !== null) { - result2 = parse_type(); - if (result2 !== null) { - result3 = parse_s(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 59) { - result6 = ";"; - pos++; + var cacheKey = 'field@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result11 = parse_extendedAttributeList(); + var result3 = result11 !== null ? result11 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result5 = parse_type(); + if (result5 !== null) { + var result6 = parse_s(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === ";") { + var result9 = ";"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\";\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7]; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, extAttrs, type, name) { return { type: "field", extAttrs: extAttrs, idlType: type, name: name }; })(pos0, result0[0], result0[2], result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, type, name) { return { type: "field", extAttrs: extAttrs, idlType: type, name: name }; })(result1[0], result1[2], result1[4]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_extendedAttributeList() { - var result0, result1, result2, result3, result4, result5, result6; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 91) { - result1 = "["; - pos++; + var cacheKey = 'extendedAttributeList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === "[") { + var result4 = "["; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\"[\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_ExtAttrs(); - if (result3 !== null) { - result4 = parse_w(); - if (result4 !== null) { - if (input.charCodeAt(pos) === 93) { - result5 = "]"; - pos++; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_ExtAttrs(); + if (result6 !== null) { + var result7 = parse_w(); + if (result7 !== null) { + if (input.substr(pos, 1) === "]") { + var result8 = "]"; + pos += 1; } else { - result5 = null; - if (reportFailures === 0) { + var result8 = null; + if (reportMatchFailures) { matchFailed("\"]\""); } } - if (result5 !== null) { - result6 = parse_w(); - if (result6 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6]; + if (result8 !== null) { + var result9 = parse_w(); + if (result9 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, ea) { return ea; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(ea) { return ea; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttrs() { - var result0, result1, result2; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_ExtAttr(); - if (result0 !== null) { - result1 = []; - result2 = parse_ExtAttrsRest(); - while (result2 !== null) { - result1.push(result2); - result2 = parse_ExtAttrsRest(); - } - if (result1 !== null) { - result0 = [result0, result1]; + var cacheKey = 'ExtAttrs@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_ExtAttr(); + if (result3 !== null) { + var result4 = []; + var result5 = parse_ExtAttrsRest(); + while (result5 !== null) { + result4.push(result5); + var result5 = parse_ExtAttrsRest(); + } + if (result4 !== null) { + var result1 = [result3, result4]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, first, others) { var ret = [first]; - for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } - return ret; })(pos0, result0[0], result0[1]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(first, others) { var ret = [first]; + for (var i = 0, n = others.length; i < n; i++) { ret.push(others[i]); } + return ret; })(result1[0], result1[1]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttrsRest() { - var result0, result1, result2, result3; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_w(); - if (result0 !== null) { - if (input.charCodeAt(pos) === 44) { - result1 = ","; - pos++; + var cacheKey = 'ExtAttrsRest@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_w(); + if (result3 !== null) { + if (input.substr(pos, 1) === ",") { + var result4 = ","; + pos += 1; } else { - result1 = null; - if (reportFailures === 0) { + var result4 = null; + if (reportMatchFailures) { matchFailed("\",\""); } } - if (result1 !== null) { - result2 = parse_w(); - if (result2 !== null) { - result3 = parse_ExtAttr(); - if (result3 !== null) { - result0 = [result0, result1, result2, result3]; + if (result4 !== null) { + var result5 = parse_w(); + if (result5 !== null) { + var result6 = parse_ExtAttr(); + if (result6 !== null) { + var result1 = [result3, result4, result5, result6]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(rest) { return rest; })(result1[3]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttr() { - var result0; - var pos0; - - pos0 = pos; - result0 = parse_ExtAttrArgList(); - if (result0 === null) { - result0 = parse_ExtAttrNamedArgList(); - if (result0 === null) { - result0 = parse_ExtAttrNameValue(); - if (result0 === null) { - result0 = parse_ExtAttrNoArg(); - } - } - } - if (result0 !== null) { - result0 = (function(offset, ea) { return ea; })(pos0, result0); + var cacheKey = 'ExtAttr@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; - } - return result0; - } - - function parse_ExtAttrNoArg() { - var result0; - var pos0; - pos0 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result0 = (function(offset, name) {return { name: name }; })(pos0, result0); - } - if (result0 === null) { - pos = pos0; - } - return result0; - } - - function parse_ExtAttrNameValue() { - var result0, result1, result2, result3, result4; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 61) { - result2 = "="; - pos++; + + var savedPos0 = pos; + var savedPos1 = pos; + var result10 = parse_extendedAttributeList(); + var result3 = result10 !== null ? result10 : ''; + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + var result9 = parse_ExtAttrArgList(); + if (result9 !== null) { + var result5 = result9; } else { - result2 = null; - if (reportFailures === 0) { - matchFailed("\"=\""); - } - } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_ScopedName(); - if (result4 !== null) { - result0 = [result0, result1, result2, result3, result4]; - } else { - result0 = null; - pos = pos1; - } + var result8 = parse_ExtAttrNamedArgList(); + if (result8 !== null) { + var result5 = result8; } else { - result0 = null; - pos = pos1; - } + var result7 = parse_ExtAttrNameValue(); + if (result7 !== null) { + var result5 = result7; + } else { + var result6 = parse_ExtAttrNoArg(); + if (result6 !== null) { + var result5 = result6; + } else { + var result5 = null;; + }; + }; + }; + } + if (result5 !== null) { + var result1 = [result3, result4, result5]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(extAttrs, ea) { + if ( extAttrs ) { ea.extAttrs = extAttrs }; + return ea; + })(result1[0], result1[2]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } - if (result0 !== null) { - result0 = (function(offset, name, value) {return { name: name, value: value }; })(pos0, result0[0], result0[4]); + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; + return result0; + } + + function parse_ExtAttrNoArg() { + var cacheKey = 'ExtAttrNoArg@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; } - if (result0 === null) { - pos = pos0; + + + var savedPos0 = pos; + var result1 = parse_identifier(); + var result2 = result1 !== null + ? (function(name) {return { name: name }; })(result1) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } - function parse_ExtAttrNamedArgList() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 61) { - result2 = "="; - pos++; + function parse_ExtAttrNameValue() { + var cacheKey = 'ExtAttrNameValue@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_identifier(); + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "=") { + var result5 = "="; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"=\""); } } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 40) { - result6 = "("; - pos++; - } else { - result6 = null; - if (reportFailures === 0) { - matchFailed("\"(\""); - } - } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_Arguments(); - result8 = result8 !== null ? result8 : ""; - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 41) { - result10 = ")"; - pos++; - } else { - result10 = null; - if (reportFailures === 0) { - matchFailed("\")\""); - } - } - if (result10 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10]; - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } - } else { - result0 = null; - pos = pos1; - } + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result9 = parse_ScopedName(); + if (result9 !== null) { + var result7 = result9; + } else { + var result8 = parse_string(); + if (result8 !== null) { + var result7 = result8; } else { - result0 = null; - pos = pos1; - } + var result7 = null;; + }; + } + if (result7 !== null) { + var result1 = [result3, result4, result5, result6, result7]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, value, args) {return { name: name, value: value, arguments: args }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, value) {return { name: name, value: value }; })(result1[0], result1[4]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttrNamedArgList() { - var result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 61) { - result2 = "="; - pos++; + var cacheKey = 'ExtAttrNamedArgList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_identifier(); + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "=") { + var result5 = "="; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"=\""); } } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_identifier(); - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 40) { - result6 = "("; - pos++; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result7 = parse_identifier(); + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === "(") { + var result9 = "("; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result6 !== null) { - result7 = parse_w(); - if (result7 !== null) { - result8 = parse_Arguments(); - result8 = result8 !== null ? result8 : ""; - if (result8 !== null) { - result9 = parse_w(); - if (result9 !== null) { - if (input.charCodeAt(pos) === 41) { - result10 = ")"; - pos++; + if (result9 !== null) { + var result10 = parse_w(); + if (result10 !== null) { + var result14 = parse_Arguments(); + var result11 = result14 !== null ? result14 : ''; + if (result11 !== null) { + var result12 = parse_w(); + if (result12 !== null) { + if (input.substr(pos, 1) === ")") { + var result13 = ")"; + pos += 1; } else { - result10 = null; - if (reportFailures === 0) { + var result13 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result10 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8, result9, result10]; + if (result13 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9, result10, result11, result12, result13]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, value, args) {return { name: name, value: value, arguments: args }; })(pos0, result0[0], result0[4], result0[8]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, value, args) {return { name: name, value: value, arguments: args }; })(result1[0], result1[4], result1[8]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } function parse_ExtAttrArgList() { - var result0, result1, result2, result3, result4, result5, result6; - var pos0, pos1; - - pos0 = pos; - pos1 = pos; - result0 = parse_identifier(); - if (result0 !== null) { - result1 = parse_w(); - if (result1 !== null) { - if (input.charCodeAt(pos) === 40) { - result2 = "("; - pos++; + var cacheKey = 'ExtAttrArgList@' + pos; + var cachedResult = cache[cacheKey]; + if (cachedResult) { + pos = cachedResult.nextPos; + return cachedResult.result; + } + + + var savedPos0 = pos; + var savedPos1 = pos; + var result3 = parse_identifier(); + if (result3 !== null) { + var result4 = parse_w(); + if (result4 !== null) { + if (input.substr(pos, 1) === "(") { + var result5 = "("; + pos += 1; } else { - result2 = null; - if (reportFailures === 0) { + var result5 = null; + if (reportMatchFailures) { matchFailed("\"(\""); } } - if (result2 !== null) { - result3 = parse_w(); - if (result3 !== null) { - result4 = parse_Arguments(); - result4 = result4 !== null ? result4 : ""; - if (result4 !== null) { - result5 = parse_w(); - if (result5 !== null) { - if (input.charCodeAt(pos) === 41) { - result6 = ")"; - pos++; + if (result5 !== null) { + var result6 = parse_w(); + if (result6 !== null) { + var result10 = parse_Arguments(); + var result7 = result10 !== null ? result10 : ''; + if (result7 !== null) { + var result8 = parse_w(); + if (result8 !== null) { + if (input.substr(pos, 1) === ")") { + var result9 = ")"; + pos += 1; } else { - result6 = null; - if (reportFailures === 0) { + var result9 = null; + if (reportMatchFailures) { matchFailed("\")\""); } } - if (result6 !== null) { - result0 = [result0, result1, result2, result3, result4, result5, result6]; + if (result9 !== null) { + var result1 = [result3, result4, result5, result6, result7, result8, result9]; } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; + var result1 = null; + pos = savedPos1; } } else { - result0 = null; - pos = pos1; - } - if (result0 !== null) { - result0 = (function(offset, name, args) {return { name: name, arguments: args }; })(pos0, result0[0], result0[4]); - } - if (result0 === null) { - pos = pos0; + var result1 = null; + pos = savedPos1; + } + var result2 = result1 !== null + ? (function(name, args) {return { name: name, arguments: args }; })(result1[0], result1[4]) + : null; + if (result2 !== null) { + var result0 = result2; + } else { + var result0 = null; + pos = savedPos0; } + + + + cache[cacheKey] = { + nextPos: pos, + result: result0 + }; return result0; } - - function cleanupExpected(expected) { - expected.sort(); - - var lastExpected = null; - var cleanExpected = []; - for (var i = 0; i < expected.length; i++) { - if (expected[i] !== lastExpected) { - cleanExpected.push(expected[i]); - lastExpected = expected[i]; + function buildErrorMessage() { + function buildExpected(failuresExpected) { + failuresExpected.sort(); + + var lastFailure = null; + var failuresExpectedUnique = []; + for (var i = 0; i < failuresExpected.length; i++) { + if (failuresExpected[i] !== lastFailure) { + failuresExpectedUnique.push(failuresExpected[i]); + lastFailure = failuresExpected[i]; + } + } + + switch (failuresExpectedUnique.length) { + case 0: + return 'end of input'; + case 1: + return failuresExpectedUnique[0]; + default: + return failuresExpectedUnique.slice(0, failuresExpectedUnique.length - 1).join(', ') + + ' or ' + + failuresExpectedUnique[failuresExpectedUnique.length - 1]; } } - return cleanExpected; + + var expected = buildExpected(rightmostMatchFailuresExpected); + var actualPos = Math.max(pos, rightmostMatchFailuresPos); + var actual = actualPos < input.length + ? quote(input.charAt(actualPos)) + : 'end of input'; + + return 'Expected ' + expected + ' but ' + actual + ' found.'; } function computeErrorPosition() { @@ -5624,13 +6930,13 @@ window.WebIDLParser = (function(){ var column = 1; var seenCR = false; - for (var i = 0; i < Math.max(pos, rightmostFailuresPos); i++) { + for (var i = 0; i < rightmostMatchFailuresPos; i++) { var ch = input.charAt(i); - if (ch === "\n") { + if (ch === '\n') { if (!seenCR) { line++; } column = 1; seenCR = false; - } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { + } else if (ch === '\r' | ch === '\u2028' || ch === '\u2029') { line++; column = 1; seenCR = true; @@ -5644,6 +6950,7 @@ window.WebIDLParser = (function(){ } + var result = parseFunctions[startRule](); /* @@ -5653,32 +6960,27 @@ window.WebIDLParser = (function(){ * * - |result !== null| * - |pos === input.length| - * - |rightmostFailuresExpected| may or may not contain something + * - |rightmostMatchFailuresExpected| may or may not contain something * * 2. The parser successfully parsed only a part of the input. * * - |result !== null| * - |pos < input.length| - * - |rightmostFailuresExpected| may or may not contain something + * - |rightmostMatchFailuresExpected| may or may not contain something * * 3. The parser did not successfully parse any part of the input. * * - |result === null| * - |pos === 0| - * - |rightmostFailuresExpected| contains at least one failure + * - |rightmostMatchFailuresExpected| contains at least one failure * * All code following this comment (including called functions) must * handle these states. */ if (result === null || pos !== input.length) { - var offset = Math.max(pos, rightmostFailuresPos); - var found = offset < input.length ? input.charAt(offset) : null; var errorPosition = computeErrorPosition(); - throw new this.SyntaxError( - cleanupExpected(rightmostFailuresExpected), - found, - offset, + buildErrorMessage(), errorPosition.line, errorPosition.column ); @@ -5693,33 +6995,9 @@ window.WebIDLParser = (function(){ /* Thrown when a parser encounters a syntax error. */ - result.SyntaxError = function(expected, found, offset, line, column) { - function buildMessage(expected, found) { - var expectedHumanized, foundHumanized; - - switch (expected.length) { - case 0: - expectedHumanized = "end of input"; - break; - case 1: - expectedHumanized = expected[0]; - break; - default: - expectedHumanized = expected.slice(0, expected.length - 1).join(", ") - + " or " - + expected[expected.length - 1]; - } - - foundHumanized = found ? quote(found) : "end of input"; - - return "Expected " + expectedHumanized + " but " + foundHumanized + " found."; - } - - this.name = "SyntaxError"; - this.expected = expected; - this.found = found; - this.message = buildMessage(expected, found); - this.offset = offset; + result.SyntaxError = function(message, line, column) { + this.name = 'SyntaxError'; + this.message = message; this.line = line; this.column = column; }; @@ -5727,4 +7005,4 @@ window.WebIDLParser = (function(){ result.SyntaxError.prototype = Error.prototype; return result; -})() \ No newline at end of file +})();