@@ -302,17 +302,6 @@ END is the point after the token."
302302 '(" get" " set" " willSet" " didSet" " subscript" " init" " deinit" ))
303303 t )
304304
305- ; ; Suppress implicit semicolon after keywords that behave like method
306- ; ; names.
307- ; ;
308- ; ; Note that binary operators take precedence over this:
309- ; ;
310- ; ; self . // not insert semicolon here
311- ; ; init
312- ((member (swift-mode:token:text previous-token)
313- '(" set" " willSet" " didSet" " subscript" " init" " deinit" ))
314- nil )
315-
316305 ; ; Suppress implicit semicolon after declaration starters.
317306 ((member (swift-mode:token:text previous-token)
318307 '(" class" " struct" " protocol" " enum" " extension" " func"
@@ -341,6 +330,42 @@ END is the point after the token."
341330 (swift-mode:forward-token-simple)))
342331 " <" )))
343332
333+ ; ; Inserts semicolon before open curly bracket.
334+ ; ;
335+ ; ; Open curly bracket may continue the previous line, but we do not indent
336+ ; ; there. For example, the code below is parsed as `(foo() { x in ... })'
337+ ; ; by the Swift compiler, but we indent it like `foo(); { x in ... }'.
338+ ; ;
339+ ; ; foo()
340+ ; ; { // does not indent here
341+ ; ; x in
342+ ; ; ...
343+ ; ; }
344+ ((eq (swift-mode:token:type next-token) '\{ ) t )
345+
346+ ; ; Suppress implicit semicolon after keywords that behave like method
347+ ; ; names.
348+ ; ;
349+ ; ; Note that binary operators take precedence over this:
350+ ; ;
351+ ; ; self . // not insert semicolon here
352+ ; ; init
353+ ; ;
354+ ; ; var x {
355+ ; ; set // not insert semicolon here
356+ ; ; (x) {
357+ ; ; }
358+ ; ; }
359+ ; ;
360+ ; ; var x {
361+ ; ; set // inserts semicolon here
362+ ; ; {
363+ ; ; }
364+ ; ; }
365+ ((member (swift-mode:token:text previous-token)
366+ '(" set" " willSet" " didSet" " subscript" " init" " deinit" ))
367+ nil )
368+
344369 ; ; Inserts implicit semicolon before open square bracket.
345370 ; ;
346371 ; ; Open square bracket for array indexing cannot appear at the start of a
@@ -371,19 +396,6 @@ END is the point after the token."
371396 ; ; )
372397 ((eq (swift-mode:token:type next-token) '\( ) t )
373398
374- ; ; Inserts semicolon before open curly bracket.
375- ; ;
376- ; ; Open curly bracket may continue the previous line, but we do not indent
377- ; ; there. For example, the code below is parsed as `(foo() { x in ... })'
378- ; ; by the Swift compiler, but we indent it like `foo(); { x in ... }'.
379- ; ;
380- ; ; foo()
381- ; ; { // does not indent here
382- ; ; x in
383- ; ; ...
384- ; ; }
385- ((eq (swift-mode:token:type next-token) '\{ ) t )
386-
387399 ; ; Otherwise, inserts implicit semicolon.
388400 (t t ))))
389401
0 commit comments