On Fri, 2008-12-12 at 09:40 +0100, Sven Van Echelpoel wrote:
> [...]
> > >
> > I'll take a look - does that snippet of code above reproduce it? What
> > options {} have you got set etc? If you have the time, then a small,
> > but complete, grammar would be helpful :-)
> >
> It does. I have attached the grammar and and the resulting C file. With
> 1 argument, this is the code that is generated from that template:
>
> #if 1 == 2
> (pANTLR3_BASE_TREE)ADAPTOR->createTypeTokenText(ADAPTOR, BAR,
> TOKTEXT(b))
> #else
> (pANTLR3_BASE_TREE)ADAPTOR->createTypeText(ADAPTOR, BAR,
> (pANTLR3_UINT8)b)
> #endif
>
> While, on the other hand, with 2 arguments you get this:
>
> #if 2 == 2
> (pANTLR3_BASE_TREE)ADAPTOR->createTypeTokenText(ADAPTOR, BAR, TOKTEXT(b,
> ""))
> #else
> (pANTLR3_BASE_TREE)ADAPTOR->createTypeText(ADAPTOR, BAR,
> (pANTLR3_UINT8)b, "")
> #endif
>
> With one argument, you can see that a node is created from the text,
> while with 2 arguments the token along with the text is passed.
>
> Thanks for looking into this, even though there is an easy workaround.
Ah yes - I should have documented this better (and will), but there is
no workaround in the templates for this because the code generator
relies on overloaded functions in Java/C# etc. With one argument, I have
to assume the one type, and with 2 arguments, the other. Unless we
change how this is generated in templates (I think I raised this issue
before but forget), it will have to remain this way I am afraid.
Jim
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---
List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address