I am unable to understand why this simple grammar -
grammar Test;
file : ID;
ID : .*;
leads to this error -
Test.g:3:6: The following alternatives can never be matched: 1
Why is this happening?
Using .* and .+ at the end of a lexer rule is illegal in ANTLR:
ID : .*; // illegal
ID : 'bar' .*; // illegal
ID : .* 'bar'; // legal
In parser rules, this is not the case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With