[antlr-interest] C++ Parsers - charVocabulary option

Ric Klaren klaren at cs.utwente.nl
Tue Jan 8 01:43:14 PST 2002


Hi,

On Mon, Jan 07, 2002 at 09:11:37PM -0000, therealtootalltimmy wrote:
> I have a simple grammar that just handles comments.
>
> When I generate a Java parser and feed it a comment with a copyright symbol
> in it, it works (does not complain about unexpected tokens).
>
> When I generate a C++ parser and feed it a comment with a copyright symbol
> in it, it complains about an unexpected token.

Is your input file unicode? If so then you're unlucky.

> I'm sure that copyright symbols are not the only characters I will have
> problems with.

If your input is unicode than it will not work. Unless...

> How can I make the copyright symbol acceptable to ANTLR generated parsers?

.. You get antlr's support library to accept unicode. There is one
incomplete patch floating around in the archive (MSVC6 centric if I recall
right). Look for post from Daniel Fekete and anything with 'unicode' in the
subject.

On the other hand... If your input is unicode and you know the enoding you
might do a 'dirty' trick by defining a token with the right unicode curses.
YMMV

Cheers,

Ric
--
-----+++++*****************************************************+++++++++-------
    ---- Ric Klaren ----- klaren at cs.utwente.nl ----- +31 53 4893722  ----
-----+++++*****************************************************+++++++++-------
Wit is cultured insolence. --- Aristotle


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list