List of usage examples for org.antlr.v4.runtime CommonToken getInputStream
@Override
public CharStream getInputStream()
From source file:com.jmcalc.utils.DescriptiveErrorListener.java
License:Apache License
@Override public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) { CommonToken offendingToken = ((CommonToken) offendingSymbol); String sourceName = offendingToken.getInputStream() .getText(new Interval(0, offendingToken.getInputStream().size())); if (e != null) { throw new ExpressionParseException(sourceName + " -> line " + line + ":" + charPositionInLine + " mismatched input '" + e.getOffendingToken().getText() + "'"); } else {// ww w . j a va 2s .c om throw new ExpressionParseException(sourceName + " -> line " + line + ":" + charPositionInLine + " unexpected token: " + offendingToken.getText()); } }