parseActions method
Implementation
Object? parseActions(int marker_kind) {
int ti = -1, curtok;
lastToken = tokens.get(++ti);
curtok = tokens.get(++ti);
allocateOtherStacks();
//
// Reparse the input...
//
stateStackTop = -1;
currentAction = START_STATE;
for (var i = 0; i < action.size(); i++) {
//
// if the parser needs to stop processing, it may do so here.
//
if (monitor != null && monitor!.isCancelled()) return null;
stateStack[++stateStackTop] = currentAction;
locationStack[stateStackTop] = ti;
currentAction = action.get(i);
if (currentAction <= NUM_RULES) // a reduce action?
{
stateStackTop--; // make reduction look like shift-reduction
process_reductions();
} else // a shift or shift-reduce action
{
if (tokStream.getKind(curtok) > NT_OFFSET) {
var badtok =
(tokStream as IPrsStream).getIToken(curtok) as ErrorToken;
throw BadParseException(badtok
.getErrorToken()
.getTokenIndex()); // parseStack[stateStackTop] = ra.prostheticAst[prs.getProsthesisIndex(tokStream.getKind(curtok))].create(tokStream.getIToken(curtok));
}
lastToken = curtok;
curtok = tokens.get(++ti);
if (currentAction > ERROR_ACTION) // a shift-reduce action?
{
currentAction -= ERROR_ACTION;
process_reductions();
}
}
}
return parseStack[marker_kind == 0 ? 0 : 1];
}