| OLD | NEW |
| (Empty) |
| 1 // From https://github.com/darobin/webidl.js/tree/, under MIT license | |
| 2 window.WebIDLParser = (function(){ | |
| 3 /* | |
| 4 * Generated by PEG.js 0.7.0. | |
| 5 * | |
| 6 * http://pegjs.majda.cz/ | |
| 7 */ | |
| 8 | |
| 9 function quote(s) { | |
| 10 /* | |
| 11 * ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a | |
| 12 * string literal except for the closing quote character, backslash, | |
| 13 * carriage return, line separator, paragraph separator, and line feed. | |
| 14 * Any character may appear in the form of an escape sequence. | |
| 15 * | |
| 16 * For portability, we also escape escape all control and non-ASCII | |
| 17 * characters. Note that "\0" and "\v" escape sequences are not used | |
| 18 * because JSHint does not like the first and IE the second. | |
| 19 */ | |
| 20 return '"' + s | |
| 21 .replace(/\\/g, '\\\\') // backslash | |
| 22 .replace(/"/g, '\\"') // closing quote character | |
| 23 .replace(/\x08/g, '\\b') // backspace | |
| 24 .replace(/\t/g, '\\t') // horizontal tab | |
| 25 .replace(/\n/g, '\\n') // line feed | |
| 26 .replace(/\f/g, '\\f') // form feed | |
| 27 .replace(/\r/g, '\\r') // carriage return | |
| 28 .replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape) | |
| 29 + '"'; | |
| 30 } | |
| 31 | |
| 32 var result = { | |
| 33 /* | |
| 34 * Parses the input with a generated parser. If the parsing is successfull, | |
| 35 * returns a value explicitly or implicitly specified by the grammar from | |
| 36 * which the parser was generated (see |PEG.buildParser|). If the parsing is | |
| 37 * unsuccessful, throws |PEG.parser.SyntaxError| describing the error. | |
| 38 */ | |
| 39 parse: function(input, startRule) { | |
| 40 var parseFunctions = { | |
| 41 "space": parse_space, | |
| 42 "s": parse_s, | |
| 43 "w": parse_w, | |
| 44 "identifier": parse_identifier, | |
| 45 "octal": parse_octal, | |
| 46 "hex": parse_hex, | |
| 47 "decimal": parse_decimal, | |
| 48 "integer": parse_integer, | |
| 49 "floatEe": parse_floatEe, | |
| 50 "expFloat": parse_expFloat, | |
| 51 "leadFloat": parse_leadFloat, | |
| 52 "dotFloat": parse_dotFloat, | |
| 53 "float": parse_float, | |
| 54 "string": parse_string, | |
| 55 "other": parse_other, | |
| 56 "type": parse_type, | |
| 57 "TypeDesc": parse_TypeDesc, | |
| 58 "Sequence": parse_Sequence, | |
| 59 "ArrayType": parse_ArrayType, | |
| 60 "UnionType": parse_UnionType, | |
| 61 "TypeList": parse_TypeList, | |
| 62 "TypeListRest": parse_TypeListRest, | |
| 63 "SimpleType": parse_SimpleType, | |
| 64 "PrimitiveType": parse_PrimitiveType, | |
| 65 "FloatType": parse_FloatType, | |
| 66 "UnsignedIntegerType": parse_UnsignedIntegerType, | |
| 67 "ScopedNameList": parse_ScopedNameList, | |
| 68 "ScopedNameListRest": parse_ScopedNameListRest, | |
| 69 "ScopedName": parse_ScopedName, | |
| 70 "AbsoluteScopedName": parse_AbsoluteScopedName, | |
| 71 "RelativeScopedName": parse_RelativeScopedName, | |
| 72 "ScopedNameRest": parse_ScopedNameRest, | |
| 73 "BooleanLiteral": parse_BooleanLiteral, | |
| 74 "Nullable": parse_Nullable, | |
| 75 "ReturnType": parse_ReturnType, | |
| 76 "definitions": parse_definitions, | |
| 77 "definition": parse_definition, | |
| 78 "partialinterface": parse_partialinterface, | |
| 79 "partialdictionary": parse_partialdictionary, | |
| 80 "callbackinterface": parse_callbackinterface, | |
| 81 "module": parse_module, | |
| 82 "implements": parse_implements, | |
| 83 "interface": parse_interface, | |
| 84 "enum": parse_enum, | |
| 85 "callback": parse_callback, | |
| 86 "EnumValues": parse_EnumValues, | |
| 87 "EnumValuesRest": parse_EnumValuesRest, | |
| 88 "Inheritance": parse_Inheritance, | |
| 89 "InheritanceInner": parse_InheritanceInner, | |
| 90 "InterfaceMemberList": parse_InterfaceMemberList, | |
| 91 "InterfaceMember": parse_InterfaceMember, | |
| 92 "const": parse_const, | |
| 93 "constExpr": parse_constExpr, | |
| 94 "attrOrOp": parse_attrOrOp, | |
| 95 "Stringifier": parse_Stringifier, | |
| 96 "Attribute": parse_Attribute, | |
| 97 "GetRaises": parse_GetRaises, | |
| 98 "SetRaises": parse_SetRaises, | |
| 99 "Operation": parse_Operation, | |
| 100 "Qualifiers": parse_Qualifiers, | |
| 101 "Special": parse_Special, | |
| 102 "OperationRest": parse_OperationRest, | |
| 103 "Arguments": parse_Arguments, | |
| 104 "ArgumentsRest": parse_ArgumentsRest, | |
| 105 "Argument": parse_Argument, | |
| 106 "Raises": parse_Raises, | |
| 107 "dictionary": parse_dictionary, | |
| 108 "DictionaryMemberList": parse_DictionaryMemberList, | |
| 109 "DictionaryMember": parse_DictionaryMember, | |
| 110 "defaultValue": parse_defaultValue, | |
| 111 "typedef": parse_typedef, | |
| 112 "exception": parse_exception, | |
| 113 "ExceptionMembers": parse_ExceptionMembers, | |
| 114 "ExceptionMember": parse_ExceptionMember, | |
| 115 "field": parse_field, | |
| 116 "ExtendedAttributeList": parse_ExtendedAttributeList, | |
| 117 "ExtendedAttributeListInner": parse_ExtendedAttributeListInner, | |
| 118 "ExtAttrs": parse_ExtAttrs, | |
| 119 "ExtAttrsRest": parse_ExtAttrsRest, | |
| 120 "ExtAttr": parse_ExtAttr, | |
| 121 "ExtAttrNoArg": parse_ExtAttrNoArg, | |
| 122 "ExtAttrNameValue": parse_ExtAttrNameValue, | |
| 123 "ExtAttrNamedArgList": parse_ExtAttrNamedArgList, | |
| 124 "ExtAttrNamedArgList": parse_ExtAttrNamedArgList, | |
| 125 "ExtAttrArgList": parse_ExtAttrArgList | |
| 126 }; | |
| 127 | |
| 128 if (startRule !== undefined) { | |
| 129 if (parseFunctions[startRule] === undefined) { | |
| 130 throw new Error("Invalid rule name: " + quote(startRule) + "."); | |
| 131 } | |
| 132 } else { | |
| 133 startRule = "definitions"; | |
| 134 } | |
| 135 | |
| 136 var pos = 0; | |
| 137 var reportFailures = 0; | |
| 138 var rightmostFailuresPos = 0; | |
| 139 var rightmostFailuresExpected = []; | |
| 140 | |
| 141 function padLeft(input, padding, length) { | |
| 142 var result = input; | |
| 143 | |
| 144 var padLength = length - input.length; | |
| 145 for (var i = 0; i < padLength; i++) { | |
| 146 result = padding + result; | |
| 147 } | |
| 148 | |
| 149 return result; | |
| 150 } | |
| 151 | |
| 152 function escape(ch) { | |
| 153 var charCode = ch.charCodeAt(0); | |
| 154 var escapeChar; | |
| 155 var length; | |
| 156 | |
| 157 if (charCode <= 0xFF) { | |
| 158 escapeChar = 'x'; | |
| 159 length = 2; | |
| 160 } else { | |
| 161 escapeChar = 'u'; | |
| 162 length = 4; | |
| 163 } | |
| 164 | |
| 165 return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(),
'0', length); | |
| 166 } | |
| 167 | |
| 168 function matchFailed(failure) { | |
| 169 if (pos < rightmostFailuresPos) { | |
| 170 return; | |
| 171 } | |
| 172 | |
| 173 if (pos > rightmostFailuresPos) { | |
| 174 rightmostFailuresPos = pos; | |
| 175 rightmostFailuresExpected = []; | |
| 176 } | |
| 177 | |
| 178 rightmostFailuresExpected.push(failure); | |
| 179 } | |
| 180 | |
| 181 function parse_space() { | |
| 182 var result0, result1, result2, result3; | |
| 183 var pos0, pos1, pos2; | |
| 184 | |
| 185 if (input.charCodeAt(pos) === 32) { | |
| 186 result0 = " "; | |
| 187 pos++; | |
| 188 } else { | |
| 189 result0 = null; | |
| 190 if (reportFailures === 0) { | |
| 191 matchFailed("\" \""); | |
| 192 } | |
| 193 } | |
| 194 if (result0 === null) { | |
| 195 if (input.charCodeAt(pos) === 9) { | |
| 196 result0 = "\t"; | |
| 197 pos++; | |
| 198 } else { | |
| 199 result0 = null; | |
| 200 if (reportFailures === 0) { | |
| 201 matchFailed("\"\\t\""); | |
| 202 } | |
| 203 } | |
| 204 if (result0 === null) { | |
| 205 if (input.charCodeAt(pos) === 13) { | |
| 206 result0 = "\r"; | |
| 207 pos++; | |
| 208 } else { | |
| 209 result0 = null; | |
| 210 if (reportFailures === 0) { | |
| 211 matchFailed("\"\\r\""); | |
| 212 } | |
| 213 } | |
| 214 if (result0 === null) { | |
| 215 if (input.charCodeAt(pos) === 10) { | |
| 216 result0 = "\n"; | |
| 217 pos++; | |
| 218 } else { | |
| 219 result0 = null; | |
| 220 if (reportFailures === 0) { | |
| 221 matchFailed("\"\\n\""); | |
| 222 } | |
| 223 } | |
| 224 if (result0 === null) { | |
| 225 if (input.charCodeAt(pos) === 12) { | |
| 226 result0 = "\f"; | |
| 227 pos++; | |
| 228 } else { | |
| 229 result0 = null; | |
| 230 if (reportFailures === 0) { | |
| 231 matchFailed("\"\\f\""); | |
| 232 } | |
| 233 } | |
| 234 if (result0 === null) { | |
| 235 pos0 = pos; | |
| 236 if (input.substr(pos, 2) === "//") { | |
| 237 result0 = "//"; | |
| 238 pos += 2; | |
| 239 } else { | |
| 240 result0 = null; | |
| 241 if (reportFailures === 0) { | |
| 242 matchFailed("\"//\""); | |
| 243 } | |
| 244 } | |
| 245 if (result0 !== null) { | |
| 246 result1 = []; | |
| 247 if (/^[^\n]/.test(input.charAt(pos))) { | |
| 248 result2 = input.charAt(pos); | |
| 249 pos++; | |
| 250 } else { | |
| 251 result2 = null; | |
| 252 if (reportFailures === 0) { | |
| 253 matchFailed("[^\\n]"); | |
| 254 } | |
| 255 } | |
| 256 while (result2 !== null) { | |
| 257 result1.push(result2); | |
| 258 if (/^[^\n]/.test(input.charAt(pos))) { | |
| 259 result2 = input.charAt(pos); | |
| 260 pos++; | |
| 261 } else { | |
| 262 result2 = null; | |
| 263 if (reportFailures === 0) { | |
| 264 matchFailed("[^\\n]"); | |
| 265 } | |
| 266 } | |
| 267 } | |
| 268 if (result1 !== null) { | |
| 269 if (input.charCodeAt(pos) === 10) { | |
| 270 result2 = "\n"; | |
| 271 pos++; | |
| 272 } else { | |
| 273 result2 = null; | |
| 274 if (reportFailures === 0) { | |
| 275 matchFailed("\"\\n\""); | |
| 276 } | |
| 277 } | |
| 278 if (result2 !== null) { | |
| 279 result0 = [result0, result1, result2]; | |
| 280 } else { | |
| 281 result0 = null; | |
| 282 pos = pos0; | |
| 283 } | |
| 284 } else { | |
| 285 result0 = null; | |
| 286 pos = pos0; | |
| 287 } | |
| 288 } else { | |
| 289 result0 = null; | |
| 290 pos = pos0; | |
| 291 } | |
| 292 if (result0 === null) { | |
| 293 pos0 = pos; | |
| 294 if (input.substr(pos, 2) === "/*") { | |
| 295 result0 = "/*"; | |
| 296 pos += 2; | |
| 297 } else { | |
| 298 result0 = null; | |
| 299 if (reportFailures === 0) { | |
| 300 matchFailed("\"/*\""); | |
| 301 } | |
| 302 } | |
| 303 if (result0 !== null) { | |
| 304 result1 = []; | |
| 305 if (/^[^*]/.test(input.charAt(pos))) { | |
| 306 result2 = input.charAt(pos); | |
| 307 pos++; | |
| 308 } else { | |
| 309 result2 = null; | |
| 310 if (reportFailures === 0) { | |
| 311 matchFailed("[^*]"); | |
| 312 } | |
| 313 } | |
| 314 if (result2 === null) { | |
| 315 pos1 = pos; | |
| 316 if (input.charCodeAt(pos) === 42) { | |
| 317 result2 = "*"; | |
| 318 pos++; | |
| 319 } else { | |
| 320 result2 = null; | |
| 321 if (reportFailures === 0) { | |
| 322 matchFailed("\"*\""); | |
| 323 } | |
| 324 } | |
| 325 if (result2 !== null) { | |
| 326 pos2 = pos; | |
| 327 reportFailures++; | |
| 328 if (input.charCodeAt(pos) === 47) { | |
| 329 result3 = "/"; | |
| 330 pos++; | |
| 331 } else { | |
| 332 result3 = null; | |
| 333 if (reportFailures === 0) { | |
| 334 matchFailed("\"/\""); | |
| 335 } | |
| 336 } | |
| 337 reportFailures--; | |
| 338 if (result3 === null) { | |
| 339 result3 = ""; | |
| 340 } else { | |
| 341 result3 = null; | |
| 342 pos = pos2; | |
| 343 } | |
| 344 if (result3 !== null) { | |
| 345 result2 = [result2, result3]; | |
| 346 } else { | |
| 347 result2 = null; | |
| 348 pos = pos1; | |
| 349 } | |
| 350 } else { | |
| 351 result2 = null; | |
| 352 pos = pos1; | |
| 353 } | |
| 354 } | |
| 355 while (result2 !== null) { | |
| 356 result1.push(result2); | |
| 357 if (/^[^*]/.test(input.charAt(pos))) { | |
| 358 result2 = input.charAt(pos); | |
| 359 pos++; | |
| 360 } else { | |
| 361 result2 = null; | |
| 362 if (reportFailures === 0) { | |
| 363 matchFailed("[^*]"); | |
| 364 } | |
| 365 } | |
| 366 if (result2 === null) { | |
| 367 pos1 = pos; | |
| 368 if (input.charCodeAt(pos) === 42) { | |
| 369 result2 = "*"; | |
| 370 pos++; | |
| 371 } else { | |
| 372 result2 = null; | |
| 373 if (reportFailures === 0) { | |
| 374 matchFailed("\"*\""); | |
| 375 } | |
| 376 } | |
| 377 if (result2 !== null) { | |
| 378 pos2 = pos; | |
| 379 reportFailures++; | |
| 380 if (input.charCodeAt(pos) === 47) { | |
| 381 result3 = "/"; | |
| 382 pos++; | |
| 383 } else { | |
| 384 result3 = null; | |
| 385 if (reportFailures === 0) { | |
| 386 matchFailed("\"/\""); | |
| 387 } | |
| 388 } | |
| 389 reportFailures--; | |
| 390 if (result3 === null) { | |
| 391 result3 = ""; | |
| 392 } else { | |
| 393 result3 = null; | |
| 394 pos = pos2; | |
| 395 } | |
| 396 if (result3 !== null) { | |
| 397 result2 = [result2, result3]; | |
| 398 } else { | |
| 399 result2 = null; | |
| 400 pos = pos1; | |
| 401 } | |
| 402 } else { | |
| 403 result2 = null; | |
| 404 pos = pos1; | |
| 405 } | |
| 406 } | |
| 407 } | |
| 408 if (result1 !== null) { | |
| 409 if (input.substr(pos, 2) === "*/") { | |
| 410 result2 = "*/"; | |
| 411 pos += 2; | |
| 412 } else { | |
| 413 result2 = null; | |
| 414 if (reportFailures === 0) { | |
| 415 matchFailed("\"*/\""); | |
| 416 } | |
| 417 } | |
| 418 if (result2 !== null) { | |
| 419 result0 = [result0, result1, result2]; | |
| 420 } else { | |
| 421 result0 = null; | |
| 422 pos = pos0; | |
| 423 } | |
| 424 } else { | |
| 425 result0 = null; | |
| 426 pos = pos0; | |
| 427 } | |
| 428 } else { | |
| 429 result0 = null; | |
| 430 pos = pos0; | |
| 431 } | |
| 432 } | |
| 433 } | |
| 434 } | |
| 435 } | |
| 436 } | |
| 437 } | |
| 438 return result0; | |
| 439 } | |
| 440 | |
| 441 function parse_s() { | |
| 442 var result0, result1; | |
| 443 | |
| 444 result1 = parse_space(); | |
| 445 if (result1 !== null) { | |
| 446 result0 = []; | |
| 447 while (result1 !== null) { | |
| 448 result0.push(result1); | |
| 449 result1 = parse_space(); | |
| 450 } | |
| 451 } else { | |
| 452 result0 = null; | |
| 453 } | |
| 454 return result0; | |
| 455 } | |
| 456 | |
| 457 function parse_w() { | |
| 458 var result0; | |
| 459 | |
| 460 result0 = parse_s(); | |
| 461 result0 = result0 !== null ? result0 : ""; | |
| 462 return result0; | |
| 463 } | |
| 464 | |
| 465 function parse_identifier() { | |
| 466 var result0, result1, result2; | |
| 467 var pos0, pos1; | |
| 468 | |
| 469 pos0 = pos; | |
| 470 pos1 = pos; | |
| 471 if (/^[A-Z_a-z]/.test(input.charAt(pos))) { | |
| 472 result0 = input.charAt(pos); | |
| 473 pos++; | |
| 474 } else { | |
| 475 result0 = null; | |
| 476 if (reportFailures === 0) { | |
| 477 matchFailed("[A-Z_a-z]"); | |
| 478 } | |
| 479 } | |
| 480 if (result0 !== null) { | |
| 481 result1 = []; | |
| 482 if (/^[0-9A-Z_a-z]/.test(input.charAt(pos))) { | |
| 483 result2 = input.charAt(pos); | |
| 484 pos++; | |
| 485 } else { | |
| 486 result2 = null; | |
| 487 if (reportFailures === 0) { | |
| 488 matchFailed("[0-9A-Z_a-z]"); | |
| 489 } | |
| 490 } | |
| 491 while (result2 !== null) { | |
| 492 result1.push(result2); | |
| 493 if (/^[0-9A-Z_a-z]/.test(input.charAt(pos))) { | |
| 494 result2 = input.charAt(pos); | |
| 495 pos++; | |
| 496 } else { | |
| 497 result2 = null; | |
| 498 if (reportFailures === 0) { | |
| 499 matchFailed("[0-9A-Z_a-z]"); | |
| 500 } | |
| 501 } | |
| 502 } | |
| 503 if (result1 !== null) { | |
| 504 result0 = [result0, result1]; | |
| 505 } else { | |
| 506 result0 = null; | |
| 507 pos = pos1; | |
| 508 } | |
| 509 } else { | |
| 510 result0 = null; | |
| 511 pos = pos1; | |
| 512 } | |
| 513 if (result0 !== null) { | |
| 514 result0 = (function(offset, nmstart, nmchars) { return nmstart + nmcha
rs.join(""); })(pos0, result0[0], result0[1]); | |
| 515 } | |
| 516 if (result0 === null) { | |
| 517 pos = pos0; | |
| 518 } | |
| 519 return result0; | |
| 520 } | |
| 521 | |
| 522 function parse_octal() { | |
| 523 var result0, result1, result2; | |
| 524 var pos0, pos1; | |
| 525 | |
| 526 pos0 = pos; | |
| 527 pos1 = pos; | |
| 528 if (input.charCodeAt(pos) === 48) { | |
| 529 result0 = "0"; | |
| 530 pos++; | |
| 531 } else { | |
| 532 result0 = null; | |
| 533 if (reportFailures === 0) { | |
| 534 matchFailed("\"0\""); | |
| 535 } | |
| 536 } | |
| 537 if (result0 !== null) { | |
| 538 result1 = []; | |
| 539 if (/^[0-7]/.test(input.charAt(pos))) { | |
| 540 result2 = input.charAt(pos); | |
| 541 pos++; | |
| 542 } else { | |
| 543 result2 = null; | |
| 544 if (reportFailures === 0) { | |
| 545 matchFailed("[0-7]"); | |
| 546 } | |
| 547 } | |
| 548 while (result2 !== null) { | |
| 549 result1.push(result2); | |
| 550 if (/^[0-7]/.test(input.charAt(pos))) { | |
| 551 result2 = input.charAt(pos); | |
| 552 pos++; | |
| 553 } else { | |
| 554 result2 = null; | |
| 555 if (reportFailures === 0) { | |
| 556 matchFailed("[0-7]"); | |
| 557 } | |
| 558 } | |
| 559 } | |
| 560 if (result1 !== null) { | |
| 561 result0 = [result0, result1]; | |
| 562 } else { | |
| 563 result0 = null; | |
| 564 pos = pos1; | |
| 565 } | |
| 566 } else { | |
| 567 result0 = null; | |
| 568 pos = pos1; | |
| 569 } | |
| 570 if (result0 !== null) { | |
| 571 result0 = (function(offset, value) { return "0" + value.join(""); })(p
os0, result0[1]); | |
| 572 } | |
| 573 if (result0 === null) { | |
| 574 pos = pos0; | |
| 575 } | |
| 576 return result0; | |
| 577 } | |
| 578 | |
| 579 function parse_hex() { | |
| 580 var result0, result1, result2, result3; | |
| 581 var pos0, pos1; | |
| 582 | |
| 583 pos0 = pos; | |
| 584 pos1 = pos; | |
| 585 if (input.charCodeAt(pos) === 48) { | |
| 586 result0 = "0"; | |
| 587 pos++; | |
| 588 } else { | |
| 589 result0 = null; | |
| 590 if (reportFailures === 0) { | |
| 591 matchFailed("\"0\""); | |
| 592 } | |
| 593 } | |
| 594 if (result0 !== null) { | |
| 595 if (/^[Xx]/.test(input.charAt(pos))) { | |
| 596 result1 = input.charAt(pos); | |
| 597 pos++; | |
| 598 } else { | |
| 599 result1 = null; | |
| 600 if (reportFailures === 0) { | |
| 601 matchFailed("[Xx]"); | |
| 602 } | |
| 603 } | |
| 604 if (result1 !== null) { | |
| 605 if (/^[0-9A-Fa-f]/.test(input.charAt(pos))) { | |
| 606 result3 = input.charAt(pos); | |
| 607 pos++; | |
| 608 } else { | |
| 609 result3 = null; | |
| 610 if (reportFailures === 0) { | |
| 611 matchFailed("[0-9A-Fa-f]"); | |
| 612 } | |
| 613 } | |
| 614 if (result3 !== null) { | |
| 615 result2 = []; | |
| 616 while (result3 !== null) { | |
| 617 result2.push(result3); | |
| 618 if (/^[0-9A-Fa-f]/.test(input.charAt(pos))) { | |
| 619 result3 = input.charAt(pos); | |
| 620 pos++; | |
| 621 } else { | |
| 622 result3 = null; | |
| 623 if (reportFailures === 0) { | |
| 624 matchFailed("[0-9A-Fa-f]"); | |
| 625 } | |
| 626 } | |
| 627 } | |
| 628 } else { | |
| 629 result2 = null; | |
| 630 } | |
| 631 if (result2 !== null) { | |
| 632 result0 = [result0, result1, result2]; | |
| 633 } else { | |
| 634 result0 = null; | |
| 635 pos = pos1; | |
| 636 } | |
| 637 } else { | |
| 638 result0 = null; | |
| 639 pos = pos1; | |
| 640 } | |
| 641 } else { | |
| 642 result0 = null; | |
| 643 pos = pos1; | |
| 644 } | |
| 645 if (result0 !== null) { | |
| 646 result0 = (function(offset, x, value) { return "0" + x + value.join(""
); })(pos0, result0[1], result0[2]); | |
| 647 } | |
| 648 if (result0 === null) { | |
| 649 pos = pos0; | |
| 650 } | |
| 651 return result0; | |
| 652 } | |
| 653 | |
| 654 function parse_decimal() { | |
| 655 var result0, result1, result2; | |
| 656 var pos0, pos1; | |
| 657 | |
| 658 pos0 = pos; | |
| 659 pos1 = pos; | |
| 660 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 661 result0 = input.charAt(pos); | |
| 662 pos++; | |
| 663 } else { | |
| 664 result0 = null; | |
| 665 if (reportFailures === 0) { | |
| 666 matchFailed("[0-9]"); | |
| 667 } | |
| 668 } | |
| 669 if (result0 !== null) { | |
| 670 result1 = []; | |
| 671 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 672 result2 = input.charAt(pos); | |
| 673 pos++; | |
| 674 } else { | |
| 675 result2 = null; | |
| 676 if (reportFailures === 0) { | |
| 677 matchFailed("[0-9]"); | |
| 678 } | |
| 679 } | |
| 680 while (result2 !== null) { | |
| 681 result1.push(result2); | |
| 682 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 683 result2 = input.charAt(pos); | |
| 684 pos++; | |
| 685 } else { | |
| 686 result2 = null; | |
| 687 if (reportFailures === 0) { | |
| 688 matchFailed("[0-9]"); | |
| 689 } | |
| 690 } | |
| 691 } | |
| 692 if (result1 !== null) { | |
| 693 result0 = [result0, result1]; | |
| 694 } else { | |
| 695 result0 = null; | |
| 696 pos = pos1; | |
| 697 } | |
| 698 } else { | |
| 699 result0 = null; | |
| 700 pos = pos1; | |
| 701 } | |
| 702 if (result0 !== null) { | |
| 703 result0 = (function(offset, numStart, numRest) { return numStart + num
Rest.join(""); })(pos0, result0[0], result0[1]); | |
| 704 } | |
| 705 if (result0 === null) { | |
| 706 pos = pos0; | |
| 707 } | |
| 708 return result0; | |
| 709 } | |
| 710 | |
| 711 function parse_integer() { | |
| 712 var result0, result1; | |
| 713 var pos0, pos1; | |
| 714 | |
| 715 pos0 = pos; | |
| 716 pos1 = pos; | |
| 717 if (input.charCodeAt(pos) === 45) { | |
| 718 result0 = "-"; | |
| 719 pos++; | |
| 720 } else { | |
| 721 result0 = null; | |
| 722 if (reportFailures === 0) { | |
| 723 matchFailed("\"-\""); | |
| 724 } | |
| 725 } | |
| 726 result0 = result0 !== null ? result0 : ""; | |
| 727 if (result0 !== null) { | |
| 728 result1 = parse_hex(); | |
| 729 if (result1 === null) { | |
| 730 result1 = parse_octal(); | |
| 731 if (result1 === null) { | |
| 732 result1 = parse_decimal(); | |
| 733 } | |
| 734 } | |
| 735 if (result1 !== null) { | |
| 736 result0 = [result0, result1]; | |
| 737 } else { | |
| 738 result0 = null; | |
| 739 pos = pos1; | |
| 740 } | |
| 741 } else { | |
| 742 result0 = null; | |
| 743 pos = pos1; | |
| 744 } | |
| 745 if (result0 !== null) { | |
| 746 result0 = (function(offset, neg, num) { return neg + num; })(pos0, res
ult0[0], result0[1]); | |
| 747 } | |
| 748 if (result0 === null) { | |
| 749 pos = pos0; | |
| 750 } | |
| 751 return result0; | |
| 752 } | |
| 753 | |
| 754 function parse_floatEe() { | |
| 755 var result0, result1, result2, result3; | |
| 756 var pos0, pos1; | |
| 757 | |
| 758 pos0 = pos; | |
| 759 pos1 = pos; | |
| 760 if (/^[Ee]/.test(input.charAt(pos))) { | |
| 761 result0 = input.charAt(pos); | |
| 762 pos++; | |
| 763 } else { | |
| 764 result0 = null; | |
| 765 if (reportFailures === 0) { | |
| 766 matchFailed("[Ee]"); | |
| 767 } | |
| 768 } | |
| 769 if (result0 !== null) { | |
| 770 if (/^[+\-]/.test(input.charAt(pos))) { | |
| 771 result1 = input.charAt(pos); | |
| 772 pos++; | |
| 773 } else { | |
| 774 result1 = null; | |
| 775 if (reportFailures === 0) { | |
| 776 matchFailed("[+\\-]"); | |
| 777 } | |
| 778 } | |
| 779 result1 = result1 !== null ? result1 : ""; | |
| 780 if (result1 !== null) { | |
| 781 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 782 result3 = input.charAt(pos); | |
| 783 pos++; | |
| 784 } else { | |
| 785 result3 = null; | |
| 786 if (reportFailures === 0) { | |
| 787 matchFailed("[0-9]"); | |
| 788 } | |
| 789 } | |
| 790 if (result3 !== null) { | |
| 791 result2 = []; | |
| 792 while (result3 !== null) { | |
| 793 result2.push(result3); | |
| 794 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 795 result3 = input.charAt(pos); | |
| 796 pos++; | |
| 797 } else { | |
| 798 result3 = null; | |
| 799 if (reportFailures === 0) { | |
| 800 matchFailed("[0-9]"); | |
| 801 } | |
| 802 } | |
| 803 } | |
| 804 } else { | |
| 805 result2 = null; | |
| 806 } | |
| 807 if (result2 !== null) { | |
| 808 result0 = [result0, result1, result2]; | |
| 809 } else { | |
| 810 result0 = null; | |
| 811 pos = pos1; | |
| 812 } | |
| 813 } else { | |
| 814 result0 = null; | |
| 815 pos = pos1; | |
| 816 } | |
| 817 } else { | |
| 818 result0 = null; | |
| 819 pos = pos1; | |
| 820 } | |
| 821 if (result0 !== null) { | |
| 822 result0 = (function(offset, e, sign, exp) { return e + sign + exp.join
(""); })(pos0, result0[0], result0[1], result0[2]); | |
| 823 } | |
| 824 if (result0 === null) { | |
| 825 pos = pos0; | |
| 826 } | |
| 827 return result0; | |
| 828 } | |
| 829 | |
| 830 function parse_expFloat() { | |
| 831 var result0, result1; | |
| 832 var pos0, pos1; | |
| 833 | |
| 834 pos0 = pos; | |
| 835 pos1 = pos; | |
| 836 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 837 result1 = input.charAt(pos); | |
| 838 pos++; | |
| 839 } else { | |
| 840 result1 = null; | |
| 841 if (reportFailures === 0) { | |
| 842 matchFailed("[0-9]"); | |
| 843 } | |
| 844 } | |
| 845 if (result1 !== null) { | |
| 846 result0 = []; | |
| 847 while (result1 !== null) { | |
| 848 result0.push(result1); | |
| 849 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 850 result1 = input.charAt(pos); | |
| 851 pos++; | |
| 852 } else { | |
| 853 result1 = null; | |
| 854 if (reportFailures === 0) { | |
| 855 matchFailed("[0-9]"); | |
| 856 } | |
| 857 } | |
| 858 } | |
| 859 } else { | |
| 860 result0 = null; | |
| 861 } | |
| 862 if (result0 !== null) { | |
| 863 result1 = parse_floatEe(); | |
| 864 if (result1 !== null) { | |
| 865 result0 = [result0, result1]; | |
| 866 } else { | |
| 867 result0 = null; | |
| 868 pos = pos1; | |
| 869 } | |
| 870 } else { | |
| 871 result0 = null; | |
| 872 pos = pos1; | |
| 873 } | |
| 874 if (result0 !== null) { | |
| 875 result0 = (function(offset, num, fee) { return num.join("") + fee; })(
pos0, result0[0], result0[1]); | |
| 876 } | |
| 877 if (result0 === null) { | |
| 878 pos = pos0; | |
| 879 } | |
| 880 return result0; | |
| 881 } | |
| 882 | |
| 883 function parse_leadFloat() { | |
| 884 var result0, result1, result2, result3; | |
| 885 var pos0, pos1; | |
| 886 | |
| 887 pos0 = pos; | |
| 888 pos1 = pos; | |
| 889 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 890 result1 = input.charAt(pos); | |
| 891 pos++; | |
| 892 } else { | |
| 893 result1 = null; | |
| 894 if (reportFailures === 0) { | |
| 895 matchFailed("[0-9]"); | |
| 896 } | |
| 897 } | |
| 898 if (result1 !== null) { | |
| 899 result0 = []; | |
| 900 while (result1 !== null) { | |
| 901 result0.push(result1); | |
| 902 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 903 result1 = input.charAt(pos); | |
| 904 pos++; | |
| 905 } else { | |
| 906 result1 = null; | |
| 907 if (reportFailures === 0) { | |
| 908 matchFailed("[0-9]"); | |
| 909 } | |
| 910 } | |
| 911 } | |
| 912 } else { | |
| 913 result0 = null; | |
| 914 } | |
| 915 if (result0 !== null) { | |
| 916 if (input.charCodeAt(pos) === 46) { | |
| 917 result1 = "."; | |
| 918 pos++; | |
| 919 } else { | |
| 920 result1 = null; | |
| 921 if (reportFailures === 0) { | |
| 922 matchFailed("\".\""); | |
| 923 } | |
| 924 } | |
| 925 if (result1 !== null) { | |
| 926 result2 = []; | |
| 927 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 928 result3 = input.charAt(pos); | |
| 929 pos++; | |
| 930 } else { | |
| 931 result3 = null; | |
| 932 if (reportFailures === 0) { | |
| 933 matchFailed("[0-9]"); | |
| 934 } | |
| 935 } | |
| 936 while (result3 !== null) { | |
| 937 result2.push(result3); | |
| 938 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 939 result3 = input.charAt(pos); | |
| 940 pos++; | |
| 941 } else { | |
| 942 result3 = null; | |
| 943 if (reportFailures === 0) { | |
| 944 matchFailed("[0-9]"); | |
| 945 } | |
| 946 } | |
| 947 } | |
| 948 if (result2 !== null) { | |
| 949 result3 = parse_floatEe(); | |
| 950 result3 = result3 !== null ? result3 : ""; | |
| 951 if (result3 !== null) { | |
| 952 result0 = [result0, result1, result2, result3]; | |
| 953 } else { | |
| 954 result0 = null; | |
| 955 pos = pos1; | |
| 956 } | |
| 957 } else { | |
| 958 result0 = null; | |
| 959 pos = pos1; | |
| 960 } | |
| 961 } else { | |
| 962 result0 = null; | |
| 963 pos = pos1; | |
| 964 } | |
| 965 } else { | |
| 966 result0 = null; | |
| 967 pos = pos1; | |
| 968 } | |
| 969 if (result0 !== null) { | |
| 970 result0 = (function(offset, num, dec, fee) { return num.join("") + "."
+ dec.join("") + fee; })(pos0, result0[0], result0[2], result0[3]); | |
| 971 } | |
| 972 if (result0 === null) { | |
| 973 pos = pos0; | |
| 974 } | |
| 975 return result0; | |
| 976 } | |
| 977 | |
| 978 function parse_dotFloat() { | |
| 979 var result0, result1, result2, result3; | |
| 980 var pos0, pos1; | |
| 981 | |
| 982 pos0 = pos; | |
| 983 pos1 = pos; | |
| 984 result0 = []; | |
| 985 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 986 result1 = input.charAt(pos); | |
| 987 pos++; | |
| 988 } else { | |
| 989 result1 = null; | |
| 990 if (reportFailures === 0) { | |
| 991 matchFailed("[0-9]"); | |
| 992 } | |
| 993 } | |
| 994 while (result1 !== null) { | |
| 995 result0.push(result1); | |
| 996 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 997 result1 = input.charAt(pos); | |
| 998 pos++; | |
| 999 } else { | |
| 1000 result1 = null; | |
| 1001 if (reportFailures === 0) { | |
| 1002 matchFailed("[0-9]"); | |
| 1003 } | |
| 1004 } | |
| 1005 } | |
| 1006 if (result0 !== null) { | |
| 1007 if (input.charCodeAt(pos) === 46) { | |
| 1008 result1 = "."; | |
| 1009 pos++; | |
| 1010 } else { | |
| 1011 result1 = null; | |
| 1012 if (reportFailures === 0) { | |
| 1013 matchFailed("\".\""); | |
| 1014 } | |
| 1015 } | |
| 1016 if (result1 !== null) { | |
| 1017 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 1018 result3 = input.charAt(pos); | |
| 1019 pos++; | |
| 1020 } else { | |
| 1021 result3 = null; | |
| 1022 if (reportFailures === 0) { | |
| 1023 matchFailed("[0-9]"); | |
| 1024 } | |
| 1025 } | |
| 1026 if (result3 !== null) { | |
| 1027 result2 = []; | |
| 1028 while (result3 !== null) { | |
| 1029 result2.push(result3); | |
| 1030 if (/^[0-9]/.test(input.charAt(pos))) { | |
| 1031 result3 = input.charAt(pos); | |
| 1032 pos++; | |
| 1033 } else { | |
| 1034 result3 = null; | |
| 1035 if (reportFailures === 0) { | |
| 1036 matchFailed("[0-9]"); | |
| 1037 } | |
| 1038 } | |
| 1039 } | |
| 1040 } else { | |
| 1041 result2 = null; | |
| 1042 } | |
| 1043 if (result2 !== null) { | |
| 1044 result3 = parse_floatEe(); | |
| 1045 result3 = result3 !== null ? result3 : ""; | |
| 1046 if (result3 !== null) { | |
| 1047 result0 = [result0, result1, result2, result3]; | |
| 1048 } else { | |
| 1049 result0 = null; | |
| 1050 pos = pos1; | |
| 1051 } | |
| 1052 } else { | |
| 1053 result0 = null; | |
| 1054 pos = pos1; | |
| 1055 } | |
| 1056 } else { | |
| 1057 result0 = null; | |
| 1058 pos = pos1; | |
| 1059 } | |
| 1060 } else { | |
| 1061 result0 = null; | |
| 1062 pos = pos1; | |
| 1063 } | |
| 1064 if (result0 !== null) { | |
| 1065 result0 = (function(offset, num, dec, fee) { return num.join("") + "."
+ dec.join("") + fee; })(pos0, result0[0], result0[2], result0[3]); | |
| 1066 } | |
| 1067 if (result0 === null) { | |
| 1068 pos = pos0; | |
| 1069 } | |
| 1070 return result0; | |
| 1071 } | |
| 1072 | |
| 1073 function parse_float() { | |
| 1074 var result0, result1; | |
| 1075 var pos0, pos1; | |
| 1076 | |
| 1077 pos0 = pos; | |
| 1078 pos1 = pos; | |
| 1079 if (input.charCodeAt(pos) === 45) { | |
| 1080 result0 = "-"; | |
| 1081 pos++; | |
| 1082 } else { | |
| 1083 result0 = null; | |
| 1084 if (reportFailures === 0) { | |
| 1085 matchFailed("\"-\""); | |
| 1086 } | |
| 1087 } | |
| 1088 result0 = result0 !== null ? result0 : ""; | |
| 1089 if (result0 !== null) { | |
| 1090 result1 = parse_leadFloat(); | |
| 1091 if (result1 === null) { | |
| 1092 result1 = parse_dotFloat(); | |
| 1093 if (result1 === null) { | |
| 1094 result1 = parse_expFloat(); | |
| 1095 if (result1 === null) { | |
| 1096 if (input.substr(pos, 8) === "Infinity") { | |
| 1097 result1 = "Infinity"; | |
| 1098 pos += 8; | |
| 1099 } else { | |
| 1100 result1 = null; | |
| 1101 if (reportFailures === 0) { | |
| 1102 matchFailed("\"Infinity\""); | |
| 1103 } | |
| 1104 } | |
| 1105 } | |
| 1106 } | |
| 1107 } | |
| 1108 if (result1 !== null) { | |
| 1109 result0 = [result0, result1]; | |
| 1110 } else { | |
| 1111 result0 = null; | |
| 1112 pos = pos1; | |
| 1113 } | |
| 1114 } else { | |
| 1115 result0 = null; | |
| 1116 pos = pos1; | |
| 1117 } | |
| 1118 if (result0 !== null) { | |
| 1119 result0 = (function(offset, neg, num) { return neg + num; })(pos0, res
ult0[0], result0[1]); | |
| 1120 } | |
| 1121 if (result0 === null) { | |
| 1122 pos = pos0; | |
| 1123 } | |
| 1124 return result0; | |
| 1125 } | |
| 1126 | |
| 1127 function parse_string() { | |
| 1128 var result0, result1, result2; | |
| 1129 var pos0, pos1; | |
| 1130 | |
| 1131 pos0 = pos; | |
| 1132 pos1 = pos; | |
| 1133 if (input.charCodeAt(pos) === 34) { | |
| 1134 result0 = "\""; | |
| 1135 pos++; | |
| 1136 } else { | |
| 1137 result0 = null; | |
| 1138 if (reportFailures === 0) { | |
| 1139 matchFailed("\"\\\"\""); | |
| 1140 } | |
| 1141 } | |
| 1142 if (result0 !== null) { | |
| 1143 result1 = []; | |
| 1144 if (/^[^""]/.test(input.charAt(pos))) { | |
| 1145 result2 = input.charAt(pos); | |
| 1146 pos++; | |
| 1147 } else { | |
| 1148 result2 = null; | |
| 1149 if (reportFailures === 0) { | |
| 1150 matchFailed("[^\"\"]"); | |
| 1151 } | |
| 1152 } | |
| 1153 while (result2 !== null) { | |
| 1154 result1.push(result2); | |
| 1155 if (/^[^""]/.test(input.charAt(pos))) { | |
| 1156 result2 = input.charAt(pos); | |
| 1157 pos++; | |
| 1158 } else { | |
| 1159 result2 = null; | |
| 1160 if (reportFailures === 0) { | |
| 1161 matchFailed("[^\"\"]"); | |
| 1162 } | |
| 1163 } | |
| 1164 } | |
| 1165 if (result1 !== null) { | |
| 1166 if (input.charCodeAt(pos) === 34) { | |
| 1167 result2 = "\""; | |
| 1168 pos++; | |
| 1169 } else { | |
| 1170 result2 = null; | |
| 1171 if (reportFailures === 0) { | |
| 1172 matchFailed("\"\\\"\""); | |
| 1173 } | |
| 1174 } | |
| 1175 if (result2 !== null) { | |
| 1176 result0 = [result0, result1, result2]; | |
| 1177 } else { | |
| 1178 result0 = null; | |
| 1179 pos = pos1; | |
| 1180 } | |
| 1181 } else { | |
| 1182 result0 = null; | |
| 1183 pos = pos1; | |
| 1184 } | |
| 1185 } else { | |
| 1186 result0 = null; | |
| 1187 pos = pos1; | |
| 1188 } | |
| 1189 if (result0 !== null) { | |
| 1190 result0 = (function(offset, str) { return str.join(""); })(pos0, resul
t0[1]); | |
| 1191 } | |
| 1192 if (result0 === null) { | |
| 1193 pos = pos0; | |
| 1194 } | |
| 1195 return result0; | |
| 1196 } | |
| 1197 | |
| 1198 function parse_other() { | |
| 1199 var result0, result1; | |
| 1200 var pos0; | |
| 1201 | |
| 1202 pos0 = pos; | |
| 1203 if (/^[^\t\n\r 0-9A-Z_a-z]/.test(input.charAt(pos))) { | |
| 1204 result1 = input.charAt(pos); | |
| 1205 pos++; | |
| 1206 } else { | |
| 1207 result1 = null; | |
| 1208 if (reportFailures === 0) { | |
| 1209 matchFailed("[^\\t\\n\\r 0-9A-Z_a-z]"); | |
| 1210 } | |
| 1211 } | |
| 1212 if (result1 !== null) { | |
| 1213 result0 = []; | |
| 1214 while (result1 !== null) { | |
| 1215 result0.push(result1); | |
| 1216 if (/^[^\t\n\r 0-9A-Z_a-z]/.test(input.charAt(pos))) { | |
| 1217 result1 = input.charAt(pos); | |
| 1218 pos++; | |
| 1219 } else { | |
| 1220 result1 = null; | |
| 1221 if (reportFailures === 0) { | |
| 1222 matchFailed("[^\\t\\n\\r 0-9A-Z_a-z]"); | |
| 1223 } | |
| 1224 } | |
| 1225 } | |
| 1226 } else { | |
| 1227 result0 = null; | |
| 1228 } | |
| 1229 if (result0 !== null) { | |
| 1230 result0 = (function(offset, other) { return other.join(""); })(pos0, r
esult0); | |
| 1231 } | |
| 1232 if (result0 === null) { | |
| 1233 pos = pos0; | |
| 1234 } | |
| 1235 return result0; | |
| 1236 } | |
| 1237 | |
| 1238 function parse_type() { | |
| 1239 var result0, result1; | |
| 1240 var pos0, pos1; | |
| 1241 | |
| 1242 pos0 = pos; | |
| 1243 pos1 = pos; | |
| 1244 result0 = parse_TypeDesc(); | |
| 1245 if (result0 !== null) { | |
| 1246 result1 = parse_Nullable(); | |
| 1247 if (result1 !== null) { | |
| 1248 result0 = [result0, result1]; | |
| 1249 } else { | |
| 1250 result0 = null; | |
| 1251 pos = pos1; | |
| 1252 } | |
| 1253 } else { | |
| 1254 result0 = null; | |
| 1255 pos = pos1; | |
| 1256 } | |
| 1257 if (result0 !== null) { | |
| 1258 result0 = (function(offset, type, nullable) { | |
| 1259 if (!type.sequence) type.sequence = false; | |
| 1260 type.nullable = nullable; | |
| 1261 return type; })(pos0, result0[0], result0[1]); | |
| 1262 } | |
| 1263 if (result0 === null) { | |
| 1264 pos = pos0; | |
| 1265 } | |
| 1266 return result0; | |
| 1267 } | |
| 1268 | |
| 1269 function parse_TypeDesc() { | |
| 1270 var result0; | |
| 1271 var pos0; | |
| 1272 | |
| 1273 pos0 = pos; | |
| 1274 result0 = parse_Sequence(); | |
| 1275 if (result0 === null) { | |
| 1276 result0 = parse_ArrayType(); | |
| 1277 if (result0 === null) { | |
| 1278 result0 = parse_SimpleType(); | |
| 1279 if (result0 === null) { | |
| 1280 result0 = parse_UnionType(); | |
| 1281 } | |
| 1282 } | |
| 1283 } | |
| 1284 if (result0 !== null) { | |
| 1285 result0 = (function(offset, type) { return type; })(pos0, result0); | |
| 1286 } | |
| 1287 if (result0 === null) { | |
| 1288 pos = pos0; | |
| 1289 } | |
| 1290 return result0; | |
| 1291 } | |
| 1292 | |
| 1293 function parse_Sequence() { | |
| 1294 var result0, result1, result2; | |
| 1295 var pos0, pos1; | |
| 1296 | |
| 1297 pos0 = pos; | |
| 1298 pos1 = pos; | |
| 1299 if (input.substr(pos, 9) === "sequence<") { | |
| 1300 result0 = "sequence<"; | |
| 1301 pos += 9; | |
| 1302 } else { | |
| 1303 result0 = null; | |
| 1304 if (reportFailures === 0) { | |
| 1305 matchFailed("\"sequence<\""); | |
| 1306 } | |
| 1307 } | |
| 1308 if (result0 !== null) { | |
| 1309 result1 = parse_type(); | |
| 1310 if (result1 !== null) { | |
| 1311 if (input.charCodeAt(pos) === 62) { | |
| 1312 result2 = ">"; | |
| 1313 pos++; | |
| 1314 } else { | |
| 1315 result2 = null; | |
| 1316 if (reportFailures === 0) { | |
| 1317 matchFailed("\">\""); | |
| 1318 } | |
| 1319 } | |
| 1320 if (result2 !== null) { | |
| 1321 result0 = [result0, result1, result2]; | |
| 1322 } else { | |
| 1323 result0 = null; | |
| 1324 pos = pos1; | |
| 1325 } | |
| 1326 } else { | |
| 1327 result0 = null; | |
| 1328 pos = pos1; | |
| 1329 } | |
| 1330 } else { | |
| 1331 result0 = null; | |
| 1332 pos = pos1; | |
| 1333 } | |
| 1334 if (result0 !== null) { | |
| 1335 result0 = (function(offset, type) { return { sequence: true, array: fa
lse, idlType: type, members: [] }; })(pos0, result0[1]); | |
| 1336 } | |
| 1337 if (result0 === null) { | |
| 1338 pos = pos0; | |
| 1339 } | |
| 1340 return result0; | |
| 1341 } | |
| 1342 | |
| 1343 function parse_ArrayType() { | |
| 1344 var result0, result1; | |
| 1345 var pos0, pos1; | |
| 1346 | |
| 1347 pos0 = pos; | |
| 1348 pos1 = pos; | |
| 1349 result0 = parse_SimpleType(); | |
| 1350 if (result0 !== null) { | |
| 1351 if (input.substr(pos, 2) === "[]") { | |
| 1352 result1 = "[]"; | |
| 1353 pos += 2; | |
| 1354 } else { | |
| 1355 result1 = null; | |
| 1356 if (reportFailures === 0) { | |
| 1357 matchFailed("\"[]\""); | |
| 1358 } | |
| 1359 } | |
| 1360 if (result1 !== null) { | |
| 1361 result0 = [result0, result1]; | |
| 1362 } else { | |
| 1363 result0 = null; | |
| 1364 pos = pos1; | |
| 1365 } | |
| 1366 } else { | |
| 1367 result0 = null; | |
| 1368 pos = pos1; | |
| 1369 } | |
| 1370 if (result0 !== null) { | |
| 1371 result0 = (function(offset, type) { | |
| 1372 type.array = true; | |
| 1373 return type; | |
| 1374 })(pos0, result0[0]); | |
| 1375 } | |
| 1376 if (result0 === null) { | |
| 1377 pos = pos0; | |
| 1378 } | |
| 1379 return result0; | |
| 1380 } | |
| 1381 | |
| 1382 function parse_UnionType() { | |
| 1383 var result0, result1, result2, result3, result4; | |
| 1384 var pos0, pos1; | |
| 1385 | |
| 1386 pos0 = pos; | |
| 1387 pos1 = pos; | |
| 1388 if (input.charCodeAt(pos) === 40) { | |
| 1389 result0 = "("; | |
| 1390 pos++; | |
| 1391 } else { | |
| 1392 result0 = null; | |
| 1393 if (reportFailures === 0) { | |
| 1394 matchFailed("\"(\""); | |
| 1395 } | |
| 1396 } | |
| 1397 if (result0 !== null) { | |
| 1398 result1 = parse_w(); | |
| 1399 if (result1 !== null) { | |
| 1400 result2 = parse_TypeList(); | |
| 1401 if (result2 !== null) { | |
| 1402 result3 = parse_w(); | |
| 1403 if (result3 !== null) { | |
| 1404 if (input.charCodeAt(pos) === 41) { | |
| 1405 result4 = ")"; | |
| 1406 pos++; | |
| 1407 } else { | |
| 1408 result4 = null; | |
| 1409 if (reportFailures === 0) { | |
| 1410 matchFailed("\")\""); | |
| 1411 } | |
| 1412 } | |
| 1413 if (result4 !== null) { | |
| 1414 result0 = [result0, result1, result2, result3, result4]; | |
| 1415 } else { | |
| 1416 result0 = null; | |
| 1417 pos = pos1; | |
| 1418 } | |
| 1419 } else { | |
| 1420 result0 = null; | |
| 1421 pos = pos1; | |
| 1422 } | |
| 1423 } else { | |
| 1424 result0 = null; | |
| 1425 pos = pos1; | |
| 1426 } | |
| 1427 } else { | |
| 1428 result0 = null; | |
| 1429 pos = pos1; | |
| 1430 } | |
| 1431 } else { | |
| 1432 result0 = null; | |
| 1433 pos = pos1; | |
| 1434 } | |
| 1435 if (result0 !== null) { | |
| 1436 result0 = (function(offset, members) { return { idlType: "union", memb
ers: members, sequence: false, array: false }; })(pos0, result0[2]); | |
| 1437 } | |
| 1438 if (result0 === null) { | |
| 1439 pos = pos0; | |
| 1440 } | |
| 1441 return result0; | |
| 1442 } | |
| 1443 | |
| 1444 function parse_TypeList() { | |
| 1445 var result0, result1, result2, result3, result4, result5, result6; | |
| 1446 var pos0, pos1; | |
| 1447 | |
| 1448 pos0 = pos; | |
| 1449 pos1 = pos; | |
| 1450 result0 = parse_type(); | |
| 1451 if (result0 !== null) { | |
| 1452 result1 = parse_s(); | |
| 1453 if (result1 !== null) { | |
| 1454 if (input.substr(pos, 2) === "or") { | |
| 1455 result2 = "or"; | |
| 1456 pos += 2; | |
| 1457 } else { | |
| 1458 result2 = null; | |
| 1459 if (reportFailures === 0) { | |
| 1460 matchFailed("\"or\""); | |
| 1461 } | |
| 1462 } | |
| 1463 if (result2 !== null) { | |
| 1464 result3 = parse_s(); | |
| 1465 if (result3 !== null) { | |
| 1466 result4 = parse_type(); | |
| 1467 if (result4 !== null) { | |
| 1468 result5 = []; | |
| 1469 result6 = parse_TypeListRest(); | |
| 1470 while (result6 !== null) { | |
| 1471 result5.push(result6); | |
| 1472 result6 = parse_TypeListRest(); | |
| 1473 } | |
| 1474 if (result5 !== null) { | |
| 1475 result0 = [result0, result1, result2, result3, result4, resu
lt5]; | |
| 1476 } else { | |
| 1477 result0 = null; | |
| 1478 pos = pos1; | |
| 1479 } | |
| 1480 } else { | |
| 1481 result0 = null; | |
| 1482 pos = pos1; | |
| 1483 } | |
| 1484 } else { | |
| 1485 result0 = null; | |
| 1486 pos = pos1; | |
| 1487 } | |
| 1488 } else { | |
| 1489 result0 = null; | |
| 1490 pos = pos1; | |
| 1491 } | |
| 1492 } else { | |
| 1493 result0 = null; | |
| 1494 pos = pos1; | |
| 1495 } | |
| 1496 } else { | |
| 1497 result0 = null; | |
| 1498 pos = pos1; | |
| 1499 } | |
| 1500 if (result0 !== null) { | |
| 1501 result0 = (function(offset, first, second, others) { var ret = [firs
t, second]; | |
| 1502 for (var i = 0, n = others.length; i < n; i++) { ret.push(ot
hers[i]); } | |
| 1503 return ret; })(pos0, result0[0], result0[4], result0[5]); | |
| 1504 } | |
| 1505 if (result0 === null) { | |
| 1506 pos = pos0; | |
| 1507 } | |
| 1508 return result0; | |
| 1509 } | |
| 1510 | |
| 1511 function parse_TypeListRest() { | |
| 1512 var result0, result1, result2, result3; | |
| 1513 var pos0, pos1; | |
| 1514 | |
| 1515 pos0 = pos; | |
| 1516 pos1 = pos; | |
| 1517 result0 = parse_s(); | |
| 1518 if (result0 !== null) { | |
| 1519 if (input.substr(pos, 2) === "or") { | |
| 1520 result1 = "or"; | |
| 1521 pos += 2; | |
| 1522 } else { | |
| 1523 result1 = null; | |
| 1524 if (reportFailures === 0) { | |
| 1525 matchFailed("\"or\""); | |
| 1526 } | |
| 1527 } | |
| 1528 if (result1 !== null) { | |
| 1529 result2 = parse_s(); | |
| 1530 if (result2 !== null) { | |
| 1531 result3 = parse_type(); | |
| 1532 if (result3 !== null) { | |
| 1533 result0 = [result0, result1, result2, result3]; | |
| 1534 } else { | |
| 1535 result0 = null; | |
| 1536 pos = pos1; | |
| 1537 } | |
| 1538 } else { | |
| 1539 result0 = null; | |
| 1540 pos = pos1; | |
| 1541 } | |
| 1542 } else { | |
| 1543 result0 = null; | |
| 1544 pos = pos1; | |
| 1545 } | |
| 1546 } else { | |
| 1547 result0 = null; | |
| 1548 pos = pos1; | |
| 1549 } | |
| 1550 if (result0 !== null) { | |
| 1551 result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); | |
| 1552 } | |
| 1553 if (result0 === null) { | |
| 1554 pos = pos0; | |
| 1555 } | |
| 1556 return result0; | |
| 1557 } | |
| 1558 | |
| 1559 function parse_SimpleType() { | |
| 1560 var result0; | |
| 1561 var pos0; | |
| 1562 | |
| 1563 pos0 = pos; | |
| 1564 result0 = parse_PrimitiveType(); | |
| 1565 if (result0 === null) { | |
| 1566 result0 = parse_UnsignedIntegerType(); | |
| 1567 if (result0 === null) { | |
| 1568 result0 = parse_FloatType(); | |
| 1569 if (result0 === null) { | |
| 1570 result0 = parse_ScopedName(); | |
| 1571 } | |
| 1572 } | |
| 1573 } | |
| 1574 if (result0 !== null) { | |
| 1575 result0 = (function(offset, type) { return { sequence: false, array: f
alse, idlType: type, members: [] }; })(pos0, result0); | |
| 1576 } | |
| 1577 if (result0 === null) { | |
| 1578 pos = pos0; | |
| 1579 } | |
| 1580 return result0; | |
| 1581 } | |
| 1582 | |
| 1583 function parse_PrimitiveType() { | |
| 1584 var result0, result1; | |
| 1585 var pos0, pos1, pos2; | |
| 1586 | |
| 1587 pos0 = pos; | |
| 1588 pos1 = pos; | |
| 1589 if (input.substr(pos, 3) === "any") { | |
| 1590 result0 = "any"; | |
| 1591 pos += 3; | |
| 1592 } else { | |
| 1593 result0 = null; | |
| 1594 if (reportFailures === 0) { | |
| 1595 matchFailed("\"any\""); | |
| 1596 } | |
| 1597 } | |
| 1598 if (result0 === null) { | |
| 1599 if (input.substr(pos, 6) === "object") { | |
| 1600 result0 = "object"; | |
| 1601 pos += 6; | |
| 1602 } else { | |
| 1603 result0 = null; | |
| 1604 if (reportFailures === 0) { | |
| 1605 matchFailed("\"object\""); | |
| 1606 } | |
| 1607 } | |
| 1608 if (result0 === null) { | |
| 1609 if (input.substr(pos, 7) === "boolean") { | |
| 1610 result0 = "boolean"; | |
| 1611 pos += 7; | |
| 1612 } else { | |
| 1613 result0 = null; | |
| 1614 if (reportFailures === 0) { | |
| 1615 matchFailed("\"boolean\""); | |
| 1616 } | |
| 1617 } | |
| 1618 if (result0 === null) { | |
| 1619 if (input.substr(pos, 5) === "octet") { | |
| 1620 result0 = "octet"; | |
| 1621 pos += 5; | |
| 1622 } else { | |
| 1623 result0 = null; | |
| 1624 if (reportFailures === 0) { | |
| 1625 matchFailed("\"octet\""); | |
| 1626 } | |
| 1627 } | |
| 1628 if (result0 === null) { | |
| 1629 if (input.substr(pos, 9) === "DOMString") { | |
| 1630 result0 = "DOMString"; | |
| 1631 pos += 9; | |
| 1632 } else { | |
| 1633 result0 = null; | |
| 1634 if (reportFailures === 0) { | |
| 1635 matchFailed("\"DOMString\""); | |
| 1636 } | |
| 1637 } | |
| 1638 } | |
| 1639 } | |
| 1640 } | |
| 1641 } | |
| 1642 if (result0 !== null) { | |
| 1643 pos2 = pos; | |
| 1644 reportFailures++; | |
| 1645 if (/^[A-Za-z0-9]/.test(input.charAt(pos))) { | |
| 1646 result1 = input.charAt(pos); | |
| 1647 pos++; | |
| 1648 } else { | |
| 1649 result1 = null; | |
| 1650 if (reportFailures === 0) { | |
| 1651 matchFailed("[A-Za-z0-9]"); | |
| 1652 } | |
| 1653 } | |
| 1654 reportFailures--; | |
| 1655 if (result1 === null) { | |
| 1656 result1 = ""; | |
| 1657 } else { | |
| 1658 result1 = null; | |
| 1659 pos = pos2; | |
| 1660 } | |
| 1661 if (result1 !== null) { | |
| 1662 result0 = [result0, result1]; | |
| 1663 } else { | |
| 1664 result0 = null; | |
| 1665 pos = pos1; | |
| 1666 } | |
| 1667 } else { | |
| 1668 result0 = null; | |
| 1669 pos = pos1; | |
| 1670 } | |
| 1671 if (result0 !== null) { | |
| 1672 result0 = (function(offset, type) { return type; })(pos0, result0[0]); | |
| 1673 } | |
| 1674 if (result0 === null) { | |
| 1675 pos = pos0; | |
| 1676 } | |
| 1677 return result0; | |
| 1678 } | |
| 1679 | |
| 1680 function parse_FloatType() { | |
| 1681 var result0, result1, result2; | |
| 1682 var pos0, pos1; | |
| 1683 | |
| 1684 pos0 = pos; | |
| 1685 pos1 = pos; | |
| 1686 if (input.substr(pos, 12) === "unrestricted") { | |
| 1687 result0 = "unrestricted"; | |
| 1688 pos += 12; | |
| 1689 } else { | |
| 1690 result0 = null; | |
| 1691 if (reportFailures === 0) { | |
| 1692 matchFailed("\"unrestricted\""); | |
| 1693 } | |
| 1694 } | |
| 1695 result0 = result0 !== null ? result0 : ""; | |
| 1696 if (result0 !== null) { | |
| 1697 result1 = parse_s(); | |
| 1698 if (result1 !== null) { | |
| 1699 if (input.substr(pos, 5) === "float") { | |
| 1700 result2 = "float"; | |
| 1701 pos += 5; | |
| 1702 } else { | |
| 1703 result2 = null; | |
| 1704 if (reportFailures === 0) { | |
| 1705 matchFailed("\"float\""); | |
| 1706 } | |
| 1707 } | |
| 1708 if (result2 === null) { | |
| 1709 if (input.substr(pos, 6) === "double") { | |
| 1710 result2 = "double"; | |
| 1711 pos += 6; | |
| 1712 } else { | |
| 1713 result2 = null; | |
| 1714 if (reportFailures === 0) { | |
| 1715 matchFailed("\"double\""); | |
| 1716 } | |
| 1717 } | |
| 1718 } | |
| 1719 if (result2 !== null) { | |
| 1720 result0 = [result0, result1, result2]; | |
| 1721 } else { | |
| 1722 result0 = null; | |
| 1723 pos = pos1; | |
| 1724 } | |
| 1725 } else { | |
| 1726 result0 = null; | |
| 1727 pos = pos1; | |
| 1728 } | |
| 1729 } else { | |
| 1730 result0 = null; | |
| 1731 pos = pos1; | |
| 1732 } | |
| 1733 if (result0 !== null) { | |
| 1734 result0 = (function(offset, unr, kind) { return (unr ? "unrestricted "
: "") + (kind); })(pos0, result0[0], result0[2]); | |
| 1735 } | |
| 1736 if (result0 === null) { | |
| 1737 pos = pos0; | |
| 1738 } | |
| 1739 return result0; | |
| 1740 } | |
| 1741 | |
| 1742 function parse_UnsignedIntegerType() { | |
| 1743 var result0, result1, result2, result3, result4; | |
| 1744 var pos0, pos1, pos2; | |
| 1745 | |
| 1746 pos0 = pos; | |
| 1747 pos1 = pos; | |
| 1748 if (input.substr(pos, 8) === "unsigned") { | |
| 1749 result0 = "unsigned"; | |
| 1750 pos += 8; | |
| 1751 } else { | |
| 1752 result0 = null; | |
| 1753 if (reportFailures === 0) { | |
| 1754 matchFailed("\"unsigned\""); | |
| 1755 } | |
| 1756 } | |
| 1757 result0 = result0 !== null ? result0 : ""; | |
| 1758 if (result0 !== null) { | |
| 1759 result1 = parse_s(); | |
| 1760 if (result1 !== null) { | |
| 1761 pos2 = pos; | |
| 1762 if (input.substr(pos, 4) === "long") { | |
| 1763 result2 = "long"; | |
| 1764 pos += 4; | |
| 1765 } else { | |
| 1766 result2 = null; | |
| 1767 if (reportFailures === 0) { | |
| 1768 matchFailed("\"long\""); | |
| 1769 } | |
| 1770 } | |
| 1771 if (result2 !== null) { | |
| 1772 result3 = parse_s(); | |
| 1773 if (result3 !== null) { | |
| 1774 if (input.substr(pos, 4) === "long") { | |
| 1775 result4 = "long"; | |
| 1776 pos += 4; | |
| 1777 } else { | |
| 1778 result4 = null; | |
| 1779 if (reportFailures === 0) { | |
| 1780 matchFailed("\"long\""); | |
| 1781 } | |
| 1782 } | |
| 1783 if (result4 !== null) { | |
| 1784 result2 = [result2, result3, result4]; | |
| 1785 } else { | |
| 1786 result2 = null; | |
| 1787 pos = pos2; | |
| 1788 } | |
| 1789 } else { | |
| 1790 result2 = null; | |
| 1791 pos = pos2; | |
| 1792 } | |
| 1793 } else { | |
| 1794 result2 = null; | |
| 1795 pos = pos2; | |
| 1796 } | |
| 1797 if (result2 === null) { | |
| 1798 if (input.substr(pos, 4) === "long") { | |
| 1799 result2 = "long"; | |
| 1800 pos += 4; | |
| 1801 } else { | |
| 1802 result2 = null; | |
| 1803 if (reportFailures === 0) { | |
| 1804 matchFailed("\"long\""); | |
| 1805 } | |
| 1806 } | |
| 1807 if (result2 === null) { | |
| 1808 if (input.substr(pos, 5) === "short") { | |
| 1809 result2 = "short"; | |
| 1810 pos += 5; | |
| 1811 } else { | |
| 1812 result2 = null; | |
| 1813 if (reportFailures === 0) { | |
| 1814 matchFailed("\"short\""); | |
| 1815 } | |
| 1816 } | |
| 1817 if (result2 === null) { | |
| 1818 if (input.substr(pos, 4) === "byte") { | |
| 1819 result2 = "byte"; | |
| 1820 pos += 4; | |
| 1821 } else { | |
| 1822 result2 = null; | |
| 1823 if (reportFailures === 0) { | |
| 1824 matchFailed("\"byte\""); | |
| 1825 } | |
| 1826 } | |
| 1827 } | |
| 1828 } | |
| 1829 } | |
| 1830 if (result2 !== null) { | |
| 1831 result0 = [result0, result1, result2]; | |
| 1832 } else { | |
| 1833 result0 = null; | |
| 1834 pos = pos1; | |
| 1835 } | |
| 1836 } else { | |
| 1837 result0 = null; | |
| 1838 pos = pos1; | |
| 1839 } | |
| 1840 } else { | |
| 1841 result0 = null; | |
| 1842 pos = pos1; | |
| 1843 } | |
| 1844 if (result0 !== null) { | |
| 1845 result0 = (function(offset, uns, kind) { return (uns ? "unsigned " : "
") + (kind.join ? kind.join("") : kind); })(pos0, result0[0], result0[2]); | |
| 1846 } | |
| 1847 if (result0 === null) { | |
| 1848 pos = pos0; | |
| 1849 } | |
| 1850 return result0; | |
| 1851 } | |
| 1852 | |
| 1853 function parse_ScopedNameList() { | |
| 1854 var result0, result1, result2; | |
| 1855 var pos0, pos1; | |
| 1856 | |
| 1857 pos0 = pos; | |
| 1858 pos1 = pos; | |
| 1859 result0 = parse_ScopedName(); | |
| 1860 if (result0 !== null) { | |
| 1861 result1 = []; | |
| 1862 result2 = parse_ScopedNameListRest(); | |
| 1863 while (result2 !== null) { | |
| 1864 result1.push(result2); | |
| 1865 result2 = parse_ScopedNameListRest(); | |
| 1866 } | |
| 1867 if (result1 !== null) { | |
| 1868 result0 = [result0, result1]; | |
| 1869 } else { | |
| 1870 result0 = null; | |
| 1871 pos = pos1; | |
| 1872 } | |
| 1873 } else { | |
| 1874 result0 = null; | |
| 1875 pos = pos1; | |
| 1876 } | |
| 1877 if (result0 !== null) { | |
| 1878 result0 = (function(offset, first, others) { var ret = [first]; | |
| 1879 for (var i = 0, n = others.length; i < n; i++) { ret.push(ot
hers[i]); } | |
| 1880 return ret; })(pos0, result0[0], result0[1]); | |
| 1881 } | |
| 1882 if (result0 === null) { | |
| 1883 pos = pos0; | |
| 1884 } | |
| 1885 return result0; | |
| 1886 } | |
| 1887 | |
| 1888 function parse_ScopedNameListRest() { | |
| 1889 var result0, result1, result2, result3; | |
| 1890 var pos0, pos1; | |
| 1891 | |
| 1892 pos0 = pos; | |
| 1893 pos1 = pos; | |
| 1894 result0 = parse_w(); | |
| 1895 if (result0 !== null) { | |
| 1896 if (input.charCodeAt(pos) === 44) { | |
| 1897 result1 = ","; | |
| 1898 pos++; | |
| 1899 } else { | |
| 1900 result1 = null; | |
| 1901 if (reportFailures === 0) { | |
| 1902 matchFailed("\",\""); | |
| 1903 } | |
| 1904 } | |
| 1905 if (result1 !== null) { | |
| 1906 result2 = parse_w(); | |
| 1907 if (result2 !== null) { | |
| 1908 result3 = parse_ScopedName(); | |
| 1909 if (result3 !== null) { | |
| 1910 result0 = [result0, result1, result2, result3]; | |
| 1911 } else { | |
| 1912 result0 = null; | |
| 1913 pos = pos1; | |
| 1914 } | |
| 1915 } else { | |
| 1916 result0 = null; | |
| 1917 pos = pos1; | |
| 1918 } | |
| 1919 } else { | |
| 1920 result0 = null; | |
| 1921 pos = pos1; | |
| 1922 } | |
| 1923 } else { | |
| 1924 result0 = null; | |
| 1925 pos = pos1; | |
| 1926 } | |
| 1927 if (result0 !== null) { | |
| 1928 result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); | |
| 1929 } | |
| 1930 if (result0 === null) { | |
| 1931 pos = pos0; | |
| 1932 } | |
| 1933 return result0; | |
| 1934 } | |
| 1935 | |
| 1936 function parse_ScopedName() { | |
| 1937 var result0; | |
| 1938 var pos0; | |
| 1939 | |
| 1940 pos0 = pos; | |
| 1941 result0 = parse_AbsoluteScopedName(); | |
| 1942 if (result0 === null) { | |
| 1943 result0 = parse_RelativeScopedName(); | |
| 1944 } | |
| 1945 if (result0 !== null) { | |
| 1946 result0 = (function(offset, name) { return name; })(pos0, result0); | |
| 1947 } | |
| 1948 if (result0 === null) { | |
| 1949 pos = pos0; | |
| 1950 } | |
| 1951 return result0; | |
| 1952 } | |
| 1953 | |
| 1954 function parse_AbsoluteScopedName() { | |
| 1955 var result0, result1; | |
| 1956 var pos0, pos1; | |
| 1957 | |
| 1958 pos0 = pos; | |
| 1959 pos1 = pos; | |
| 1960 if (input.substr(pos, 2) === "::") { | |
| 1961 result0 = "::"; | |
| 1962 pos += 2; | |
| 1963 } else { | |
| 1964 result0 = null; | |
| 1965 if (reportFailures === 0) { | |
| 1966 matchFailed("\"::\""); | |
| 1967 } | |
| 1968 } | |
| 1969 if (result0 !== null) { | |
| 1970 result1 = parse_RelativeScopedName(); | |
| 1971 if (result1 !== null) { | |
| 1972 result0 = [result0, result1]; | |
| 1973 } else { | |
| 1974 result0 = null; | |
| 1975 pos = pos1; | |
| 1976 } | |
| 1977 } else { | |
| 1978 result0 = null; | |
| 1979 pos = pos1; | |
| 1980 } | |
| 1981 if (result0 !== null) { | |
| 1982 result0 = (function(offset, rel) { return "::" + rel; })(pos0, result0
[1]); | |
| 1983 } | |
| 1984 if (result0 === null) { | |
| 1985 pos = pos0; | |
| 1986 } | |
| 1987 return result0; | |
| 1988 } | |
| 1989 | |
| 1990 function parse_RelativeScopedName() { | |
| 1991 var result0, result1, result2; | |
| 1992 var pos0, pos1; | |
| 1993 | |
| 1994 pos0 = pos; | |
| 1995 pos1 = pos; | |
| 1996 result0 = parse_identifier(); | |
| 1997 if (result0 !== null) { | |
| 1998 result1 = []; | |
| 1999 result2 = parse_ScopedNameRest(); | |
| 2000 while (result2 !== null) { | |
| 2001 result1.push(result2); | |
| 2002 result2 = parse_ScopedNameRest(); | |
| 2003 } | |
| 2004 if (result1 !== null) { | |
| 2005 result0 = [result0, result1]; | |
| 2006 } else { | |
| 2007 result0 = null; | |
| 2008 pos = pos1; | |
| 2009 } | |
| 2010 } else { | |
| 2011 result0 = null; | |
| 2012 pos = pos1; | |
| 2013 } | |
| 2014 if (result0 !== null) { | |
| 2015 result0 = (function(offset, name, rest) { return name + rest.join("");
})(pos0, result0[0], result0[1]); | |
| 2016 } | |
| 2017 if (result0 === null) { | |
| 2018 pos = pos0; | |
| 2019 } | |
| 2020 return result0; | |
| 2021 } | |
| 2022 | |
| 2023 function parse_ScopedNameRest() { | |
| 2024 var result0, result1; | |
| 2025 var pos0, pos1; | |
| 2026 | |
| 2027 pos0 = pos; | |
| 2028 pos1 = pos; | |
| 2029 if (input.substr(pos, 2) === "::") { | |
| 2030 result0 = "::"; | |
| 2031 pos += 2; | |
| 2032 } else { | |
| 2033 result0 = null; | |
| 2034 if (reportFailures === 0) { | |
| 2035 matchFailed("\"::\""); | |
| 2036 } | |
| 2037 } | |
| 2038 if (result0 !== null) { | |
| 2039 result1 = parse_identifier(); | |
| 2040 if (result1 !== null) { | |
| 2041 result0 = [result0, result1]; | |
| 2042 } else { | |
| 2043 result0 = null; | |
| 2044 pos = pos1; | |
| 2045 } | |
| 2046 } else { | |
| 2047 result0 = null; | |
| 2048 pos = pos1; | |
| 2049 } | |
| 2050 if (result0 !== null) { | |
| 2051 result0 = (function(offset, name) { return name.join(""); })(pos0, res
ult0); | |
| 2052 } | |
| 2053 if (result0 === null) { | |
| 2054 pos = pos0; | |
| 2055 } | |
| 2056 return result0; | |
| 2057 } | |
| 2058 | |
| 2059 function parse_BooleanLiteral() { | |
| 2060 var result0; | |
| 2061 var pos0; | |
| 2062 | |
| 2063 pos0 = pos; | |
| 2064 if (input.substr(pos, 4) === "true") { | |
| 2065 result0 = "true"; | |
| 2066 pos += 4; | |
| 2067 } else { | |
| 2068 result0 = null; | |
| 2069 if (reportFailures === 0) { | |
| 2070 matchFailed("\"true\""); | |
| 2071 } | |
| 2072 } | |
| 2073 if (result0 === null) { | |
| 2074 if (input.substr(pos, 5) === "false") { | |
| 2075 result0 = "false"; | |
| 2076 pos += 5; | |
| 2077 } else { | |
| 2078 result0 = null; | |
| 2079 if (reportFailures === 0) { | |
| 2080 matchFailed("\"false\""); | |
| 2081 } | |
| 2082 } | |
| 2083 } | |
| 2084 if (result0 !== null) { | |
| 2085 result0 = (function(offset, value) { return value; })(pos0, result0); | |
| 2086 } | |
| 2087 if (result0 === null) { | |
| 2088 pos = pos0; | |
| 2089 } | |
| 2090 return result0; | |
| 2091 } | |
| 2092 | |
| 2093 function parse_Nullable() { | |
| 2094 var result0; | |
| 2095 var pos0; | |
| 2096 | |
| 2097 pos0 = pos; | |
| 2098 if (input.charCodeAt(pos) === 63) { | |
| 2099 result0 = "?"; | |
| 2100 pos++; | |
| 2101 } else { | |
| 2102 result0 = null; | |
| 2103 if (reportFailures === 0) { | |
| 2104 matchFailed("\"?\""); | |
| 2105 } | |
| 2106 } | |
| 2107 result0 = result0 !== null ? result0 : ""; | |
| 2108 if (result0 !== null) { | |
| 2109 result0 = (function(offset, nullable) { return nullable ? true : false
; })(pos0, result0); | |
| 2110 } | |
| 2111 if (result0 === null) { | |
| 2112 pos = pos0; | |
| 2113 } | |
| 2114 return result0; | |
| 2115 } | |
| 2116 | |
| 2117 function parse_ReturnType() { | |
| 2118 var result0; | |
| 2119 var pos0; | |
| 2120 | |
| 2121 pos0 = pos; | |
| 2122 if (input.substr(pos, 4) === "void") { | |
| 2123 result0 = "void"; | |
| 2124 pos += 4; | |
| 2125 } else { | |
| 2126 result0 = null; | |
| 2127 if (reportFailures === 0) { | |
| 2128 matchFailed("\"void\""); | |
| 2129 } | |
| 2130 } | |
| 2131 if (result0 === null) { | |
| 2132 result0 = parse_type(); | |
| 2133 } | |
| 2134 if (result0 !== null) { | |
| 2135 result0 = (function(offset, ret) { return ret; })(pos0, result0); | |
| 2136 } | |
| 2137 if (result0 === null) { | |
| 2138 pos = pos0; | |
| 2139 } | |
| 2140 return result0; | |
| 2141 } | |
| 2142 | |
| 2143 function parse_definitions() { | |
| 2144 var result0, result1, result2; | |
| 2145 var pos0, pos1; | |
| 2146 | |
| 2147 pos0 = pos; | |
| 2148 pos1 = pos; | |
| 2149 result0 = parse_w(); | |
| 2150 if (result0 !== null) { | |
| 2151 result1 = []; | |
| 2152 result2 = parse_definition(); | |
| 2153 while (result2 !== null) { | |
| 2154 result1.push(result2); | |
| 2155 result2 = parse_definition(); | |
| 2156 } | |
| 2157 if (result1 !== null) { | |
| 2158 result0 = [result0, result1]; | |
| 2159 } else { | |
| 2160 result0 = null; | |
| 2161 pos = pos1; | |
| 2162 } | |
| 2163 } else { | |
| 2164 result0 = null; | |
| 2165 pos = pos1; | |
| 2166 } | |
| 2167 if (result0 !== null) { | |
| 2168 result0 = (function(offset, defs) { return defs; })(pos0, result0[1]); | |
| 2169 } | |
| 2170 if (result0 === null) { | |
| 2171 pos = pos0; | |
| 2172 } | |
| 2173 return result0; | |
| 2174 } | |
| 2175 | |
| 2176 function parse_definition() { | |
| 2177 var result0; | |
| 2178 var pos0; | |
| 2179 | |
| 2180 pos0 = pos; | |
| 2181 result0 = parse_partialdictionary(); | |
| 2182 if (result0 === null) { | |
| 2183 result0 = parse_partialinterface(); | |
| 2184 if (result0 === null) { | |
| 2185 result0 = parse_callbackinterface(); | |
| 2186 if (result0 === null) { | |
| 2187 result0 = parse_module(); | |
| 2188 if (result0 === null) { | |
| 2189 result0 = parse_interface(); | |
| 2190 if (result0 === null) { | |
| 2191 result0 = parse_dictionary(); | |
| 2192 if (result0 === null) { | |
| 2193 result0 = parse_typedef(); | |
| 2194 if (result0 === null) { | |
| 2195 result0 = parse_exception(); | |
| 2196 if (result0 === null) { | |
| 2197 result0 = parse_implements(); | |
| 2198 if (result0 === null) { | |
| 2199 result0 = parse_enum(); | |
| 2200 if (result0 === null) { | |
| 2201 result0 = parse_callback(); | |
| 2202 } | |
| 2203 } | |
| 2204 } | |
| 2205 } | |
| 2206 } | |
| 2207 } | |
| 2208 } | |
| 2209 } | |
| 2210 } | |
| 2211 } | |
| 2212 if (result0 !== null) { | |
| 2213 result0 = (function(offset, def) { return def; })(pos0, result0); | |
| 2214 } | |
| 2215 if (result0 === null) { | |
| 2216 pos = pos0; | |
| 2217 } | |
| 2218 return result0; | |
| 2219 } | |
| 2220 | |
| 2221 function parse_partialinterface() { | |
| 2222 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13, result14, result15
; | |
| 2223 var pos0, pos1; | |
| 2224 | |
| 2225 pos0 = pos; | |
| 2226 pos1 = pos; | |
| 2227 result0 = parse_ExtendedAttributeList(); | |
| 2228 if (result0 !== null) { | |
| 2229 result1 = parse_s(); | |
| 2230 result1 = result1 !== null ? result1 : ""; | |
| 2231 if (result1 !== null) { | |
| 2232 if (input.substr(pos, 7) === "partial") { | |
| 2233 result2 = "partial"; | |
| 2234 pos += 7; | |
| 2235 } else { | |
| 2236 result2 = null; | |
| 2237 if (reportFailures === 0) { | |
| 2238 matchFailed("\"partial\""); | |
| 2239 } | |
| 2240 } | |
| 2241 if (result2 !== null) { | |
| 2242 result3 = parse_s(); | |
| 2243 if (result3 !== null) { | |
| 2244 if (input.substr(pos, 9) === "interface") { | |
| 2245 result4 = "interface"; | |
| 2246 pos += 9; | |
| 2247 } else { | |
| 2248 result4 = null; | |
| 2249 if (reportFailures === 0) { | |
| 2250 matchFailed("\"interface\""); | |
| 2251 } | |
| 2252 } | |
| 2253 if (result4 !== null) { | |
| 2254 result5 = parse_s(); | |
| 2255 if (result5 !== null) { | |
| 2256 result6 = parse_identifier(); | |
| 2257 if (result6 !== null) { | |
| 2258 result7 = parse_w(); | |
| 2259 if (result7 !== null) { | |
| 2260 if (input.charCodeAt(pos) === 123) { | |
| 2261 result8 = "{"; | |
| 2262 pos++; | |
| 2263 } else { | |
| 2264 result8 = null; | |
| 2265 if (reportFailures === 0) { | |
| 2266 matchFailed("\"{\""); | |
| 2267 } | |
| 2268 } | |
| 2269 if (result8 !== null) { | |
| 2270 result9 = parse_w(); | |
| 2271 if (result9 !== null) { | |
| 2272 result10 = parse_InterfaceMemberList(); | |
| 2273 if (result10 !== null) { | |
| 2274 result11 = parse_w(); | |
| 2275 if (result11 !== null) { | |
| 2276 if (input.charCodeAt(pos) === 125) { | |
| 2277 result12 = "}"; | |
| 2278 pos++; | |
| 2279 } else { | |
| 2280 result12 = null; | |
| 2281 if (reportFailures === 0) { | |
| 2282 matchFailed("\"}\""); | |
| 2283 } | |
| 2284 } | |
| 2285 if (result12 !== null) { | |
| 2286 result13 = parse_w(); | |
| 2287 if (result13 !== null) { | |
| 2288 if (input.charCodeAt(pos) === 59) { | |
| 2289 result14 = ";"; | |
| 2290 pos++; | |
| 2291 } else { | |
| 2292 result14 = null; | |
| 2293 if (reportFailures === 0) { | |
| 2294 matchFailed("\";\""); | |
| 2295 } | |
| 2296 } | |
| 2297 if (result14 !== null) { | |
| 2298 result15 = parse_w(); | |
| 2299 if (result15 !== null) { | |
| 2300 result0 = [result0, result1, result2, re
sult3, result4, result5, result6, result7, result8, result9, result10, result11,
result12, result13, result14, result15]; | |
| 2301 } else { | |
| 2302 result0 = null; | |
| 2303 pos = pos1; | |
| 2304 } | |
| 2305 } else { | |
| 2306 result0 = null; | |
| 2307 pos = pos1; | |
| 2308 } | |
| 2309 } else { | |
| 2310 result0 = null; | |
| 2311 pos = pos1; | |
| 2312 } | |
| 2313 } else { | |
| 2314 result0 = null; | |
| 2315 pos = pos1; | |
| 2316 } | |
| 2317 } else { | |
| 2318 result0 = null; | |
| 2319 pos = pos1; | |
| 2320 } | |
| 2321 } else { | |
| 2322 result0 = null; | |
| 2323 pos = pos1; | |
| 2324 } | |
| 2325 } else { | |
| 2326 result0 = null; | |
| 2327 pos = pos1; | |
| 2328 } | |
| 2329 } else { | |
| 2330 result0 = null; | |
| 2331 pos = pos1; | |
| 2332 } | |
| 2333 } else { | |
| 2334 result0 = null; | |
| 2335 pos = pos1; | |
| 2336 } | |
| 2337 } else { | |
| 2338 result0 = null; | |
| 2339 pos = pos1; | |
| 2340 } | |
| 2341 } else { | |
| 2342 result0 = null; | |
| 2343 pos = pos1; | |
| 2344 } | |
| 2345 } else { | |
| 2346 result0 = null; | |
| 2347 pos = pos1; | |
| 2348 } | |
| 2349 } else { | |
| 2350 result0 = null; | |
| 2351 pos = pos1; | |
| 2352 } | |
| 2353 } else { | |
| 2354 result0 = null; | |
| 2355 pos = pos1; | |
| 2356 } | |
| 2357 } else { | |
| 2358 result0 = null; | |
| 2359 pos = pos1; | |
| 2360 } | |
| 2361 } else { | |
| 2362 result0 = null; | |
| 2363 pos = pos1; | |
| 2364 } | |
| 2365 if (result0 !== null) { | |
| 2366 result0 = (function(offset, extAttrs, name, mem) { return { type: "par
tialinterface", name: name, members: mem, extAttrs: extAttrs }; })(pos0, result0
[0], result0[6], result0[10]); | |
| 2367 } | |
| 2368 if (result0 === null) { | |
| 2369 pos = pos0; | |
| 2370 } | |
| 2371 return result0; | |
| 2372 } | |
| 2373 | |
| 2374 function parse_partialdictionary() { | |
| 2375 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13; | |
| 2376 var pos0, pos1; | |
| 2377 | |
| 2378 pos0 = pos; | |
| 2379 pos1 = pos; | |
| 2380 if (input.substr(pos, 7) === "partial") { | |
| 2381 result0 = "partial"; | |
| 2382 pos += 7; | |
| 2383 } else { | |
| 2384 result0 = null; | |
| 2385 if (reportFailures === 0) { | |
| 2386 matchFailed("\"partial\""); | |
| 2387 } | |
| 2388 } | |
| 2389 if (result0 !== null) { | |
| 2390 result1 = parse_s(); | |
| 2391 if (result1 !== null) { | |
| 2392 if (input.substr(pos, 10) === "dictionary") { | |
| 2393 result2 = "dictionary"; | |
| 2394 pos += 10; | |
| 2395 } else { | |
| 2396 result2 = null; | |
| 2397 if (reportFailures === 0) { | |
| 2398 matchFailed("\"dictionary\""); | |
| 2399 } | |
| 2400 } | |
| 2401 if (result2 !== null) { | |
| 2402 result3 = parse_s(); | |
| 2403 if (result3 !== null) { | |
| 2404 result4 = parse_identifier(); | |
| 2405 if (result4 !== null) { | |
| 2406 result5 = parse_w(); | |
| 2407 if (result5 !== null) { | |
| 2408 if (input.charCodeAt(pos) === 123) { | |
| 2409 result6 = "{"; | |
| 2410 pos++; | |
| 2411 } else { | |
| 2412 result6 = null; | |
| 2413 if (reportFailures === 0) { | |
| 2414 matchFailed("\"{\""); | |
| 2415 } | |
| 2416 } | |
| 2417 if (result6 !== null) { | |
| 2418 result7 = parse_w(); | |
| 2419 if (result7 !== null) { | |
| 2420 result8 = parse_DictionaryMemberList(); | |
| 2421 if (result8 !== null) { | |
| 2422 result9 = parse_w(); | |
| 2423 if (result9 !== null) { | |
| 2424 if (input.charCodeAt(pos) === 125) { | |
| 2425 result10 = "}"; | |
| 2426 pos++; | |
| 2427 } else { | |
| 2428 result10 = null; | |
| 2429 if (reportFailures === 0) { | |
| 2430 matchFailed("\"}\""); | |
| 2431 } | |
| 2432 } | |
| 2433 if (result10 !== null) { | |
| 2434 result11 = parse_w(); | |
| 2435 if (result11 !== null) { | |
| 2436 if (input.charCodeAt(pos) === 59) { | |
| 2437 result12 = ";"; | |
| 2438 pos++; | |
| 2439 } else { | |
| 2440 result12 = null; | |
| 2441 if (reportFailures === 0) { | |
| 2442 matchFailed("\";\""); | |
| 2443 } | |
| 2444 } | |
| 2445 if (result12 !== null) { | |
| 2446 result13 = parse_w(); | |
| 2447 if (result13 !== null) { | |
| 2448 result0 = [result0, result1, result2, result
3, result4, result5, result6, result7, result8, result9, result10, result11, res
ult12, result13]; | |
| 2449 } else { | |
| 2450 result0 = null; | |
| 2451 pos = pos1; | |
| 2452 } | |
| 2453 } else { | |
| 2454 result0 = null; | |
| 2455 pos = pos1; | |
| 2456 } | |
| 2457 } else { | |
| 2458 result0 = null; | |
| 2459 pos = pos1; | |
| 2460 } | |
| 2461 } else { | |
| 2462 result0 = null; | |
| 2463 pos = pos1; | |
| 2464 } | |
| 2465 } else { | |
| 2466 result0 = null; | |
| 2467 pos = pos1; | |
| 2468 } | |
| 2469 } else { | |
| 2470 result0 = null; | |
| 2471 pos = pos1; | |
| 2472 } | |
| 2473 } else { | |
| 2474 result0 = null; | |
| 2475 pos = pos1; | |
| 2476 } | |
| 2477 } else { | |
| 2478 result0 = null; | |
| 2479 pos = pos1; | |
| 2480 } | |
| 2481 } else { | |
| 2482 result0 = null; | |
| 2483 pos = pos1; | |
| 2484 } | |
| 2485 } else { | |
| 2486 result0 = null; | |
| 2487 pos = pos1; | |
| 2488 } | |
| 2489 } else { | |
| 2490 result0 = null; | |
| 2491 pos = pos1; | |
| 2492 } | |
| 2493 } else { | |
| 2494 result0 = null; | |
| 2495 pos = pos1; | |
| 2496 } | |
| 2497 } else { | |
| 2498 result0 = null; | |
| 2499 pos = pos1; | |
| 2500 } | |
| 2501 } else { | |
| 2502 result0 = null; | |
| 2503 pos = pos1; | |
| 2504 } | |
| 2505 if (result0 !== null) { | |
| 2506 result0 = (function(offset, name, members) { | |
| 2507 return { | |
| 2508 type: "partialdictionary", | |
| 2509 name: name, | |
| 2510 members: members | |
| 2511 }; | |
| 2512 })(pos0, result0[4], result0[8]); | |
| 2513 } | |
| 2514 if (result0 === null) { | |
| 2515 pos = pos0; | |
| 2516 } | |
| 2517 return result0; | |
| 2518 } | |
| 2519 | |
| 2520 function parse_callbackinterface() { | |
| 2521 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13, result14, result15
; | |
| 2522 var pos0, pos1; | |
| 2523 | |
| 2524 pos0 = pos; | |
| 2525 pos1 = pos; | |
| 2526 result0 = parse_ExtendedAttributeList(); | |
| 2527 if (result0 !== null) { | |
| 2528 result1 = parse_s(); | |
| 2529 result1 = result1 !== null ? result1 : ""; | |
| 2530 if (result1 !== null) { | |
| 2531 if (input.substr(pos, 8) === "callback") { | |
| 2532 result2 = "callback"; | |
| 2533 pos += 8; | |
| 2534 } else { | |
| 2535 result2 = null; | |
| 2536 if (reportFailures === 0) { | |
| 2537 matchFailed("\"callback\""); | |
| 2538 } | |
| 2539 } | |
| 2540 if (result2 !== null) { | |
| 2541 result3 = parse_s(); | |
| 2542 if (result3 !== null) { | |
| 2543 if (input.substr(pos, 9) === "interface") { | |
| 2544 result4 = "interface"; | |
| 2545 pos += 9; | |
| 2546 } else { | |
| 2547 result4 = null; | |
| 2548 if (reportFailures === 0) { | |
| 2549 matchFailed("\"interface\""); | |
| 2550 } | |
| 2551 } | |
| 2552 if (result4 !== null) { | |
| 2553 result5 = parse_s(); | |
| 2554 if (result5 !== null) { | |
| 2555 result6 = parse_identifier(); | |
| 2556 if (result6 !== null) { | |
| 2557 result7 = parse_w(); | |
| 2558 if (result7 !== null) { | |
| 2559 if (input.charCodeAt(pos) === 123) { | |
| 2560 result8 = "{"; | |
| 2561 pos++; | |
| 2562 } else { | |
| 2563 result8 = null; | |
| 2564 if (reportFailures === 0) { | |
| 2565 matchFailed("\"{\""); | |
| 2566 } | |
| 2567 } | |
| 2568 if (result8 !== null) { | |
| 2569 result9 = parse_w(); | |
| 2570 if (result9 !== null) { | |
| 2571 result10 = parse_InterfaceMemberList(); | |
| 2572 if (result10 !== null) { | |
| 2573 result11 = parse_w(); | |
| 2574 if (result11 !== null) { | |
| 2575 if (input.charCodeAt(pos) === 125) { | |
| 2576 result12 = "}"; | |
| 2577 pos++; | |
| 2578 } else { | |
| 2579 result12 = null; | |
| 2580 if (reportFailures === 0) { | |
| 2581 matchFailed("\"}\""); | |
| 2582 } | |
| 2583 } | |
| 2584 if (result12 !== null) { | |
| 2585 result13 = parse_w(); | |
| 2586 if (result13 !== null) { | |
| 2587 if (input.charCodeAt(pos) === 59) { | |
| 2588 result14 = ";"; | |
| 2589 pos++; | |
| 2590 } else { | |
| 2591 result14 = null; | |
| 2592 if (reportFailures === 0) { | |
| 2593 matchFailed("\";\""); | |
| 2594 } | |
| 2595 } | |
| 2596 if (result14 !== null) { | |
| 2597 result15 = parse_w(); | |
| 2598 if (result15 !== null) { | |
| 2599 result0 = [result0, result1, result2, re
sult3, result4, result5, result6, result7, result8, result9, result10, result11,
result12, result13, result14, result15]; | |
| 2600 } else { | |
| 2601 result0 = null; | |
| 2602 pos = pos1; | |
| 2603 } | |
| 2604 } else { | |
| 2605 result0 = null; | |
| 2606 pos = pos1; | |
| 2607 } | |
| 2608 } else { | |
| 2609 result0 = null; | |
| 2610 pos = pos1; | |
| 2611 } | |
| 2612 } else { | |
| 2613 result0 = null; | |
| 2614 pos = pos1; | |
| 2615 } | |
| 2616 } else { | |
| 2617 result0 = null; | |
| 2618 pos = pos1; | |
| 2619 } | |
| 2620 } else { | |
| 2621 result0 = null; | |
| 2622 pos = pos1; | |
| 2623 } | |
| 2624 } else { | |
| 2625 result0 = null; | |
| 2626 pos = pos1; | |
| 2627 } | |
| 2628 } else { | |
| 2629 result0 = null; | |
| 2630 pos = pos1; | |
| 2631 } | |
| 2632 } else { | |
| 2633 result0 = null; | |
| 2634 pos = pos1; | |
| 2635 } | |
| 2636 } else { | |
| 2637 result0 = null; | |
| 2638 pos = pos1; | |
| 2639 } | |
| 2640 } else { | |
| 2641 result0 = null; | |
| 2642 pos = pos1; | |
| 2643 } | |
| 2644 } else { | |
| 2645 result0 = null; | |
| 2646 pos = pos1; | |
| 2647 } | |
| 2648 } else { | |
| 2649 result0 = null; | |
| 2650 pos = pos1; | |
| 2651 } | |
| 2652 } else { | |
| 2653 result0 = null; | |
| 2654 pos = pos1; | |
| 2655 } | |
| 2656 } else { | |
| 2657 result0 = null; | |
| 2658 pos = pos1; | |
| 2659 } | |
| 2660 } else { | |
| 2661 result0 = null; | |
| 2662 pos = pos1; | |
| 2663 } | |
| 2664 if (result0 !== null) { | |
| 2665 result0 = (function(offset, extAttrs, name, mem) { return { type: "cal
lbackinterface", name: name, members: mem, extAttrs: extAttrs }; })(pos0, result
0[0], result0[6], result0[10]); | |
| 2666 } | |
| 2667 if (result0 === null) { | |
| 2668 pos = pos0; | |
| 2669 } | |
| 2670 return result0; | |
| 2671 } | |
| 2672 | |
| 2673 function parse_module() { | |
| 2674 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13; | |
| 2675 var pos0, pos1; | |
| 2676 | |
| 2677 pos0 = pos; | |
| 2678 pos1 = pos; | |
| 2679 result0 = parse_ExtendedAttributeList(); | |
| 2680 if (result0 !== null) { | |
| 2681 result1 = parse_s(); | |
| 2682 result1 = result1 !== null ? result1 : ""; | |
| 2683 if (result1 !== null) { | |
| 2684 if (input.substr(pos, 6) === "module") { | |
| 2685 result2 = "module"; | |
| 2686 pos += 6; | |
| 2687 } else { | |
| 2688 result2 = null; | |
| 2689 if (reportFailures === 0) { | |
| 2690 matchFailed("\"module\""); | |
| 2691 } | |
| 2692 } | |
| 2693 if (result2 !== null) { | |
| 2694 result3 = parse_s(); | |
| 2695 if (result3 !== null) { | |
| 2696 result4 = parse_identifier(); | |
| 2697 if (result4 !== null) { | |
| 2698 result5 = parse_w(); | |
| 2699 if (result5 !== null) { | |
| 2700 if (input.charCodeAt(pos) === 123) { | |
| 2701 result6 = "{"; | |
| 2702 pos++; | |
| 2703 } else { | |
| 2704 result6 = null; | |
| 2705 if (reportFailures === 0) { | |
| 2706 matchFailed("\"{\""); | |
| 2707 } | |
| 2708 } | |
| 2709 if (result6 !== null) { | |
| 2710 result7 = parse_w(); | |
| 2711 if (result7 !== null) { | |
| 2712 result8 = parse_definitions(); | |
| 2713 if (result8 !== null) { | |
| 2714 result9 = parse_w(); | |
| 2715 if (result9 !== null) { | |
| 2716 if (input.charCodeAt(pos) === 125) { | |
| 2717 result10 = "}"; | |
| 2718 pos++; | |
| 2719 } else { | |
| 2720 result10 = null; | |
| 2721 if (reportFailures === 0) { | |
| 2722 matchFailed("\"}\""); | |
| 2723 } | |
| 2724 } | |
| 2725 if (result10 !== null) { | |
| 2726 result11 = parse_w(); | |
| 2727 if (result11 !== null) { | |
| 2728 if (input.charCodeAt(pos) === 59) { | |
| 2729 result12 = ";"; | |
| 2730 pos++; | |
| 2731 } else { | |
| 2732 result12 = null; | |
| 2733 if (reportFailures === 0) { | |
| 2734 matchFailed("\";\""); | |
| 2735 } | |
| 2736 } | |
| 2737 if (result12 !== null) { | |
| 2738 result13 = parse_w(); | |
| 2739 if (result13 !== null) { | |
| 2740 result0 = [result0, result1, result2, result
3, result4, result5, result6, result7, result8, result9, result10, result11, res
ult12, result13]; | |
| 2741 } else { | |
| 2742 result0 = null; | |
| 2743 pos = pos1; | |
| 2744 } | |
| 2745 } else { | |
| 2746 result0 = null; | |
| 2747 pos = pos1; | |
| 2748 } | |
| 2749 } else { | |
| 2750 result0 = null; | |
| 2751 pos = pos1; | |
| 2752 } | |
| 2753 } else { | |
| 2754 result0 = null; | |
| 2755 pos = pos1; | |
| 2756 } | |
| 2757 } else { | |
| 2758 result0 = null; | |
| 2759 pos = pos1; | |
| 2760 } | |
| 2761 } else { | |
| 2762 result0 = null; | |
| 2763 pos = pos1; | |
| 2764 } | |
| 2765 } else { | |
| 2766 result0 = null; | |
| 2767 pos = pos1; | |
| 2768 } | |
| 2769 } else { | |
| 2770 result0 = null; | |
| 2771 pos = pos1; | |
| 2772 } | |
| 2773 } else { | |
| 2774 result0 = null; | |
| 2775 pos = pos1; | |
| 2776 } | |
| 2777 } else { | |
| 2778 result0 = null; | |
| 2779 pos = pos1; | |
| 2780 } | |
| 2781 } else { | |
| 2782 result0 = null; | |
| 2783 pos = pos1; | |
| 2784 } | |
| 2785 } else { | |
| 2786 result0 = null; | |
| 2787 pos = pos1; | |
| 2788 } | |
| 2789 } else { | |
| 2790 result0 = null; | |
| 2791 pos = pos1; | |
| 2792 } | |
| 2793 } else { | |
| 2794 result0 = null; | |
| 2795 pos = pos1; | |
| 2796 } | |
| 2797 if (result0 !== null) { | |
| 2798 result0 = (function(offset, extAttrs, name, defs) { return { type: "mo
dule", name: name, definitions: defs, extAttrs: extAttrs }; })(pos0, result0[0],
result0[4], result0[8]); | |
| 2799 } | |
| 2800 if (result0 === null) { | |
| 2801 pos = pos0; | |
| 2802 } | |
| 2803 return result0; | |
| 2804 } | |
| 2805 | |
| 2806 function parse_implements() { | |
| 2807 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9; | |
| 2808 var pos0, pos1; | |
| 2809 | |
| 2810 pos0 = pos; | |
| 2811 pos1 = pos; | |
| 2812 result0 = parse_ExtendedAttributeList(); | |
| 2813 if (result0 !== null) { | |
| 2814 result1 = parse_s(); | |
| 2815 result1 = result1 !== null ? result1 : ""; | |
| 2816 if (result1 !== null) { | |
| 2817 result2 = parse_ScopedName(); | |
| 2818 if (result2 !== null) { | |
| 2819 result3 = parse_s(); | |
| 2820 if (result3 !== null) { | |
| 2821 if (input.substr(pos, 10) === "implements") { | |
| 2822 result4 = "implements"; | |
| 2823 pos += 10; | |
| 2824 } else { | |
| 2825 result4 = null; | |
| 2826 if (reportFailures === 0) { | |
| 2827 matchFailed("\"implements\""); | |
| 2828 } | |
| 2829 } | |
| 2830 if (result4 !== null) { | |
| 2831 result5 = parse_s(); | |
| 2832 if (result5 !== null) { | |
| 2833 result6 = parse_ScopedName(); | |
| 2834 if (result6 !== null) { | |
| 2835 result7 = parse_w(); | |
| 2836 if (result7 !== null) { | |
| 2837 if (input.charCodeAt(pos) === 59) { | |
| 2838 result8 = ";"; | |
| 2839 pos++; | |
| 2840 } else { | |
| 2841 result8 = null; | |
| 2842 if (reportFailures === 0) { | |
| 2843 matchFailed("\";\""); | |
| 2844 } | |
| 2845 } | |
| 2846 if (result8 !== null) { | |
| 2847 result9 = parse_w(); | |
| 2848 if (result9 !== null) { | |
| 2849 result0 = [result0, result1, result2, result3, resul
t4, result5, result6, result7, result8, result9]; | |
| 2850 } else { | |
| 2851 result0 = null; | |
| 2852 pos = pos1; | |
| 2853 } | |
| 2854 } else { | |
| 2855 result0 = null; | |
| 2856 pos = pos1; | |
| 2857 } | |
| 2858 } else { | |
| 2859 result0 = null; | |
| 2860 pos = pos1; | |
| 2861 } | |
| 2862 } else { | |
| 2863 result0 = null; | |
| 2864 pos = pos1; | |
| 2865 } | |
| 2866 } else { | |
| 2867 result0 = null; | |
| 2868 pos = pos1; | |
| 2869 } | |
| 2870 } else { | |
| 2871 result0 = null; | |
| 2872 pos = pos1; | |
| 2873 } | |
| 2874 } else { | |
| 2875 result0 = null; | |
| 2876 pos = pos1; | |
| 2877 } | |
| 2878 } else { | |
| 2879 result0 = null; | |
| 2880 pos = pos1; | |
| 2881 } | |
| 2882 } else { | |
| 2883 result0 = null; | |
| 2884 pos = pos1; | |
| 2885 } | |
| 2886 } else { | |
| 2887 result0 = null; | |
| 2888 pos = pos1; | |
| 2889 } | |
| 2890 if (result0 !== null) { | |
| 2891 result0 = (function(offset, extAttrs, target, impl) { return { type: '
implements', target: target, 'implements': impl, extAttrs: extAttrs }; })(pos0,
result0[0], result0[2], result0[6]); | |
| 2892 } | |
| 2893 if (result0 === null) { | |
| 2894 pos = pos0; | |
| 2895 } | |
| 2896 return result0; | |
| 2897 } | |
| 2898 | |
| 2899 function parse_interface() { | |
| 2900 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13, result14, result15
; | |
| 2901 var pos0, pos1; | |
| 2902 | |
| 2903 pos0 = pos; | |
| 2904 pos1 = pos; | |
| 2905 result0 = parse_ExtendedAttributeList(); | |
| 2906 if (result0 !== null) { | |
| 2907 result1 = parse_s(); | |
| 2908 result1 = result1 !== null ? result1 : ""; | |
| 2909 if (result1 !== null) { | |
| 2910 if (input.substr(pos, 9) === "interface") { | |
| 2911 result2 = "interface"; | |
| 2912 pos += 9; | |
| 2913 } else { | |
| 2914 result2 = null; | |
| 2915 if (reportFailures === 0) { | |
| 2916 matchFailed("\"interface\""); | |
| 2917 } | |
| 2918 } | |
| 2919 if (result2 !== null) { | |
| 2920 result3 = parse_s(); | |
| 2921 if (result3 !== null) { | |
| 2922 result4 = parse_identifier(); | |
| 2923 if (result4 !== null) { | |
| 2924 result5 = parse_w(); | |
| 2925 if (result5 !== null) { | |
| 2926 result6 = parse_Inheritance(); | |
| 2927 if (result6 !== null) { | |
| 2928 result7 = parse_w(); | |
| 2929 if (result7 !== null) { | |
| 2930 if (input.charCodeAt(pos) === 123) { | |
| 2931 result8 = "{"; | |
| 2932 pos++; | |
| 2933 } else { | |
| 2934 result8 = null; | |
| 2935 if (reportFailures === 0) { | |
| 2936 matchFailed("\"{\""); | |
| 2937 } | |
| 2938 } | |
| 2939 if (result8 !== null) { | |
| 2940 result9 = parse_w(); | |
| 2941 if (result9 !== null) { | |
| 2942 result10 = parse_InterfaceMemberList(); | |
| 2943 if (result10 !== null) { | |
| 2944 result11 = parse_w(); | |
| 2945 if (result11 !== null) { | |
| 2946 if (input.charCodeAt(pos) === 125) { | |
| 2947 result12 = "}"; | |
| 2948 pos++; | |
| 2949 } else { | |
| 2950 result12 = null; | |
| 2951 if (reportFailures === 0) { | |
| 2952 matchFailed("\"}\""); | |
| 2953 } | |
| 2954 } | |
| 2955 if (result12 !== null) { | |
| 2956 result13 = parse_w(); | |
| 2957 if (result13 !== null) { | |
| 2958 if (input.charCodeAt(pos) === 59) { | |
| 2959 result14 = ";"; | |
| 2960 pos++; | |
| 2961 } else { | |
| 2962 result14 = null; | |
| 2963 if (reportFailures === 0) { | |
| 2964 matchFailed("\";\""); | |
| 2965 } | |
| 2966 } | |
| 2967 if (result14 !== null) { | |
| 2968 result15 = parse_w(); | |
| 2969 if (result15 !== null) { | |
| 2970 result0 = [result0, result1, result2, re
sult3, result4, result5, result6, result7, result8, result9, result10, result11,
result12, result13, result14, result15]; | |
| 2971 } else { | |
| 2972 result0 = null; | |
| 2973 pos = pos1; | |
| 2974 } | |
| 2975 } else { | |
| 2976 result0 = null; | |
| 2977 pos = pos1; | |
| 2978 } | |
| 2979 } else { | |
| 2980 result0 = null; | |
| 2981 pos = pos1; | |
| 2982 } | |
| 2983 } else { | |
| 2984 result0 = null; | |
| 2985 pos = pos1; | |
| 2986 } | |
| 2987 } else { | |
| 2988 result0 = null; | |
| 2989 pos = pos1; | |
| 2990 } | |
| 2991 } else { | |
| 2992 result0 = null; | |
| 2993 pos = pos1; | |
| 2994 } | |
| 2995 } else { | |
| 2996 result0 = null; | |
| 2997 pos = pos1; | |
| 2998 } | |
| 2999 } else { | |
| 3000 result0 = null; | |
| 3001 pos = pos1; | |
| 3002 } | |
| 3003 } else { | |
| 3004 result0 = null; | |
| 3005 pos = pos1; | |
| 3006 } | |
| 3007 } else { | |
| 3008 result0 = null; | |
| 3009 pos = pos1; | |
| 3010 } | |
| 3011 } else { | |
| 3012 result0 = null; | |
| 3013 pos = pos1; | |
| 3014 } | |
| 3015 } else { | |
| 3016 result0 = null; | |
| 3017 pos = pos1; | |
| 3018 } | |
| 3019 } else { | |
| 3020 result0 = null; | |
| 3021 pos = pos1; | |
| 3022 } | |
| 3023 } else { | |
| 3024 result0 = null; | |
| 3025 pos = pos1; | |
| 3026 } | |
| 3027 } else { | |
| 3028 result0 = null; | |
| 3029 pos = pos1; | |
| 3030 } | |
| 3031 } else { | |
| 3032 result0 = null; | |
| 3033 pos = pos1; | |
| 3034 } | |
| 3035 if (result0 !== null) { | |
| 3036 result0 = (function(offset, extAttrs, name, herit, mem) { return { typ
e: "interface", name: name, inheritance: herit, members: mem, extAttrs: extAttrs
}; })(pos0, result0[0], result0[4], result0[6], result0[10]); | |
| 3037 } | |
| 3038 if (result0 === null) { | |
| 3039 pos = pos0; | |
| 3040 } | |
| 3041 return result0; | |
| 3042 } | |
| 3043 | |
| 3044 function parse_enum() { | |
| 3045 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13, result14, result15
; | |
| 3046 var pos0, pos1; | |
| 3047 | |
| 3048 pos0 = pos; | |
| 3049 pos1 = pos; | |
| 3050 result0 = parse_ExtendedAttributeList(); | |
| 3051 if (result0 !== null) { | |
| 3052 result1 = parse_s(); | |
| 3053 result1 = result1 !== null ? result1 : ""; | |
| 3054 if (result1 !== null) { | |
| 3055 if (input.substr(pos, 4) === "enum") { | |
| 3056 result2 = "enum"; | |
| 3057 pos += 4; | |
| 3058 } else { | |
| 3059 result2 = null; | |
| 3060 if (reportFailures === 0) { | |
| 3061 matchFailed("\"enum\""); | |
| 3062 } | |
| 3063 } | |
| 3064 if (result2 !== null) { | |
| 3065 result3 = parse_s(); | |
| 3066 if (result3 !== null) { | |
| 3067 result4 = parse_identifier(); | |
| 3068 if (result4 !== null) { | |
| 3069 result5 = parse_w(); | |
| 3070 if (result5 !== null) { | |
| 3071 if (input.charCodeAt(pos) === 123) { | |
| 3072 result6 = "{"; | |
| 3073 pos++; | |
| 3074 } else { | |
| 3075 result6 = null; | |
| 3076 if (reportFailures === 0) { | |
| 3077 matchFailed("\"{\""); | |
| 3078 } | |
| 3079 } | |
| 3080 if (result6 !== null) { | |
| 3081 result7 = parse_w(); | |
| 3082 if (result7 !== null) { | |
| 3083 result8 = parse_EnumValues(); | |
| 3084 if (result8 !== null) { | |
| 3085 result9 = parse_w(); | |
| 3086 result9 = result9 !== null ? result9 : ""; | |
| 3087 if (result9 !== null) { | |
| 3088 if (input.charCodeAt(pos) === 44) { | |
| 3089 result10 = ","; | |
| 3090 pos++; | |
| 3091 } else { | |
| 3092 result10 = null; | |
| 3093 if (reportFailures === 0) { | |
| 3094 matchFailed("\",\""); | |
| 3095 } | |
| 3096 } | |
| 3097 result10 = result10 !== null ? result10 : ""; | |
| 3098 if (result10 !== null) { | |
| 3099 result11 = parse_w(); | |
| 3100 if (result11 !== null) { | |
| 3101 if (input.charCodeAt(pos) === 125) { | |
| 3102 result12 = "}"; | |
| 3103 pos++; | |
| 3104 } else { | |
| 3105 result12 = null; | |
| 3106 if (reportFailures === 0) { | |
| 3107 matchFailed("\"}\""); | |
| 3108 } | |
| 3109 } | |
| 3110 if (result12 !== null) { | |
| 3111 result13 = parse_w(); | |
| 3112 if (result13 !== null) { | |
| 3113 if (input.charCodeAt(pos) === 59) { | |
| 3114 result14 = ";"; | |
| 3115 pos++; | |
| 3116 } else { | |
| 3117 result14 = null; | |
| 3118 if (reportFailures === 0) { | |
| 3119 matchFailed("\";\""); | |
| 3120 } | |
| 3121 } | |
| 3122 if (result14 !== null) { | |
| 3123 result15 = parse_w(); | |
| 3124 if (result15 !== null) { | |
| 3125 result0 = [result0, result1, result2, re
sult3, result4, result5, result6, result7, result8, result9, result10, result11,
result12, result13, result14, result15]; | |
| 3126 } else { | |
| 3127 result0 = null; | |
| 3128 pos = pos1; | |
| 3129 } | |
| 3130 } else { | |
| 3131 result0 = null; | |
| 3132 pos = pos1; | |
| 3133 } | |
| 3134 } else { | |
| 3135 result0 = null; | |
| 3136 pos = pos1; | |
| 3137 } | |
| 3138 } else { | |
| 3139 result0 = null; | |
| 3140 pos = pos1; | |
| 3141 } | |
| 3142 } else { | |
| 3143 result0 = null; | |
| 3144 pos = pos1; | |
| 3145 } | |
| 3146 } else { | |
| 3147 result0 = null; | |
| 3148 pos = pos1; | |
| 3149 } | |
| 3150 } else { | |
| 3151 result0 = null; | |
| 3152 pos = pos1; | |
| 3153 } | |
| 3154 } else { | |
| 3155 result0 = null; | |
| 3156 pos = pos1; | |
| 3157 } | |
| 3158 } else { | |
| 3159 result0 = null; | |
| 3160 pos = pos1; | |
| 3161 } | |
| 3162 } else { | |
| 3163 result0 = null; | |
| 3164 pos = pos1; | |
| 3165 } | |
| 3166 } else { | |
| 3167 result0 = null; | |
| 3168 pos = pos1; | |
| 3169 } | |
| 3170 } else { | |
| 3171 result0 = null; | |
| 3172 pos = pos1; | |
| 3173 } | |
| 3174 } else { | |
| 3175 result0 = null; | |
| 3176 pos = pos1; | |
| 3177 } | |
| 3178 } else { | |
| 3179 result0 = null; | |
| 3180 pos = pos1; | |
| 3181 } | |
| 3182 } else { | |
| 3183 result0 = null; | |
| 3184 pos = pos1; | |
| 3185 } | |
| 3186 } else { | |
| 3187 result0 = null; | |
| 3188 pos = pos1; | |
| 3189 } | |
| 3190 if (result0 !== null) { | |
| 3191 result0 = (function(offset, extAttrs, name, values) { return { type: "
enum", name: name, values: values, extAttrs: extAttrs }; })(pos0, result0[0], re
sult0[4], result0[8]); | |
| 3192 } | |
| 3193 if (result0 === null) { | |
| 3194 pos = pos0; | |
| 3195 } | |
| 3196 return result0; | |
| 3197 } | |
| 3198 | |
| 3199 function parse_callback() { | |
| 3200 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13, result14, result15
, result16, result17; | |
| 3201 var pos0, pos1; | |
| 3202 | |
| 3203 pos0 = pos; | |
| 3204 pos1 = pos; | |
| 3205 result0 = parse_ExtendedAttributeList(); | |
| 3206 if (result0 !== null) { | |
| 3207 result1 = parse_s(); | |
| 3208 result1 = result1 !== null ? result1 : ""; | |
| 3209 if (result1 !== null) { | |
| 3210 if (input.substr(pos, 8) === "callback") { | |
| 3211 result2 = "callback"; | |
| 3212 pos += 8; | |
| 3213 } else { | |
| 3214 result2 = null; | |
| 3215 if (reportFailures === 0) { | |
| 3216 matchFailed("\"callback\""); | |
| 3217 } | |
| 3218 } | |
| 3219 if (result2 !== null) { | |
| 3220 result3 = parse_s(); | |
| 3221 if (result3 !== null) { | |
| 3222 result4 = parse_identifier(); | |
| 3223 if (result4 !== null) { | |
| 3224 result5 = parse_w(); | |
| 3225 if (result5 !== null) { | |
| 3226 if (input.charCodeAt(pos) === 61) { | |
| 3227 result6 = "="; | |
| 3228 pos++; | |
| 3229 } else { | |
| 3230 result6 = null; | |
| 3231 if (reportFailures === 0) { | |
| 3232 matchFailed("\"=\""); | |
| 3233 } | |
| 3234 } | |
| 3235 if (result6 !== null) { | |
| 3236 result7 = parse_w(); | |
| 3237 if (result7 !== null) { | |
| 3238 result8 = parse_ReturnType(); | |
| 3239 if (result8 !== null) { | |
| 3240 result9 = parse_s(); | |
| 3241 if (result9 !== null) { | |
| 3242 if (input.charCodeAt(pos) === 40) { | |
| 3243 result10 = "("; | |
| 3244 pos++; | |
| 3245 } else { | |
| 3246 result10 = null; | |
| 3247 if (reportFailures === 0) { | |
| 3248 matchFailed("\"(\""); | |
| 3249 } | |
| 3250 } | |
| 3251 if (result10 !== null) { | |
| 3252 result11 = parse_w(); | |
| 3253 if (result11 !== null) { | |
| 3254 result12 = parse_Arguments(); | |
| 3255 if (result12 !== null) { | |
| 3256 result13 = parse_w(); | |
| 3257 if (result13 !== null) { | |
| 3258 if (input.charCodeAt(pos) === 41) { | |
| 3259 result14 = ")"; | |
| 3260 pos++; | |
| 3261 } else { | |
| 3262 result14 = null; | |
| 3263 if (reportFailures === 0) { | |
| 3264 matchFailed("\")\""); | |
| 3265 } | |
| 3266 } | |
| 3267 if (result14 !== null) { | |
| 3268 result15 = parse_w(); | |
| 3269 if (result15 !== null) { | |
| 3270 if (input.charCodeAt(pos) === 59) { | |
| 3271 result16 = ";"; | |
| 3272 pos++; | |
| 3273 } else { | |
| 3274 result16 = null; | |
| 3275 if (reportFailures === 0) { | |
| 3276 matchFailed("\";\""); | |
| 3277 } | |
| 3278 } | |
| 3279 if (result16 !== null) { | |
| 3280 result17 = parse_w(); | |
| 3281 if (result17 !== null) { | |
| 3282 result0 = [result0, result1, result2
, result3, result4, result5, result6, result7, result8, result9, result10, resul
t11, result12, result13, result14, result15, result16, result17]; | |
| 3283 } else { | |
| 3284 result0 = null; | |
| 3285 pos = pos1; | |
| 3286 } | |
| 3287 } else { | |
| 3288 result0 = null; | |
| 3289 pos = pos1; | |
| 3290 } | |
| 3291 } else { | |
| 3292 result0 = null; | |
| 3293 pos = pos1; | |
| 3294 } | |
| 3295 } else { | |
| 3296 result0 = null; | |
| 3297 pos = pos1; | |
| 3298 } | |
| 3299 } else { | |
| 3300 result0 = null; | |
| 3301 pos = pos1; | |
| 3302 } | |
| 3303 } else { | |
| 3304 result0 = null; | |
| 3305 pos = pos1; | |
| 3306 } | |
| 3307 } else { | |
| 3308 result0 = null; | |
| 3309 pos = pos1; | |
| 3310 } | |
| 3311 } else { | |
| 3312 result0 = null; | |
| 3313 pos = pos1; | |
| 3314 } | |
| 3315 } else { | |
| 3316 result0 = null; | |
| 3317 pos = pos1; | |
| 3318 } | |
| 3319 } else { | |
| 3320 result0 = null; | |
| 3321 pos = pos1; | |
| 3322 } | |
| 3323 } else { | |
| 3324 result0 = null; | |
| 3325 pos = pos1; | |
| 3326 } | |
| 3327 } else { | |
| 3328 result0 = null; | |
| 3329 pos = pos1; | |
| 3330 } | |
| 3331 } else { | |
| 3332 result0 = null; | |
| 3333 pos = pos1; | |
| 3334 } | |
| 3335 } else { | |
| 3336 result0 = null; | |
| 3337 pos = pos1; | |
| 3338 } | |
| 3339 } else { | |
| 3340 result0 = null; | |
| 3341 pos = pos1; | |
| 3342 } | |
| 3343 } else { | |
| 3344 result0 = null; | |
| 3345 pos = pos1; | |
| 3346 } | |
| 3347 } else { | |
| 3348 result0 = null; | |
| 3349 pos = pos1; | |
| 3350 } | |
| 3351 } else { | |
| 3352 result0 = null; | |
| 3353 pos = pos1; | |
| 3354 } | |
| 3355 if (result0 !== null) { | |
| 3356 result0 = (function(offset, extAttrs, name, ret, args) { return { type
: "callback", idlType: ret, name: name, args: args, extAttrs: extAttrs }; })(pos
0, result0[0], result0[4], result0[8], result0[12]); | |
| 3357 } | |
| 3358 if (result0 === null) { | |
| 3359 pos = pos0; | |
| 3360 } | |
| 3361 return result0; | |
| 3362 } | |
| 3363 | |
| 3364 function parse_EnumValues() { | |
| 3365 var result0, result1, result2; | |
| 3366 var pos0, pos1; | |
| 3367 | |
| 3368 pos0 = pos; | |
| 3369 pos1 = pos; | |
| 3370 result0 = parse_string(); | |
| 3371 if (result0 !== null) { | |
| 3372 result1 = []; | |
| 3373 result2 = parse_EnumValuesRest(); | |
| 3374 while (result2 !== null) { | |
| 3375 result1.push(result2); | |
| 3376 result2 = parse_EnumValuesRest(); | |
| 3377 } | |
| 3378 if (result1 !== null) { | |
| 3379 result0 = [result0, result1]; | |
| 3380 } else { | |
| 3381 result0 = null; | |
| 3382 pos = pos1; | |
| 3383 } | |
| 3384 } else { | |
| 3385 result0 = null; | |
| 3386 pos = pos1; | |
| 3387 } | |
| 3388 if (result0 !== null) { | |
| 3389 result0 = (function(offset, first, others) { var ret = [first]; | |
| 3390 for (var i = 0, n = others.length; i < n; i++) { ret.push(ot
hers[i]); } | |
| 3391 return ret; })(pos0, result0[0], result0[1]); | |
| 3392 } | |
| 3393 if (result0 === null) { | |
| 3394 pos = pos0; | |
| 3395 } | |
| 3396 return result0; | |
| 3397 } | |
| 3398 | |
| 3399 function parse_EnumValuesRest() { | |
| 3400 var result0, result1, result2, result3; | |
| 3401 var pos0, pos1; | |
| 3402 | |
| 3403 pos0 = pos; | |
| 3404 pos1 = pos; | |
| 3405 result0 = parse_w(); | |
| 3406 if (result0 !== null) { | |
| 3407 if (input.charCodeAt(pos) === 44) { | |
| 3408 result1 = ","; | |
| 3409 pos++; | |
| 3410 } else { | |
| 3411 result1 = null; | |
| 3412 if (reportFailures === 0) { | |
| 3413 matchFailed("\",\""); | |
| 3414 } | |
| 3415 } | |
| 3416 if (result1 !== null) { | |
| 3417 result2 = parse_w(); | |
| 3418 if (result2 !== null) { | |
| 3419 result3 = parse_string(); | |
| 3420 if (result3 !== null) { | |
| 3421 result0 = [result0, result1, result2, result3]; | |
| 3422 } else { | |
| 3423 result0 = null; | |
| 3424 pos = pos1; | |
| 3425 } | |
| 3426 } else { | |
| 3427 result0 = null; | |
| 3428 pos = pos1; | |
| 3429 } | |
| 3430 } else { | |
| 3431 result0 = null; | |
| 3432 pos = pos1; | |
| 3433 } | |
| 3434 } else { | |
| 3435 result0 = null; | |
| 3436 pos = pos1; | |
| 3437 } | |
| 3438 if (result0 !== null) { | |
| 3439 result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); | |
| 3440 } | |
| 3441 if (result0 === null) { | |
| 3442 pos = pos0; | |
| 3443 } | |
| 3444 return result0; | |
| 3445 } | |
| 3446 | |
| 3447 function parse_Inheritance() { | |
| 3448 var result0; | |
| 3449 var pos0; | |
| 3450 | |
| 3451 pos0 = pos; | |
| 3452 result0 = parse_InheritanceInner(); | |
| 3453 result0 = result0 !== null ? result0 : ""; | |
| 3454 if (result0 !== null) { | |
| 3455 result0 = (function(offset, herit) { return herit ? herit : []; })(pos
0, result0); | |
| 3456 } | |
| 3457 if (result0 === null) { | |
| 3458 pos = pos0; | |
| 3459 } | |
| 3460 return result0; | |
| 3461 } | |
| 3462 | |
| 3463 function parse_InheritanceInner() { | |
| 3464 var result0, result1, result2; | |
| 3465 var pos0, pos1; | |
| 3466 | |
| 3467 pos0 = pos; | |
| 3468 pos1 = pos; | |
| 3469 if (input.charCodeAt(pos) === 58) { | |
| 3470 result0 = ":"; | |
| 3471 pos++; | |
| 3472 } else { | |
| 3473 result0 = null; | |
| 3474 if (reportFailures === 0) { | |
| 3475 matchFailed("\":\""); | |
| 3476 } | |
| 3477 } | |
| 3478 if (result0 !== null) { | |
| 3479 result1 = parse_w(); | |
| 3480 if (result1 !== null) { | |
| 3481 result2 = parse_ScopedNameList(); | |
| 3482 if (result2 !== null) { | |
| 3483 result0 = [result0, result1, result2]; | |
| 3484 } else { | |
| 3485 result0 = null; | |
| 3486 pos = pos1; | |
| 3487 } | |
| 3488 } else { | |
| 3489 result0 = null; | |
| 3490 pos = pos1; | |
| 3491 } | |
| 3492 } else { | |
| 3493 result0 = null; | |
| 3494 pos = pos1; | |
| 3495 } | |
| 3496 if (result0 !== null) { | |
| 3497 result0 = (function(offset, herit) { return herit; })(pos0, result0[2]
); | |
| 3498 } | |
| 3499 if (result0 === null) { | |
| 3500 pos = pos0; | |
| 3501 } | |
| 3502 return result0; | |
| 3503 } | |
| 3504 | |
| 3505 function parse_InterfaceMemberList() { | |
| 3506 var result0, result1; | |
| 3507 var pos0; | |
| 3508 | |
| 3509 pos0 = pos; | |
| 3510 result0 = []; | |
| 3511 result1 = parse_InterfaceMember(); | |
| 3512 while (result1 !== null) { | |
| 3513 result0.push(result1); | |
| 3514 result1 = parse_InterfaceMember(); | |
| 3515 } | |
| 3516 if (result0 !== null) { | |
| 3517 result0 = (function(offset, mem) { return mem ? mem : []; })(pos0, res
ult0); | |
| 3518 } | |
| 3519 if (result0 === null) { | |
| 3520 pos = pos0; | |
| 3521 } | |
| 3522 return result0; | |
| 3523 } | |
| 3524 | |
| 3525 function parse_InterfaceMember() { | |
| 3526 var result0; | |
| 3527 var pos0; | |
| 3528 | |
| 3529 pos0 = pos; | |
| 3530 result0 = parse_const(); | |
| 3531 if (result0 === null) { | |
| 3532 result0 = parse_attrOrOp(); | |
| 3533 } | |
| 3534 if (result0 !== null) { | |
| 3535 result0 = (function(offset, mem) { return mem; })(pos0, result0); | |
| 3536 } | |
| 3537 if (result0 === null) { | |
| 3538 pos = pos0; | |
| 3539 } | |
| 3540 return result0; | |
| 3541 } | |
| 3542 | |
| 3543 function parse_const() { | |
| 3544 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13; | |
| 3545 var pos0, pos1; | |
| 3546 | |
| 3547 pos0 = pos; | |
| 3548 pos1 = pos; | |
| 3549 result0 = parse_ExtendedAttributeList(); | |
| 3550 if (result0 !== null) { | |
| 3551 result1 = parse_s(); | |
| 3552 result1 = result1 !== null ? result1 : ""; | |
| 3553 if (result1 !== null) { | |
| 3554 if (input.substr(pos, 5) === "const") { | |
| 3555 result2 = "const"; | |
| 3556 pos += 5; | |
| 3557 } else { | |
| 3558 result2 = null; | |
| 3559 if (reportFailures === 0) { | |
| 3560 matchFailed("\"const\""); | |
| 3561 } | |
| 3562 } | |
| 3563 if (result2 !== null) { | |
| 3564 result3 = parse_s(); | |
| 3565 if (result3 !== null) { | |
| 3566 result4 = parse_type(); | |
| 3567 if (result4 !== null) { | |
| 3568 result5 = parse_s(); | |
| 3569 if (result5 !== null) { | |
| 3570 result6 = parse_identifier(); | |
| 3571 if (result6 !== null) { | |
| 3572 result7 = parse_w(); | |
| 3573 if (result7 !== null) { | |
| 3574 if (input.charCodeAt(pos) === 61) { | |
| 3575 result8 = "="; | |
| 3576 pos++; | |
| 3577 } else { | |
| 3578 result8 = null; | |
| 3579 if (reportFailures === 0) { | |
| 3580 matchFailed("\"=\""); | |
| 3581 } | |
| 3582 } | |
| 3583 if (result8 !== null) { | |
| 3584 result9 = parse_w(); | |
| 3585 if (result9 !== null) { | |
| 3586 result10 = parse_constExpr(); | |
| 3587 if (result10 !== null) { | |
| 3588 result11 = parse_w(); | |
| 3589 if (result11 !== null) { | |
| 3590 if (input.charCodeAt(pos) === 59) { | |
| 3591 result12 = ";"; | |
| 3592 pos++; | |
| 3593 } else { | |
| 3594 result12 = null; | |
| 3595 if (reportFailures === 0) { | |
| 3596 matchFailed("\";\""); | |
| 3597 } | |
| 3598 } | |
| 3599 if (result12 !== null) { | |
| 3600 result13 = parse_w(); | |
| 3601 if (result13 !== null) { | |
| 3602 result0 = [result0, result1, result2, result
3, result4, result5, result6, result7, result8, result9, result10, result11, res
ult12, result13]; | |
| 3603 } else { | |
| 3604 result0 = null; | |
| 3605 pos = pos1; | |
| 3606 } | |
| 3607 } else { | |
| 3608 result0 = null; | |
| 3609 pos = pos1; | |
| 3610 } | |
| 3611 } else { | |
| 3612 result0 = null; | |
| 3613 pos = pos1; | |
| 3614 } | |
| 3615 } else { | |
| 3616 result0 = null; | |
| 3617 pos = pos1; | |
| 3618 } | |
| 3619 } else { | |
| 3620 result0 = null; | |
| 3621 pos = pos1; | |
| 3622 } | |
| 3623 } else { | |
| 3624 result0 = null; | |
| 3625 pos = pos1; | |
| 3626 } | |
| 3627 } else { | |
| 3628 result0 = null; | |
| 3629 pos = pos1; | |
| 3630 } | |
| 3631 } else { | |
| 3632 result0 = null; | |
| 3633 pos = pos1; | |
| 3634 } | |
| 3635 } else { | |
| 3636 result0 = null; | |
| 3637 pos = pos1; | |
| 3638 } | |
| 3639 } else { | |
| 3640 result0 = null; | |
| 3641 pos = pos1; | |
| 3642 } | |
| 3643 } else { | |
| 3644 result0 = null; | |
| 3645 pos = pos1; | |
| 3646 } | |
| 3647 } else { | |
| 3648 result0 = null; | |
| 3649 pos = pos1; | |
| 3650 } | |
| 3651 } else { | |
| 3652 result0 = null; | |
| 3653 pos = pos1; | |
| 3654 } | |
| 3655 } else { | |
| 3656 result0 = null; | |
| 3657 pos = pos1; | |
| 3658 } | |
| 3659 if (result0 !== null) { | |
| 3660 result0 = (function(offset, extAttrs, type, name, value) { return { ty
pe: "const", extAttrs: extAttrs, idlType: type, name: name, value: value }; })(p
os0, result0[0], result0[4], result0[6], result0[10]); | |
| 3661 } | |
| 3662 if (result0 === null) { | |
| 3663 pos = pos0; | |
| 3664 } | |
| 3665 return result0; | |
| 3666 } | |
| 3667 | |
| 3668 function parse_constExpr() { | |
| 3669 var result0; | |
| 3670 var pos0; | |
| 3671 | |
| 3672 pos0 = pos; | |
| 3673 result0 = parse_BooleanLiteral(); | |
| 3674 if (result0 === null) { | |
| 3675 result0 = parse_float(); | |
| 3676 if (result0 === null) { | |
| 3677 result0 = parse_integer(); | |
| 3678 if (result0 === null) { | |
| 3679 if (input.substr(pos, 3) === "NaN") { | |
| 3680 result0 = "NaN"; | |
| 3681 pos += 3; | |
| 3682 } else { | |
| 3683 result0 = null; | |
| 3684 if (reportFailures === 0) { | |
| 3685 matchFailed("\"NaN\""); | |
| 3686 } | |
| 3687 } | |
| 3688 if (result0 === null) { | |
| 3689 if (input.substr(pos, 4) === "null") { | |
| 3690 result0 = "null"; | |
| 3691 pos += 4; | |
| 3692 } else { | |
| 3693 result0 = null; | |
| 3694 if (reportFailures === 0) { | |
| 3695 matchFailed("\"null\""); | |
| 3696 } | |
| 3697 } | |
| 3698 if (result0 === null) { | |
| 3699 if (input.charCodeAt(pos) === 39) { | |
| 3700 result0 = "'"; | |
| 3701 pos++; | |
| 3702 } else { | |
| 3703 result0 = null; | |
| 3704 if (reportFailures === 0) { | |
| 3705 matchFailed("\"'\""); | |
| 3706 } | |
| 3707 } | |
| 3708 } | |
| 3709 } | |
| 3710 } | |
| 3711 } | |
| 3712 } | |
| 3713 if (result0 !== null) { | |
| 3714 result0 = (function(offset, value) { return value; })(pos0, result0); | |
| 3715 } | |
| 3716 if (result0 === null) { | |
| 3717 pos = pos0; | |
| 3718 } | |
| 3719 return result0; | |
| 3720 } | |
| 3721 | |
| 3722 function parse_attrOrOp() { | |
| 3723 var result0; | |
| 3724 var pos0; | |
| 3725 | |
| 3726 pos0 = pos; | |
| 3727 result0 = parse_Stringifier(); | |
| 3728 if (result0 === null) { | |
| 3729 result0 = parse_Attribute(); | |
| 3730 if (result0 === null) { | |
| 3731 result0 = parse_Operation(); | |
| 3732 } | |
| 3733 } | |
| 3734 if (result0 !== null) { | |
| 3735 result0 = (function(offset, ao) { return ao; })(pos0, result0); | |
| 3736 } | |
| 3737 if (result0 === null) { | |
| 3738 pos = pos0; | |
| 3739 } | |
| 3740 return result0; | |
| 3741 } | |
| 3742 | |
| 3743 function parse_Stringifier() { | |
| 3744 var result0, result1, result2; | |
| 3745 var pos0, pos1; | |
| 3746 | |
| 3747 pos0 = pos; | |
| 3748 pos1 = pos; | |
| 3749 if (input.substr(pos, 11) === "stringifier") { | |
| 3750 result0 = "stringifier"; | |
| 3751 pos += 11; | |
| 3752 } else { | |
| 3753 result0 = null; | |
| 3754 if (reportFailures === 0) { | |
| 3755 matchFailed("\"stringifier\""); | |
| 3756 } | |
| 3757 } | |
| 3758 if (result0 !== null) { | |
| 3759 result1 = parse_w(); | |
| 3760 if (result1 !== null) { | |
| 3761 result2 = parse_Attribute(); | |
| 3762 if (result2 === null) { | |
| 3763 result2 = parse_OperationRest(); | |
| 3764 if (result2 === null) { | |
| 3765 if (input.charCodeAt(pos) === 59) { | |
| 3766 result2 = ";"; | |
| 3767 pos++; | |
| 3768 } else { | |
| 3769 result2 = null; | |
| 3770 if (reportFailures === 0) { | |
| 3771 matchFailed("\";\""); | |
| 3772 } | |
| 3773 } | |
| 3774 } | |
| 3775 } | |
| 3776 if (result2 !== null) { | |
| 3777 result0 = [result0, result1, result2]; | |
| 3778 } else { | |
| 3779 result0 = null; | |
| 3780 pos = pos1; | |
| 3781 } | |
| 3782 } else { | |
| 3783 result0 = null; | |
| 3784 pos = pos1; | |
| 3785 } | |
| 3786 } else { | |
| 3787 result0 = null; | |
| 3788 pos = pos1; | |
| 3789 } | |
| 3790 if (result0 !== null) { | |
| 3791 result0 = (function(offset, rest) { | |
| 3792 if (rest === ";") return { type: "stringifier", stringifier:
true }; | |
| 3793 else { | |
| 3794 rest.stringifier = true; | |
| 3795 return rest; | |
| 3796 } | |
| 3797 })(pos0, result0[2]); | |
| 3798 } | |
| 3799 if (result0 === null) { | |
| 3800 pos = pos0; | |
| 3801 } | |
| 3802 return result0; | |
| 3803 } | |
| 3804 | |
| 3805 function parse_Attribute() { | |
| 3806 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13, result14; | |
| 3807 var pos0, pos1, pos2; | |
| 3808 | |
| 3809 pos0 = pos; | |
| 3810 pos1 = pos; | |
| 3811 result0 = parse_ExtendedAttributeList(); | |
| 3812 if (result0 !== null) { | |
| 3813 result1 = parse_w(); | |
| 3814 if (result1 !== null) { | |
| 3815 pos2 = pos; | |
| 3816 if (input.substr(pos, 8) === "readonly") { | |
| 3817 result2 = "readonly"; | |
| 3818 pos += 8; | |
| 3819 } else { | |
| 3820 result2 = null; | |
| 3821 if (reportFailures === 0) { | |
| 3822 matchFailed("\"readonly\""); | |
| 3823 } | |
| 3824 } | |
| 3825 if (result2 !== null) { | |
| 3826 result3 = parse_s(); | |
| 3827 if (result3 !== null) { | |
| 3828 result2 = [result2, result3]; | |
| 3829 } else { | |
| 3830 result2 = null; | |
| 3831 pos = pos2; | |
| 3832 } | |
| 3833 } else { | |
| 3834 result2 = null; | |
| 3835 pos = pos2; | |
| 3836 } | |
| 3837 result2 = result2 !== null ? result2 : ""; | |
| 3838 if (result2 !== null) { | |
| 3839 if (input.substr(pos, 9) === "attribute") { | |
| 3840 result3 = "attribute"; | |
| 3841 pos += 9; | |
| 3842 } else { | |
| 3843 result3 = null; | |
| 3844 if (reportFailures === 0) { | |
| 3845 matchFailed("\"attribute\""); | |
| 3846 } | |
| 3847 } | |
| 3848 if (result3 !== null) { | |
| 3849 result4 = parse_s(); | |
| 3850 if (result4 !== null) { | |
| 3851 result5 = parse_type(); | |
| 3852 if (result5 !== null) { | |
| 3853 result6 = parse_s(); | |
| 3854 if (result6 !== null) { | |
| 3855 result7 = parse_identifier(); | |
| 3856 if (result7 !== null) { | |
| 3857 result8 = parse_w(); | |
| 3858 if (result8 !== null) { | |
| 3859 result9 = parse_GetRaises(); | |
| 3860 result9 = result9 !== null ? result9 : ""; | |
| 3861 if (result9 !== null) { | |
| 3862 result10 = parse_w(); | |
| 3863 if (result10 !== null) { | |
| 3864 result11 = parse_SetRaises(); | |
| 3865 result11 = result11 !== null ? result11 : ""; | |
| 3866 if (result11 !== null) { | |
| 3867 result12 = parse_w(); | |
| 3868 if (result12 !== null) { | |
| 3869 if (input.charCodeAt(pos) === 59) { | |
| 3870 result13 = ";"; | |
| 3871 pos++; | |
| 3872 } else { | |
| 3873 result13 = null; | |
| 3874 if (reportFailures === 0) { | |
| 3875 matchFailed("\";\""); | |
| 3876 } | |
| 3877 } | |
| 3878 if (result13 !== null) { | |
| 3879 result14 = parse_w(); | |
| 3880 if (result14 !== null) { | |
| 3881 result0 = [result0, result1, result2, resu
lt3, result4, result5, result6, result7, result8, result9, result10, result11, r
esult12, result13, result14]; | |
| 3882 } else { | |
| 3883 result0 = null; | |
| 3884 pos = pos1; | |
| 3885 } | |
| 3886 } else { | |
| 3887 result0 = null; | |
| 3888 pos = pos1; | |
| 3889 } | |
| 3890 } else { | |
| 3891 result0 = null; | |
| 3892 pos = pos1; | |
| 3893 } | |
| 3894 } else { | |
| 3895 result0 = null; | |
| 3896 pos = pos1; | |
| 3897 } | |
| 3898 } else { | |
| 3899 result0 = null; | |
| 3900 pos = pos1; | |
| 3901 } | |
| 3902 } else { | |
| 3903 result0 = null; | |
| 3904 pos = pos1; | |
| 3905 } | |
| 3906 } else { | |
| 3907 result0 = null; | |
| 3908 pos = pos1; | |
| 3909 } | |
| 3910 } else { | |
| 3911 result0 = null; | |
| 3912 pos = pos1; | |
| 3913 } | |
| 3914 } else { | |
| 3915 result0 = null; | |
| 3916 pos = pos1; | |
| 3917 } | |
| 3918 } else { | |
| 3919 result0 = null; | |
| 3920 pos = pos1; | |
| 3921 } | |
| 3922 } else { | |
| 3923 result0 = null; | |
| 3924 pos = pos1; | |
| 3925 } | |
| 3926 } else { | |
| 3927 result0 = null; | |
| 3928 pos = pos1; | |
| 3929 } | |
| 3930 } else { | |
| 3931 result0 = null; | |
| 3932 pos = pos1; | |
| 3933 } | |
| 3934 } else { | |
| 3935 result0 = null; | |
| 3936 pos = pos1; | |
| 3937 } | |
| 3938 } else { | |
| 3939 result0 = null; | |
| 3940 pos = pos1; | |
| 3941 } | |
| 3942 if (result0 !== null) { | |
| 3943 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]); | |
| 3944 } | |
| 3945 if (result0 === null) { | |
| 3946 pos = pos0; | |
| 3947 } | |
| 3948 return result0; | |
| 3949 } | |
| 3950 | |
| 3951 function parse_GetRaises() { | |
| 3952 var result0, result1, result2, result3, result4; | |
| 3953 var pos0, pos1; | |
| 3954 | |
| 3955 pos0 = pos; | |
| 3956 pos1 = pos; | |
| 3957 if (input.substr(pos, 9) === "getraises") { | |
| 3958 result0 = "getraises"; | |
| 3959 pos += 9; | |
| 3960 } else { | |
| 3961 result0 = null; | |
| 3962 if (reportFailures === 0) { | |
| 3963 matchFailed("\"getraises\""); | |
| 3964 } | |
| 3965 } | |
| 3966 if (result0 !== null) { | |
| 3967 result1 = parse_w(); | |
| 3968 if (result1 !== null) { | |
| 3969 if (input.charCodeAt(pos) === 40) { | |
| 3970 result2 = "("; | |
| 3971 pos++; | |
| 3972 } else { | |
| 3973 result2 = null; | |
| 3974 if (reportFailures === 0) { | |
| 3975 matchFailed("\"(\""); | |
| 3976 } | |
| 3977 } | |
| 3978 if (result2 !== null) { | |
| 3979 result3 = parse_ScopedNameList(); | |
| 3980 if (result3 !== null) { | |
| 3981 if (input.charCodeAt(pos) === 41) { | |
| 3982 result4 = ")"; | |
| 3983 pos++; | |
| 3984 } else { | |
| 3985 result4 = null; | |
| 3986 if (reportFailures === 0) { | |
| 3987 matchFailed("\")\""); | |
| 3988 } | |
| 3989 } | |
| 3990 if (result4 !== null) { | |
| 3991 result0 = [result0, result1, result2, result3, result4]; | |
| 3992 } else { | |
| 3993 result0 = null; | |
| 3994 pos = pos1; | |
| 3995 } | |
| 3996 } else { | |
| 3997 result0 = null; | |
| 3998 pos = pos1; | |
| 3999 } | |
| 4000 } else { | |
| 4001 result0 = null; | |
| 4002 pos = pos1; | |
| 4003 } | |
| 4004 } else { | |
| 4005 result0 = null; | |
| 4006 pos = pos1; | |
| 4007 } | |
| 4008 } else { | |
| 4009 result0 = null; | |
| 4010 pos = pos1; | |
| 4011 } | |
| 4012 if (result0 !== null) { | |
| 4013 result0 = (function(offset, list) { return list; })(pos0, result0[3]); | |
| 4014 } | |
| 4015 if (result0 === null) { | |
| 4016 pos = pos0; | |
| 4017 } | |
| 4018 return result0; | |
| 4019 } | |
| 4020 | |
| 4021 function parse_SetRaises() { | |
| 4022 var result0, result1, result2, result3, result4; | |
| 4023 var pos0, pos1; | |
| 4024 | |
| 4025 pos0 = pos; | |
| 4026 pos1 = pos; | |
| 4027 if (input.substr(pos, 9) === "setraises") { | |
| 4028 result0 = "setraises"; | |
| 4029 pos += 9; | |
| 4030 } else { | |
| 4031 result0 = null; | |
| 4032 if (reportFailures === 0) { | |
| 4033 matchFailed("\"setraises\""); | |
| 4034 } | |
| 4035 } | |
| 4036 if (result0 !== null) { | |
| 4037 result1 = parse_w(); | |
| 4038 if (result1 !== null) { | |
| 4039 if (input.charCodeAt(pos) === 40) { | |
| 4040 result2 = "("; | |
| 4041 pos++; | |
| 4042 } else { | |
| 4043 result2 = null; | |
| 4044 if (reportFailures === 0) { | |
| 4045 matchFailed("\"(\""); | |
| 4046 } | |
| 4047 } | |
| 4048 if (result2 !== null) { | |
| 4049 result3 = parse_ScopedNameList(); | |
| 4050 if (result3 !== null) { | |
| 4051 if (input.charCodeAt(pos) === 41) { | |
| 4052 result4 = ")"; | |
| 4053 pos++; | |
| 4054 } else { | |
| 4055 result4 = null; | |
| 4056 if (reportFailures === 0) { | |
| 4057 matchFailed("\")\""); | |
| 4058 } | |
| 4059 } | |
| 4060 if (result4 !== null) { | |
| 4061 result0 = [result0, result1, result2, result3, result4]; | |
| 4062 } else { | |
| 4063 result0 = null; | |
| 4064 pos = pos1; | |
| 4065 } | |
| 4066 } else { | |
| 4067 result0 = null; | |
| 4068 pos = pos1; | |
| 4069 } | |
| 4070 } else { | |
| 4071 result0 = null; | |
| 4072 pos = pos1; | |
| 4073 } | |
| 4074 } else { | |
| 4075 result0 = null; | |
| 4076 pos = pos1; | |
| 4077 } | |
| 4078 } else { | |
| 4079 result0 = null; | |
| 4080 pos = pos1; | |
| 4081 } | |
| 4082 if (result0 !== null) { | |
| 4083 result0 = (function(offset, list) { return list; })(pos0, result0[3]); | |
| 4084 } | |
| 4085 if (result0 === null) { | |
| 4086 pos = pos0; | |
| 4087 } | |
| 4088 return result0; | |
| 4089 } | |
| 4090 | |
| 4091 function parse_Operation() { | |
| 4092 var result0, result1, result2, result3, result4; | |
| 4093 var pos0, pos1; | |
| 4094 | |
| 4095 pos0 = pos; | |
| 4096 pos1 = pos; | |
| 4097 result0 = parse_ExtendedAttributeList(); | |
| 4098 if (result0 !== null) { | |
| 4099 result1 = parse_w(); | |
| 4100 if (result1 !== null) { | |
| 4101 result2 = parse_Qualifiers(); | |
| 4102 if (result2 !== null) { | |
| 4103 result3 = parse_w(); | |
| 4104 if (result3 !== null) { | |
| 4105 result4 = parse_OperationRest(); | |
| 4106 if (result4 !== null) { | |
| 4107 result0 = [result0, result1, result2, result3, result4]; | |
| 4108 } else { | |
| 4109 result0 = null; | |
| 4110 pos = pos1; | |
| 4111 } | |
| 4112 } else { | |
| 4113 result0 = null; | |
| 4114 pos = pos1; | |
| 4115 } | |
| 4116 } else { | |
| 4117 result0 = null; | |
| 4118 pos = pos1; | |
| 4119 } | |
| 4120 } else { | |
| 4121 result0 = null; | |
| 4122 pos = pos1; | |
| 4123 } | |
| 4124 } else { | |
| 4125 result0 = null; | |
| 4126 pos = pos1; | |
| 4127 } | |
| 4128 if (result0 !== null) { | |
| 4129 result0 = (function(offset, extAttrs, quals, rest) { | |
| 4130 for (var k in quals) rest[k] = quals[k]; | |
| 4131 if (extAttrs) rest.extAttrs = extAttrs; | |
| 4132 return rest; | |
| 4133 })(pos0, result0[0], result0[2], result0[4]); | |
| 4134 } | |
| 4135 if (result0 === null) { | |
| 4136 pos = pos0; | |
| 4137 } | |
| 4138 return result0; | |
| 4139 } | |
| 4140 | |
| 4141 function parse_Qualifiers() { | |
| 4142 var result0, result1, result2; | |
| 4143 var pos0, pos1; | |
| 4144 | |
| 4145 pos0 = pos; | |
| 4146 pos1 = pos; | |
| 4147 result0 = parse_w(); | |
| 4148 if (result0 !== null) { | |
| 4149 if (input.substr(pos, 6) === "static") { | |
| 4150 result1 = "static"; | |
| 4151 pos += 6; | |
| 4152 } else { | |
| 4153 result1 = null; | |
| 4154 if (reportFailures === 0) { | |
| 4155 matchFailed("\"static\""); | |
| 4156 } | |
| 4157 } | |
| 4158 if (result1 === null) { | |
| 4159 result1 = []; | |
| 4160 result2 = parse_Special(); | |
| 4161 while (result2 !== null) { | |
| 4162 result1.push(result2); | |
| 4163 result2 = parse_Special(); | |
| 4164 } | |
| 4165 } | |
| 4166 if (result1 !== null) { | |
| 4167 result0 = [result0, result1]; | |
| 4168 } else { | |
| 4169 result0 = null; | |
| 4170 pos = pos1; | |
| 4171 } | |
| 4172 } else { | |
| 4173 result0 = null; | |
| 4174 pos = pos1; | |
| 4175 } | |
| 4176 if (result0 !== null) { | |
| 4177 result0 = (function(offset, quals) { if (typeof quals == "string") r
eturn [quals]; | |
| 4178 return quals; })(pos0, result0[1]); | |
| 4179 } | |
| 4180 if (result0 === null) { | |
| 4181 pos = pos0; | |
| 4182 } | |
| 4183 return result0; | |
| 4184 } | |
| 4185 | |
| 4186 function parse_Special() { | |
| 4187 var result0, result1, result2; | |
| 4188 var pos0, pos1; | |
| 4189 | |
| 4190 pos0 = pos; | |
| 4191 pos1 = pos; | |
| 4192 result0 = parse_w(); | |
| 4193 if (result0 !== null) { | |
| 4194 if (input.substr(pos, 6) === "getter") { | |
| 4195 result1 = "getter"; | |
| 4196 pos += 6; | |
| 4197 } else { | |
| 4198 result1 = null; | |
| 4199 if (reportFailures === 0) { | |
| 4200 matchFailed("\"getter\""); | |
| 4201 } | |
| 4202 } | |
| 4203 if (result1 === null) { | |
| 4204 if (input.substr(pos, 6) === "setter") { | |
| 4205 result1 = "setter"; | |
| 4206 pos += 6; | |
| 4207 } else { | |
| 4208 result1 = null; | |
| 4209 if (reportFailures === 0) { | |
| 4210 matchFailed("\"setter\""); | |
| 4211 } | |
| 4212 } | |
| 4213 if (result1 === null) { | |
| 4214 if (input.substr(pos, 7) === "creator") { | |
| 4215 result1 = "creator"; | |
| 4216 pos += 7; | |
| 4217 } else { | |
| 4218 result1 = null; | |
| 4219 if (reportFailures === 0) { | |
| 4220 matchFailed("\"creator\""); | |
| 4221 } | |
| 4222 } | |
| 4223 if (result1 === null) { | |
| 4224 if (input.substr(pos, 7) === "deleter") { | |
| 4225 result1 = "deleter"; | |
| 4226 pos += 7; | |
| 4227 } else { | |
| 4228 result1 = null; | |
| 4229 if (reportFailures === 0) { | |
| 4230 matchFailed("\"deleter\""); | |
| 4231 } | |
| 4232 } | |
| 4233 if (result1 === null) { | |
| 4234 if (input.substr(pos, 12) === "legacycaller") { | |
| 4235 result1 = "legacycaller"; | |
| 4236 pos += 12; | |
| 4237 } else { | |
| 4238 result1 = null; | |
| 4239 if (reportFailures === 0) { | |
| 4240 matchFailed("\"legacycaller\""); | |
| 4241 } | |
| 4242 } | |
| 4243 } | |
| 4244 } | |
| 4245 } | |
| 4246 } | |
| 4247 if (result1 !== null) { | |
| 4248 result2 = parse_w(); | |
| 4249 if (result2 !== null) { | |
| 4250 result0 = [result0, result1, result2]; | |
| 4251 } else { | |
| 4252 result0 = null; | |
| 4253 pos = pos1; | |
| 4254 } | |
| 4255 } else { | |
| 4256 result0 = null; | |
| 4257 pos = pos1; | |
| 4258 } | |
| 4259 } else { | |
| 4260 result0 = null; | |
| 4261 pos = pos1; | |
| 4262 } | |
| 4263 if (result0 !== null) { | |
| 4264 result0 = (function(offset, spe) { return spe; })(pos0, result0[1]); | |
| 4265 } | |
| 4266 if (result0 === null) { | |
| 4267 pos = pos0; | |
| 4268 } | |
| 4269 return result0; | |
| 4270 } | |
| 4271 | |
| 4272 function parse_OperationRest() { | |
| 4273 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13; | |
| 4274 var pos0, pos1; | |
| 4275 | |
| 4276 pos0 = pos; | |
| 4277 pos1 = pos; | |
| 4278 result0 = parse_ReturnType(); | |
| 4279 if (result0 !== null) { | |
| 4280 result1 = parse_s(); | |
| 4281 if (result1 !== null) { | |
| 4282 result2 = parse_identifier(); | |
| 4283 result2 = result2 !== null ? result2 : ""; | |
| 4284 if (result2 !== null) { | |
| 4285 result3 = parse_w(); | |
| 4286 if (result3 !== null) { | |
| 4287 if (input.charCodeAt(pos) === 40) { | |
| 4288 result4 = "("; | |
| 4289 pos++; | |
| 4290 } else { | |
| 4291 result4 = null; | |
| 4292 if (reportFailures === 0) { | |
| 4293 matchFailed("\"(\""); | |
| 4294 } | |
| 4295 } | |
| 4296 if (result4 !== null) { | |
| 4297 result5 = parse_w(); | |
| 4298 if (result5 !== null) { | |
| 4299 result6 = parse_Arguments(); | |
| 4300 result6 = result6 !== null ? result6 : ""; | |
| 4301 if (result6 !== null) { | |
| 4302 result7 = parse_w(); | |
| 4303 if (result7 !== null) { | |
| 4304 if (input.charCodeAt(pos) === 41) { | |
| 4305 result8 = ")"; | |
| 4306 pos++; | |
| 4307 } else { | |
| 4308 result8 = null; | |
| 4309 if (reportFailures === 0) { | |
| 4310 matchFailed("\")\""); | |
| 4311 } | |
| 4312 } | |
| 4313 if (result8 !== null) { | |
| 4314 result9 = parse_w(); | |
| 4315 if (result9 !== null) { | |
| 4316 result10 = parse_Raises(); | |
| 4317 result10 = result10 !== null ? result10 : ""; | |
| 4318 if (result10 !== null) { | |
| 4319 result11 = parse_w(); | |
| 4320 if (result11 !== null) { | |
| 4321 if (input.charCodeAt(pos) === 59) { | |
| 4322 result12 = ";"; | |
| 4323 pos++; | |
| 4324 } else { | |
| 4325 result12 = null; | |
| 4326 if (reportFailures === 0) { | |
| 4327 matchFailed("\";\""); | |
| 4328 } | |
| 4329 } | |
| 4330 if (result12 !== null) { | |
| 4331 result13 = parse_w(); | |
| 4332 if (result13 !== null) { | |
| 4333 result0 = [result0, result1, result2, result
3, result4, result5, result6, result7, result8, result9, result10, result11, res
ult12, result13]; | |
| 4334 } else { | |
| 4335 result0 = null; | |
| 4336 pos = pos1; | |
| 4337 } | |
| 4338 } else { | |
| 4339 result0 = null; | |
| 4340 pos = pos1; | |
| 4341 } | |
| 4342 } else { | |
| 4343 result0 = null; | |
| 4344 pos = pos1; | |
| 4345 } | |
| 4346 } else { | |
| 4347 result0 = null; | |
| 4348 pos = pos1; | |
| 4349 } | |
| 4350 } else { | |
| 4351 result0 = null; | |
| 4352 pos = pos1; | |
| 4353 } | |
| 4354 } else { | |
| 4355 result0 = null; | |
| 4356 pos = pos1; | |
| 4357 } | |
| 4358 } else { | |
| 4359 result0 = null; | |
| 4360 pos = pos1; | |
| 4361 } | |
| 4362 } else { | |
| 4363 result0 = null; | |
| 4364 pos = pos1; | |
| 4365 } | |
| 4366 } else { | |
| 4367 result0 = null; | |
| 4368 pos = pos1; | |
| 4369 } | |
| 4370 } else { | |
| 4371 result0 = null; | |
| 4372 pos = pos1; | |
| 4373 } | |
| 4374 } else { | |
| 4375 result0 = null; | |
| 4376 pos = pos1; | |
| 4377 } | |
| 4378 } else { | |
| 4379 result0 = null; | |
| 4380 pos = pos1; | |
| 4381 } | |
| 4382 } else { | |
| 4383 result0 = null; | |
| 4384 pos = pos1; | |
| 4385 } | |
| 4386 } else { | |
| 4387 result0 = null; | |
| 4388 pos = pos1; | |
| 4389 } | |
| 4390 if (result0 !== null) { | |
| 4391 result0 = (function(offset, ret, name, args, exc) { return { type: "op
eration", idlType: ret, name: name, arguments: (args ? args : []), raises: exc }
; })(pos0, result0[0], result0[2], result0[6], result0[10]); | |
| 4392 } | |
| 4393 if (result0 === null) { | |
| 4394 pos = pos0; | |
| 4395 } | |
| 4396 return result0; | |
| 4397 } | |
| 4398 | |
| 4399 function parse_Arguments() { | |
| 4400 var result0, result1, result2; | |
| 4401 var pos0, pos1; | |
| 4402 | |
| 4403 pos0 = pos; | |
| 4404 pos1 = pos; | |
| 4405 result0 = parse_Argument(); | |
| 4406 if (result0 !== null) { | |
| 4407 result1 = []; | |
| 4408 result2 = parse_ArgumentsRest(); | |
| 4409 while (result2 !== null) { | |
| 4410 result1.push(result2); | |
| 4411 result2 = parse_ArgumentsRest(); | |
| 4412 } | |
| 4413 if (result1 !== null) { | |
| 4414 result0 = [result0, result1]; | |
| 4415 } else { | |
| 4416 result0 = null; | |
| 4417 pos = pos1; | |
| 4418 } | |
| 4419 } else { | |
| 4420 result0 = null; | |
| 4421 pos = pos1; | |
| 4422 } | |
| 4423 if (result0 !== null) { | |
| 4424 result0 = (function(offset, first, others) { var ret = [first]; | |
| 4425 for (var i = 0, n = others.length; i < n; i++) { ret.push(ot
hers[i]); } | |
| 4426 return ret; })(pos0, result0[0], result0[1]); | |
| 4427 } | |
| 4428 if (result0 === null) { | |
| 4429 pos = pos0; | |
| 4430 } | |
| 4431 return result0; | |
| 4432 } | |
| 4433 | |
| 4434 function parse_ArgumentsRest() { | |
| 4435 var result0, result1, result2, result3; | |
| 4436 var pos0, pos1; | |
| 4437 | |
| 4438 pos0 = pos; | |
| 4439 pos1 = pos; | |
| 4440 result0 = parse_w(); | |
| 4441 if (result0 !== null) { | |
| 4442 if (input.charCodeAt(pos) === 44) { | |
| 4443 result1 = ","; | |
| 4444 pos++; | |
| 4445 } else { | |
| 4446 result1 = null; | |
| 4447 if (reportFailures === 0) { | |
| 4448 matchFailed("\",\""); | |
| 4449 } | |
| 4450 } | |
| 4451 if (result1 !== null) { | |
| 4452 result2 = parse_w(); | |
| 4453 if (result2 !== null) { | |
| 4454 result3 = parse_Argument(); | |
| 4455 if (result3 !== null) { | |
| 4456 result0 = [result0, result1, result2, result3]; | |
| 4457 } else { | |
| 4458 result0 = null; | |
| 4459 pos = pos1; | |
| 4460 } | |
| 4461 } else { | |
| 4462 result0 = null; | |
| 4463 pos = pos1; | |
| 4464 } | |
| 4465 } else { | |
| 4466 result0 = null; | |
| 4467 pos = pos1; | |
| 4468 } | |
| 4469 } else { | |
| 4470 result0 = null; | |
| 4471 pos = pos1; | |
| 4472 } | |
| 4473 if (result0 !== null) { | |
| 4474 result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); | |
| 4475 } | |
| 4476 if (result0 === null) { | |
| 4477 pos = pos0; | |
| 4478 } | |
| 4479 return result0; | |
| 4480 } | |
| 4481 | |
| 4482 function parse_Argument() { | |
| 4483 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9; | |
| 4484 var pos0, pos1; | |
| 4485 | |
| 4486 pos0 = pos; | |
| 4487 pos1 = pos; | |
| 4488 result0 = parse_ExtendedAttributeList(); | |
| 4489 if (result0 !== null) { | |
| 4490 result1 = parse_w(); | |
| 4491 if (result1 !== null) { | |
| 4492 if (input.substr(pos, 2) === "in") { | |
| 4493 result2 = "in"; | |
| 4494 pos += 2; | |
| 4495 } else { | |
| 4496 result2 = null; | |
| 4497 if (reportFailures === 0) { | |
| 4498 matchFailed("\"in\""); | |
| 4499 } | |
| 4500 } | |
| 4501 result2 = result2 !== null ? result2 : ""; | |
| 4502 if (result2 !== null) { | |
| 4503 result3 = parse_w(); | |
| 4504 if (result3 !== null) { | |
| 4505 if (input.substr(pos, 8) === "optional") { | |
| 4506 result4 = "optional"; | |
| 4507 pos += 8; | |
| 4508 } else { | |
| 4509 result4 = null; | |
| 4510 if (reportFailures === 0) { | |
| 4511 matchFailed("\"optional\""); | |
| 4512 } | |
| 4513 } | |
| 4514 result4 = result4 !== null ? result4 : ""; | |
| 4515 if (result4 !== null) { | |
| 4516 result5 = parse_w(); | |
| 4517 if (result5 !== null) { | |
| 4518 result6 = parse_type(); | |
| 4519 if (result6 !== null) { | |
| 4520 if (input.substr(pos, 3) === "...") { | |
| 4521 result7 = "..."; | |
| 4522 pos += 3; | |
| 4523 } else { | |
| 4524 result7 = null; | |
| 4525 if (reportFailures === 0) { | |
| 4526 matchFailed("\"...\""); | |
| 4527 } | |
| 4528 } | |
| 4529 result7 = result7 !== null ? result7 : ""; | |
| 4530 if (result7 !== null) { | |
| 4531 result8 = parse_s(); | |
| 4532 if (result8 !== null) { | |
| 4533 result9 = parse_identifier(); | |
| 4534 if (result9 !== null) { | |
| 4535 result0 = [result0, result1, result2, result3, resul
t4, result5, result6, result7, result8, result9]; | |
| 4536 } else { | |
| 4537 result0 = null; | |
| 4538 pos = pos1; | |
| 4539 } | |
| 4540 } else { | |
| 4541 result0 = null; | |
| 4542 pos = pos1; | |
| 4543 } | |
| 4544 } else { | |
| 4545 result0 = null; | |
| 4546 pos = pos1; | |
| 4547 } | |
| 4548 } else { | |
| 4549 result0 = null; | |
| 4550 pos = pos1; | |
| 4551 } | |
| 4552 } else { | |
| 4553 result0 = null; | |
| 4554 pos = pos1; | |
| 4555 } | |
| 4556 } else { | |
| 4557 result0 = null; | |
| 4558 pos = pos1; | |
| 4559 } | |
| 4560 } else { | |
| 4561 result0 = null; | |
| 4562 pos = pos1; | |
| 4563 } | |
| 4564 } else { | |
| 4565 result0 = null; | |
| 4566 pos = pos1; | |
| 4567 } | |
| 4568 } else { | |
| 4569 result0 = null; | |
| 4570 pos = pos1; | |
| 4571 } | |
| 4572 } else { | |
| 4573 result0 = null; | |
| 4574 pos = pos1; | |
| 4575 } | |
| 4576 if (result0 !== null) { | |
| 4577 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], resu
lt0[7], result0[9]); | |
| 4578 } | |
| 4579 if (result0 === null) { | |
| 4580 pos = pos0; | |
| 4581 } | |
| 4582 return result0; | |
| 4583 } | |
| 4584 | |
| 4585 function parse_Raises() { | |
| 4586 var result0, result1, result2, result3, result4, result5, result6; | |
| 4587 var pos0, pos1; | |
| 4588 | |
| 4589 pos0 = pos; | |
| 4590 pos1 = pos; | |
| 4591 if (input.substr(pos, 6) === "raises") { | |
| 4592 result0 = "raises"; | |
| 4593 pos += 6; | |
| 4594 } else { | |
| 4595 result0 = null; | |
| 4596 if (reportFailures === 0) { | |
| 4597 matchFailed("\"raises\""); | |
| 4598 } | |
| 4599 } | |
| 4600 if (result0 !== null) { | |
| 4601 result1 = parse_s(); | |
| 4602 if (result1 !== null) { | |
| 4603 if (input.charCodeAt(pos) === 40) { | |
| 4604 result2 = "("; | |
| 4605 pos++; | |
| 4606 } else { | |
| 4607 result2 = null; | |
| 4608 if (reportFailures === 0) { | |
| 4609 matchFailed("\"(\""); | |
| 4610 } | |
| 4611 } | |
| 4612 if (result2 !== null) { | |
| 4613 result3 = parse_w(); | |
| 4614 if (result3 !== null) { | |
| 4615 result4 = parse_ScopedNameList(); | |
| 4616 if (result4 !== null) { | |
| 4617 result5 = parse_w(); | |
| 4618 if (result5 !== null) { | |
| 4619 if (input.charCodeAt(pos) === 41) { | |
| 4620 result6 = ")"; | |
| 4621 pos++; | |
| 4622 } else { | |
| 4623 result6 = null; | |
| 4624 if (reportFailures === 0) { | |
| 4625 matchFailed("\")\""); | |
| 4626 } | |
| 4627 } | |
| 4628 if (result6 !== null) { | |
| 4629 result0 = [result0, result1, result2, result3, result4, re
sult5, result6]; | |
| 4630 } else { | |
| 4631 result0 = null; | |
| 4632 pos = pos1; | |
| 4633 } | |
| 4634 } else { | |
| 4635 result0 = null; | |
| 4636 pos = pos1; | |
| 4637 } | |
| 4638 } else { | |
| 4639 result0 = null; | |
| 4640 pos = pos1; | |
| 4641 } | |
| 4642 } else { | |
| 4643 result0 = null; | |
| 4644 pos = pos1; | |
| 4645 } | |
| 4646 } else { | |
| 4647 result0 = null; | |
| 4648 pos = pos1; | |
| 4649 } | |
| 4650 } else { | |
| 4651 result0 = null; | |
| 4652 pos = pos1; | |
| 4653 } | |
| 4654 } else { | |
| 4655 result0 = null; | |
| 4656 pos = pos1; | |
| 4657 } | |
| 4658 if (result0 !== null) { | |
| 4659 result0 = (function(offset, list) { return list; })(pos0, result0[4]); | |
| 4660 } | |
| 4661 if (result0 === null) { | |
| 4662 pos = pos0; | |
| 4663 } | |
| 4664 return result0; | |
| 4665 } | |
| 4666 | |
| 4667 function parse_dictionary() { | |
| 4668 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13; | |
| 4669 var pos0, pos1; | |
| 4670 | |
| 4671 pos0 = pos; | |
| 4672 pos1 = pos; | |
| 4673 if (input.substr(pos, 10) === "dictionary") { | |
| 4674 result0 = "dictionary"; | |
| 4675 pos += 10; | |
| 4676 } else { | |
| 4677 result0 = null; | |
| 4678 if (reportFailures === 0) { | |
| 4679 matchFailed("\"dictionary\""); | |
| 4680 } | |
| 4681 } | |
| 4682 if (result0 !== null) { | |
| 4683 result1 = parse_s(); | |
| 4684 if (result1 !== null) { | |
| 4685 result2 = parse_identifier(); | |
| 4686 if (result2 !== null) { | |
| 4687 result3 = parse_w(); | |
| 4688 if (result3 !== null) { | |
| 4689 result4 = parse_Inheritance(); | |
| 4690 if (result4 !== null) { | |
| 4691 result5 = parse_w(); | |
| 4692 if (result5 !== null) { | |
| 4693 if (input.charCodeAt(pos) === 123) { | |
| 4694 result6 = "{"; | |
| 4695 pos++; | |
| 4696 } else { | |
| 4697 result6 = null; | |
| 4698 if (reportFailures === 0) { | |
| 4699 matchFailed("\"{\""); | |
| 4700 } | |
| 4701 } | |
| 4702 if (result6 !== null) { | |
| 4703 result7 = parse_w(); | |
| 4704 if (result7 !== null) { | |
| 4705 result8 = parse_DictionaryMemberList(); | |
| 4706 if (result8 !== null) { | |
| 4707 result9 = parse_w(); | |
| 4708 if (result9 !== null) { | |
| 4709 if (input.charCodeAt(pos) === 125) { | |
| 4710 result10 = "}"; | |
| 4711 pos++; | |
| 4712 } else { | |
| 4713 result10 = null; | |
| 4714 if (reportFailures === 0) { | |
| 4715 matchFailed("\"}\""); | |
| 4716 } | |
| 4717 } | |
| 4718 if (result10 !== null) { | |
| 4719 result11 = parse_w(); | |
| 4720 if (result11 !== null) { | |
| 4721 if (input.charCodeAt(pos) === 59) { | |
| 4722 result12 = ";"; | |
| 4723 pos++; | |
| 4724 } else { | |
| 4725 result12 = null; | |
| 4726 if (reportFailures === 0) { | |
| 4727 matchFailed("\";\""); | |
| 4728 } | |
| 4729 } | |
| 4730 if (result12 !== null) { | |
| 4731 result13 = parse_w(); | |
| 4732 if (result13 !== null) { | |
| 4733 result0 = [result0, result1, result2, result
3, result4, result5, result6, result7, result8, result9, result10, result11, res
ult12, result13]; | |
| 4734 } else { | |
| 4735 result0 = null; | |
| 4736 pos = pos1; | |
| 4737 } | |
| 4738 } else { | |
| 4739 result0 = null; | |
| 4740 pos = pos1; | |
| 4741 } | |
| 4742 } else { | |
| 4743 result0 = null; | |
| 4744 pos = pos1; | |
| 4745 } | |
| 4746 } else { | |
| 4747 result0 = null; | |
| 4748 pos = pos1; | |
| 4749 } | |
| 4750 } else { | |
| 4751 result0 = null; | |
| 4752 pos = pos1; | |
| 4753 } | |
| 4754 } else { | |
| 4755 result0 = null; | |
| 4756 pos = pos1; | |
| 4757 } | |
| 4758 } else { | |
| 4759 result0 = null; | |
| 4760 pos = pos1; | |
| 4761 } | |
| 4762 } else { | |
| 4763 result0 = null; | |
| 4764 pos = pos1; | |
| 4765 } | |
| 4766 } else { | |
| 4767 result0 = null; | |
| 4768 pos = pos1; | |
| 4769 } | |
| 4770 } else { | |
| 4771 result0 = null; | |
| 4772 pos = pos1; | |
| 4773 } | |
| 4774 } else { | |
| 4775 result0 = null; | |
| 4776 pos = pos1; | |
| 4777 } | |
| 4778 } else { | |
| 4779 result0 = null; | |
| 4780 pos = pos1; | |
| 4781 } | |
| 4782 } else { | |
| 4783 result0 = null; | |
| 4784 pos = pos1; | |
| 4785 } | |
| 4786 } else { | |
| 4787 result0 = null; | |
| 4788 pos = pos1; | |
| 4789 } | |
| 4790 if (result0 !== null) { | |
| 4791 result0 = (function(offset, name, superclass, members) { | |
| 4792 return { | |
| 4793 type: "dictionary", | |
| 4794 name: name, | |
| 4795 inheritance: superclass, | |
| 4796 members: members | |
| 4797 }; | |
| 4798 })(pos0, result0[2], result0[4], result0[8]); | |
| 4799 } | |
| 4800 if (result0 === null) { | |
| 4801 pos = pos0; | |
| 4802 } | |
| 4803 return result0; | |
| 4804 } | |
| 4805 | |
| 4806 function parse_DictionaryMemberList() { | |
| 4807 var result0, result1; | |
| 4808 var pos0; | |
| 4809 | |
| 4810 pos0 = pos; | |
| 4811 result0 = []; | |
| 4812 result1 = parse_DictionaryMember(); | |
| 4813 while (result1 !== null) { | |
| 4814 result0.push(result1); | |
| 4815 result1 = parse_DictionaryMember(); | |
| 4816 } | |
| 4817 if (result0 !== null) { | |
| 4818 result0 = (function(offset, mem) { return mem ? mem : []; })(pos0, res
ult0); | |
| 4819 } | |
| 4820 if (result0 === null) { | |
| 4821 pos = pos0; | |
| 4822 } | |
| 4823 return result0; | |
| 4824 } | |
| 4825 | |
| 4826 function parse_DictionaryMember() { | |
| 4827 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9; | |
| 4828 var pos0, pos1; | |
| 4829 | |
| 4830 pos0 = pos; | |
| 4831 pos1 = pos; | |
| 4832 result0 = parse_ExtendedAttributeList(); | |
| 4833 if (result0 !== null) { | |
| 4834 result1 = parse_w(); | |
| 4835 if (result1 !== null) { | |
| 4836 result2 = parse_type(); | |
| 4837 if (result2 !== null) { | |
| 4838 result3 = parse_s(); | |
| 4839 if (result3 !== null) { | |
| 4840 result4 = parse_identifier(); | |
| 4841 if (result4 !== null) { | |
| 4842 result5 = parse_w(); | |
| 4843 if (result5 !== null) { | |
| 4844 result6 = parse_defaultValue(); | |
| 4845 result6 = result6 !== null ? result6 : ""; | |
| 4846 if (result6 !== null) { | |
| 4847 result7 = parse_w(); | |
| 4848 if (result7 !== null) { | |
| 4849 if (input.charCodeAt(pos) === 59) { | |
| 4850 result8 = ";"; | |
| 4851 pos++; | |
| 4852 } else { | |
| 4853 result8 = null; | |
| 4854 if (reportFailures === 0) { | |
| 4855 matchFailed("\";\""); | |
| 4856 } | |
| 4857 } | |
| 4858 if (result8 !== null) { | |
| 4859 result9 = parse_w(); | |
| 4860 if (result9 !== null) { | |
| 4861 result0 = [result0, result1, result2, result3, resul
t4, result5, result6, result7, result8, result9]; | |
| 4862 } else { | |
| 4863 result0 = null; | |
| 4864 pos = pos1; | |
| 4865 } | |
| 4866 } else { | |
| 4867 result0 = null; | |
| 4868 pos = pos1; | |
| 4869 } | |
| 4870 } else { | |
| 4871 result0 = null; | |
| 4872 pos = pos1; | |
| 4873 } | |
| 4874 } else { | |
| 4875 result0 = null; | |
| 4876 pos = pos1; | |
| 4877 } | |
| 4878 } else { | |
| 4879 result0 = null; | |
| 4880 pos = pos1; | |
| 4881 } | |
| 4882 } else { | |
| 4883 result0 = null; | |
| 4884 pos = pos1; | |
| 4885 } | |
| 4886 } else { | |
| 4887 result0 = null; | |
| 4888 pos = pos1; | |
| 4889 } | |
| 4890 } else { | |
| 4891 result0 = null; | |
| 4892 pos = pos1; | |
| 4893 } | |
| 4894 } else { | |
| 4895 result0 = null; | |
| 4896 pos = pos1; | |
| 4897 } | |
| 4898 } else { | |
| 4899 result0 = null; | |
| 4900 pos = pos1; | |
| 4901 } | |
| 4902 if (result0 !== null) { | |
| 4903 result0 = (function(offset, extAttrs, type, name, defaultValue) { | |
| 4904 return { | |
| 4905 type: type, | |
| 4906 name: name, | |
| 4907 defaultValue: defaultValue | |
| 4908 }; | |
| 4909 })(pos0, result0[0], result0[2], result0[4], result0[6]); | |
| 4910 } | |
| 4911 if (result0 === null) { | |
| 4912 pos = pos0; | |
| 4913 } | |
| 4914 return result0; | |
| 4915 } | |
| 4916 | |
| 4917 function parse_defaultValue() { | |
| 4918 var result0, result1, result2; | |
| 4919 var pos0, pos1; | |
| 4920 | |
| 4921 pos0 = pos; | |
| 4922 pos1 = pos; | |
| 4923 if (input.charCodeAt(pos) === 61) { | |
| 4924 result0 = "="; | |
| 4925 pos++; | |
| 4926 } else { | |
| 4927 result0 = null; | |
| 4928 if (reportFailures === 0) { | |
| 4929 matchFailed("\"=\""); | |
| 4930 } | |
| 4931 } | |
| 4932 if (result0 !== null) { | |
| 4933 result1 = parse_w(); | |
| 4934 if (result1 !== null) { | |
| 4935 result2 = parse_constExpr(); | |
| 4936 if (result2 === null) { | |
| 4937 result2 = parse_string(); | |
| 4938 } | |
| 4939 if (result2 !== null) { | |
| 4940 result0 = [result0, result1, result2]; | |
| 4941 } else { | |
| 4942 result0 = null; | |
| 4943 pos = pos1; | |
| 4944 } | |
| 4945 } else { | |
| 4946 result0 = null; | |
| 4947 pos = pos1; | |
| 4948 } | |
| 4949 } else { | |
| 4950 result0 = null; | |
| 4951 pos = pos1; | |
| 4952 } | |
| 4953 if (result0 !== null) { | |
| 4954 result0 = (function(offset, value) { return value; })(pos0, result0[2]
); | |
| 4955 } | |
| 4956 if (result0 === null) { | |
| 4957 pos = pos0; | |
| 4958 } | |
| 4959 return result0; | |
| 4960 } | |
| 4961 | |
| 4962 function parse_typedef() { | |
| 4963 var result0, result1, result2, result3, result4, result5, result6, resul
t7; | |
| 4964 var pos0, pos1; | |
| 4965 | |
| 4966 pos0 = pos; | |
| 4967 pos1 = pos; | |
| 4968 if (input.substr(pos, 7) === "typedef") { | |
| 4969 result0 = "typedef"; | |
| 4970 pos += 7; | |
| 4971 } else { | |
| 4972 result0 = null; | |
| 4973 if (reportFailures === 0) { | |
| 4974 matchFailed("\"typedef\""); | |
| 4975 } | |
| 4976 } | |
| 4977 if (result0 !== null) { | |
| 4978 result1 = parse_s(); | |
| 4979 if (result1 !== null) { | |
| 4980 result2 = parse_type(); | |
| 4981 if (result2 !== null) { | |
| 4982 result3 = parse_s(); | |
| 4983 if (result3 !== null) { | |
| 4984 result4 = parse_identifier(); | |
| 4985 if (result4 !== null) { | |
| 4986 result5 = parse_w(); | |
| 4987 if (result5 !== null) { | |
| 4988 if (input.charCodeAt(pos) === 59) { | |
| 4989 result6 = ";"; | |
| 4990 pos++; | |
| 4991 } else { | |
| 4992 result6 = null; | |
| 4993 if (reportFailures === 0) { | |
| 4994 matchFailed("\";\""); | |
| 4995 } | |
| 4996 } | |
| 4997 if (result6 !== null) { | |
| 4998 result7 = parse_w(); | |
| 4999 if (result7 !== null) { | |
| 5000 result0 = [result0, result1, result2, result3, result4,
result5, result6, result7]; | |
| 5001 } else { | |
| 5002 result0 = null; | |
| 5003 pos = pos1; | |
| 5004 } | |
| 5005 } else { | |
| 5006 result0 = null; | |
| 5007 pos = pos1; | |
| 5008 } | |
| 5009 } else { | |
| 5010 result0 = null; | |
| 5011 pos = pos1; | |
| 5012 } | |
| 5013 } else { | |
| 5014 result0 = null; | |
| 5015 pos = pos1; | |
| 5016 } | |
| 5017 } else { | |
| 5018 result0 = null; | |
| 5019 pos = pos1; | |
| 5020 } | |
| 5021 } else { | |
| 5022 result0 = null; | |
| 5023 pos = pos1; | |
| 5024 } | |
| 5025 } else { | |
| 5026 result0 = null; | |
| 5027 pos = pos1; | |
| 5028 } | |
| 5029 } else { | |
| 5030 result0 = null; | |
| 5031 pos = pos1; | |
| 5032 } | |
| 5033 if (result0 !== null) { | |
| 5034 result0 = (function(offset, type, name) { return { type: 'typedef', na
me: name, idlType: type }; })(pos0, result0[2], result0[4]); | |
| 5035 } | |
| 5036 if (result0 === null) { | |
| 5037 pos = pos0; | |
| 5038 } | |
| 5039 return result0; | |
| 5040 } | |
| 5041 | |
| 5042 function parse_exception() { | |
| 5043 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10, result11, result12, result13, result14, result15
; | |
| 5044 var pos0, pos1; | |
| 5045 | |
| 5046 pos0 = pos; | |
| 5047 pos1 = pos; | |
| 5048 result0 = parse_ExtendedAttributeList(); | |
| 5049 if (result0 !== null) { | |
| 5050 result1 = parse_w(); | |
| 5051 if (result1 !== null) { | |
| 5052 if (input.substr(pos, 9) === "exception") { | |
| 5053 result2 = "exception"; | |
| 5054 pos += 9; | |
| 5055 } else { | |
| 5056 result2 = null; | |
| 5057 if (reportFailures === 0) { | |
| 5058 matchFailed("\"exception\""); | |
| 5059 } | |
| 5060 } | |
| 5061 if (result2 !== null) { | |
| 5062 result3 = parse_s(); | |
| 5063 if (result3 !== null) { | |
| 5064 result4 = parse_identifier(); | |
| 5065 if (result4 !== null) { | |
| 5066 result5 = parse_w(); | |
| 5067 if (result5 !== null) { | |
| 5068 result6 = parse_Inheritance(); | |
| 5069 if (result6 !== null) { | |
| 5070 result7 = parse_w(); | |
| 5071 if (result7 !== null) { | |
| 5072 if (input.charCodeAt(pos) === 123) { | |
| 5073 result8 = "{"; | |
| 5074 pos++; | |
| 5075 } else { | |
| 5076 result8 = null; | |
| 5077 if (reportFailures === 0) { | |
| 5078 matchFailed("\"{\""); | |
| 5079 } | |
| 5080 } | |
| 5081 if (result8 !== null) { | |
| 5082 result9 = parse_w(); | |
| 5083 if (result9 !== null) { | |
| 5084 result10 = parse_ExceptionMembers(); | |
| 5085 if (result10 !== null) { | |
| 5086 result11 = parse_w(); | |
| 5087 if (result11 !== null) { | |
| 5088 if (input.charCodeAt(pos) === 125) { | |
| 5089 result12 = "}"; | |
| 5090 pos++; | |
| 5091 } else { | |
| 5092 result12 = null; | |
| 5093 if (reportFailures === 0) { | |
| 5094 matchFailed("\"}\""); | |
| 5095 } | |
| 5096 } | |
| 5097 if (result12 !== null) { | |
| 5098 result13 = parse_w(); | |
| 5099 if (result13 !== null) { | |
| 5100 if (input.charCodeAt(pos) === 59) { | |
| 5101 result14 = ";"; | |
| 5102 pos++; | |
| 5103 } else { | |
| 5104 result14 = null; | |
| 5105 if (reportFailures === 0) { | |
| 5106 matchFailed("\";\""); | |
| 5107 } | |
| 5108 } | |
| 5109 if (result14 !== null) { | |
| 5110 result15 = parse_w(); | |
| 5111 if (result15 !== null) { | |
| 5112 result0 = [result0, result1, result2, re
sult3, result4, result5, result6, result7, result8, result9, result10, result11,
result12, result13, result14, result15]; | |
| 5113 } else { | |
| 5114 result0 = null; | |
| 5115 pos = pos1; | |
| 5116 } | |
| 5117 } else { | |
| 5118 result0 = null; | |
| 5119 pos = pos1; | |
| 5120 } | |
| 5121 } else { | |
| 5122 result0 = null; | |
| 5123 pos = pos1; | |
| 5124 } | |
| 5125 } else { | |
| 5126 result0 = null; | |
| 5127 pos = pos1; | |
| 5128 } | |
| 5129 } else { | |
| 5130 result0 = null; | |
| 5131 pos = pos1; | |
| 5132 } | |
| 5133 } else { | |
| 5134 result0 = null; | |
| 5135 pos = pos1; | |
| 5136 } | |
| 5137 } else { | |
| 5138 result0 = null; | |
| 5139 pos = pos1; | |
| 5140 } | |
| 5141 } else { | |
| 5142 result0 = null; | |
| 5143 pos = pos1; | |
| 5144 } | |
| 5145 } else { | |
| 5146 result0 = null; | |
| 5147 pos = pos1; | |
| 5148 } | |
| 5149 } else { | |
| 5150 result0 = null; | |
| 5151 pos = pos1; | |
| 5152 } | |
| 5153 } else { | |
| 5154 result0 = null; | |
| 5155 pos = pos1; | |
| 5156 } | |
| 5157 } else { | |
| 5158 result0 = null; | |
| 5159 pos = pos1; | |
| 5160 } | |
| 5161 } else { | |
| 5162 result0 = null; | |
| 5163 pos = pos1; | |
| 5164 } | |
| 5165 } else { | |
| 5166 result0 = null; | |
| 5167 pos = pos1; | |
| 5168 } | |
| 5169 } else { | |
| 5170 result0 = null; | |
| 5171 pos = pos1; | |
| 5172 } | |
| 5173 } else { | |
| 5174 result0 = null; | |
| 5175 pos = pos1; | |
| 5176 } | |
| 5177 if (result0 !== null) { | |
| 5178 result0 = (function(offset, extAttrs, name, herit, mem) { | |
| 5179 return { | |
| 5180 type: 'exception', | |
| 5181 name: name, | |
| 5182 inheritance: herit, | |
| 5183 members: mem, | |
| 5184 extAttrs: extAttrs, | |
| 5185 }; | |
| 5186 })(pos0, result0[0], result0[4], result0[6], result0[10]); | |
| 5187 } | |
| 5188 if (result0 === null) { | |
| 5189 pos = pos0; | |
| 5190 } | |
| 5191 return result0; | |
| 5192 } | |
| 5193 | |
| 5194 function parse_ExceptionMembers() { | |
| 5195 var result0, result1; | |
| 5196 var pos0; | |
| 5197 | |
| 5198 pos0 = pos; | |
| 5199 result0 = []; | |
| 5200 result1 = parse_ExceptionMember(); | |
| 5201 while (result1 !== null) { | |
| 5202 result0.push(result1); | |
| 5203 result1 = parse_ExceptionMember(); | |
| 5204 } | |
| 5205 if (result0 !== null) { | |
| 5206 result0 = (function(offset, mem) { return mem ? mem : []; })(pos0, res
ult0); | |
| 5207 } | |
| 5208 if (result0 === null) { | |
| 5209 pos = pos0; | |
| 5210 } | |
| 5211 return result0; | |
| 5212 } | |
| 5213 | |
| 5214 function parse_ExceptionMember() { | |
| 5215 var result0; | |
| 5216 var pos0; | |
| 5217 | |
| 5218 pos0 = pos; | |
| 5219 result0 = parse_const(); | |
| 5220 if (result0 === null) { | |
| 5221 result0 = parse_field(); | |
| 5222 } | |
| 5223 if (result0 !== null) { | |
| 5224 result0 = (function(offset, mem) { return mem; })(pos0, result0); | |
| 5225 } | |
| 5226 if (result0 === null) { | |
| 5227 pos = pos0; | |
| 5228 } | |
| 5229 return result0; | |
| 5230 } | |
| 5231 | |
| 5232 function parse_field() { | |
| 5233 var result0, result1, result2, result3, result4, result5, result6, resul
t7; | |
| 5234 var pos0, pos1; | |
| 5235 | |
| 5236 pos0 = pos; | |
| 5237 pos1 = pos; | |
| 5238 result0 = parse_ExtendedAttributeList(); | |
| 5239 if (result0 !== null) { | |
| 5240 result1 = parse_s(); | |
| 5241 result1 = result1 !== null ? result1 : ""; | |
| 5242 if (result1 !== null) { | |
| 5243 result2 = parse_type(); | |
| 5244 if (result2 !== null) { | |
| 5245 result3 = parse_s(); | |
| 5246 if (result3 !== null) { | |
| 5247 result4 = parse_identifier(); | |
| 5248 if (result4 !== null) { | |
| 5249 result5 = parse_w(); | |
| 5250 if (result5 !== null) { | |
| 5251 if (input.charCodeAt(pos) === 59) { | |
| 5252 result6 = ";"; | |
| 5253 pos++; | |
| 5254 } else { | |
| 5255 result6 = null; | |
| 5256 if (reportFailures === 0) { | |
| 5257 matchFailed("\";\""); | |
| 5258 } | |
| 5259 } | |
| 5260 if (result6 !== null) { | |
| 5261 result7 = parse_w(); | |
| 5262 if (result7 !== null) { | |
| 5263 result0 = [result0, result1, result2, result3, result4,
result5, result6, result7]; | |
| 5264 } else { | |
| 5265 result0 = null; | |
| 5266 pos = pos1; | |
| 5267 } | |
| 5268 } else { | |
| 5269 result0 = null; | |
| 5270 pos = pos1; | |
| 5271 } | |
| 5272 } else { | |
| 5273 result0 = null; | |
| 5274 pos = pos1; | |
| 5275 } | |
| 5276 } else { | |
| 5277 result0 = null; | |
| 5278 pos = pos1; | |
| 5279 } | |
| 5280 } else { | |
| 5281 result0 = null; | |
| 5282 pos = pos1; | |
| 5283 } | |
| 5284 } else { | |
| 5285 result0 = null; | |
| 5286 pos = pos1; | |
| 5287 } | |
| 5288 } else { | |
| 5289 result0 = null; | |
| 5290 pos = pos1; | |
| 5291 } | |
| 5292 } else { | |
| 5293 result0 = null; | |
| 5294 pos = pos1; | |
| 5295 } | |
| 5296 if (result0 !== null) { | |
| 5297 result0 = (function(offset, extAttrs, type, name) { return { type: "fi
eld", extAttrs: extAttrs, idlType: type, name: name }; })(pos0, result0[0], resu
lt0[2], result0[4]); | |
| 5298 } | |
| 5299 if (result0 === null) { | |
| 5300 pos = pos0; | |
| 5301 } | |
| 5302 return result0; | |
| 5303 } | |
| 5304 | |
| 5305 function parse_ExtendedAttributeList() { | |
| 5306 var result0; | |
| 5307 var pos0; | |
| 5308 | |
| 5309 pos0 = pos; | |
| 5310 result0 = parse_ExtendedAttributeListInner(); | |
| 5311 result0 = result0 !== null ? result0 : ""; | |
| 5312 if (result0 !== null) { | |
| 5313 result0 = (function(offset, ea) { return ea ? ea : []; })(pos0, result
0); | |
| 5314 } | |
| 5315 if (result0 === null) { | |
| 5316 pos = pos0; | |
| 5317 } | |
| 5318 return result0; | |
| 5319 } | |
| 5320 | |
| 5321 function parse_ExtendedAttributeListInner() { | |
| 5322 var result0, result1, result2, result3, result4, result5, result6; | |
| 5323 var pos0, pos1; | |
| 5324 | |
| 5325 pos0 = pos; | |
| 5326 pos1 = pos; | |
| 5327 result0 = parse_w(); | |
| 5328 if (result0 !== null) { | |
| 5329 if (input.charCodeAt(pos) === 91) { | |
| 5330 result1 = "["; | |
| 5331 pos++; | |
| 5332 } else { | |
| 5333 result1 = null; | |
| 5334 if (reportFailures === 0) { | |
| 5335 matchFailed("\"[\""); | |
| 5336 } | |
| 5337 } | |
| 5338 if (result1 !== null) { | |
| 5339 result2 = parse_w(); | |
| 5340 if (result2 !== null) { | |
| 5341 result3 = parse_ExtAttrs(); | |
| 5342 if (result3 !== null) { | |
| 5343 result4 = parse_w(); | |
| 5344 if (result4 !== null) { | |
| 5345 if (input.charCodeAt(pos) === 93) { | |
| 5346 result5 = "]"; | |
| 5347 pos++; | |
| 5348 } else { | |
| 5349 result5 = null; | |
| 5350 if (reportFailures === 0) { | |
| 5351 matchFailed("\"]\""); | |
| 5352 } | |
| 5353 } | |
| 5354 if (result5 !== null) { | |
| 5355 result6 = parse_w(); | |
| 5356 if (result6 !== null) { | |
| 5357 result0 = [result0, result1, result2, result3, result4, re
sult5, result6]; | |
| 5358 } else { | |
| 5359 result0 = null; | |
| 5360 pos = pos1; | |
| 5361 } | |
| 5362 } else { | |
| 5363 result0 = null; | |
| 5364 pos = pos1; | |
| 5365 } | |
| 5366 } else { | |
| 5367 result0 = null; | |
| 5368 pos = pos1; | |
| 5369 } | |
| 5370 } else { | |
| 5371 result0 = null; | |
| 5372 pos = pos1; | |
| 5373 } | |
| 5374 } else { | |
| 5375 result0 = null; | |
| 5376 pos = pos1; | |
| 5377 } | |
| 5378 } else { | |
| 5379 result0 = null; | |
| 5380 pos = pos1; | |
| 5381 } | |
| 5382 } else { | |
| 5383 result0 = null; | |
| 5384 pos = pos1; | |
| 5385 } | |
| 5386 if (result0 !== null) { | |
| 5387 result0 = (function(offset, ea) { return ea; })(pos0, result0[3]); | |
| 5388 } | |
| 5389 if (result0 === null) { | |
| 5390 pos = pos0; | |
| 5391 } | |
| 5392 return result0; | |
| 5393 } | |
| 5394 | |
| 5395 function parse_ExtAttrs() { | |
| 5396 var result0, result1, result2; | |
| 5397 var pos0, pos1; | |
| 5398 | |
| 5399 pos0 = pos; | |
| 5400 pos1 = pos; | |
| 5401 result0 = parse_ExtAttr(); | |
| 5402 if (result0 !== null) { | |
| 5403 result1 = []; | |
| 5404 result2 = parse_ExtAttrsRest(); | |
| 5405 while (result2 !== null) { | |
| 5406 result1.push(result2); | |
| 5407 result2 = parse_ExtAttrsRest(); | |
| 5408 } | |
| 5409 if (result1 !== null) { | |
| 5410 result0 = [result0, result1]; | |
| 5411 } else { | |
| 5412 result0 = null; | |
| 5413 pos = pos1; | |
| 5414 } | |
| 5415 } else { | |
| 5416 result0 = null; | |
| 5417 pos = pos1; | |
| 5418 } | |
| 5419 if (result0 !== null) { | |
| 5420 result0 = (function(offset, first, others) { var ret = [first]; | |
| 5421 for (var i = 0, n = others.length; i < n; i++) { ret.push(ot
hers[i]); } | |
| 5422 return ret; })(pos0, result0[0], result0[1]); | |
| 5423 } | |
| 5424 if (result0 === null) { | |
| 5425 pos = pos0; | |
| 5426 } | |
| 5427 return result0; | |
| 5428 } | |
| 5429 | |
| 5430 function parse_ExtAttrsRest() { | |
| 5431 var result0, result1, result2, result3; | |
| 5432 var pos0, pos1; | |
| 5433 | |
| 5434 pos0 = pos; | |
| 5435 pos1 = pos; | |
| 5436 result0 = parse_w(); | |
| 5437 if (result0 !== null) { | |
| 5438 if (input.charCodeAt(pos) === 44) { | |
| 5439 result1 = ","; | |
| 5440 pos++; | |
| 5441 } else { | |
| 5442 result1 = null; | |
| 5443 if (reportFailures === 0) { | |
| 5444 matchFailed("\",\""); | |
| 5445 } | |
| 5446 } | |
| 5447 if (result1 !== null) { | |
| 5448 result2 = parse_w(); | |
| 5449 if (result2 !== null) { | |
| 5450 result3 = parse_ExtAttr(); | |
| 5451 if (result3 !== null) { | |
| 5452 result0 = [result0, result1, result2, result3]; | |
| 5453 } else { | |
| 5454 result0 = null; | |
| 5455 pos = pos1; | |
| 5456 } | |
| 5457 } else { | |
| 5458 result0 = null; | |
| 5459 pos = pos1; | |
| 5460 } | |
| 5461 } else { | |
| 5462 result0 = null; | |
| 5463 pos = pos1; | |
| 5464 } | |
| 5465 } else { | |
| 5466 result0 = null; | |
| 5467 pos = pos1; | |
| 5468 } | |
| 5469 if (result0 !== null) { | |
| 5470 result0 = (function(offset, rest) { return rest; })(pos0, result0[3]); | |
| 5471 } | |
| 5472 if (result0 === null) { | |
| 5473 pos = pos0; | |
| 5474 } | |
| 5475 return result0; | |
| 5476 } | |
| 5477 | |
| 5478 function parse_ExtAttr() { | |
| 5479 var result0; | |
| 5480 var pos0; | |
| 5481 | |
| 5482 pos0 = pos; | |
| 5483 result0 = parse_ExtAttrArgList(); | |
| 5484 if (result0 === null) { | |
| 5485 result0 = parse_ExtAttrNamedArgList(); | |
| 5486 if (result0 === null) { | |
| 5487 result0 = parse_ExtAttrNameValue(); | |
| 5488 if (result0 === null) { | |
| 5489 result0 = parse_ExtAttrNoArg(); | |
| 5490 } | |
| 5491 } | |
| 5492 } | |
| 5493 if (result0 !== null) { | |
| 5494 result0 = (function(offset, ea) { return ea; })(pos0, result0); | |
| 5495 } | |
| 5496 if (result0 === null) { | |
| 5497 pos = pos0; | |
| 5498 } | |
| 5499 return result0; | |
| 5500 } | |
| 5501 | |
| 5502 function parse_ExtAttrNoArg() { | |
| 5503 var result0; | |
| 5504 var pos0; | |
| 5505 | |
| 5506 pos0 = pos; | |
| 5507 result0 = parse_identifier(); | |
| 5508 if (result0 !== null) { | |
| 5509 result0 = (function(offset, name) {return { name: name }; })(pos0, res
ult0); | |
| 5510 } | |
| 5511 if (result0 === null) { | |
| 5512 pos = pos0; | |
| 5513 } | |
| 5514 return result0; | |
| 5515 } | |
| 5516 | |
| 5517 function parse_ExtAttrNameValue() { | |
| 5518 var result0, result1, result2, result3, result4; | |
| 5519 var pos0, pos1; | |
| 5520 | |
| 5521 pos0 = pos; | |
| 5522 pos1 = pos; | |
| 5523 result0 = parse_identifier(); | |
| 5524 if (result0 !== null) { | |
| 5525 result1 = parse_w(); | |
| 5526 if (result1 !== null) { | |
| 5527 if (input.charCodeAt(pos) === 61) { | |
| 5528 result2 = "="; | |
| 5529 pos++; | |
| 5530 } else { | |
| 5531 result2 = null; | |
| 5532 if (reportFailures === 0) { | |
| 5533 matchFailed("\"=\""); | |
| 5534 } | |
| 5535 } | |
| 5536 if (result2 !== null) { | |
| 5537 result3 = parse_w(); | |
| 5538 if (result3 !== null) { | |
| 5539 result4 = parse_ScopedName(); | |
| 5540 if (result4 !== null) { | |
| 5541 result0 = [result0, result1, result2, result3, result4]; | |
| 5542 } else { | |
| 5543 result0 = null; | |
| 5544 pos = pos1; | |
| 5545 } | |
| 5546 } else { | |
| 5547 result0 = null; | |
| 5548 pos = pos1; | |
| 5549 } | |
| 5550 } else { | |
| 5551 result0 = null; | |
| 5552 pos = pos1; | |
| 5553 } | |
| 5554 } else { | |
| 5555 result0 = null; | |
| 5556 pos = pos1; | |
| 5557 } | |
| 5558 } else { | |
| 5559 result0 = null; | |
| 5560 pos = pos1; | |
| 5561 } | |
| 5562 if (result0 !== null) { | |
| 5563 result0 = (function(offset, name, value) {return { name: name, value:
value }; })(pos0, result0[0], result0[4]); | |
| 5564 } | |
| 5565 if (result0 === null) { | |
| 5566 pos = pos0; | |
| 5567 } | |
| 5568 return result0; | |
| 5569 } | |
| 5570 | |
| 5571 function parse_ExtAttrNamedArgList() { | |
| 5572 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10; | |
| 5573 var pos0, pos1; | |
| 5574 | |
| 5575 pos0 = pos; | |
| 5576 pos1 = pos; | |
| 5577 result0 = parse_identifier(); | |
| 5578 if (result0 !== null) { | |
| 5579 result1 = parse_w(); | |
| 5580 if (result1 !== null) { | |
| 5581 if (input.charCodeAt(pos) === 61) { | |
| 5582 result2 = "="; | |
| 5583 pos++; | |
| 5584 } else { | |
| 5585 result2 = null; | |
| 5586 if (reportFailures === 0) { | |
| 5587 matchFailed("\"=\""); | |
| 5588 } | |
| 5589 } | |
| 5590 if (result2 !== null) { | |
| 5591 result3 = parse_w(); | |
| 5592 if (result3 !== null) { | |
| 5593 result4 = parse_identifier(); | |
| 5594 if (result4 !== null) { | |
| 5595 result5 = parse_w(); | |
| 5596 if (result5 !== null) { | |
| 5597 if (input.charCodeAt(pos) === 40) { | |
| 5598 result6 = "("; | |
| 5599 pos++; | |
| 5600 } else { | |
| 5601 result6 = null; | |
| 5602 if (reportFailures === 0) { | |
| 5603 matchFailed("\"(\""); | |
| 5604 } | |
| 5605 } | |
| 5606 if (result6 !== null) { | |
| 5607 result7 = parse_w(); | |
| 5608 if (result7 !== null) { | |
| 5609 result8 = parse_Arguments(); | |
| 5610 result8 = result8 !== null ? result8 : ""; | |
| 5611 if (result8 !== null) { | |
| 5612 result9 = parse_w(); | |
| 5613 if (result9 !== null) { | |
| 5614 if (input.charCodeAt(pos) === 41) { | |
| 5615 result10 = ")"; | |
| 5616 pos++; | |
| 5617 } else { | |
| 5618 result10 = null; | |
| 5619 if (reportFailures === 0) { | |
| 5620 matchFailed("\")\""); | |
| 5621 } | |
| 5622 } | |
| 5623 if (result10 !== null) { | |
| 5624 result0 = [result0, result1, result2, result3, res
ult4, result5, result6, result7, result8, result9, result10]; | |
| 5625 } else { | |
| 5626 result0 = null; | |
| 5627 pos = pos1; | |
| 5628 } | |
| 5629 } else { | |
| 5630 result0 = null; | |
| 5631 pos = pos1; | |
| 5632 } | |
| 5633 } else { | |
| 5634 result0 = null; | |
| 5635 pos = pos1; | |
| 5636 } | |
| 5637 } else { | |
| 5638 result0 = null; | |
| 5639 pos = pos1; | |
| 5640 } | |
| 5641 } else { | |
| 5642 result0 = null; | |
| 5643 pos = pos1; | |
| 5644 } | |
| 5645 } else { | |
| 5646 result0 = null; | |
| 5647 pos = pos1; | |
| 5648 } | |
| 5649 } else { | |
| 5650 result0 = null; | |
| 5651 pos = pos1; | |
| 5652 } | |
| 5653 } else { | |
| 5654 result0 = null; | |
| 5655 pos = pos1; | |
| 5656 } | |
| 5657 } else { | |
| 5658 result0 = null; | |
| 5659 pos = pos1; | |
| 5660 } | |
| 5661 } else { | |
| 5662 result0 = null; | |
| 5663 pos = pos1; | |
| 5664 } | |
| 5665 } else { | |
| 5666 result0 = null; | |
| 5667 pos = pos1; | |
| 5668 } | |
| 5669 if (result0 !== null) { | |
| 5670 result0 = (function(offset, name, value, args) {return { name: name, v
alue: value, arguments: args }; })(pos0, result0[0], result0[4], result0[8]); | |
| 5671 } | |
| 5672 if (result0 === null) { | |
| 5673 pos = pos0; | |
| 5674 } | |
| 5675 return result0; | |
| 5676 } | |
| 5677 | |
| 5678 function parse_ExtAttrNamedArgList() { | |
| 5679 var result0, result1, result2, result3, result4, result5, result6, resul
t7, result8, result9, result10; | |
| 5680 var pos0, pos1; | |
| 5681 | |
| 5682 pos0 = pos; | |
| 5683 pos1 = pos; | |
| 5684 result0 = parse_identifier(); | |
| 5685 if (result0 !== null) { | |
| 5686 result1 = parse_w(); | |
| 5687 if (result1 !== null) { | |
| 5688 if (input.charCodeAt(pos) === 61) { | |
| 5689 result2 = "="; | |
| 5690 pos++; | |
| 5691 } else { | |
| 5692 result2 = null; | |
| 5693 if (reportFailures === 0) { | |
| 5694 matchFailed("\"=\""); | |
| 5695 } | |
| 5696 } | |
| 5697 if (result2 !== null) { | |
| 5698 result3 = parse_w(); | |
| 5699 if (result3 !== null) { | |
| 5700 result4 = parse_identifier(); | |
| 5701 if (result4 !== null) { | |
| 5702 result5 = parse_w(); | |
| 5703 if (result5 !== null) { | |
| 5704 if (input.charCodeAt(pos) === 40) { | |
| 5705 result6 = "("; | |
| 5706 pos++; | |
| 5707 } else { | |
| 5708 result6 = null; | |
| 5709 if (reportFailures === 0) { | |
| 5710 matchFailed("\"(\""); | |
| 5711 } | |
| 5712 } | |
| 5713 if (result6 !== null) { | |
| 5714 result7 = parse_w(); | |
| 5715 if (result7 !== null) { | |
| 5716 result8 = parse_Arguments(); | |
| 5717 result8 = result8 !== null ? result8 : ""; | |
| 5718 if (result8 !== null) { | |
| 5719 result9 = parse_w(); | |
| 5720 if (result9 !== null) { | |
| 5721 if (input.charCodeAt(pos) === 41) { | |
| 5722 result10 = ")"; | |
| 5723 pos++; | |
| 5724 } else { | |
| 5725 result10 = null; | |
| 5726 if (reportFailures === 0) { | |
| 5727 matchFailed("\")\""); | |
| 5728 } | |
| 5729 } | |
| 5730 if (result10 !== null) { | |
| 5731 result0 = [result0, result1, result2, result3, res
ult4, result5, result6, result7, result8, result9, result10]; | |
| 5732 } else { | |
| 5733 result0 = null; | |
| 5734 pos = pos1; | |
| 5735 } | |
| 5736 } else { | |
| 5737 result0 = null; | |
| 5738 pos = pos1; | |
| 5739 } | |
| 5740 } else { | |
| 5741 result0 = null; | |
| 5742 pos = pos1; | |
| 5743 } | |
| 5744 } else { | |
| 5745 result0 = null; | |
| 5746 pos = pos1; | |
| 5747 } | |
| 5748 } else { | |
| 5749 result0 = null; | |
| 5750 pos = pos1; | |
| 5751 } | |
| 5752 } else { | |
| 5753 result0 = null; | |
| 5754 pos = pos1; | |
| 5755 } | |
| 5756 } else { | |
| 5757 result0 = null; | |
| 5758 pos = pos1; | |
| 5759 } | |
| 5760 } else { | |
| 5761 result0 = null; | |
| 5762 pos = pos1; | |
| 5763 } | |
| 5764 } else { | |
| 5765 result0 = null; | |
| 5766 pos = pos1; | |
| 5767 } | |
| 5768 } else { | |
| 5769 result0 = null; | |
| 5770 pos = pos1; | |
| 5771 } | |
| 5772 } else { | |
| 5773 result0 = null; | |
| 5774 pos = pos1; | |
| 5775 } | |
| 5776 if (result0 !== null) { | |
| 5777 result0 = (function(offset, name, value, args) {return { name: name, v
alue: value, arguments: args }; })(pos0, result0[0], result0[4], result0[8]); | |
| 5778 } | |
| 5779 if (result0 === null) { | |
| 5780 pos = pos0; | |
| 5781 } | |
| 5782 return result0; | |
| 5783 } | |
| 5784 | |
| 5785 function parse_ExtAttrArgList() { | |
| 5786 var result0, result1, result2, result3, result4, result5, result6; | |
| 5787 var pos0, pos1; | |
| 5788 | |
| 5789 pos0 = pos; | |
| 5790 pos1 = pos; | |
| 5791 result0 = parse_identifier(); | |
| 5792 if (result0 !== null) { | |
| 5793 result1 = parse_w(); | |
| 5794 if (result1 !== null) { | |
| 5795 if (input.charCodeAt(pos) === 40) { | |
| 5796 result2 = "("; | |
| 5797 pos++; | |
| 5798 } else { | |
| 5799 result2 = null; | |
| 5800 if (reportFailures === 0) { | |
| 5801 matchFailed("\"(\""); | |
| 5802 } | |
| 5803 } | |
| 5804 if (result2 !== null) { | |
| 5805 result3 = parse_w(); | |
| 5806 if (result3 !== null) { | |
| 5807 result4 = parse_Arguments(); | |
| 5808 result4 = result4 !== null ? result4 : ""; | |
| 5809 if (result4 !== null) { | |
| 5810 result5 = parse_w(); | |
| 5811 if (result5 !== null) { | |
| 5812 if (input.charCodeAt(pos) === 41) { | |
| 5813 result6 = ")"; | |
| 5814 pos++; | |
| 5815 } else { | |
| 5816 result6 = null; | |
| 5817 if (reportFailures === 0) { | |
| 5818 matchFailed("\")\""); | |
| 5819 } | |
| 5820 } | |
| 5821 if (result6 !== null) { | |
| 5822 result0 = [result0, result1, result2, result3, result4, re
sult5, result6]; | |
| 5823 } else { | |
| 5824 result0 = null; | |
| 5825 pos = pos1; | |
| 5826 } | |
| 5827 } else { | |
| 5828 result0 = null; | |
| 5829 pos = pos1; | |
| 5830 } | |
| 5831 } else { | |
| 5832 result0 = null; | |
| 5833 pos = pos1; | |
| 5834 } | |
| 5835 } else { | |
| 5836 result0 = null; | |
| 5837 pos = pos1; | |
| 5838 } | |
| 5839 } else { | |
| 5840 result0 = null; | |
| 5841 pos = pos1; | |
| 5842 } | |
| 5843 } else { | |
| 5844 result0 = null; | |
| 5845 pos = pos1; | |
| 5846 } | |
| 5847 } else { | |
| 5848 result0 = null; | |
| 5849 pos = pos1; | |
| 5850 } | |
| 5851 if (result0 !== null) { | |
| 5852 result0 = (function(offset, name, args) {return { name: name, argument
s: args }; })(pos0, result0[0], result0[4]); | |
| 5853 } | |
| 5854 if (result0 === null) { | |
| 5855 pos = pos0; | |
| 5856 } | |
| 5857 return result0; | |
| 5858 } | |
| 5859 | |
| 5860 | |
| 5861 function cleanupExpected(expected) { | |
| 5862 expected.sort(); | |
| 5863 | |
| 5864 var lastExpected = null; | |
| 5865 var cleanExpected = []; | |
| 5866 for (var i = 0; i < expected.length; i++) { | |
| 5867 if (expected[i] !== lastExpected) { | |
| 5868 cleanExpected.push(expected[i]); | |
| 5869 lastExpected = expected[i]; | |
| 5870 } | |
| 5871 } | |
| 5872 return cleanExpected; | |
| 5873 } | |
| 5874 | |
| 5875 function computeErrorPosition() { | |
| 5876 /* | |
| 5877 * The first idea was to use |String.split| to break the input up to the | |
| 5878 * error position along newlines and derive the line and column from | |
| 5879 * there. However IE's |split| implementation is so broken that it was | |
| 5880 * enough to prevent it. | |
| 5881 */ | |
| 5882 | |
| 5883 var line = 1; | |
| 5884 var column = 1; | |
| 5885 var seenCR = false; | |
| 5886 | |
| 5887 for (var i = 0; i < Math.max(pos, rightmostFailuresPos); i++) { | |
| 5888 var ch = input.charAt(i); | |
| 5889 if (ch === "\n") { | |
| 5890 if (!seenCR) { line++; } | |
| 5891 column = 1; | |
| 5892 seenCR = false; | |
| 5893 } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { | |
| 5894 line++; | |
| 5895 column = 1; | |
| 5896 seenCR = true; | |
| 5897 } else { | |
| 5898 column++; | |
| 5899 seenCR = false; | |
| 5900 } | |
| 5901 } | |
| 5902 | |
| 5903 return { line: line, column: column }; | |
| 5904 } | |
| 5905 | |
| 5906 | |
| 5907 var result = parseFunctions[startRule](); | |
| 5908 | |
| 5909 /* | |
| 5910 * The parser is now in one of the following three states: | |
| 5911 * | |
| 5912 * 1. The parser successfully parsed the whole input. | |
| 5913 * | |
| 5914 * - |result !== null| | |
| 5915 * - |pos === input.length| | |
| 5916 * - |rightmostFailuresExpected| may or may not contain something | |
| 5917 * | |
| 5918 * 2. The parser successfully parsed only a part of the input. | |
| 5919 * | |
| 5920 * - |result !== null| | |
| 5921 * - |pos < input.length| | |
| 5922 * - |rightmostFailuresExpected| may or may not contain something | |
| 5923 * | |
| 5924 * 3. The parser did not successfully parse any part of the input. | |
| 5925 * | |
| 5926 * - |result === null| | |
| 5927 * - |pos === 0| | |
| 5928 * - |rightmostFailuresExpected| contains at least one failure | |
| 5929 * | |
| 5930 * All code following this comment (including called functions) must | |
| 5931 * handle these states. | |
| 5932 */ | |
| 5933 if (result === null || pos !== input.length) { | |
| 5934 var offset = Math.max(pos, rightmostFailuresPos); | |
| 5935 var found = offset < input.length ? input.charAt(offset) : null; | |
| 5936 var errorPosition = computeErrorPosition(); | |
| 5937 | |
| 5938 throw new this.SyntaxError( | |
| 5939 cleanupExpected(rightmostFailuresExpected), | |
| 5940 found, | |
| 5941 offset, | |
| 5942 errorPosition.line, | |
| 5943 errorPosition.column | |
| 5944 ); | |
| 5945 } | |
| 5946 | |
| 5947 return result; | |
| 5948 }, | |
| 5949 | |
| 5950 /* Returns the parser source code. */ | |
| 5951 toSource: function() { return this._source; } | |
| 5952 }; | |
| 5953 | |
| 5954 /* Thrown when a parser encounters a syntax error. */ | |
| 5955 | |
| 5956 result.SyntaxError = function(expected, found, offset, line, column) { | |
| 5957 function buildMessage(expected, found) { | |
| 5958 var expectedHumanized, foundHumanized; | |
| 5959 | |
| 5960 switch (expected.length) { | |
| 5961 case 0: | |
| 5962 expectedHumanized = "end of input"; | |
| 5963 break; | |
| 5964 case 1: | |
| 5965 expectedHumanized = expected[0]; | |
| 5966 break; | |
| 5967 default: | |
| 5968 expectedHumanized = expected.slice(0, expected.length - 1).join(", ") | |
| 5969 + " or " | |
| 5970 + expected[expected.length - 1]; | |
| 5971 } | |
| 5972 | |
| 5973 foundHumanized = found ? quote(found) : "end of input"; | |
| 5974 | |
| 5975 return "Expected " + expectedHumanized + " but " + foundHumanized + " foun
d."; | |
| 5976 } | |
| 5977 | |
| 5978 this.name = "SyntaxError"; | |
| 5979 this.expected = expected; | |
| 5980 this.found = found; | |
| 5981 this.message = buildMessage(expected, found); | |
| 5982 this.offset = offset; | |
| 5983 this.line = line; | |
| 5984 this.column = column; | |
| 5985 }; | |
| 5986 | |
| 5987 result.SyntaxError.prototype = Error.prototype; | |
| 5988 | |
| 5989 return result; | |
| 5990 })(); | |
| OLD | NEW |