[antlr-interest] Range generation in C++ mode

Ric Klaren klaren at cs.utwente.nl
Tue Sep 7 03:09:25 PDT 2004

On Tue, Sep 07, 2004 at 09:44:44AM +0200, Martin Probst wrote:
> Yes, it happens when compiling with MSVC 7.1 (2003). I've attached the
> stack backtrace. The precise message is:
> > Debug Assertion Failed!
> > Program: ...
> > File: isctype.c
> > Line: 56
> > Expression: (unsigned)(c+1) <= 256
> It's really called from isprint as you can see from the backtrace.

Could you verify that in the file String.cpp (line 41) of your support
library the character fed to isprint is anded with 0xff ? I'm kindoff
surprised that a negative value gets to isprint. It might be that you still
link to an older support library ?

> > I also got a hack that has better UTF8 support in C++. Using a modified
> > InputBuffer and another CharScanner superclass. The InputBuffer decodes
> > the
> > UTF8 and the CharScanner superclass can repackage things in the form you
> > like (currently UTF8 stored in std::string)
> I'm actually quite content with the way I handle it at the moment. The
> only problem I will get is proper error reporting (with respect to column
> numbers) but I'll either do this in a special error handler or with an
> ugly client-side hack. Converting UTF-8 to UCS-2 or sth similar would not
> actually help me as I have to compare the string values of tokens to UTF-8
> strings later on.

Well the actual result of the 'hack' would be that you still have UTF8 at
the parser/treeparser level. (in all getText calls and similar) And have
correct line/column information because the lexer internally uses 32 bit


    ---- Ric Klaren ----- j.klaren at utwente.nl ----- +31 53 4893755  ----
  Quidquid latine dictum sit, altum viditur.
                 (Whatever is said in Latin sounds profound.)

Yahoo! Groups Links

<*> To visit your group on the web, go to:

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

More information about the antlr-interest mailing list