forked from jasder/antlr
Prevent NPE after reporting error
This commit is contained in:
parent
4c1e9b4119
commit
4c4f767d17
|
@ -138,6 +138,7 @@ public class TestRig {
|
|||
}
|
||||
if ( lexerClass==null ) {
|
||||
System.err.println("Can't load "+lexerName);
|
||||
return;
|
||||
}
|
||||
|
||||
InputStream is = System.in;
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in New Issue