branch: externals/phps-mode
commit b852f5fd1db23a1891f5655e17882852bfa5570d
Author: Christian Johansson <[email protected]>
Commit: Christian Johansson <[email protected]>
All tests for indentation passes
---
phps-mode-functions.el | 16 +++++++++-------
phps-mode-test-functions.el | 6 +++---
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index 022ef6b..d488712 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -122,7 +122,7 @@
(when first-token-is-nesting-increase
(setq column-level (1+ column-level))))
- (message "new line at %s, %s %s.%s (%s - %s) = %s %s %s %s
%s [%s %s] %s" token last-token column-level tuning-level nesting-start
nesting-end round-bracket-level square-bracket-level curly-bracket-level
alternative-control-structure-level inline-control-structure-level
first-token-is-nesting-decrease first-token-is-nesting-increase in-assignment)
+ ;; (message "new line at %s, %s %s.%s (%s - %s) = %s %s %s
%s %s [%s %s] %s" token last-token column-level tuning-level nesting-start
nesting-end round-bracket-level square-bracket-level curly-bracket-level
alternative-control-structure-level inline-control-structure-level
first-token-is-nesting-decrease first-token-is-nesting-increase in-assignment)
;; Put indent-level to hash-table
(when (> last-line-number 0)
@@ -302,19 +302,20 @@
(if (string= token ";")
(progn
(setq in-assignment nil)
- (message "Assignment ended at semi-colon"))
+ ;; (message "Assignment ended at semi-colon")
+ )
(when first-token-on-line
(if (or (equal token 'T_VARIABLE)
(equal token 'T_CONSTANT_ENCAPSED_STRING)
(equal token 'T_OBJECT_OPERATOR))
(progn
- (message "In assignment on new-line at %s" token)
+ ;; (message "In assignment on new-line at %s" token)
(setq in-assignment-on-new-line t))
- (message "Not in assignment on new-line at %s" token)
+ ;; (message "Not in assignment on new-line at %s" token)
(setq in-assignment-on-new-line nil)))))
(when (and (not after-special-control-structure)
(string= token "="))
- (message "Started assignment")
+ ;; (message "Started assignment")
(setq in-assignment t)
(setq in-assignment-on-new-line nil))
@@ -357,7 +358,8 @@
;; Is line ending indentation lesser than line beginning
indentation?
(when (and (< nesting-end nesting-start)
- (> column-level 0))
+ (> column-level 0)
+ (not in-assignment-on-new-line))
;; Decrement column
(if allow-custom-column-decrement
@@ -374,7 +376,7 @@
(when first-token-is-nesting-increase
(setq column-level (1+ column-level))))
- (message "last token at %s %s.%s (%s - %s) = %s %s %s %s %s [%s
%s]" last-token column-level tuning-level nesting-start nesting-end
round-bracket-level square-bracket-level curly-bracket-level
alternative-control-structure-level inline-control-structure-level
first-token-is-nesting-decrease first-token-is-nesting-increase)
+ ;; (message "last token at %s %s.%s (%s - %s) = %s %s %s %s %s [%s
%s]" last-token column-level tuning-level nesting-start nesting-end
round-bracket-level square-bracket-level curly-bracket-level
alternative-control-structure-level inline-control-structure-level
first-token-is-nesting-decrease first-token-is-nesting-increase)
;; Put indent-level to hash-table
(puthash last-line-number `(,column-level ,tuning-level)
line-indents))
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index c862954..46d0ec5 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -179,7 +179,7 @@
"Round bracket test 1"
(goto-char 30)
(phps-mode-functions-indent-line)
- (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
+ ;; (message "Tokens %s point %s" phps-mode-lexer-tokens (point))
(let ((buffer-contents (buffer-substring-no-properties (point-min)
(point-max))))
(should (equal buffer-contents "<?php\n$variable = array(\n
'random4');\n$variable = true;\n"))))
@@ -297,7 +297,7 @@
(phps-mode-test-with-buffer
"<?php\n$var = $var2->getHead()\n->getTail();\n"
"Multi-line assignment indentation test 1"
- (message "Tokens: %s" phps-mode-lexer-tokens)
+ ;; (message "Tokens: %s" phps-mode-lexer-tokens)
(goto-char 35)
(phps-mode-functions-indent-line)
(let ((buffer-contents (buffer-substring-no-properties (point-min)
(point-max))))
@@ -322,7 +322,7 @@
(phps-mode-test-with-buffer
"<?php\nif (empty($this->var)):\n$this->var = 'abc123';\n endif;"
"Alternative control structure test"
- (goto-char 30)
+ (goto-char 35)
(phps-mode-functions-indent-line)
(let ((buffer-contents (buffer-substring-no-properties (point-min)
(point-max))))
(should (equal buffer-contents "<?php\nif (empty($this->var)):\n
$this->var = 'abc123';\n endif;"))))