[antlr-interest] C++ problem, just exits with code -1

Ric Klaren ric.klaren at gmail.com
Fri Jan 7 14:35:57 PST 2005


Hi,

On Fri, 07 Jan 2005 22:13:04 +0000, clocKwize
<clockwize at blueyonder.co.uk> wrote:
> hi, i'm using dev-c++, i've created a static lib, and used the calc
> example, but change it so it takes a string directly for parsing.
> 
> if i give it "1+2;" it parses fine, if i give it "1+2" it says missing
> SEMI, which is great, but if i pass it something totally wrong, like
> "1,2,3,4" it just exits...
> 
> any idea why this happens?

Try adding:

charVocabulary='\u0003'..'\u00FF';

To the lexer options. It is probably exiting due to encountering a
character outside the character vocabulary defined in the lexer rules
so far. Although I'd suspect that it should print an error message
about encountering an exception during lexing.

BTW the default charVocabulary will change to the above in the 2.7.5
release of antlr.

Cheers,

Ric


More information about the antlr-interest mailing list