Repository: groovy Updated Branches: refs/heads/master 8545fed53 -> 9ae7fa9b0
GROOVY-8853: string literal can span rows Project: http://git-wip-us.apache.org/repos/asf/groovy/repo Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/9ae7fa9b Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/9ae7fa9b Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/9ae7fa9b Branch: refs/heads/master Commit: 9ae7fa9b012e97671cc59a013d552894e81d4518 Parents: 8545fed Author: Daniel Sun <sun...@apache.org> Authored: Sun Oct 21 01:27:19 2018 +0800 Committer: Daniel Sun <sun...@apache.org> Committed: Sun Oct 21 01:27:19 2018 +0800 ---------------------------------------------------------------------- src/antlr/GroovyLexer.g4 | 4 ++-- .../org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy | 2 ++ .../parser-antlr4/src/test/resources/fail/String_03.groovy | 2 ++ .../parser-antlr4/src/test/resources/fail/String_04.groovy | 2 ++ 4 files changed, 8 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/groovy/blob/9ae7fa9b/src/antlr/GroovyLexer.g4 ---------------------------------------------------------------------- diff --git a/src/antlr/GroovyLexer.g4 b/src/antlr/GroovyLexer.g4 index 097dd4c..41ba5a7 100644 --- a/src/antlr/GroovyLexer.g4 +++ b/src/antlr/GroovyLexer.g4 @@ -300,14 +300,14 @@ mode DEFAULT_MODE; // character in the double quotation string. e.g. "a" fragment DqStringCharacter - : ~["\\$] + : ~["\r\n\\$] | EscapeSequence ; // character in the single quotation string. e.g. 'a' fragment SqStringCharacter - : ~['\\] + : ~['\r\n\\] | EscapeSequence ; http://git-wip-us.apache.org/repos/asf/groovy/blob/9ae7fa9b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy ---------------------------------------------------------------------- diff --git a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy index 7cc868d..04b5b95 100644 --- a/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy +++ b/subprojects/parser-antlr4/src/test/groovy/org/apache/groovy/parser/antlr4/SyntaxErrorTest.groovy @@ -224,6 +224,8 @@ class SyntaxErrorTest extends GroovyTestCase { void "test groovy core - String"() { TestUtils.doRunAndShouldFail('fail/String_01x.groovy') TestUtils.doRunAndShouldFail('fail/String_02x.groovy') + TestUtils.shouldFail('fail/String_03.groovy') + TestUtils.shouldFail('fail/String_04.groovy') } void "test groovy core - NonStaticClass"() { http://git-wip-us.apache.org/repos/asf/groovy/blob/9ae7fa9b/subprojects/parser-antlr4/src/test/resources/fail/String_03.groovy ---------------------------------------------------------------------- diff --git a/subprojects/parser-antlr4/src/test/resources/fail/String_03.groovy b/subprojects/parser-antlr4/src/test/resources/fail/String_03.groovy new file mode 100644 index 0000000..da41ab8 --- /dev/null +++ b/subprojects/parser-antlr4/src/test/resources/fail/String_03.groovy @@ -0,0 +1,2 @@ +def a = 'a + ' \ No newline at end of file http://git-wip-us.apache.org/repos/asf/groovy/blob/9ae7fa9b/subprojects/parser-antlr4/src/test/resources/fail/String_04.groovy ---------------------------------------------------------------------- diff --git a/subprojects/parser-antlr4/src/test/resources/fail/String_04.groovy b/subprojects/parser-antlr4/src/test/resources/fail/String_04.groovy new file mode 100644 index 0000000..5769948 --- /dev/null +++ b/subprojects/parser-antlr4/src/test/resources/fail/String_04.groovy @@ -0,0 +1,2 @@ +def a = "a + " \ No newline at end of file