branch: externals/phps-mode commit a9d0e941dfda7431c66d5daa49f2bab1a0ed1fc3 Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
Started on SDT for static variables statement --- phps-mode-ast-bookkeeping.el | 21 +++++++++++++++ phps-mode-parser-sdt.el | 61 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+) diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el index f372160d7e..77f853866c 100644 --- a/phps-mode-ast-bookkeeping.el +++ b/phps-mode-ast-bookkeeping.el @@ -282,6 +282,27 @@ defined-p bookkeeping))) + ((equal type 'static-variables-statement) + (when-let ((variables (reverse (plist-get item 'static-var-list)))) + (dolist (variable variables) + (let ((ids + (phps-mode-ast-bookkeeping--generate-variable-scope-string + scope + (plist-get variable 'name))) + (object + (list + (plist-get variable 'start) + (plist-get variable 'end)))) + (dolist (id ids) + (puthash + id + 1 + bookkeeping)) + (puthash + object + 1 + bookkeeping))))) + ((equal type 'function) (let ((name (plist-get item 'name)) (sub-scope scope)) diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el index bb651cf501..1919616bb2 100644 --- a/phps-mode-parser-sdt.el +++ b/phps-mode-parser-sdt.el @@ -181,6 +181,17 @@ ast-object)) phps-mode-parser--table-translations) +;; statement -> (T_STATIC static_var_list ";") +(puthash + 151 + (lambda(args _terminals) + `( + ast-type + static-variables-statement + static-var-list + ,(nth 1 args))) + phps-mode-parser--table-translations) + ;; statement -> (T_ECHO echo_expr_list ";") (puthash 152 @@ -489,6 +500,56 @@ (nth 1 args)) phps-mode-parser--table-translations) +;; static_var_list -> (static_var_list "," static_var) +(puthash + 272 + (lambda(args _terminals) + (append (nth 0 args) (list (nth 2 args)))) + phps-mode-parser--table-translations) + +;; static_var_list -> (static_var) +(puthash + 273 + (lambda(args _terminals) + (list args)) + phps-mode-parser--table-translations) + +;; static_var -> (T_VARIABLE) +(puthash + 274 + (lambda(args terminals) + `( + ast-type + variable + name + ,(nth 0 args) + index + ,(car (cdr (nth 0 terminals))) + start + ,(car (cdr (nth 0 terminals))) + end + ,(cdr (cdr (nth 0 terminals))))) + phps-mode-parser--table-translations) + +;; static_var -> (T_VARIABLE "=" expr) +(puthash + 275 + (lambda(args terminals) + `( + ast-type + variable + name + ,(nth 0 args) + expr + ,(nth 2 args) + index + ,(car (cdr (nth 0 terminals))) + start + ,(car (cdr (nth 0 terminals))) + end + ,(cdr (cdr (nth 0 terminals))))) + phps-mode-parser--table-translations) + ;; class_statement_list -> (class_statement_list class_statement) (puthash 276