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

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

[elpa] externals/phps-mode ba8165a 063/405: Fixed bug with brace count n


From: Stefan Monnier
Subject: [elpa] externals/phps-mode ba8165a 063/405: Fixed bug with brace count not including braces inside double quoted strings
Date: Sat, 13 Jul 2019 09:59:44 -0400 (EDT)

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

    Fixed bug with brace count not including braces inside double quoted strings
---
 phps-functions.el      | 4 ++++
 phps-test-functions.el | 8 ++++++++
 2 files changed, 12 insertions(+)

diff --git a/phps-functions.el b/phps-functions.el
index a0f4aa1..fe7ded9 100644
--- a/phps-functions.el
+++ b/phps-functions.el
@@ -171,6 +171,8 @@
                   ('T_OPEN_TAG (setq start-in-scripting t))
                   ('T_OPEN_TAG_WITH_ECHO (setq start-in-scripting t))
                   ('T_CLOSE_TAG (setq start-in-scripting nil))
+                  ('T_CURLY_OPEN (setq start-brace-level (+ start-brace-level 
1)))
+                  ('T_DOLLAR_OPEN_CURLY_BRACES (setq start-brace-level (+ 
start-brace-level 1)))
                   ("}" (setq start-brace-level (- start-brace-level 1)))
                   ("{" (setq start-brace-level (+ start-brace-level 1)))
                   ("(" (setq start-parenthesis-level (+ 
start-parenthesis-level 1)))
@@ -191,6 +193,8 @@
                   ('T_OPEN_TAG (setq end-in-scripting t))
                   ('T_OPEN_TAG_WITH_ECHO (setq end-in-scripting t))
                   ('T_CLOSE_TAG (setq end-in-scripting nil))
+                  ('T_CURLY_OPEN (setq end-brace-level (+ end-brace-level 1)))
+                  ('T_DOLLAR_OPEN_CURLY_BRACES (setq end-brace-level (+ 
end-brace-level 1)))
                   ("}" (setq end-brace-level (- end-brace-level 1)))
                   ("{" (setq end-brace-level (+ end-brace-level 1)))
                   ("(" (setq end-parenthesis-level (+ end-parenthesis-level 
1)))
diff --git a/phps-test-functions.el b/phps-test-functions.el
index 1ead7e7..b4ef345 100644
--- a/phps-test-functions.el
+++ b/phps-test-functions.el
@@ -123,6 +123,14 @@
    (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"))))
 
+  (phps-mode/with-test-buffer
+   "<?php\nadd_filter(\n\"views_{$screen->id}\",'__return_empty_array'\n);"
+   (goto-char 25)
+   (phps-mode/indent-line)
+   ;; (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\nadd_filter(\n    
\"views_{$screen->id}\",'__return_empty_array'\n);"))))
+
   )
 
 (defun phps-mode/test-functions--get-point-data ()



reply via email to

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