Uncomment syncs before adaptivePredict
These allow slightly better error recovery before we run `adaptivePredict`, as illustrated by the test.
This commit is contained in:
parent
4617daaea7
commit
940cbcf19f
|
@ -11,6 +11,7 @@ TestTemplates ::= [
|
|||
"LL2": [],
|
||||
"LL3": [],
|
||||
"LLStar": [],
|
||||
"SingleTokenDeletionBeforePredict": [],
|
||||
"SingleTokenDeletionBeforeLoop": [],
|
||||
"MultiTokenDeletionBeforeLoop": [],
|
||||
"SingleTokenDeletionDuringLoop": [],
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
TestType() ::= "Parser"
|
||||
|
||||
Options ::= [
|
||||
"Debug": false
|
||||
]
|
||||
|
||||
Grammar ::= [
|
||||
"T": {<grammar("T")>}
|
||||
]
|
||||
|
||||
Input() ::= "caaab"
|
||||
|
||||
Rule() ::= "a"
|
||||
|
||||
Output() ::= <<
|
||||
>>
|
||||
|
||||
Errors() ::= <<
|
||||
line 1:0 extraneous input 'c' expecting 'a'
|
||||
>>
|
||||
|
||||
grammar(grammarName) ::= <<
|
||||
grammar <grammarName>;
|
||||
a : 'a'+ 'b'
|
||||
| 'a'+ 'c'
|
||||
;
|
||||
q : 'e' ;
|
||||
>>
|
|
@ -531,7 +531,7 @@ do {
|
|||
|
||||
AltBlock(choice, preamble, alts, error) ::= <<
|
||||
setState(<choice.stateNumber>);
|
||||
<!_errHandler.sync(this);!>
|
||||
_errHandler.sync(this);
|
||||
<if(choice.label)><labelref(choice.label)> = _input.LT(1);<endif>
|
||||
<preamble; separator="\n">
|
||||
switch ( getInterpreter().adaptivePredict(_input,<choice.decision>,_ctx) ) {
|
||||
|
@ -544,7 +544,7 @@ case <i>:
|
|||
|
||||
OptionalBlock(choice, alts, error) ::= <<
|
||||
setState(<choice.stateNumber>);
|
||||
<!_errHandler.sync(this);!>
|
||||
_errHandler.sync(this);
|
||||
switch ( getInterpreter().adaptivePredict(_input,<choice.decision>,_ctx) ) {
|
||||
<alts:{alt |
|
||||
case <i><if(!choice.ast.greedy)>+1<endif>:
|
||||
|
|
Loading…
Reference in New Issue