IDEA-114427 Using $this in GString marked as invalid (Identifier or code block expected)

This commit is contained in:
Max Medvedev
2013-10-22 17:43:07 +04:00
parent b783e1e007
commit c13aacf9a8
5 changed files with 728 additions and 711 deletions
File diff suppressed because it is too large Load Diff
@@ -22,8 +22,6 @@ import java.util.*;
%%
%{@SuppressWarnings({"UnnecessaryFullyQualifiedName", "FieldCanBeLocal", "UnusedDeclaration", "UnusedAssignment", "AccessStaticViaInstance",
"AssignmentToStaticFieldFromInstanceMethod", "MethodMayBeStatic", "CStyleArrayDeclaration", "UnnecessarySemicolon"}) %}
%class _GroovyLexer
%implements FlexLexer, GroovyTokenTypes, TokenType
%unicode
@@ -143,10 +143,10 @@ public class CompoundStringExpression implements GroovyElementTypes {
final PsiBuilder.Marker injection = myBuilder.mark();
ParserUtils.getToken(myBuilder, mDOLLAR);
if (mIDENT.equals(myBuilder.getTokenType())) {
if (myBuilder.getTokenType() == mIDENT || myBuilder.getTokenType() == kTHIS) {
PathExpression.parse(myBuilder, myParser);
}
else if (mLCURLY.equals(myBuilder.getTokenType())) {
else if (myBuilder.getTokenType() == mLCURLY) {
OpenOrClosableBlock.parseClosableBlock(myBuilder, myParser);
}
else {
@@ -148,6 +148,8 @@ public class ExpressionsParsingTest extends GroovyParsingTestCase {
public void testgstring$ugly_lexer() throws Throwable { doTest(); }
public void testgstring$this() {doTest()}
public void testmapLiteral() throws Throwable { doTest(); }
public void testnew$arr_decl() throws Throwable { doTest(); }
@@ -0,0 +1,19 @@
print "abc $this.prop test"
-----
Groovy script
Call expression
Reference expression
PsiElement(identifier)('print')
PsiWhiteSpace(' ')
Command arguments
Compound Gstring
PsiElement(Gstring begin)('"')
GrStringContentImpl(GString content element)
PsiElement(Gstring content)('abc ')
GString injection
PsiElement($)('$')
Reference expression
PsiElement(this)('this')
GrStringContentImpl(GString content element)
PsiElement(Gstring content)('.prop test')
PsiElement(Gstring end)('"')