[antlr-interest] question on C target generated code

Madden, Warren warren.madden at lmco.com
Tue Jul 31 12:22:09 PDT 2007


Greetings!

 

I'm trying to put together a grammar targeted at C, but am running into
a problem at compile time.  Here's a snippet of my code:

 

            firstlet = (pANTLR3_COMMON_TOKEN)LT(1);

            MATCHT(LETTER, &FOLLOW_LETTER_in_cor145); 

 

            if ( !(firstlet->getText(firstlet).equals( "C" )) ) 

            {

                    CONSTRUCTEX();

                    EXCEPTION->type         =
ANTLR3_FAILED_PREDICATE_EXCEPTION;

                    EXCEPTION->message      = "$firstlet.text.equals(
\"C\" )";

                    EXCEPTION->ruleName     = "cor";

 

 

            }

 

I get the following error message in gcc:

 

ReccoParser.c: In function `cor':

ReccoParser.c:1490: error: request for member `equals' in something not
a structure or union

 

It's clear that firstlet is a pANTLR3_COMMON_TOKEN, and the getText
function returns a pANTLR3_STRING.  But the ANTLR3_STRING structure
doesn't have an equals member - the closest thing it comes to it is a
compare method.  I'm left scratching my head.  Could someone enlighten
me as to what I'm missing?

 

Thanks!

 

Warren Madden

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


More information about the antlr-interest mailing list