emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/swift-mode fd228c0 203/496: Improve lexer rule for disctin


From: ELPA Syncer
Subject: [nongnu] elpa/swift-mode fd228c0 203/496: Improve lexer rule for disctinction between case in switch and enum
Date: Sun, 29 Aug 2021 11:33:36 -0400 (EDT)

branch: elpa/swift-mode
commit fd228c0c9e821c55b4c4b08438806c4fcdfc27b5
Author: ap4y <lod@pisem.net>
Commit: ap4y <lod@pisem.net>

    Improve lexer rule for disctinction between case in switch and enum
    statements
---
 swift-mode.el | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/swift-mode.el b/swift-mode.el
index 5c6a106..3d6881b 100644
--- a/swift-mode.el
+++ b/swift-mode.el
@@ -147,8 +147,9 @@
        (op-exp (exp "OP" exp))
        (tern-exp (op-exp "?" exp ":" exp))
 
-       (enum-cases (assign-exp)
-                   (enum-cases ";" "ecase" enum-cases))
+       (enum-case ("ecase" assign-exp)
+                  ("ecase" "(" type ")"))
+       (enum-cases (enum-case) (enum-case ";" enum-case))
        (enum-body (enum-cases) (insts))
 
        (case-exps (exp) (guard-exp))
@@ -257,7 +258,7 @@
    (t (let ((tok (smie-default-forward-token)))
         (cond
          ((equal tok "case")
-          (if (looking-at ".+\\(,\\|:\\)")
+          (if (looking-at ".+\\(where.*[,]\\|:\\)")
               "case"
             "ecase"))
          (t tok))))
@@ -300,7 +301,7 @@
      (t (let ((tok (smie-default-backward-token)))
           (cond
            ((equal tok "case")
-            (if (looking-at ".+\\(,\\|:\\)")
+            (if (looking-at ".+\\(where.*[,]\\|:\\)")
                 "case"
               "ecase"))
            (t tok))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]