[groovy] match new line escapes in single-double-quoted strings

IDEA-190625
This commit is contained in:
Daniil Ovchinnikov
2018-04-24 20:18:24 +03:00
parent df147405bc
commit 222c80066f
4 changed files with 1071 additions and 932 deletions
File diff suppressed because it is too large Load Diff
@@ -1,19 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.lexer;
import com.intellij.lexer.FlexLexer;
@@ -265,6 +250,7 @@ mGSTRING_LITERAL = {mDOUBLE_QUOTED_LITERAL} | {mTRIPLE_DOUBLE_QUOTED_LITERAL}
}
[^$\"\\\n\r]+ { return storeToken(mGSTRING_CONTENT); }
{mSTRING_ESC} { return storeToken(mGSTRING_CONTENT); }
\\. | \\ { return storeToken(mGSTRING_CONTENT); }
{mNLS} {
@@ -1,18 +1,4 @@
/*
* Copyright 2000-2017 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package org.jetbrains.plugins.groovy.lang.parser
/**
@@ -180,6 +166,8 @@ class ExpressionsParsingTest extends GroovyParsingTestCase {
void testgstring$this() { doTest() }
void testgstring$newline() { doTest() }
void testmapLiteral() throws Throwable { doTest() }
void testnew$arr_decl() throws Throwable { doTest() }
@@ -0,0 +1,16 @@
"This is not a multiline\
String, $name, but the continuation\
character (\\) makes it more readable."
-----
Groovy script
Compound Gstring
PsiElement(Gstring begin)('"')
GrStringContentImpl(GString content element)
PsiElement(Gstring content)('This is not a multiline\\nString, ')
GString injection
PsiElement($)('$')
Reference expression
PsiElement(identifier)('name')
GrStringContentImpl(GString content element)
PsiElement(Gstring content)(', but the continuation\\ncharacter (\\) makes it more readable.')
PsiElement(Gstring end)('"')