@@ -813,14 +813,14 @@ extension Parser {
813813
814814 // Check for a [expr] suffix.
815815 // Note that this cannot be the start of a new line.
816- if let lsquare = self . consume ( if: TokenSpec ( . leftSquareBracket , allowAtStartOfLine: false ) ) {
816+ if let lsquare = self . consume ( if: TokenSpec ( . leftSquare , allowAtStartOfLine: false ) ) {
817817 let args : [ RawTupleExprElementSyntax ]
818- if self . at ( . rightSquareBracket ) {
818+ if self . at ( . rightSquare ) {
819819 args = [ ]
820820 } else {
821821 args = self . parseArgumentListElements ( pattern: pattern)
822822 }
823- let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquareBracket )
823+ let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquare )
824824
825825 // If we can parse trailing closures, do so.
826826 let trailingClosure : RawClosureExprSyntax ?
@@ -1053,26 +1053,26 @@ extension Parser {
10531053 while loopCondition. evaluate ( currentToken) {
10541054 // Check for a [] or .[] suffix. The latter is only permitted when there
10551055 // are no components.
1056- if self . at ( TokenSpec ( . leftSquareBracket , allowAtStartOfLine: false ) )
1057- || ( components. isEmpty && self . at ( . period) && self . peek ( ) . rawTokenKind == . leftSquareBracket )
1056+ if self . at ( TokenSpec ( . leftSquare , allowAtStartOfLine: false ) )
1057+ || ( components. isEmpty && self . at ( . period) && self . peek ( ) . rawTokenKind == . leftSquare )
10581058 {
10591059 // Consume the '.', if it's allowed here.
10601060 let period : RawTokenSyntax ?
1061- if !self . at ( . leftSquareBracket ) {
1061+ if !self . at ( . leftSquare ) {
10621062 period = self . consumeAnyToken ( )
10631063 } else {
10641064 period = nil
10651065 }
10661066
1067- precondition ( self . at ( . leftSquareBracket ) )
1067+ precondition ( self . at ( . leftSquare ) )
10681068 let lsquare = self . consumeAnyToken ( )
10691069 let args : [ RawTupleExprElementSyntax ]
1070- if self . at ( . rightSquareBracket ) {
1070+ if self . at ( . rightSquare ) {
10711071 args = [ ]
10721072 } else {
10731073 args = self . parseArgumentListElements ( pattern: pattern)
10741074 }
1075- let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquareBracket )
1075+ let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquare )
10761076
10771077 components. append (
10781078 RawKeyPathComponentSyntax (
@@ -1335,7 +1335,7 @@ extension Parser {
13351335 // element without label.
13361336 return RawExprSyntax ( self . parseTupleExpression ( pattern: pattern) )
13371337
1338- case ( . leftSquareBracket , _) ? :
1338+ case ( . leftSquare , _) ? :
13391339 return self . parseCollectionLiteral ( )
13401340
13411341 case nil :
@@ -1637,17 +1637,17 @@ extension Parser {
16371637 return RawExprSyntax (
16381638 RawArrayExprSyntax (
16391639 remainingTokens,
1640- leftSquare: missingToken ( . leftSquareBracket ) ,
1640+ leftSquare: missingToken ( . leftSquare ) ,
16411641 elements: RawArrayElementListSyntax ( elements: [ ] , arena: self . arena) ,
1642- rightSquare: missingToken ( . rightSquareBracket ) ,
1642+ rightSquare: missingToken ( . rightSquare ) ,
16431643 arena: self . arena
16441644 )
16451645 )
16461646 }
16471647
1648- let ( unexpectedBeforeLSquare, lsquare) = self . expect ( . leftSquareBracket )
1648+ let ( unexpectedBeforeLSquare, lsquare) = self . expect ( . leftSquare )
16491649
1650- if let rsquare = self . consume ( if: . rightSquareBracket ) {
1650+ if let rsquare = self . consume ( if: . rightSquare ) {
16511651 return RawExprSyntax (
16521652 RawArrayExprSyntax (
16531653 unexpectedBeforeLSquare,
@@ -1659,7 +1659,7 @@ extension Parser {
16591659 )
16601660 }
16611661
1662- if let ( colon, rsquare) = self . consume ( if: . colon, followedBy: . rightSquareBracket ) {
1662+ if let ( colon, rsquare) = self . consume ( if: . colon, followedBy: . rightSquare ) {
16631663 // FIXME: We probably want a separate node for the empty case.
16641664 return RawExprSyntax (
16651665 RawDictionaryExprSyntax (
@@ -1713,12 +1713,12 @@ extension Parser {
17131713 // If we saw a comma, that's a strong indicator we have more elements
17141714 // to process. If that's not the case, we have to do some legwork to
17151715 // determine if we should bail out.
1716- guard comma == nil || self . at ( . rightSquareBracket , . eof) else {
1716+ guard comma == nil || self . at ( . rightSquare , . eof) else {
17171717 continue
17181718 }
17191719
17201720 // If we found EOF or the closing square bracket, bailout.
1721- if self . at ( . rightSquareBracket , . eof) {
1721+ if self . at ( . rightSquare , . eof) {
17221722 break
17231723 }
17241724
@@ -1732,7 +1732,7 @@ extension Parser {
17321732 }
17331733 }
17341734
1735- let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquareBracket )
1735+ let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquare )
17361736 switch elementKind! {
17371737 case . dictionary:
17381738 return RawExprSyntax (
@@ -1862,7 +1862,7 @@ extension Parser {
18621862 mutating func parseClosureSignatureIfPresent( ) -> RawClosureSignatureSyntax ? {
18631863 // If we have a leading token that may be part of the closure signature, do a
18641864 // speculative parse to validate it and look for 'in'.
1865- guard self . at ( . atSign, . leftParen, . leftSquareBracket ) || self . at ( . wildcard, . identifier) else {
1865+ guard self . at ( . atSign, . leftParen, . leftSquare ) || self . at ( . wildcard, . identifier) else {
18661866 // No closure signature.
18671867 return nil
18681868 }
@@ -1874,11 +1874,11 @@ extension Parser {
18741874 let attrs = self . parseAttributeList ( )
18751875
18761876 let captures : RawClosureCaptureSignatureSyntax ?
1877- if let lsquare = self . consume ( if: . leftSquareBracket ) {
1877+ if let lsquare = self . consume ( if: . leftSquare ) {
18781878 // At this point, we know we have a closure signature. Parse the capture list
18791879 // and parameters.
18801880 var elements = [ RawClosureCaptureItemSyntax] ( )
1881- if !self . at ( . rightSquareBracket ) {
1881+ if !self . at ( . rightSquare ) {
18821882 var keepGoing : RawTokenSyntax ? = nil
18831883 var loopProgress = LoopProgressCondition ( )
18841884 repeat {
@@ -1924,10 +1924,10 @@ extension Parser {
19241924 }
19251925 // We were promised a right square bracket, so we're going to get it.
19261926 var unexpectedNodes = [ RawSyntax] ( )
1927- while !self . at ( . eof) && !self . at ( . rightSquareBracket ) && !self . at ( . keyword( . in) ) {
1927+ while !self . at ( . eof) && !self . at ( . rightSquare ) && !self . at ( . keyword( . in) ) {
19281928 unexpectedNodes. append ( RawSyntax ( self . consumeAnyToken ( ) ) )
19291929 }
1930- let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquareBracket )
1930+ let ( unexpectedBeforeRSquare, rsquare) = self . expect ( . rightSquare )
19311931 unexpectedNodes. append ( contentsOf: unexpectedBeforeRSquare? . elements ?? [ ] )
19321932
19331933 captures = RawClosureCaptureSignatureSyntax (
@@ -2090,7 +2090,7 @@ extension Parser {
20902090 // follows a proper subexpression.
20912091 let expr : RawExprSyntax
20922092 if self . at ( . binaryOperator)
2093- && ( self . peek ( ) . rawTokenKind == . comma || self . peek ( ) . rawTokenKind == . rightParen || self . peek ( ) . rawTokenKind == . rightSquareBracket )
2093+ && ( self . peek ( ) . rawTokenKind == . comma || self . peek ( ) . rawTokenKind == . rightParen || self . peek ( ) . rawTokenKind == . rightSquare )
20942094 {
20952095 let ( ident, args) = self . parseDeclNameRef ( . operators)
20962096 expr = RawExprSyntax (
@@ -2246,7 +2246,7 @@ extension Parser.Lookahead {
22462246 TokenSpec ( . where) ,
22472247 TokenSpec ( . comma) :
22482248 return true
2249- case TokenSpec ( . leftSquareBracket ) ,
2249+ case TokenSpec ( . leftSquare ) ,
22502250 TokenSpec ( . leftParen) ,
22512251 TokenSpec ( . period) ,
22522252 TokenSpec ( . is) ,
@@ -2679,9 +2679,9 @@ extension Parser.Lookahead {
26792679 }
26802680
26812681 // Skip by a closure capture list if present.
2682- if lookahead. consume ( if: . leftSquareBracket ) != nil {
2683- lookahead. skipUntil ( . rightSquareBracket , . rightSquareBracket )
2684- if lookahead. consume ( if: . rightSquareBracket ) == nil {
2682+ if lookahead. consume ( if: . leftSquare ) != nil {
2683+ lookahead. skipUntil ( . rightSquare , . rightSquare )
2684+ if lookahead. consume ( if: . rightSquare ) == nil {
26852685 return false
26862686 }
26872687 }
0 commit comments