[antlr-interest] Matching fragments
Sam Barnett-Cormack
s.barnett-cormack at lancaster.ac.uk
Mon Sep 7 13:45:53 PDT 2009
Gavin Lambert wrote:
> At 05:31 8/09/2009, Sam Barnett-Cormack wrote:
> >However, the rules I'll pass them to won't match EOF.
> >
> >It strikes me that all I need to do is make the token stream
> >wrapper *not* return an EOF. However, the docs seem to specify
> >that it *should* return an EOF. How, practically or ideally,
> >should I resolve this?
>
> Your custom streams should return an EOF when they run out of input. It
> doesn't really matter (from this perspective) whether or not the rule
> being invoked is expecting an EOF; by default rules are not required to
> consume all input. (Adding EOF matching to a rule is the main way of
> requesting that a rule *should* try to consume all input.)
Huzzah, that's good, I don't need to write anything odd. My custom
stream currently sends the EOF, as that's what the docs seemed to say to do.
--
Sam Barnett-Cormack
More information about the antlr-interest
mailing list