mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] process $$ before $ in dollar-slashy strings (IDEA-164748)
This commit is contained in:
+1163
-1164
File diff suppressed because it is too large
Load Diff
@@ -610,7 +610,7 @@ mGSTRING_LITERAL = \"\"
|
||||
}
|
||||
|
||||
<IN_DOLLAR_SLASH_REGEX> {
|
||||
"/""$" { if (!gStringStack.isEmpty()) {
|
||||
"/$" { if (!gStringStack.isEmpty()) {
|
||||
gStringStack.pop();
|
||||
}
|
||||
if (blockStack.isEmpty()){
|
||||
@@ -620,15 +620,19 @@ mGSTRING_LITERAL = \"\"
|
||||
}
|
||||
return GroovyTokenTypes.mDOLLAR_SLASH_REGEX_END; }
|
||||
|
||||
"$$" { return GroovyTokenTypes.mDOLLAR_SLASH_REGEX_CONTENT; }
|
||||
|
||||
"$" {
|
||||
yybegin(IN_DOLLAR_SLASH_REGEX_DOLLAR);
|
||||
return GroovyTokenTypes.mDOLLAR;
|
||||
}
|
||||
|
||||
{mDOLLAR_SLASH_REGEX_CONTENT}? "$"
|
||||
/[^"{"[:letter:]"_"] { return GroovyTokenTypes.mDOLLAR_SLASH_REGEX_CONTENT; }
|
||||
|
||||
"/" { return GroovyTokenTypes.mDOLLAR_SLASH_REGEX_CONTENT; }
|
||||
|
||||
{mDOLLAR_SLASH_REGEX_CONTENT} { return GroovyTokenTypes.mDOLLAR_SLASH_REGEX_CONTENT; }
|
||||
|
||||
"$" { yybegin(IN_DOLLAR_SLASH_REGEX_DOLLAR);
|
||||
return GroovyTokenTypes.mDOLLAR;}
|
||||
}
|
||||
|
||||
<IN_DOLLAR_SLASH_REGEX_DOLLAR> {
|
||||
|
||||
+3
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -352,6 +352,8 @@ class ExpressionsParsingTest extends GroovyParsingTestCase {
|
||||
|
||||
void testregex$dollarSlashy9() throws Throwable { doTest() }
|
||||
|
||||
void testregex$dollarSlashy10() { doTest() }
|
||||
|
||||
void testregex$dollarSlashyCode() throws Throwable { doTest() }
|
||||
|
||||
void testregex$dollarSlashyCodeUnfinished() throws Throwable { doTest() }
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
print($/$$/$)
|
||||
-----
|
||||
Groovy script
|
||||
Method call
|
||||
Reference expression
|
||||
PsiElement(identifier)('print')
|
||||
Arguments
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
GroovyASTPsiElementImpl($/ regex literal)
|
||||
PsiElement($/ regex begin)('$/')
|
||||
PsiElement($/ regex content)('$$')
|
||||
PsiElement($/ regex end)('/$')
|
||||
PsiElement())(')')
|
||||
Reference in New Issue
Block a user