MediaWiki:Skin/Projekt:Adventure2/parser.js: Unterschied zwischen den Versionen
Zur Navigation springen
Zur Suche springen
J* (Diskussion | Beiträge) |
J* (Diskussion | Beiträge) (a2 initialisieren, falls nötig) |
||
(17 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
Zeile 1: | Zeile 1: | ||
+ | if (window.a2 === undefined) | ||
+ | window.a2 = {}; | ||
+ | |||
a2.parser = (function(){ | a2.parser = (function(){ | ||
/* | /* | ||
Zeile 52: | Zeile 55: | ||
"ActionFunctions": parse_ActionFunctions, | "ActionFunctions": parse_ActionFunctions, | ||
"ActionFunction": parse_ActionFunction, | "ActionFunction": parse_ActionFunction, | ||
+ | "Channel": parse_Channel, | ||
"PageDec": parse_PageDec, | "PageDec": parse_PageDec, | ||
"PageVirtualClause": parse_PageVirtualClause, | "PageVirtualClause": parse_PageVirtualClause, | ||
Zeile 59: | Zeile 63: | ||
"ItemVirtualClause": parse_ItemVirtualClause, | "ItemVirtualClause": parse_ItemVirtualClause, | ||
"ItemVirtualList": parse_ItemVirtualList, | "ItemVirtualList": parse_ItemVirtualList, | ||
+ | "StringKwArgClause": parse_StringKwArgClause, | ||
+ | "StringKwArg": parse_StringKwArg, | ||
"L": parse_L, | "L": parse_L, | ||
"R": parse_R, | "R": parse_R, | ||
Zeile 67: | Zeile 73: | ||
"ItemVirtual": parse_ItemVirtual, | "ItemVirtual": parse_ItemVirtual, | ||
"Page": parse_Page, | "Page": parse_Page, | ||
+ | "Time": parse_Time, | ||
+ | "Overlay": parse_Overlay, | ||
"S": parse_S, | "S": parse_S, | ||
"String": parse_String, | "String": parse_String, | ||
Zeile 83: | Zeile 91: | ||
} | } | ||
− | var pos = 0; | + | var pos = { offset: 0, line: 1, column: 1, seenCR: false }; |
var reportFailures = 0; | var reportFailures = 0; | ||
− | var rightmostFailuresPos = 0; | + | var rightmostFailuresPos = { offset: 0, line: 1, column: 1, seenCR: false }; |
var rightmostFailuresExpected = []; | var rightmostFailuresExpected = []; | ||
+ | var cache = {}; | ||
function padLeft(input, padding, length) { | function padLeft(input, padding, length) { | ||
Zeile 113: | Zeile 122: | ||
return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length); | return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length); | ||
+ | } | ||
+ | |||
+ | function clone(object) { | ||
+ | var result = {}; | ||
+ | for (var key in object) { | ||
+ | result[key] = object[key]; | ||
+ | } | ||
+ | return result; | ||
+ | } | ||
+ | |||
+ | function advance(pos, n) { | ||
+ | var endOffset = pos.offset + n; | ||
+ | |||
+ | for (var offset = pos.offset; offset < endOffset; offset++) { | ||
+ | var ch = input.charAt(offset); | ||
+ | if (ch === "\n") { | ||
+ | if (!pos.seenCR) { pos.line++; } | ||
+ | pos.column = 1; | ||
+ | pos.seenCR = false; | ||
+ | } else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") { | ||
+ | pos.line++; | ||
+ | pos.column = 1; | ||
+ | pos.seenCR = true; | ||
+ | } else { | ||
+ | pos.column++; | ||
+ | pos.seenCR = false; | ||
+ | } | ||
+ | } | ||
+ | |||
+ | pos.offset += n; | ||
} | } | ||
function matchFailed(failure) { | function matchFailed(failure) { | ||
− | if (pos < rightmostFailuresPos) { | + | if (pos.offset < rightmostFailuresPos.offset) { |
return; | return; | ||
} | } | ||
− | if (pos > rightmostFailuresPos) { | + | if (pos.offset > rightmostFailuresPos.offset) { |
− | rightmostFailuresPos = pos; | + | rightmostFailuresPos = clone(pos); |
rightmostFailuresExpected = []; | rightmostFailuresExpected = []; | ||
} | } | ||
Zeile 129: | Zeile 168: | ||
function parse_start() { | function parse_start() { | ||
+ | var cacheKey = "start@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2; | var result0, result1, result2; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
result0 = parse_S(); | result0 = parse_S(); | ||
result0 = result0 !== null ? result0 : ""; | result0 = result0 !== null ? result0 : ""; | ||
Zeile 147: | Zeile 193: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, d) {return d;})(pos0, result0[1]); | + | result0 = (function(offset, line, column, d) {return d;})(pos0.offset, pos0.line, pos0.column, result0[1]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
function parse_Declaration() { | function parse_Declaration() { | ||
+ | var cacheKey = "Declaration@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0; | var result0; | ||
Zeile 172: | Zeile 230: | ||
} | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
function parse_EventDec() { | function parse_EventDec() { | ||
+ | var cacheKey = "EventDec@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2, result3, result4, result5, result6, result7, result8; | var result0, result1, result2, result3, result4, result5, result6, result7, result8; | ||
var pos0, pos1, pos2; | var pos0, pos1, pos2; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
result0 = parse_S(); | result0 = parse_S(); | ||
result0 = result0 !== null ? result0 : ""; | result0 = result0 !== null ? result0 : ""; | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | if (input.substr(pos, 5) === "event") { | + | if (input.substr(pos.offset, 5) === "event") { |
result1 = "event"; | result1 = "event"; | ||
− | pos | + | advance(pos, 5); |
} else { | } else { | ||
result1 = null; | result1 = null; | ||
Zeile 194: | Zeile 264: | ||
} | } | ||
if (result1 !== null) { | if (result1 !== null) { | ||
− | pos2 = pos; | + | pos2 = clone(pos); |
result2 = parse_S(); | result2 = parse_S(); | ||
if (result2 !== null) { | if (result2 !== null) { | ||
Zeile 202: | Zeile 272: | ||
} else { | } else { | ||
result2 = null; | result2 = null; | ||
− | pos = pos2; | + | pos = clone(pos2); |
} | } | ||
} else { | } else { | ||
result2 = null; | result2 = null; | ||
− | pos = pos2; | + | pos = clone(pos2); |
} | } | ||
result2 = result2 !== null ? result2 : ""; | result2 = result2 !== null ? result2 : ""; | ||
Zeile 228: | Zeile 298: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, n, tr, co, ac) { return ["event", {name:n?n[1]:":anonymous:", trigger:tr, condition:(co?co:function(){return true;}), action:(ac?ac:function(){return true;})}]; })(pos0, result0[2], result0[4], result0[5], result0[6]); | + | result0 = (function(offset, line, column, n, tr, co, ac) { return ["event", {name:n?n[1]:":anonymous:", trigger:tr, condition:(co?co:function(){return true;}), action:(ac?ac:function(){return true;})}]; })(pos0.offset, pos0.line, pos0.column, result0[2], result0[4], result0[5], result0[6]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
function parse_TriggerClause() { | function parse_TriggerClause() { | ||
+ | var cacheKey = "TriggerClause@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2, result3, result4; | var result0, result1, result2, result3, result4; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 2) === "on") { | + | if (input.substr(pos.offset, 2) === "on") { |
result0 = "on"; | result0 = "on"; | ||
− | pos | + | advance(pos, 2); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 299: | Zeile 381: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, tr) {return tr;})(pos0, result0[3]); | + | result0 = (function(offset, line, column, tr) {return tr;})(pos0.offset, pos0.line, pos0.column, result0[3]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
function parse_TriggerFunctions() { | function parse_TriggerFunctions() { | ||
+ | var cacheKey = "TriggerFunctions@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2; | var result0, result1, result2; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
result0 = parse_TriggerFunction(); | result0 = parse_TriggerFunction(); | ||
if (result0 !== null) { | if (result0 !== null) { | ||
Zeile 341: | Zeile 435: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, t, o) {o.push(t); return o;})(pos0, result0[0], result0[2]); | + | result0 = (function(offset, line, column, t, o) {o.push(t); return o;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
result0 = parse_TriggerFunction(); | result0 = parse_TriggerFunction(); | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, t) {return [t];})(pos0, result0); | + | result0 = (function(offset, line, column, t) {return [t];})(pos0.offset, pos0.line, pos0.column, result0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
function parse_TriggerFunction() { | function parse_TriggerFunction() { | ||
+ | var cacheKey = "TriggerFunction@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2, result3, result4, result5; | var result0, result1, result2, result3, result4, result5; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
result0 = parse_TriggerPageOrVirtOp(); | result0 = parse_TriggerPageOrVirtOp(); | ||
if (result0 !== null) { | if (result0 !== null) { | ||
Zeile 390: | Zeile 496: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, t, a) {return t+"."+a;})(pos0, result0[0], result0[2]); | + | result0 = (function(offset, line, column, t, a) {return t+"."+a;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
result0 = parse_TriggerItemOrVirtOp(); | result0 = parse_TriggerItemOrVirtOp(); | ||
if (result0 !== null) { | if (result0 !== null) { | ||
Zeile 427: | Zeile 533: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, t, a) {return t+"."+a;})(pos0, result0[0], result0[2]); | + | result0 = (function(offset, line, column, t, a) {return t+"."+a;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 5) === "click") { | + | if (input.substr(pos.offset, 5) === "click") { |
result0 = "click"; | result0 = "click"; | ||
− | pos | + | advance(pos, 5); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 469: | Zeile 575: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, t, a) {return t+"."+a;})(pos0, result0[0], result0[2]); | + | result0 = (function(offset, line, column, t, a) {return t+"."+a;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 7) === "combine") { | + | if (input.substr(pos.offset, 7) === "combine") { |
result0 = "combine"; | result0 = "combine"; | ||
− | pos | + | advance(pos, 7); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 521: | Zeile 627: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, t, a, b) {return [t,a,b].join(".")})(pos0, result0[0], result0[2], result0[4]); | + | result0 = (function(offset, line, column, t, a, b) {return [t,a,b].join(".")})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2], result0[4]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 5) === "apply") { | + | if (input.substr(pos.offset, 5) === "apply") { |
result0 = "apply"; | result0 = "apply"; | ||
− | pos | + | advance(pos, 5); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 578: | Zeile 684: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, t, a, b) {return [t,a,b].join(".")})(pos0, result0[0], result0[2], result0[4]); | + | result0 = (function(offset, line, column, t, a, b) {return [t,a,b].join(".")})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2], result0[4]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
} | } | ||
Zeile 610: | Zeile 716: | ||
} | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
function parse_TriggerPageOrVirtOp() { | function parse_TriggerPageOrVirtOp() { | ||
+ | var cacheKey = "TriggerPageOrVirtOp@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0; | var result0; | ||
− | if (input.substr(pos, 5) === "enter") { | + | if (input.substr(pos.offset, 5) === "enter") { |
result0 = "enter"; | result0 = "enter"; | ||
− | pos | + | advance(pos, 5); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 626: | Zeile 744: | ||
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | if (input.substr(pos, 5) === "leave") { | + | if (input.substr(pos.offset, 5) === "leave") { |
result0 = "leave"; | result0 = "leave"; | ||
− | pos | + | advance(pos, 5); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 636: | Zeile 754: | ||
} | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
function parse_TriggerItemOrVirtOp() { | function parse_TriggerItemOrVirtOp() { | ||
+ | var cacheKey = "TriggerItemOrVirtOp@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0; | var result0; | ||
− | if (input.substr(pos, 3) === "add") { | + | if (input.substr(pos.offset, 3) === "add") { |
result0 = "add"; | result0 = "add"; | ||
− | pos | + | advance(pos, 3); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 652: | Zeile 782: | ||
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | if (input.substr(pos, 6) === "remove") { | + | if (input.substr(pos.offset, 6) === "remove") { |
result0 = "remove"; | result0 = "remove"; | ||
− | pos | + | advance(pos, 6); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 662: | Zeile 792: | ||
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | if (input.substr(pos, 8) === "activate") { | + | if (input.substr(pos.offset, 8) === "activate") { |
result0 = "activate"; | result0 = "activate"; | ||
− | pos | + | advance(pos, 8); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 673: | Zeile 803: | ||
} | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
function parse_ConditionClause() { | function parse_ConditionClause() { | ||
+ | var cacheKey = "ConditionClause@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2, result3; | var result0, result1, result2, result3; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 2) === "if") { | + | if (input.substr(pos.offset, 2) === "if") { |
result0 = "if"; | result0 = "if"; | ||
− | pos | + | advance(pos, 2); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 701: | Zeile 843: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, co) {return co;})(pos0, result0[2]); | + | result0 = (function(offset, line, column, co) {return co;})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
function parse_ConditionFunction() { | function parse_ConditionFunction() { | ||
+ | var cacheKey = "ConditionFunction@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2, result3; | var result0, result1, result2, result3; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 4) === "page") { | + | if (input.substr(pos.offset, 4) === "page") { |
result0 = "page"; | result0 = "page"; | ||
− | pos | + | advance(pos, 4); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 749: | Zeile 903: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, p) {return function(){return a2.cpage == p};})(pos0, result0[2]); | + | result0 = (function(offset, line, column, p) {return function(){return a2.cpage == p};})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 3) === "any") { | + | if (input.substr(pos.offset, 3) === "any") { |
result0 = "any"; | result0 = "any"; | ||
− | pos | + | advance(pos, 3); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 791: | Zeile 945: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, a) {return function(){for(var j=0; j<a.length; j++) if (a[j]()) return true; return false; }})(pos0, result0[2]); | + | result0 = (function(offset, line, column, a) {return function(){for(var j=0; j<a.length; j++) if (a[j]()) return true; return false; }})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 3) === "all") { | + | if (input.substr(pos.offset, 3) === "all") { |
result0 = "all"; | result0 = "all"; | ||
− | pos | + | advance(pos, 3); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 833: | Zeile 987: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, a) {return function(){for(var j=0; j<a.length; j++) if (!a[j]()) return false; return true; }})(pos0, result0[2]); | + | result0 = (function(offset, line, column, a) {return function(){for(var j=0; j<a.length; j++) if (!a[j]()) return false; return true; }})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 3) === "not") { | + | if (input.substr(pos.offset, 3) === "not") { |
result0 = "not"; | result0 = "not"; | ||
− | pos | + | advance(pos, 3); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 875: | Zeile 1.029: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, f) {return function(){ return !f()};})(pos0, result0[2]); | + | result0 = (function(offset, line, column, f) {return function(){ return !f()};})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 4) === "have") { | + | if (input.substr(pos.offset, 4) === "have") { |
result0 = "have"; | result0 = "have"; | ||
− | pos | + | advance(pos, 4); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 917: | Zeile 1.071: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, i) {return function(){return !!a2.items[i]};})(pos0, result0[2]); | + | result0 = (function(offset, line, column, i) {return function(){return !!a2.items[i]};})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 4) === "page") { | + | if (input.substr(pos.offset, 4) === "page") { |
result0 = "page"; | result0 = "page"; | ||
− | pos | + | advance(pos, 4); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 959: | Zeile 1.113: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, v) {return function(){return !!a2.hasVirtual(v);};})(pos0, result0[2]); | + | result0 = (function(offset, line, column, v) {return function(){return !!a2.util.hasVirtual(v);};})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 4) === "have") { | + | if (input.substr(pos.offset, 4) === "have") { |
result0 = "have"; | result0 = "have"; | ||
− | pos | + | advance(pos, 4); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 1.001: | Zeile 1.155: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, v) {return function(){return !!a2.hasVirtual(v);};})(pos0, result0[2]); | + | result0 = (function(offset, line, column, v) {return function(){return !!a2.util.hasVirtual(v);};})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
− | + | if (result0 === null) { | |
− | + | pos0 = clone(pos); | |
− | + | pos1 = clone(pos); | |
− | + | if (input.substr(pos.offset, 7) === "visible") { | |
− | + | result0 = "visible"; | |
− | + | advance(pos, 7); | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | if (reportFailures === 0) { | |
− | + | matchFailed("\"visible\""); | |
− | + | } | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result1 = parse_L(); | |
− | + | if (result1 !== null) { | |
− | + | result2 = parse_Overlay(); | |
− | + | if (result2 !== null) { | |
− | + | result3 = parse_R(); | |
− | + | if (result3 !== null) { | |
− | + | result0 = [result0, result1, result2, result3]; | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result0 = (function(offset, line, column, o) {return function(){return $("#overlay_"+o+":visible").length;};})(pos0.offset, pos0.line, pos0.column, result0[2]); | |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos = clone(pos0); | |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos0 = clone(pos); | |
− | + | pos1 = clone(pos); | |
− | + | if (input.substr(pos.offset, 12) === "timeoutIsSet") { | |
− | + | result0 = "timeoutIsSet"; | |
− | + | advance(pos, 12); | |
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"timeoutIsSet\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = parse_L(); | ||
+ | if (result1 !== null) { | ||
+ | result2 = parse_R(); | ||
+ | if (result2 !== null) { | ||
+ | result0 = [result0, result1, result2]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column) {return function(){return a2.util.timeoutIsSet();};})(pos0.offset, pos0.line, pos0.column); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
} | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_ConditionArgs() { |
− | var result0, result1, result2 | + | var cacheKey = "ConditionArgs@" + pos.offset; |
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = | + | pos1 = clone(pos); |
− | + | result0 = parse_ConditionFunction(); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result1 = | + | result1 = parse_C(); |
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_ConditionArgs(); |
if (result2 !== null) { | if (result2 !== null) { | ||
− | + | result0 = [result0, result1, result2]; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, | + | result0 = (function(offset, line, column, f, a) {a.push(f); return a;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); |
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos0 = clone(pos); |
+ | result0 = parse_ConditionFunction(); | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, f) {return [f];})(pos0.offset, pos0.line, pos0.column, result0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_ActionClause() { |
− | var | + | var cacheKey = "ActionClause@" + pos.offset; |
− | var | + | var cachedResult = cache[cacheKey]; |
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
− | pos0 = pos; | + | var result0, result1, result2, result3; |
− | pos1 = pos; | + | var pos0, pos1; |
− | result0 = | + | |
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.substr(pos.offset, 2) === "do") { | ||
+ | result0 = "do"; | ||
+ | advance(pos, 2); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"do\""); | ||
+ | } | ||
+ | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result1 = | + | result1 = parse_S(); |
if (result1 !== null) { | if (result1 !== null) { | ||
result2 = parse_ActionFunctions(); | result2 = parse_ActionFunctions(); | ||
if (result2 !== null) { | if (result2 !== null) { | ||
− | result0 = [result0, result1, result2]; | + | result3 = parse_CC(); |
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, | + | result0 = (function(offset, line, column, ac) {return ac;})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0 | + | pos = clone(pos0); |
− | |||
− | |||
− | |||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_ActionFunctions() { |
− | var result0, result1, result2 | + | var cacheKey = "ActionFunctions@" + pos.offset; |
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = | + | pos1 = clone(pos); |
− | + | result0 = parse_ActionFunction(); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result1 = | + | result1 = parse_C(); |
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_ActionFunctions(); |
if (result2 !== null) { | if (result2 !== null) { | ||
− | + | result0 = [result0, result1, result2]; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, f, | + | result0 = (function(offset, line, column, f, a) {return function(real){f(real); a(real);};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | result0 = parse_ActionFunction(); |
− | + | } | |
− | + | ||
− | + | cache[cacheKey] = { | |
− | + | nextPos: clone(pos), | |
− | + | result: result0 | |
− | + | }; | |
− | + | return result0; | |
− | + | } | |
− | + | ||
− | + | function parse_ActionFunction() { | |
− | + | var cacheKey = "ActionFunction@" + pos.offset; | |
− | + | var cachedResult = cache[cacheKey]; | |
− | + | if (cachedResult) { | |
− | + | pos = clone(cachedResult.nextPos); | |
− | + | return cachedResult.result; | |
− | + | } | |
− | + | ||
− | + | var result0, result1, result2, result3, result4, result5, result6; | |
− | + | var pos0, pos1; | |
− | + | ||
− | + | pos0 = clone(pos); | |
− | + | pos1 = clone(pos); | |
+ | if (input.substr(pos.offset, 4) === "goto") { | ||
+ | result0 = "goto"; | ||
+ | advance(pos, 4); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"goto\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = parse_L(); | ||
+ | if (result1 !== null) { | ||
+ | result2 = parse_Page(); | ||
+ | if (result2 !== null) { | ||
+ | result3 = parse_R(); | ||
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
− | if (result0 !== null) { | + | } else { |
− | + | result0 = null; | |
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, f, p) {return function(real){a2.util.goto(p)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.substr(pos.offset, 3) === "add") { | ||
+ | result0 = "add"; | ||
+ | advance(pos, 3); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"add\""); | ||
+ | } | ||
} | } | ||
− | if (result0 === null) { | + | if (result0 !== null) { |
− | pos = pos0; | + | result1 = parse_L(); |
− | } | + | if (result1 !== null) { |
− | if (result0 === null) { | + | result2 = parse_Identifier(); |
− | pos0 = pos; | + | if (result2 !== null) { |
− | pos1 = pos; | + | result3 = parse_R(); |
− | if (input.substr(pos, 6) === "remove") { | + | if (result3 !== null) { |
− | result0 = "remove"; | + | result0 = [result0, result1, result2, result3]; |
− | pos | + | } else { |
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, f, i) {return function(real){a2.util.add(i)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.substr(pos.offset, 6) === "remove") { | ||
+ | result0 = "remove"; | ||
+ | advance(pos, 6); | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 1.268: | Zeile 1.550: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, f, i) {return function(real){a2.util.remove(i)};})(pos0, result0[0], result0[2]); | + | result0 = (function(offset, line, column, f, i) {return function(real){a2.util.remove(i)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, 5) === "print") { | + | if (input.substr(pos.offset, 5) === "print") { |
result0 = "print"; | result0 = "print"; | ||
− | pos | + | advance(pos, 5); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
Zeile 1.310: | Zeile 1.592: | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, f, s) {return function(real){a2.util.print(s)};})(pos0, result0[0], result0[2]); | + | result0 = (function(offset, line, column, f, s) {return function(real){a2.util.print(s)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, | + | if (input.substr(pos.offset, 3) === "ask") { |
− | result0 = " | + | result0 = "ask"; |
− | pos | + | advance(pos, 3); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("\" | + | matchFailed("\"ask\""); |
} | } | ||
} | } | ||
Zeile 1.345: | Zeile 1.627: | ||
result1 = parse_L(); | result1 = parse_L(); | ||
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_String(); |
if (result2 !== null) { | if (result2 !== null) { | ||
− | result3 = | + | result3 = parse_C(); |
if (result3 !== null) { | if (result3 !== null) { | ||
− | result0 = [result0, result1, result2, result3]; | + | result4 = parse_StringKwArgClause(); |
+ | if (result4 !== null) { | ||
+ | result5 = parse_R(); | ||
+ | if (result5 !== null) { | ||
+ | result0 = [result0, result1, result2, result3, result4, result5]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, f, | + | result0 = (function(offset, line, column, f, s, c) {return function(real){a2.util.print(s,c);};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2], result0[4]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, | + | if (input.substr(pos.offset, 12) === "clearTimeout") { |
− | result0 = " | + | result0 = "clearTimeout"; |
− | pos | + | advance(pos, 12); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("\" | + | matchFailed("\"clearTimeout\""); |
} | } | ||
} | } | ||
Zeile 1.387: | Zeile 1.681: | ||
result1 = parse_L(); | result1 = parse_L(); | ||
if (result1 !== null) { | if (result1 !== null) { | ||
− | if ( | + | result2 = parse_R(); |
− | result2 | + | if (result2 !== null) { |
− | + | result0 = [result0, result1, result2]; | |
} else { | } else { | ||
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | |||
− | |||
} | } | ||
− | if ( | + | } else { |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, f) {return function(real){a2.timer.clear();};})(pos0.offset, pos0.line, pos0.column, result0[0]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.substr(pos.offset, 11) === "showOverlay") { | ||
+ | result0 = "showOverlay"; | ||
+ | advance(pos, 11); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"showOverlay\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = parse_L(); | ||
+ | if (result1 !== null) { | ||
+ | result2 = parse_Overlay(); | ||
+ | if (result2 !== null) { | ||
+ | result3 = parse_R(); | ||
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
} else { | } else { | ||
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
} | } | ||
− | if ( | + | } else { |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result0 = (function(offset, line, column, f, o) {return function(real){ $("#overlay_"+o).show();};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); | |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos = clone(pos0); | |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos0 = clone(pos); | |
− | + | pos1 = clone(pos); | |
− | + | if (input.substr(pos.offset, 11) === "hideOverlay") { | |
− | + | result0 = "hideOverlay"; | |
− | + | advance(pos, 11); | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | if (reportFailures === 0) { | |
− | + | matchFailed("\"hideOverlay\""); | |
− | + | } | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result1 = parse_L(); | |
+ | if (result1 !== null) { | ||
+ | result2 = parse_Overlay(); | ||
+ | if (result2 !== null) { | ||
+ | result3 = parse_R(); | ||
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, f, o) {return function(real){ $("#overlay_"+o).hide();};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
} | } | ||
− | + | if (result0 === null) { | |
− | + | pos0 = clone(pos); | |
− | + | pos1 = clone(pos); | |
− | + | if (input.substr(pos.offset, 6) === "remove") { | |
− | + | result0 = "remove"; | |
− | + | advance(pos, 6); | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | if (reportFailures === 0) { | |
− | + | matchFailed("\"remove\""); | |
− | + | } | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result1 = parse_L(); | |
− | + | if (result1 !== null) { | |
− | + | result2 = parse_ItemVirtual(); | |
− | + | if (result2 !== null) { | |
− | + | result3 = parse_R(); | |
− | + | if (result3 !== null) { | |
− | + | result0 = [result0, result1, result2, result3]; | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result0 = (function(offset, line, column, f, i) {return function(real){a2.util.removeAll(i)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); | |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos = clone(pos0); | |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos0 = clone(pos); | |
− | + | pos1 = clone(pos); | |
− | + | if (input.substr(pos.offset, 6) === "remove") { | |
− | + | result0 = "remove"; | |
− | + | advance(pos, 6); | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | if (reportFailures === 0) { | |
− | + | matchFailed("\"remove\""); | |
− | + | } | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result1 = parse_L(); | |
− | + | if (result1 !== null) { | |
− | + | if (input.substr(pos.offset, 2) === "${") { | |
− | + | result2 = "${"; | |
− | + | advance(pos, 2); | |
− | + | } else { | |
− | + | result2 = null; | |
− | + | if (reportFailures === 0) { | |
− | + | matchFailed("\"${\""); | |
− | + | } | |
− | + | } | |
− | + | if (result2 !== null) { | |
+ | result3 = parse_TriggerItemOrVirtOp(); | ||
+ | if (result3 === null) { | ||
+ | if (input.substr(pos.offset, 7) === "combine") { | ||
+ | result3 = "combine"; | ||
+ | advance(pos, 7); | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"combine\""); | ||
+ | } | ||
+ | } | ||
+ | if (result3 === null) { | ||
+ | if (input.substr(pos.offset, 5) === "apply") { | ||
+ | result3 = "apply"; | ||
+ | advance(pos, 5); | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"apply\""); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | if (result3 !== null) { | ||
+ | if (/^[12]/.test(input.charAt(pos.offset))) { | ||
+ | result4 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result4 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[12]"); | ||
+ | } | ||
+ | } | ||
+ | if (result4 !== null) { | ||
+ | if (input.charCodeAt(pos.offset) === 125) { | ||
+ | result5 = "}"; | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result5 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"}\""); | ||
+ | } | ||
+ | } | ||
+ | if (result5 !== null) { | ||
+ | result6 = parse_R(); | ||
+ | if (result6 !== null) { | ||
+ | result0 = [result0, result1, result2, result3, result4, result5, result6]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, f, rt, rn) {return function(real){if (rt == real[0] && a2.virtualTriggerMap[rt] && a2.virtualTriggerMap[rt][parseInt(rn)-1]) a2.util.remove(real[parseInt(rn)]);};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[3], result0[4]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.substr(pos.offset, 10) === "setTimeout") { | ||
+ | result0 = "setTimeout"; | ||
+ | advance(pos, 10); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"setTimeout\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = parse_L(); | ||
+ | if (result1 !== null) { | ||
+ | result2 = parse_Time(); | ||
+ | if (result2 !== null) { | ||
+ | result3 = parse_R(); | ||
+ | if (result3 !== null) { | ||
+ | result4 = parse_C(); | ||
+ | if (result4 !== null) { | ||
+ | result5 = parse_ActionFunctions(); | ||
+ | if (result5 !== null) { | ||
+ | result0 = [result0, result1, result2, result3, result4, result5]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, t, a) {return function(real){a2.timer.set(t, function(){a(real)});};})(pos0.offset, pos0.line, pos0.column, result0[2], result0[5]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.substr(pos.offset, 4) === "play") { | ||
+ | result0 = "play"; | ||
+ | advance(pos, 4); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"play\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = parse_L(); | ||
+ | if (result1 !== null) { | ||
+ | result2 = parse_Channel(); | ||
+ | if (result2 !== null) { | ||
+ | result3 = parse_C(); | ||
+ | if (result3 !== null) { | ||
+ | result4 = parse_String(); | ||
+ | if (result4 !== null) { | ||
+ | result5 = parse_R(); | ||
+ | if (result5 !== null) { | ||
+ | result0 = [result0, result1, result2, result3, result4, result5]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, f, chan, file) {return function(real){a2.audio.play(chan, file)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2], result0[4]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.substr(pos.offset, 4) === "stop") { | ||
+ | result0 = "stop"; | ||
+ | advance(pos, 4); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"stop\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = parse_L(); | ||
+ | if (result1 !== null) { | ||
+ | result2 = parse_Channel(); | ||
+ | if (result2 !== null) { | ||
+ | result3 = parse_R(); | ||
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, f, chan) {return function(real){a2.audio.stop(chan)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_Channel() { |
− | var result0 | + | var cacheKey = "Channel@" + pos.offset; |
− | var pos0 | + | var cachedResult = cache[cacheKey]; |
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0; | ||
+ | var pos0; | ||
− | pos0 = pos | + | pos0 = clone(pos); |
− | + | if (input.substr(pos.offset, 5) === "music") { | |
− | if (input.substr(pos, | + | result0 = "music"; |
− | result0 = " | + | advance(pos, 5); |
− | pos | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("\" | + | matchFailed("\"music\""); |
} | } | ||
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | + | result0 = (function(offset, line, column) {return "music";})(pos0.offset, pos0.line, pos0.column); | |
− | if ( | + | } |
− | + | if (result0 === null) { | |
− | if ( | + | pos = clone(pos0); |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos0 = clone(pos); | |
− | + | if (input.substr(pos.offset, 5) === "noise") { | |
− | + | result0 = "noise"; | |
− | + | advance(pos, 5); | |
− | + | } else { | |
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"noise\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column) {return "noise";})(pos0.offset, pos0.line, pos0.column); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | if (input.substr(pos.offset, 10) === "background") { | ||
+ | result0 = "background"; | ||
+ | advance(pos, 10); | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | if (reportFailures === 0) { |
+ | matchFailed("\"background\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column) {return "background";})(pos0.offset, pos0.line, pos0.column); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
} | } | ||
− | |||
− | |||
− | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_PageDec() { |
− | var result0, result1, result2; | + | var cacheKey = "PageDec@" + pos.offset; |
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2, result3; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos | + | pos1 = clone(pos); |
− | + | if (input.substr(pos.offset, 4) === "page") { | |
− | if ( | + | result0 = "page"; |
− | + | advance(pos, 4); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | + | if (reportFailures === 0) { | |
+ | matchFailed("\"page\""); | ||
+ | } | ||
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | + | result1 = parse_CC(); | |
− | } | + | if (result1 !== null) { |
− | if (result0 | + | result2 = parse_PageVirtualClause(); |
− | + | result2 = result2 !== null ? result2 : ""; | |
+ | if (result2 !== null) { | ||
+ | result3 = parse_End(); | ||
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, pv) {return ["page", {virt:pv}];})(pos0.offset, pos0.line, pos0.column, result0[2]); | ||
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | + | pos = clone(pos0); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_PageVirtualClause() { |
− | var | + | var cacheKey = "PageVirtualClause@" + pos.offset; |
− | var | + | var cachedResult = cache[cacheKey]; |
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
− | pos0 = pos; | + | var result0, result1, result2, result3; |
− | pos1 = pos; | + | var pos0, pos1; |
− | if (input.substr(pos, | + | |
− | result0 = " | + | pos0 = clone(pos); |
− | pos | + | pos1 = clone(pos); |
+ | if (input.substr(pos.offset, 8) === "provides") { | ||
+ | result0 = "provides"; | ||
+ | advance(pos, 8); | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("\" | + | matchFailed("\"provides\""); |
} | } | ||
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result1 = | + | result1 = parse_S(); |
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_PageVirtualList(); |
− | |||
if (result2 !== null) { | if (result2 !== null) { | ||
− | result3 = | + | result3 = parse_CC(); |
− | |||
if (result3 !== null) { | if (result3 !== null) { | ||
− | + | result0 = [result0, result1, result2, result3]; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, | + | result0 = (function(offset, line, column, v) {return v;})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_PageVirtualList() { |
− | var result0, result1, result2 | + | var cacheKey = "PageVirtualList@" + pos.offset; |
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = | + | pos1 = clone(pos); |
− | + | result0 = parse_PageVirtual(); | |
− | + | if (result0 !== null) { | |
− | + | result1 = parse_C(); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | if (result0 !== null) { | ||
− | result1 = | ||
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_PageVirtualList(); |
if (result2 !== null) { | if (result2 !== null) { | ||
− | + | result0 = [result0, result1, result2]; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, | + | result0 = (function(offset, line, column, v, vl) {vl.push(v); return vl;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); |
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos0 = clone(pos); |
+ | result0 = parse_PageVirtual(); | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, v) {return [v];})(pos0.offset, pos0.line, pos0.column, result0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_ItemDec() { |
− | var result0, result1, result2, result3; | + | var cacheKey = "ItemDec@" + pos.offset; |
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2, result3, result4; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | if (input.substr(pos, | + | if (input.substr(pos.offset, 4) === "item") { |
− | result0 = " | + | result0 = "item"; |
− | pos | + | advance(pos, 4); |
} else { | } else { | ||
result0 = null; | result0 = null; | ||
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("\" | + | matchFailed("\"item\""); |
} | } | ||
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result1 = | + | result1 = parse_CC(); |
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_TitleClause(); |
+ | result2 = result2 !== null ? result2 : ""; | ||
if (result2 !== null) { | if (result2 !== null) { | ||
− | result3 = | + | result3 = parse_ItemVirtualClause(); |
+ | result3 = result3 !== null ? result3 : ""; | ||
if (result3 !== null) { | if (result3 !== null) { | ||
− | result0 = [result0, result1, result2, result3]; | + | result4 = parse_End(); |
+ | if (result4 !== null) { | ||
+ | result0 = [result0, result1, result2, result3, result4]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, | + | result0 = (function(offset, line, column, t, iv) {return ["item", {virt:iv, title:t}];})(pos0.offset, pos0.line, pos0.column, result0[2], result0[3]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_TitleClause() { |
− | var result0, result1, result2; | + | var cacheKey = "TitleClause@" + pos.offset; |
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2, result3; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | pos1 = pos; | + | pos1 = clone(pos); |
− | result0 = | + | if (input.substr(pos.offset, 5) === "title") { |
− | if (result0 !== null) { | + | result0 = "title"; |
− | result1 = | + | advance(pos, 5); |
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"title\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = parse_S(); | ||
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_String(); |
if (result2 !== null) { | if (result2 !== null) { | ||
− | result0 = [result0, result1, result2]; | + | result3 = parse_CC(); |
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos1; | + | pos = clone(pos1); |
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, | + | result0 = (function(offset, line, column, s) {return s;})(pos0.offset, pos0.line, pos0.column, result0[2]); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = | + | pos = clone(pos0); |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_ItemVirtualClause() { |
− | var | + | var cacheKey = "ItemVirtualClause@" + pos.offset; |
− | var | + | var cachedResult = cache[cacheKey]; |
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
− | pos0 = pos; | + | var result0, result1, result2, result3; |
− | result0 = | + | var pos0, pos1; |
− | result0 = | + | |
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.substr(pos.offset, 8) === "provides") { | ||
+ | result0 = "provides"; | ||
+ | advance(pos, 8); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"provides\""); | ||
+ | } | ||
+ | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | + | result1 = parse_S(); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_ItemVirtualList(); |
− | |||
if (result2 !== null) { | if (result2 !== null) { | ||
− | result0 = [result0, result1, result2]; | + | result3 = parse_CC(); |
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos0; | + | pos = clone(pos1); |
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, v) {return v;})(pos0.offset, pos0.line, pos0.column, result0[2]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_ItemVirtualList() { |
+ | var cacheKey = "ItemVirtualList@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2; | var result0, result1, result2; | ||
− | var pos0; | + | var pos0, pos1; |
− | pos0 = pos; | + | pos0 = clone(pos); |
− | + | pos1 = clone(pos); | |
− | result0 = | + | result0 = parse_ItemVirtual(); |
if (result0 !== null) { | if (result0 !== null) { | ||
− | + | result1 = parse_C(); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_ItemVirtualList(); |
− | |||
if (result2 !== null) { | if (result2 !== null) { | ||
result0 = [result0, result1, result2]; | result0 = [result0, result1, result2]; | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos0; | + | pos = clone(pos1); |
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, v, vl) {vl.push(v); return vl;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | result0 = parse_ItemVirtual(); | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, v) {return [v];})(pos0.offset, pos0.line, pos0.column, result0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_StringKwArgClause() { |
+ | var cacheKey = "StringKwArgClause@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2; | var result0, result1, result2; | ||
− | var pos0; | + | var pos0, pos1; |
− | pos0 = pos; | + | pos0 = clone(pos); |
− | + | pos1 = clone(pos); | |
− | result0 = | + | result0 = parse_StringKwArg(); |
if (result0 !== null) { | if (result0 !== null) { | ||
− | + | result1 = parse_C(); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
if (result1 !== null) { | if (result1 !== null) { | ||
− | result2 = | + | result2 = parse_StringKwArgClause(); |
− | |||
if (result2 !== null) { | if (result2 !== null) { | ||
result0 = [result0, result1, result2]; | result0 = [result0, result1, result2]; | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos0; | + | pos = clone(pos1); |
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, k, r) {return [k].concat(r); })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | result0 = parse_StringKwArg(); | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, k) { return [k]; })(pos0.offset, pos0.line, pos0.column, result0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_StringKwArg() { |
− | var | + | var cacheKey = "StringKwArg@" + pos.offset; |
− | var | + | var cachedResult = cache[cacheKey]; |
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
− | pos0 = pos; | + | var result0, result1, result2, result3, result4; |
− | + | var pos0, pos1; | |
− | result0 = | + | |
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | result0 = parse_Identifier(); | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | if (input.charCodeAt(pos) === | + | result1 = parse_S(); |
− | + | result1 = result1 !== null ? result1 : ""; | |
− | + | if (result1 !== null) { | |
− | + | if (input.charCodeAt(pos.offset) === 61) { | |
− | + | result2 = "="; | |
− | + | advance(pos, 1); | |
− | + | } else { | |
+ | result2 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"=\""); | ||
+ | } | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
if (result2 !== null) { | if (result2 !== null) { | ||
− | result0 = [result0, result1, result2]; | + | result3 = parse_S(); |
+ | result3 = result3 !== null ? result3 : ""; | ||
+ | if (result3 !== null) { | ||
+ | result4 = parse_String(); | ||
+ | if (result4 !== null) { | ||
+ | result0 = [result0, result1, result2, result3, result4]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, i, s) {return [i,s];})(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_L() { |
+ | var cacheKey = "L@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
var result0, result1, result2; | var result0, result1, result2; | ||
− | var pos0 | + | var pos0; |
− | pos0 = pos; | + | pos0 = clone(pos); |
− | + | result0 = parse_S(); | |
− | + | result0 = result0 !== null ? result0 : ""; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
if (result0 !== null) { | if (result0 !== null) { | ||
− | + | if (input.charCodeAt(pos.offset) === 40) { | |
− | if | + | result1 = "("; |
− | + | advance(pos, 1); | |
− | pos | ||
} else { | } else { | ||
− | + | result1 = null; | |
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed(" | + | matchFailed("\"(\""); |
} | } | ||
} | } | ||
− | + | if (result1 !== null) { | |
− | + | result2 = parse_S(); | |
− | if ( | + | result2 = result2 !== null ? result2 : ""; |
− | result2 | + | if (result2 !== null) { |
− | + | result0 = [result0, result1, result2]; | |
} else { | } else { | ||
− | + | result0 = null; | |
− | + | pos = clone(pos0); | |
− | |||
− | |||
} | } | ||
− | |||
− | |||
− | |||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos0); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos0); |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_R() { |
− | var result0, result1; | + | var cacheKey = "R@" + pos.offset; |
− | var pos0 | + | var cachedResult = cache[cacheKey]; |
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2; | ||
+ | var pos0; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | + | result0 = parse_S(); | |
− | + | result0 = result0 !== null ? result0 : ""; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result1 = | + | if (input.charCodeAt(pos.offset) === 41) { |
+ | result1 = ")"; | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\")\""); | ||
+ | } | ||
+ | } | ||
if (result1 !== null) { | if (result1 !== null) { | ||
− | result0 = [result0, result1]; | + | result2 = parse_S(); |
+ | result2 = result2 !== null ? result2 : ""; | ||
+ | if (result2 !== null) { | ||
+ | result0 = [result0, result1, result2]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos0); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos0); |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_C() { |
− | var result0, result1; | + | var cacheKey = "C@" + pos.offset; |
− | var pos0 | + | var cachedResult = cache[cacheKey]; |
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2; | ||
+ | var pos0; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | + | result0 = parse_S(); | |
− | if (input.charCodeAt(pos) === | + | result0 = result0 !== null ? result0 : ""; |
− | + | if (result0 !== null) { | |
− | + | if (input.charCodeAt(pos.offset) === 44) { | |
− | + | result1 = ","; | |
− | + | advance(pos, 1); | |
− | + | } else { | |
− | + | result1 = null; | |
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\",\""); | ||
+ | } | ||
} | } | ||
− | |||
− | |||
− | |||
if (result1 !== null) { | if (result1 !== null) { | ||
− | result0 = [result0, result1]; | + | result2 = parse_S(); |
+ | result2 = result2 !== null ? result2 : ""; | ||
+ | if (result2 !== null) { | ||
+ | result0 = [result0, result1, result2]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos0); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos0); |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_CC() { |
− | var result0, result1; | + | var cacheKey = "CC@" + pos.offset; |
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2; | ||
var pos0; | var pos0; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | if ( | + | result0 = parse_S(); |
− | + | result0 = result0 !== null ? result0 : ""; | |
− | + | if (result0 !== null) { | |
− | + | if (input.charCodeAt(pos.offset) === 59) { | |
− | + | result1 = ";"; | |
− | + | advance(pos, 1); | |
− | + | } else { | |
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\";\""); | ||
+ | } | ||
} | } | ||
− | + | if (result1 !== null) { | |
− | + | result2 = parse_S(); | |
− | + | result2 = result2 !== null ? result2 : ""; | |
− | + | if (result2 !== null) { | |
− | + | result0 = [result0, result1, result2]; | |
− | if ( | ||
− | result1 | ||
− | |||
} else { | } else { | ||
− | + | result0 = null; | |
− | + | pos = clone(pos0); | |
− | |||
− | |||
} | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
+ | pos = clone(pos0); | ||
} | } | ||
− | + | ||
− | + | cache[cacheKey] = { | |
− | } | + | nextPos: clone(pos), |
− | + | result: result0 | |
− | + | }; | |
− | + | return result0; | |
− | return result0; | ||
} | } | ||
− | function | + | function parse_Identifier() { |
− | var result0, result1, result2 | + | var cacheKey = "Identifier@" + pos.offset; |
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2; | ||
var pos0, pos1; | var pos0, pos1; | ||
− | pos0 = pos; | + | pos0 = clone(pos); |
− | + | pos1 = clone(pos); | |
− | if (/^[ \ | + | if (/^[a-z\xE4\xF6\xFC_]/.test(input.charAt(pos.offset))) { |
− | + | result0 = input.charAt(pos.offset); | |
− | pos | + | advance(pos, 1); |
} else { | } else { | ||
− | + | result0 = null; | |
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("[ \\ | + | matchFailed("[a-z\\xE4\\xF6\\xFC_]"); |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | if (input. | + | result1 = []; |
− | + | if (/^[a-z\xE4\xF6\xFC_]/.test(input.charAt(pos.offset))) { | |
− | pos | + | result2 = input.charAt(pos.offset); |
+ | advance(pos, 1); | ||
} else { | } else { | ||
− | + | result2 = null; | |
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("\ | + | matchFailed("[a-z\\xE4\\xF6\\xFC_]"); |
} | } | ||
} | } | ||
− | + | while (result2 !== null) { | |
− | result2 | + | result1.push(result2); |
− | if (/^[ | + | if (/^[a-z\xE4\xF6\xFC_]/.test(input.charAt(pos.offset))) { |
− | + | result2 = input.charAt(pos.offset); | |
− | pos | + | advance(pos, 1); |
} else { | } else { | ||
− | + | result2 = null; | |
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("[ | + | matchFailed("[a-z\\xE4\\xF6\\xFC_]"); |
} | } | ||
} | } | ||
− | + | } | |
− | + | if (result1 !== null) { | |
− | + | result0 = [result0, result1]; | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result0 = (function(offset, line, column, i1, i2) {return i1+i2.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); | |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos = clone(pos0); | |
− | + | } | |
− | + | ||
− | + | cache[cacheKey] = { | |
− | + | nextPos: clone(pos), | |
− | + | result: result0 | |
− | + | }; | |
− | + | return result0; | |
− | + | } | |
− | + | ||
− | + | function parse_PageVirtual() { | |
− | + | var cacheKey = "PageVirtual@" + pos.offset; | |
− | + | var cachedResult = cache[cacheKey]; | |
− | + | if (cachedResult) { | |
− | + | pos = clone(cachedResult.nextPos); | |
− | + | return cachedResult.result; | |
− | + | } | |
− | + | ||
− | + | var result0, result1; | |
− | + | var pos0, pos1; | |
− | + | ||
− | + | pos0 = clone(pos); | |
− | + | pos1 = clone(pos); | |
− | + | if (input.charCodeAt(pos.offset) === 64) { | |
− | + | result0 = "@"; | |
− | + | advance(pos, 1); | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | if (reportFailures === 0) { | |
− | + | matchFailed("\"@\""); | |
− | + | } | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result1 = parse_Identifier(); | |
− | + | if (result1 !== null) { | |
− | + | result0 = [result0, result1]; | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | pos = clone(pos1); | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result0 = (function(offset, line, column, p, i) {return p+i;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); | |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos = clone(pos0); | |
− | + | } | |
− | + | ||
− | + | cache[cacheKey] = { | |
− | + | nextPos: clone(pos), | |
− | + | result: result0 | |
− | + | }; | |
− | + | return result0; | |
− | + | } | |
− | + | ||
− | + | function parse_ItemVirtual() { | |
− | + | var cacheKey = "ItemVirtual@" + pos.offset; | |
− | + | var cachedResult = cache[cacheKey]; | |
− | + | if (cachedResult) { | |
− | + | pos = clone(cachedResult.nextPos); | |
− | + | return cachedResult.result; | |
− | + | } | |
− | + | ||
− | + | var result0, result1; | |
− | + | var pos0, pos1; | |
− | + | ||
− | + | pos0 = clone(pos); | |
− | + | pos1 = clone(pos); | |
− | + | if (input.charCodeAt(pos.offset) === 58) { | |
− | + | result0 = ":"; | |
− | + | advance(pos, 1); | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | if (reportFailures === 0) { | |
− | + | matchFailed("\":\""); | |
− | + | } | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result1 = parse_Identifier(); | |
− | + | if (result1 !== null) { | |
− | + | result0 = [result0, result1]; | |
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos1); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = pos0; | + | pos = clone(pos1); |
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, p, i) {return p+i;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); | ||
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos0 = pos; | + | pos = clone(pos0); |
− | + | } | |
− | if (/^[ | + | |
− | + | cache[cacheKey] = { | |
− | + | nextPos: clone(pos), | |
− | + | result: result0 | |
− | + | }; | |
− | + | return result0; | |
− | + | } | |
− | + | ||
+ | function parse_Page() { | ||
+ | var cacheKey = "Page@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1; | ||
+ | var pos0; | ||
+ | |||
+ | pos0 = clone(pos); | ||
+ | if (/^[0-9]/.test(input.charAt(pos.offset))) { | ||
+ | result1 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[0-9]"); | ||
} | } | ||
+ | } | ||
+ | if (result1 !== null) { | ||
+ | result0 = []; | ||
while (result1 !== null) { | while (result1 !== null) { | ||
result0.push(result1); | result0.push(result1); | ||
− | if (/^[ | + | if (/^[0-9]/.test(input.charAt(pos.offset))) { |
− | result1 = input.charAt(pos); | + | result1 = input.charAt(pos.offset); |
− | pos | + | advance(pos, 1); |
} else { | } else { | ||
result1 = null; | result1 = null; | ||
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("[ | + | matchFailed("[0-9]"); |
} | } | ||
} | } | ||
} | } | ||
− | if (result0 !== null) { | + | } else { |
− | + | result0 = null; | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result0 = (function(offset, line, column, p) {return p.join("");})(pos0.offset, pos0.line, pos0.column, result0); | |
− | + | } | |
− | + | if (result0 === null) { | |
− | + | pos = clone(pos0); | |
− | + | } | |
− | + | ||
− | + | cache[cacheKey] = { | |
− | + | nextPos: clone(pos), | |
− | + | result: result0 | |
− | + | }; | |
− | + | return result0; | |
− | + | } | |
− | + | ||
− | + | function parse_Time() { | |
− | + | var cacheKey = "Time@" + pos.offset; | |
− | + | var cachedResult = cache[cacheKey]; | |
− | + | if (cachedResult) { | |
− | + | pos = clone(cachedResult.nextPos); | |
− | + | return cachedResult.result; | |
− | + | } | |
− | + | ||
− | + | var result0, result1, result2; | |
− | + | var pos0, pos1; | |
− | + | ||
− | + | pos0 = clone(pos); | |
− | + | pos1 = clone(pos); | |
− | + | if (/^[1-9]/.test(input.charAt(pos.offset))) { | |
− | + | result0 = input.charAt(pos.offset); | |
− | + | advance(pos, 1); | |
− | + | } else { | |
− | + | result0 = null; | |
− | + | if (reportFailures === 0) { | |
− | + | matchFailed("[1-9]"); | |
− | + | } | |
− | + | } | |
− | + | if (result0 !== null) { | |
− | + | result1 = []; | |
− | + | if (/^[0-9]/.test(input.charAt(pos.offset))) { | |
− | + | result2 = input.charAt(pos.offset); | |
− | + | advance(pos, 1); | |
− | + | } else { | |
− | + | result2 = null; | |
− | + | if (reportFailures === 0) { | |
− | + | matchFailed("[0-9]"); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | |||
− | |||
− | |||
} | } | ||
− | + | while (result2 !== null) { | |
− | if (/^[ | + | result1.push(result2); |
− | + | if (/^[0-9]/.test(input.charAt(pos.offset))) { | |
− | pos | + | result2 = input.charAt(pos.offset); |
+ | advance(pos, 1); | ||
} else { | } else { | ||
− | + | result2 = null; | |
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("[ | + | matchFailed("[0-9]"); |
} | } | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
+ | if (result1 !== null) { | ||
+ | result0 = [result0, result1]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, p, q) {return parseInt(p+q.join(""));})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
} | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
return result0; | return result0; | ||
} | } | ||
− | function | + | function parse_Overlay() { |
− | var | + | var cacheKey = "Overlay@" + pos.offset; |
− | var | + | var cachedResult = cache[cacheKey]; |
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
− | pos0 | + | var result0, result1; |
− | + | var pos0; | |
− | if (input. | + | |
− | + | pos0 = clone(pos); | |
− | pos | + | if (/^[a-z]/.test(input.charAt(pos.offset))) { |
+ | result1 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
} else { | } else { | ||
− | + | result1 = null; | |
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed(" | + | matchFailed("[a-z]"); |
} | } | ||
} | } | ||
− | if ( | + | if (result1 !== null) { |
− | + | result0 = []; | |
− | + | while (result1 !== null) { | |
− | while ( | + | result0.push(result1); |
− | + | if (/^[a-z]/.test(input.charAt(pos.offset))) { | |
− | + | result1 = input.charAt(pos.offset); | |
− | + | advance(pos, 1); | |
− | |||
− | |||
− | |||
− | pos | ||
} else { | } else { | ||
− | + | result1 = null; | |
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed(" | + | matchFailed("[a-z]"); |
} | } | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | |||
} | } | ||
if (result0 !== null) { | if (result0 !== null) { | ||
− | result0 = (function(offset, | + | result0 = (function(offset, line, column, p) {return p.join("");})(pos0.offset, pos0.line, pos0.column, result0); |
} | } | ||
if (result0 === null) { | if (result0 === null) { | ||
− | pos = pos0; | + | pos = clone(pos0); |
} | } | ||
− | + | ||
− | + | cache[cacheKey] = { | |
− | pos1 = pos; | + | nextPos: clone(pos), |
− | + | result: result0 | |
− | + | }; | |
− | pos | + | return result0; |
+ | } | ||
+ | |||
+ | function parse_S() { | ||
+ | var cacheKey = "S@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2, result3, result4; | ||
+ | var pos0, pos1; | ||
+ | |||
+ | pos0 = clone(pos); | ||
+ | result0 = []; | ||
+ | if (/^[ \t\n]/.test(input.charAt(pos.offset))) { | ||
+ | result1 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[ \\t\\n]"); | ||
+ | } | ||
+ | } | ||
+ | while (result1 !== null) { | ||
+ | result0.push(result1); | ||
+ | if (/^[ \t\n]/.test(input.charAt(pos.offset))) { | ||
+ | result1 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
} else { | } else { | ||
− | + | result1 = null; | |
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("\ | + | matchFailed("[ \\t\\n]"); |
} | } | ||
} | } | ||
− | + | } | |
− | result1 = | + | if (result0 !== null) { |
− | + | if (input.substr(pos.offset, 2) === "/*") { | |
− | + | result1 = "/*"; | |
− | + | advance(pos, 2); | |
− | + | } else { | |
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"/*\""); | ||
+ | } | ||
+ | } | ||
+ | if (result1 !== null) { | ||
+ | result2 = []; | ||
+ | if (/^[^*]/.test(input.charAt(pos.offset))) { | ||
+ | result3 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[^*]"); | ||
+ | } | ||
} | } | ||
− | if ( | + | if (result3 === null) { |
− | if (input. | + | pos1 = clone(pos); |
− | + | if (/^[*]/.test(input.charAt(pos.offset))) { | |
− | pos | + | result3 = input.charAt(pos.offset); |
+ | advance(pos, 1); | ||
} else { | } else { | ||
− | + | result3 = null; | |
if (reportFailures === 0) { | if (reportFailures === 0) { | ||
− | matchFailed("\"\\ | + | matchFailed("[*]"); |
+ | } | ||
+ | } | ||
+ | if (result3 !== null) { | ||
+ | if (/^[^\/]/.test(input.charAt(pos.offset))) { | ||
+ | result4 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result4 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[^\\/]"); | ||
+ | } | ||
+ | } | ||
+ | if (result4 !== null) { | ||
+ | result3 = [result3, result4]; | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | pos = clone(pos1); | ||
} | } | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | pos = clone(pos1); | ||
} | } | ||
− | if (result2 !== null) { | + | } |
− | result0 = [result0, result1, result2]; | + | while (result3 !== null) { |
+ | result2.push(result3); | ||
+ | if (/^[^*]/.test(input.charAt(pos.offset))) { | ||
+ | result3 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[^*]"); | ||
+ | } | ||
+ | } | ||
+ | if (result3 === null) { | ||
+ | pos1 = clone(pos); | ||
+ | if (/^[*]/.test(input.charAt(pos.offset))) { | ||
+ | result3 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[*]"); | ||
+ | } | ||
+ | } | ||
+ | if (result3 !== null) { | ||
+ | if (/^[^\/]/.test(input.charAt(pos.offset))) { | ||
+ | result4 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result4 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[^\\/]"); | ||
+ | } | ||
+ | } | ||
+ | if (result4 !== null) { | ||
+ | result3 = [result3, result4]; | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | if (result2 !== null) { | ||
+ | if (input.substr(pos.offset, 2) === "*/") { | ||
+ | result3 = "*/"; | ||
+ | advance(pos, 2); | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"*/\""); | ||
+ | } | ||
+ | } | ||
+ | if (result3 !== null) { | ||
+ | result4 = parse_S(); | ||
+ | result4 = result4 !== null ? result4 : ""; | ||
+ | if (result4 !== null) { | ||
+ | result0 = [result0, result1, result2, result3, result4]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | result0 = []; | ||
+ | if (/^[ \t\n]/.test(input.charAt(pos.offset))) { | ||
+ | result1 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[ \\t\\n]"); | ||
+ | } | ||
+ | } | ||
+ | while (result1 !== null) { | ||
+ | result0.push(result1); | ||
+ | if (/^[ \t\n]/.test(input.charAt(pos.offset))) { | ||
+ | result1 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[ \\t\\n]"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | if (input.substr(pos.offset, 2) === "//") { | ||
+ | result1 = "//"; | ||
+ | advance(pos, 2); | ||
+ | } else { | ||
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"//\""); | ||
+ | } | ||
+ | } | ||
+ | if (result1 !== null) { | ||
+ | result2 = []; | ||
+ | if (/^[^\n]/.test(input.charAt(pos.offset))) { | ||
+ | result3 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[^\\n]"); | ||
+ | } | ||
+ | } | ||
+ | while (result3 !== null) { | ||
+ | result2.push(result3); | ||
+ | if (/^[^\n]/.test(input.charAt(pos.offset))) { | ||
+ | result3 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result3 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[^\\n]"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | if (result2 !== null) { | ||
+ | result3 = parse_S(); | ||
+ | result3 = result3 !== null ? result3 : ""; | ||
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | if (/^[ \t\n]/.test(input.charAt(pos.offset))) { | ||
+ | result1 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[ \\t\\n]"); | ||
+ | } | ||
+ | } | ||
+ | if (result1 !== null) { | ||
+ | result0 = []; | ||
+ | while (result1 !== null) { | ||
+ | result0.push(result1); | ||
+ | if (/^[ \t\n]/.test(input.charAt(pos.offset))) { | ||
+ | result1 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result1 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[ \\t\\n]"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
+ | return result0; | ||
+ | } | ||
+ | |||
+ | function parse_String() { | ||
+ | var cacheKey = "String@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2; | ||
+ | var pos0, pos1; | ||
+ | |||
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.charCodeAt(pos.offset) === 39) { | ||
+ | result0 = "'"; | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"'\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = []; | ||
+ | result2 = parse_SingleStringChar(); | ||
+ | while (result2 !== null) { | ||
+ | result1.push(result2); | ||
+ | result2 = parse_SingleStringChar(); | ||
+ | } | ||
+ | if (result1 !== null) { | ||
+ | if (input.charCodeAt(pos.offset) === 39) { | ||
+ | result2 = "'"; | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result2 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"'\""); | ||
+ | } | ||
+ | } | ||
+ | if (result2 !== null) { | ||
+ | result0 = [result0, result1, result2]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, s) { return s.join("");})(pos0.offset, pos0.line, pos0.column, result0[1]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | pos1 = clone(pos); | ||
+ | if (input.charCodeAt(pos.offset) === 34) { | ||
+ | result0 = "\""; | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"\\\"\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = []; | ||
+ | result2 = parse_DoubleStringChar(); | ||
+ | while (result2 !== null) { | ||
+ | result1.push(result2); | ||
+ | result2 = parse_DoubleStringChar(); | ||
+ | } | ||
+ | if (result1 !== null) { | ||
+ | if (input.charCodeAt(pos.offset) === 34) { | ||
+ | result2 = "\""; | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result2 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"\\\"\""); | ||
+ | } | ||
+ | } | ||
+ | if (result2 !== null) { | ||
+ | result0 = [result0, result1, result2]; | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | pos = clone(pos1); | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column, s) { return s.join("");})(pos0.offset, pos0.line, pos0.column, result0[1]); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
+ | return result0; | ||
+ | } | ||
+ | |||
+ | function parse_SingleStringChar() { | ||
+ | var cacheKey = "SingleStringChar@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0; | ||
+ | |||
+ | result0 = parse_EscapeSequence(); | ||
+ | if (result0 === null) { | ||
+ | if (/^[^']/.test(input.charAt(pos.offset))) { | ||
+ | result0 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[^']"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
+ | return result0; | ||
+ | } | ||
+ | |||
+ | function parse_DoubleStringChar() { | ||
+ | var cacheKey = "DoubleStringChar@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0; | ||
+ | |||
+ | result0 = parse_EscapeSequence(); | ||
+ | if (result0 === null) { | ||
+ | if (/^[^"]/.test(input.charAt(pos.offset))) { | ||
+ | result0 = input.charAt(pos.offset); | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("[^\"]"); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
+ | return result0; | ||
+ | } | ||
+ | |||
+ | function parse_EscapeSequence() { | ||
+ | var cacheKey = "EscapeSequence@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0; | ||
+ | var pos0; | ||
+ | |||
+ | pos0 = clone(pos); | ||
+ | if (input.substr(pos.offset, 2) === "\\n") { | ||
+ | result0 = "\\n"; | ||
+ | advance(pos, 2); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"\\\\n\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column) {return "\n";})(pos0.offset, pos0.line, pos0.column); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | if (input.substr(pos.offset, 2) === "\\\"") { | ||
+ | result0 = "\\\""; | ||
+ | advance(pos, 2); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"\\\\\\\"\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column) {return '"';})(pos0.offset, pos0.line, pos0.column); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos0 = clone(pos); | ||
+ | if (input.substr(pos.offset, 2) === "\\'") { | ||
+ | result0 = "\\'"; | ||
+ | advance(pos, 2); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"\\\\'\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result0 = (function(offset, line, column) {return "'";})(pos0.offset, pos0.line, pos0.column); | ||
+ | } | ||
+ | if (result0 === null) { | ||
+ | pos = clone(pos0); | ||
+ | } | ||
+ | } | ||
+ | } | ||
+ | |||
+ | cache[cacheKey] = { | ||
+ | nextPos: clone(pos), | ||
+ | result: result0 | ||
+ | }; | ||
+ | return result0; | ||
+ | } | ||
+ | |||
+ | function parse_End() { | ||
+ | var cacheKey = "End@" + pos.offset; | ||
+ | var cachedResult = cache[cacheKey]; | ||
+ | if (cachedResult) { | ||
+ | pos = clone(cachedResult.nextPos); | ||
+ | return cachedResult.result; | ||
+ | } | ||
+ | |||
+ | var result0, result1, result2, result3; | ||
+ | var pos0; | ||
+ | |||
+ | pos0 = clone(pos); | ||
+ | if (input.substr(pos.offset, 3) === "end") { | ||
+ | result0 = "end"; | ||
+ | advance(pos, 3); | ||
+ | } else { | ||
+ | result0 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\"end\""); | ||
+ | } | ||
+ | } | ||
+ | if (result0 !== null) { | ||
+ | result1 = parse_S(); | ||
+ | result1 = result1 !== null ? result1 : ""; | ||
+ | if (result1 !== null) { | ||
+ | if (input.charCodeAt(pos.offset) === 46) { | ||
+ | result2 = "."; | ||
+ | advance(pos, 1); | ||
+ | } else { | ||
+ | result2 = null; | ||
+ | if (reportFailures === 0) { | ||
+ | matchFailed("\".\""); | ||
+ | } | ||
+ | } | ||
+ | if (result2 !== null) { | ||
+ | result3 = parse_S(); | ||
+ | result3 = result3 !== null ? result3 : ""; | ||
+ | if (result3 !== null) { | ||
+ | result0 = [result0, result1, result2, result3]; | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos0); |
} | } | ||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | pos = | + | pos = clone(pos0); |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | + | pos = clone(pos0); | |
− | |||
− | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} else { | } else { | ||
result0 = null; | result0 = null; | ||
− | + | pos = clone(pos0); | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | pos = | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | + | cache[cacheKey] = { | |
− | + | nextPos: clone(pos), | |
− | + | result: result0 | |
− | + | }; | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | } | ||
− | |||
− | |||
− | |||
return result0; | return result0; | ||
} | } | ||
Zeile 2.689: | Zeile 3.861: | ||
} | } | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
Zeile 2.729: | Zeile 3.871: | ||
* | * | ||
* - |result !== null| | * - |result !== null| | ||
− | * - |pos === input.length| | + | * - |pos.offset === input.length| |
* - |rightmostFailuresExpected| may or may not contain something | * - |rightmostFailuresExpected| may or may not contain something | ||
* | * | ||
Zeile 2.735: | Zeile 3.877: | ||
* | * | ||
* - |result !== null| | * - |result !== null| | ||
− | * - |pos < input.length| | + | * - |pos.offset < input.length| |
* - |rightmostFailuresExpected| may or may not contain something | * - |rightmostFailuresExpected| may or may not contain something | ||
* | * | ||
Zeile 2.741: | Zeile 3.883: | ||
* | * | ||
* - |result === null| | * - |result === null| | ||
− | * - |pos === 0| | + | * - |pos.offset === 0| |
* - |rightmostFailuresExpected| contains at least one failure | * - |rightmostFailuresExpected| contains at least one failure | ||
* | * | ||
Zeile 2.747: | Zeile 3.889: | ||
* handle these states. | * handle these states. | ||
*/ | */ | ||
− | if (result === null || pos !== input.length) { | + | if (result === null || pos.offset !== input.length) { |
− | var offset = Math.max(pos, rightmostFailuresPos); | + | var offset = Math.max(pos.offset, rightmostFailuresPos.offset); |
var found = offset < input.length ? input.charAt(offset) : null; | var found = offset < input.length ? input.charAt(offset) : null; | ||
− | var errorPosition = | + | var errorPosition = pos.offset > rightmostFailuresPos.offset ? pos : rightmostFailuresPos; |
throw new this.SyntaxError( | throw new this.SyntaxError( |
Aktuelle Version vom 22. Juli 2015, 22:05 Uhr
if (window.a2 === undefined)
window.a2 = {};
a2.parser = (function(){
/*
* Generated by PEG.js 0.7.0.
*
* http://pegjs.majda.cz/
*/
function quote(s) {
/*
* ECMA-262, 5th ed., 7.8.4: All characters may appear literally in a
* string literal except for the closing quote character, backslash,
* carriage return, line separator, paragraph separator, and line feed.
* Any character may appear in the form of an escape sequence.
*
* For portability, we also escape escape all control and non-ASCII
* characters. Note that "\0" and "\v" escape sequences are not used
* because JSHint does not like the first and IE the second.
*/
return '"' + s
.replace(/\\/g, '\\\\') // backslash
.replace(/"/g, '\\"') // closing quote character
.replace(/\x08/g, '\\b') // backspace
.replace(/\t/g, '\\t') // horizontal tab
.replace(/\n/g, '\\n') // line feed
.replace(/\f/g, '\\f') // form feed
.replace(/\r/g, '\\r') // carriage return
.replace(/[\x00-\x07\x0B\x0E-\x1F\x80-\uFFFF]/g, escape)
+ '"';
}
var result = {
/*
* Parses the input with a generated parser. If the parsing is successfull,
* returns a value explicitly or implicitly specified by the grammar from
* which the parser was generated (see |PEG.buildParser|). If the parsing is
* unsuccessful, throws |PEG.parser.SyntaxError| describing the error.
*/
parse: function(input, startRule) {
var parseFunctions = {
"start": parse_start,
"Declaration": parse_Declaration,
"EventDec": parse_EventDec,
"TriggerClause": parse_TriggerClause,
"TriggerFunctions": parse_TriggerFunctions,
"TriggerFunction": parse_TriggerFunction,
"TriggerPageOrVirtOp": parse_TriggerPageOrVirtOp,
"TriggerItemOrVirtOp": parse_TriggerItemOrVirtOp,
"ConditionClause": parse_ConditionClause,
"ConditionFunction": parse_ConditionFunction,
"ConditionArgs": parse_ConditionArgs,
"ActionClause": parse_ActionClause,
"ActionFunctions": parse_ActionFunctions,
"ActionFunction": parse_ActionFunction,
"Channel": parse_Channel,
"PageDec": parse_PageDec,
"PageVirtualClause": parse_PageVirtualClause,
"PageVirtualList": parse_PageVirtualList,
"ItemDec": parse_ItemDec,
"TitleClause": parse_TitleClause,
"ItemVirtualClause": parse_ItemVirtualClause,
"ItemVirtualList": parse_ItemVirtualList,
"StringKwArgClause": parse_StringKwArgClause,
"StringKwArg": parse_StringKwArg,
"L": parse_L,
"R": parse_R,
"C": parse_C,
"CC": parse_CC,
"Identifier": parse_Identifier,
"PageVirtual": parse_PageVirtual,
"ItemVirtual": parse_ItemVirtual,
"Page": parse_Page,
"Time": parse_Time,
"Overlay": parse_Overlay,
"S": parse_S,
"String": parse_String,
"SingleStringChar": parse_SingleStringChar,
"DoubleStringChar": parse_DoubleStringChar,
"EscapeSequence": parse_EscapeSequence,
"End": parse_End
};
if (startRule !== undefined) {
if (parseFunctions[startRule] === undefined) {
throw new Error("Invalid rule name: " + quote(startRule) + ".");
}
} else {
startRule = "start";
}
var pos = { offset: 0, line: 1, column: 1, seenCR: false };
var reportFailures = 0;
var rightmostFailuresPos = { offset: 0, line: 1, column: 1, seenCR: false };
var rightmostFailuresExpected = [];
var cache = {};
function padLeft(input, padding, length) {
var result = input;
var padLength = length - input.length;
for (var i = 0; i < padLength; i++) {
result = padding + result;
}
return result;
}
function escape(ch) {
var charCode = ch.charCodeAt(0);
var escapeChar;
var length;
if (charCode <= 0xFF) {
escapeChar = 'x';
length = 2;
} else {
escapeChar = 'u';
length = 4;
}
return '\\' + escapeChar + padLeft(charCode.toString(16).toUpperCase(), '0', length);
}
function clone(object) {
var result = {};
for (var key in object) {
result[key] = object[key];
}
return result;
}
function advance(pos, n) {
var endOffset = pos.offset + n;
for (var offset = pos.offset; offset < endOffset; offset++) {
var ch = input.charAt(offset);
if (ch === "\n") {
if (!pos.seenCR) { pos.line++; }
pos.column = 1;
pos.seenCR = false;
} else if (ch === "\r" || ch === "\u2028" || ch === "\u2029") {
pos.line++;
pos.column = 1;
pos.seenCR = true;
} else {
pos.column++;
pos.seenCR = false;
}
}
pos.offset += n;
}
function matchFailed(failure) {
if (pos.offset < rightmostFailuresPos.offset) {
return;
}
if (pos.offset > rightmostFailuresPos.offset) {
rightmostFailuresPos = clone(pos);
rightmostFailuresExpected = [];
}
rightmostFailuresExpected.push(failure);
}
function parse_start() {
var cacheKey = "start@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_S();
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
result1 = [];
result2 = parse_Declaration();
while (result2 !== null) {
result1.push(result2);
result2 = parse_Declaration();
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, d) {return d;})(pos0.offset, pos0.line, pos0.column, result0[1]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_Declaration() {
var cacheKey = "Declaration@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0;
result0 = parse_EventDec();
if (result0 === null) {
result0 = parse_PageDec();
if (result0 === null) {
result0 = parse_ItemDec();
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_EventDec() {
var cacheKey = "EventDec@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3, result4, result5, result6, result7, result8;
var pos0, pos1, pos2;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_S();
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
if (input.substr(pos.offset, 5) === "event") {
result1 = "event";
advance(pos, 5);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"event\"");
}
}
if (result1 !== null) {
pos2 = clone(pos);
result2 = parse_S();
if (result2 !== null) {
result3 = parse_Identifier();
if (result3 !== null) {
result2 = [result2, result3];
} else {
result2 = null;
pos = clone(pos2);
}
} else {
result2 = null;
pos = clone(pos2);
}
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_CC();
if (result3 !== null) {
result4 = parse_TriggerClause();
if (result4 !== null) {
result5 = parse_ConditionClause();
result5 = result5 !== null ? result5 : "";
if (result5 !== null) {
result6 = parse_ActionClause();
result6 = result6 !== null ? result6 : "";
if (result6 !== null) {
result7 = parse_End();
if (result7 !== null) {
result8 = parse_S();
result8 = result8 !== null ? result8 : "";
if (result8 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6, result7, result8];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, n, tr, co, ac) { return ["event", {name:n?n[1]:":anonymous:", trigger:tr, condition:(co?co:function(){return true;}), action:(ac?ac:function(){return true;})}]; })(pos0.offset, pos0.line, pos0.column, result0[2], result0[4], result0[5], result0[6]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_TriggerClause() {
var cacheKey = "TriggerClause@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 2) === "on") {
result0 = "on";
advance(pos, 2);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"on\"");
}
}
if (result0 !== null) {
result1 = parse_S();
if (result1 !== null) {
result2 = parse_S();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_TriggerFunctions();
if (result3 !== null) {
result4 = parse_CC();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, tr) {return tr;})(pos0.offset, pos0.line, pos0.column, result0[3]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_TriggerFunctions() {
var cacheKey = "TriggerFunctions@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_TriggerFunction();
if (result0 !== null) {
result1 = parse_C();
if (result1 !== null) {
result2 = parse_TriggerFunctions();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, t, o) {o.push(t); return o;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
result0 = parse_TriggerFunction();
if (result0 !== null) {
result0 = (function(offset, line, column, t) {return [t];})(pos0.offset, pos0.line, pos0.column, result0);
}
if (result0 === null) {
pos = clone(pos0);
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_TriggerFunction() {
var cacheKey = "TriggerFunction@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3, result4, result5;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_TriggerPageOrVirtOp();
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Page();
if (result2 === null) {
result2 = parse_PageVirtual();
}
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, t, a) {return t+"."+a;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_TriggerItemOrVirtOp();
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Identifier();
if (result2 === null) {
result2 = parse_ItemVirtual();
}
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, t, a) {return t+"."+a;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 5) === "click") {
result0 = "click";
advance(pos, 5);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"click\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Identifier();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, t, a) {return t+"."+a;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 7) === "combine") {
result0 = "combine";
advance(pos, 7);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"combine\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Identifier();
if (result2 === null) {
result2 = parse_ItemVirtual();
}
if (result2 !== null) {
result3 = parse_C();
if (result3 !== null) {
result4 = parse_Identifier();
if (result4 === null) {
result4 = parse_ItemVirtual();
}
if (result4 !== null) {
result5 = parse_R();
if (result5 !== null) {
result0 = [result0, result1, result2, result3, result4, result5];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, t, a, b) {return [t,a,b].join(".")})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2], result0[4]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 5) === "apply") {
result0 = "apply";
advance(pos, 5);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"apply\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Identifier();
if (result2 === null) {
result2 = parse_ItemVirtual();
}
if (result2 !== null) {
result3 = parse_C();
if (result3 !== null) {
result4 = parse_Identifier();
if (result4 !== null) {
result5 = parse_R();
if (result5 !== null) {
result0 = [result0, result1, result2, result3, result4, result5];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, t, a, b) {return [t,a,b].join(".")})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2], result0[4]);
}
if (result0 === null) {
pos = clone(pos0);
}
}
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_TriggerPageOrVirtOp() {
var cacheKey = "TriggerPageOrVirtOp@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0;
if (input.substr(pos.offset, 5) === "enter") {
result0 = "enter";
advance(pos, 5);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"enter\"");
}
}
if (result0 === null) {
if (input.substr(pos.offset, 5) === "leave") {
result0 = "leave";
advance(pos, 5);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"leave\"");
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_TriggerItemOrVirtOp() {
var cacheKey = "TriggerItemOrVirtOp@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0;
if (input.substr(pos.offset, 3) === "add") {
result0 = "add";
advance(pos, 3);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"add\"");
}
}
if (result0 === null) {
if (input.substr(pos.offset, 6) === "remove") {
result0 = "remove";
advance(pos, 6);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"remove\"");
}
}
if (result0 === null) {
if (input.substr(pos.offset, 8) === "activate") {
result0 = "activate";
advance(pos, 8);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"activate\"");
}
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ConditionClause() {
var cacheKey = "ConditionClause@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 2) === "if") {
result0 = "if";
advance(pos, 2);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"if\"");
}
}
if (result0 !== null) {
result1 = parse_S();
if (result1 !== null) {
result2 = parse_ConditionFunction();
if (result2 !== null) {
result3 = parse_CC();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, co) {return co;})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ConditionFunction() {
var cacheKey = "ConditionFunction@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 4) === "page") {
result0 = "page";
advance(pos, 4);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"page\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Page();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, p) {return function(){return a2.cpage == p};})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 3) === "any") {
result0 = "any";
advance(pos, 3);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"any\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_ConditionArgs();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, a) {return function(){for(var j=0; j<a.length; j++) if (a[j]()) return true; return false; }})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 3) === "all") {
result0 = "all";
advance(pos, 3);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"all\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_ConditionArgs();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, a) {return function(){for(var j=0; j<a.length; j++) if (!a[j]()) return false; return true; }})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 3) === "not") {
result0 = "not";
advance(pos, 3);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"not\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_ConditionFunction();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f) {return function(){ return !f()};})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 4) === "have") {
result0 = "have";
advance(pos, 4);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"have\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Identifier();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, i) {return function(){return !!a2.items[i]};})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 4) === "page") {
result0 = "page";
advance(pos, 4);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"page\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_PageVirtual();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, v) {return function(){return !!a2.util.hasVirtual(v);};})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 4) === "have") {
result0 = "have";
advance(pos, 4);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"have\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_ItemVirtual();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, v) {return function(){return !!a2.util.hasVirtual(v);};})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 7) === "visible") {
result0 = "visible";
advance(pos, 7);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"visible\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Overlay();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, o) {return function(){return $("#overlay_"+o+":visible").length;};})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 12) === "timeoutIsSet") {
result0 = "timeoutIsSet";
advance(pos, 12);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"timeoutIsSet\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_R();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column) {return function(){return a2.util.timeoutIsSet();};})(pos0.offset, pos0.line, pos0.column);
}
if (result0 === null) {
pos = clone(pos0);
}
}
}
}
}
}
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ConditionArgs() {
var cacheKey = "ConditionArgs@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_ConditionFunction();
if (result0 !== null) {
result1 = parse_C();
if (result1 !== null) {
result2 = parse_ConditionArgs();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, a) {a.push(f); return a;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
result0 = parse_ConditionFunction();
if (result0 !== null) {
result0 = (function(offset, line, column, f) {return [f];})(pos0.offset, pos0.line, pos0.column, result0);
}
if (result0 === null) {
pos = clone(pos0);
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ActionClause() {
var cacheKey = "ActionClause@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 2) === "do") {
result0 = "do";
advance(pos, 2);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"do\"");
}
}
if (result0 !== null) {
result1 = parse_S();
if (result1 !== null) {
result2 = parse_ActionFunctions();
if (result2 !== null) {
result3 = parse_CC();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, ac) {return ac;})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ActionFunctions() {
var cacheKey = "ActionFunctions@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_ActionFunction();
if (result0 !== null) {
result1 = parse_C();
if (result1 !== null) {
result2 = parse_ActionFunctions();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, a) {return function(real){f(real); a(real);};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
result0 = parse_ActionFunction();
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ActionFunction() {
var cacheKey = "ActionFunction@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3, result4, result5, result6;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 4) === "goto") {
result0 = "goto";
advance(pos, 4);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"goto\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Page();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, p) {return function(real){a2.util.goto(p)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 3) === "add") {
result0 = "add";
advance(pos, 3);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"add\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Identifier();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, i) {return function(real){a2.util.add(i)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 6) === "remove") {
result0 = "remove";
advance(pos, 6);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"remove\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Identifier();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, i) {return function(real){a2.util.remove(i)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 5) === "print") {
result0 = "print";
advance(pos, 5);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"print\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_String();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, s) {return function(real){a2.util.print(s)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 3) === "ask") {
result0 = "ask";
advance(pos, 3);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"ask\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_String();
if (result2 !== null) {
result3 = parse_C();
if (result3 !== null) {
result4 = parse_StringKwArgClause();
if (result4 !== null) {
result5 = parse_R();
if (result5 !== null) {
result0 = [result0, result1, result2, result3, result4, result5];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, s, c) {return function(real){a2.util.print(s,c);};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2], result0[4]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 12) === "clearTimeout") {
result0 = "clearTimeout";
advance(pos, 12);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"clearTimeout\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_R();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f) {return function(real){a2.timer.clear();};})(pos0.offset, pos0.line, pos0.column, result0[0]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 11) === "showOverlay") {
result0 = "showOverlay";
advance(pos, 11);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"showOverlay\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Overlay();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, o) {return function(real){ $("#overlay_"+o).show();};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 11) === "hideOverlay") {
result0 = "hideOverlay";
advance(pos, 11);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"hideOverlay\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Overlay();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, o) {return function(real){ $("#overlay_"+o).hide();};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 6) === "remove") {
result0 = "remove";
advance(pos, 6);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"remove\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_ItemVirtual();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, i) {return function(real){a2.util.removeAll(i)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 6) === "remove") {
result0 = "remove";
advance(pos, 6);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"remove\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
if (input.substr(pos.offset, 2) === "${") {
result2 = "${";
advance(pos, 2);
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"${\"");
}
}
if (result2 !== null) {
result3 = parse_TriggerItemOrVirtOp();
if (result3 === null) {
if (input.substr(pos.offset, 7) === "combine") {
result3 = "combine";
advance(pos, 7);
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\"combine\"");
}
}
if (result3 === null) {
if (input.substr(pos.offset, 5) === "apply") {
result3 = "apply";
advance(pos, 5);
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\"apply\"");
}
}
}
}
if (result3 !== null) {
if (/^[12]/.test(input.charAt(pos.offset))) {
result4 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("[12]");
}
}
if (result4 !== null) {
if (input.charCodeAt(pos.offset) === 125) {
result5 = "}";
advance(pos, 1);
} else {
result5 = null;
if (reportFailures === 0) {
matchFailed("\"}\"");
}
}
if (result5 !== null) {
result6 = parse_R();
if (result6 !== null) {
result0 = [result0, result1, result2, result3, result4, result5, result6];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, rt, rn) {return function(real){if (rt == real[0] && a2.virtualTriggerMap[rt] && a2.virtualTriggerMap[rt][parseInt(rn)-1]) a2.util.remove(real[parseInt(rn)]);};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[3], result0[4]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 10) === "setTimeout") {
result0 = "setTimeout";
advance(pos, 10);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"setTimeout\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Time();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result4 = parse_C();
if (result4 !== null) {
result5 = parse_ActionFunctions();
if (result5 !== null) {
result0 = [result0, result1, result2, result3, result4, result5];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, t, a) {return function(real){a2.timer.set(t, function(){a(real)});};})(pos0.offset, pos0.line, pos0.column, result0[2], result0[5]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 4) === "play") {
result0 = "play";
advance(pos, 4);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"play\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Channel();
if (result2 !== null) {
result3 = parse_C();
if (result3 !== null) {
result4 = parse_String();
if (result4 !== null) {
result5 = parse_R();
if (result5 !== null) {
result0 = [result0, result1, result2, result3, result4, result5];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, chan, file) {return function(real){a2.audio.play(chan, file)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2], result0[4]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 4) === "stop") {
result0 = "stop";
advance(pos, 4);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"stop\"");
}
}
if (result0 !== null) {
result1 = parse_L();
if (result1 !== null) {
result2 = parse_Channel();
if (result2 !== null) {
result3 = parse_R();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, f, chan) {return function(real){a2.audio.stop(chan)};})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
}
}
}
}
}
}
}
}
}
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_Channel() {
var cacheKey = "Channel@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0;
var pos0;
pos0 = clone(pos);
if (input.substr(pos.offset, 5) === "music") {
result0 = "music";
advance(pos, 5);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"music\"");
}
}
if (result0 !== null) {
result0 = (function(offset, line, column) {return "music";})(pos0.offset, pos0.line, pos0.column);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
if (input.substr(pos.offset, 5) === "noise") {
result0 = "noise";
advance(pos, 5);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"noise\"");
}
}
if (result0 !== null) {
result0 = (function(offset, line, column) {return "noise";})(pos0.offset, pos0.line, pos0.column);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
if (input.substr(pos.offset, 10) === "background") {
result0 = "background";
advance(pos, 10);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"background\"");
}
}
if (result0 !== null) {
result0 = (function(offset, line, column) {return "background";})(pos0.offset, pos0.line, pos0.column);
}
if (result0 === null) {
pos = clone(pos0);
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_PageDec() {
var cacheKey = "PageDec@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 4) === "page") {
result0 = "page";
advance(pos, 4);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"page\"");
}
}
if (result0 !== null) {
result1 = parse_CC();
if (result1 !== null) {
result2 = parse_PageVirtualClause();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_End();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, pv) {return ["page", {virt:pv}];})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_PageVirtualClause() {
var cacheKey = "PageVirtualClause@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 8) === "provides") {
result0 = "provides";
advance(pos, 8);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"provides\"");
}
}
if (result0 !== null) {
result1 = parse_S();
if (result1 !== null) {
result2 = parse_PageVirtualList();
if (result2 !== null) {
result3 = parse_CC();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, v) {return v;})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_PageVirtualList() {
var cacheKey = "PageVirtualList@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_PageVirtual();
if (result0 !== null) {
result1 = parse_C();
if (result1 !== null) {
result2 = parse_PageVirtualList();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, v, vl) {vl.push(v); return vl;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
result0 = parse_PageVirtual();
if (result0 !== null) {
result0 = (function(offset, line, column, v) {return [v];})(pos0.offset, pos0.line, pos0.column, result0);
}
if (result0 === null) {
pos = clone(pos0);
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ItemDec() {
var cacheKey = "ItemDec@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 4) === "item") {
result0 = "item";
advance(pos, 4);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"item\"");
}
}
if (result0 !== null) {
result1 = parse_CC();
if (result1 !== null) {
result2 = parse_TitleClause();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result3 = parse_ItemVirtualClause();
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result4 = parse_End();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, t, iv) {return ["item", {virt:iv, title:t}];})(pos0.offset, pos0.line, pos0.column, result0[2], result0[3]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_TitleClause() {
var cacheKey = "TitleClause@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 5) === "title") {
result0 = "title";
advance(pos, 5);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"title\"");
}
}
if (result0 !== null) {
result1 = parse_S();
if (result1 !== null) {
result2 = parse_String();
if (result2 !== null) {
result3 = parse_CC();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, s) {return s;})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ItemVirtualClause() {
var cacheKey = "ItemVirtualClause@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.substr(pos.offset, 8) === "provides") {
result0 = "provides";
advance(pos, 8);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"provides\"");
}
}
if (result0 !== null) {
result1 = parse_S();
if (result1 !== null) {
result2 = parse_ItemVirtualList();
if (result2 !== null) {
result3 = parse_CC();
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, v) {return v;})(pos0.offset, pos0.line, pos0.column, result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ItemVirtualList() {
var cacheKey = "ItemVirtualList@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_ItemVirtual();
if (result0 !== null) {
result1 = parse_C();
if (result1 !== null) {
result2 = parse_ItemVirtualList();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, v, vl) {vl.push(v); return vl;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
result0 = parse_ItemVirtual();
if (result0 !== null) {
result0 = (function(offset, line, column, v) {return [v];})(pos0.offset, pos0.line, pos0.column, result0);
}
if (result0 === null) {
pos = clone(pos0);
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_StringKwArgClause() {
var cacheKey = "StringKwArgClause@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_StringKwArg();
if (result0 !== null) {
result1 = parse_C();
if (result1 !== null) {
result2 = parse_StringKwArgClause();
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, k, r) {return [k].concat(r); })(pos0.offset, pos0.line, pos0.column, result0[0], result0[2]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
result0 = parse_StringKwArg();
if (result0 !== null) {
result0 = (function(offset, line, column, k) { return [k]; })(pos0.offset, pos0.line, pos0.column, result0);
}
if (result0 === null) {
pos = clone(pos0);
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_StringKwArg() {
var cacheKey = "StringKwArg@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
result0 = parse_Identifier();
if (result0 !== null) {
result1 = parse_S();
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
if (input.charCodeAt(pos.offset) === 61) {
result2 = "=";
advance(pos, 1);
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"=\"");
}
}
if (result2 !== null) {
result3 = parse_S();
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result4 = parse_String();
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, i, s) {return [i,s];})(pos0.offset, pos0.line, pos0.column, result0[0], result0[4]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_L() {
var cacheKey = "L@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0;
pos0 = clone(pos);
result0 = parse_S();
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
if (input.charCodeAt(pos.offset) === 40) {
result1 = "(";
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"(\"");
}
}
if (result1 !== null) {
result2 = parse_S();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_R() {
var cacheKey = "R@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0;
pos0 = clone(pos);
result0 = parse_S();
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
if (input.charCodeAt(pos.offset) === 41) {
result1 = ")";
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\")\"");
}
}
if (result1 !== null) {
result2 = parse_S();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_C() {
var cacheKey = "C@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0;
pos0 = clone(pos);
result0 = parse_S();
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
if (input.charCodeAt(pos.offset) === 44) {
result1 = ",";
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\",\"");
}
}
if (result1 !== null) {
result2 = parse_S();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_CC() {
var cacheKey = "CC@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0;
pos0 = clone(pos);
result0 = parse_S();
result0 = result0 !== null ? result0 : "";
if (result0 !== null) {
if (input.charCodeAt(pos.offset) === 59) {
result1 = ";";
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\";\"");
}
}
if (result1 !== null) {
result2 = parse_S();
result2 = result2 !== null ? result2 : "";
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_Identifier() {
var cacheKey = "Identifier@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (/^[a-z\xE4\xF6\xFC_]/.test(input.charAt(pos.offset))) {
result0 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[a-z\\xE4\\xF6\\xFC_]");
}
}
if (result0 !== null) {
result1 = [];
if (/^[a-z\xE4\xF6\xFC_]/.test(input.charAt(pos.offset))) {
result2 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("[a-z\\xE4\\xF6\\xFC_]");
}
}
while (result2 !== null) {
result1.push(result2);
if (/^[a-z\xE4\xF6\xFC_]/.test(input.charAt(pos.offset))) {
result2 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("[a-z\\xE4\\xF6\\xFC_]");
}
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, i1, i2) {return i1+i2.join("");})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_PageVirtual() {
var cacheKey = "PageVirtual@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.charCodeAt(pos.offset) === 64) {
result0 = "@";
advance(pos, 1);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"@\"");
}
}
if (result0 !== null) {
result1 = parse_Identifier();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, p, i) {return p+i;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_ItemVirtual() {
var cacheKey = "ItemVirtual@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.charCodeAt(pos.offset) === 58) {
result0 = ":";
advance(pos, 1);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\":\"");
}
}
if (result0 !== null) {
result1 = parse_Identifier();
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, p, i) {return p+i;})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_Page() {
var cacheKey = "Page@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1;
var pos0;
pos0 = clone(pos);
if (/^[0-9]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[0-9]");
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
if (/^[0-9]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[0-9]");
}
}
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset, line, column, p) {return p.join("");})(pos0.offset, pos0.line, pos0.column, result0);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_Time() {
var cacheKey = "Time@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (/^[1-9]/.test(input.charAt(pos.offset))) {
result0 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[1-9]");
}
}
if (result0 !== null) {
result1 = [];
if (/^[0-9]/.test(input.charAt(pos.offset))) {
result2 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("[0-9]");
}
}
while (result2 !== null) {
result1.push(result2);
if (/^[0-9]/.test(input.charAt(pos.offset))) {
result2 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("[0-9]");
}
}
}
if (result1 !== null) {
result0 = [result0, result1];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, p, q) {return parseInt(p+q.join(""));})(pos0.offset, pos0.line, pos0.column, result0[0], result0[1]);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_Overlay() {
var cacheKey = "Overlay@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1;
var pos0;
pos0 = clone(pos);
if (/^[a-z]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[a-z]");
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
if (/^[a-z]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[a-z]");
}
}
}
} else {
result0 = null;
}
if (result0 !== null) {
result0 = (function(offset, line, column, p) {return p.join("");})(pos0.offset, pos0.line, pos0.column, result0);
}
if (result0 === null) {
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_S() {
var cacheKey = "S@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3, result4;
var pos0, pos1;
pos0 = clone(pos);
result0 = [];
if (/^[ \t\n]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[ \\t\\n]");
}
}
while (result1 !== null) {
result0.push(result1);
if (/^[ \t\n]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[ \\t\\n]");
}
}
}
if (result0 !== null) {
if (input.substr(pos.offset, 2) === "/*") {
result1 = "/*";
advance(pos, 2);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"/*\"");
}
}
if (result1 !== null) {
result2 = [];
if (/^[^*]/.test(input.charAt(pos.offset))) {
result3 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[^*]");
}
}
if (result3 === null) {
pos1 = clone(pos);
if (/^[*]/.test(input.charAt(pos.offset))) {
result3 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[*]");
}
}
if (result3 !== null) {
if (/^[^\/]/.test(input.charAt(pos.offset))) {
result4 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("[^\\/]");
}
}
if (result4 !== null) {
result3 = [result3, result4];
} else {
result3 = null;
pos = clone(pos1);
}
} else {
result3 = null;
pos = clone(pos1);
}
}
while (result3 !== null) {
result2.push(result3);
if (/^[^*]/.test(input.charAt(pos.offset))) {
result3 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[^*]");
}
}
if (result3 === null) {
pos1 = clone(pos);
if (/^[*]/.test(input.charAt(pos.offset))) {
result3 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[*]");
}
}
if (result3 !== null) {
if (/^[^\/]/.test(input.charAt(pos.offset))) {
result4 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result4 = null;
if (reportFailures === 0) {
matchFailed("[^\\/]");
}
}
if (result4 !== null) {
result3 = [result3, result4];
} else {
result3 = null;
pos = clone(pos1);
}
} else {
result3 = null;
pos = clone(pos1);
}
}
}
if (result2 !== null) {
if (input.substr(pos.offset, 2) === "*/") {
result3 = "*/";
advance(pos, 2);
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("\"*/\"");
}
}
if (result3 !== null) {
result4 = parse_S();
result4 = result4 !== null ? result4 : "";
if (result4 !== null) {
result0 = [result0, result1, result2, result3, result4];
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
result0 = [];
if (/^[ \t\n]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[ \\t\\n]");
}
}
while (result1 !== null) {
result0.push(result1);
if (/^[ \t\n]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[ \\t\\n]");
}
}
}
if (result0 !== null) {
if (input.substr(pos.offset, 2) === "//") {
result1 = "//";
advance(pos, 2);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("\"//\"");
}
}
if (result1 !== null) {
result2 = [];
if (/^[^\n]/.test(input.charAt(pos.offset))) {
result3 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[^\\n]");
}
}
while (result3 !== null) {
result2.push(result3);
if (/^[^\n]/.test(input.charAt(pos.offset))) {
result3 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result3 = null;
if (reportFailures === 0) {
matchFailed("[^\\n]");
}
}
}
if (result2 !== null) {
result3 = parse_S();
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
if (result0 === null) {
if (/^[ \t\n]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[ \\t\\n]");
}
}
if (result1 !== null) {
result0 = [];
while (result1 !== null) {
result0.push(result1);
if (/^[ \t\n]/.test(input.charAt(pos.offset))) {
result1 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result1 = null;
if (reportFailures === 0) {
matchFailed("[ \\t\\n]");
}
}
}
} else {
result0 = null;
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_String() {
var cacheKey = "String@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2;
var pos0, pos1;
pos0 = clone(pos);
pos1 = clone(pos);
if (input.charCodeAt(pos.offset) === 39) {
result0 = "'";
advance(pos, 1);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result0 !== null) {
result1 = [];
result2 = parse_SingleStringChar();
while (result2 !== null) {
result1.push(result2);
result2 = parse_SingleStringChar();
}
if (result1 !== null) {
if (input.charCodeAt(pos.offset) === 39) {
result2 = "'";
advance(pos, 1);
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"'\"");
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, s) { return s.join("");})(pos0.offset, pos0.line, pos0.column, result0[1]);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
pos1 = clone(pos);
if (input.charCodeAt(pos.offset) === 34) {
result0 = "\"";
advance(pos, 1);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"\\\"\"");
}
}
if (result0 !== null) {
result1 = [];
result2 = parse_DoubleStringChar();
while (result2 !== null) {
result1.push(result2);
result2 = parse_DoubleStringChar();
}
if (result1 !== null) {
if (input.charCodeAt(pos.offset) === 34) {
result2 = "\"";
advance(pos, 1);
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\"\\\"\"");
}
}
if (result2 !== null) {
result0 = [result0, result1, result2];
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
} else {
result0 = null;
pos = clone(pos1);
}
if (result0 !== null) {
result0 = (function(offset, line, column, s) { return s.join("");})(pos0.offset, pos0.line, pos0.column, result0[1]);
}
if (result0 === null) {
pos = clone(pos0);
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_SingleStringChar() {
var cacheKey = "SingleStringChar@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0;
result0 = parse_EscapeSequence();
if (result0 === null) {
if (/^[^']/.test(input.charAt(pos.offset))) {
result0 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[^']");
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_DoubleStringChar() {
var cacheKey = "DoubleStringChar@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0;
result0 = parse_EscapeSequence();
if (result0 === null) {
if (/^[^"]/.test(input.charAt(pos.offset))) {
result0 = input.charAt(pos.offset);
advance(pos, 1);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("[^\"]");
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_EscapeSequence() {
var cacheKey = "EscapeSequence@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0;
var pos0;
pos0 = clone(pos);
if (input.substr(pos.offset, 2) === "\\n") {
result0 = "\\n";
advance(pos, 2);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"\\\\n\"");
}
}
if (result0 !== null) {
result0 = (function(offset, line, column) {return "\n";})(pos0.offset, pos0.line, pos0.column);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
if (input.substr(pos.offset, 2) === "\\\"") {
result0 = "\\\"";
advance(pos, 2);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"\\\\\\\"\"");
}
}
if (result0 !== null) {
result0 = (function(offset, line, column) {return '"';})(pos0.offset, pos0.line, pos0.column);
}
if (result0 === null) {
pos = clone(pos0);
}
if (result0 === null) {
pos0 = clone(pos);
if (input.substr(pos.offset, 2) === "\\'") {
result0 = "\\'";
advance(pos, 2);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"\\\\'\"");
}
}
if (result0 !== null) {
result0 = (function(offset, line, column) {return "'";})(pos0.offset, pos0.line, pos0.column);
}
if (result0 === null) {
pos = clone(pos0);
}
}
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function parse_End() {
var cacheKey = "End@" + pos.offset;
var cachedResult = cache[cacheKey];
if (cachedResult) {
pos = clone(cachedResult.nextPos);
return cachedResult.result;
}
var result0, result1, result2, result3;
var pos0;
pos0 = clone(pos);
if (input.substr(pos.offset, 3) === "end") {
result0 = "end";
advance(pos, 3);
} else {
result0 = null;
if (reportFailures === 0) {
matchFailed("\"end\"");
}
}
if (result0 !== null) {
result1 = parse_S();
result1 = result1 !== null ? result1 : "";
if (result1 !== null) {
if (input.charCodeAt(pos.offset) === 46) {
result2 = ".";
advance(pos, 1);
} else {
result2 = null;
if (reportFailures === 0) {
matchFailed("\".\"");
}
}
if (result2 !== null) {
result3 = parse_S();
result3 = result3 !== null ? result3 : "";
if (result3 !== null) {
result0 = [result0, result1, result2, result3];
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
} else {
result0 = null;
pos = clone(pos0);
}
cache[cacheKey] = {
nextPos: clone(pos),
result: result0
};
return result0;
}
function cleanupExpected(expected) {
expected.sort();
var lastExpected = null;
var cleanExpected = [];
for (var i = 0; i < expected.length; i++) {
if (expected[i] !== lastExpected) {
cleanExpected.push(expected[i]);
lastExpected = expected[i];
}
}
return cleanExpected;
}
var result = parseFunctions[startRule]();
/*
* The parser is now in one of the following three states:
*
* 1. The parser successfully parsed the whole input.
*
* - |result !== null|
* - |pos.offset === input.length|
* - |rightmostFailuresExpected| may or may not contain something
*
* 2. The parser successfully parsed only a part of the input.
*
* - |result !== null|
* - |pos.offset < input.length|
* - |rightmostFailuresExpected| may or may not contain something
*
* 3. The parser did not successfully parse any part of the input.
*
* - |result === null|
* - |pos.offset === 0|
* - |rightmostFailuresExpected| contains at least one failure
*
* All code following this comment (including called functions) must
* handle these states.
*/
if (result === null || pos.offset !== input.length) {
var offset = Math.max(pos.offset, rightmostFailuresPos.offset);
var found = offset < input.length ? input.charAt(offset) : null;
var errorPosition = pos.offset > rightmostFailuresPos.offset ? pos : rightmostFailuresPos;
throw new this.SyntaxError(
cleanupExpected(rightmostFailuresExpected),
found,
offset,
errorPosition.line,
errorPosition.column
);
}
return result;
},
/* Returns the parser source code. */
toSource: function() { return this._source; }
};
/* Thrown when a parser encounters a syntax error. */
result.SyntaxError = function(expected, found, offset, line, column) {
function buildMessage(expected, found) {
var expectedHumanized, foundHumanized;
switch (expected.length) {
case 0:
expectedHumanized = "end of input";
break;
case 1:
expectedHumanized = expected[0];
break;
default:
expectedHumanized = expected.slice(0, expected.length - 1).join(", ")
+ " or "
+ expected[expected.length - 1];
}
foundHumanized = found ? quote(found) : "end of input";
return "Expected " + expectedHumanized + " but " + foundHumanized + " found.";
}
this.name = "SyntaxError";
this.expected = expected;
this.found = found;
this.message = buildMessage(expected, found);
this.offset = offset;
this.line = line;
this.column = column;
};
result.SyntaxError.prototype = Error.prototype;
return result;
})();