[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 9c67facc86 075/135: Work on bookkeeping of cl
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 9c67facc86 075/135: Work on bookkeeping of class static properties |
Date: |
Sun, 29 Jan 2023 03:11:06 -0500 (EST) |
branch: externals/phps-mode
commit 9c67facc8673fc55152565e3c4763e7433994e39
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Work on bookkeeping of class static properties
---
phps-mode-parser-sdt.el | 232 ++++++++++++++++++++++++++----------------------
1 file changed, 124 insertions(+), 108 deletions(-)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 2f93d6bfd8..307086b390 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -634,116 +634,132 @@
name
(let ((potential-uris (list "")))
(when scope
- (dolist (item scope)
- (let ((space-type (car item))
- (space-name (car (cdr item))))
- (cond
-
- ((equal space-type 'namespace)
- (let ((potential-uri-count (length potential-uris))
- (potential-uri-index 0))
- (while (< potential-uri-index potential-uri-count)
- (setf
- (nth potential-uri-index potential-uris)
- (format " namespace %s%s" space-name (nth
potential-uri-index potential-uris)))
- (setq potential-uri-index (1+ potential-uri-index)))))
-
- ((equal space-type 'class)
- (let ((potential-uri-count (length potential-uris))
- (potential-uri-index 0))
- (while (< potential-uri-index potential-uri-count)
- (setf
- (nth potential-uri-index potential-uris)
- (format " class %s%s" space-name (nth potential-uri-index
potential-uris)))
- (setq potential-uri-index (1+ potential-uri-index)))))
-
- ((equal space-type 'interface)
- (let ((potential-uri-count (length potential-uris))
- (potential-uri-index 0))
- (while (< potential-uri-index potential-uri-count)
- (setf
- (nth potential-uri-index potential-uris)
- (format " interface %s%s" space-name (nth
potential-uri-index potential-uris)))
- (setq potential-uri-index (1+ potential-uri-index)))))
-
- ((equal space-type 'trait)
- (let ((potential-uri-count (length potential-uris))
- (potential-uri-index 0))
- (while (< potential-uri-index potential-uri-count)
- (setf
- (nth potential-uri-index potential-uris)
- (format " trait %s%s" space-name (nth potential-uri-index
potential-uris)))
- (setq potential-uri-index (1+ potential-uri-index)))))
-
- ((equal space-type 'function)
- (let ((potential-uri-count (length potential-uris))
- (potential-uri-index 0))
- (while (< potential-uri-index potential-uri-count)
- (setf
- (nth potential-uri-index potential-uris)
- (format " function %s%s" space-name (nth
potential-uri-index potential-uris)))
- (setq potential-uri-index (1+ potential-uri-index)))))
-
- ((equal space-type 'anonymous-function)
- (let ((potential-uri-count (length potential-uris))
- (potential-uri-index 0))
- (while (< potential-uri-index potential-uri-count)
- (setf
- (nth potential-uri-index potential-uris)
- (format " anonymous %s%s" space-name (nth
potential-uri-index potential-uris)))
- (setq potential-uri-index (1+ potential-uri-index)))))
-
- ((equal space-type 'static)
- (let ((potential-uri-count (length potential-uris))
- (potential-uri-index 0))
- (while (< potential-uri-index potential-uri-count)
- (setf
- (nth potential-uri-index potential-uris)
- (format " static%s" (nth potential-uri-index
potential-uris)))
- (setq potential-uri-index (1+ potential-uri-index)))))
-
- ((equal space-type 'arrow-function)
- ;; TODO Should branch of two here one with and one without the
arrow function scope
- (let ((potential-uri-count (length potential-uris))
- (potential-uri-index 0))
- (while (< potential-uri-index potential-uri-count)
- (setf
- (nth potential-uri-index potential-uris)
- (format " anonymous %s%s" space-name (nth
potential-uri-index potential-uris)))
- (setq potential-uri-index (1+ potential-uri-index)))))
-
- ;; TODO Below should alter symbol namespaces instead of build
namespace data
- ((equal space-type 'global)
- (setq namespace nil)
- (setq class nil)
- (setq function nil)
- (setq arrow-function nil)
- (setq anonymous-function nil))
-
- ((equal space-type 'object-operator)
- (let ((downcased-space-name
- (downcase space-name)))
+ (let ((scope-count (length scope))
+ (scope-index 0))
+ (while (< scope-index scope-count)
+ (let ((item (nth scope-index scope))
+ (next-scope)
+ (next-scope-type)
+ (next-scope-is-this-object-operator)
+ (next-scope-is-self-static-member-operator))
+
+ ;; Should add one scope look-ahead to determine if we should
+ ;; ignore function scope before a $this-> or self:: or static::
operator
+ (when (< scope-index (1- scope-count))
+ (setq next-scope (nth (1+ scope-index) scope))
+ (setq next-scope-type (car next-scope))
(cond
- ((string= downcased-space-name "$this")
- (setq function nil))
- (t
- ;; TODO Do something here
- ))))
-
- ((equal space-type 'static-member)
- (let ((downcased-space-name
- (downcase space-name)))
+ ((equal next-scope-type 'object-operator)
+ (let ((downcased-scope-name (downcase (car (cdr
next-scope)))))
+ (when (string= downcased-scope-name "$this")
+ (setq next-scope-is-this-object-operator t))))
+ ((equal next-scope-type 'static-member)
+ (let ((downcased-scope-name (downcase (car (cdr
next-scope)))))
+ (when (or
+ (string= downcased-scope-name "self")
+ (string= downcased-scope-name "static"))
+
+ (let ((potential-uri-count (length potential-uris))
+ (potential-uri-index 0))
+ (while (< potential-uri-index potential-uri-count)
+ (setf
+ (nth potential-uri-index potential-uris)
+ (format " static%s" (nth potential-uri-index
potential-uris)))
+ (setq potential-uri-index (1+ potential-uri-index))))
+
+ (setq next-scope-is-self-static-member-operator t))))))
+
+ (let ((space-type (car item))
+ (space-name (car (cdr item))))
(cond
- ((or
- (string= downcased-space-name "self")
- (string= downcased-space-name "static"))
- (setq is-static-p t)
- (setq function nil))
- (t
- ;; TODO Do something here
- ))))
-
- ))))
+
+ ((equal space-type 'namespace)
+ (let ((potential-uri-count (length potential-uris))
+ (potential-uri-index 0))
+ (while (< potential-uri-index potential-uri-count)
+ (setf
+ (nth potential-uri-index potential-uris)
+ (format " namespace %s%s" space-name (nth
potential-uri-index potential-uris)))
+ (setq potential-uri-index (1+ potential-uri-index)))))
+
+ ((equal space-type 'class)
+ (let ((potential-uri-count (length potential-uris))
+ (potential-uri-index 0))
+ (while (< potential-uri-index potential-uri-count)
+ (setf
+ (nth potential-uri-index potential-uris)
+ (format " class %s%s" space-name (nth
potential-uri-index potential-uris)))
+ (setq potential-uri-index (1+ potential-uri-index)))))
+
+ ((equal space-type 'interface)
+ (let ((potential-uri-count (length potential-uris))
+ (potential-uri-index 0))
+ (while (< potential-uri-index potential-uri-count)
+ (setf
+ (nth potential-uri-index potential-uris)
+ (format " interface %s%s" space-name (nth
potential-uri-index potential-uris)))
+ (setq potential-uri-index (1+ potential-uri-index)))))
+
+ ((equal space-type 'trait)
+ (let ((potential-uri-count (length potential-uris))
+ (potential-uri-index 0))
+ (while (< potential-uri-index potential-uri-count)
+ (setf
+ (nth potential-uri-index potential-uris)
+ (format " trait %s%s" space-name (nth
potential-uri-index potential-uris)))
+ (setq potential-uri-index (1+ potential-uri-index)))))
+
+ ((and
+ (equal space-type 'function)
+ (not (or
+ next-scope-is-this-object-operator
+ next-scope-is-self-static-member-operator)))
+ (let ((potential-uri-count (length potential-uris))
+ (potential-uri-index 0))
+ (while (< potential-uri-index potential-uri-count)
+ (setf
+ (nth potential-uri-index potential-uris)
+ (format " function %s%s" space-name (nth
potential-uri-index potential-uris)))
+ (setq potential-uri-index (1+ potential-uri-index)))))
+
+ ((equal space-type 'anonymous-function)
+ (let ((potential-uri-count (length potential-uris))
+ (potential-uri-index 0))
+ (while (< potential-uri-index potential-uri-count)
+ (setf
+ (nth potential-uri-index potential-uris)
+ (format " anonymous %s%s" space-name (nth
potential-uri-index potential-uris)))
+ (setq potential-uri-index (1+ potential-uri-index)))))
+
+ ((equal space-type 'static)
+ (let ((potential-uri-count (length potential-uris))
+ (potential-uri-index 0))
+ (while (< potential-uri-index potential-uri-count)
+ (setf
+ (nth potential-uri-index potential-uris)
+ (format " static%s" (nth potential-uri-index
potential-uris)))
+ (setq potential-uri-index (1+ potential-uri-index)))))
+
+ ((equal space-type 'arrow-function)
+ ;; TODO Should branch of two here one with and one without
the arrow function scope
+ (let ((potential-uri-count (length potential-uris))
+ (potential-uri-index 0))
+ (while (< potential-uri-index potential-uri-count)
+ (setf
+ (nth potential-uri-index potential-uris)
+ (format " anonymous %s%s" space-name (nth
potential-uri-index potential-uris)))
+ (setq potential-uri-index (1+ potential-uri-index)))))
+
+ ;; TODO Below should alter symbol namespaces instead of build
namespace data
+ ((equal space-type 'global)
+ (setq namespace nil)
+ (setq class nil)
+ (setq function nil)
+ (setq arrow-function nil)
+ (setq anonymous-function nil))
+
+ )))
+ (setq scope-index (1+ scope-index)))))
(let ((potential-uri-count (length potential-uris))
(potential-uri-index 0)
- [elpa] externals/phps-mode c6e4844753 122/135: Some byte-compilation fixes, (continued)
- [elpa] externals/phps-mode c6e4844753 122/135: Some byte-compilation fixes, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 96eeff74f8 130/135: Added more todo items for bookkeeping and imenu, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 66ad034207 025/135: SDT member_modifier, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 34a595fa09 028/135: SDT class_const_list, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 1332919417 049/135: Passing another bookkeeping test via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 438ec520fc 051/135: Passing bookkeeping via SDT for conditional assignments, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 7fa721a85d 060/135: More work on bookkeeping static class properties, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 0bf9b31fef 062/135: Passed bookkeeping via SDT for try catch variables, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 40d7d88fb8 069/135: Work on bookkeeping global variables, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode a10656fc34 070/135: Passing bookkeeping test for global variables, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 9c67facc86 075/135: Work on bookkeeping of class static properties,
Christian Johansson <=
- [elpa] externals/phps-mode 39a6fe03ae 079/135: Improved is-varadic and is-reference argument flags, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode e8a5dbe153 126/135: Fix for trait and interface imenu, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 579034d1c6 127/135: Passing imenu test via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode fb9a181135 088/135: Passed more bookkeeping tsts, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode e6bc401d0b 068/135: Work on improving test for global variable bookkeeping, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 4949daefd9 101/135: Passing another SDT imenu test, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode c0c37bafd9 110/135: Added some TODO items, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 76ef8cceac 124/135: More fixes in code, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 3b6eb46d4c 129/135: Added new MVP bookkeeping and imenu test, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode f9ddef260c 039/135: Passing first bookkeeping test using SDT generated bookkeeping, Christian Johansson, 2023/01/29