[antlr-interest] C target recognition problem

Pierre Attar pat at tireme.fr
Sun Mar 30 02:50:44 PDT 2008


Hi,

I'm running the following rule in ANTLRWorks with an input such as 
f"blabla"f :

FString : '\u0022'  ~('\u0022')+ '\u0022';
 and "blabla" is recognized as a string .... it works perfectly.


But in fact, I'm using the C generator in a C++ environment so all code 
is included as extern "C".
Also, in my reality, the string to analyze is created in memory by an 
other ANTLR recognition wich creates XMLString (wchar).

So my lexer recognizer is defined as
        input = antlr3NewUCS2StringInPlaceStream ((pANTLR3_UINT16) 
str,(ANTLR3_UINT64) XMLString::stringLen(str), NULL);

Doing that, it seems that the lexer is able to recognize the str but 
when I try to get the text from the recognized string
FString2->getText(FString2)->chars

 I have a nothing ("") sting.

Any ideas on where may be the problem ? I'm quite sure it is a character 
coding problem but I'm not able to find where are the contradictions ...

Thaks al lot for help,

Pierre





More information about the antlr-interest mailing list