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

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

[elpa] externals/phps-mode 2720be8 165/405: Indentation calculation for


From: Stefan Monnier
Subject: [elpa] externals/phps-mode 2720be8 165/405: Indentation calculation for heredoc and nowdoc assignments passes
Date: Sat, 13 Jul 2019 10:00:05 -0400 (EDT)

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

    Indentation calculation for heredoc and nowdoc assignments passes
---
 phps-mode-functions.el      | 9 +++++----
 phps-mode-test-functions.el | 7 ++-----
 2 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/phps-mode-functions.el b/phps-mode-functions.el
index cb1ea0e..fa1fa80 100644
--- a/phps-mode-functions.el
+++ b/phps-mode-functions.el
@@ -99,7 +99,8 @@
                     (setq nesting-end (+ round-bracket-level 
square-bracket-level curly-bracket-level alternative-control-structure-level 
inline-control-structure-level))
 
                     ;; Inside assignment increment by one
-                    (when in-assignment
+                    (when (and in-assignment
+                               (not in-heredoc))
                       (setq nesting-end (1+ nesting-end)))
 
                     ;; Is line ending indentation lesser than line beginning 
indentation?
@@ -129,7 +130,7 @@
                       (puthash last-line-number `(,column-level ,tuning-level) 
line-indents))
 
                     (when (> token-end-line-number token-start-line-number)
-                      (message "Token %s starts at %s and ends at %s" token 
token-start-line-number token-end-line-number)
+                      ;; (message "Token %s starts at %s and ends at %s" token 
token-start-line-number token-end-line-number)
                       (when (equal token 'T_DOC_COMMENT)
                         (setq tuning-level 1))
 
@@ -299,8 +300,7 @@
                 (setq after-special-control-structure-token token))
 
               ;; Keep track of assignments
-              (when (and in-assignment
-                         (not in-heredoc))
+              (when in-assignment
                 (if (string= token ";")
                     (progn
                       (setq in-assignment nil)
@@ -319,6 +319,7 @@
                       ;; (message "Not in assignment on new-line at %s" token)
                       (setq in-assignment-on-new-line nil)))))
               (when (and (not after-special-control-structure)
+                         (not in-assignment)
                          (string= token "="))
                 ;; (message "Started assignment")
                 (setq in-assignment t)
diff --git a/phps-mode-test-functions.el b/phps-mode-test-functions.el
index 04236f3..536f31b 100644
--- a/phps-mode-test-functions.el
+++ b/phps-mode-test-functions.el
@@ -92,13 +92,13 @@
   (phps-mode-test-with-buffer
    "<?php\n$str = <<<'EOD'\nExample of string\nspanning multiple lines\nusing 
nowdoc syntax.\nEOD;\n"
    "Multi-line NOWDOC string"
-   (message "Tokens: %s" phps-mode-lexer-tokens)
+   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
   (phps-mode-test-with-buffer
    "<?php\n$str = <<<EOD\nExample of string\nspanning multiple lines\nusing 
heredoc syntax.\nEOD;\n"
    "Multi-line HEREDOC string"
-   (message "Tokens: %s" phps-mode-lexer-tokens)
+   ;; (message "Tokens: %s" phps-mode-lexer-tokens)
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0)) (5 (0 0)) (6 (0 
0))) (phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
   (phps-mode-test-with-buffer
@@ -119,9 +119,6 @@
    (message "Tokens: %s" phps-mode-lexer-tokens)
    (should (equal '((1 (0 0)) (2 (0 0)) (3 (0 0)) (4 (0 0))) 
(phps-mode-test-functions--hash-to-list 
(phps-mode-functions-get-lines-indent)))))
 
-  ;; TODO Multi-line double-quoted strings
-
-
   )
 
 ;; TODO Add unit tests for HEREDOC and NOWDOC regions as well



reply via email to

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