branch: externals/phps-mode commit 64a3ca8818d3fe043cbed0b96e9d7d3dc0834bec Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Modified start and end for single and double quoted strings --- phps-lexer.el | 8 ++++---- phps-test-lexer.el | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/phps-lexer.el b/phps-lexer.el index 7907b06..0e75bae 100644 --- a/phps-lexer.el +++ b/phps-lexer.el @@ -836,8 +836,8 @@ ;; Handle the '' case (if (looking-at-p "'") (progn - ;; (message "Empty single quoted string from %s to %s" end (+ end 1)) - (phps-mode/RETURN_TOKEN 'T_CONSTANT_ENCAPSED_STRING end (+ end 1)) + ;; (message "Empty single quoted string from %s to %s" start (+ start 2)) + (phps-mode/RETURN_TOKEN 'T_CONSTANT_ENCAPSED_STRING start (+ start 2)) (forward-char)) (progn ;; Unclosed single quotes @@ -878,8 +878,8 @@ ;; Handle the "" case (if (looking-at-p "\"") (progn - ;; (message "Empty double quoted string from %s to %s" end (+ end 1)) - (phps-mode/RETURN_TOKEN 'T_CONSTANT_ENCAPSED_STRING end (+ end 1)) + ;; (message "Empty double quoted string from %s to %s" start (+ start 2)) + (phps-mode/RETURN_TOKEN 'T_CONSTANT_ENCAPSED_STRING start (+ start 2)) (forward-char)) (progn ;; (message "Found no ending quote, skipping to end") diff --git a/phps-test-lexer.el b/phps-test-lexer.el index e7d75fb..781668b 100644 --- a/phps-test-lexer.el +++ b/phps-test-lexer.el @@ -92,17 +92,17 @@ (phps-mode/with-test-buffer "<?php echo $var = array('');" (should (equal phps-mode/lexer-tokens - '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 16) ("=" 17 . 18) (T_ARRAY 19 . 24) ("(" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 26 . 27) (")" 27 . 28) (";" 28 . 29))))) + '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 16) ("=" 17 . 18) (T_ARRAY 19 . 24) ("(" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 27) (")" 27 . 28) (";" 28 . 29))))) (phps-mode/with-test-buffer "<?php if (empty($parameters[self::PARAMETER_CONFIGURATION_INTERNAL_FILENAME])) { $parameters[self::PARAMETER_CONFIGURATION_INTERNAL_FILENAME] = ''; }" (should (equal phps-mode/lexer-tokens - '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_EMPTY 11 . 16) ("(" 16 . 17) (T_VARIABLE 17 . 28) ("[" 28 . 29) (T_STRING 29 . 33) (T_PAAMAYIM_NEKUDOTAYIM 33 . 35) (T_STRING 35 . 76) ("]" 76 . 77) (")" 77 . 78) (")" 78 . 79) ("{" 80 . 81) (T_VARIABLE 82 . 93) ("[" 93 . 94) (T_STRING 94 . 98) (T_PAAMAYIM_NEKUDOTAYIM 98 . 100) (T_STRING 100 . 141) ("]" 141 . 142) ("=" 143 . 144) (T_CONSTANT_ENCAPSED_STRING 146 . 147) (";" 147 . 148) ("}" 149 . 150))))) + '((T_OPEN_TAG 1 . 7) (T_IF 7 . 9) ("(" 10 . 11) (T_EMPTY 11 . 16) ("(" 16 . 17) (T_VARIABLE 17 . 28) ("[" 28 . 29) (T_STRING 29 . 33) (T_PAAMAYIM_NEKUDOTAYIM 33 . 35) (T_STRING 35 . 76) ("]" 76 . 77) (")" 77 . 78) (")" 78 . 79) ("{" 80 . 81) (T_VARIABLE 82 . 93) ("[" 93 . 94) (T_STRING 94 . 98) (T_PAAMAYIM_NEKUDOTAYIM 98 . 100) (T_STRING 100 . 141) ("]" 141 . 142) ("=" 143 . 144) (T_CONSTANT_ENCAPSED_STRING 145 . 147) (";" 147 . 148) ("}" 149 . 150))))) (phps-mode/with-test-buffer "<?php echo $var = array(\"\");" (should (equal phps-mode/lexer-tokens - '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 16) ("=" 17 . 18) (T_ARRAY 19 . 24) ("(" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 26 . 27) (")" 27 . 28) (";" 28 . 29))))) + '((T_OPEN_TAG 1 . 7) (T_ECHO 7 . 11) (T_VARIABLE 12 . 16) ("=" 17 . 18) (T_ARRAY 19 . 24) ("(" 24 . 25) (T_CONSTANT_ENCAPSED_STRING 25 . 27) (")" 27 . 28) (";" 28 . 29))))) (phps-mode/with-test-buffer "<?php echo $var = array('abc' => '123');"