@Override
    public void syntaxError(final Recognizer<?, ?> recognizer, final Object offendingSymbol, final int line,
                            final int charPositionInLine, final String msg, final RecognitionException e) {
        throw new GremlinParserException(line, charPositionInLine, msg);
    }
Gremlin error listener class which throw {@link GremlinParserException} on syntax error.
gremlin-core/src/main/java/org/apache/tinkerpop/gremlin/language/grammar/GremlinErrorListener.java