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

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

[elpa] externals/phps-mode d33625bb1a 067/135: Bookkeeping for array ass


From: Christian Johansson
Subject: [elpa] externals/phps-mode d33625bb1a 067/135: Bookkeeping for array assignment passing test
Date: Sun, 29 Jan 2023 03:11:04 -0500 (EST)

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

    Bookkeeping for array assignment passing test
---
 phps-mode-parser-sdt.el    | 62 ++++++++++++++++++++++++++++++----------------
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 41 insertions(+), 23 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index a2bd37905b..9d4866167a 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -3829,6 +3829,39 @@
 (puthash
  358
  (lambda(args _terminals)
+   ;; TODO Declare array-pair-list assignments here
+   (let ((array-pair-list (nth 1 args)))
+     (dolist (array-item array-pair-list)
+       (let ((array-item-type (plist-get array-item 'ast-type)))
+         (cond
+          ((equal array-item-type 'array-pair-expr)
+           (let* ((array-item-expr (plist-get array-item 'expr))
+                  (array-item-expr-type (plist-get array-item-expr 'ast-type)))
+             (cond
+              ((equal array-item-expr-type 'expr-variable)
+               (let* ((expr-variable (plist-get array-item-expr 'variable))
+                      (expr-variable-type (plist-get expr-variable 'ast-type)))
+                 (cond
+                  ((equal expr-variable-type 'variable-callable-variable)
+                   (let* ((callable-variable (plist-get expr-variable 
'callable-variable))
+                          (callable-variable-type (plist-get callable-variable 
'ast-type)))
+                     (cond
+                      ((equal callable-variable-type 
'callable-variable-simple-variable)
+                       (let* ((callable-simple-variable
+                               (plist-get callable-variable 'simple-variable))
+                              (variable-name
+                               (plist-get callable-simple-variable 'variable))
+                              (variable-start
+                               (plist-get callable-simple-variable 'ast-start))
+                              (variable-end
+                               (plist-get callable-simple-variable 'ast-end)))
+                         (push
+                          (list
+                           variable-name
+                           phps-mode-parser-sdt--bookkeeping-namespace
+                           variable-start
+                           variable-end)
+                          
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))))))))))))))))
    `(
      ast-type
      expr-list
@@ -6215,52 +6248,37 @@
 (puthash
  533
  (lambda(args _terminals)
-   `(
-     ast-type
-     array-pair-list-non-empty
-     non-empty-array-pair-list
-     ,args))
+   args)
  phps-mode-parser--table-translations)
 
 ;; 534 ((possible_array_pair) (%empty))
 (puthash
  534
  (lambda(args _terminals)
-   `(
-     ast-type
-     possible-array-pair-empty))
+   nil)
  phps-mode-parser--table-translations)
 
 ;; 535 ((possible_array_pair) (array_pair))
 (puthash
  535
  (lambda(args _terminals)
-   `(
-     ast-type
-     possible-array-pair-not-empty
-     array-pair
-     ,args))
+   args)
  phps-mode-parser--table-translations)
 
 ;; 536 ((non_empty_array_pair_list) (non_empty_array_pair_list "," 
possible_array_pair))
 (puthash
  536
  (lambda(args _terminals)
-   `(
-     ast-type
-     non-empty-array-pair-list
-     ,(append (nth 0 args) (list (nth 2 args)))))
+   (if (nth 2 args)
+       (append (nth 0 args) (list (nth 2 args)))
+     (nth 0 args)))
  phps-mode-parser--table-translations)
 
 ;; 537 ((non_empty_array_pair_list) (possible_array_pair))
 (puthash
  537
  (lambda(args _terminals)
-   `(
-     ast-type
-     non-empty-array-pair-list
-     possible-array-pair
-     ,args))
+   (list args))
  phps-mode-parser--table-translations)
 
 ;; 538 ((array_pair) (expr T_DOUBLE_ARROW expr))
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index b6485e2ecc..15621b146a 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -271,7 +271,7 @@
   (phps-mode-test-ast--should-bookkeep
    "<?php\n\n[$random, $bandom] = myValues();\nif ($random) {\n    echo 
'Hit';\n}\nif ($bandom) {\n    echo 'Hit';\n}\n"
    "Bookkeeping of variable declarations in array"
-   '((" id $random" 1) ((9 16) 1) (" id $bandom" 1) ((18 25) 1) ((45 52) 1) 
((78 85) 1)))
+   '((" id $bandom" ((18 25))) (" id $random" ((9 16))) ((18 25) 1) ((9 16) 1) 
((45 52) 1) ((78 85) 1)))
 
   (phps-mode-test-ast--should-bookkeep
    "<?php\n\n$var = 123;\n\nfunction test($abc) {\n    global $var;\n    if 
($var) {\n        echo 'Hit';\n    }\n}"



reply via email to

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