Fwd: [antlr-interest] ANTLR, C++ and UNICODE

Ric Klaren ric.klaren at gmail.com
Sun Jul 17 15:09:00 PDT 2005


Alain Filion wrote:
> I have tried your Unicode solution for C++ and I find it weird that you
> don't use wistream as an input to your UnicodeCharBuffer. If you use
> basic char, how can you support Unicode character which are defined by
> wchar_t ?

> Usually, Unicode strings are defined in wstring. How can I use those
> with ANTLR ?

Solution is a big word. The example is a proof of concept thing. It's
very much untested and only intended to show how one can hook unicode
decoding and encoding in antlr. The example decodes UTF-8 and during
parsing antlr uses 32 bit values. After the token is recognized it
reencodes it to UTF8 into a normal string. You can plug in any other
string implementation at that point.

Cheers,

Ric


More information about the antlr-interest mailing list