[antlr-interest] C Runtime and Strings

Gavin Lambert antlr at mirality.co.nz
Fri Aug 24 06:30:38 PDT 2007


At 00:33 25/08/2007, dev.null.nix at gmail.com wrote:
 >scoped_identifier : NAMESPACE_COLON? (IDENTIFIER 
NAMESPACE_COLON)*
 >IDENTIFIER;
 >
 >I would like to return the string representing 
scoped_identifier.
 >
 >Is there any way to access the buffer location of a token in the 

 >input buffer (like storing a pointer to the first and the last 
char).

 From within a rule, you can just use $text, I think.  (Or maybe 
it's $getText(), or $scoped_identifier.text.  I'm a little fuzzy 
now, it's been a while.)  From outside the rule you can either use 
that last one or assign a label to it and use that instead.

 >And if there is a way, is the input buffer read into one big 
buffer
 >so that it is valid for the whole parser?

Yep.



More information about the antlr-interest mailing list