-
Notifications
You must be signed in to change notification settings - Fork 27
Open
Description
I'm using different rulesets in a custom parser for erazor lib.
Frequently i use peek(1) on a ruleset to verify if it should process what comes next or leave it to another ruleset.
The problem is that if a function using ruleset(A) decides not to process what comes next after peek(1), and another function with ruleset(B) processes what comes next, the first token will be the one defined by function (A) peek(1)
example:
function A() {
stream.ruleset = MyLexer.ASomeRules;
var tok = peek(1);
switch(tok) {
case SOME_RULE: B(); // let B process what comes next.
}
}
function B() {
stream.ruleset = MyLexer.BOtherRules;
// will throw SOME_RULE has no match in this switch.
switch stream {
case OTHER_RULE: null;
}
}Metadata
Metadata
Assignees
Labels
No labels