@@ -1040,37 +1040,17 @@ object Parsers {
1040
1040
atSpan(accept(USCORE )) { Ident (nme.WILDCARD ) }
1041
1041
1042
1042
/** Accept identifier or match clause acting as a selector on given tree `t` */
1043
- def selector (t : Tree ): Tree =
1043
+ def selectorOrMatch (t : Tree ): Tree =
1044
1044
atSpan(startOffset(t), in.offset) {
1045
1045
if in.token == MATCH then matchClause(t) else Select (t, ident())
1046
1046
}
1047
1047
1048
- def idSelector (t : Tree ): Tree =
1048
+ def selector (t : Tree ): Tree =
1049
1049
atSpan(startOffset(t), in.offset) { Select (t, ident()) }
1050
1050
1051
- /** Selectors ::= id { `.' id }
1052
- *
1053
- * Accept `.' separated identifiers acting as a selectors on given tree `t`.
1054
- * @param finish An alternative parse in case the next token is not an identifier.
1055
- * If the alternative does not apply, its tree argument is returned unchanged.
1056
- */
1057
- def selectors (t : Tree , finish : Tree => Tree ): Tree = {
1058
- val t1 = finish(t)
1059
- if (t1 ne t) t1 else dotSelectors(selector(t), finish)
1060
- }
1061
-
1062
- /** DotSelectors ::= { `.' id }
1063
- *
1064
- * Accept `.' separated identifiers acting as a selectors on given tree `t`.
1065
- * @param finish An alternative parse in case the token following a `.' is not an identifier.
1066
- * If the alternative does not apply, its tree argument is returned unchanged.
1067
- */
1068
- def dotSelectors (t : Tree , finish : Tree => Tree = id): Tree =
1069
- if (in.token == DOT ) { in.nextToken(); selectors(t, finish) }
1070
- else t
1071
-
1072
- def dotSelections (t : Tree ): Tree =
1073
- if (in.token == DOT ) { in.nextToken(); dotSelections(t) }
1051
+ /** DotSelectors ::= { `.' id } */
1052
+ def dotSelectors (t : Tree ): Tree =
1053
+ if (in.token == DOT ) { in.nextToken(); dotSelectors(selector(t)) }
1074
1054
else t
1075
1055
1076
1056
private val id : Tree => Tree = x => x
@@ -1091,7 +1071,7 @@ object Parsers {
1091
1071
val mix = mixinQualifierOpt()
1092
1072
val t = atSpan(start) { Super (This (qual), mix) }
1093
1073
accept(DOT )
1094
- idSelector (t)
1074
+ selector (t)
1095
1075
1096
1076
if in.token == THIS then handleThis(EmptyTypeIdent )
1097
1077
else if in.token == SUPER then handleSuper(EmptyTypeIdent )
@@ -1623,7 +1603,7 @@ object Parsers {
1623
1603
in.nextToken()
1624
1604
atSpan(startOffset(t)) { SingletonTypeTree (t) }
1625
1605
else
1626
- singletonCompletion(idSelector (t))
1606
+ singletonCompletion(selector (t))
1627
1607
else convertToTypeId(t)
1628
1608
singletonCompletion(simpleRef())
1629
1609
}
@@ -2282,7 +2262,7 @@ object Parsers {
2282
2262
in.token match {
2283
2263
case DOT =>
2284
2264
in.nextToken()
2285
- simpleExprRest(selector (t), canApply = true )
2265
+ simpleExprRest(selectorOrMatch (t), canApply = true )
2286
2266
case LBRACKET =>
2287
2267
val tapp = atSpan(startOffset(t), in.offset) { TypeApply (t, typeArgs(namedOK = true , wildOK = false )) }
2288
2268
simpleExprRest(tapp, canApply = true )
@@ -2698,7 +2678,7 @@ object Parsers {
2698
2678
def simplePatternRest (t : Tree ): Tree =
2699
2679
if in.token == DOT then
2700
2680
in.nextToken()
2701
- simplePatternRest(idSelector (t))
2681
+ simplePatternRest(selector (t))
2702
2682
else
2703
2683
var p = t
2704
2684
if (in.token == LBRACKET )
0 commit comments