Prevent NPE after reporting error

This commit is contained in:
Sam Harwell 2012-07-18 14:59:41 -05:00
parent 4c1e9b4119
commit 4c4f767d17
2 changed files with 3 additions and 2 deletions

View File

@ -138,6 +138,7 @@ public class TestRig {
}
if ( lexerClass==null ) {
System.err.println("Can't load "+lexerName);
return;
}
InputStream is = System.in;

View File

@ -168,7 +168,7 @@ public class AttributeChecks implements ActionSplitterListener {
errMgr.toolError(ErrorType.UNDEFINED_RULE_IN_NONLOCAL_REF,
x.getText(), y.getText());
}
if ( r.resolveToAttribute(y.getText(), null)==null ) {
else if ( r.resolveToAttribute(y.getText(), null)==null ) {
errMgr.grammarError(ErrorType.UNKNOWN_RULE_ATTRIBUTE,
g.fileName, y, y.getText(), x.getText(), expr);
@ -182,7 +182,7 @@ public class AttributeChecks implements ActionSplitterListener {
errMgr.toolError(ErrorType.UNDEFINED_RULE_IN_NONLOCAL_REF,
x.getText(), y.getText());
}
if ( r.resolveToAttribute(y.getText(), null)==null ) {
else if ( r.resolveToAttribute(y.getText(), null)==null ) {
errMgr.grammarError(ErrorType.UNKNOWN_RULE_ATTRIBUTE,
g.fileName, y, y.getText(), x.getText(), expr);