@@ -528,7 +528,7 @@ Return nil otherwise." ;; FIXME pound-count
528528 ; ; Suppress implicit semicolon after declaration starters.
529529 ((member (swift-mode:token:text previous-token)
530530 '(" class" " struct" " protocol" " enum" " extension" " func"
531- " typealias" " associatedtype" " precedencegroup" " operator" ))
531+ " typealias" " associatedtype" " precedencegroup" " operator" ))
532532 nil )
533533
534534 ; ; Inserts implicit semicolon before declaration starters.
@@ -553,70 +553,70 @@ Return nil otherwise." ;; FIXME pound-count
553553 (swift-mode:forward-token-simple)))
554554 " <" )))
555555
556- ; ; Suppress implicit semicolon after keywords that behave like method
557- ; ; names.
558- ; ;
559- ; ; Note that binary operators take precedence over this:
560- ; ;
561- ; ; self . // not insert semicolon here
562- ; ; init
563- ; ;
564- ; ; var x {
565- ; ; set // not insert semicolon here
566- ; ; (x) {
567- ; ; }
568- ; ; }
569- ; ;
570- ; ; var x {
571- ; ; set // inserts semicolon here
572- ; ; {
573- ; ; }
574- ; ; }
575- ((member (swift-mode:token:text previous-token)
576- '(" set" " willSet" " didSet" " subscript" " init" " deinit" ))
577- nil )
578-
579- ; ; Inserts implicit semicolon before open square bracket.
580- ; ;
581- ; ; Open square bracket for array indexing cannot appear at the start of a
582- ; ; line.
583- ; ; https://github.com/apple/swift/blob/8d4b1cc3c47c7624d57f188d5b227152ccb03163/lib/Parse/ParseExpr.cpp#L1525
584- ; ;
585- ; ; Note that the following pattern (i.e. after binary-operator) is handled
586- ; ; by above case.
587- ; ;
588- ; ; let x =
589- ; ; [
590- ; ; 1
591- ; ; ]
592- ((eq (swift-mode:token:type next-token) '\[ ) t )
593-
594- ; ; Inserts implicit semicolon before open parenthesis, unless it is a
595- ; ; function parameter clause. Suppress implicit semicolon before function
596- ; ; parameter clause.
597- ; ;
598- ; ; Open parenthesis for function arguments cannot appear at the start of a
599- ; ; line.
600- ; ; https://github.com/apple/swift/blob/8d4b1cc3c47c7624d57f188d5b227152ccb03163/lib/Parse/ParseExpr.cpp#L1251
601- ; ;
602- ; ; Note that the following pattern (i.e. after binary-operator) is handled
603- ; ; by above case.
604- ; ;
605- ; ; let x =
606- ; ; (
607- ; ; 1
608- ; ; )
609- ((eq (swift-mode:token:type next-token) '\( )
610- (not (swift-mode:function-parameter-clause-p)))
611-
612- ; ; Suppress implicit semicolon after the beginning of an interpolated
613- ; ; expression.
614- ((eq (swift-mode:token:type previous-token)
615- 'string-chunk-before-interpolated-expression )
616- nil )
617-
618- ; ; Otherwise, inserts implicit semicolon.
619- (t t ))))
556+ ; ; Suppress implicit semicolon after keywords that behave like method
557+ ; ; names.
558+ ; ;
559+ ; ; Note that binary operators take precedence over this:
560+ ; ;
561+ ; ; self . // not insert semicolon here
562+ ; ; init
563+ ; ;
564+ ; ; var x {
565+ ; ; set // not insert semicolon here
566+ ; ; (x) {
567+ ; ; }
568+ ; ; }
569+ ; ;
570+ ; ; var x {
571+ ; ; set // inserts semicolon here
572+ ; ; {
573+ ; ; }
574+ ; ; }
575+ ((member (swift-mode:token:text previous-token)
576+ '(" set" " willSet" " didSet" " subscript" " init" " deinit" ))
577+ nil )
578+
579+ ; ; Inserts implicit semicolon before open square bracket.
580+ ; ;
581+ ; ; Open square bracket for array indexing cannot appear at the start of a
582+ ; ; line.
583+ ; ; https://github.com/apple/swift/blob/8d4b1cc3c47c7624d57f188d5b227152ccb03163/lib/Parse/ParseExpr.cpp#L1525
584+ ; ;
585+ ; ; Note that the following pattern (i.e. after binary-operator) is handled
586+ ; ; by above case.
587+ ; ;
588+ ; ; let x =
589+ ; ; [
590+ ; ; 1
591+ ; ; ]
592+ ((eq (swift-mode:token:type next-token) '\[ ) t )
593+
594+ ; ; Inserts implicit semicolon before open parenthesis, unless it is a
595+ ; ; function parameter clause. Suppress implicit semicolon before function
596+ ; ; parameter clause.
597+ ; ;
598+ ; ; Open parenthesis for function arguments cannot appear at the start of a
599+ ; ; line.
600+ ; ; https://github.com/apple/swift/blob/8d4b1cc3c47c7624d57f188d5b227152ccb03163/lib/Parse/ParseExpr.cpp#L1251
601+ ; ;
602+ ; ; Note that the following pattern (i.e. after binary-operator) is handled
603+ ; ; by above case.
604+ ; ;
605+ ; ; let x =
606+ ; ; (
607+ ; ; 1
608+ ; ; )
609+ ((eq (swift-mode:token:type next-token) '\( )
610+ (not (swift-mode:function-parameter-clause-p)))
611+
612+ ; ; Suppress implicit semicolon after the beginning of an interpolated
613+ ; ; expression.
614+ ((eq (swift-mode:token:type previous-token)
615+ 'string-chunk-before-interpolated-expression )
616+ nil )
617+
618+ ; ; Otherwise, inserts implicit semicolon.
619+ (t t ))))
620620
621621(defun swift-mode:function-parameter-clause-p ()
622622 " Return t if the cursor is before a function parameter clause.
0 commit comments