[antlr-interest] Re: Synchronizing error messages from filter

Monty Zukowski monty at codetransform.com
Fri Jul 30 16:55:39 PDT 2004


> You might make a custom token object that had a field for an error
> message.  Then override consume() in the parser to print your error
> before actually consuming the token passed it.
>

I left out some detail here.  You would put the error message into an 
instance variable in your lexer.  Then in the makeToken() rule you 
would attach that error message to the next Token it creates which is 
not of type SKIP.  Inspect the generated code to see that it will work, 
particularly the nextToken rule part which discards the tokens to be 
skipped, you may have to check for SKIP or FILTER, I'm not familiar 
with how the "filter" option is implemented but a quick inspection will 
make it clear.

On Jul 30, 2004, at 4:40 PM, dotlessbraille wrote:

> Monty,
> Thanks but when I use filter=FILTER where FILTER is a protected
> rule, I don't believe the lexer ever puts the resulting token into
> the token stream.  Is there a way to force that?
> -S
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



More information about the antlr-interest mailing list