ANTLR lexer can't lookahead at all
问题 I have the following grammar: rule: 'aaa' | 'a' 'a'; It can successfully parse the string 'aaa', but it fails to parse 'aa' with the following error: line 1:2 mismatched character '<EOF>' expecting 'a' FYI, it is the lexer's problem not the parser's because I don't even call the parser. The main function looks like: @members { public static void main(String[] args) throws Exception { RecipeLexer lexer = new RecipeLexer(new ANTLRInputStream(System.in)); for (Token t = lexer.nextToken(); t