mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
keywords are not name-elements in command-expressions
This commit is contained in:
+1
@@ -142,6 +142,7 @@ public class ExpressionStatement implements GroovyElementTypes {
|
||||
|
||||
private static GroovyElementType namePartParse(PsiBuilder builder, GroovyParser parser) {
|
||||
if (BINARY_OP_SET.contains(builder.getTokenType())) return WRONGWAY;
|
||||
if (KEYWORDS.contains(builder.getTokenType())) return WRONGWAY;
|
||||
final GroovyElementType type = PathExpression.namePartParse(builder, parser);
|
||||
if (type == WRONGWAY && NUMBERS.contains(builder.getTokenType())) {
|
||||
builder.advanceLexer();
|
||||
|
||||
+1
@@ -278,6 +278,7 @@ public class ExpressionsParsingTest extends GroovyParsingTestCase {
|
||||
public void testcommandExpr$in() {doTest()}
|
||||
public void testcommandExpr$as() {doTest()}
|
||||
public void testcommandExpr$arrayAccess() {doTest()}
|
||||
public void testcommandExpr$keywords() {doTest()}
|
||||
|
||||
public void testDiamond() {doTest()}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
if (true) print "foo" else print "bar"
|
||||
-----
|
||||
Groovy script
|
||||
IF statement
|
||||
PsiElement(if)('if')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(()('(')
|
||||
Literal
|
||||
PsiElement(true)('true')
|
||||
PsiElement())(')')
|
||||
PsiWhiteSpace(' ')
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('print')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Literal
|
||||
PsiElement(Gstring)('"foo"')
|
||||
PsiWhiteSpace(' ')
|
||||
PsiElement(else)('else')
|
||||
PsiWhiteSpace(' ')
|
||||
Call expression
|
||||
Reference expression
|
||||
PsiElement(identifier)('print')
|
||||
PsiWhiteSpace(' ')
|
||||
Command arguments
|
||||
Literal
|
||||
PsiElement(Gstring)('"bar"')
|
||||
Reference in New Issue
Block a user