[antlr-interest] Getting token text - simple?

lansdownsoftware dave-Johnson at btclick.com
Mon Sep 30 10:57:45 PDT 2002


Hi,

I've had some fun with PCCTS 1.33 on a couple of projects and now 
have started with ANTLR 2.7.1 producing C++ code.
I have a typically trivial (I hope) newbie problem.
How do I get the token text, where I'm looking at attribute values.  
My code is the html.g as distributed with the following modification:

protected
ATTR
options {ignore=WS_;}
    :   WORD ('=' (axa:WORD ('%')? | ('-')? INT | bxb:STRING | 
HEXNUM))?
    {
        if( axa != NULL )
            printf( "<<A:attribute>><%s>", axa.getText());
        if( bxb != NULL )
            printf( "<<B:attribute>><%s>", bxb.getText());
	}
	;

I get the message:
(file/line) error C2039: 'getText' : is not a member 
of 'RefCount<class antlr::Token>'
..should I be deriving my own token class ?

Thanks

Dave Johnson


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list