[antlr-interest] Getting Token Text in C

Jim Idle jimi at temporal-wave.com
Wed Jun 10 08:38:41 PDT 2009


Florian Leitner-Fischer wrote:
> Jim,
>> Florian, where is this code? In an action? Driver code? Don't use the 
>> direct code like this as if I cahnge it, then all your code will 
>> break.   
> The code stems from the example package.
Really, I don't remember doing that directly. I think that the C Java 
parser example calls LT to force the lexer to run, but the comments 
should say that you do not normally do that.

>> There are macros, such as PARSER and so on that you should use. Look 
>> at the top of the generated code for more details.
>>
>> If you use LT rather than LA, then you will get a token pointer and 
>> it has pointers to the input stream where the token starts and a 
>> length field.
>>   
> I found the macros, but is there some where an example how they are used?
Perhaps you should have a read through the documentation? ;-)

http://www.antlr.org/api/C/index.html

Jim


More information about the antlr-interest mailing list