[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}"
- [elpa] externals/phps-mode 75743d0c25 022/135: Merge branch 'master' into feature/full-sdt, (continued)
- [elpa] externals/phps-mode 75743d0c25 022/135: Merge branch 'master' into feature/full-sdt, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 610358e2ef 026/135: SDT for property, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 4981a1eb45 032/135: SDT rules up to 520, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode b2454f1967 058/135: Bookkeeping of static class property, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 962b905ca0 057/135: Bookkeeping working for class non-static properties, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 7b9f8011f1 056/135: More testing, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode e2f2c86e18 059/135: Improved class properties bookkeeping test, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode eac10d63e6 063/135: Started on bookkeeping of variables inside anonymous functions, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode e924ac83b6 065/135: Improved bookkeeping test for anonymous function, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode e614a20ada 066/135: Added bookkeeping for referenced foreach variables, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode d33625bb1a 067/135: Bookkeeping for array assignment passing test,
Christian Johansson <=
- [elpa] externals/phps-mode a646676781 084/135: Passing more bookkeeping tests, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 7609f09f04 090/135: More bookkeeping final touches, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 6c6906317a 095/135: Added bookkeeping test for trait class symbols, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode ada5e79291 097/135: Passing bookkeeping test for class properties in class constructor, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 8aae220c57 098/135: Started on integrating imenu generation in SDT bookkeeping, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 95f563fc70 102/135: Passing bookkeeping tests with integrated imenu generation, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode ae516f9e19 105/135: Using separate imenu items for redeclared symbols, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode b21c9f3f3a 107/135: Imenu generation via SDT all tests now passing, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 3332b2bfa9 109/135: Fixes syntax coloring of super-globals, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode bddf800099 111/135: Added failing test, Christian Johansson, 2023/01/29