[antlr-interest] How does one suppress 'no viable alternative at character' warning messages

Tim Halloran hallorant at gmail.com
Wed Sep 17 11:14:33 PDT 2008


My lexer is sending warnings to stderr of the form and I'd like to suppress
these.

line 1:7 no viable alternative at character 'H'
line 1:8 no viable alternative at character 'I'
line 1:9 no viable alternative at character 'D'
line 1:10 no viable alternative at character 'E'

Now, I read chapter 10 of the ANTLR book and my grammar has the following:

@members {
@Override
protected void mismatch(IntStream input, int ttype, BitSet follow)
        throws RecognitionException {
    throw new MismatchedTokenException(ttype, input);
}

@Override
public Object recoverFromMismatchedSet(IntStream input,
        RecognitionException e, BitSet follow) throws RecognitionException {
    throw e;
}
}

@rulecatch {
catch (RecognitionException e) {
    throw e;
}
}

To make it "strict" about not trying to recover.

Thanks!
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080917/96a4b751/attachment.html 


More information about the antlr-interest mailing list