[antlr-interest] rewrite empty input string to "*"
Jean-Sebastien Vachon
jean-sebastien.vachon at wantedtech.com
Thu May 5 13:22:16 PDT 2011
Hi All,
What is the best way to rewrite an empty input?
I mean if my input is "" (empty string) how can I rewrite to "*" ?
The desired behaviour is to search everything (*) if the input is empty.
I thought about upgrading my top rule to be:
query
: (andExpression+ -> andExpression) EOF
| (SPACE*) EOF -> STAR
;
Where STAR and SPACE are defined as:
STAR : '*';
SPACE : (' ' | '\t' | '\f')+ {$channel=HIDDEN;};
With this set of rules the output of tree in its text form is "STAR" while I was expecting "*"
What am I doing wrong?
Thanks
More information about the antlr-interest
mailing list