[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 4dc07c9041 050/212: Bookkeeping via AST worki
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 4dc07c9041 050/212: Bookkeeping via AST working with assigned variables from array |
Date: |
Wed, 26 Jan 2022 01:50:40 -0500 (EST) |
branch: externals/phps-mode
commit 4dc07c90415bf69997ddf6e7833e5debbd6209bb
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Bookkeeping via AST working with assigned variables from array
---
phps-mode-ast-bookkeeping.el | 13 +++++++++++++
phps-mode-parser-sdt.el | 28 +++++++++++++++++++++++-----
test/phps-mode-test-ast.el | 2 +-
3 files changed, 37 insertions(+), 6 deletions(-)
diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index 53a5e8d6f4..0655bf0091 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -398,6 +398,19 @@
defined
bookkeeping)))
+ ((equal type 'assign-variables-from-array)
+ (when-let ((keys (reverse (plist-get item 'keys))))
+ (dolist (key keys)
+ (push
+ (list
+ scope
+ (list
+ 'ast-type
+ 'assign-variable
+ 'key
+ key))
+ bookkeeping-stack))))
+
((and
(equal type 'assign-variable)
(plist-get (plist-get item 'key) 'name))
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index a82a32bcba..b2e391d749 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -585,16 +585,21 @@
ast-object))
phps-mode-parser--table-translations)
-;; expr -> (variable T_INC)
+;; expr -> ("[" array_pair_list "]" "=" expr)
(puthash
- 353
+ 336
(lambda(args _terminals)
(let ((ast-object
(list
'ast-type
- 'increment-variable
- 'variable
- (nth 0 args))))
+ 'assign-variables-from-array
+ 'keys
+ (nth 1 args)
+ 'values
+ (phps-mode-parser-sdt--get-list-of-object (nth 4 args)))))
+ ;; (message "Method: %S" ast-object)
+ ;; (message "args: %S" args)
+ ;; (message "terminals: %S" terminals)
ast-object))
phps-mode-parser--table-translations)
@@ -623,6 +628,19 @@
ast-object))
phps-mode-parser--table-translations)
+;; expr -> (variable T_INC)
+(puthash
+ 353
+ (lambda(args _terminals)
+ (let ((ast-object
+ (list
+ 'ast-type
+ 'increment-variable
+ 'variable
+ (nth 0 args))))
+ ast-object))
+ phps-mode-parser--table-translations)
+
;; inline_function -> (function returns_ref backup_doc_comment "("
parameter_list ")" lexical_vars return_type backup_fn_flags "{"
inner_statement_list "}" backup_fn_flags)
(puthash
416
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 569802af74..0ab8142928 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -483,7 +483,7 @@
(phps-mode-ast-bookkeeping--generate)
(should (equal
(phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
- (list (list " id $random" 1) (list (list 9 16) 1) (list " id
$bandom" 1) (list (list 18 25) 1) (list (list 45 52) 1) (list (list 78 85)
1))))))
+ '((" id $random" 1) ((9 16) 1) (" id $bandom" 1) ((18 25) 1)
((45 52) 1) ((78 85) 1))))))
(phps-mode-test-ast--buffer-contents
"<?php\n\n$var = 123;\n\nfunction test($abc) {\n global $var;\n if
($var) {\n echo 'Hit';\n }\n}"
- [elpa] externals/phps-mode 1ab6ac7324 131/212: Added failing tests for indentation, (continued)
- [elpa] externals/phps-mode 1ab6ac7324 131/212: Added failing tests for indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7135a30446 173/212: Updated TODO items, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 63c5fef240 175/212: Started on tests for more basic functions of indentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 735f1e0c89 176/212: More notes, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 73d460d5a4 181/212: Passing lexer tests with optimized lexer, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e5df43eea9 187/212: More tweaking of indentation helpers, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 413547fbf1 188/212: Searching for previous bracket now steps over optional PHP starting tags, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4b4a96fda2 208/212: Improved cache filename, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode ef97058a67 184/212: Added more tests for indentation helper functions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a1af5b11fb 040/212: More work on bookkeeping of class properties via AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4dc07c9041 050/212: Bookkeeping via AST working with assigned variables from array,
Christian Johansson <=
- [elpa] externals/phps-mode 4d226f18cc 048/212: Bookkeeping via AST working with referenced foreach variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5603e6266b 047/212: SDT for array values, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 787d82313e 045/212: Bookkeeping via AST now tracks variables around inline-functions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a629baba89 053/212: More work on bookkeeping via AST for arrow function variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode df0b707a61 044/212: Added parser SDT for inline-function, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 432382eddb 051/212: Added bookkeeping support for global variables in functions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode bb381d8127 041/212: Bookkeeping of class properties via AST passed test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e95df1027b 042/212: Reverted old tests for imenu and bookkeeping for lex-analyzer, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode a65c8af308 008/212: Extract ast code into separate file and test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 23c001c33f 037/212: Moved parser SDT to separate file, Christian Johansson, 2022/01/26