@Override
			public void tokenRef(TerminalAST ref) {
				if ("EOF".equals(ref.getText())) {
					// this is a special predefined reference
					return;
				}

				if ( g.isLexer() ) ruleRef(ref, null);
			}
Important enough to avoid multiple definitions that we do very early,
right after AST construction. Also check for undefined rules in
parser/lexer to avoid exceptions later. Return true if we find multiple
definitions of the same rule or a reference to an undefined rule or
parser rule ref in lexer rule.
tool/src/org/antlr/v4/Tool.java