was processing grammar after syntax error.

This commit is contained in:
Terence Parr 2012-09-09 11:50:30 -07:00
parent c581faafc7
commit 0ac781aebf
2 changed files with 3 additions and 0 deletions

View File

@ -364,6 +364,8 @@ public class Tool {
if ( g.ast!=null && internalOption_PrintGrammarTree ) System.out.println(g.ast.toStringTree());
//g.ast.inspect();
if ( g.ast.hasErrors ) return;
int prevErrors = errMgr.getNumErrors();
// MAKE SURE GRAMMAR IS SEMANTICALLY CORRECT (FILL IN GRAMMAR OBJECT)
SemanticPipeline sem = new SemanticPipeline(g);

View File

@ -325,6 +325,7 @@ public class LeftRecursiveRuleAnalyzer extends LeftRecursiveRuleWalker {
for (int i = 0; i < n; i++) {
GrammarAST alt = (GrammarAST)blk.getChildren().get(i);
Tree first = alt.getChild(0);
if ( first==null ) continue;
if ( first.getType()==RULE_REF && first.getText().equals(ruleName) ) return true;
Tree rref = first.getChild(1);
if ( rref!=null && rref.getType()==RULE_REF && rref.getText().equals(ruleName) ) return true;