[antlr-interest] Re: Code generation error?

jm_newton jm_newton at yahoo.co.uk
Mon Aug 2 06:15:15 PDT 2004


Hi,
sorry for the slow reply - just been on holiday...

Correcting the grammer got rid of the java statement in the generated
c++ code so thats a good start. 

I've also rebuilt ANTLR with your suggested fix and tried it on my
original grammer which resulted in compilable c++.

The only question I've got left now is how your fix gets into the
ANTLR src tree? Is there a bug tracking system I submit it to or does
the fact it is discussed here result in the change being incorporated
into the next release?

JM

--- In antlr-interest at yahoogroups.com, Ric Klaren <klaren at c...> wrote:
> Hi,
> 
> On Tue, Jul 27, 2004 at 12:56:40PM -0000, jm_newton wrote:
> > STRING : !QUOTE ('a'..'z')* !QUOTE
> >        ;
> 
> First off I think you intend:
> 
> STRING : QUOTE! ('a'..'z')* QUOTE! ;
> 
> > which results in the following generated c++ code. Unfourtunately in
> > the middle of that lot is the statement text.setLength(). setLength()
> > is not a valid member function of std::basic_string so compilation
> > fails...
> 
> Nevertheless you caught something that's been in the codegen since
ages...
> congrats :)
> 
> The fix is easy though replace the only occurence of
> text.setLength(_saveIndex) in CppCodegenerator.java with a
> text.erase(_saveIndex) and rebuild antlr.
> 
> > I'm not sure if I'm trying to do the impossible with my parser or
> > found a real problem here. Environment:
> > cantlr -> 2.7.4 from WWW site
> > antlr-2.7.4
> 
> Not the impossible, if rebuilding of antlr is not an option then the (I
> hope) corrected rule above does not trigger the bug.
> 
> Thanks for the report!
> 
> Ric
> --
>
-----+++++*****************************************************+++++++++-------
>     ---- Ric Klaren ----- j.klaren at u... ----- +31 53 4893755  ----
>
-----+++++*****************************************************+++++++++-------
>   "You can't expect to wield supreme executive power just because some
>    watery tot throws a sword at you!"
>   --- Monty Python and the Holy Grail



 
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