[antlr-interest] Problem "debugging" ANTLR error messages.

Frank Du frank.du at riskmetrics.com
Wed Feb 3 11:36:11 PST 2010


Hi Søren, have you considered the below rule. It may help to have a cleaner stmt rule:

WS  :   ( ' ' | '\t' | '\u000C' | '\r' | '\n')  { $channel=HIDDEN; }
    ;

Then the rule will look like:

stmt    :       variable_decl ';' | method_call ';' | assignment ';'
        ;

Thanks,
Frank

-----Original Message-----
From: antlr-interest-bounces at antlr.org [mailto:antlr-interest-bounces at antlr.org] On Behalf Of Gavin Lambert
Sent: Wednesday, February 03, 2010 2:04 PM
To: Søren Andersen; antlr-interest at antlr.org
Subject: Re: [antlr-interest] Problem "debugging" ANTLR error messages.

At 02:16 4/02/2010, Søren Andersen wrote:
 >I'm toying with a Java-like language for fun, and I'm having a
 >problem with ANTLR crashing when trying to use it.
[...]
 >[14:14:32] error(10):  internal error: Exception test.g:19:64:
 >unexpected char:
 >0xA0 at org.antlr.grammar.v2.ANTLRLexer.nextToken(ANTLRLexer.java:347)
 >: unexpected stream error from parsing test.g

Char 0xA0 is a non-breaking-space, suggesting
that you copy-pasted the rule from a webpage or
something else that inserted them.  Try retyping
the spaces as "real" spaces and it should fix the
problem.  (The column index should tell you where
the problem character is.)


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: http://www.antlr.org/mailman/options/antlr-interest/your-email-address

This email message and any attachments are for the sole use of the intended recipients and may contain proprietary and/or confidential information which may be privileged or otherwise protected from disclosure. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not an intended recipient, please contact the sender by reply email and destroy the original message and any copies of the message as well as any attachments to the original message.


More information about the antlr-interest mailing list