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

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

[elpa] externals/phps-mode b6dc7e7: Lexer now detects escaped double quo


From: Christian Johansson
Subject: [elpa] externals/phps-mode b6dc7e7: Lexer now detects escaped double quotes inside double quoted strings
Date: Mon, 2 Dec 2019 06:03:37 -0500 (EST)

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

    Lexer now detects escaped double quotes inside double quoted strings
---
 phps-mode-analyzer.el        | 4 ++--
 phps-mode.el                 | 4 ++--
 test/phps-mode-test-lexer.el | 7 +++++++
 3 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/phps-mode-analyzer.el b/phps-mode-analyzer.el
index 4b2291e..94df331 100644
--- a/phps-mode-analyzer.el
+++ b/phps-mode-analyzer.el
@@ -1526,7 +1526,7 @@
 
                        ;; Process character if it's not escaped
                        (if is-escaped
-                           (forward-char 2)
+                           (forward-char 1)
                          (setq open-quote nil)
                          (if (looking-at "\"")
                              (let ((_double-quoted-string 
(buffer-substring-no-properties start (+ string-start 1))))
@@ -1537,7 +1537,7 @@
                            (phps-mode-lexer-RETURN_TOKEN "\"" start (1+ start))
                            (phps-mode-lexer-RETURN_TOKEN 
'T_ENCAPSED_AND_WHITESPACE (1+ start) string-start))))
                    (progn
-                     (display-warning 'phps-mode (format "Found no ending of 
quote at %s" (point)))
+                     (display-warning 'phps-mode (format "Found no ending of 
quote at %s-%s" start (point)))
                      (phps-mode-lexer-MOVE_FORWARD (point-max))
                      (setq open-quote nil))))))))
 
diff --git a/phps-mode.el b/phps-mode.el
index 203ae0e..7e6bc8d 100644
--- a/phps-mode.el
+++ b/phps-mode.el
@@ -5,8 +5,8 @@
 ;; Author: Christian Johansson <address@hidden>
 ;; Maintainer: Christian Johansson <address@hidden>
 ;; Created: 3 Mar 2018
-;; Modified: 24 Nov 2019
-;; Version: 0.3.19
+;; Modified: 2 Dec 2019
+;; Version: 0.3.20
 ;; Keywords: tools, convenience
 ;; URL: https://github.com/cjohansson/emacs-phps-mode
 
diff --git a/test/phps-mode-test-lexer.el b/test/phps-mode-test-lexer.el
index ed3ba44..0355617 100644
--- a/test/phps-mode-test-lexer.el
+++ b/test/phps-mode-test-lexer.el
@@ -304,6 +304,13 @@
    (should (equal phps-mode-lexer-tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_START_HEREDOC 14 . 21) (T_ENCAPSED_AND_WHITESPACE 21 . 28) (T_CURLY_OPEN 28 
. 29) (T_VARIABLE 29 . 35) ("[" 35 . 36) (T_CONSTANT_ENCAPSED_STRING 36 . 43) 
("]" 43 . 44) (T_OBJECT_OPERATOR 44 . 46) (T_STRING 46 . 54) ("}" 54 . 55) 
(T_ENCAPSED_AND_WHITESPACE 55 . 62) (T_CURLY_OPEN 62 . 63) (T_VARIABLE 63 . 69) 
(T_OBJECT_OPERATOR 69 . 71) (T_STRING 71 . 75) ("(" 75 . 76) (")" 76 . 77) ("}" 
77 . 78) (T_ENCAPSED_AND_WH [...]
 
+  (phps-mode-test-with-buffer
+   "<?php echo \"\\\"$string\\\"\";"
+   "Escaped double quotes with variable in it"
+   ;; (message "Tokens 2: %s" phps-mode-lexer-tokens)
+   (should (equal phps-mode-lexer-tokens
+                  '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) ("\"" 12 . 13) 
(T_ENCAPSED_AND_WHITESPACE 13 . 15) (T_VARIABLE 15 . 22) 
(T_CONSTANT_ENCAPSED_STRING 22 . 24) ("\"" 24 . 25) (";" 25 . 26)))))
+
   )
 
 (defun phps-mode-test-lexer-namespaces ()



reply via email to

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