Strings Ending in Backslash are Improperly Lexed 81/81181/1
authorDanielle Mustillo <danielle.mustillo@ericsson.com>
Mon, 25 Mar 2019 18:27:45 +0000 (14:27 -0400)
committerRobert Varga <nite@hq.sk>
Tue, 26 Mar 2019 12:10:52 +0000 (12:10 +0000)
commit31764ea9b3e3359276282c6e4a64d07ce607c251
tree35e2a8b77225ab46bc0bdd89edf565b8cd00218c
parent1e957e754a2003930b7e044e02ab76fd79923f38
Strings Ending in Backslash are Improperly Lexed

Using greedy match for SUB_STRING fragment's forward lookahead
is troublesome because it will consume all non-double-quotes
until the final one -- including any escapes present.

This patch fixes the lexer to use non-greedy subrule, so that
escapes are properly accounted for.

JIRA: YANGTOOLS-971
Change-Id: Ic93c5c2bfa807001735125bd0367c29a1a25ea99
Signed-off-by: Danielle Mustillo <danielle.mustillo@ericsson.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e307e3f6893f94bc0a6b3fac094270f3e206eef2)
yang/yang-parser-rfc7950/src/main/antlr/YangStatementLexer.g4
yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/YT971Test.java [new file with mode: 0644]
yang/yang-parser-rfc7950/src/test/resources/bugs/YT971/test.yang [new file with mode: 0644]