diff --git a/tool/src/org/antlr/v4/Tool.java b/tool/src/org/antlr/v4/Tool.java index 16780393c..52f7d7b19 100644 --- a/tool/src/org/antlr/v4/Tool.java +++ b/tool/src/org/antlr/v4/Tool.java @@ -463,6 +463,11 @@ public class Tool { public boolean undefined = false; @Override public void tokenRef(TerminalAST ref) { + if ("EOF".equals(ref.getText())) { + // this is a special predefined reference + return; + } + if ( g.isLexer() ) ruleRef(ref, null); }