[antlr-interest] C# extra or lack of character in a token when getting Text of a node in the tree

Keith Nicholas keith.nicholas at gmail.com
Wed Dec 22 17:33:50 PST 2010


I have a grammar with the token......


STRING
    :  '\'' ( ESC_SEQ | ~('\\'|'\'') )* '\''
    ;


so, single quotes string ( as per auto generated in antlr works)


When I'm walking the tree......    i have a string   'blah'

in the debugger I have


+ [Antlr.Runtime.Tree.CommonTree] {'blah'} Antlr.Runtime.Tree.CommonTree

and the "Text" property is

Text "'blah'" string

might be a bit hard to see

but it is   blah'       ie,  it has the ' on the end.....

Now I'm not sure if its supposed to have both the quote or neither quotes,
but I'm pretty sure its not supposed to just have one of them

any ideas?

Regards,

Keith


More information about the antlr-interest mailing list