Fix InstanceIdentifierParser's lexer 50/103950/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 3 Jan 2023 19:21:08 +0000 (20:21 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 6 Jan 2023 16:09:21 +0000 (17:09 +0100)
We have a day-0 bug here: we are using xpathLexer instead of
instanceIdentifierLexer.

JIRA: YANGTOOLS-1361
Change-Id: Ic4c074577c8a6fce9fbc22ef5da8e54b5df75faa
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8175666c67304af22cda102db8a183784b659799)

xpath/yang-xpath-impl/src/main/java/org/opendaylight/yangtools/yang/xpath/impl/InstanceIdentifierParser.java

index 4fdf780847e2bce8187ae764f763dba374d3de16..c38ae48aa922547c26f30e08779fa9cf1bea4b3f 100644 (file)
@@ -20,6 +20,7 @@ import org.antlr.v4.runtime.CharStreams;
 import org.antlr.v4.runtime.CommonTokenStream;
 import org.opendaylight.yangtools.yang.common.UnresolvedQName;
 import org.opendaylight.yangtools.yang.common.YangNamespaceContext;
+import org.opendaylight.yangtools.yang.xpath.antlr.instanceIdentifierLexer;
 import org.opendaylight.yangtools.yang.xpath.antlr.instanceIdentifierParser;
 import org.opendaylight.yangtools.yang.xpath.antlr.instanceIdentifierParser.EqQuotedStringContext;
 import org.opendaylight.yangtools.yang.xpath.antlr.instanceIdentifierParser.InstanceIdentifierContext;
@@ -32,7 +33,6 @@ import org.opendaylight.yangtools.yang.xpath.antlr.instanceIdentifierParser.Path
 import org.opendaylight.yangtools.yang.xpath.antlr.instanceIdentifierParser.PosContext;
 import org.opendaylight.yangtools.yang.xpath.antlr.instanceIdentifierParser.PredicateContext;
 import org.opendaylight.yangtools.yang.xpath.antlr.instanceIdentifierParser.QuotedStringContext;
-import org.opendaylight.yangtools.yang.xpath.antlr.xpathLexer;
 import org.opendaylight.yangtools.yang.xpath.api.YangBinaryOperator;
 import org.opendaylight.yangtools.yang.xpath.api.YangExpr;
 import org.opendaylight.yangtools.yang.xpath.api.YangLiteralExpr;
@@ -90,7 +90,7 @@ abstract class InstanceIdentifierParser {
     }
 
     final Absolute interpretAsInstanceIdentifier(final YangLiteralExpr expr) throws XPathExpressionException {
-        final xpathLexer lexer = new xpathLexer(CharStreams.fromString(expr.getLiteral()));
+        final instanceIdentifierLexer lexer = new instanceIdentifierLexer(CharStreams.fromString(expr.getLiteral()));
         final instanceIdentifierParser parser = new instanceIdentifierParser(new CommonTokenStream(lexer));
         final CapturingErrorListener listener = new CapturingErrorListener();
         lexer.removeErrorListeners();