[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode f4d2164f8b 067/212: Bookkeeping via parser SD
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode f4d2164f8b 067/212: Bookkeeping via parser SDT passing static variables in function |
Date: |
Wed, 26 Jan 2022 01:50:48 -0500 (EST) |
branch: externals/phps-mode
commit f4d2164f8b97d4393ba7317608f5b4021606591b
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Bookkeeping via parser SDT passing static variables in function
---
phps-mode-ast-bookkeeping.el | 34 +++++++++++++++++++++++++---------
phps-mode-parser-sdt.el | 8 ++++----
test/phps-mode-test-ast.el | 4 +++-
3 files changed, 32 insertions(+), 14 deletions(-)
diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index 77f853866c..41002d560d 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -110,14 +110,15 @@
(scope name &optional read-only)
"Generate variable scope string from SCOPE and NAME and optionally
READ-ONLY."
(let ((scope-strings)
- (bubbles-stack (list (list "" nil (reverse scope))))) ;; scope-string
namespace bubbles
+ (bubbles-stack (list (list "" nil nil (reverse scope))))) ;;
scope-string namespace bubbles
(while bubbles-stack
(setq
bubbles-data
(pop bubbles-stack))
(let ((scope-string (car bubbles-data))
(namespace (car (cdr bubbles-data)))
- (bubbles (car (cdr (cdr bubbles-data)))))
+ (class (car (cdr (cdr bubbles-data))))
+ (bubbles (car (cdr (cdr (cdr bubbles-data))))))
(while bubbles
(let* ((bubble (pop bubbles))
(scope-type (plist-get bubble 'type))
@@ -148,17 +149,30 @@
(format
"%s class %s"
scope-string
- scope-name))))
+ scope-name)))
+ (setq
+ class
+ scope-name))
((and
(equal scope-type 'function)
scope-name)
- (setq
- scope-string
- (format
- "%s function %s"
- scope-string
- scope-name)))
+ (if (and
+ namespace
+ (not class))
+ (setq
+ scope-string
+ (format
+ "%s namespace %s function %s"
+ scope-string
+ namespace
+ scope-name))
+ (setq
+ scope-string
+ (format
+ "%s function %s"
+ scope-string
+ scope-name))))
((and
(equal scope-type 'inline-function)
@@ -180,6 +194,7 @@
(list
scope-string
namespace
+ class
bubbles)
bubbles-stack))
(setq
@@ -199,6 +214,7 @@
(list
scope-string
namespace
+ class
bubbles)
bubbles-stack))
(setq
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 1919616bb2..a960db1678 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -522,13 +522,13 @@
ast-type
variable
name
- ,(nth 0 args)
+ ,args
index
- ,(car (cdr (nth 0 terminals)))
+ ,(car (cdr terminals))
start
- ,(car (cdr (nth 0 terminals)))
+ ,(car (cdr terminals))
end
- ,(cdr (cdr (nth 0 terminals)))))
+ ,(cdr (cdr terminals))))
phps-mode-parser--table-translations)
;; static_var -> (T_VARIABLE "=" expr)
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index a8715957e0..38b13cd274 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -849,7 +849,7 @@
(phps-mode-test-ast--buffer-contents
"<?php\n\n$a = $b = $c = 3;\n\nif ($a) {\n echo 'a=',$a;\n} else {\n
echo '$a is undefined!';\n}\nif ($b) {\n echo 'b=',$b;\n} else {\n echo
'$b is undefined!';\n}\nif ($c) {\n echo 'c=',$c;\n} else {\n echo '$c is
undefined!';\n}"
- "Bookkeeping of typed class variables"
+ "Bookkeeping of chained variable assignments"
(lambda()
(let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation:\n%S\n" parse)
@@ -869,6 +869,8 @@
(phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
'((" id $a" 1) ((8 10) 1) (" id $b" 1) ((13 15) 1) (" id $c" 1) ((18
20) 1) ((31 33) 1) ((51 53) 1) ((99 101) 1) ((119 121) 1) ((167 169) 1) ((187
189) 1))))))
+ ;; TODO Test nullable typed class properties
+
;; TODO Test variables inside static function and method
;; TODO Test this and make sure all variables hit
- [elpa] externals/phps-mode db7121941c 156/212: Passing indention on line after not equals condition, (continued)
- [elpa] externals/phps-mode db7121941c 156/212: Passing indention on line after not equals condition, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d072fe5315 136/212: Improved indentation around array elements, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f880ba2d62 164/212: Improved indentation on lines after assignment that ends with closing bracket, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode db019887af 170/212: Passed new indentation tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 781356557c 194/212: More adjustments to indent helper to find previous command, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 0735959c08 209/212: Using silent cache write, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode e3bf9e8fed 059/212: SDT rules for some more infix operations, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 2bc31a0f83 065/212: Added TODO items, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d802a669c0 061/212: Bookkeeping via AST working with isset() and !empty() scoped variables, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode d9115ec583 069/212: Cleaned up AST bookkeeping tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f4d2164f8b 067/212: Bookkeeping via parser SDT passing static variables in function,
Christian Johansson <=
- [elpa] externals/phps-mode e66abd00e5 064/212: Bookkeeping via AST passing nested isset() !empty() expressions, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 8b5ce22d87 072/212: Fixed issue with SDT for return statement, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 491c82a2a1 071/212: Added TODO item for bookkeeping via AST, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5ec32f5f5a 076/212: Bookkeeping via AST passing all tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 228f212127 080/212: Starting on removing the old process tokens in string function, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 5b1f5b4774 079/212: Improved format of SDT, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 3f3a8bb0fa 081/212: Major refactor of indent tests, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode b469f0ffbb 088/212: Passing indentation for multi-line class implements, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode f69df4fdf6 083/212: Moved indentation to separate file and test, Christian Johansson, 2022/01/26
- [elpa] externals/phps-mode 481deb6331 082/212: More work on indentation, Christian Johansson, 2022/01/26