Correct instance-identifier escaping 52/103952/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 3 Jan 2023 15:39:04 +0000 (16:39 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Fri, 6 Jan 2023 16:09:21 +0000 (17:09 +0100)
commitb1035b77080285d770a10cda1860e8cc8d3aaf3c
tree7ad92d997de848eae23d9f45d28fff14f004c6ab
parent977dd428ce02b8493506cc06fb6a1da53e8985fb
Correct instance-identifier escaping

Dealing with single-quoted and double-quoted strings in
instance-identifier differs quite a bit. In order to deal with these
strings, we need to differentiate them in lexer, for which we create
separate modes.

This forces us to explicitly define lexer lokens and only match raw
strings in their mode -- ensuring there are no surprises.

JIRA: YANGTOOLS-1458
Change-Id: I3f58c10f068da1128d8a7c1c5bed3917bfea0c78
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 45e8951a576c6bf2cb2bd0290167619b8be2fc5a)
xpath/yang-xpath-impl/src/main/antlr4/org/opendaylight/yangtools/yang/xpath/antlr/instanceIdentifierLexer.g4 [moved from xpath/yang-xpath-impl/src/main/antlr4/org/opendaylight/yangtools/yang/xpath/antlr/instanceIdentifier.g4 with 51% similarity]
xpath/yang-xpath-impl/src/main/antlr4/org/opendaylight/yangtools/yang/xpath/antlr/instanceIdentifierParser.g4 [new file with mode: 0644]
xpath/yang-xpath-impl/src/main/java/org/opendaylight/yangtools/yang/xpath/impl/InstanceIdentifierParser.java
xpath/yang-xpath-impl/src/test/java/org/opendaylight/yangtools/yang/xpath/impl/InstanceIdentifierParserTest.java [new file with mode: 0644]