branch: externals/phps-mode
commit 105fecec7230a46e75b43ab5d5e1ac3355762fae
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
New indent calculation for inline syntax passes test
---
phps-mode-functions.el | 2 +-
phps-mode-test-functions.el | 13 +++++++------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index badc339..64d93af 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -200,7 +200,7 @@
(equal after-special-control-structure-token
'T_ELSEIF))
(progn
(when after-special-control-structure-first-on-line
- (setq first-token-is-nesting-decrease t)))
+ (setq first-token-is-nesting-increase t)))
(message "Was inline-control structure %s %s"
after-special-control-structure-token token)
(setq inline-control-structure-level (1+
inline-control-structure-level))
(when after-special-control-structure-first-on-line
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index f5f0536..549d727 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -49,26 +49,27 @@
"Test `phps-mode-functions-get-lines-indent' function."
(phps-mode-test-with-buffer
- "<html><head><title><?php\nif ($myCondition) {\nif ($mySeconCondition)
{\necho $title;\n}\n} ?></title><body>Bla bla</body></html>"
+ "<html><head><title><?php\nif ($myCondition) {\n if ($mySeconCondition)
{\n echo $title;\n } else {\n echo $title2;\n echo
$title3;\n }\n} ?></title><body>Bla bla</body></html>"
"Mixed HTML/PHP"
- (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (0
0))) (phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
+ (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (2 0)) (5 (1 0)) (6 (2
0)) (7 (2 0)) (8 (1 0)) (9 (0 0))) (phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
(phps-mode-test-with-buffer
- "<?php\nif (true):\n echo 'Something';\nelse:\n echo 'Something
else';\nendif;\necho true;\n"
+ "<?php\nif (true):\n echo 'Something';\nelse:\n echo 'Something
else';\n 'Something else again';\nendif;\necho true;\n"
"Alternative control structures"
- ;; (message "Tokens: %s" phps-mode-lexer-tokens)
- (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0
0)) (7 (0 0))) (phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
+ (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (1
0)) (7 (0 0)) (8 (0 0))) (phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
(phps-mode-test-with-buffer
"<?php\nif (true)\n echo 'Something';\nelse\n echo 'Something
else';\necho true;\n"
"Inline control structures"
- (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0
1))) (phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
+ (should (equal '((1 (0 0)) (2 (0 0)) (3 (1 0)) (4 (0 0)) (5 (1 0)) (6 (0
0))) (phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
(phps-mode-test-with-buffer
"<?php\n/**\n* Bla\n*/"
"DOC-COMMENT"
(should (equal '((1 (0 0)) (2 (0 0)) (3 (0 1)))
(phps-mode-test-functions--hash-to-list
(phps-mode-functions-get-lines-indent)))))
+ ;; TODO round and square bracket expressions
+
;; TODO CASE, DEFAULT
;; TODO NOWDOC, HEREDOC