opExecute = function opExecuteFunc(opIndex, phraseIndex, sysData) {
let ret = true;
const op = opcodes[opIndex];
nodeHits += 1;
if (nodeHits > limitNodeHits) {
throw new Error(`parser: maximum number of node hits exceeded: ${limitNodeHits}`);
}
treeDepth += 1;
if (treeDepth > maxTreeDepth) {
maxTreeDepth = treeDepth;
if (maxTreeDepth > limitTreeDepth) {
throw new Error(`parser: maximum parse tree depth exceeded: ${limitTreeDepth}`);
}
}
sysData.refresh();
if (thisThis.trace !== null) {
const lk = lookAroundValue();
thisThis.trace.down(op, sysData.state, phraseIndex, sysData.phraseLength, lk.anchor, lk.lookAround);
}
if (inLookBehind()) {
switch (op.type) {
case id.ALT:
opALT(opIndex, phraseIndex, sysData);
break;
case id.CAT:
opCATBehind(opIndex, phraseIndex, sysData);
break;
case id.REP:
opREPBehind(opIndex, phraseIndex, sysData);
break;
case id.RNM:
opRNM(opIndex, phraseIndex, sysData);
break;
case id.UDT:
opUDT(opIndex, phraseIndex, sysData);
break;
case id.AND:
opAND(opIndex, phraseIndex, sysData);
break;
case id.NOT:
opNOT(opIndex, phraseIndex, sysData);
break;
case id.TRG:
opTRGBehind(opIndex, phraseIndex, sysData);
break;
case id.TBS:
opTBSBehind(opIndex, phraseIndex, sysData);
break;
case id.TLS:
opTLSBehind(opIndex, phraseIndex, sysData);
break;
case id.BKR:
opBKRBehind(opIndex, phraseIndex, sysData);
break;
case id.BKA:
opBKA(opIndex, phraseIndex, sysData);
break;
case id.BKN:
opBKN(opIndex, phraseIndex, sysData);
break;
case id.ABG:
opABG(opIndex, phraseIndex, sysData);
break;
case id.AEN:
opAEN(opIndex, phraseIndex, sysData);
break;
default:
ret = false;
break;
}
} else {
switch (op.type) {
case id.ALT:
opALT(opIndex, phraseIndex, sysData);
break;
case id.CAT:
opCAT(opIndex, phraseIndex, sysData);
break;
case id.REP:
opREP(opIndex, phraseIndex, sysData);
break;
case id.RNM:
opRNM(opIndex, phraseIndex, sysData);
break;
case id.UDT:
opUDT(opIndex, phraseIndex, sysData);
break;
case id.AND:
opAND(opIndex, phraseIndex, sysData);
break;
case id.NOT:
opNOT(opIndex, phraseIndex, sysData);
break;
case id.TRG:
opTRG(opIndex, phraseIndex, sysData);
break;
case id.TBS:
opTBS(opIndex, phraseIndex, sysData);
break;
case id.TLS:
opTLS(opIndex, phraseIndex, sysData);
break;
case id.BKR:
opBKR(opIndex, phraseIndex, sysData);
break;
case id.BKA:
opBKA(opIndex, phraseIndex, sysData);
break;
case id.BKN:
opBKN(opIndex, phraseIndex, sysData);
break;
case id.ABG:
opABG(opIndex, phraseIndex, sysData);
break;
case id.AEN:
opAEN(opIndex, phraseIndex, sysData);
break;
default:
ret = false;
break;
}
}
if (!inLookAround() && phraseIndex + sysData.phraseLength > maxMatched) {
maxMatched = phraseIndex + sysData.phraseLength;
}
if (thisThis.stats !== null) {
thisThis.stats.collect(op, sysData);
}
if (thisThis.trace !== null) {
const lk = lookAroundValue();
thisThis.trace.up(op, sysData.state, phraseIndex, sysData.phraseLength, lk.anchor, lk.lookAround);
}
treeDepth -= 1;
return ret;
};
};