[antlr-interest] Parsing optional component in Tree Walker

John D. Mitchell johnm-antlr at non.net
Mon Apr 11 09:19:58 PDT 2005


>>>>> "Peter" == Peter Kronenberg <PKronenberg at technicacorp.com> writes:
[...]

> I have a tree walker that needs to deal with an optional component C.

Another alternative is to not make it optional.  I.e, when you build the
tree, if the real C isn't there, create an imaginary token/node for it.

Basically, this is the NullObject pattern.

Take care,
	John


More information about the antlr-interest mailing list