-
Notifications
You must be signed in to change notification settings - Fork 176
Open
Labels
Milestone
Description
With a parser rule like this:
foo: '(' bar ')' -> ^(T_BAR[$bar.text] bar);The returned string in the BAR token is corrupted.
The reason is that the following code is generated in the parser:
root_1 = (pANTLR3_BASE_TREE)(ADAPTOR->becomeRoot(ADAPTOR,
(pANTLR3_BASE_TREE)ADAPTOR->createTypeText(ADAPTOR, T_BAR,
(pANTLR3_UINT8)(STRSTREAM->toStringTT(STRSTREAM, bar90.start, bar90.stop))),
root_1));
The toStringTT() method returns a pANTLR3_STRING pointer.
But the createTypeText() method (and the createToken() method that it calls) expects a UTF-8 char string.
The pANTLR3_STRING is eventually cast to pANTLR3_UCHAR and the text state set to ANTLR3_TEXT_CHARP.
Reading the token text from the token results in gibberish.
Tested with both ANTLR 3.4 and 3.5.
Is there any workaround available?
Reactions are currently unavailable