No, you override both of these with your own function, and your own
function should call your own version of emit if the built in one is not
what you want.

However most people will not need to use a customized token type and emit
overrides and so on. There is a pointer and 3 integers in the token that
can be used to store any additional information that you need.


Jim

> -----Original Message-----
> From: [email protected] [mailto:antlr-interest-
> [email protected]] On Behalf Of Michael Carns
> Sent: Tuesday, April 26, 2011 12:42 AM
> To: [email protected]
> Subject: [antlr-interest] Possible bug in C runtime: Unable to override
> emit() in lexer
>
> In order to use a customized token type, I believe I need to override
> emit() and emitNew() within my ANTLR3_LEXER instance.  However, my
> function isn't getting called.  I'm using version 3.1.3 of the C
> runtime.
>
> The culprit appears to be this call to emit() within nextTokenStr() in
> antlr3lexer.c:
>
> Line 268:
>                 if (lexer->rec->state->token == NULL)
>                 {
>                     // Emit the real token, which adds it in to the
> token stream basically
>                     //
>                     emit(lexer);
>                 }
>
> Shouldn't it be "lexer->emit(lexer)"?  As written, the call to emit()
> will bind to the local version of emit() within antlr3lexer.c and won't
> call my customized version.  I've looked at more recent versions in the
> source repository, and the code appears to be unchanged.  Is this a
> real bug, or am I going down the wrong road in my attempt to customize
> the generated tokens?
>
> Thanks,
> Mike Carns
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-
> email-address

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

-- 
You received this message because you are subscribed to the Google Groups 
"il-antlr-interest" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.

Reply via email to