[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/swift-mode 773219a 142/496: Treat default clause for case
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/swift-mode 773219a 142/496: Treat default clause for case statement as a whole with colon in bnf |
Date: |
Sun, 29 Aug 2021 11:33:24 -0400 (EDT) |
branch: elpa/swift-mode
commit 773219a11063af8bb2b9af2ac7c2406247bdddbd
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>
Treat default clause for case statement as a whole with colon in bnf
grammar
This commit removes ambiguity from case statement grammars, it seems default
lexer parses this statement as a whole. Also improved tests for case
statements to actually catch related bug.
fixes #48
---
swift-mode.el | 4 ++--
test/indentation-tests.el | 16 ++++++++++++----
2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/swift-mode.el b/swift-mode.el
index f16fbe9..dbcc0ca 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -140,7 +140,7 @@
(case-exps (guard-exp))
(cases (case-exps ":" insts)
(cases "case" cases))
- (switch-body (cases) (cases "default" insts))
+ (switch-body (cases) (cases "default:" insts))
(for-head (in-exp) (op-exp) (for-head ";" for-head))
@@ -269,7 +269,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" "default:")
(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 f958732..bb5286b 100644
--- a/test/indentation-tests.el
+++ b/test/indentation-tests.el
@@ -354,13 +354,17 @@ case y:
"
{
switch true {
-|default
+ case y:
+ x
+|default:
}
}
" "
{
switch true {
- |default
+ case y:
+ x
+ |default:
}
}
")
@@ -369,13 +373,17 @@ case y:
"
{
switch true {
- |default
+ case y:
+ x
+ |default:
}
}
" "
{
switch true {
- |default
+ case y:
+ x
+ |default:
}
}
")
- [nongnu] elpa/swift-mode 48cbf55 088/496: Extend a bit installation instructions for package.el, (continued)
- [nongnu] elpa/swift-mode 48cbf55 088/496: Extend a bit installation instructions for package.el, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 7e77211 087/496: Remove redundant autoload, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode a092adc 091/496: Return default paragraph definitions., ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode c9c1271 089/496: Make flycheck work with multiple sources, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 4ac4ea3 098/496: Add font-lock for declaration expression with destructuring, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 6abb788 121/496: Add keywords header, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 07780b4 118/496: Merge pull request #30 from ap4y/syntactic_fontification, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 18ea989 134/496: Merge pull request #42 from ap4y/customizable_multiline_dot_statement, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode d42c53c 147/496: Use semantic smie function instead of regex for multi-line dot, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 34f0c95 152/496: Correct source argument extraction in flycheck checker, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 773219a 142/496: Treat default clause for case statement as a whole with colon in bnf,
ELPA Syncer <=
- [nongnu] elpa/swift-mode d7b13b0 150/496: Convert targeted sdk flycheck option from list to string, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode b0fea47 168/496: Fix eval-after-load problems when byte-compiled., ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode e859716 176/496: Merge pull request #75 from ap4y/test_against_24_4, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode f2b923e 178/496: Improve case statement grammar, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 75aa277 188/496: Add separate lexer rule for return type arrow symbol "->", prevent, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 1c4253b 191/496: Improve indentation for nested hash/array statements, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode ebc60c8 197/496: Make closure block in function argument close at the offset 0, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 4bdbc23 211/496: Normalize indentation for function declration with argument list on the, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode cf219aa 217/496: Improve indentation of the nested arrays and dictionaries, ELPA Syncer, 2021/08/29
- [nongnu] elpa/swift-mode 655bd60 229/496: Fix indent in trailing closure, ELPA Syncer, 2021/08/29