[antlr-interest] C Runtime and Strings

Stefan Klinger dev.null.nix at gmail.com
Sat Aug 25 10:00:55 PDT 2007


Gavin Lambert wrote:
> >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.
So it should be valid to return something like this from such a rule 
(with the advantace that nothing needs to be allocated):

scoped_identifier : NAMESPACE_COLON? (IDENTIFIER NAMESPACE_COLON)* 
IDENTIFIER;

struct MyReturn {
    pANTLR3_UINT8 *begin_of_rule;
    pANTLR3_UINT8 *end_of_rule;
};

for e.g. the input "12 + my::identifier::name + 34"

begin_of_rule should be pointing to 'm' and end_of_rule to 'e'.


If someone could give me a hint how i can accomplish that it would be great.

Thanks,

Stefan



More information about the antlr-interest mailing list