No, ID
does not match "$one"
or "£one"
as you can see:
T.g
grammar T;
parse : ID EOF;
ID : ('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')*;
Main.java
import org.antlr.runtime.*;
public class Main {
public static void main(String[] args) throws Exception {
TLexer lexer = new TLexer(new ANTLRStringStream("$one"));
TParser parser = new TParser(new CommonTokenStream(lexer));
parser.parse();
}
}
Run the test
java -cp antlr-3.4-complete.jar org.antlr.Tool T.g
javac -cp antlr-3.4-complete.jar *.java
java -cp .;antlr-3.4-complete.jar Main
will produce the following error:
line 1:0 mismatched character '$' expecting set null
Note that both antlr-3.4-complete.jar
and antlr-3.4-complete-no-antlrv2.jar
produce the same error (or any other 3.x version, for that matter).
My guess is that you're using ANTLRWorks and you didn't notice the error messages on the console tab (they're there!).