branch: externals/phps-mode commit 5bb45ce26cb50c4b51bf98f0e5e436ee1abbbb74 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Added lexer test for properties inside heredoc --- phps-mode-lexer.el | 3 +-- phps-mode-test-lexer.el | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el index c52df42..4dc8814 100644 --- a/phps-mode-lexer.el +++ b/phps-mode-lexer.el @@ -1380,8 +1380,7 @@ ANY_CHAR' (let ((start (car (cdr token)))) (if (< start previous-token-start) (push token old-tokens) - (throw 'stop-iteration nil) - )))) + (throw 'stop-iteration nil))))) (setq old-tokens (nreverse old-tokens)) ;; Delete all overlays from point of change to end of buffer diff --git a/phps-mode-test-lexer.el b/phps-mode-test-lexer.el index 3b8538a..f964e06 100644 --- a/phps-mode-test-lexer.el +++ b/phps-mode-test-lexer.el @@ -276,7 +276,12 @@ (should (equal phps-mode-lexer-tokens '((T_OPEN_TAG 1 . 7) (T_VARIABLE 7 . 12) (T_OBJECT_OPERATOR 12 . 14) (T_STRING 14 . 17) ("(" 17 . 18) (T_VARIABLE 18 . 25) ("[" 25 . 26) (T_CONSTANT_ENCAPSED_STRING 26 . 33) ("]" 33 . 34) ("[" 34 . 35) (T_CONSTANT_ENCAPSED_STRING 35 . 46) ("]" 46 . 47) ("," 47 . 48) (T_ARRAY 49 . 54) ("(" 54 . 55) (T_CONSTANT_ENCAPSED_STRING 55 . 67) (T_DOUBLE_ARROW 68 . 70) ("\"" 71 . 72) (T_ENCAPSED_AND_WHITESPACE 72 . 72) (T_CURLY_OPEN 72 . 73) (T_VARIABLE 73 . 79) ("[" 79 . 80) (T_C [...] - ;; TODO Test object properties inside heredoc, nowdocs strings + (phps-mode-test-with-buffer + "<?php\n$var = <<<EOD\nrandom {$value['color']->property} again {$value->head()}; random\nEOD;\n" + "Complex tokens with tokens inside HEREDOC string" + ;; (message "Tokens 2: %s" phps-mode-lexer-tokens) + (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 [...] )