branch: externals/phps-mode commit 16ec02520a24e88ceb1585c807354bfeb79eb734 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Fixed ampersand in lexer --- phps-mode-lexer.el | 7 +++++-- test/phps-mode-test-ast.el | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el index 077e9d762d..8daae5d1b8 100644 --- a/phps-mode-lexer.el +++ b/phps-mode-lexer.el @@ -110,7 +110,7 @@ (defconst phps-mode-lexer--lambdas-by-state #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 data (ST_IN_SCRIPTING ((lambda nil (when (looking-at "exit") (let ((match-end (match-end 0)) (match-beginning (match-beginning 0))) (let ((matching-length (- match-end match-beginning))) (when (> matching-length 0) (when (or (not phps-mode-lexer--match-length) (> matching-length phps-mode-lexer--match-length)) (setq phps-mode-lexer--match-length matching-length) (setq phps-mode-lexer--match-body (lambda nil (phps- [...] -]*" "\\(\\$\\|\\.\\.\\.\\)")) (let ((match-end (match-end 0)) (match-beginning (match-beginning 0))) (let ((matching-length (- match-end match-beginning))) (when (> matching-length 0) (when (or (not phps-mode-lexer--match-length) (> matching-length phps-mode-lexer--match-length)) (setq phps-mode-lexer--match-length matching-length) (setq phps-mode-lexer--match-body (lambda nil (phps-mode-lexer--yyless 1) (phps-mode-lexer--return-token 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG))) (setq phps- [...] +]*" "\\(\\$\\|\\.\\.\\.\\)")) (let ((match-end (match-end 0)) (match-beginning (match-beginning 0))) (let ((matching-length (- match-end match-beginning))) (when (> matching-length 0) (when (or (not phps-mode-lexer--match-length) (> matching-length phps-mode-lexer--match-length)) (setq phps-mode-lexer--match-length matching-length) (setq phps-mode-lexer--match-body (lambda nil (phps-mode-lexer--yyless 1) (phps-mode-lexer--return-token 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG (match-beginni [...] " phps-mode-lexer--heredoc-label ";? \\|\\$" phps-mode-lexer--label "\\|{\\$" phps-mode-lexer--label "\\|\\${" phps-mode-lexer--label "\\)") nil t))) (if string-start (let* ((start (match-beginning 0)) (end (match-end 0)) (data (buffer-substring-no-properties start end))) (cond ((string-match (concat " " phps-mode-lexer--heredoc-label ";? @@ -1150,7 +1150,10 @@ ST_IN_SCRIPTING (looking-at (concat "&" "[ \t\r\n]*" "\\(\\$\\|\\.\\.\\.\\)")) (phps-mode-lexer--yyless 1) - (phps-mode-lexer--return-token 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG)) + (phps-mode-lexer--return-token + 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG + (match-beginning 0) + (- (match-end 0) 1))) (phps-mode-lexer--match-macro ST_IN_SCRIPTING diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el index 3c7c470345..431f4e8fb0 100644 --- a/test/phps-mode-test-ast.el +++ b/test/phps-mode-test-ast.el @@ -39,10 +39,10 @@ (phps-mode-ast--generate) (phps-mode-ast-bookkeeping--generate) (message - "expected-bookkeeping: %S\n" + "expected-bookkeeping:\n%S\n" bookkeeping) (message - "actual-bookkeeping: %S\n" + "actual-bookkeeping:\n%S\n" (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t))