[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 164b77e 205/405: Unit test for alternative co
From: |
Stefan Monnier |
Subject: |
[elpa] externals/phps-mode 164b77e 205/405: Unit test for alternative control syntax passes with new algorithm |
Date: |
Sat, 13 Jul 2019 10:00:13 -0400 (EDT) |
branch: externals/phps-mode
commit 164b77e1ed169840562ccb677eccd584ebd46c47
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Unit test for alternative control syntax passes with new algorithm
---
phps-mode-functions.el | 57 +++++++++++++++++++--------------------------
phps-mode-test-functions.el | 4 ----
2 files changed, 24 insertions(+), 37 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index d54953c..c8d60e4 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -203,12 +203,15 @@
;; (message "Found ending alternative token %s %s" token
alternative-control-structure-level)
(when (equal token 'T_ENDSWITCH)
+
+ ;; Decrement end switch with two points
(setq allow-custom-column-decrement t)
(setq alternative-control-structure-level (1-
alternative-control-structure-level)))
(when first-token-on-line
(setq first-token-is-nesting-decrease t)))
+ ;; When we encounter a token except () after a
control-structure
(when (and after-special-control-structure
(= after-special-control-structure
round-bracket-level)
(not (string= token ")"))
@@ -231,44 +234,29 @@
(if (string= token ":")
(progn
- ;; Alternative syntax for control structures here
- (if (or (equal
after-special-control-structure-token 'T_ELSE)
- (equal
after-special-control-structure-token 'T_ELSEIF)
- (equal
after-special-control-structure-token 'T_DEFAULT))
- (progn
- (setq line-contained-nesting-increase t)
- (when
after-special-control-structure-first-on-line
-<<<<<<< HEAD
- (setq alternative-control-structure-level
(1+ alternative-control-structure-level))))
-=======
- (setq first-token-is-nesting-decrease t)))
->>>>>>> 2d4646f2f1e8faf4a79f6b36f30140c233592430
-
- (when (equal
after-special-control-structure-token 'T_SWITCH)
- (setq alternative-control-structure-level (1+
alternative-control-structure-level))
- (setq allow-custom-column-increment t))
-<<<<<<< HEAD
+ (when (equal after-special-control-structure-token
'T_SWITCH)
(setq alternative-control-structure-level (1+
alternative-control-structure-level))
- (setq line-contained-nesting-increase t)
- (when
after-special-control-structure-first-on-line
- (setq first-token-is-nesting-increase t))))
+ (setq allow-custom-column-increment t))
-=======
+ (setq alternative-control-structure-level (1+
alternative-control-structure-level))
- (setq alternative-control-structure-level (1+
alternative-control-structure-level))
- (setq line-contained-nesting-increase t)
- (when
after-special-control-structure-first-on-line
- (setq first-token-is-nesting-increase t))))
+ (when phps-mode-functions-verbose
+ (message "\nIncreasing
alternative-control-structure after %s %s to %s\n"
after-special-control-structure-token token
alternative-control-structure-level))
+
+ (setq line-contained-nesting-increase t)
+ (when after-special-control-structure-first-on-line
+ (setq first-token-is-nesting-increase t)))
->>>>>>> 2d4646f2f1e8faf4a79f6b36f30140c233592430
- ;; (message "Started inline control-structure after %s
at %s" after-special-control-structure-token token)
- (setq in-inline-control-structure t)
- (setq temp-pre-indent (1+ column-level))))
+ (when phps-mode-functions-verbose
+ (message "\nStarted inline control-structure after
%s at %s\n" after-special-control-structure-token token))
- (setq after-special-control-structure nil)
- (setq after-special-control-structure-token nil)
- (setq after-special-control-structure-first-on-line nil)))
+ (setq in-inline-control-structure t)
+ (setq temp-pre-indent (1+ column-level))))
+
+ (setq after-special-control-structure nil)
+ (setq after-special-control-structure-token nil)
+ (setq after-special-control-structure-first-on-line nil)))
;; Support extra special control structures (CASE)
(when (and after-extra-special-control-structure
@@ -305,7 +293,10 @@
nesting-stack
(string= (car (cdr (cdr (car nesting-stack))))
":"))
- (setq alternative-control-structure-level (1-
alternative-control-structure-level)))
+ (setq alternative-control-structure-level (1-
alternative-control-structure-level))
+ (when phps-mode-functions-verbose
+ (message "\nDecreasing alternative control structure
nesting at %s to %s\n" token alternative-control-structure-level))
+ )
)
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index ef110cc..f21aae3 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -112,7 +112,6 @@
)
-<<<<<<< HEAD
(defun phps-mode-test-functions-get-lines-indent-multi-line-assignments ()
"Test for multi-line assignments."
@@ -146,11 +145,8 @@
;; (message "Tokens: %s" phps-mode-lexer-tokens)
(should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (1 0)) (5 (1 0)) (6 (1
0)) (7 (1 0)) (8 (1 0))) (phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
-
)
-=======
->>>>>>> 2d4646f2f1e8faf4a79f6b36f30140c233592430
(defun phps-mode-test-functions-get-lines-indent-inline-if ()
"Test for inline if indentations."
- [elpa] externals/phps-mode d7c5f67 190/405: More work on nesting-stack, (continued)
- [elpa] externals/phps-mode d7c5f67 190/405: More work on nesting-stack, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 253839f 170/405: Added indentation unit tests for concatenated strings outside assignments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e38794b0 197/405: More conceptual work on algorithm for inline control structures, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 9db28d9 185/405: Added verbose flag for unit tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 2a1ed52 196/405: Optimized algorithm for indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode a30c3f6 177/405: More work on indentation tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode e8a8d41 204/405: Merged remote changes, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode faa4e00 201/405: Started on conceptually describing algorithm for multi-line assignment indentation, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 874701d 195/405: Work on alternative and inline control structure syntax with new algorithm, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ec69d07 193/405: Added a failing class declaration indentation case, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 164b77e 205/405: Unit test for alternative control syntax passes with new algorithm,
Stefan Monnier <=
- [elpa] externals/phps-mode e8658c8 192/405: New indentation algorithm now passes class unit tests, started on indentation document, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode ba9d8a0 199/405: More organization of tests, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 86404c8 207/405: New algorithm now passes tests for alternative control structure, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8b4c188 188/405: Now able to detect indent change of scope with same nesting level, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 91715f6 217/405: Added another test for multi-line function arguments, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 75c4af4 214/405: Fixed indentation for lines wrapped in scripting open/close, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode d754163 221/405: More work on multi-line token-less lines, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8947e6e 202/405: Conceptual work on indentation-calculation for multi-line assignment, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode fc2e8b7 212/405: Added logic to indent token-less lines as well, Stefan Monnier, 2019/07/13
- [elpa] externals/phps-mode 8707777 237/405: Updated README, Stefan Monnier, 2019/07/13