forked from jasder/antlr
rm k=1 chk to report early ambiguity.
This commit is contained in:
parent
102980dffd
commit
9a0aaacbee
|
@ -239,7 +239,7 @@ import java.util.Set;
|
|||
* holds the decision were evaluating
|
||||
*/
|
||||
public class ParserATNSimulator<Symbol extends Token> extends ATNSimulator {
|
||||
public static boolean debug = false;
|
||||
public static boolean debug = false
|
||||
public static boolean dfa_debug = false;
|
||||
public static boolean retry_debug = false;
|
||||
|
||||
|
@ -535,8 +535,7 @@ public class ParserATNSimulator<Symbol extends Token> extends ATNSimulator {
|
|||
int k = input.index() - startIndex + 1; // how much input we used
|
||||
// System.out.println("used k="+k);
|
||||
if ( outerContext == ParserRuleContext.EMPTY || // in grammar start rule
|
||||
!D.configset.dipsIntoOuterContext ||
|
||||
k == 1 ) // SLL(1) == LL(1)
|
||||
!D.configset.dipsIntoOuterContext )
|
||||
{
|
||||
if ( reportAmbiguities && !D.configset.hasSemanticContext ) {
|
||||
reportAmbiguity(dfa, D, startIndex, input.index(), D.configset.conflictingAlts, D.configset);
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
grammar T;
|
||||
s : a a a;
|
||||
a : {false}? ID
|
||||
| {true}? ID
|
||||
| INT
|
||||
;
|
||||
ID : 'a'..'z'+ ;
|
||||
s : f f EOF;
|
||||
f : | x;
|
||||
x : 'a' 'b';
|
||||
INT : '0'..'9'+;
|
||||
WS : (' '|'\n') {skip();} ;
|
||||
|
|
Loading…
Reference in New Issue