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

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

[elpa] externals/phps-mode 7fcef9b: Added lexer support for dynamic obje


From: Christian Johansson
Subject: [elpa] externals/phps-mode 7fcef9b: Added lexer support for dynamic object properties and methods
Date: Mon, 27 Apr 2020 12:41:43 -0400 (EDT)

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

    Added lexer support for dynamic object properties and methods
---
 phps-mode-lexer.el           |  7 ++-----
 phps-mode.el                 |  4 ++--
 test/phps-mode-test-lexer.el | 18 ++++++++++++------
 3 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index b7771b7..7f50ab2 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -475,11 +475,8 @@
 
       (phps-mode-lexer--match-macro
        (and ST_LOOKING_FOR_PROPERTY (looking-at phps-mode-lexer--ANY_CHAR))
-       (let ((end (match-end 0)))
-         (phps-mode-lexer--yy_pop_state)
-         ;; TODO goto restart here?
-         ;; (message "Restart here")
-         (phps-mode-lexer--MOVE_FORWARD end)))
+       (phps-mode-lexer--yy_pop_state)
+      (phps-mode-lexer--re2c))
 
       (phps-mode-lexer--match-macro
        (and ST_IN_SCRIPTING (looking-at "::"))
diff --git a/phps-mode.el b/phps-mode.el
index f9b4c3a..49fa07d 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: 25 Apr 2020
-;; Version: 0.3.43
+;; Modified: 27 Apr 2020
+;; Version: 0.3.44
 ;; 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 89c6e38..430b867 100644
--- a/test/phps-mode-test-lexer.el
+++ b/test/phps-mode-test-lexer.el
@@ -322,18 +322,24 @@
    (should (equal phps-mode-lex-analyzer--tokens
                   '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 11) ("=" 12 . 13) 
(T_CONSTANT_ENCAPSED_STRING 14 . 18) (";" 18 . 19)))))
 
+  (phps-mode-test--with-buffer
+   "<?php\n\n$object = (object) array(\n    'field_random' => 25\n);\n$field = 
'random';\necho $object->{\"field_$field\"};"
+   "Dynamic object property"
+   (should (equal phps-mode-lex-analyzer--tokens
+                  '((T_OPEN_TAG 1 . 7) (T_VARIABLE 8 . 15) ("=" 16 . 17) 
(T_OBJECT_CAST 18 . 26) (T_ARRAY 27 . 32) ("(" 32 . 33) 
(T_CONSTANT_ENCAPSED_STRING 38 . 52) (T_DOUBLE_ARROW 53 . 55) (T_LNUMBER 56 . 
58) (")" 59 . 60) (";" 60 . 61) (T_VARIABLE 62 . 68) ("=" 69 . 70) 
(T_CONSTANT_ENCAPSED_STRING 71 . 79) (";" 79 . 80) (T_ECHO 81 . 85) (T_VARIABLE 
86 . 93) (T_OBJECT_OPERATOR 93 . 95) ("{" 95 . 96) ("\"" 96 . 97) 
(T_ENCAPSED_AND_WHITESPACE 97 . 103) (T_VARIABLE 103 . 109) ("\"" 109 .  [...]
+
+  (phps-mode-test--with-buffer
+   "<?php\nclass MyClass { function myFunction() { return 'hello'; }}\n$class 
= new MyClass();\n$function = \"Function\";\necho $class->{\"my$function\"}();"
+   "Dynamic object method"
+   (should (equal phps-mode-lex-analyzer--tokens
+                  '((T_OPEN_TAG 1 . 7) (T_CLASS 7 . 12) (T_STRING 13 . 20) 
("{" 21 . 22) (T_FUNCTION 23 . 31) (T_STRING 32 . 42) ("(" 42 . 43) (")" 43 . 
44) ("{" 45 . 46) (T_RETURN 47 . 53) (T_CONSTANT_ENCAPSED_STRING 54 . 61) (";" 
61 . 62) ("}" 63 . 64) ("}" 64 . 65) (T_VARIABLE 66 . 72) ("=" 73 . 74) (T_NEW 
75 . 78) (T_STRING 79 . 86) ("(" 86 . 87) (")" 87 . 88) (";" 88 . 89) 
(T_VARIABLE 90 . 99) ("=" 100 . 101) (T_CONSTANT_ENCAPSED_STRING 102 . 112) 
(";" 112 . 113) (T_ECHO 114 . 118)  [...]
+
   )
 
 (defun phps-mode-test-lexer--namespaces ()
   "Run test for namespaces."
 
   (phps-mode-test--with-buffer
-   "<?php\nnamespace MyNameSpace{\n\tclass MyClass {\n\t\tpublic function 
__construct() {\n\t\t\texit;\n\t\t}\n\t}\n}\n"
-   "Object-oriented namespace file"
-   (should (equal phps-mode-lex-analyzer--tokens
-                  '((T_OPEN_TAG 1 . 7) (T_NAMESPACE 7 . 16) (T_STRING 17 . 28) 
("{" 28 . 29) (T_CLASS 31 . 36) (T_STRING 37 . 44) ("{" 45 . 46) (T_PUBLIC 49 . 
55) (T_FUNCTION 56 . 64) (T_STRING 65 . 76) ("(" 76 . 77) (")" 77 . 78) ("{" 79 
. 80) (T_EXIT 84 . 88) (";" 88 . 89) ("}" 92 . 93) ("}" 95 . 96) ("}" 97 . 
98)))))
-
-  (phps-mode-test--with-buffer
    "<?php\nNAMESPACE MyNameSpace;\nCLASS MyClass {\n\tpublic function 
__construct() {\n\t\texit;\n\t}\n}\n"
    "Capitalized object-oriented namespace file"
    (should (equal



reply via email to

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