[antlr-interest] Emitting (additional) imaginary tokens in the C target

Jim Idle jimi at temporal-wave.com
Thu Jun 14 07:45:41 PDT 2007


It had to swap because of changes made to lexer token handling in Java,
that I wished to propagate. At the same time, as you observe, I felt
that the override method should change as the names seemed intuitively
the wrong way round. When you have the whole changes and not just the
fact that the names changed, it makes more sense, and you lexer rules
will simply too.

 

Jim

 

From: antlr-interest-bounces at antlr.org
[mailto:antlr-interest-bounces at antlr.org] On Behalf Of Gavin Lambert
Sent: Thursday, June 14, 2007 4:42 AM
To: ANTLR mail-list
Subject: Re: [antlr-interest] Emitting (additional) imaginary tokens in
the C target

 

At 23:25 14/06/2007, Wincent Colaiuta wrote:
>Actually, emitNew emits an existing token and emit 
>constructs a new token:
>
>static void emitNew         (pANTLR3_LEXER lexer,   
>pANTLR3_COMMON_TOKEN token)
[...]
>static pANTLR3_COMMON_TOKEN
>emit        (pANTLR3_LEXER lexer)

Innnteresting.  In the version I've got it's the other way around (but
then I haven't downloaded the release yet; I still have one of the
betas):

static void  emit (pANTLR3_LEXER lexer, pANTLR3_COMMON_TOKEN token);
static void  emitNew(pANTLR3_LEXER lexer,  ANTLR3_UINT32 ttype,
              ANTLR3_UINT64 line,     ANTLR3_UINT32 charPosition, 
              ANTLR3_UINT32 channel, 
              ANTLR3_UINT64 start,    ANTLR3_UINT64 stop
                );

The names make more sense to me this way around.  Though I guess it
makes life easier not having to pass in all those parameters :)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070614/f4f38468/attachment.html 


More information about the antlr-interest mailing list