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

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

[elpa] externals/phps-mode ada66dc7f3 09/27: Updated lexer for PHP 8.2


From: Christian Johansson
Subject: [elpa] externals/phps-mode ada66dc7f3 09/27: Updated lexer for PHP 8.2
Date: Sat, 4 Mar 2023 03:24:56 -0500 (EST)

branch: externals/phps-mode
commit ada66dc7f3e3e3efd2ae39a96a561152c5f450e5
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    Updated lexer for PHP 8.2
---
 phps-mode-lexer.el | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index d6f1900913..8016837b31 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -121,8 +121,7 @@
 ;; VARIABLES
 
 
-(defvar 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 
(looking-at "exit")) (lambda nil (phps-mode-lexer--return-token-with-indent 
'T_EXIT))) ((lambda nil (looking-at "die")) (lambda nil 
(phps-mode-lexer--return-token-with-indent 'T_EXIT))) ((lambda nil (looking-at 
"fn")) (lambda nil (phps-mode-lexer--return-token-with-indent 'T_FN))) ((lambda 
nil (looking-at "function")) (lambda nil (phps-mod [...]
-
        ]*("))) (lambda nil (phps-mode-lexer--yyless (length "readonly")) 
(phps-mode-lexer--return-token-with-str 'T_STRING 0))) ((lambda nil (looking-at 
"unset")) (lambda nil (phps-mode-lexer--return-token-with-indent 'T_UNSET))) 
((lambda nil (looking-at "=>")) (lambda nil (phps-mode-lexer--return-token 
'T_DOUBLE_ARROW))) ((lambda nil (looking-at "list")) (lambda nil 
(phps-mode-lexer--return-token-with-indent 'T_LIST))) ((lambda nil (looking-at 
"array")) (lambda nil (phps-mode-lexer--return-tok [...]
+(defvar 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 
(looking-at "exit")) (lambda nil (phps-mode-lexer--return-token-with-indent 
'T_EXIT))) ((lambda nil (looking-at "die")) (lambda nil 
(phps-mode-lexer--return-token-with-indent 'T_EXIT))) ((lambda nil (looking-at 
"fn")) (lambda nil (phps-mode-lexer--return-token-with-indent 'T_FN))) ((lambda 
nil (looking-at "function")) (lambda nil (phps-mod [...]
 ]*" "\\(\\$\\|\\.\\.\\.\\)"))) (lambda nil (phps-mode-lexer--yyless 1) 
(phps-mode-lexer--return-token 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG 
(match-beginning 0) (- (match-end 0) 1)))) ((lambda nil (looking-at "&")) 
(lambda nil (phps-mode-lexer--return-token 
'T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG))) ((lambda nil (looking-at (concat 
"\\(" "]" "\\|" ")" "\\)"))) (lambda nil 
(phps-mode-lexer--return-exit-nesting-token))) ((lambda nil (looking-at (concat 
"\\(" "\\[" "\\|" "(" "\\)"))) (la [...]
 [       ]*\\(" 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 (match-string 0))) (cond 
((string-match-p (concat "
 [       ]*" phps-mode-lexer--heredoc-label) data) (setq start (match-beginning 
2)) (setq end (match-beginning 2)) (phps-mode-lexer--return-token-with-val 
'T_ENCAPSED_AND_WHITESPACE old-end start) (phps-mode-lexer--begin 
'ST_END_HEREDOC)) (t (phps-mode-lexer--return-token-with-val 
'T_ENCAPSED_AND_WHITESPACE old-end start)))) (progn (signal 'phps-lexer-error 
(list (format "Found no ending of heredoc starting at %d" old-start) 
old-start))))))))) ST_LOOKING_FOR_VARNAME (((lambda nil (looking-at ( [...]
@@ -695,6 +694,14 @@
    (looking-at "trait")
    (phps-mode-lexer--return-token-with-indent 'T_TRAIT))
 
+  ;; The enum keyword must be followed by whitespace and another identifier.
+  ;; This avoids the BC break of using enum in classes, namespaces, functions 
and constants.
+  (phps-mode-lexer--match-macro
+   ST_IN_SCRIPTING
+   (looking-at (concat "\\(enum\\)" phps-mode-lexer--whitespace 
"\\(extends\\|implements\\)"))
+   (phps-mode-lexer--yyless 4)
+   (phps-mode-lexer--return-token-with-str 'T_STRING))
+
   (phps-mode-lexer--match-macro
    ST_IN_SCRIPTING
    (looking-at (concat "\\(enum\\)" phps-mode-lexer--whitespace 
"[a-zA-Z_\x80-\xff]"))
@@ -972,13 +979,6 @@
    (looking-at "readonly")
    (phps-mode-lexer--return-token-with-indent 'T_READONLY))
 
-  ;; Don't treat "readonly(" as a keyword, to allow using it as a function 
name.
-  (phps-mode-lexer--match-macro
-   ST_IN_SCRIPTING
-   (looking-at (concat "readonly" "[ \n\r\t]*("))
-   (phps-mode-lexer--yyless (length "readonly"))
-   (phps-mode-lexer--return-token-with-str 'T_STRING 0))
-
   (phps-mode-lexer--match-macro
    ST_IN_SCRIPTING
    (looking-at "unset")



reply via email to

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