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

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

[elpa] externals/phps-mode b437374 040/405: Fixed bug in parsing of obje


From: Stefan Monnier
Subject: [elpa] externals/phps-mode b437374 040/405: Fixed bug in parsing of object parameters inside double quoted string
Date: Sat, 13 Jul 2019 09:59:38 -0400 (EDT)

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

    Fixed bug in parsing of object parameters inside double quoted string
---
 phps-lexer.el      |  7 ++++---
 phps-test-lexer.el | 12 ++++++------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/phps-lexer.el b/phps-lexer.el
index 61ad818..8fb5694 100644
--- a/phps-lexer.el
+++ b/phps-lexer.el
@@ -891,7 +891,7 @@
                         ;; (message "Double quoted string: %s" 
double-quoted-string)
                         (phps-mode/RETURN_TOKEN 'T_CONSTANT_ENCAPSED_STRING 
start (+ string-start 2))))
                   (progn
-                    (message "Found variable after '%s'" 
(buffer-substring-no-properties start string-start))
+                    ;; (message "Found variable after '%s'" 
(buffer-substring-no-properties start string-start))
                     (phps-mode/BEGIN phps-mode/ST_DOUBLE_QUOTES)
                     (phps-mode/RETURN_TOKEN "\"" start (+ start 1))
                     (phps-mode/RETURN_TOKEN 'T_ENCAPSED_AND_WHITESPACE (+ 
start 1) string-start))))
@@ -986,7 +986,8 @@
 
    ((looking-at (concat "\\$" phps-mode/LABEL "->" "[a-zA-Z_\x80-\xff]"))
     (phps-mode/yy_push_state phps-mode/ST_LOOKING_FOR_PROPERTY)
-    (phps-mode/RETURN_TOKEN 'T_VARIABLE (match-beginning 0) (match-end 0)))
+    (forward-char -3)
+    (phps-mode/RETURN_TOKEN 'T_VARIABLE (match-beginning 0) (- (match-end 0) 
3)))
 
    ((looking-at (concat "\\$" phps-mode/LABEL "\\["))
     (phps-mode/yy_push_state phps-mode/ST_VAR_OFFSET)
@@ -1001,7 +1002,7 @@
 
    ((looking-at "[\"]")
     (phps-mode/BEGIN phps-mode/ST_IN_SCRIPTING)
-    (message "Ended double-quote at %s" (match-beginning 0))
+    ;; (message "Ended double-quote at %s" (match-beginning 0))
     (phps-mode/RETURN_TOKEN "\"" (match-beginning 0) (match-end 0)))
 
    ((looking-at phps-mode/ANY_CHAR)
diff --git a/phps-test-lexer.el b/phps-test-lexer.el
index 3147afd..aabd220 100644
--- a/phps-test-lexer.el
+++ b/phps-test-lexer.el
@@ -217,19 +217,19 @@
    (should (equal phps-mode/lexer-tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 12) (T_OBJECT_OPERATOR 
12 . 14) (T_STRING 14 . 19) (";" 19 . 20) (";" 21 . 23) (T_CLOSE_TAG 21 . 
23)))))
 
-  ;; TODO Fix this, produces invalid tokens
   (phps-mode/with-test-buffer
    "<?php $var = \"SELECT post_parent FROM $wpdb->posts WHERE ID = 
'\".$id.\"'\"; ?>"
-   (message "Tokens 1: %s" phps-mode/lexer-tokens)
+   ;; (message "Tokens 1: %s" phps-mode/lexer-tokens)
    (should (equal phps-mode/lexer-tokens
-                  '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) ("\"" 
14 . 15) (T_ENCAPSED_AND_WHITESPACE 15 . 39) (T_VARIABLE 39 . 47) (T_STRING 47 
. 51) (T_CONSTANT_ENCAPSED_STRING 51 . 64) ("\"" 64 . 65) ("." 65 . 66) 
(T_VARIABLE 66 . 69) ("." 69 . 70) (T_CONSTANT_ENCAPSED_STRING 70 . 73) (";" 73 
. 74) (";" 75 . 77) (T_CLOSE_TAG 75 . 77)))))
+                  '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) ("\"" 
14 . 15) (T_ENCAPSED_AND_WHITESPACE 15 . 39) (T_VARIABLE 39 . 44) 
(T_OBJECT_OPERATOR 44 . 46) (T_STRING 46 . 51) (T_CONSTANT_ENCAPSED_STRING 51 . 
64) ("\"" 64 . 65) ("." 65 . 66) (T_VARIABLE 66 . 69) ("." 69 . 70) 
(T_CONSTANT_ENCAPSED_STRING 70 . 73) (";" 73 . 74) (";" 75 . 77) (T_CLOSE_TAG 
75 . 77)))))
 
-  ;; TODO Fix this, produces invalid tokens
   (phps-mode/with-test-buffer
    "<?php $wpdb->get_var(\"SELECT post_parent FROM $wpdb->posts WHERE ID = 
'\".$id.\"'\"); ?>"
-   (message "Tokens 2: %s" phps-mode/lexer-tokens)
+   ;; (message "Tokens 2: %s" phps-mode/lexer-tokens)
    (should (equal phps-mode/lexer-tokens
-                  '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 12) (T_OBJECT_OPERATOR 
12 . 14) (T_STRING 14 . 21) ("(" 21 . 22) ("\"" 22 . 23) 
(T_ENCAPSED_AND_WHITESPACE 23 . 47) (T_VARIABLE 47 . 54) (T_OBJECT_OPERATOR 54 
. 56) (T_STRING 56 . 59) (T_CONSTANT_ENCAPSED_STRING 59 . 72) ("\"" 72 . 73) 
("." 73 . 74) (T_VARIABLE 74 . 77) ("." 77 . 78) (T_CONSTANT_ENCAPSED_STRING 78 
. 81) (")" 81 . 82) (";" 82 . 83) (";" 84 . 86) (T_CLOSE_TAG 84 . 86)))))
+                  '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 12) (T_OBJECT_OPERATOR 
12 . 14) (T_STRING 14 . 21) ("(" 21 . 22) ("\"" 22 . 23) 
(T_ENCAPSED_AND_WHITESPACE 23 . 47) (T_VARIABLE 47 . 52) (T_OBJECT_OPERATOR 52 
. 54) (T_STRING 54 . 59) (T_CONSTANT_ENCAPSED_STRING 59 . 72) ("\"" 72 . 73) 
("." 73 . 74) (T_VARIABLE 74 . 77) ("." 77 . 78) (T_CONSTANT_ENCAPSED_STRING 78 
. 81) (")" 81 . 82) (";" 82 . 83) (";" 84 . 86) (T_CLOSE_TAG 84 . 86)))))
+
+  ;; TODO Test object properties inside heredoc, nowdocs strings
 
   )
 



reply via email to

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