[antlr-interest] Matching fragments
Gavin Lambert
antlr at mirality.co.nz
Mon Sep 7 13:18:07 PDT 2009
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.)
More information about the antlr-interest
mailing list