[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 5c31636 200/496: Treat default token as case to
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 5c31636 200/496: Treat default token as case token |
Date: |
Sun, 29 Aug 2021 11:33:35 -0400 (EDT) |
branch: elpa/swift-mode
commit 5c3163614333f8a46faca3c1aa63dbde8694620a
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>
Treat default token as case token
---
swift-mode.el | 13 +++++++++----
test/indentation-tests.el | 21 +++++++++++++++++++++
2 files changed, 30 insertions(+), 4 deletions(-)
diff --git a/swift-mode.el b/swift-mode.el
index 8b68c54..6e5498f 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -152,9 +152,8 @@
(enum-body (enum-cases) (insts))
(case-exps (exp) (guard-exp))
- (cases (case-exps ":" insts)
- (cases "case" cases))
- (switch-body (cases) (cases "default:" insts))
+ (case (case-exps ":" insts))
+ (switch-body (case) (case "case" case))
(for-head (in-exp) (op-exp) (for-head ";" for-head))
@@ -252,6 +251,9 @@
((looking-at swift-smie--access-modifier-regexp)
(goto-char (match-end 0)) "ACCESSMOD")
+ ((looking-at "default")
+ (goto-char (match-end 0)) "case")
+
(t (let ((tok (smie-default-forward-token)))
(cond
((equal tok "case")
@@ -292,6 +294,9 @@
((looking-back swift-smie--access-modifier-regexp (- (point) 8) t)
(goto-char (match-beginning 0)) "ACCESSMOD")
+ ((looking-back "default" (- (point) 7) t)
+ (goto-char (match-beginning 0)) "case")
+
(t (let ((tok (smie-default-backward-token)))
(cond
((equal tok "case")
@@ -321,7 +326,7 @@
(if (smie-rule-parent-p "switch")
(smie-rule-parent swift-indent-switch-case-offset)))
(`(:before . ";")
- (if (smie-rule-parent-p "case" "default:")
+ (if (smie-rule-parent-p "case")
(smie-rule-parent swift-indent-offset)))
;; Apply swift-indent-multiline-statement-offset only if
diff --git a/test/indentation-tests.el b/test/indentation-tests.el
index f048d14..6508ae0 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -388,6 +388,27 @@ case y:
}
")
+(check-indentation indents-statements-under-default-case/1
+ "
+{
+ switch true {
+ case y:
+ x
+ default:
+ |z
+ }
+}
+" "
+{
+ switch true {
+ case y:
+ x
+ default:
+ |z
+ }
+}
+")
+
(check-indentation indents-case-statements-with-destucturing/1
"
switch true {
- [nongnu] elpa/swift-mode 27b93dd 126/496: Merge pull request #34 from ap4y/string_interpolation_improvements, (continued)
- [nongnu] elpa/swift-mode 27b93dd 126/496: Merge pull request #34 from ap4y/string_interpolation_improvements, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c08c3a1 138/496: Define dot-exp smie rule as combination of ids rather than expressions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b5bfbe0 154/496: Don't active flycheck checker by default, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c73d653 151/496: Use correct function from cl-lib, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 67fd6a9 160/496: Fix indentation of multiline operator expressions, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 4b6d6f1 162/496: Add ckruse to the Acknowledgements in README, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 5675e1f 167/496: Merge pull request #65 from ckruse/fix_64, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 94d687d 173/496: Add required ELPA source, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 302e83d 194/496: Distinct generic type parameter from ">" operator when checking for, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 73cdda9 195/496: Don't put implicit semicolon after "(", ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 5c31636 200/496: Treat default token as case token,
ELPA Syncer <=
- [nongnu] elpa/swift-mode 4ab5f7f 201/496: Add implicit semicolon rule for ?? operator, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode fd228c0 203/496: Improve lexer rule for disctinction between case in switch and enum, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 1122ab9 204/496: Add grammar rule for return statement in function, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode f193a82 205/496: defcustom types for swift-indent was incorrectly set to intergerp, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode a60e3fa 209/496: Don't indent chain of operators multiple times, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e539ba6 215/496: Improve support for the multi-line case statements, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 95e753b 226/496: Disable testing against emacs 24.3, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e898e7e 234/496: Merge pull request #91 from uk-ar/fix-indent-with-hanging-operator-after-comment, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode a1d7a06 236/496: Merge pull request #88 from uk-ar/fix-indent-after-comment, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode fd9ed20 244/496: Modify indents around comma to meet Xcode spec, ELPA Syncer, 2021/08/29