[antlr-interest] dellete space token
elekis
elekis at gmail.com
Tue Apr 1 00:18:16 PDT 2008
hi all,
I try to make a simple grammar and print token.
I try to parse some sentence like that
DEFINITION MODULE helloworld ;
there my lexer grammar
lexer grammar Lyaflplug;
TAG_DEFINITION_MODULE :'DEFINITION MODULE';
TAG_POINT_VIRGULE :';';
Ident :LETTER NAMECHAR*;
fragment NAMECHAR :LETTER | DIGIT | '-' | '_';
fragment LETTER :'a'..'z'| 'A'..'Z';
fragment DIGIT :'0'..'9';
WS :(' '|'\r'|'\t'|'\u000C'|'\n') {channel=99;};
based on the xml tutorial
but when I print token I have that
Token: DEFINITION MODULE
Token:
Token: helloworld
Token:
Token: ;
he print all space. WHY??
other thing is it possible to put directly token in the parser I mean
write a rule like that
compilationUnit: 'DEFINITION MODULE' Ident ';';
than that
compilationUnit: TAG_DEFINITION_MODULE Ident TAG_POINT_VIRGULE;
??
thanks, a+++
More information about the antlr-interest
mailing list