[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 7f504111eb 11/12: Commented out work on bookk
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 7f504111eb 11/12: Commented out work on bookkeeping constants |
Date: |
Sun, 5 Feb 2023 03:06:14 -0500 (EST) |
branch: externals/phps-mode
commit 7f504111ebdf57dfafd860dac9879281c120235c
Author: christian <christian@cvj.se>
Commit: christian <christian@cvj.se>
Commented out work on bookkeeping constants
---
phps-mode-parser-sdt.el | 143 +++++++++++++++++++++++----------------------
test/phps-mode-test-ast.el | 10 ++--
2 files changed, 79 insertions(+), 74 deletions(-)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 4f9804b375..1a385ec617 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -708,7 +708,7 @@
(setq next-scope-is-this-object-operator t))))
((equal next-scope-type 'static-member)
(setq scope-static-member t)
- (let ((downcased-scope-name (downcase (car (cdr
next-scope)))))
+ (let ((downcased-scope-name (downcase (plist-get (car (cdr
next-scope)) 'name))))
(when (or
(string= downcased-scope-name "self")
(string= downcased-scope-name "static"))
@@ -1612,8 +1612,13 @@
(and
symbol-static-member
(not
- (or (string= (downcase symbol-static-member) "self")
- (string= (downcase symbol-static-member) "static")))))
+ (or
+ (and
+ (listp symbol-static-member)
+ (string= (downcase (plist-get symbol-static-member
'name)) "self"))
+ (and
+ (listp symbol-static-member)
+ (string= (downcase (plist-get symbol-static-member
'name)) "static"))))))
(cond
;; Super-global variable
@@ -7169,73 +7174,73 @@
;; 482 ((constant) (name))
(puthash
482
- (lambda(args terminals)
- (message "482: %S" args)
+ (lambda(args _terminals)
;; TODO Should bookkeep symbol read here
- (let ((constant-name-type (plist-get args 'ast-type))
- (constant-name (plist-get args 'name))
- (constant-start (car (cdr terminals)))
- (constant-end (cdr (cdr terminals))))
- (cond
-
- ((equal constant-name-type 'string-name)
- ;; BLAHA
- ;; TODO When reading this symbol should check global namespace
- ;; and namespace constants for hit
- (let ((symbol-scope phps-mode-parser-sdt--bookkeeping-namespace))
- (push (list 'constant) symbol-scope)
- (push
- (list
- constant-name
- symbol-scope
- constant-start
- constant-end)
- phps-mode-parser-sdt--bookkeeping-symbol-stack)))
-
- ((equal constant-name-type 'qualified-name)
- ;; BLAHA\BLAHA
- ;; TODO Handle this
- )
-
- ((equal constant-name-type 'fully-qualified-name)
- ;; \BLAHA
- (let* ((constant-namespace)
- (string-pos 0)
- (namespace-pos
- (string-search "\\" constant-name string-pos))
- (namespace-last-pos namespace-pos))
-
- ;; Extract any potential constant namespace here
- (when namespace-pos
- (setq string-pos (1+ string-pos))
- (setq namespace-pos (string-search "\\" constant-name string-pos))
- (while namespace-pos
- (setq namespace-last-pos namespace-pos)
- (setq string-pos (1+ string-pos))
- (setq namespace-pos (string-search "\\" constant-name
string-pos)))
- (unless (= namespace-last-pos 0)
- (setq
- constant-namespace
- (substring constant-name 1 namespace-last-pos)))
- (setq
- constant-name
- (substring constant-name (1+ namespace-last-pos))))
-
- (push
- (list
- constant-name
- (if constant-namespace `((namespace ,constant-namespace)) nil)
- constant-start
- constant-end)
- phps-mode-parser-sdt--bookkeeping-symbol-stack)))
-
- ((equal constant-name-type 'relative-name)
- ;; namespace\A inside namespace X\Y resolves to X\Y\A.
- ;; TODO Handle this
- )
-
- ))
+ ;; (message "482: %S" args)
+ ;; (let ((constant-name-type (plist-get args 'ast-type))
+ ;; (constant-name (plist-get args 'name))
+ ;; (constant-start (car (cdr terminals)))
+ ;; (constant-end (cdr (cdr terminals))))
+ ;; (cond
+
+ ;; ((equal constant-name-type 'string-name)
+ ;; ;; BLAHA
+ ;; ;; TODO When reading this symbol should check global namespace
+ ;; ;; and namespace constants for hit
+ ;; (let ((symbol-scope phps-mode-parser-sdt--bookkeeping-namespace))
+ ;; (push (list 'constant) symbol-scope)
+ ;; (push
+ ;; (list
+ ;; constant-name
+ ;; symbol-scope
+ ;; constant-start
+ ;; constant-end)
+ ;; phps-mode-parser-sdt--bookkeeping-symbol-stack)))
+
+ ;; ((equal constant-name-type 'qualified-name)
+ ;; ;; BLAHA\BLAHA
+ ;; ;; TODO Handle this
+ ;; )
+
+ ;; ((equal constant-name-type 'fully-qualified-name)
+ ;; ;; \BLAHA
+ ;; (let* ((constant-namespace)
+ ;; (string-pos 0)
+ ;; (namespace-pos
+ ;; (string-search "\\" constant-name string-pos))
+ ;; (namespace-last-pos namespace-pos))
+
+ ;; ;; Extract any potential constant namespace here
+ ;; (when namespace-pos
+ ;; (setq string-pos (1+ string-pos))
+ ;; (setq namespace-pos (string-search "\\" constant-name
string-pos))
+ ;; (while namespace-pos
+ ;; (setq namespace-last-pos namespace-pos)
+ ;; (setq string-pos (1+ string-pos))
+ ;; (setq namespace-pos (string-search "\\" constant-name
string-pos)))
+ ;; (unless (= namespace-last-pos 0)
+ ;; (setq
+ ;; constant-namespace
+ ;; (substring constant-name 1 namespace-last-pos)))
+ ;; (setq
+ ;; constant-name
+ ;; (substring constant-name (1+ namespace-last-pos))))
+
+ ;; (push
+ ;; (list
+ ;; constant-name
+ ;; (if constant-namespace `((namespace ,constant-namespace)) nil)
+ ;; constant-start
+ ;; constant-end)
+ ;; phps-mode-parser-sdt--bookkeeping-symbol-stack)))
+
+ ;; ((equal constant-name-type 'relative-name)
+ ;; ;; namespace\A inside namespace X\Y resolves to X\Y\A.
+ ;; ;; TODO Handle this
+ ;; )
+
+ ;; ))
`(
ast-type
@@ -7749,7 +7754,7 @@
namespace)))
((equal class-name-type 'class-name-static)
(let ((namespace phps-mode-parser-sdt--bookkeeping-namespace))
- (push (list 'static-member "static") namespace)
+ (push (list 'static-member (list 'ast-type 'string-name 'name
"static")) namespace)
(setf
(nth 1 (car phps-mode-parser-sdt--bookkeeping-symbol-stack))
namespace)))))
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 505d7ef968..5e96cf133b 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -134,11 +134,11 @@
;; TODO v2 Should properly bookkeep inside potentially endlessly nested
anonymous functions / arrow functions / anonymous classes
;; TODO v2 bookkeep and include all kind of constants in imenu
- (phps-mode-test-ast--should-bookkeep
- "<?php\n\nnamespace mySpace\n{\n define('MY_CONSTANT', 'abc123');\n
const MY_CONSTANT2 = 'def456';\n\n if (\\MY_CONSTANT) {\n echo
'hit';\n }\n if (MY_CONSTANT) {\n echo 'hit';\n }\n if
(MY_CONSTANT2) {\n echo 'hit';\n }\n if (\\mySpace\\MY_CONSTANT2)
{\n echo 'hit';\n }\n\n if (\\YOUR_CONSTANT) {\n echo
'miss';\n }\n if (YOUR_CONSTANT) {\n echo 'miss';\n }\n if
(\\MY_CONSTANT2) {\n echo 'mis [...]
- "Constants in all possible scopes"
- '(((159 170) 1) ((208 220) 1) ((371 384) 0) ((848 862) 5) ((900 911) 1)
((1000 1011) 1))
- '(("abc")))
+ ;; (phps-mode-test-ast--should-bookkeep
+ ;; "<?php\n\nnamespace mySpace\n{\n define('MY_CONSTANT', 'abc123');\n
const MY_CONSTANT2 = 'def456';\n\n if (\\MY_CONSTANT) {\n echo
'hit';\n }\n if (MY_CONSTANT) {\n echo 'hit';\n }\n if
(MY_CONSTANT2) {\n echo 'hit';\n }\n if (\\mySpace\\MY_CONSTANT2)
{\n echo 'hit';\n }\n\n if (\\YOUR_CONSTANT) {\n echo
'miss';\n }\n if (YOUR_CONSTANT) {\n echo 'miss';\n }\n if
(\\MY_CONSTANT2) {\n echo ' [...]
+ ;; "Constants in all possible scopes"
+ ;; '(((159 170) 1) ((208 220) 1) ((371 384) 0) ((848 862) 5) ((900 911) 1)
((1000 1011) 1))
+ ;; '(("abc")))
(phps-mode-test-ast--should-bookkeep
"<?php\n\n$var = 'abc';\n\nif ($var2) {\n echo 'This never
happens';\n}\nif ($var) {\n echo 'This happens';\n}"
- [elpa] externals/phps-mode ee28b83099 01/12: Added support for bookkeeping and imenu for list() variable assignment, (continued)
- [elpa] externals/phps-mode ee28b83099 01/12: Added support for bookkeeping and imenu for list() variable assignment, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode f6004f1b37 04/12: Added profiling outputs, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 8f0b9459c4 07/12: More work on bookkeeping constants, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 1e659967a8 08/12: More work on constants bookkeeping, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 8a3492da41 09/12: Improved bookkeeping of referenced variable, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 541111abf7 03/12: More work on bookkeeping class constants, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode f13607bf1e 12/12: Updated version to 0.4.34, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 7c2b17a4b6 06/12: Added new todo items, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode a034b63d56 02/12: Started on bookkeeping global constants, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode a9241a9b67 10/12: Added constants bookkeeping and imenu test again, Christian Johansson, 2023/02/05
- [elpa] externals/phps-mode 7f504111eb 11/12: Commented out work on bookkeeping constants,
Christian Johansson <=