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

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

[elpa] externals/phps-mode e887dc91e3 043/135: Added TODO items


From: Christian Johansson
Subject: [elpa] externals/phps-mode e887dc91e3 043/135: Added TODO items
Date: Sun, 29 Jan 2023 03:11:02 -0500 (EST)

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

    Added TODO items
---
 phps-mode-parser-sdt.el    | 105 +++++++++++++++++++++++++++++----------------
 test/phps-mode-test-ast.el |   2 +
 2 files changed, 71 insertions(+), 36 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index a0967a37a9..27d5d97111 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1091,7 +1091,7 @@
    args)
  phps-mode-parser--table-translations)
 
-;; 108 ((top_statement) (statement))
+;; 108 ((top_statement) (attributed_statement))
 (puthash
  108
  (lambda(args _terminals)
@@ -1120,6 +1120,13 @@
  111
  (lambda(args terminals)
    (phps-mode-parser-sdt--parse-top-statement)
+   (let ((namespace-name (nth 1 args)))
+     (setq phps-mode-parser-sdt--bookkeeping-namespace
+           (format
+            " namespace %s%s"
+            namespace-name
+            phps-mode-parser-sdt--bookkeeping-namespace)))
+
    `(
      ast-type
      namespace
@@ -1137,7 +1144,40 @@
 (puthash
  112
  (lambda(args terminals)
+   (message "phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+   (message "phps-mode-parser-sdt--bookkeeping-symbol-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-stack)
+   ;; Go through stacks and modify symbol namespaces
+   ;; but only for non-super-global variables
+   (let ((namespace-name (nth 1 args)))
+     (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
+       (dolist (
+                symbol-list
+                phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+         (let ((symbol-name (car symbol-list)))
+           (unless (gethash
+                    symbol-name
+                    phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+             (setcar symbol-list
+                     (format
+                      " namespace %s%s"
+                      namespace-name
+                      symbol-name))))))
+     (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+       (dolist (
+                symbol-list
+                phps-mode-parser-sdt--bookkeeping-symbol-stack)
+         (let ((symbol-name (car symbol-list)))
+           (unless (gethash
+                    symbol-name
+                    phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+             (setcar symbol-list
+                     (format
+                      " namespace %s%s"
+                      namespace-name
+                      symbol-name)))))))
+
    (phps-mode-parser-sdt--parse-top-statement)
+
    `(
      ast-type
      namespace
@@ -1812,7 +1852,7 @@
    ;; (message "parameter_list-args: %S" (nth 5 args))
    ;; (message "parameter_list-terminals: %S" (nth 5 terminals))
 
-   ;; Iterate optional parameters are declare them
+   ;; Iterate optional parameters are declare them as new variable declarations
    (when-let ((parameter-list (nth 5 args)))
      (dolist (parameter parameter-list)
        (let ((parameter-ast-type (plist-get parameter 'ast-type)))
@@ -1838,7 +1878,6 @@
                symbol-end)
               phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)))))))
 
-   
    ;; (message
    ;;  "phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S"
    ;;  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
@@ -1848,41 +1887,35 @@
 
    ;; Go through stacks and modify symbol namespaces
    ;; but only for non-super-global variables
-   (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
-     (dolist (
+   (let ((function-name (nth 2 args)))
+     (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
+       (dolist (
+                symbol-list
+                phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+         (let ((symbol-name (car symbol-list)))
+           (unless (gethash
+                    symbol-name
+                    phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+             (setcar
               symbol-list
-              phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
-       (let ((symbol-name (car symbol-list)))
-         (unless (gethash
-                  symbol-name
-                  phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
-         (setcar symbol-list
-                 (format
-                  " function %s%s"
-                  (nth 2 args)
-                  symbol-name)))))
-     ;; (message
-     ;;  "new-phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S"
-     ;;  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
-     )
-
-   (when phps-mode-parser-sdt--bookkeeping-symbol-stack
-     (dolist (
+              (format
+               " function %s%s"
+               function-name
+               symbol-name))))))
+     (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+       (dolist (
+                symbol-list
+                phps-mode-parser-sdt--bookkeeping-symbol-stack)
+         (let ((symbol-name (car symbol-list)))
+           (unless (gethash
+                    symbol-name
+                    phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+             (setcar
               symbol-list
-              phps-mode-parser-sdt--bookkeeping-symbol-stack)
-       (let ((symbol-name (car symbol-list)))
-         (unless (gethash
-                  symbol-name
-                  phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
-           (setcar symbol-list
-                   (format
-                    " function %s%s"
-                    (nth 2 args)
-                    symbol-name)))))
-     ;; (message
-     ;;  "new-phps-mode-parser-sdt--bookkeeping-symbol-stack: %S"
-     ;;  phps-mode-parser-sdt--bookkeeping-symbol-stack)
-     )
+              (format
+               " function %s%s"
+               function-name
+               symbol-name)))))))
 
    `(
      ast-type
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 7c29e7cb5e..826b20ccbc 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -373,6 +373,8 @@
    "Bookkeeping of self reference inside arrow function inside of static 
method"
    '((" class myClass static id $var" 1) ((30 34) 1) (" class myClass function 
myMethod id $a" 1) ((69 71) 1) (" class myClass function myMethod arrow 
function 1 id $b" 1) ((85 87) 1) ((98 102) 1) ((105 107) 1) ((110 112) 1)))
 
+  ;; TODO Add trait class bookkeping test here
+
   ;; TODO Make this test pass
   ;; (phps-mode-test-ast--should-bookkeep
   ;;  "<?php\nnamespace myNamespace;\nclass myClass\n{\n    private $property1 
= '';\n    private $property2;\n    protected function myMethod(\n        
$argument1,\n        $argument2,\n        $argument3\n    ) {\n        if 
($this->property2) {\n            echo 'was here';\n        }\n        /* 
@codingStandardsIgnoreEnd */\n        if (\n            $argument1\n            
&& $argument2\n            && $argument3\n            && $argument4\n           
 && !empty($argument1['index']) [...]



reply via email to

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