[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode cc584ff4d6 061/135: Bookkeping of static clas
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode cc584ff4d6 061/135: Bookkeping of static class properties test passing |
Date: |
Sun, 29 Jan 2023 03:11:04 -0500 (EST) |
branch: externals/phps-mode
commit cc584ff4d6c6ab2531536ea91fc660f56c9c1325
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Bookkeping of static class properties test passing
---
phps-mode-parser-sdt.el | 66 +++++++++++++++++++++-------------------------
test/phps-mode-test-ast.el | 2 +-
2 files changed, 31 insertions(+), 37 deletions(-)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 8590d2e446..6c7fb4b525 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -596,6 +596,11 @@
nil
"Current bookkeeping namespace.")
+(defvar-local
+ phps-mode-parser-sdt--bookkeeping-namespace-stack
+ nil
+ "Current bookkeeping namespace.")
+
(defvar-local
phps-mode-parser-sdt--bookkeeping-symbol-stack
nil
@@ -727,11 +732,11 @@
(phps-mode-parser-sdt--get-symbol-uri
symbol-name
symbol-scope)))
- (message
- "assign symbol uri: %S from %S + %S"
- symbol-uri
- symbol-name
- symbol-scope)
+ ;; (message
+ ;; "assign symbol uri: %S from %S + %S"
+ ;; symbol-uri
+ ;; symbol-name
+ ;; symbol-scope)
(if (gethash symbol-uri phps-mode-parser-sdt-bookkeeping)
(puthash
symbol-uri
@@ -764,11 +769,11 @@
(phps-mode-parser-sdt--get-symbol-uri
symbol-name
symbol-scope)))
- (message
- "reference symbol uri: %S from %S + %S"
- symbol-uri
- symbol-name
- symbol-scope)
+ ;; (message
+ ;; "reference symbol uri: %S from %S + %S"
+ ;; symbol-uri
+ ;; symbol-name
+ ;; symbol-scope)
(cond
;; Super-global variable
@@ -5665,29 +5670,6 @@
(puthash
512
(lambda(args terminals)
- (let ((static-member-type
- (plist-get
- args
- 'ast-type)))
- (cond
- ((equal static-member-type 'static-member-class-name)
- (let* ((class-name (plist-get args 'class-name))
- (class-name-type (plist-get class-name 'ast-type)))
- (cond
- ((equal class-name-type 'class-name-name)
- (let* ((class-name-string (plist-get class-name 'name))
- (simple-variable (plist-get args 'simple-variable))
- (simple-variable-type (plist-get simple-variable 'ast-type)))
- (cond
- ((equal simple-variable-type 'simple-variable-variable)
- (let ((simple-variable-name
- (plist-get simple-variable 'variable))
- (namespace
- phps-mode-parser-sdt--bookkeeping-namespace))
- ;; TODO Should modify stack car instead
- (push
- (list 'static-member class-name-string)
- (nth 1 (car
phps-mode-parser-sdt--bookkeeping-symbol-stack)))))))))))))
`(
ast-type
variable-static-member
@@ -5802,11 +5784,14 @@
(symbol-start
(car (cdr terminals)))
(symbol-end
- (cdr (cdr terminals))))
+ (cdr (cdr terminals)))
+ (namespace phps-mode-parser-sdt--bookkeeping-namespace))
+ (when phps-mode-parser-sdt--bookkeeping-namespace-stack
+ (setq namespace (pop
phps-mode-parser-sdt--bookkeeping-namespace-stack)))
(push
(list
symbol-name
- phps-mode-parser-sdt--bookkeeping-namespace
+ namespace
symbol-start
symbol-end)
phps-mode-parser-sdt--bookkeeping-symbol-stack))
@@ -5850,7 +5835,15 @@
;; 518 ((static_member) (class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable))
(puthash
518
- (lambda(args _terminals)
+ (lambda(args terminals)
+ (let* ((class-name (nth 0 args))
+ (class-name-type (plist-get class-name 'ast-type)))
+ (cond
+ ((equal class-name-type 'class-name-name)
+ (let ((class-name-string (plist-get class-name 'name))
+ (namespace phps-mode-parser-sdt--bookkeeping-namespace))
+ (push (list 'static-member class-name-string) namespace)
+ (push namespace phps-mode-parser-sdt--bookkeeping-namespace-stack)))))
`(
ast-type
static-member-class-name
@@ -5864,6 +5857,7 @@
(puthash
519
(lambda(args _terminals)
+ ;; TODO Add bookkeeping here
`(
ast-type
static-member-variable-class-name
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 76c8e92bee..ce995c6c02 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -246,7 +246,7 @@
(phps-mode-test-ast--should-bookkeep
"<?php\n\n// Class properties\n\nclass myParent {}\n\nclass myClass extends
myParent {\n private $var1 = 123;\n protected static $var2;\n public
$var3;\n var $var4;\n function __construct() {\n if ($this) {\n
echo 'Hit';\n }\n if ($this->var1) {\n echo
'Hit';\n }\n if (self::$var1) {\n echo 'Miss';\n
}\n if (self::$var2) {\n echo 'Hit';\n }\n if
(static::$var2) {\n [...]
"Bookkeeping of class properties"
- '((" class myClass id $var1" 1) ((93 98) 1) (" class myClass static id
$var2" 1) ((127 132) 1) (" class myClass id $var3" 1) ((145 150) 1) (" class
myClass id $var4" 1) ((160 165) 1) (" class myClass function __construct id
$this" 1) ((208 213) 1) ((263 268) 1) ((270 274) 1) ((330 335) 0) ((392 397) 1)
((447 452) 1) ((454 458) 1) ((508 513) 1) ((515 519) 1) ((569 574) 1) ((576
580) 0) ((688 693) 0)))
+ '((" class myClass function __construct id $this" ((194 743))) (" class
myClass id $var4" ((160 165))) (" class myClass id $var3" ((145 150))) (" class
myClass static id $var2" ((127 132))) (" class myClass id $var1" ((93 98)))
((639 643) 0) ((632 637) 1) ((578 582) 1) ((571 576) 1) ((517 521) 1) ((510
515) 1) ((455 460) 1) ((392 397) 1) ((330 335) 0) ((270 274) 1) ((263 268) 1)
((208 213) 1) ((751 756) 0)))
(phps-mode-test-ast--should-bookkeep
"<?php\n\ntry {\n \n} catch (\\Exception $e) {\n if ($e) {\n
echo 'Hit';\n }\n}\n\nif ($e) {\n echo 'Miss';\n}\n"
- [elpa] externals/phps-mode f26c45586d 046/135: More work on bookkeeping, (continued)
- [elpa] externals/phps-mode f26c45586d 046/135: More work on bookkeeping, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode ddc1213d83 002/135: Typo in production number, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 7a3b86b11d 011/135: Added SDT for all statements, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode b68d94ee08 030/135: More SDT rules, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode eb07936ea8 036/135: added todo notes, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 0ca63fe2b6 041/135: Passing another bookkeeping test via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode e74d0fd634 010/135: SDT for inner_statement, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 8dc2235f17 017/135: Added SDT for if_stmt, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode d73af7968e 033/135: SDT to 538, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 0e8923c0bd 042/135: Passed super-globals bookkeeping test via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode cc584ff4d6 061/135: Bookkeping of static class properties test passing,
Christian Johansson <=
- [elpa] externals/phps-mode eefe70b999 072/135: Work on improving symbol URI calculation, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode ebe28c3c9d 073/135: Work on improving symbol URI generation for class method variables, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 61d3e7b1e0 093/135: Passing bookkeeping test but via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode d16c8a4e93 099/135: Passing some tests now with integrated bookkeeping and imenu-generation, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 9a45a530d0 100/135: Passing more imenu tests, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 749659769c 115/135: More work on imenu generation via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 42b983bb16 045/135: More work on bookkeeping via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode cba467b26c 050/135: Added TODO items, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode e1752a3aa3 064/135: Bookkeeping of variables inside simple anonymous functions, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode d464cb1f01 077/135: Fixed bookkeeping of global variables, Christian Johansson, 2023/01/29