[antlr-interest] ANTLR 3: XML Parsing tutorial

Mark Mandel mark.mandel at gmail.com
Sun Dec 24 02:42:41 PST 2006


Hey,

(Quick prefix with a ANTLR newbie disclaimer)

Quick question for you all:

Looking at:
http://www.antlr.org/wiki/display/ANTLR3/1.+Lexer

The rule in question is:
WS  : (' '|'\r'|'\t'|'\u000C'|'\n') {channel=99;}
    ;

2 questions on the statement made on this rule:

(1)
'The rule WS is special as it recognizes all white spaces, but does
not pass it to the next stage, the token parser, because we don't care
about white spaces.'

Any reason why a $channel=HIDDEN was not used (I realise this is the
same, but, I would have thought it would make more sense to a new
user?)

(2)
Sending the token to channel 99 is ANTLR's way of saying that.
'0'..'9' is a short form of saying (0|1|2|3|4|5|6|7|8|9) and 'a'..'z'
respectively for the characters from a to z.'

Is it just me, or does this sentence not make any sense?

>From what I've been reading, sending the token to chennel 99 is ANTLRs
way of saying, 'please ignore this token, because we do not care about
it at this time'.  Am I wrong?

Otherwise, tutorial is looking good - just plugging away at it.

Thanks for the hard work.

Mark

-- 
E: mark.mandel at gmail.com
W: www.compoundtheory.com


More information about the antlr-interest mailing list