File tree 4 files changed +10
-9
lines changed
src/org/jetbrains/plugins/scala/lang/parser/parsing
testdata/parser/data/trailingcommas 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import org.jetbrains.plugins.scala.lang.parser.parsing.builder.ScalaPsiBuilder
10
10
import org .jetbrains .plugins .scala .lang .parser .parsing .top .ClassTemplate
11
11
import org .jetbrains .plugins .scala .lang .parser .parsing .types .{Path , TypeArgs }
12
12
import org .jetbrains .plugins .scala .lang .parser .parsing .xml .XmlExpr
13
+ import org .jetbrains .plugins .scala .lang .parser .util .ParserUtils
13
14
14
15
import scala .annotation .tailrec
15
16
@@ -100,7 +101,7 @@ trait SimpleExpr extends ParserNode with ScalaTokenTypes {
100
101
builder error ErrMsg (" wrong.expression" )
101
102
}
102
103
}
103
- if (builder.getTokenType == ScalaTokenTypes .tCOMMA) {
104
+ if (builder.getTokenType == ScalaTokenTypes .tCOMMA && ! ParserUtils .eatTrailingComma(builder, ScalaTokenTypes .tRPARENTHESIS) ) {
104
105
builder.advanceLexer()
105
106
isTuple = true
106
107
}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ package types
6
6
7
7
import org .jetbrains .plugins .scala .lang .lexer .ScalaTokenTypes
8
8
import org .jetbrains .plugins .scala .lang .parser .parsing .builder .ScalaPsiBuilder
9
+ import org .jetbrains .plugins .scala .lang .parser .util .ParserUtils
9
10
10
11
/**
11
12
* @author Alexander Podkhalyuzin
@@ -39,7 +40,7 @@ trait Types extends ParserNode {
39
40
return (false ,isTuple)
40
41
}
41
42
var exit = true
42
- while (exit && builder.getTokenType == ScalaTokenTypes .tCOMMA) {
43
+ while (exit && builder.getTokenType == ScalaTokenTypes .tCOMMA && ! ParserUtils .eatTrailingComma(builder, ScalaTokenTypes .tRPARENTHESIS) ) {
43
44
isTuple = true
44
45
builder.advanceLexer() // Ate ,
45
46
if (! typesParse) {
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ ScalaFile
84
84
PsiWhiteSpace(' ')
85
85
PsiElement(=)('=')
86
86
PsiWhiteSpace(' ')
87
- Tuple
87
+ ExpressionInParenthesis
88
88
PsiElement(()('(')
89
89
PsiWhiteSpace('\n ')
90
90
Literal
Original file line number Diff line number Diff line change @@ -70,16 +70,15 @@ ScalaFile
70
70
<empty list>
71
71
PsiElement(:)(':')
72
72
PsiWhiteSpace(' ')
73
- TupleType : (
73
+ TypeInParenthesis : (
74
74
Int,
75
75
)
76
76
PsiElement(()('(')
77
77
PsiWhiteSpace('\n ')
78
- TypesList
79
- SimpleType: Int
80
- CodeReferenceElement: Int
81
- PsiElement(identifier)('Int')
82
- PsiElement(,)(',')
78
+ SimpleType: Int
79
+ CodeReferenceElement: Int
80
+ PsiElement(identifier)('Int')
81
+ PsiElement(,)(',')
83
82
PsiWhiteSpace('\n ')
84
83
PsiElement())(')')
85
84
PsiWhiteSpace(' ')
You can’t perform that action at this time.
0 commit comments