[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode fa3681141b 027/212: Passed test for bookkeepi
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode fa3681141b 027/212: Passed test for bookkeeping of conditional assignment via parser SDT |
Date: |
Wed, 26 Jan 2022 01:50:18 -0500 (EST) |
branch: externals/phps-mode
commit fa3681141b7ba6bf12579c52944d776b331f13b7
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Passed test for bookkeeping of conditional assignment via parser SDT
---
phps-mode-ast.el | 116 ++++++++++++++++++++++++++++++++++---------------------
1 file changed, 72 insertions(+), 44 deletions(-)
diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 5e0dbbacf3..77da90c8a7 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -489,6 +489,22 @@
ast-object))
phps-mode-parser--table-translations)
+
+;; function_call -> (name argument_list)
+(puthash
+ 431
+ (lambda(args _terminals)
+ (let ((ast-object
+ (list
+ 'ast-type
+ 'function_call
+ 'name
+ (nth 0 args)
+ 'argument_list
+ (phps-mode-ast--get-list-of-objects (nth 1 args)))))
+ ast-object))
+ phps-mode-parser--table-translations)
+
;; simple_variable -> (T_VARIABLE)
(puthash
492
@@ -497,7 +513,7 @@
(let ((ast-object
(list
'ast-type
- 'variable
+ 'simple_variable
'name
args
'index
@@ -698,7 +714,7 @@
(let ((type (plist-get item 'ast-type)))
(cond
- ((equal type 'variable)
+ ((equal type 'simple_variable)
(let ((id (format
"%s id %s"
variable-namespace
@@ -840,7 +856,7 @@
bookkeeping-stack)))))
((equal type 'if)
- (let ((children (reverse (plist-get item 'children))))
+ (when-let ((children (reverse (plist-get item 'children))))
(dolist (child children)
(push
(list
@@ -850,7 +866,7 @@
namespace)
child)
bookkeeping-stack)))
- (let ((conditions (reverse (plist-get item 'condition))))
+ (when-let ((conditions (reverse (plist-get item 'condition))))
(dolist (condition conditions)
(push
(list
@@ -862,40 +878,7 @@
bookkeeping-stack))))
((equal type 'foreach)
- ;; Optional key
- (when-let ((key (plist-get item 'key)))
- (let ((id (format
- "%s id %s"
- variable-namespace
- (plist-get key 'name)))
- (object (list
- (plist-get key 'start)
- (plist-get key 'end))))
- (puthash
- id
- 1
- bookkeeping)
- (puthash
- object
- 1
- bookkeeping)))
- (let* ((value (plist-get item 'value))
- (id (format
- "%s id %s"
- variable-namespace
- (plist-get value 'name)))
- (object (list
- (plist-get value 'start)
- (plist-get value 'end))))
- (puthash
- id
- 1
- bookkeeping)
- (puthash
- object
- 1
- bookkeeping))
- (let ((children (reverse (plist-get item 'children))))
+ (when-let ((children (reverse (plist-get item 'children))))
(dolist (child children)
(push
(list
@@ -905,7 +888,33 @@
namespace)
child)
bookkeeping-stack)))
- (let ((expression (reverse (plist-get item 'expression))))
+ (when-let ((value (plist-get item 'value)))
+ (push
+ (list
+ (list
+ class
+ function
+ namespace)
+ (list
+ 'ast-type
+ 'assign-variable
+ 'key
+ value))
+ bookkeeping-stack))
+ (when-let ((key (plist-get item 'key)))
+ (push
+ (list
+ (list
+ class
+ function
+ namespace)
+ (list
+ 'ast-type
+ 'assign-variable
+ 'key
+ key))
+ bookkeeping-stack))
+ (when-let ((expression (reverse (plist-get item 'expression))))
(dolist (expr expression)
(push
(list
@@ -917,7 +926,6 @@
bookkeeping-stack))))
((equal type 'for)
- ;; Optional incremental
(when-let ((children (reverse (plist-get item 'children))))
(dolist (child children)
(push
@@ -928,7 +936,6 @@
namespace)
child)
bookkeeping-stack)))
- ;; Optional incremental
(when-let ((children (reverse (plist-get item 'incremental))))
(dolist (child children)
(push
@@ -939,7 +946,6 @@
namespace)
child)
bookkeeping-stack)))
- ;; Optional test
(when-let ((children (reverse (plist-get item 'test))))
(dolist (child children)
(push
@@ -950,7 +956,6 @@
namespace)
child)
bookkeeping-stack)))
- ;; Optional initial
(when-let ((children (reverse (plist-get item 'initial))))
(dolist (child children)
(push
@@ -1026,7 +1031,18 @@
(puthash
object
defined
- bookkeeping)))
+ bookkeeping)
+ (when-let ((exps (plist-get item 'value)))
+ (when (listp exps)
+ (dolist (exp exps)
+ (push
+ (list
+ (list
+ class
+ function
+ namespace)
+ exp)
+ bookkeeping-stack))))))
((equal type 'property)
(let ((subject (plist-get item 'subject)))
@@ -1052,6 +1068,18 @@
defined
bookkeeping))))
+ ((equal type 'function_call)
+ (when-let ((arguments (plist-get item 'argument_list)))
+ (dolist (argument arguments)
+ (push
+ (list
+ (list
+ class
+ function
+ namespace)
+ argument)
+ bookkeeping-stack))))
+
)))))
(setq
phps-mode-ast--bookkeeping
- [elpa] externals/phps-mode 2afb7dc87a 002/212: Generating basic imenu-index via parser SDT, (continued)
- [elpa] externals/phps-mode 2afb7dc87a 002/212: Generating basic imenu-index via parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 41b1566c40 010/212: Imenu generation via parser SDT passing more tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 8f9870fb9b 013/212: Parser SDT does not use global variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 4753734b0a 006/212: Moved syntax coloring to separate file, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d037aa09bc 023/212: Added bookkeeping via parser SDT foreach ($x as $y) {}, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 3d54b6ff01 022/212: Passed another test for bookkeeping generated via parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 442ad93cb2 018/212: Fix for function parameter formatting in AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2a4d5dea37 019/212: Passed bookkeeping of function arguments, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode c29e35fea2 021/212: More work on bookkeeping, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0daaa97f8d 025/212: SDT for for() loop started, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode fa3681141b 027/212: Passed test for bookkeeping of conditional assignment via parser SDT,
Christian Johansson <=
- [elpa] externals/phps-mode fc4c763d68 030/212: Added SDT for class properties, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f7c261cee1 032/212: Generate parser command now compatible with latest emacs-parser-generator, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f82c9a377d 033/212: Re-generated parser to verify automation functionality, improved automation documentation, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f858060096 034/212: More work on bookkeeping generated from parser SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode c83b1c264e 060/212: Fixed SDT for isset_variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 8fa61fa1f2 063/212: Passing bookkeeping of interface method arguments, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 7a636ccd28 078/212: Removed obsolete file parser-grammar-macro.el, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode ee211dac6a 084/212: Started on indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f65ca852cd 092/212: Passed another indent test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 9a2573939a 094/212: More wrestling, Christian Johansson, 2022/01/26