2 * Copyright (c) 2019 Pantheon Technologies, s.r.o. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.yangtools.yang.xpath.impl;
10 import javax.xml.xpath.XPathExpressionException;
11 import org.antlr.v4.runtime.BaseErrorListener;
12 import org.antlr.v4.runtime.RecognitionException;
13 import org.antlr.v4.runtime.Recognizer;
14 import org.eclipse.jdt.annotation.Nullable;
16 final class CapturingErrorListener extends BaseErrorListener {
17 private @Nullable XPathExpressionException error;
20 public void syntaxError(final @Nullable Recognizer<?, ?> recognizer, final @Nullable Object offendingSymbol,
21 final int line, final int charPositionInLine, final @Nullable String msg,
22 final @Nullable RecognitionException cause) {
23 final XPathExpressionException ex = Utils.wrapException(cause, "%s", msg);
27 error.addSuppressed(ex);
31 void reportError() throws XPathExpressionException {