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

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

[elpa] externals/phps-mode 3f08b86 128/405: Updated tracking of alternat


From: Stefan Monnier
Subject: [elpa] externals/phps-mode 3f08b86 128/405: Updated tracking of alternative control structures
Date: Sat, 13 Jul 2019 09:59:58 -0400 (EDT)

branch: externals/phps-mode
commit 3f08b8624b9c85a4db0ada30457706bd5a792d95
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Updated tracking of alternative control structures
---
 phps-mode-functions.el      | 10 ++++++----
 phps-mode-test-functions.el |  2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index bef38ea..ba99fa2 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -330,8 +330,9 @@
                           (equal token 'T_ENDFOR)
                           (equal token 'T_ENDFOREACH)
                           (equal token 'T_ENDSWITCH))
-                  
-                  (setq end-alternative-control-structure-level (- 
end-alternative-control-structure-level 1)))
+                  (when (= first-token-on-line end-token-number)
+                    (setq start-alternative-control-structure-level (1- 
start-alternative-control-structure-level)))
+                  (setq end-alternative-control-structure-level (1- 
end-alternative-control-structure-level)))
 
                 ;; Reduce inline control structure level when we encounter a 
semi-colon after it's opening
                 (when (and end-expecting-semi-colon
@@ -392,12 +393,13 @@
               (when (or
                      (equal token 'T_IF)
                      (equal token 'T_WHILE)
+                     (equal token 'T_CASE)
+                     (equal token 'T_DEFAULT)
                      (equal token 'T_FOR)
                      (equal token 'T_FOREACH)
                      (equal token 'T_SWITCH)
                      (equal token 'T_ELSE)
-                     (equal token 'T_ELSEIF)
-                     (equal token 'T_CASE))
+                     (equal token 'T_ELSEIF))
                 ;; (message "Found special control structure %s %s" token 
start-round-bracket-level)
                 (setq after-special-control-structure round-brace-level)
 
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 141ef33..986f0eb 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -375,7 +375,7 @@
   (phps-mode-test-with-buffer
    "<?php\nif ($myCondition):\n    echo 'was here';\nendif;\necho 'was here 
3';\n"
    (goto-char 52)
-   (should (equal (list (list t 0 0 0 0 1 8 nil) (list t 0 0 0 0 0 10 nil)) 
(phps-mode-functions-get-point-data))))
+   (should (equal (list (list t 0 0 0 0 0 8 nil) (list t 0 0 0 0 0 10 nil)) 
(phps-mode-functions-get-point-data))))
 
   (phps-mode-test-with-buffer
    "<?php\nif ($myCondition):    echo 'was here';\nendif;\necho 'was here 
4';\n"



reply via email to

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