The input content:
The grammar:
grammar test;
p : EOF;
Char : [a-z];
fragment Tab : '\t';
fragment Space : ' ';
T1 : (Tab|Space)+ ->skip;
T2 : '#' T1+ Char+;
The matching result is this:
[@0,0:6='# abc',<T2>,1:0] <<<<<<<< PLACE 1
[@1,7:6='<EOF>',<EOF>,1:7]
line 1:0 extraneous input '# abc' expecting <EOF>
Please ignore the error in the last line. I am wondering why the token matched at PLACE 1 is T2.
In the grammar file, the T2 lexer rule goes after the T1 lexer rule. So I expect T1 rule should get applied first. So why the spaces in # abc is not skipped?
Does ANTLR uses some greedy strategy to match current character stream with the longest lexer rule?
