branch: externals/phps-mode commit a0b350c3164680d4c623936eb71abddbfe60743f Author: Christian Johansson <christ...@cvj.se> Commit: Christian Johansson <christ...@cvj.se>
More work on SDT --- phps-mode-ast.el | 54 ++----------------------------------------------- phps-mode-parser-sdt.el | 34 +++++++++++++++++++++++++++++-- 2 files changed, 34 insertions(+), 54 deletions(-) diff --git a/phps-mode-ast.el b/phps-mode-ast.el index eca2c86800..2a4e4eaaa3 100644 --- a/phps-mode-ast.el +++ b/phps-mode-ast.el @@ -40,61 +40,11 @@ phps-mode-ast--parse-trail parse-trail) - ;; (message "\nTranslation:\n%S\n\n" translation) - - (when translation - (dolist (item translation) - (when (listp item) - (cond - - ((plist-get item 'ast-type) - (if (and - (not namespace) - (equal (plist-get item 'ast-type) 'namespace) - (equal (plist-get item 'end) 'max)) - (progn - ;; (message "Found global namespace: %S" item) - (setq - namespace - item)) - (if namespace - (push - item - namespace-children) - (push - item - ast)))) - - ((listp (car item)) - (dolist (sub-item item) - (when (and - (listp sub-item) - (plist-get sub-item 'ast-type)) - (if namespace - (push - sub-item - namespace-children) - (push - sub-item - ast))))))))) - - (when namespace - (plist-put - namespace - 'children - (reverse namespace-children)) - (push - namespace - ast)) - (setq - ast - (reverse ast)) - - ;; (message "AST:\n%S\n\n" ast) + (message "\nTranslation:\n%S\n\n" translation) (setq phps-mode-ast--tree - ast) + translation) phps-mode-ast--tree)) diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el index a78564c428..fd1d14ab27 100644 --- a/phps-mode-parser-sdt.el +++ b/phps-mode-parser-sdt.el @@ -872,10 +872,10 @@ (puthash 80 (lambda(_args _terminals) 'T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG) phps-mode-parser--table-translations) ;; 81 ((identifier) (T_STRING)) -(puthash 81 (lambda(_args terminals) terminals) phps-mode-parser--table-translations) +(puthash 81 (lambda(args _terminals) args) phps-mode-parser--table-translations) ;; 82 ((identifier) (semi_reserved)) -(puthash 82 (lambda(_args terminals) terminals) phps-mode-parser--table-translations) +(puthash 82 (lambda(args terminals) args) phps-mode-parser--table-translations) ;; 83 ((top_statement_list) (top_statement_list top_statement)) (puthash @@ -886,6 +886,36 @@ ;; 84 ((top_statement_list) (%empty)) (puthash 84 (lambda(_args _terminals) nil) phps-mode-parser--table-translations) +;; 85 ((namespace_declaration_name) (identifier)) +(puthash 85 (lambda(args _terminals) args) phps-mode-parser--table-translations) + +;; 86 ((namespace_declaration_name) (T_NAME_QUALIFIED)) +(puthash 86 (lambda(_args terminals) terminals) phps-mode-parser--table-translations) + +;; 87 ((namespace_name) (T_STRING)) +(puthash 87 (lambda(args _terminals) args) phps-mode-parser--table-translations) + +;; 88 ((namespace_name) (T_NAME_QUALIFIED)) +(puthash 88 (lambda(_args terminals) terminals) phps-mode-parser--table-translations) + +;; 89 ((legacy_namespace_name) (namespace_name)) +(puthash 89 (lambda(args _terminals) args) phps-mode-parser--table-translations) + +;; 90 ((legacy_namespace_name) (T_NAME_FULLY_QUALIFIED)) +(puthash 90 (lambda(_args terminals) terminals) phps-mode-parser--table-translations) + +;; 91 ((name) (T_STRING)) +(puthash 91 (lambda(args _terminals) args) phps-mode-parser--table-translations) + +;; 92 ((name) (T_NAME_QUALIFIED)) +(puthash 92 (lambda(_args terminals) terminals) phps-mode-parser--table-translations) + +;; 93 ((name) (T_NAME_FULLY_QUALIFIED)) +(puthash 93 (lambda(_args terminals) terminals) phps-mode-parser--table-translations) + +;; 94 ((name) (T_NAME_RELATIVE)) +(puthash 94 (lambda(_args terminals) terminals) phps-mode-parser--table-translations) + ;; 111 top_statement -> (T_NAMESPACE namespace_declaration_name ";") (puthash 111