[antlr-interest] Ignore Whitespace
Anakreon Mejdi
amejdi at ertonline.gr
Tue Nov 5 04:08:52 PST 2002
Taking this line as example:
Assay: , std
Alphascreen 384 , Description:
,
Remove the ':' alternative from the IGNORE rule, also remove rules
DISCARD and WS
class CSVLexer extends Lexer;
options{
filter=IGNORE;
caseSensitive = false; //I asume case doesn't matter
}
preotected IGNORE
:
'\t
| '\n' {newline();}
| '\r' '\n' {newline();}
| ','
;
protcetd FILTER_SPACES
:
(' ')+
;
protected DATA
:
a .. z
| 0 .. 9
| ' ' (FILTER_SPACES!)?
;
KEEP
:
(DATA)+ (':'! | ','!)?
;
You can not discard white spaces since data like "Alphascreen 384" would
become Alphascreen384.
The DATA rule will accept the first white space but will discard all the
others.
I don't know if it will work without modifications though.
Anakreon
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list