[elpa] externals/phps-mode 44e618ffe3 023/135: SDT for trait_alias

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 44e618ffe3237c11ee37a0811f583bf5441a1b64
Author: Christian Johansson 
Commit: Christian Johansson 

SDT for trait_alias
---
 phps-mode-parser-sdt.el | 96 +
 1 file changed, 96 insertions(+)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 86ff6c9920..53e7f56572 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2709,6 +2709,102 @@
 ;; 306 ((class_name_list) (class_name_list "," class_name))
 (puthash 306 (lambda(args _terminals) (append (nth 0 args) (nth 2 args))) 
phps-mode-parser--table-translations)
 
+;; 307 ((trait_adaptations) (";"))
+(puthash 307 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 308 ("{" "}"))
+(puthash 308 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 309 ((trait_adaptations) ("{" trait_adaptation_list "}"))
+(puthash 309 (lambda(args _terminals) (nth 1 args)) 
phps-mode-parser--table-translations)
+
+;; 310 ((trait_adaptation_list) (trait_adaptation))
+(puthash 310 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
+
+;; 311 ((trait_adaptation_list) (trait_adaptation_list trait_adaptation))
+(puthash 311 (lambda(args _terminals) (append (nth 0 args) (nth 1 args))) 
phps-mode-parser--table-translations)
+
+;; 312 ((trait_adaptation) (trait_precedence ";"))
+(puthash 312 (lambda(args _terminals) (nth 0 args)) 
phps-mode-parser--table-translations)
+
+;; 313 ((trait_adaptation) (trait_alias ";"))
+(puthash
+ 313
+ (lambda(args _terminals) (nth 0 args))
+ phps-mode-parser--table-translations)
+
+;; 314 ((trait_precedence) (absolute_trait_method_reference T_INSTEADOF 
class_name_list))
+(puthash
+ 314
+ (lambda(args _terminals)
+   `(
+ ast-type
+ trait-precendence
+ absolute-trait-method-reference
+ ,(nth 0 args)
+ instead-of
+ ,(nth 2 args)
+ )
+   phps-mode-parser--table-translations))
+
+;; 315 ((trait_alias) (trait_method_reference T_AS T_STRING))
+(puthash
+ 315
+ (lambda(args _terminals)
+   `(
+ ast-type
+ trait-alias
+ trait-method-reference
+ ,(nth 0 args)
+ as
+ ,(nth 2 args)
+ )
+   phps-mode-parser--table-translations))
+
+;; 316 ((trait_alias) (trait_method_reference T_AS reserved_non_modifiers))
+(puthash
+ 316
+ (lambda(args _terminals)
+   `(
+ ast-type
+ trait-non-modifier
+ trait-method-reference
+ ,(nth 0 args)
+ as
+ ,(nth 2 args)
+ )
+   phps-mode-parser--table-translations))
+
+;; 317 ((trait_alias) (trait_method_reference T_AS member_modifier identifier))
+(puthash
+ 317
+ (lambda(args _terminals)
+   `(
+ ast-type
+ trait-alias-modifier
+ trait-method-reference
+ ,(nth 0 args)
+ as
+ ,(nth 2 args)
+ identifier
+ ,(nth 3 args)
+ )
+   phps-mode-parser--table-translations))
+
+;; 318 ((trait_alias) (trait_method_reference T_AS member_modifier))
+(puthash
+ 318
+ (lambda(args _terminals)
+   `(
+ ast-type
+ trait-modifier
+ trait-method-reference
+ ,(nth 0 args)
+ as
+ ,(nth 2 args)
+ )
+   phps-mode-parser--table-translations))
+
 
 ;; TODO WAS HERE
 



[elpa] externals/phps-mode 8c71d3838e 018/135: Added SDT for type

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 8c71d3838e7e94fdd31852ec7eb38390df8b7b1c
Author: Christian Johansson 
Commit: Christian Johansson 

Added SDT for type
---
 phps-mode-parser-sdt.el | 169 
 1 file changed, 156 insertions(+), 13 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index bef61231dd..e5b1c3b8d5 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2207,32 +2207,110 @@
  ))
  phps-mode-parser--table-translations)
 
+;; 238 ((alt_if_stmt_without_else) (T_IF "(" expr ")" ":" 
inner_statement_list))
+(puthash
+ 238
+ (lambda(args _terminals)
+   `(
+ ast-type
+ alt-if-stmt-without-else
+ if-condition
+ ,(nth 2 args)
+ inner-statement-list
+ ,(nth 5 args)
+ ))
+ phps-mode-parser--table-translations)
 
-;; TODO Was here 285 is half
+;; 239 ((alt_if_stmt_without_else) (alt_if_stmt_without_else T_ELSEIF "(" expr 
")" ":" inner_statement_list))
+(puthash
+ 239
+ (lambda(args _terminals)
+   `(
+ ast-type
+ alt-if-stmt-without-else-elseif
+ alt-if-stmt-without-else
+ ,(nth 2 args)
+ elseif-condition
+ ,(nth 3 args)
+ inner-statement-list
+ ,(nth 6 args)
+ ))
+ phps-mode-parser--table-translations)
 
+;; 240 ((alt_if_stmt) (alt_if_stmt_without_else T_ENDIF ";"))
+(puthash 240 (lambda(args _terminals) (nth 0 args)) 
phps-mode-parser--table-translations)
 
-;; parameter_list -> (non_empty_parameter_list possible_comma)
+;; 241 ((alt_if_stmt) (alt_if_stmt_without_else T_ELSE ":" 
inner_statement_list T_ENDIF ";"))
 (puthash
- 242
+ 241
  (lambda(args _terminals)
-   (nth 0 args))
+   `(
+ ast-type
+ alt-if-stmt-else
+ alt-if-stmt-without-else
+ ,(nth 0 args)
+ inner-statement-list
+ ,(nth 3 args)
+ ))
  phps-mode-parser--table-translations)
 
-;; non_empty_parameter_list -> (attributed_parameter)
+;; 242 ((parameter_list) (non_empty_parameter_list possible_comma))
+(puthash 242 (lambda(args _terminals) (nth 0 args)) 
phps-mode-parser--table-translations)
+
+;; 243 ((parameter_list) (%empty))
+(puthash 243 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 244 ((non_empty_parameter_list) (attributed_parameter))
+(puthash 244 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
+
+;; 245 ((non_empty_parameter_list) (non_empty_parameter_list "," 
attributed_parameter))
+(puthash 245 (lambda(args _terminals) (append (nth 0 args) (list (nth 2 
args phps-mode-parser--table-translations)
+
+;; 246 ((attributed_parameter) (attributes parameter))
 (puthash
- 244
+ 246
  (lambda(args _terminals)
-   (list args))
+   `(
+ ast-type
+ attributed-parameter
+ attributes
+ ,(nth 0 args)
+ parameter
+ ,(nth 1 args)
+ ))
  phps-mode-parser--table-translations)
 
-;; non_empty_parameter_list -> (non_empty_parameter_list "," 
attributed_parameter)
+;; 247 ((attributed_parameter) (parameter))
 (puthash
- 245
+ 247
  (lambda(args _terminals)
-   (append (nth 0 args) (list (nth 2 args
+   `(
+ ast-type
+ attributed-parameter
+ parameter
+ ,(nth 1 args)
+ ))
  phps-mode-parser--table-translations)
 
-;; parameter -> (optional_property_modifiers optional_type_without_static 
is_reference is_variadic T_VARIABLE backup_doc_comment)
+;; 248 ((optional_property_modifiers) (%empty))
+(puthash 248 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 249 ((optional_property_modifiers) (optional_property_modifiers 
property_modifier))
+(puthash 249 (lambda(args _terminals) (append (nth 0 args) (list (nth 1 
args phps-mode-parser--table-translations)
+
+;; 250 ((property_modifier) (T_PUBLIC))
+(puthash 250 (lambda(_args _terminals) 'T_PUBLIC) 
phps-mode-parser--table-translations)
+
+;; 251 ((property_modifier) (T_PROTECTED))
+(puthash 251 (lambda(_args _terminals) 'T_PROTECTED) 
phps-mode-parser--table-translations)
+
+;; 252 ((property_modifier) (T_PROTECTED))
+(puthash 252 (lambda(_args _terminals) 'T_PRIVATE) 
phps-mode-parser--table-translations)
+
+;; 253 ((property_modifier) (T_PROTECTED))
+(puthash 253 (lambda(_args _terminals) 'T_PROTECTED) 
phps-mode-parser--table-translations)
+
+;; 254 ((parameter) (optional_property_modifiers optional_type_without_static 
is_reference is_variadic T_VARIABLE backup_doc_comment))
 (puthash
  254
  (lambda(args terminals)
@@ -2256,7 +2334,7 @@
  ))
  phps-mode-parser--table-translations)
 
-;; parameter -> (optional_property_modifiers optional_type_without_static 
is_reference is_variadic T_VARIABLE backup_doc_comment "=" expr)
+;; 255 ((parameter) (optional_property_modifiers optional_type_without_static 
is_reference is_variadic T_VARIABLE backup_doc_comment "=" expr))
 (puthash
  255
  (lambda(args terminals)
@@ -2280,10 +2358,75 @@
  backup-doc-comment
  ,(nth 5 args)
  default-value
- ,(phps-mode-parser-sdt--get-list-of-object (nth 7 args))
+ ,(nth 7 a

[elpa] externals/phps-mode 67635aa9ee 015/135: Added SDT for for-statement and foreach-statements

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 67635aa9eec0daf498ca80f84c4a5c17eee1c4af
Author: Christian Johansson 
Commit: Christian Johansson 

Added SDT for for-statement and foreach-statements
---
 phps-mode-parser-sdt.el | 89 +++--
 1 file changed, 87 insertions(+), 2 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 9e52670a92..cc7ea74022 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1929,9 +1929,19 @@
)
  phps-mode-parser--table-translations)
 
-;; TODO Was here 285 is half
+;; 204 ((foreach_variable) (variable))
+(puthash
+ 204
+ (lambda(args _terminals)
+   `(
+ ast-type
+ foreach-variable
+ variable
+ ,args
+ ))
+ phps-mode-parser--table-translations)
 
-;; foreach_variable -> (ampersand variable)
+;; 205 ((foreach_variable) (ampersand variable))
 (puthash
  205
  (lambda(args _terminals)
@@ -1943,6 +1953,81 @@
  ))
  phps-mode-parser--table-translations)
 
+;; 206 ((foreach_variable) (T_LIST "(" array_pair_list ")"))
+(puthash
+ 206
+ (lambda(args _terminals)
+   `(
+ ast-type
+ foreach-list-variable
+ array-pair-list
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 207 ((foreach_variable) ("[" array_pair_list "]"))
+(puthash
+ 207
+ (lambda(args _terminals)
+   `(
+ ast-type
+ foreach-variable
+ array-pair-list
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 208 ((for_statement) (statement))
+(puthash
+ 208
+ (lambda(args _terminals)
+   `(
+ ast-type
+ for-statement
+ statement
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 209 ((for_statement) (":" inner_statement_list T_ENDFOR ";"))
+(puthash
+ 209
+ (lambda(args _terminals)
+   `(
+ ast-type
+ for-statement
+ inner-statement-list
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 210 ((foreach_statement) (statement))
+(puthash
+ 210
+ (lambda(args _terminals)
+   `(
+ ast-type
+ foreach-statement
+ statement
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 211 ((foreach_statement) (":" inner_statement_list T_ENDFOREACH ";"))
+(puthash
+ 211
+ (lambda(args _terminals)
+   `(
+ ast-type
+ foreach-statement
+ inner-statement-list
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; TODO Was here 285 is half
+
+
 ;; if_stmt_without_else -> (T_IF "(" expr ")" statement)
 (puthash
  234



[elpa] externals/phps-mode f28ea09743 020/135: SDT is not using get-list-of-object function anymore

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit f28ea09743055f961d4af52d76fa9b80ffeb1e08
Author: Christian Johansson 
Commit: Christian Johansson 

SDT is not using get-list-of-object function anymore
---
 phps-mode-parser-sdt.el | 203 
 1 file changed, 102 insertions(+), 101 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 608bdf6244..2dbcd65764 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -584,24 +584,12 @@
 ;;; Code:
 
 
-;; TODO Remove function (phps-mode-parser-sdt--get-list-of-object)
-;; TODO Stop using children generic name
-
-
 (require 'phps-mode-parser)
 
-(defun phps-mode-parser-sdt--get-list-of-object (objects)
-  "Get list of OBJECTS."
-  (cond
-
-   ((and (listp objects)
- (plist-get objects 'ast-type))
-(list objects))
-
-   ((listp objects)
-objects)
-
-   (t (list objects
+(defvar-local
+  phps-mode-parser-sdt-bookkeeping
+  (make-hash-table :test 'equal)
+  "Bookkeeping")
 
 ;; SDT starts here
 
@@ -968,16 +956,7 @@
  phps-mode-parser--table-translations)
 
 ;; 101 ((attributes) (attributes attribute))
-(puthash
- 101
- (lambda(args _terminals)
-   `(
- ast-type
- attributes
- attributes
- ,(append (plist-get (nth 0 args) 'children) (list (nth 1 args)))
- ))
- phps-mode-parser--table-translations)
+(puthash 101 (lambda(args _terminals) (append (nth 0 args) (list (nth 1 
args phps-mode-parser--table-translations)
 
 ;; 102 ((attributed_statement) (function_declaration_statement))
 (puthash 102 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
@@ -1604,7 +1583,7 @@
  ,(car (cdr (nth 4 terminals)))
  optional-variable-end
  ,(cdr (cdr (nth 4 terminals)))
- children
+ inner-statement-list
  ,(nth 7 args)
  ))
  phps-mode-parser--table-translations)
@@ -1702,7 +1681,7 @@
  ,(nth 5 args)
  return-type
  ,(nth 7 args)
- children
+ inner-statement-list
  ,(nth 10 args)
  ))
  phps-mode-parser--table-translations)
@@ -2531,26 +2510,22 @@
)
  phps-mode-parser--table-translations)
 
+;; 289 ((global_var_list) (global_var_list "," global_var))
+(puthash 289 (lambda(args _terminals) (append (nth 0 args) (list (nth 2 
args phps-mode-parser--table-translations)
 
-;; TODO WAS HERE
-
+;; 290 ((global_var_list) (global_var))
+(puthash 290 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
 
+;; 291 ((global_var) (simple_variable))
+(puthash 291 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
-;; static_var_list -> (static_var_list "," static_var)
-(puthash
- 292
- (lambda(args _terminals)
-   (append (nth 0 args) (list (nth 2 args
- phps-mode-parser--table-translations)
+;; 292 ((static_var_list) (static_var_list "," static_var))
+(puthash 292 (lambda(args _terminals) (append (nth 0 args) (list (nth 2 
args phps-mode-parser--table-translations)
 
-;; static_var_list -> (static_var)
-(puthash
- 293
- (lambda(args _terminals)
-   (list args))
- phps-mode-parser--table-translations)
+;; 293 ((static_var_list) (static_var))
+(puthash 293 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
 
-;; static_var -> (T_VARIABLE)
+;; 294 ((static_var) (T_VARIABLE))
 (puthash
  294
  (lambda(args terminals)
@@ -2568,7 +2543,7 @@
  ))
  phps-mode-parser--table-translations)
 
-;; static_var -> (T_VARIABLE "=" expr)
+;; 295 ((static_var) (T_VARIABLE "=" expr))
 (puthash
  295
  (lambda(args terminals)
@@ -2588,7 +2563,7 @@
  ))
  phps-mode-parser--table-translations)
 
-;; class_statement_list -> (class_statement_list class_statement)
+;; 296 ((class_statement_list) (class_statement_list class_statement))
 (puthash
  296
  (lambda(args _terminals)
@@ -2597,7 +2572,10 @@
(cdr args)))
  phps-mode-parser--table-translations)
 
-;; attributed_class_statement -> (variable_modifiers 
optional_type_without_static property_list ";")
+;; 297 ((class_statement_list) (%empty))
+(puthash 297 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 298 ((attributed_class_statement) (variable_modifiers 
optional_type_without_static property_list ";"))
 (puthash
  298
  (lambda(args terminals)
@@ -2605,7 +2583,7 @@
  ast-type
  property
  modifiers
- ,(phps-mode-parser-sdt--get-list-of-object (nth 0 args))
+ ,(nth 0 args)
  type
  ,(nth 1 args)
  subject
@@ -2617,7 +2595,25 @@
  ))
  phps-mode-parser--table-translations)
 
-;; attributed_class_statement -> (method_modifiers function returns_ref 
identifier backup_doc_comment "(" parameter_list ")" return_type 
backup_fn_flags method_body backup_fn_flags)
+;; 299 ((attributed_class_statement) (method_modifiers T_CONST 
class_const_list ";"))
+(puthash
+ 299
+ (lambda(args terminals)
+   `(
+ ast-type
+ constant
+ modifiers
+ ,(nth 0 args)
+ subject
+ ,(nth 2 args)
+ ast-start
+ ,(c

[elpa] externals/phps-mode dd672cd243 021/135: More SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit dd672cd243a7e1539ea834477b9b97e494755e9c
Author: Christian Johansson 
Commit: Christian Johansson 

More SDT
---
 phps-mode-parser-sdt.el | 62 +
 1 file changed, 62 insertions(+)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 2dbcd65764..86ff6c9920 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2647,6 +2647,68 @@
  ))
  phps-mode-parser--table-translations)
 
+;; 301 ((attributed_class_statement) (enum_case))
+(puthash
+ 301
+ (lambda(args _terminals)
+   `(
+ ast-type
+ class-enum
+ enum-case
+ ,args
+ )
+   )
+ phps-mode-parser--table-translations)
+
+;; 302 ((class_statement) (attributed_class_statement))
+(puthash
+ 302
+ (lambda(args _terminals)
+   `(
+ ast-type
+ class-statement
+ attributed-class-statement
+ ,args
+ )
+   )
+ phps-mode-parser--table-translations)
+
+;; 303 ((class_statement) (attributes attributed_class_statement))
+(puthash
+ 303
+ (lambda(args _terminals)
+   `(
+ ast-type
+ class-statement
+ attributes
+ ,(nth 0 args)
+ attributed-class-statement
+ ,(nth 1 args)
+ )
+   )
+ phps-mode-parser--table-translations)
+
+;; 304 ((class_statement) (T_USE class_name_list trait_adaptations))
+(puthash
+ 304
+ (lambda(args _terminals)
+   `(
+ ast-type
+ use-class-statement
+ class-name-list
+ ,(nth 1 args)
+ trait-adaptations
+ ,(nth 2 args)
+ )
+   )
+ phps-mode-parser--table-translations)
+
+;; 305 ((class_name_list) (class_name))
+(puthash 305 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
+
+;; 306 ((class_name_list) (class_name_list "," class_name))
+(puthash 306 (lambda(args _terminals) (append (nth 0 args) (nth 2 args))) 
phps-mode-parser--table-translations)
+
 
 ;; TODO WAS HERE
 



[elpa] externals/phps-mode 23fcce7ee0 006/135: SDT for use-top-statements

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 23fcce7ee0e086aed6babd1b4bb9c59d922c5363
Author: Christian Johansson 
Commit: Christian Johansson 

SDT for use-top-statements
---
 phps-mode-parser-sdt.el | 68 +
 1 file changed, 68 insertions(+)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 5d0cd484e1..0169f97e51 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1085,6 +1085,74 @@
  ))
  phps-mode-parser--table-translations)
 
+;; 114 ((top_statement) (T_USE mixed_group_use_declaration ";"))
+(puthash
+ 114
+ (lambda(args terminals)
+   `(
+ ast-type
+ mixed-group-use-declaration-top-statement
+ ast-value
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 115 ((top_statement) (T_USE use_type group_use_declaration ";"))
+(puthash
+ 115
+ (lambda(args terminals)
+   `(
+ ast-type
+ type-group-use-declaration-top-statement
+ use-type
+ ,(nth 1 args)
+ ,group-use-declaration
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 116 ((top_statement) (T_USE use_declarations ";"))
+(puthash
+ 116
+ (lambda(args terminals)
+   `(
+ ast-type
+ use-declarations-top-statement
+ ast-value
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 117 ((top_statement) (T_USE use_type use_declarations ";"))
+(puthash
+ 117
+ (lambda(args terminals)
+   `(
+ ast-type
+ type-use-declarations-top-statement
+ ast-value
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 118 ((top_statement) (T_CONST const_list ";"))
+(puthash
+ 118
+ (lambda(args terminals)
+   `(
+ ast-type
+ const-list-top-statement
+ ast-value
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 119 ((use_type) (T_FUNCTION))
+(puthash 119 (lambda(args terminals) args) 
phps-mode-parser--table-translations)
+
+;; 120 ((use_type) (T_CONST))
+(puthash 120 (lambda(args terminals) args) 
phps-mode-parser--table-translations)
+
 ;; inner_statement_list -> (inner_statement_list inner_statement)
 (puthash
  139



[elpa] externals/phps-mode ddc1213d83 002/135: Typo in production number

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit ddc1213d837665fd3b3df51450337ed10bc17adb
Author: Christian Johansson 
Commit: Christian Johansson 

Typo in production number
---
 phps-mode-parser-sdt.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index abb18fce72..a78564c428 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -883,8 +883,8 @@
  (lambda(args _terminals) (if (car args) (append (car args) (cdr args)) (cdr 
args)))
  phps-mode-parser--table-translations)
 
-;; 83 ((top_statement_list) (%empty))
-(puthash 83 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+;; 84 ((top_statement_list) (%empty))
+(puthash 84 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
 
 ;; 111 top_statement -> (T_NAMESPACE namespace_declaration_name ";")
 (puthash



[elpa] externals/phps-mode 393edecde0 009/135: Started with bookkeeping index of objects

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 393edecde0206893a3e83be15e075fd27e6ef622
Author: Christian Johansson 
Commit: Christian Johansson 

Started with bookkeeping index of objects
---
 phps-mode-ast-bookkeeping.el | 448 +++
 test/phps-mode-test-ast.el   |   5 +-
 2 files changed, 334 insertions(+), 119 deletions(-)

diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index ebff44a952..c4675fc559 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -18,7 +18,12 @@
 (defvar-local
   phps-mode-ast-bookkeeping--index
   nil
-  "Bookkeeping for current buffer.")
+  "Bookkeeping string index for current buffer.")
+
+(defvar-local
+  phps-mode-ast-bookkeeping--object-index
+  nil
+  "Bookkeeping object index for current buffer.")
 
 (defvar
   phps-mode-ast-bookkeeping--superglobal-variable-p
@@ -246,6 +251,7 @@
   "Generate AST for current buffer or optionally for TREE."
   (let ((bookkeeping (make-hash-table :test 'equal))
 (bookkeeping-stack (if tree tree phps-mode-ast--tree))
+(bookkeeping-objects)
 (inline-function-count 0)
 (arrow-function-count 0)
 (defined-count 0))
@@ -269,16 +275,29 @@
   (cond
 
((equal type 'simple-variable)
-(let ((ids
-   (phps-mode-ast-bookkeeping--generate-variable-scope-string
-scope
-(plist-get item 'name)
-t))
-  (object
-   (list
-(plist-get item 'start)
-(plist-get item 'end)))
-  (defined-p 0))
+(let* ((object-name (plist-get item 'name))
+   (object-start (plist-get item 'start))
+   (object-end (plist-get item 'end))
+   (ids
+(phps-mode-ast-bookkeeping--generate-variable-scope-string
+ scope
+ object-name
+ t))
+   (object
+(list
+ object-start
+ object-end))
+   (defined-p 0)
+   (bookkeeping-object
+(list
+ 'type type
+ 'name object-name
+ 'scope scope
+ 'start object-start
+ 'end object-end)))
+  (push
+   bookkeeping-object
+   bookkeeping-objects)
 
   (dolist (id ids)
 (when (gethash id bookkeeping)
@@ -286,10 +305,11 @@
defined-p
1)))
 
-  ;; Is a super-global variable?
-  (when (gethash
- (plist-get item 'name)
- phps-mode-ast-bookkeeping--superglobal-variable-p)
+  ;; Is it a super-global variable?
+  (when
+  (gethash
+   (plist-get item 'name)
+   phps-mode-ast-bookkeeping--superglobal-variable-p)
 (setq
  defined-p
  1))
@@ -301,14 +321,28 @@
((equal type 'static-variables-statement)
 (when-let ((variables (reverse (plist-get item 'static-var-list
   (dolist (variable variables)
-(let ((ids
-   
(phps-mode-ast-bookkeeping--generate-variable-scope-string
-scope
-(plist-get variable 'name)))
-  (object
-   (list
-(plist-get variable 'start)
-(plist-get variable 'end
+(let* ((object-name (plist-get variable 'name))
+   (object-start (plist-get variable 'start))
+   (object-end (plist-get variable 'end))
+   (ids
+
(phps-mode-ast-bookkeeping--generate-variable-scope-string
+ scope
+ object-name))
+   (object
+(list
+ object-start
+ object-end))
+   (bookkeeping-object
+(list
+ 'type type
+ 'name object-name
+ 'scope scope
+ 'start object-start
+ 'end object-end)))
+  (push
+   bookkeeping-object
+   bookkeeping-objects)
+
   (dolist (id ids)
 (puthash
  id
@@ -325,14 +359,28 @@
   (push `(type function name ,name) sub-scope)
   (when-let ((parameter-list (plist-get item 'parameter-list)))
 (dolist (parameter parameter-list)
-  (let ((ids

[elpa] externals/phps-mode f333b4f0fd 007/135: SDT for possible_comma

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit f333b4f0fd5f183e0e331f274ec35f97cab4a4a2
Author: Christian Johansson 
Commit: Christian Johansson 

SDT for possible_comma
---
 phps-mode-parser-sdt.el | 32 +++-
 1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 0169f97e51..d770cedda1 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1153,7 +1153,37 @@
 ;; 120 ((use_type) (T_CONST))
 (puthash 120 (lambda(args terminals) args) 
phps-mode-parser--table-translations)
 
-;; inner_statement_list -> (inner_statement_list inner_statement)
+;; 121 ((group_use_declaration) (legacy_namespace_name T_NS_SEPARATOR "{" 
unprefixed_use_declarations possible_comma "}"))
+(puthash
+ 121
+ (lambda(args terminals)
+   `(
+ ast-type
+ legacy-group-use-declaration
+ unprefixed-use-declarations
+ ,(nth 3 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 122 ((mixed_group_use_declaration) (legacy_namespace_name T_NS_SEPARATOR 
"{" inline_use_declarations possible_comma "}"))
+(puthash
+ 122
+ (lambda(args terminals)
+   `(
+ ast-type
+ mixed-group-use-declaration
+ inline-use-declarations
+ ,(nth 3 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 123 ((possible_comma) (%empty))
+(puthash 123 (lambda(_args terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 124 ((possible_comma) (","))
+(puthash 124 (lambda(_args terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 139 inner_statement_list -> (inner_statement_list inner_statement)
 (puthash
  139
  (lambda(args _terminals)



[elpa] externals/phps-mode cba467b26c 050/135: Added TODO items

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit cba467b26cefe06f0b168f85352f96266460f46b
Author: Christian Johansson 
Commit: Christian Johansson 

Added TODO items
---
 phps-mode-parser-sdt.el | 17 +++--
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 585cb6857a..33877f6bdb 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2252,18 +2252,21 @@
 (puthash
  204
  (lambda(args _terminals)
+   ;; TODO Declare variable here
+
`(
  ast-type
  foreach-variable
  variable
- ,args
- ))
+ ,args))
  phps-mode-parser--table-translations)
 
 ;; 205 ((foreach_variable) (ampersand variable))
 (puthash
  205
  (lambda(args _terminals)
+   ;; TODO Declare variable here
+
`(
  ast-type
  foreach-referenced-variable
@@ -2276,24 +2279,26 @@
 (puthash
  206
  (lambda(args _terminals)
+   ;; TODO Declare variable here
+
`(
  ast-type
  foreach-list-variable
  array-pair-list
- ,(nth 2 args)
- ))
+ ,(nth 2 args)))
  phps-mode-parser--table-translations)
 
 ;; 207 ((foreach_variable) ("[" array_pair_list "]"))
 (puthash
  207
  (lambda(args _terminals)
+   ;; TODO Declare variable here
+
`(
  ast-type
  foreach-variable
  array-pair-list
- ,(nth 1 args)
- ))
+ ,(nth 1 args)))
  phps-mode-parser--table-translations)
 
 ;; 208 ((for_statement) (statement))



[elpa] externals/phps-mode c93e41b57f 013/135: Fixed new compilation errors in added SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit c93e41b57fc71ff7676b7172c007e7683431efe5
Author: Christian Johansson 
Commit: Christian Johansson 

Fixed new compilation errors in added SDT
---
 phps-mode-parser-sdt.el | 375 
 1 file changed, 255 insertions(+), 120 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 3e0a19c304..cb1b5ee337 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -818,7 +818,7 @@
 (puthash 70 (lambda(_args _terminals) 'T_ENUM) 
phps-mode-parser--table-translations)
 
 ;; 71 ((semi_reserved) (reserved_non_modifiers))
-(puthash 71 (lambda(_args _terminals) args) 
phps-mode-parser--table-translations)
+(puthash 71 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 72 ((semi_reserved) (T_STATIC))
 (puthash 72 (lambda(_args _terminals) 'T_STATIC) 
phps-mode-parser--table-translations)
@@ -851,7 +851,7 @@
 (puthash 81 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 82 ((identifier) (semi_reserved))
-(puthash 82 (lambda(args terminals) args) phps-mode-parser--table-translations)
+(puthash 82 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 83 ((top_statement_list) (top_statement_list top_statement))
 (puthash
@@ -962,7 +962,7 @@
  ast-type
  attributes
  attributes
- (,attribute)
+ (,args)
  ))
  phps-mode-parser--table-translations)
 
@@ -1012,13 +1012,13 @@
`(
  ast-type
  namespace
- name
+ ast-name
  ,(nth 1 args)
- index
+ ast-index
  ,(car (cdr (nth 1 terminals)))
- start
+ ast-start
  ,(car (cdr (nth 2 terminals)))
- end
+ ast-end
  max
  ))
  phps-mode-parser--table-translations)
@@ -1030,13 +1030,13 @@
`(
  ast-type
  namespace
- name
+ ast-name
  ,(nth 1 args)
- index
+ ast-index
  ,(car (cdr (nth 1 terminals)))
- start
+ ast-start
  ,(car (cdr (nth 2 terminals)))
- end
+ ast-end
  ,(car (cdr (nth 4 terminals)))
  top-statement-list
  ,(nth 3 args)
@@ -1050,11 +1050,11 @@
`(
  ast-type
  namespace
- index
+ ast-index
  ,(car (cdr (nth 0 terminals)))
- start
+ ast-start
  ,(car (cdr (nth 1 terminals)))
- end
+ ast-end
  ,(car (cdr (nth 3 terminals)))
  top-statement-list
  ,(nth 2 args)
@@ -1082,7 +1082,7 @@
  type-group-use-declaration-top-statement
  use-type
  ,(nth 1 args)
- ,group-use-declaration
+ group-use-declaration
  ,(nth 2 args)
  ))
  phps-mode-parser--table-translations)
@@ -1124,7 +1124,7 @@
  phps-mode-parser--table-translations)
 
 ;; 119 ((use_type) (T_FUNCTION))
-(puthash 119 (lambda(args terminals) args) 
phps-mode-parser--table-translations)
+(puthash 119 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 120 ((use_type) (T_CONST))
 (puthash 120 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
@@ -1173,7 +1173,7 @@
 ;; 126 ((inline_use_declarations) (inline_use_declaration))
 (puthash
  126
- (lambda(args terminals)
+ (lambda(args _terminals)
`(
  ast-type
  inline-use-declarations
@@ -1184,7 +1184,7 @@
 ;; 127 ((unprefixed_use_declarations) (unprefixed_use_declarations "," 
unprefixed_use_declaration))
 (puthash
  127
- (lambda(args terminals)
+ (lambda(args _terminals)
`(
  ast-type
  unprefixed-use-declarations
@@ -1195,18 +1195,18 @@
 ;; 128 ((unprefixed_use_declarations) (unprefixed_use_declaration))
 (puthash
  128
- (lambda(args terminals)
+ (lambda(args _terminals)
`(
  ast-type
  unprefixed-use-declarations
- ,(args))
+ ,(list args))
  )
phps-mode-parser--table-translations)
 
 ;; 129 ((use_declarations) (use_declarations "," use_declaration))
 (puthash
  129
- (lambda(args terminals)
+ (lambda(args _terminals)
`(
  ast-type
  use-declarations
@@ -1217,30 +1217,30 @@
 ;; 130 ((use_declarations) (use_declaration))
 (puthash
  130
- (lambda(args terminals)
+ (lambda(args _terminals)
`(
  ast-type
  use-declarations
- (args)
+ ,(list args)
  ))
  phps-mode-parser--table-translations)
 
 ;; 131 ((inline_use_declaration) (unprefixed_use_declaration))
 (puthash
  131
- (lambda(args terminals)
+ (lambda(args _terminals)
`(
  ast-type
  inline-use-declaration
  declation
- ,(args)
+ ,(list args)
  ))
  phps-mode-parser--table-translations)
 
 ;; 132 ((inline_use_declaration) (use_type unprefixed_use_declaration))
 (puthash
  132
- (lambda(args terminals)
+ (lambda(args _terminals)
`(
  ast-type
  inline-use-declaration
@@ -1254,7 +1254,7 @@
 ;; 133 ((unprefixed_use_declaration) (namespace_name))
 (puthash
  133
- (lambda(args terminals)
+ (lambda(args _terminals)
`(
  namespace-name
  ,args
@@ -1264,7 +1264,7 @@
 ;; 134 ((unprefixed_use_declaration) (namespace_name T_AS T_S

[elpa] externals/phps-mode fd28fcbed3 012/135: Added SDT for unset_variables and more

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit fd28fcbed3f8d7f43b815d7745cf950bc8c90e6c
Author: Christian Johansson 
Commit: Christian Johansson 

Added SDT for unset_variables and more
---
 phps-mode-parser-sdt.el | 111 +++-
 1 file changed, 82 insertions(+), 29 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index a68fe8ca25..3e0a19c304 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -583,30 +583,6 @@
 
 ;;; Code:
 
-;; TODO Add SDT for
-;; argument_list
-;; array_pair_list
-;; catch_list
-;; catch_name_list
-;; class_statement_list
-;; echo_expr_list
-;; expr
-;; extends_from
-;; for_exprs
-;; for_statement
-;; foreach_statement
-;; global_var_list
-;; implements_list
-;; inner_statement_list
-;; inner_statement_list
-;; interface_extends_list
-;; isset_variables
-;; lexical_vars
-;; method_body
-;; method_modifiers
-;; optional_expr
-;; statement
-;; variable_modifiers
 
 ;; TODO Remove function (phps-mode-parser-sdt--get-list-of-object)
 
@@ -1609,15 +1585,18 @@
  ))
  phps-mode-parser--table-translations)
 
-;; catch_list -> (catch_list T_CATCH "(" catch_name_list optional_variable ")" 
"{" inner_statement_list "}")
+;; 168 ((catch_list) (%empty))
+(puthash 168 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 169 ((catch_list) (catch_list T_CATCH "(" catch_name_list optional_variable 
")" "{" inner_statement_list "}"))
 (puthash
  169
  (lambda(args terminals)
`(
  ast-type
- catch
+ catch-list
  catch-name-list
- ,(phps-mode-parser-sdt--get-list-of-object (nth 3 args))
+ ,(nth 3 args)
  optional-variable
  ,(nth 4 args)
  optional-variable-start
@@ -1629,7 +1608,79 @@
  ))
  phps-mode-parser--table-translations)
 
-;; function_declaration_statement -> (function returns_ref T_STRING 
backup_doc_comment "(" parameter_list ")" return_type backup_fn_flags "{" 
inner_statement_list "}" backup_fn_flags)
+;; 170 ((catch_name_list) (class_name))
+(puthash
+ 170
+ (lambda(args _terminals)
+   `(
+ ast-type
+ catch-name-list
+ class-names
+ (,args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 171 ((catch_name_list) (catch_name_list "|" class_name))
+(puthash
+ 171
+ (lambda(args _terminals)
+   `(
+ ast-type
+ catch-name-list
+ class-names
+ ,(append (nth 0 args) (list (nth 2 args)))
+ ))
+ phps-mode-parser--table-translations)
+
+;; 172 ((optional_variable) (%empty))
+(puthash 172 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 173 ((optional_variable) (T_VARIABLE))
+(puthash 173 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 174 ((finally_statement) (%empty))
+(puthash 174 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 175 ((finally_statement) (T_FINALLY "{" inner_statement_list "}"))
+(puthash
+ 175
+ (lambda(args _terminals)
+   `(
+ ast-type
+ finally-statement
+ inner-statement-list
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 176 ((unset_variables) (unset_variable))
+(puthash
+ 176
+ (lambda(args _terminals)
+   `(
+ ast-type
+ unset-variables
+ variables
+ ,(args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 177 ((unset_variables) (unset_variables "," unset_variable))
+(puthash
+ 177
+ (lambda(args _terminals)
+   `(
+ ast-type
+ unset-variables
+ variables
+ ,(append (nth 0 args) (nth 2 args))
+ ))
+ phps-mode-parser--table-translations)
+
+;; 178 ((unset_variable) (variable))
+(puthash 178 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 179 ((function_declaration_statement) (function returns_ref T_STRING 
backup_doc_comment "(" parameter_list ")" return_type backup_fn_flags "{" 
inner_statement_list "}" backup_fn_flags))
 (puthash
  179
  (lambda(args terminals)
@@ -1651,10 +1702,12 @@
  return-type
  ,(nth 7 args)
  children
- ,(phps-mode-parser-sdt--get-list-of-object (nth 10 args))
+ ,(nth 10 args)
  ))
  phps-mode-parser--table-translations)
 
+;; TODO Was here
+
 ;; class_declaration_statement -> (class_modifiers T_CLASS T_STRING 
extends_from implements_list backup_doc_comment "{" class_statement_list "}")
 (puthash
  184



[elpa] externals/phps-mode 42b983bb16 045/135: More work on bookkeeping via SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 42b983bb1627df81900f81dfd5436161ece13aa8
Author: Christian Johansson 
Commit: Christian Johansson 

More work on bookkeeping via SDT
---
 phps-mode-ast.el|  2 +-
 phps-mode-parser-sdt.el | 92 +
 2 files changed, 71 insertions(+), 23 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 8c18b631b9..5483c9bb1d 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -35,7 +35,7 @@
(make-hash-table :test 'equal))
   (setq
phps-mode-parser-sdt--bookkeeping-namespace
-   "")
+   nil)
   (setq
phps-mode-parser-sdt--bookkeeping-symbol-stack
nil)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 052c8efd56..668ac6e88a 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -591,11 +591,9 @@
   (make-hash-table :test 'equal)
   "Bookkeeping")
 
-;; TODO Should use stack for namespace to be able to go up and down in level
-
 (defvar-local
   phps-mode-parser-sdt--bookkeeping-namespace
-  ""
+  nil
   "Current bookkeeping namespace.")
 
 (defvar-local
@@ -615,15 +613,70 @@
 
 (defun phps-mode-parser-sdt--get-namespaced-symbol-name (symbol-name)
   "Get namespaced SYMBOL-NAME."
-  (if
-  (gethash
-   symbol-name
-   phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
-  symbol-name
-(format
- "%s id %s"
- phps-mode-parser-sdt--bookkeeping-namespace
- symbol-name)))
+  (let ((namespace)
+(class)
+(interface)
+(trait)
+(function))
+(when phps-mode-parser-sdt--bookkeeping-namespace
+  (dolist (item phps-mode-parser-sdt--bookkeeping-namespace)
+(let ((space-type (car item))
+  (space-name (car (cdr item
+  (cond
+   ((equal space-type 'namespace)
+(setq namespace space-name))
+   ((equal space-type 'class)
+(setq class space-name))
+   ((equal space-type 'interface)
+(setq interface space-name))
+   ((equal space-type 'trait)
+(setq trait space-name))
+   ((equal space-type 'function)
+(setq function space-name))
+(if (gethash
+ symbol-name
+ phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+symbol-name
+  (let ((new-symbol-name
+ (format
+  " id %s"
+  symbol-name)))
+(when function
+  (setq
+   new-symbol-name
+   (format
+" function %s%s"
+function
+new-symbol-name)))
+(when trait
+  (setq
+   new-symbol-name
+   (format
+" trait %s%s"
+trait
+new-symbol-name)))
+(when interface
+  (setq
+   new-symbol-name
+   (format
+" interface %s%s"
+interface
+new-symbol-name)))
+(when class
+  (setq
+   new-symbol-name
+   (format
+" class %s%s"
+class
+new-symbol-name)))
+(when namespace
+  (setq
+   new-symbol-name
+   (format
+" namespace %s%s"
+namespace
+new-symbol-name)))
+new-symbol-name
 
 (defun phps-mode-parser-sdt--parse-top-statement ()
   "Parse latest top statement."
@@ -968,13 +1021,10 @@
  85
  (lambda(args _terminals)
(let ((namespace-name args))
- (setq
-  phps-mode-parser-sdt--bookkeeping-namespace
-  (format
-   " namespace %s%s"
-   namespace-name
-   phps-mode-parser-sdt--bookkeeping-namespace)))
-   args)
+ (push
+  (list 'namespace namespace-name)
+  phps-mode-parser-sdt--bookkeeping-namespace))
+ args)
  phps-mode-parser--table-translations)
 
 ;; 86 ((namespace_declaration_name) (T_NAME_QUALIFIED))
@@ -1151,9 +1201,7 @@
  112
  (lambda(args terminals)
(phps-mode-parser-sdt--parse-top-statement)
-   (setq
-phps-mode-parser-sdt--bookkeeping-namespace
-"")
+   (setq phps-mode-parser-sdt--bookkeeping-namespace nil)
`(
  ast-type
  namespace



[elpa] externals/phps-mode c782b18dc0 027/135: Merge branch 'master' into feature/full-sdt

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit c782b18dc04c72442dd8bea1d572787247c65ae8
Merge: 610358e2ef a42252b2b0
Author: Christian Johansson 
Commit: Christian Johansson 

Merge branch 'master' into feature/full-sdt
---
 TODO.md   |  25 ++
 phps-mode-indent.el   |   6 +-
 phps-mode-lexer.el| 191 --
 phps-mode-syntax-color.el |   2 +-
 phps-mode.el  |   4 +-
 test/phps-mode-test-indent.el |   4 +
 test/phps-mode-test-lexer.el  |  33 
 7 files changed, 200 insertions(+), 65 deletions(-)

diff --git a/TODO.md b/TODO.md
index 805f5f8299..c2c57ef2fb 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,5 +1,30 @@
 # TODO
 
+## Indentation
+
+### Alternative switch case
+
+switch($case) {
+case 1:
+case 2;
+echo 'here';
+}
+
+### Multi-line function call with named arguments
+
+function myFunction(
+$arg1,
+$arg2
+) {
+}
+myFunction(
+arg1:
+$var1,
+arg2:
+$var2,
+);
+
+
 ## Code intelligence
 
 * Bookkeeping of chained object operators like WC()->cart->subtotal
diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index 220cd95ade..f0ea149d44 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -1126,7 +1126,8 @@
;; default:
((and
  (not previous-line-ends-with-opening-bracket)
- (not (string-match-p ":[\t ]*$" previous-line-string))
+ (not (string-match-p ")[\t ]*:[\t ]*$" previous-line-string))
+ (not (string-match-p "^[\t ]*case[\t ]*" 
previous-line-string))
  (or
   (string-match-p
"^[\t ]*case[\t ]+.*\\(;\\|:\\)[\t ]*$"
@@ -1312,6 +1313,9 @@
;; LINE AFTER ALTERNATIVE CASE DEFINITION
;; switch ($array):
;; case 'Something';
+   ;; or
+   ;; switch ($array):
+   ;; case 'Something':
((and
  (string-match-p
   "^[\t ]*\\(case.+\\|default\\)\\(;\\|:\\)[\t ]*$"
diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index 8daae5d1b8..ecbf76cc94 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -12,6 +12,11 @@
 ;; * Defines the lexer for this grammar based on the Zend PHP 8.1 Lexer at
 ;; 
https://raw.githubusercontent.com/php/php-src/PHP-8.1/Zend/zend_language_scanner.l
 ;; which is using re2c.
+;;
+;; Instructions on how to generate new lexer rules
+;; 1. Make edits in lexer rules in function 
`phps-mode-lexer--generate-lexer-rules'
+;; 2. Run `eval-buffer' and then `phps-mode-lexer--generate-lexer-rules'
+;; 3. Update inline value of `phps-mode-lexer--lambdas-by-state' by running 
code "(insert (format "%S" phps-mode-lexer--lambdas-by-state))"
 
 ;;; Code:
 
@@ -52,20 +57,17 @@
   2147483648
   "Limit for 32-bit integer.")
 
-(defconst phps-mode-lexer--bnum
-  "0b[01]+"
-  "Boolean number.")
-
-(defconst phps-mode-lexer--hnum
-  "0x[0-9a-fA-F]+"
-  "Hexadecimal number.")
-
 (defconst phps-mode-lexer--lnum
-  "[0-9]+"
+  "[0-9]+\\(_[0-9]+\\)*"
   "Long number.")
 
 (defconst phps-mode-lexer--dnum
-  "\\([0-9]*\\.[0-9]+\\)\\|\\([0-9]+\\.[0-9]*\\)"
+  (format
+   "\\(%s?\\.%s\\|%s\\.%s?\\)"
+   phps-mode-lexer--lnum
+   phps-mode-lexer--lnum
+   phps-mode-lexer--lnum
+   phps-mode-lexer--lnum)
   "Double number.")
 
 (defconst phps-mode-lexer--exponent-dnum
@@ -75,6 +77,18 @@
   phps-mode-lexer--lnum)
   "Exponent double number.")
 
+(defconst phps-mode-lexer--hnum
+  "0x[0-9a-fA-F]+\\(_[0-9a-fA-F]+\\)*"
+  "Hexadecimal number.")
+
+(defconst phps-mode-lexer--bnum
+  "0b[01]+\\(_[01]+\\)*"
+  "Boolean number.")
+
+(defconst phps-mode-lexer--onum
+  "0o[0-7]+\\(_[0-7]+\\)*"
+  "Octal number.")
+
 (defconst phps-mode-lexer--label
   "[A-Za-z_[:nonascii:]][0-9A-Za-z_[:nonascii:]]*"
   "Labels are used for names.")
@@ -107,18 +121,17 @@
 ;; VARIABLES
 
 
-(defconst
-  phps-mode-lexer--lambdas-by-state
-  #s(hash-table size 65 test equal rehash-size 1.5 rehash-threshold 0.8125 
data (ST_IN_SCRIPTING ((lambda nil (when (looking-at "exit") (let ((match-end 
(match-end 0)) (match-beginning (match-beginning 0))) (let ((matching-length (- 
match-end match-beginning))) (when (> matching-length 0) (when (or (not 
phps-mode-lexer--match-length) (> matching-length 
phps-mode-lexer--match-length)) (setq phps-mode-lexer--match-length 
matching-length) (setq phps-mode-lexer--match-body (lambda nil (phps- [...]
-]*" "\\(\\$\\|\\.\\.\\.\\)")) (let ((match-end (match-end 0)) (match-beginning 
(match-beginning 0))) (let ((matching-length (- match-end match-beginning))) 
(when (> matching-length 0) (when (or (not phps-mode-lexer--match-length) (> 
matching-length phps-mode-lexer--match-length)) (setq 
phps-mode-lexer--match-length matching-length) (setq 
phps-mode-lexer--match-body (lambda nil (phps-mode-lexer--yyless 1) 
(phps-mode-lexer--return-token 'T_AMPERSAND_FOLLOWED_BY_VAR_OR_VARARG 
(matc

[elpa] externals/phps-mode 96eeff74f8 130/135: Added more todo items for bookkeeping and imenu

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 96eeff74f85c180d88723c09700f97dc42b7efc2
Author: christian 
Commit: christian 

Added more todo items for bookkeeping and imenu
---
 phps-mode-parser-sdt.el| 21 ++---
 test/phps-mode-test-ast.el |  4 ++--
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index b44ca19edf..853fa94320 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -841,6 +841,12 @@
 ;; (message "potential-uris: %S" potential-uris)
 ))
 
+ ((equal space-type 'object-operator)
+  (setq scope-object-operator space-name))
+
+ ((equal space-type 'static-member)
+  (setq scope-static-member space-name))
+
  )))
 (setq scope-index (1+ scope-index)
 
@@ -1596,6 +1602,7 @@
  (symbol-object-operator
   (nth 13 (nth 1 symbol-uri-object)))
  (symbol-hit 0))
+
 (unless (and
  symbol-object-operator
  (not (string= (downcase symbol-object-operator) "$this")))
@@ -1637,14 +1644,14 @@
   (when (<= matching-symbol-start symbol-start)
 (setq matching-hit t)
 (setq symbol-hit matching-symbol-id)))
-(setq matching-symbol-index (1+ matching-symbol-index)))
+(setq matching-symbol-index (1+ matching-symbol-index))
 
-(puthash
- (list
-  symbol-start
-  symbol-end)
- symbol-hit
- phps-mode-parser-sdt-bookkeeping)
+  (puthash
+   (list
+symbol-start
+symbol-end)
+   symbol-hit
+   phps-mode-parser-sdt-bookkeeping))
 
 ;; (message
 ;;  "reference symbol uri: %S from %S + %S, start: %S, end: %S, 
object: %S, hit?: %S"
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 3e77798291..48d1cbdc69 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -131,8 +131,9 @@
   "Run test for bookkeeping generation."
   (message "-- Running tests for bookkeeping generation... --\n")
 
-  ;; TODO MVP Not bookkeeping for $var->whatever when $var is not $this
   ;; TODO v2 Should have more delicate handling of isset, !empty condition 
blocks
+  ;; TODO v2 bookkeep and include constants in imenu
+  ;; TODO v2 imenu should contain redeclaration of variables
 
   (phps-mode-test-ast--should-bookkeep
" 'random', 'doThis' => function() {}];\nif 
($z->name) {\necho 'Hit';\n}\nif ($z->doThis()) {\necho 'Hit';\n}"
"Bookkeeping ignoring variable properties that is not $this"



[elpa] externals/phps-mode 6816e24e04 005/135: More work on attributes SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 6816e24e040fb89f148b4ac368c8af5fb07addbf
Author: Christian Johansson 
Commit: Christian Johansson 

More work on attributes SDT
---
 phps-mode-parser-sdt.el | 94 -
 1 file changed, 31 insertions(+), 63 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index f52dda1224..5d0cd484e1 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1003,74 +1003,31 @@
  phps-mode-parser--table-translations)
 
 ;; 102 ((attributed_statement) (function_declaration_statement))
-(puthash
- 102
- (lambda(args _terminals)
-   `(
- ast-type
- attributed-statement
- ast-child-type
- function
- child
- ,args
- ))
- phps-mode-parser--table-translations)
+(puthash 102 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 103 ((attributed_statement) (class_declaration_statement))
-(puthash
- 103
- (lambda(args _terminals)
-   `(
- ast-type
- attributed-statement
- ast-child-type
- class
- child
- ,args
- ))
- phps-mode-parser--table-translations)
+(puthash 103 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 104 ((attributed_statement) (trait_declaration_statement))
-(puthash
- 104
- (lambda(args _terminals)
-   `(
- ast-type
- attributed-statement
- ast-child-type
- trait
- child
- ,args
- ))
- phps-mode-parser--table-translations)
+(puthash 104 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 105 ((attributed_statement) (interface_declaration_statement))
-(puthash
- 105
- (lambda(args _terminals)
-   `(
- ast-type
- attributed-statement
- ast-child-type
- interface
- child
- ,args
- ))
- phps-mode-parser--table-translations)
+(puthash 105 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 106 ((attributed_statement) (enum_declaration_statement))
-(puthash
- 106
- (lambda(args _terminals)
-   `(
- ast-type
- attributed-statement
- ast-child-type
- enum
- child
- ,args
- ))
- phps-mode-parser--table-translations)
+(puthash 106 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 107 ((top_statement) (statement))
+(puthash 107 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 108 ((top_statement) (statement))
+(puthash 108 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 109 ((top_statement) (attributed_statement))
+(puthash 109 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 110 ((top_statement) (T_HALT_COMPILER "(" ")" ";"))
+(puthash 109 (lambda(args _terminals) (nth 0 args)) 
phps-mode-parser--table-translations)
 
 ;; 111 top_statement -> (T_NAMESPACE namespace_declaration_name ";")
 (puthash
@@ -1110,11 +1067,22 @@
  ))
  phps-mode-parser--table-translations)
 
-;; top_statement -> (T_NAMESPACE "{" top_statement_list "}")
+;; 113 top_statement -> (T_NAMESPACE "{" top_statement_list "}")
 (puthash
  113
- (lambda(args _terminals)
-   (nth 2 args))
+ (lambda(args terminals)
+   `(
+ ast-type
+ namespace
+ index
+ ,(car (cdr (nth 0 terminals)))
+ start
+ ,(car (cdr (nth 1 terminals)))
+ end
+ ,(car (cdr (nth 3 terminals)))
+ children
+ ,(nth 2 args)
+ ))
  phps-mode-parser--table-translations)
 
 ;; inner_statement_list -> (inner_statement_list inner_statement)



[elpa] externals/phps-mode ad3b10e716 055/135: Added variable reference to bookkeeping stack where it is referencing $this

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit ad3b10e71656d2e15f9d3a26071a30647df70ace
Author: Christian Johansson 
Commit: Christian Johansson 

Added variable reference to bookkeeping stack where it is referencing $this
---
 phps-mode-parser-sdt.el | 92 ++---
 1 file changed, 88 insertions(+), 4 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 87670c476d..e6c3be3d01 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -5640,8 +5640,83 @@
 ;; 513 ((variable) (array_object_dereferenceable T_OBJECT_OPERATOR 
property_name))
 (puthash
  513
- (lambda(args _terminals)
-   ;; TODO Add to stack variable reference here
+ (lambda(args terminals)
+   (let* ((array-object-dereferenceable (nth 0 args))
+  (array-object-dereferenceable-type
+   (plist-get
+array-object-dereferenceable
+'ast-type)))
+ (when (equal
+array-object-dereferenceable-type
+'array-object-dereferenceable-fully-dereferenceable)
+   (let* ((dereferenceable
+   (plist-get
+array-object-dereferenceable
+'fully-dereferenceable))
+  (dereferencable-type
+   (plist-get
+dereferenceable
+'ast-type)))
+ (when (equal
+dereferencable-type
+'fully-dereferenceable-variable)
+   (let* ((fully-dereferenceable-variable
+   (plist-get
+dereferenceable
+'variable))
+  (fully-dereferenceable-variable-type
+   (plist-get
+fully-dereferenceable-variable
+'ast-type)))
+ (when (equal
+fully-dereferenceable-variable-type
+'variable-callable-variable)
+   (let* ((callable-variable
+   (plist-get
+fully-dereferenceable-variable
+'callable-variable))
+  (callable-variable-type
+   (plist-get
+callable-variable
+'ast-type)))
+ (when (equal
+callable-variable-type
+'callable-variable-simple-variable)
+   (let* ((simple-variable
+  (plist-get
+   (plist-get
+callable-variable
+'simple-variable)
+   'variable))
+  (simple-variable-lowercased
+   (downcase simple-variable)))
+ (let* ((property (nth 2 args))
+(property-type (plist-get property 'ast-type)))
+   (when (equal
+  property-type
+  'property-name-string)
+ (let ((property-string
+(plist-get
+ property
+ 'string)))
+   (cond
+
+((string=
+  simple-variable-lowercased
+  "$this")
+ (let ((namespace 
phps-mode-parser-sdt--bookkeeping-namespace))
+   (push (list 'object-operator) namespace)
+   (push
+(list
+ property-string
+ namespace
+ (car (cdr (nth 0 terminals)))
+ (cdr (cdr (nth 2 terminals
+
phps-mode-parser-sdt--bookkeeping-symbol-stack)))
+
+(t
+ ;; TODO Do something here?
+ ))
`(
  ast-type
  variable-array-object-dereferenceable-property-name
@@ -5685,6 +5760,10 @@
`(
  ast-type
  simple-variable-variable
+ ast-start
+ ,(car (cdr terminals))
+ ast-end
+ ,(cdr (cdr terminals))
  variable
  ,args))
  phps-mode-parser--table-translations)
@@ -5702,11 +5781,16 @@
 ;; 517 ((simple_variable) ("$" simple_variable))
 (puthash
  517
- (lambda(args _terminals)
+ (lambda(args terminals)
`(
  ast-type
  simple-variable-variable
- ,(nth 1 args)))
+ ,(nth 1 args)
+ ast-start
+ ,(car (cdr (nth 1 terminals)))
+ ast-end
+ ,(cdr (cdr (nth 1 terminals)))
+ ))
  phps-mode-parser--table-translations)
 
 ;; 518 ((static_member) (class_name T_PAAMAYIM_NEKUDOTAYIM simple_variable))



[elpa] externals/phps-mode a07fd20026 008/135: Keeping track of global namespace directly from SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit a07fd20026bd8c0a1a974416bb99d15d20fbbf0d
Author: Christian Johansson 
Commit: Christian Johansson 

Keeping track of global namespace directly from SDT
---
 phps-mode-ast-imenu.el  | 131 +---
 phps-mode-parser-sdt.el | 101 -
 2 files changed, 169 insertions(+), 63 deletions(-)

diff --git a/phps-mode-ast-imenu.el b/phps-mode-ast-imenu.el
index e61e6bfe9d..1b3528ee33 100644
--- a/phps-mode-ast-imenu.el
+++ b/phps-mode-ast-imenu.el
@@ -19,7 +19,9 @@
 (defun phps-mode-ast-imenu--generate (&optional tree)
   "Generate imenu from current buffer AST or optionally from TREE."
   (let ((imenu-index)
-(ast-tree (if tree tree phps-mode-ast--tree)))
+(ast-tree (if tree tree phps-mode-ast--tree))
+(global-namespace-name)
+(global-namespace-items))
 (dolist (item ast-tree)
   (let ((children (plist-get item 'children))
 (item-type (plist-get item 'ast-type))
@@ -30,57 +32,84 @@
item-index
item-name
item-type)
-  (if (and
-   (or
-(equal item-type 'namespace)
-(equal item-type 'class)
-(equal item-type 'interface))
-   children)
-  (progn
-(dolist (child children)
-  (let ((grand-children (plist-get child 'children))
-(child-type (plist-get child 'ast-type))
-(child-name (plist-get child 'name))
-(child-index (plist-get child 'index))
-(subparent))
-(when (and
-   child-name
-   child-index)
-  (if (and
-   (or
-(equal child-type 'class)
-(equal child-type 'interface))
-   grand-children)
-  (progn
-(dolist (grand-child grand-children)
-  (let ((grand-child-index
- (plist-get grand-child 'index))
-(grand-child-name
- (plist-get grand-child 'name)))
-(when (and
-   grand-child-index
-   grand-child-name)
+  (if (or
+   (equal item-type 'namespace)
+   (equal item-type 'class)
+   (equal item-type 'interface))
+  (if children
+  (progn
+(dolist (child children)
+  (let ((grand-children (plist-get child 'children))
+(child-type (plist-get child 'ast-type))
+(child-name (plist-get child 'name))
+(child-index (plist-get child 'index))
+(subparent))
+(when (and
+   child-name
+   child-index)
+  (if (and
+   (or
+(equal child-type 'class)
+(equal child-type 'interface))
+   grand-children)
+  (progn
+(dolist (grand-child grand-children)
+  (let ((grand-child-index
+ (plist-get grand-child 'index))
+(grand-child-name
+ (plist-get grand-child 'name)))
+(when (and
+   grand-child-index
+   grand-child-name)
+  (push
+   `(,grand-child-name . 
,grand-child-index)
+   subparent
+(when subparent
   (push
-   `(,grand-child-name . ,grand-child-index)
-   subparent
-(when subparent
-  (push
-   (append
-(list child-name)
-(reverse subparent))
-   parent)))
-(push
- `(,child-name . ,child-index)
- parent)
-(when parent
-  (push
-   (append
-(list item-name)
-(reverse parent))
-   

[elpa] externals/phps-mode b1d402cc39 001/135: Added some SDT rules

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit b1d402cc39d82e7bf639a7e14537c7aa344ec581
Author: Christian Johansson 
Commit: Christian Johansson 

Added some SDT rules
---
 phps-mode-parser-sdt.el | 265 ++--
 1 file changed, 258 insertions(+), 7 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 6748c729ca..abb18fce72 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -626,16 +626,267 @@
 
(t (list objects
 
-;; top_statement_list -> (top_statement_list top_statement)
+;; SDT starts here
+
+;; 0 ((start) (top_statement_list))
+(puthash 0 (lambda(args _terminals) args) phps-mode-parser--table-translations)
+
+;; 1 ((reserved_non_modifiers) (T_INCLUDE))
+(puthash 1 (lambda(_args _terminals) 'T_INCLUDE) 
phps-mode-parser--table-translations)
+
+;; 2 ((reserved_non_modifiers) (T_INCLUDE_ONCE))
+(puthash 2 (lambda(_args _terminals) 'T_INCLUDE_ONCE) 
phps-mode-parser--table-translations)
+
+;; 3 ((reserved_non_modifiers) (T_EVAL))
+(puthash 3 (lambda(_args _terminals) 'T_EVAL) 
phps-mode-parser--table-translations)
+
+;; 4 ((reserved_non_modifiers) (T_REQUIRE))
+(puthash 4 (lambda(_args _terminals) 'T_REQUIRE) 
phps-mode-parser--table-translations)
+
+;; 5 ((reserved_non_modifiers) (T_REQUIRE_ONCE))
+(puthash 5 (lambda(_args _terminals) 'T_REQUIRE_ONCE) 
phps-mode-parser--table-translations)
+
+;; 6 ((reserved_non_modifiers) (T_LOGICAL_OR))
+(puthash 6 (lambda(_args _terminals) 'T_LOGICAL_OR) 
phps-mode-parser--table-translations)
+
+;; 7 ((reserved_non_modifiers) (T_LOGICAL_XOR))
+(puthash 7 (lambda(_args _terminals) 'T_LOGICAL_XOR) 
phps-mode-parser--table-translations)
+
+;; 8 ((reserved_non_modifiers) (T_LOGICAL_AND))
+(puthash 8 (lambda(_args _terminals) 'T_LOGICAL_AND) 
phps-mode-parser--table-translations)
+
+;; 9 ((reserved_non_modifiers) (T_INSTANCEOF))
+(puthash 9 (lambda(_args _terminals) 'T_INSTANCEOF) 
phps-mode-parser--table-translations)
+
+;; 10 ((reserved_non_modifiers) (T_NEW))
+(puthash 10 (lambda(_args _terminals) 'T_NEW) 
phps-mode-parser--table-translations)
+
+;; 11 ((reserved_non_modifiers) (T_CLONE))
+(puthash 11 (lambda(_args _terminals) 'T_CLONE) 
phps-mode-parser--table-translations)
+
+;; 12 ((reserved_non_modifiers) (T_EXIT))
+(puthash 12 (lambda(_args _terminals) 'T_EXIT) 
phps-mode-parser--table-translations)
+
+;; 13 ((reserved_non_modifiers) (T_IF))
+(puthash 13 (lambda(_args _terminals) 'T_IF) 
phps-mode-parser--table-translations)
+
+;; 14 ((reserved_non_modifiers) (T_ELSEIF))
+(puthash 14 (lambda(_args _terminals) 'T_ELSEIF) 
phps-mode-parser--table-translations)
+
+;; 15 ((reserved_non_modifiers) (T_ELSE))
+(puthash 15 (lambda(_args _terminals) 'T_ELSE) 
phps-mode-parser--table-translations)
+
+;; 16 ((reserved_non_modifiers) (T_ENDIF))
+(puthash 16 (lambda(_args _terminals) 'T_ENDIF) 
phps-mode-parser--table-translations)
+
+;; 17 ((reserved_non_modifiers) (T_ECHO))
+(puthash 17 (lambda(_args _terminals) 'T_ECHO) 
phps-mode-parser--table-translations)
+
+;; 18 ((reserved_non_modifiers) (T_DO))
+(puthash 18 (lambda(_args _terminals) 'T_DO) 
phps-mode-parser--table-translations)
+
+;; 19 ((reserved_non_modifiers) (T_WHILE))
+(puthash 19 (lambda(_args _terminals) 'T_WHILE) 
phps-mode-parser--table-translations)
+
+;; 20 ((reserved_non_modifiers) (T_ENDWHILE))
+(puthash 20 (lambda(_args _terminals) 'T_ENDWHILE) 
phps-mode-parser--table-translations)
+
+;; 21 ((reserved_non_modifiers) (T_FOR))
+(puthash 21 (lambda(_args _terminals) 'T_FOR) 
phps-mode-parser--table-translations)
+
+;; 22 ((reserved_non_modifiers) (T_ENDFOR))
+(puthash 22 (lambda(_args _terminals) 'T_ENDFOR) 
phps-mode-parser--table-translations)
+
+;; 23 ((reserved_non_modifiers) (T_FOREACH))
+(puthash 23 (lambda(_args _terminals) 'T_FOREACH) 
phps-mode-parser--table-translations)
+
+;; 24 ((reserved_non_modifiers) (T_ENDFOREACH))
+(puthash 24 (lambda(_args _terminals) 'T_ENDFOREACH) 
phps-mode-parser--table-translations)
+
+;; 25 ((reserved_non_modifiers) (T_DECLARE))
+(puthash 25 (lambda(_args _terminals) 'T_DECLARE) 
phps-mode-parser--table-translations)
+
+;; 26 ((reserved_non_modifiers) (T_ENDDECLARE))
+(puthash 26 (lambda(_args _terminals) 'T_ENDDECLARE) 
phps-mode-parser--table-translations)
+
+;; 27 ((reserved_non_modifiers) (T_AS))
+(puthash 27 (lambda(_args _terminals) 'T_AS) 
phps-mode-parser--table-translations)
+
+;; 28 ((reserved_non_modifiers) (T_TRY))
+(puthash 28 (lambda(_args _terminals) 'T_TRY) 
phps-mode-parser--table-translations)
+
+;; 29 ((reserved_non_modifiers) (T_CATCH))
+(puthash 29 (lambda(_args _terminals) 'T_CATCH) 
phps-mode-parser--table-translations)
+
+;; 30 ((reserved_non_modifiers) (T_FINALLY))
+(puthash 30 (lambda(_args _terminals) 'T_FINALLY) 
phps-mode-parser--table-translations)
+
+;; 31 ((reserved_non_modifiers) (T_THROW))
+(puthash 31 (lambda(_args _terminals) 'T_THROW) 
phps-mode-parser--table-translations)
+
+;; 32 ((reserved_non_modifiers) (T_USE))
+(puthash 32 (lambda(_args 

[elpa] externals/phps-mode a0b350c316 003/135: More work on SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit a0b350c3164680d4c623936eb71abddbfe60743f
Author: Christian Johansson 
Commit: Christian Johansson 

More work on SDT
---
 phps-mode-ast.el| 54 ++---
 phps-mode-parser-sdt.el | 34 +--
 2 files changed, 34 insertions(+), 54 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index eca2c86800..2a4e4eaaa3 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -40,61 +40,11 @@
  phps-mode-ast--parse-trail
  parse-trail)
 
-;; (message "\nTranslation:\n%S\n\n" translation)
-
-(when translation
-  (dolist (item translation)
-(when (listp item)
-  (cond
-
-   ((plist-get item 'ast-type)
-(if (and
- (not namespace)
- (equal (plist-get item 'ast-type) 'namespace)
- (equal (plist-get item 'end) 'max))
-(progn
-  ;; (message "Found global namespace: %S" item)
-  (setq
-   namespace
-   item))
-  (if namespace
-  (push
-   item
-   namespace-children)
-(push
- item
- ast
-
-   ((listp (car item))
-(dolist (sub-item item)
-  (when (and
- (listp sub-item)
- (plist-get sub-item 'ast-type))
-(if namespace
-(push
- sub-item
- namespace-children)
-  (push
-   sub-item
-   ast)
-
-(when namespace
-  (plist-put
-   namespace
-   'children
-   (reverse namespace-children))
-  (push
-   namespace
-   ast))
-(setq
- ast
- (reverse ast))
-
-;; (message "AST:\n%S\n\n" ast)
+(message "\nTranslation:\n%S\n\n" translation)
 
 (setq
  phps-mode-ast--tree
- ast)
+ translation)
 phps-mode-ast--tree))
 
 
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index a78564c428..fd1d14ab27 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -872,10 +872,10 @@
 (puthash 80 (lambda(_args _terminals) 
'T_AMPERSAND_NOT_FOLLOWED_BY_VAR_OR_VARARG) 
phps-mode-parser--table-translations)
 
 ;; 81 ((identifier) (T_STRING))
-(puthash 81 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+(puthash 81 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 82 ((identifier) (semi_reserved))
-(puthash 82 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+(puthash 82 (lambda(args terminals) args) phps-mode-parser--table-translations)
 
 ;; 83 ((top_statement_list) (top_statement_list top_statement))
 (puthash
@@ -886,6 +886,36 @@
 ;; 84 ((top_statement_list) (%empty))
 (puthash 84 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
 
+;; 85 ((namespace_declaration_name) (identifier))
+(puthash 85 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 86 ((namespace_declaration_name) (T_NAME_QUALIFIED))
+(puthash 86 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+
+;; 87 ((namespace_name) (T_STRING))
+(puthash 87 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 88 ((namespace_name) (T_NAME_QUALIFIED))
+(puthash 88 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+
+;; 89 ((legacy_namespace_name) (namespace_name))
+(puthash 89 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 90 ((legacy_namespace_name) (T_NAME_FULLY_QUALIFIED))
+(puthash 90 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+
+;; 91 ((name) (T_STRING))
+(puthash 91 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 92 ((name) (T_NAME_QUALIFIED))
+(puthash 92 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+
+;; 93 ((name) (T_NAME_FULLY_QUALIFIED))
+(puthash 93 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+
+;; 94 ((name) (T_NAME_RELATIVE))
+(puthash 94 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+
 ;; 111 top_statement -> (T_NAMESPACE namespace_declaration_name ";")
 (puthash
  111



[elpa] externals/phps-mode 610358e2ef 026/135: SDT for property

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 610358e2ef3e5bf0a9da7686e3b71ab02e7bb3ab
Author: Christian Johansson 
Commit: Christian Johansson 

SDT for property
---
 phps-mode-parser-sdt.el | 30 ++
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index d4936fdd34..17f4876e32 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2886,28 +2886,40 @@
 (puthash 335 (lambda(_args _terminals) 'final) 
phps-mode-parser--table-translations)
 
 ;; 336 ((member_modifier) (T_READONLY))
-(puthash 335 (lambda(_args _terminals) 'readonly) 
phps-mode-parser--table-translations)
+(puthash 336 (lambda(_args _terminals) 'readonly) 
phps-mode-parser--table-translations)
 
-;; TODO Was here
+;; 337 ((property_list) (property_list "," property))
+(puthash 337 (lambda(args _terminals) (append (nth 0 args) (nth 2 args))) 
phps-mode-parser--table-translations)
+
+;; 338 ((property_list) (property))
+(puthash 338 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
 
-;; property -> (T_VARIABLE backup_doc_comment)
+;; 339 ((property) (T_VARIABLE backup_doc_comment))
 (puthash
  339
  (lambda(args _terminals)
-   (nth 0 args))
+   `(
+ property-variable
+ variable
+ ,(nth 0 args)
+ backup-doc-comment
+ ,(nth 1 args)
+ ))
  phps-mode-parser--table-translations)
 
-;; property -> (T_VARIABLE "=" expr backup_doc_comment)
+;; 340 ((property) (T_VARIABLE "=" expr backup_doc_comment))
 (puthash
  340
  (lambda(args terminals)
`(
  ast-type
- assign-property-variable
- key
+ property-assigned-variable
+ variable
  ,(nth 0 args)
- value
+ expr
  ,(nth 2 args)
+ backup-doc-comment
+ ,(nth 3 args)
  ast-index
  ,(car (cdr (nth 0 terminals)))
  ast-start
@@ -2917,6 +2929,8 @@
  ))
  phps-mode-parser--table-translations)
 
+;; TODO Was here
+
 ;; expr -> ("[" array_pair_list "]" "=" expr)
 (puthash
  358



[elpa] externals/phps-mode 8aae220c57 098/135: Started on integrating imenu generation in SDT bookkeeping

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 8aae220c5760c2202e387a16ee5adb6a69d159fb
Author: Christian Johansson 
Commit: Christian Johansson 

Started on integrating imenu generation in SDT bookkeeping
---
 phps-mode-ast.el   |  12 +++
 phps-mode-parser-sdt.el| 189 +++--
 test/phps-mode-test-ast.el |   7 +-
 3 files changed, 149 insertions(+), 59 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 46d7f9a130..7fd9d7a1eb 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -33,6 +33,18 @@
   (setq
phps-mode-parser-sdt-bookkeeping
(make-hash-table :test 'equal))
+  (setq
+   phps-mode-parser-sdt-symbol-table-index
+   0)
+  (setq
+   phps-mode-parser-sdt-symbol-imenu
+   nil)
+  (setq
+   phps-mode-parser-sdt-symbol-table
+   (make-hash-table :test 'equal))
+  (setq
+   phps-mode-parser-sdt-symbol-table-by-uri
+   (make-hash-table :test 'equal))
   (setq
phps-mode-parser-sdt--bookkeeping-namespace
nil)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 9debeadd39..590e7a3821 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -589,7 +589,27 @@
 (defvar-local
   phps-mode-parser-sdt-bookkeeping
   (make-hash-table :test 'equal)
-  "Bookkeeping")
+  "Bookkeeping of symbol references.")
+
+(defvar-local
+  phps-mode-parser-sdt-symbol-table-index
+  0
+  "Symbol table index.")
+
+(defvar-local
+  phps-mode-parser-sdt-symbol-table
+  (make-hash-table :test 'equal)
+  "Symbol table of parse, symbol ID => (list URI start end)")
+
+(defvar-local
+  phps-mode-parser-sdt-symbol-table-by-uri
+  (make-hash-table :test 'equal)
+  "Symbol table of parse, symbol URI => list of symbol IDs.")
+
+(defvar-local
+  phps-mode-parser-sdt-symbol-imenu
+  nil
+  "Imenu for symbols of parse.")
 
 (defvar-local
   phps-mode-parser-sdt--bookkeeping-namespace
@@ -673,7 +693,7 @@
 (while (< potential-uri-index potential-uri-count)
   (setf
(nth potential-uri-index potential-uris)
-   (format " static%s" (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)))
@@ -690,7 +710,7 @@
 (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)))
+   (format "namespace %s%s" space-name (nth 
potential-uri-index potential-uris)))
   (setq potential-uri-index (1+ potential-uri-index)
 
  ((and
@@ -701,7 +721,7 @@
 (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)))
+   (format "class %s%s" space-name (nth 
potential-uri-index potential-uris)))
   (setq potential-uri-index (1+ potential-uri-index)
 
  ((and
@@ -712,7 +732,7 @@
 (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)))
+   (format "interface %s%s" space-name (nth 
potential-uri-index potential-uris)))
   (setq potential-uri-index (1+ potential-uri-index)
 
  ((and
@@ -723,7 +743,7 @@
 (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)))
+   (format "trait %s%s" space-name (nth 
potential-uri-index potential-uris)))
   (setq potential-uri-index (1+ potential-uri-index)
 
  ((and
@@ -737,7 +757,7 @@
 (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)))
+   (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)
@@ -746,7 +766,7 @@
   

[elpa] externals/phps-mode 4949daefd9 101/135: Passing another SDT imenu test

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 4949daefd927e4760667d58bf7c9f0c70b4b6d7e
Author: Christian Johansson 
Commit: Christian Johansson 

Passing another SDT imenu test
---
 test/phps-mode-test-ast.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index b7bee26e20..7f88b2d070 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -167,7 +167,8 @@
   (phps-mode-test-ast--should-bookkeep
" $value) {\nif ($key || $value) {\necho 'Hit';\n  
  }\n}\nfor ($i = 0; $i < count($items); $i++) {\nif ($i) {\necho 
'Hit';\n}\n}\nif ($a = 123) {\nif ($a) {\necho 'Hit';\n
}\n}\nwhile ($b = 123) {\nif ($a) {\necho 'Hit';\n}\n}\ndo {\n  
  echo 'Hit';\n} while ( [...]
"Bookkeeping of conditional assignments"
-   '((" id $items" ((36 42))) ((36 42) 1) (" id $item" ((80 85))) ((97 102) 1) 
((80 85) 1) ((70 76) 1) (" id $value" ((161 167))) (" id $key" ((153 157))) 
((187 193) 1) ((179 183) 1) ((161 167) 1) ((153 157) 1) ((143 149) 1) (" id $i" 
((230 232))) ((274 276) 1) ((258 260) 1) ((249 255) 1) ((238 240) 1) ((230 232) 
1) (" id $a" ((312 314))) ((332 334) 1) ((312 314) 1) (" id $b" ((373 375))) 
((393 395) 1) ((373 375) 1) (" id $c" ((457 459))) ((457 459) 1)))
+   '(((36 42) 1) ((97 102) 2) ((80 85) 2) ((70 76) 1) ((187 193) 3) ((179 183) 
4) ((161 167) 3) ((153 157) 4) ((143 149) 1) ((274 276) 5) ((258 260) 5) ((249 
255) 1) ((238 240) 5) ((230 232) 5) ((332 334) 6) ((312 314) 6) ((393 395) 6) 
((373 375) 7) ((457 459) 8))
+   '(("id $items" . 36) ("id $item" . 80) ("id $value" . 161) ("id $key" . 
153) ("id $i" . 230) ("id $a" . 312) ("id $b" . 373) ("id $c" . 457)))
 
   (phps-mode-test-ast--should-bookkeep
"var1) {\necho 
'Hit';\n}\nif (self::$var1) {\necho 'Miss';\n   
 }\nif (self::$var2) {\necho 'Hit';\n}\nif 
(static::$var2) {\n [...]



[elpa] externals/phps-mode f86d8dc6ac 078/135: More work on arrow function variable uri

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit f86d8dc6ac0b291b3b94a3f547555b0fdb3d128a
Author: christian 
Commit: christian 

More work on arrow function variable uri
---
 phps-mode-parser-sdt.el | 18 --
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index faab16fd49..ca8c10f00c 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -753,14 +753,20 @@
   (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
+  ;; branch of two alternative namespaces here
+  ;; one with and one without the arrow function scope
   (let ((potential-uri-count (length potential-uris))
-(potential-uri-index 0))
+(potential-uri-index 0)
+(new-potential-uris))
 (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)
+  (push
+   (format " arrow %s%s" space-name (nth 
potential-uri-index potential-uris))
+   new-potential-uris)
+  (setq potential-uri-index (1+ potential-uri-index)))
+(setq potential-uris (append potential-uris 
new-potential-uris))
+(message "new-potential-uris: %S" new-potential-uris)
+(message "potential-uris: %S" potential-uris)
+))
 
  ;; TODO Below should alter symbol namespaces instead of build 
namespace data
  ((equal space-type 'global)



[elpa] externals/phps-mode a0358daa01 004/135: Added SDT for attributes

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit a0358daa01d4e825a10587fcb5bf011a1802c53f
Author: Christian Johansson 
Commit: Christian Johansson 

Added SDT for attributes
---
 phps-mode-parser-sdt.el | 164 ++--
 1 file changed, 160 insertions(+), 4 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index fd1d14ab27..f52dda1224 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -902,19 +902,175 @@
 (puthash 89 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 90 ((legacy_namespace_name) (T_NAME_FULLY_QUALIFIED))
-(puthash 90 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+(puthash 90 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 91 ((name) (T_STRING))
 (puthash 91 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 92 ((name) (T_NAME_QUALIFIED))
-(puthash 92 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+(puthash 92 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 93 ((name) (T_NAME_FULLY_QUALIFIED))
-(puthash 93 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+(puthash 93 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 94 ((name) (T_NAME_RELATIVE))
-(puthash 94 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+(puthash 94 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 95 ((attribute_decl) (class_name))
+(puthash
+ 95
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attribute-decl
+ class-name
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 96 ((attribute_decl) (class_name argument_list))
+(puthash
+ 96
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attribute-decl
+ class-name
+ ,(nth 0 args)
+ argument-list
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 97 ((attribute_group) (attribute_decl))
+(puthash
+ 97
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attribute-group
+ children
+ (,args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 98 ((attribute_group) (attribute_group "," attribute_decl))
+(puthash
+ 98
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attribute-group
+ children
+ ,(append (plist-get (nth 0 args) 'ast-type) (nth 2 args))
+ ))
+ phps-mode-parser--table-translations)
+
+;; 99 ((attribute) (T_ATTRIBUTE attribute_group possible_comma "]"))
+(puthash
+ 99
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attribute
+ children
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 100 ((attributes) (attribute))
+(puthash
+ 100
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attributes
+ children
+ (,attribute)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 101 ((attributes) (attributes attribute))
+(puthash
+ 101
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attributes
+ children
+ ,(append (plist-get (nth 0 args) 'children) (nth 1 args))
+ ))
+ phps-mode-parser--table-translations)
+
+;; 102 ((attributed_statement) (function_declaration_statement))
+(puthash
+ 102
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attributed-statement
+ ast-child-type
+ function
+ child
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 103 ((attributed_statement) (class_declaration_statement))
+(puthash
+ 103
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attributed-statement
+ ast-child-type
+ class
+ child
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 104 ((attributed_statement) (trait_declaration_statement))
+(puthash
+ 104
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attributed-statement
+ ast-child-type
+ trait
+ child
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 105 ((attributed_statement) (interface_declaration_statement))
+(puthash
+ 105
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attributed-statement
+ ast-child-type
+ interface
+ child
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 106 ((attributed_statement) (enum_declaration_statement))
+(puthash
+ 106
+ (lambda(args _terminals)
+   `(
+ ast-type
+ attributed-statement
+ ast-child-type
+ enum
+ child
+ ,args
+ ))
+ phps-mode-parser--table-translations)
 
 ;; 111 top_statement -> (T_NAMESPACE namespace_declaration_name ";")
 (puthash



[elpa] externals/phps-mode f4be94ccfc 094/135: Passing bookkeeping test for class properties inside conditional expression

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit f4be94ccfcc09d9aa7fbf4101d18dc03ba909c08
Author: Christian Johansson 
Commit: Christian Johansson 

Passing bookkeeping test for class properties inside conditional expression
---
 test/phps-mode-test-ast.el | 15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index a464055f95..acabb60f85 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -373,14 +373,19 @@
"Bookkeeping of self reference inside arrow function inside of static 
method"
'((" class myClass function myMethod id $a" ((78 80))) (" class myClass 
arrow 1 function myMethod id $b" ((106 108))) (" class myClass static id $var" 
((35 39))) ((78 80) 1) ((106 108) 1) ((131 133) 1) ((126 128) 1) ((119 123) 1) 
((35 39) 1)))
 
+  (phps-mode-test-ast--should-bookkeep
+   "property2) {\necho 'was here';\n}\n/* 
@codingStandardsIgnoreEnd */\nif (\n$argument1\n
&& $argument2\n&& $argument3\n&& $argument4\n   
 && !empty($argument1['index'])\n  [...]
+   "Bookkeeping of properties inside if condition list"
+   '((" namespace myNamespace class myClass function myMethod id $argument3" 
((180 190))) (" namespace myNamespace class myClass function myMethod id 
$argument2" ((160 170))) (" namespace myNamespace class myClass function 
myMethod id $argument1" ((140 150) (446 456))) (" namespace myNamespace class 
myClass function myMethod id $this" ((197 581))) (" namespace myNamespace class 
myClass id $property2" ((87 97))) (" namespace myNamespace class myClass id 
$property1" ((58 68))) ((180 190) 1 [...]
+
+  (phps-mode-test-ast--should-bookkeep
+   "sayHello();\n$o->sayWorld();\n$o->sayExclamationMark();\n?>"
+   "Trait classes"
+   nil)
+
   ;; TODO Add trait class bookkeping test here
   ;; TODO Add test for class properties in class construct here
 
-  ;; TODO Make this test pass
-  ;; (phps-mode-test-ast--should-bookkeep
-  ;;  "property2) {\necho 'was here';\n}\n/* 
@codingStandardsIgnoreEnd */\nif (\n$argument1\n
&& $argument2\n&& $argument3\n&& $argument4\n   
 && !empty($argument1['index']) [...]
-  ;;  "Bookkeeping of properties inside if condition list"
-  ;;  '((" namespace myNamespace class myClass id $property1" 1) ((58 68) 1) 
(" namespace myNamespace class myClass id $property2" 1) ((87 97) 1) (" 
namespace myNamespace class myClass function myMethod id $this" 1) (" namespace 
myNamespace class myClass function myMethod id $argument1" 1) ((140 150) 1) (" 
namespace myNamespace class myClass function myMethod id $argument2" 1) ((160 
170) 1) (" namespace myNamespace class myClass function myMethod id $argument3" 
1) ((180 190) 1) ((211 216 [...]
 
   (message "\n-- Ran tests for bookkeeping generation. --"))
 



[elpa] externals/phps-mode b2454f1967 058/135: Bookkeeping of static class property

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit b2454f1967ae98aead75d1087e182c1c2ef6ca84
Author: Christian Johansson 
Commit: Christian Johansson 

Bookkeeping of static class property
---
 phps-mode-parser-sdt.el | 12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index ecd0168bc7..ac5fae8afe 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -3078,7 +3078,13 @@
  (cond
   ((equal attributed-class-statement-type 'property)
(let ((property-list
-  (plist-get attributed-class-statement 'subject)))
+  (plist-get attributed-class-statement 'subject))
+ (is-static))
+ (when-let (property-modifiers
+(plist-get attributed-class-statement 'modifiers))
+   (dolist (modifier property-modifiers)
+ (when (equal modifier 'static)
+   (setq is-static t
  (dolist (property property-list)
(let ((property-type
   (plist-get property 'ast-type)))
@@ -3092,6 +3098,8 @@
   (plist-get property 'ast-end))
  (symbol-scope
   phps-mode-parser-sdt--bookkeeping-namespace))
+ (when is-static
+   (push (list 'static) symbol-scope))
  (push
   (list
symbol-name
@@ -3419,7 +3427,7 @@
 (puthash 324 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
 
 ;; 325 ((variable_modifiers) (T_VAR))
-(puthash 325 (lambda(_args _terminals) 'public) 
phps-mode-parser--table-translations)
+(puthash 325 (lambda(_args _terminals) '(public)) 
phps-mode-parser--table-translations)
 
 ;; 326 ((method_modifiers) (%empty))
 (puthash 326 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)



[elpa] externals/phps-mode 7fa721a85d 060/135: More work on bookkeeping static class properties

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 7fa721a85ddb9eefa5db9c89f3cab3dcd7ace3d5
Author: Christian Johansson 
Commit: Christian Johansson 

More work on bookkeeping static class properties
---
 phps-mode-parser-sdt.el | 37 -
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index ac5fae8afe..8590d2e446 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -643,6 +643,18 @@
(t
 ;; TODO Do something here
 
+   ((equal space-type 'static-member)
+(let ((downcased-space-name
+   (downcase space-name)))
+  (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 'static)
 (setq is-static-p t))
 (if (gethash
@@ -5652,7 +5664,30 @@
 ;; 512 ((variable) (static_member))
 (puthash
  512
- (lambda(args _terminals)
+ (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



[elpa] externals/phps-mode 1a1245f186 082/135: Passing bookkeeping test isset and empty variables

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 1a1245f18695b571ad5b44cb740932e9a8abdcdf
Author: Christian Johansson 
Commit: Christian Johansson 

Passing bookkeeping test isset and empty variables
---
 phps-mode-parser-sdt.el| 60 ++
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 46 insertions(+), 16 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 8537608f76..bf35794061 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -768,14 +768,6 @@
 ;; (message "potential-uris: %S" potential-uris)
 ))
 
- ;; 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)
 
@@ -842,7 +834,6 @@
 
   (when phps-mode-parser-sdt--bookkeeping-symbol-stack
 ;; Bookkeeping hit / misses of symbol references here
-;; TODO Should consider declaration position as well?
 (dolist (
  symbol-list
  phps-mode-parser-sdt--bookkeeping-symbol-stack)
@@ -867,7 +858,15 @@
  ((gethash
symbol-uri
phps-mode-parser-sdt-bookkeeping)
-  (setq symbol-hit 1)))
+  (let ((matching-symbols
+ (gethash
+  symbol-uri
+  phps-mode-parser-sdt-bookkeeping)))
+(dolist (matching-symbol matching-symbols)
+  (let ((matching-symbol-start (car matching-symbol))
+(matching-symbol-end (car (cdr matching-symbol
+(when (<= matching-symbol-start symbol-start)
+  (setq symbol-hit 1)))
 
 (puthash
  (list
@@ -3428,7 +3427,6 @@
   (plist-get property 'ast-type)))
  (cond
   ((equal property-type 'property-variable)
-   ;; TODO Bookkeep proerty-variable here
(let ((symbol-name
   (plist-get property 'variable))
  (symbol-start
@@ -3929,7 +3927,6 @@
 (puthash
  358
  (lambda(args _terminals)
-   ;; TODO Declare array-pair-list assignments here
(let ((array-pair-list (nth 1 args)))
  (dolist (array-item array-pair-list)
(let ((array-item-type (plist-get array-item 'ast-type)))
@@ -6715,17 +6712,50 @@
 ;; 561 ((internal_functions_in_yacc) (T_ISSET "(" isset_variables 
possible_comma ")"))
 (puthash
  561
- (lambda(args _terminals)
+ (lambda(args terminals)
+   (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+ (let ((isset-start (car (cdr (nth 1 terminals
+   (isset-end (cdr (cdr (nth 4 terminals)
+   (dolist (item phps-mode-parser-sdt--bookkeeping-symbol-stack)
+ (let ((item-start (nth 2 item))
+   (item-end (nth 3 item)))
+   (when (and
+  (> item-start isset-start)
+  (< item-end isset-end))
+ (push
+  (list
+   (nth 0 item)
+   phps-mode-parser-sdt--bookkeeping-namespace
+   item-start
+   item-end)
+ phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
`(
  ast-type
  internal-isset
+ isset-variables
  ,(nth 2 args)))
  phps-mode-parser--table-translations)
 
 ;; 562 ((internal_functions_in_yacc) (T_EMPTY "(" expr ")"))
 (puthash
  562
- (lambda(args _terminals)
+ (lambda(args terminals)
+   (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+ (let ((empty-start (car (cdr (nth 1 terminals
+   (empty-end (cdr (cdr (nth 3 terminals)
+   (dolist (item phps-mode-parser-sdt--bookkeeping-symbol-stack)
+ (let ((item-start (nth 2 item))
+   (item-end (nth 3 item)))
+   (when (and
+  (> item-start empty-start)
+  (< item-end empty-end))
+ (push
+  (list
+   (nth 0 item)
+   phps-mode-parser-sdt--bookkeeping-namespace
+   item-start
+   item-end)
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
`(
  ast-type
  internal-empty-expr
@@ -6806,7 +6836,7 @@
 (puthash
  570
  (lambda(args _terminals)
-   (list args))
+   args)
  phps-mode-parser--table-translations)
 
 (provide 'phps-mode-parser-sdt)
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 51c7758fd9..4930dacd01 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -296,7 +296,7 @@
   (phps-mode-test-ast--should-bookkeep
"

[elpa] externals/phps-mode d33625bb1a 067/135: Bookkeeping for array assignment passing test

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit d33625bb1af15cc059cb4e05cb9f04565b6d82f9
Author: Christian Johansson 
Commit: Christian Johansson 

Bookkeeping for array assignment passing test
---
 phps-mode-parser-sdt.el| 62 ++
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 41 insertions(+), 23 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index a2bd37905b..9d4866167a 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -3829,6 +3829,39 @@
 (puthash
  358
  (lambda(args _terminals)
+   ;; TODO Declare array-pair-list assignments here
+   (let ((array-pair-list (nth 1 args)))
+ (dolist (array-item array-pair-list)
+   (let ((array-item-type (plist-get array-item 'ast-type)))
+ (cond
+  ((equal array-item-type 'array-pair-expr)
+   (let* ((array-item-expr (plist-get array-item 'expr))
+  (array-item-expr-type (plist-get array-item-expr 'ast-type)))
+ (cond
+  ((equal array-item-expr-type 'expr-variable)
+   (let* ((expr-variable (plist-get array-item-expr 'variable))
+  (expr-variable-type (plist-get expr-variable 'ast-type)))
+ (cond
+  ((equal expr-variable-type 'variable-callable-variable)
+   (let* ((callable-variable (plist-get expr-variable 
'callable-variable))
+  (callable-variable-type (plist-get callable-variable 
'ast-type)))
+ (cond
+  ((equal callable-variable-type 
'callable-variable-simple-variable)
+   (let* ((callable-simple-variable
+   (plist-get callable-variable 'simple-variable))
+  (variable-name
+   (plist-get callable-simple-variable 'variable))
+  (variable-start
+   (plist-get callable-simple-variable 'ast-start))
+  (variable-end
+   (plist-get callable-simple-variable 'ast-end)))
+ (push
+  (list
+   variable-name
+   phps-mode-parser-sdt--bookkeeping-namespace
+   variable-start
+   variable-end)
+  
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
`(
  ast-type
  expr-list
@@ -6215,52 +6248,37 @@
 (puthash
  533
  (lambda(args _terminals)
-   `(
- ast-type
- array-pair-list-non-empty
- non-empty-array-pair-list
- ,args))
+   args)
  phps-mode-parser--table-translations)
 
 ;; 534 ((possible_array_pair) (%empty))
 (puthash
  534
  (lambda(args _terminals)
-   `(
- ast-type
- possible-array-pair-empty))
+   nil)
  phps-mode-parser--table-translations)
 
 ;; 535 ((possible_array_pair) (array_pair))
 (puthash
  535
  (lambda(args _terminals)
-   `(
- ast-type
- possible-array-pair-not-empty
- array-pair
- ,args))
+   args)
  phps-mode-parser--table-translations)
 
 ;; 536 ((non_empty_array_pair_list) (non_empty_array_pair_list "," 
possible_array_pair))
 (puthash
  536
  (lambda(args _terminals)
-   `(
- ast-type
- non-empty-array-pair-list
- ,(append (nth 0 args) (list (nth 2 args)
+   (if (nth 2 args)
+   (append (nth 0 args) (list (nth 2 args)))
+ (nth 0 args)))
  phps-mode-parser--table-translations)
 
 ;; 537 ((non_empty_array_pair_list) (possible_array_pair))
 (puthash
  537
  (lambda(args _terminals)
-   `(
- ast-type
- non-empty-array-pair-list
- possible-array-pair
- ,args))
+   (list args))
  phps-mode-parser--table-translations)
 
 ;; 538 ((array_pair) (expr T_DOUBLE_ARROW expr))
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index b6485e2ecc..15621b146a 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -271,7 +271,7 @@
   (phps-mode-test-ast--should-bookkeep
"

[elpa] externals/phps-mode 177b00f06a 132/135: Updated copyright years

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 177b00f06af8db9b8c5967fbe664327f05743c2f
Author: christian 
Commit: christian 

Updated copyright years
---
 admin/phps-mode-automation.el| 2 +-
 phps-mode-ast.el | 2 +-
 phps-mode-automation-grammar.el  | 4 ++--
 phps-mode-automation-parser-generator.el | 2 +-
 phps-mode-cache.el   | 2 +-
 phps-mode-flymake.el | 2 +-
 phps-mode-indent.el  | 2 +-
 phps-mode-lex-analyzer.el| 2 +-
 phps-mode-lexer.el   | 2 +-
 phps-mode-macros.el  | 2 +-
 phps-mode-parser-sdt.el  | 2 +-
 phps-mode-parser.el  | 2 +-
 phps-mode-serial.el  | 2 +-
 phps-mode-syntax-color.el| 2 +-
 phps-mode-syntax-table.el| 2 +-
 phps-mode-test.el| 2 +-
 phps-mode.el | 2 +-
 test/phps-mode-test-ast.el   | 2 +-
 test/phps-mode-test-cache.el | 2 +-
 test/phps-mode-test-indent.el| 2 +-
 test/phps-mode-test-integration.el   | 2 +-
 test/phps-mode-test-lex-analyzer.el  | 2 +-
 test/phps-mode-test-lexer.el | 2 +-
 test/phps-mode-test-parser.el| 2 +-
 test/phps-mode-test-syntax-table.el  | 2 +-
 25 files changed, 26 insertions(+), 26 deletions(-)

diff --git a/admin/phps-mode-automation.el b/admin/phps-mode-automation.el
index a95cb0f0bb..c2acc1fedc 100644
--- a/admin/phps-mode-automation.el
+++ b/admin/phps-mode-automation.el
@@ -1,6 +1,6 @@
 ;;; phps-mode-automation --- Generate a parser file -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023  Free Software Foundation, Inc.
 
 
 ;;; Commentary:
diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 1e5e09fcb1..1be9a1c49a 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -1,6 +1,6 @@
 ;;; phps-mode-ast.el --- Abstract Syntax Tree functions -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023  Free Software Foundation, Inc.
 
 
 ;;; Commentary:
diff --git a/phps-mode-automation-grammar.el b/phps-mode-automation-grammar.el
index ebb37e4f81..57c26b1c2f 100644
--- a/phps-mode-automation-grammar.el
+++ b/phps-mode-automation-grammar.el
@@ -1,6 +1,6 @@
 ;;; phps-mode-automation-grammar --- Grammar -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023  Free Software Foundation, Inc.
 
 
 ;;; Commentary:
@@ -33,7 +33,7 @@
 
 (defvar
   phps-mode-automation-grammar--copyright
-  ";; Copyright (C) 2018-2022  Free Software Foundation, Inc.\n\n;; This file 
is not part of GNU Emacs.\n\n\n"
+  ";; Copyright (C) 2018-2023  Free Software Foundation, Inc.\n\n;; This file 
is not part of GNU Emacs.\n\n\n"
   "Copyright contents for parser.")
 
 (defvar
diff --git a/phps-mode-automation-parser-generator.el 
b/phps-mode-automation-parser-generator.el
index 1cbbff0e22..b4969f3602 100644
--- a/phps-mode-automation-parser-generator.el
+++ b/phps-mode-automation-parser-generator.el
@@ -1,6 +1,6 @@
 ;;; phps-mode-automation-parser-generator --- Generate a parser for PHP YACC 
grammar -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023  Free Software Foundation, Inc.
 
 
 ;;; Commentary:
diff --git a/phps-mode-cache.el b/phps-mode-cache.el
index a773fec83a..2e08a6f397 100644
--- a/phps-mode-cache.el
+++ b/phps-mode-cache.el
@@ -1,6 +1,6 @@
 ;;; phps-mode-cache.el -- Cache for phps-mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023  Free Software Foundation, Inc.
 
 
 ;;; Commentary:
diff --git a/phps-mode-flymake.el b/phps-mode-flymake.el
index 4e244b09b0..12ab3acd6c 100644
--- a/phps-mode-flymake.el
+++ b/phps-mode-flymake.el
@@ -1,6 +1,6 @@
 ;;; phps-mode-flymake.el --- Flymake support for PHPs -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023  Free Software Foundation, Inc.
 
 
 ;;; Commentary:
diff --git a/phps-mode-indent.el b/phps-mode-indent.el
index aad359f5b3..665cc9387b 100644
--- a/phps-mode-indent.el
+++ b/phps-mode-indent.el
@@ -1,6 +1,6 @@
 ;;; phps-mode-indent.el -- Indentation for phps-mode -*- lexical-binding: t -*-
 
-;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023  Free Software Foundation, Inc.
 
 
 
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 802c1c1cd1..737265a5c5 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -1,6 +1,6 @@
 ;;; phps-mode-lex-analyzer.el -- Lex analyzer for PHPs -*- lexical-binding: t 
-*-
 
-;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
+;; Copyright (C) 2018-2023  Free Software Fou

[elpa] externals/phps-mode e1752a3aa3 064/135: Bookkeeping of variables inside simple anonymous functions

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit e1752a3aa38d9295e20b33530855f8e35d31e6d8
Author: Christian Johansson 
Commit: Christian Johansson 

Bookkeeping of variables inside simple anonymous functions
---
 phps-mode-parser-sdt.el| 304 +
 test/phps-mode-test-ast.el |   4 +-
 2 files changed, 174 insertions(+), 134 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index c55bd4094d..a626eb02a5 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -3189,53 +3189,54 @@
(dolist (method-modifier method-modifiers)
  (when (equal method-modifier 'static)
(setq is-static-p t
- (unless is-static-p
-   (push
-(list
- "$this"
- phps-mode-parser-sdt--bookkeeping-namespace
- (plist-get attributed-class-statement 'ast-start)
- (plist-get attributed-class-statement 'ast-end))
-phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
- (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
-   (dolist (
-symbol-list
-phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
- (let ((symbol-name (car symbol-list))
-   (symbol-start (nth 2 symbol-list)))
-   (unless (or
-(gethash
- symbol-name
- 
phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
-(< symbol-start function-start)
-(> symbol-start function-end))
- (let ((symbol-scope (car (cdr symbol-list
-   (push
-(list 'function function-name)
-symbol-scope)
-   (setcar
-(cdr symbol-list)
-symbol-scope))
- (when phps-mode-parser-sdt--bookkeeping-symbol-stack
-   (dolist (
-symbol-list
-phps-mode-parser-sdt--bookkeeping-symbol-stack)
- (let ((symbol-name (nth 0 symbol-list))
-   (symbol-namespace (nth 1 symbol-list))
-   (symbol-start (nth 2 symbol-list)))
-   (unless (or
-(gethash
- symbol-name
- 
phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
-(< symbol-start function-start)
-(> symbol-start function-end))
- (let ((symbol-scope (car (cdr symbol-list
-   (push
-(list 'function function-name)
-symbol-scope)
-   (setcar
-(cdr symbol-list)
-symbol-scope))
+ (when (and function-start function-end)
+   (unless is-static-p
+ (push
+  (list
+   "$this"
+   phps-mode-parser-sdt--bookkeeping-namespace
+   (plist-get attributed-class-statement 'ast-start)
+   (plist-get attributed-class-statement 'ast-end))
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
+   (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
+ (dolist (
+  symbol-list
+  
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+   (let ((symbol-name (car symbol-list))
+ (symbol-start (nth 2 symbol-list)))
+ (unless (or
+  (gethash
+   symbol-name
+   
phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+  (< symbol-start function-start)
+  (> symbol-start function-end))
+   (let ((symbol-scope (car (cdr symbol-list
+ (push
+  (list 'function function-name)
+  symbol-scope)
+ (setcar
+  (cdr symbol-list)
+  symbol-scope))
+   (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+ (dolist (
+  symbol-list
+  phps-mode-parser-sdt--bookkeeping-symbol-stack)
+   (let ((symbol-name (nth 0 symbol-list))
+ (symbol-namespace (nth 1 symbol-list))
+ (symbol-start (nth 2 symbol-list)))
+ (unless (or
+  (gethash
+   symbol-name
+   
phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+  (< symbol-start function-start)
+  (> symbol-start function-end))
+   (let ((symbol-scope (car (cdr symbol-list
+ 

[elpa] externals/phps-mode 0bf9b31fef 062/135: Passed bookkeeping via SDT for try catch variables

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 0bf9b31fefe7443dbbd808512f67c296244c1578
Author: Christian Johansson 
Commit: Christian Johansson 

Passed bookkeeping via SDT for try catch variables
---
 phps-mode-ast.el   |  3 +++
 phps-mode-parser-sdt.el| 29 -
 test/phps-mode-test-ast.el |  2 +-
 3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 5483c9bb1d..0e392b127e 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -36,6 +36,9 @@
   (setq
phps-mode-parser-sdt--bookkeeping-namespace
nil)
+  (setq
+   phps-mode-parser-sdt--bookkeeping-namespace-stack
+   nil)
   (setq
phps-mode-parser-sdt--bookkeeping-symbol-stack
nil)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 6c7fb4b525..139c340665 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1836,20 +1836,39 @@
 (puthash
  169
  (lambda(args terminals)
+   (let ((optional-variable (nth 4 args))
+ (optional-variable-start)
+ (optional-variable-end))
+ (when optional-variable
+   (setq optional-variable-start (car (cdr (nth 4 terminals
+   (setq optional-variable-end (cdr (cdr (nth 4 terminals
+   (push
+(list
+ optional-variable
+ phps-mode-parser-sdt--bookkeeping-namespace
+ optional-variable-start
+ optional-variable-end)
+phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+   (push
+(list
+ optional-variable
+ phps-mode-parser-sdt--bookkeeping-namespace
+ optional-variable-start
+ optional-variable-end)
+phps-mode-parser-sdt--bookkeeping-symbol-stack))
`(
  ast-type
  catch-list
  catch-name-list
  ,(nth 3 args)
  optional-variable
- ,(nth 4 args)
+ ,optional-variable
  optional-variable-start
- ,(car (cdr (nth 4 terminals)))
+ ,optional-variable-start
  optional-variable-end
- ,(cdr (cdr (nth 4 terminals)))
+ ,optional-variable-end
  inner-statement-list
- ,(nth 7 args)
- ))
+ ,(nth 7 args
  phps-mode-parser--table-translations)
 
 ;; 170 ((catch_name_list) (class_name))
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index ce995c6c02..4d79c3153c 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -251,7 +251,7 @@
   (phps-mode-test-ast--should-bookkeep
"

[elpa] externals/phps-mode eac10d63e6 063/135: Started on bookkeeping of variables inside anonymous functions

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit eac10d63e61655c51fad3800156ec45324b2b12f
Author: Christian Johansson 
Commit: Christian Johansson 

Started on bookkeeping of variables inside anonymous functions
---
 phps-mode-ast.el|  3 ++
 phps-mode-parser-sdt.el | 95 +++--
 2 files changed, 96 insertions(+), 2 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 0e392b127e..3dc1816187 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -42,6 +42,9 @@
   (setq
phps-mode-parser-sdt--bookkeeping-symbol-stack
nil)
+  (setq
+   phps-mode-parser-sdt--bookkeeping-anonymous-function-count
+   0)
   (let* ((result (phps-mode-parser--parse t))
  (parse-trail (nth 0 result))
  (translation (nth 1 result))
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 139c340665..c55bd4094d 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -611,6 +611,11 @@
   nil
   "Current bookkeeping assignment symbol stack.")
 
+(defvar-local
+  phps-mode-parser-sdt--bookkeeping-anonymous-function-count
+  nil
+  "Count of anonymous functions.")
+
 (defvar
   phps-mode-parser-sdt--bookkeeping--superglobal-variable-p
   #s(hash-table size 12 test equal rehash-size 1.5 rehash-threshold 0.8125 
data ("$_GET" 1 "$_POST" 1 "$_COOKIE" 1 "$_SESSION" 1 "$_REQUEST" 1 "$GLOBALS" 
1 "$_SERVER" 1 "$_FILES" 1 "$_ENV" 1 "$argc" 1 "$argv" 1 
"$http_​response_​header" 1))
@@ -623,7 +628,8 @@
 (interface)
 (trait)
 (function)
-(is-static-p))
+(is-static-p)
+(anonymous-function))
 (when scope
   (dolist (item scope)
 (let ((space-type (car item))
@@ -639,6 +645,8 @@
 (setq trait space-name))
((equal space-type 'function)
 (setq function space-name))
+   ((equal space-type 'anonymous-function)
+(setq anonymous-function space-name))
((equal space-type 'object-operator)
 (let ((downcased-space-name
(downcase space-name)))
@@ -670,6 +678,13 @@
  (format
   " id %s"
   name)))
+(when anonymous-function
+  (setq
+   new-symbol-name
+   (format
+" anonymous function%s%s"
+anonymous-function
+new-symbol-name)))
 (when is-static-p
   (setq
new-symbol-name
@@ -4867,7 +4882,83 @@
 ;; 439 ((inline_function) (function returns_ref backup_doc_comment "(" 
parameter_list ")" lexical_vars return_type backup_fn_flags "{" 
inner_statement_list "}" backup_fn_flags))
 (puthash
  439
- (lambda(args _terminals)
+ (lambda(args terminals)
+   (message "439: %S" phps-mode-parser-sdt--bookkeeping-symbol-stack)
+   (message "args: %S" args)
+   (let ((function-start
+  (cdr (cdr (nth 9 terminals
+ (function-end
+  (car (cdr (nth 11 terminals)
+ (let ((namespace phps-mode-parser-sdt--bookkeeping-namespace)
+   (parameter-list (nth 4 args))
+   (lexical-vars (nth 6 args)))
+   (setq
+phps-mode-parser-sdt--bookkeeping-anonymous-function-count
+(1+ phps-mode-parser-sdt--bookkeeping-anonymous-function-count))
+   (push
+(list
+ 'anonymous-function
+ phps-mode-parser-sdt--bookkeeping-anonymous-function-count)
+namespace)
+
+   ;; Go through parameters and assign variables inside function
+   (when parameter-list
+ (dolist (parameter parameter-list)
+   (let ((parameter-type
+  (plist-get
+   parameter
+   'ast-type)))
+ (cond
+  ((equal parameter-type 'attributed-parameter)
+   (let* ((attributed-parameter
+   (plist-get parameter 'parameter))
+  (parameter-name
+   (plist-get attributed-parameter 'ast-name))
+  (parameter-start
+   (plist-get attributed-parameter 'ast-start))
+  (parameter-end
+   (plist-get attributed-parameter 'ast-end)))
+ (push
+  (list
+   parameter-name
+   namespace
+   parameter-start
+   parameter-end)
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+ (push
+  (list
+   parameter-name
+   namespace
+   parameter-start
+   parameter-end)
+  phps-mode-parser-sdt--bookkeeping-symbol-stack)))
+
+   ;; TODO Go through lexical_vars and assign inside function
+
+   ;; Go through phps-mode-parser-sdt--bookkeeping-symbol-stack in scope 
and add namespace
+   (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+ (dolist (
+  symbol-list
+

[elpa] externals/phps-mode 6944154fd3 125/135: Imenu via SDT passing some more tests

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 6944154fd3ffb5da503bf6a0a427d9dbda4d3ed5
Author: christian 
Commit: christian 

Imenu via SDT passing some more tests
---
 phps-mode-ast.el   |  6 +++---
 test/phps-mode-test-ast.el | 42 +-
 2 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index fb60a01009..8ade386522 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -116,7 +116,7 @@
(< (cdr a) (cdr (car (car (cdr b))
   (t
(< (cdr a) (cdr b)))
- (push `(declaration . ,v3-index) v3-list)
+ (push `("declaration" . ,v3-index) v3-list)
  (push `(,k3 ,v3-list) v2-list))
  (if (symbolp k3)
  (setq v2-index v3))
@@ -140,7 +140,7 @@
   (< (cdr a) (cdr (car (car (cdr b))
  (t
   (< (cdr a) (cdr b)))
-(push `(declaration . ,v2-index) v2-list)
+(push `("declaration" . ,v2-index) v2-list)
 (push `(,k2 ,v2-list) v-list))
 (if (symbolp k2)
 (setq v-index v2)
@@ -164,7 +164,7 @@
  (< (cdr a) (cdr (car (car (cdr b))
 (t
  (< (cdr a) (cdr b)))
-   (push `(declaration . ,v-index) v-list)
+   (push `("declaration" . ,v-index) v-list)
(push `(,k ,v-list) imenu-index))
(push `(,k . ,v) imenu-index)))
phps-mode-parser-sdt-symbol-imenu--table)
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 45c23bf027..c1fbc64588 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -151,7 +151,7 @@
" $value) {\nif ($key || $value) {\necho 'Hit';\n  
  }\n}\nfor ($i = 0; $i < count($items); $i++) {\nif ($i) {\necho 
'Hit';\n}\n}\nif ($a = 123) {\nif ($a) {\necho 'Hit';\n
}\n}\nwhile ($b = 123) {\nif ($a) {\necho 'Hit';\n}\n}\ndo {\n  
  echo 'Hit';\n} while ( [...]
@@ -174,49 +174,49 @@
"var1) {\necho 
'Hit';\n}\nif (self::$var1) {\necho 'Miss';\n   
 }\nif (self::$var2) {\necho 'Hit';\n}\nif 
(static::$var2) {\n [...]
"Bookkeeping of class properties"
'(((93 98) 1) ((127 132) 2) ((145 150) 3) ((160 165) 4) ((208 213) 5) ((263 
268) 5) ((270 274) 1) ((330 335) 0) ((392 397) 2) ((455 460) 2) ((510 515) 5) 
((517 521) 3) ((571 576) 5) ((578 582) 4) ((632 637) 5) ((639 643) 0) ((751 
756) 0))
-   '(("class myClass" . 54) ("class myClass function __construct" . 194) 
("class myClass function __construct id $this" . 194) ("class myClass id $var4" 
. 160) ("class myClass id $var3" . 145) ("class myClass static id $var2" . 127) 
("class myClass id $var1" . 93)))
+   '(("class myParent" (("declaration" . 35))) ("class myClass" 
(("declaration" . 54) ("$var1" . 93) ("$var2" . 127) ("$var3" . 145) ("$var4" . 
160) ("function __construct" (("declaration" . 194) ("$this" . 194) 
(declaration . 194)))
 
   (phps-mode-test-ast--should-bookkeep
"random();\n$this->random['abc'] = 
123;\n}\n}"
+   "random();\n$this->random['abc'] = 
123;\n}\n}"
"Method calls should be avoided in bookkeeping"
-   '(((121 127) 0) ((114 119) 3) ((89 94) 3))
-   '(("class myClass" . 13) ("class myClass function __construct" . 79) 
("class myClass function __construct id $this" . 79)))
+   '(((95 100) 1) ((120 125) 1) ((127 133) 0))
+   '(("class myClass" (("declaration" . 19) ("function __construct" 
(("declaration" . 85) ("$this" . 85) (declaration . 85)))
 
   (phps-mode-test-ast--should-bookkeep
" &$item2) 
{\nif ($item) {\necho 'Hit';\n}\n}"
"Bookkeeping of foreach reference variable declaration"
-   '(((7 13) 1) ((69 74) 2) ((52 57) 2) ((41 47) 1) ((152 157) 2) ((134 140) 
3) ((125 129) 4) ((115 121) 1))
-   '(("id $items" . 7) ("id $item" . 52) ("id $item2" . 134) ("id $key" . 
125)))
+   '(((7 13) 1) ((41 47) 1) ((52 57) 2) ((69 74) 2) ((115 121) 1) ((125 129) 
3) ((134 140) 4) ((152 157) 2))
+   '(("$items" . 7) ("$item" . 52) ("$key" . 125) ("$item2" . 134)))
 
   (phps-mode-test-ast--should-bookkeep
" $x + $y;\n$z = 1;\n$fn = fn($x2) => 
fn($y2) => $x2 * $y2 + $z;\nfn(array $x3) => $x3;\n$x4 = 4;\nstatic fn(): int 
=> $x4;\nfn($x5 = 42) => $x5;\nfn(&$x6) => $x6;\nfn&($x7) => $x7;\nfn($x8, 
...$rest) => $rest;"
"Bookkeeping in arrow functions"
-   '(((7 9) 1) ((25 27) 3) ((37 39) 1) ((32 34) 3) ((15 19) 2) ((41 43) 4) 
((58 61) 6) ((69 72) 7) ((89 91) 4) ((83 86) 7) ((77 80) 6) ((49 52) 5) ((102 
105) 8) 

[elpa] externals/phps-mode ada5e79291 097/135: Passing bookkeeping test for class properties in class constructor

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit ada5e79291a73aea54915076a4e7faddf2bf6e38
Author: Christian Johansson 
Commit: Christian Johansson 

Passing bookkeeping test for class properties in class constructor
---
 phps-mode-parser-sdt.el| 57 +++---
 test/phps-mode-test-ast.el |  3 +--
 2 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 636d9aefe1..9debeadd39 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -780,7 +780,7 @@
   (let ((potential-uri-count (length potential-uris))
 (potential-uri-index 0)
 (matching-uri))
-(message "potential-uris: %S" potential-uris)
+;; (message "potential-uris: %S" potential-uris)
 
 ;; Iterate potential-uris, select first match or if no match return 
the first
 (while (< potential-uri-index potential-uri-count)
@@ -815,13 +815,13 @@
symbol-name
symbol-scope)))
 
-(message
- "assign symbol uri: %S from %S + %S, start: %S, end: %S"
- symbol-uri
- symbol-name
- symbol-scope
- symbol-start
- symbol-end)
+;; (message
+;;  "assign symbol uri: %S from %S + %S, start: %S, end: %S"
+;;  symbol-uri
+;;  symbol-name
+;;  symbol-scope
+;;  symbol-start
+;;  symbol-end)
 
 (if (gethash symbol-uri phps-mode-parser-sdt-bookkeeping)
 (puthash
@@ -884,14 +884,14 @@
  symbol-hit
  phps-mode-parser-sdt-bookkeeping)
 
-(message
- "reference symbol uri: %S from %S + %S, start: %S, end: %S, hit?: %S"
- symbol-uri
- symbol-name
- symbol-scope
- symbol-start
- symbol-end
- symbol-hit)
+;; (message
+;;  "reference symbol uri: %S from %S + %S, start: %S, end: %S, hit?: 
%S"
+;;  symbol-uri
+;;  symbol-name
+;;  symbol-scope
+;;  symbol-start
+;;  symbol-end
+;;  symbol-hit)
 
 ))
 (setq
@@ -3445,10 +3445,12 @@
;; - add function scope but only for:
;; - non-super-global variables
;; - symbols defined inside function limits
-   (let ((function-name
+   (let* ((function-name
   (plist-get
attributed-class-statement
'ast-name))
+  (function-name-downcased
+   (downcase function-name))
  (function-start
   (plist-get
attributed-class-statement
@@ -3461,7 +3463,11 @@
   (plist-get
attributed-class-statement
'parameter-list))
- (is-static-p))
+ (is-static-p)
+ (is-contructor-p
+  (string=
+   function-name-downcased
+   "__construct")))
 
  ;; Is static method?
  (when-let (method-modifiers
@@ -3540,12 +3546,27 @@
   'parameter))
 (attributed-parameter-name
  (plist-get attributed-parameter 'ast-name))
+(attributed-parameter-visibility
+ (plist-get attributed-parameter 'visibility))
 (symbol-name
  attributed-parameter-name)
 (symbol-start
  (plist-get attributed-parameter 'ast-start))
 (symbol-end
  (plist-get attributed-parameter 'ast-end)))
+
+   (when (and
+  is-contructor-p
+  attributed-parameter-visibility)
+ ;; Declare class properties here
+ (push
+  (list
+   symbol-name
+   phps-mode-parser-sdt--bookkeeping-namespace
+   symbol-start
+   symbol-end)
+  
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
+
(push
 (list
  symbol-name
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index be42e58ddd..98a7fa7ccf 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -383,11 +383,10 @@
"A basic trait class"
'((" trait MyTrait function sayHello id $this" ((80 147))) (" trait MyTrait 
id $var" ((35 39))) ((101 104) 1) ((94 99) 1) ((35 39) 1)))
 
-  ;; TODO Make this test pass
   (phps-mode-test-ast--should-bookkeep
"

[elpa] externals/phps-mode fb9a181135 088/135: Passed more bookkeeping tsts

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit fb9a181135d3f0feca34573ff703a435db6f8965
Author: Christian Johansson 
Commit: Christian Johansson 

Passed more bookkeeping tsts
---
 phps-mode-ast.el   |  3 ---
 phps-mode-parser-sdt.el|  7 +--
 test/phps-mode-test-ast.el | 10 --
 3 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 51df54f4e7..46d7f9a130 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -36,9 +36,6 @@
   (setq
phps-mode-parser-sdt--bookkeeping-namespace
nil)
-  (setq
-   phps-mode-parser-sdt--bookkeeping-namespace-stack
-   nil)
   (setq
phps-mode-parser-sdt--bookkeeping-symbol-stack
nil)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 991e3068ba..3382481f34 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -596,11 +596,6 @@
   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
@@ -3923,7 +3918,7 @@
  class-name
  ,(nth 1 args)
  ctor-arguments
- ,(n 2 args)
+ ,(nth 2 args)
  ))
  phps-mode-parser--table-translations)
 
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 840add33be..80e901d542 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -343,27 +343,25 @@
"Bookkeeping of static variables in different scopes without namespaces"
'((" id $a" ((15 17))) ((15 17) 1) ((24 26) 1) (" function test id $a" ((61 
63))) ((73 75) 1) ((61 63) 1) (" class There function here id $this" ((121 
166))) (" class There function here id $a" ((138 140))) ((154 156) 1) ((138 
140) 1)))
 
-  ;; TODO WAS HERE
-
   (phps-mode-test-ast--should-bookkeep
"variable) {}\n  
  if ($this->variable2) {}\nif ($this->variable3) {}\nif 
($this->variable4) {}\nif (self::$variable4) {}\nif 
(self::$variable5) {}\nif (self::$varia [...]
"Bookkeeping of typed class variables"
-   '((" class There id $variable" 1) ((33 42) 1) (" class There id $variable2" 
1) ((67 77) 1) (" class There id $variable3" 1) ((98 108) 1) (" class There 
static id $variable4" 1) ((129 139) 1) (" class There static id $variable5" 1) 
((171 181) 1) (" class There static id $variable6" 1) ((209 219) 1) (" class 
There function here id $this" 1) ((259 264) 1) ((266 274) 1) ((291 296) 1) 
((298 307) 1) ((324 329) 1) ((331 340) 1) ((357 362) 1) ((364 373) 0) ((396 
406) 1) ((429 439) 1) ((462 472) 1)))
+   '((" class There function here id $this" ((245 482))) (" class There static 
id $variable6" ((209 219))) (" class There static id $variable5" ((171 181))) 
(" class There static id $variable4" ((129 139))) (" class There id $variable3" 
((98 108))) (" class There id $variable2" ((67 77))) (" class There id 
$variable" ((33 42))) ((462 472) 1) ((429 439) 1) ((396 406) 1) ((364 373) 0) 
((357 362) 1) ((331 340) 1) ((324 329) 1) ((298 307) 1) ((291 296) 1) ((266 
274) 1) ((259 264) 1)))
 
   (phps-mode-test-ast--should-bookkeep
"variable) {}\n  
  if ($this->variable2) {}\nif ($this->variable3) {}\nif 
($this->variable4) {}\nif (self::$variable4) {}\nif 
(self::$variable5) {}\nif (self::$var [...]
"Bookkeeping of nullable typed class variables"
-   '((" class There id $variable" 1) ((33 42) 1) (" class There id $variable2" 
1) ((68 78) 1) (" class There id $variable3" 1) ((99 109) 1) (" class There 
static id $variable4" 1) ((130 140) 1) (" class There static id $variable5" 1) 
((172 182) 1) (" class There static id $variable6" 1) ((211 221) 1) (" class 
There function here id $this" 1) ((261 266) 1) ((268 276) 1) ((293 298) 1) 
((300 309) 1) ((326 331) 1) ((333 342) 1) ((359 364) 1) ((366 375) 0) ((398 
408) 1) ((431 441) 1) ((464 474) 1)))
+   '((" class There function here id $this" ((247 484))) (" class There static 
id $variable6" ((211 221))) (" class There static id $variable5" ((172 182))) 
(" class There static id $variable4" ((130 140))) (" class There id $variable3" 
((99 109))) (" class There id $variable2" ((68 78))) (" class There id 
$variable" ((33 42))) ((464 474) 1) ((431 441) 1) ((398 408) 1) ((366 375) 0) 
((359 364) 1) ((333 342) 1) ((326 331) 1) ((300 309) 1) ((293 298) 1) ((268 
276) 1) ((261 266) 1)))
 
   (phps-mode-test-ast--should-bookkeep
" $this->test . $d . $e;\n
}\n}\n\n$a = new myClass();\necho $a->test('def')('ghi');"



[elpa] externals/phps-mode 0654fe8899 134/135: Updated documentation

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 0654fe8899d0dc2af01a1a28b86b8555844821b2
Author: christian 
Commit: christian 

Updated documentation
---
 README.md | 5 +++--
 TODO.md   | 9 -
 2 files changed, 3 insertions(+), 11 deletions(-)

diff --git a/README.md b/README.md
index ddd7b2e09b..550df3e73a 100644
--- a/README.md
+++ b/README.md
@@ -21,14 +21,15 @@ This mode does not require PHP installed on your computer 
because it has a built
 * Incremental parser, imenu and bookkeeping generation after buffer changes
 * Supports `(comment-region)` and `(uncomment-region)`
 * Support indentation for inline-html areas
-* Imenu support
 * Minimal mode map
 * Tested using unit tests and integration tests
 * Continuous integration tests using Travis
 * Included in GNU ELPA package archive
 * Support for asynchronous lexer via processes (`async.el`) or threads
 * Mode-line asynchronous status
-* Bookkeeping in lexical-analysis, showing defined and undefined variables via 
syntax coloring (requires a theme that has distinct colors for 
'font-lock-warning-face and 'font-lock-variable-name-face)
+* Bookkeeping of symbols via syntax-directed translation, showing defined and 
undefined symbols via syntax coloring (requires a theme that has distinct 
colors for 'font-lock-warning-face and 'font-lock-variable-name-face)
+* Imenu generation via syntax-directed translation, showing namespaces, 
classes, functions, traits, interfaces and variables
+* Generation of symbol-table via syntax-directed translation
 * Canonical LR(1) Parser automatically generated from official PHP 8.1 LALR(1) 
YACC grammar
 
 ## Issues and roadmap
diff --git a/TODO.md b/TODO.md
index 2f386a6528..6b170c4897 100644
--- a/TODO.md
+++ b/TODO.md
@@ -2,11 +2,6 @@
 
 ## Parser
 
-* Parsing code like
-
-$totalPrice =
-0.;
-
 ## Indentation
 
 'language' =>
@@ -31,10 +26,6 @@
 ## Code intelligence
 
 * Bookkeeping of chained object operators like WC()->cart->subtotal
-* Bookkeeping of variables inside classes with multiple methods seems to not 
work
-* Bookkeeping of class properties inside condition lists
-* Imenu-generation of conditionally defined functions and classes
-* Integrate imenu-generation into bookkeeping generation
 
 ## Other
 



[elpa] externals/phps-mode e2f2c86e18 059/135: Improved class properties bookkeeping test

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit e2f2c86e188e794e408d58f43cf40a26804bd3dc
Author: Christian Johansson 
Commit: Christian Johansson 

Improved class properties bookkeeping test
---
 test/phps-mode-test-ast.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 43e9099371..76c8e92bee 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -244,7 +244,7 @@
'((" id $items" ((36 42))) ((36 42) 1) (" id $item" ((80 85))) ((97 102) 1) 
((80 85) 1) ((70 76) 1) (" id $value" ((161 167))) (" id $key" ((153 157))) 
((187 193) 1) ((179 183) 1) ((161 167) 1) ((153 157) 1) ((143 149) 1) (" id $i" 
((230 232))) ((274 276) 1) ((258 260) 1) ((249 255) 1) ((238 240) 1) ((230 232) 
1) (" id $a" ((312 314))) ((332 334) 1) ((312 314) 1) (" id $b" ((373 375))) 
((393 395) 1) ((373 375) 1) (" id $c" ((457 459))) ((457 459) 1)))
 
   (phps-mode-test-ast--should-bookkeep
-   "var1) {\necho 
'Hit';\n}\nif (self::$var1) {\necho 'Miss';\n   
 }\nif (self::$var2) {\necho 'Hit';\n}\nif 
($this->var3) {\n   [...]
+   "var1) {\necho 
'Hit';\n}\nif (self::$var1) {\necho 'Miss';\n   
 }\nif (self::$var2) {\necho 'Hit';\n}\nif 
(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)))
 



[elpa] externals/phps-mode d98f6d78d8 114/135: Saving symbol-table after parse

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit d98f6d78d8fa2869a38e84037d62427132ba6070
Author: Christian Johansson 
Commit: Christian Johansson 

Saving symbol-table after parse
---
 phps-mode-ast.el   |  19 +-
 phps-mode-lex-analyzer.el  |   9 +-
 phps-mode-parser-sdt.el|  18 +-
 test/phps-mode-test-ast.el | 451 ++---
 4 files changed, 258 insertions(+), 239 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 106b269c7c..6d8a2683bb 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -39,8 +39,14 @@
phps-mode-parser-sdt-symbol-table-index
0)
   (setq
-   phps-mode-parser-sdt-symbol-imenu
-   nil)
+   phps-mode-parser-sdt-symbol-imenu--classes
+   (make-hash-table :test 'equal))
+  (setq
+   phps-mode-parser-sdt-symbol-imenu--functions
+   (make-hash-table :test 'equal))
+  (setq
+   phps-mode-parser-sdt-symbol-imenu--namespaces
+   (make-hash-table :test 'equal))
   (setq
phps-mode-parser-sdt-symbol-table
(make-hash-table :test 'equal))
@@ -68,9 +74,12 @@
 
 (phps-mode-debug-message
  (message "\nTranslation:\n%S\n\n" translation))
-(setq
- phps-mode-parser-sdt-symbol-imenu
- (nreverse phps-mode-parser-sdt-symbol-imenu))
+
+;; TODO Build imenu  in `phps-mode-parser-sdt-symbol-imenu' by collecting:
+;; * `phps-mode-parser-sdt-symbol-imenu--classes'
+;; * `phps-mode-parser-sdt-symbol-imenu--functions'
+;; * `phps-mode-parser-sdt-symbol-imenu--namespaces'
+
 (setq
  phps-mode-ast--tree
  translation)
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 1f94cca127..46b07cf08e 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -65,6 +65,9 @@
 (defvar-local phps-mode-lex-analyzer--bookkeeping nil
   "Bookkeeping of all variables in tokens.")
 
+(defvar-local phps-mode-lex-analyzer--symbol-table nil
+  "Symbol-table of all symbols found in parse.")
+
 (defvar-local phps-mode-lex-analyzer--tokens nil
   "Latest tokens.")
 
@@ -260,6 +263,7 @@
(setq phps-mode-lex-analyzer--ast (nth 9 lex-result))
(setq phps-mode-lex-analyzer--bookkeeping (nth 10 lex-result))
(setq phps-mode-lex-analyzer--imenu (nth 11 lex-result))
+   (setq phps-mode-lex-analyzer--symbol-table (nth 12 lex-result))
 
(setq phps-mode-lex-analyzer--processed-buffer-p t)
(phps-mode-lex-analyzer--reset-imenu)
@@ -405,6 +409,7 @@
(setq phps-mode-lex-analyzer--ast (nth 9 lex-result))
(setq phps-mode-lex-analyzer--bookkeeping (nth 10 lex-result))
(setq phps-mode-lex-analyzer--imenu (nth 11 lex-result))
+   (setq phps-mode-lex-analyzer--symbol-table (nth 12 lex-result))
 
(phps-mode-debug-message
 (message
@@ -1235,6 +1240,7 @@
 (setq ast-tree phps-mode-ast--tree)
 (setq bookkeeping phps-mode-parser-sdt-bookkeeping)
 (setq imenu phps-mode-parser-sdt-symbol-imenu)
+(setq symbol-table phps-mode phps-mode-parser-sdt-symbol-table)
 
 (kill-buffer)))
 
@@ -1251,7 +1257,8 @@
 parse-error
 ast-tree
 bookkeeping
-imenu)))
+imenu
+symbol-table)))
 
   ;; Save cache if possible and permitted
   (when (and
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index df265fe62e..402ce7c236 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2,9 +2,6 @@
 
 ;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
 
-;; TODO 1. Should make imenu hierarchical
-;; TODO 2. Should fix bookkeeping issues in real-world example files
-;; TODO 3. (FUTURE) Fix bookkeeping in scope if-isset/!empty blocks
 
 ;;; Commentary:
 
@@ -614,6 +611,21 @@
   nil
   "Imenu for symbols of parse.")
 
+(defvar-local
+  phps-mode-parser-sdt-symbol-imenu--classes
+  nil
+  "Symbols inside class / interface / trait scope.")
+
+(defvar-local
+  phps-mode-parser-sdt-symbol-imenu--functions
+  nil
+  "Symbols inside class scope.")
+
+(defvar-local
+  phps-mode-parser-sdt-symbol-imenu--namespaces
+  nil
+  "Symbols inside namespaces.")
+
 (defvar-local
   phps-mode-parser-sdt--bookkeeping-namespace
   nil
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 316772c8da..83299d6fc6 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -124,238 +124,229 @@
 (funcall logic)
 (message "Passed test for %S\n" name)))
 
-;; (defun phps-mode-test-ast-bookkeeping ()
-;;   "Run test for bookkeeping generation."
-;;   (message "-- Running tests for bookkeeping generation... --\n")
-
-;;   (phps-mode-test-ast--should-bookkeep
-;;" $value) {\nif ($key || $value) {\n
echo 'Hit';\n}\n}\nfor ($i = 0; $i < count($items); $i++) {\nif ($i) 
{\necho 'Hit';\n}\n}\nif ($a = 123) {\nif ($a) {\necho 
'Hit';\n}\n}\nwhile ($b 

[elpa] externals/phps-mode 438ec520fc 051/135: Passing bookkeeping via SDT for conditional assignments

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 438ec520fc8167783877b20586cb5d43feeedd23
Author: Christian Johansson 
Commit: Christian Johansson 

Passing bookkeeping via SDT for conditional assignments
---
 phps-mode-parser-sdt.el| 82 --
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 65 insertions(+), 19 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 33877f6bdb..5b3fbfd2bd 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -617,7 +617,8 @@
 (class)
 (interface)
 (trait)
-(function))
+(function)
+(is-static-p))
 (when scope
   (dolist (item scope)
 (let ((space-type (car item))
@@ -632,7 +633,9 @@
((equal space-type 'trait)
 (setq trait space-name))
((equal space-type 'function)
-(setq function space-name))
+(setq function space-name))
+   ((equal space-type 'static)
+(setq is-static-p t))
 (if (gethash
  name
  phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
@@ -641,6 +644,12 @@
  (format
   " id %s"
   name)))
+(when is-static-p
+  (setq
+   new-symbol-name
+   (format
+" static%s"
+new-symbol-name)))
 (when function
   (setq
new-symbol-name
@@ -1919,13 +1928,13 @@
symbol-end)
   phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)))
 
-   (message "before:")
-   (message
-"phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S"
-phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
-   (message
-"phps-mode-parser-sdt--bookkeeping-symbol-stack: %S"
-phps-mode-parser-sdt--bookkeeping-symbol-stack)
+   ;; (message "before:")
+   ;; (message
+   ;;  "phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S"
+   ;;  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+   ;; (message
+   ;;  "phps-mode-parser-sdt--bookkeeping-symbol-stack: %S"
+   ;;  phps-mode-parser-sdt--bookkeeping-symbol-stack)
 
;; Go through stacks and modify symbol namespaces
;; - add function scope but only for non-super-global variables
@@ -1962,13 +1971,13 @@
 symbol-scope)))
 
 
-   (message "after:")
-   (message
-"phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S"
-phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
-   (message
-"phps-mode-parser-sdt--bookkeeping-symbol-stack: %S"
-phps-mode-parser-sdt--bookkeeping-symbol-stack)
+   ;; (message "after:")
+   ;; (message
+   ;;  "phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S"
+   ;;  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+   ;; (message
+   ;;  "phps-mode-parser-sdt--bookkeeping-symbol-stack: %S"
+   ;;  phps-mode-parser-sdt--bookkeeping-symbol-stack)
 
 
`(
@@ -2251,8 +2260,45 @@
 ;; 204 ((foreach_variable) (variable))
 (puthash
  204
- (lambda(args _terminals)
-   ;; TODO Declare variable here
+ (lambda(args terminals)
+   ;; Save variable declaration in bookkeeping buffer
+   (let ((variable-type (plist-get args 'ast-type)))
+ (cond
+  ((equal variable-type 'variable-callable-variable)
+   (let* ((callable-variable (plist-get args 'callable-variable))
+  (callable-variable-type (plist-get callable-variable 'ast-type)))
+ (cond
+  ((equal callable-variable-type 'callable-variable-simple-variable)
+   (let ((callable-variable-simple-variable
+  (plist-get callable-variable 'simple-variable)))
+ (let ((callable-variable-simple-variable-type
+(plist-get
+ callable-variable-simple-variable
+ 'ast-type)))
+   (cond
+((equal
+  callable-variable-simple-variable-type
+  'simple-variable-variable)
+ (let* ((variable-name
+ (plist-get
+  callable-variable-simple-variable
+  'variable))
+(symbol-name
+ variable-name)
+(symbol-start
+ (car (cdr terminals)))
+(symbol-end
+ (cdr (cdr terminals)))
+(symbol-scope
+ phps-mode-parser-sdt--bookkeeping-namespace))
+   ;; (message "declared foreach variable from terminals: %S" 
terminals)
+   (push
+(list
+ symbol-name
+ symbol-scope
+ symbol-start
+ symbol-end)
+
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
 
`(
  ast-type

[elpa] externals/phps-mode 9c67facc86 075/135: Work on bookkeeping of class static properties

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 9c67facc8673fc55152565e3c4763e7433994e39
Author: Christian Johansson 
Commit: Christian Johansson 

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)
-  (

[elpa] externals/phps-mode ebe28c3c9d 073/135: Work on improving symbol URI generation for class method variables

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit ebe28c3c9d522111049500abd79961eafdc9fb25
Author: Christian Johansson 
Commit: Christian Johansson 

Work on improving symbol URI generation for class method variables
---
 phps-mode-parser-sdt.el | 29 ++---
 1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 513070d059..9d4ae7fced 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2156,12 +2156,11 @@
 (puthash
  185
  (lambda(args terminals)
-
-   ;; TODO Should place class scope first in scope
-   ;; unless a namespace exists, in that case it should be placed second in 
scope
-
;; Go through stacks and modify symbol name-spaces
-   ;; but only for non-super-global variables
+   ;; but only for non-super-global variables.
+   ;; 
+   ;; Should place class scope first in scope
+   ;; unless a namespace exists, in that case it should be placed second in 
scope
(let ((class-name (nth 1 args)))
  (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
(dolist (
@@ -2172,9 +2171,13 @@
 symbol-name
 phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
  (let ((symbol-scope (reverse (car (cdr symbol-list)
-   (push
-(list 'class class-name)
-symbol-scope)
+   (if (equal (car (car symbol-scope)) 'namespace)
+   (let ((namespace-name (car (cdr (car symbol-scope)
+ (setcar symbol-scope (list 'class class-name))
+ (push (list 'namespace namespace-name) symbol-scope))
+ (push
+  (list 'class class-name)
+  symbol-scope))
(setcar
 (cdr symbol-list)
 (reverse symbol-scope)))
@@ -2188,9 +2191,13 @@
 symbol-name
 phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
  (let ((symbol-scope (reverse (car (cdr symbol-list)
-   (push
-(list 'class class-name)
-symbol-scope)
+   (if (equal (car (car symbol-scope)) 'namespace)
+   (let ((namespace-name (car (cdr (car symbol-scope)
+ (setcar symbol-scope (list 'class class-name))
+ (push (list 'namespace namespace-name) symbol-scope))
+ (push
+  (list 'class class-name)
+  symbol-scope))
(setcar
 (cdr symbol-list)
 (reverse symbol-scope



[elpa] externals/phps-mode 696d66d7e7 085/135: Bookkeeping of static variable inside function

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 696d66d7e76b37d968b226e9c892c42cb584ab77
Author: Christian Johansson 
Commit: Christian Johansson 

Bookkeeping of static variable inside function
---
 phps-mode-parser-sdt.el| 15 +++
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index a328e6d803..ddb9bea944 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1786,6 +1786,21 @@
 (puthash
  156
  (lambda(args _terminals)
+   (let ((static-var-list (nth 1 args)))
+ (dolist (static-var static-var-list)
+   (let ((static-var-type (plist-get static-var 'ast-type)))
+ (cond
+  ((equal static-var-type 'variable)
+   (let* ((variable-name (plist-get static-var 'ast-name))
+  (variable-start (plist-get static-var 'ast-start))
+  (variable-end (plist-get static-var 'ast-end)))
+ (push
+  (list
+   variable-name
+   phps-mode-parser-sdt--bookkeeping-namespace
+   variable-start
+   variable-end)
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)))
`(
  ast-type
  static-statement
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 9619250711..4dde441bb1 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -331,7 +331,7 @@
   (phps-mode-test-ast--should-bookkeep
"

[elpa] externals/phps-mode 6c6906317a 095/135: Added bookkeeping test for trait class symbols

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 6c6906317a60413f74966dcb447d621b932b94fd
Author: Christian Johansson 
Commit: Christian Johansson 

Added bookkeeping test for trait class symbols
---
 phps-mode-parser-sdt.el| 55 --
 test/phps-mode-test-ast.el |  8 +++
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 6926c821ea..636d9aefe1 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2308,6 +2308,58 @@
 (puthash
  190
  (lambda(args _terminals)
+   ;; Go through stacks and modify symbol name-spaces
+   ;; but only for non-super-global variables.
+   ;; 
+   ;; Should place class scope first in scope
+   ;; unless a namespace exists, in that case it should be placed second in 
scope
+   (let ((class-name (nth 1 args)))
+ (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
+   (dolist (
+symbol-list
+phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+ (let ((symbol-name (car symbol-list))
+   (symbol-start (nth 2 symbol-list))
+   (symbol-end (nth 3 symbol-list)))
+   (unless (gethash
+symbol-name
+phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+ (let ((symbol-scope (reverse (car (cdr symbol-list)
+   (if (equal (car (car symbol-scope)) 'namespace)
+   (let ((namespace-name (car (cdr (car symbol-scope)
+ (setcar symbol-scope (list 'interface class-name))
+ (push (list 'namespace namespace-name) symbol-scope))
+ (push
+  (list 'trait class-name)
+  symbol-scope))
+   (setq symbol-scope (reverse symbol-scope))
+   (setcar
+(cdr symbol-list)
+symbol-scope))
+
+ (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+   (dolist (
+symbol-list
+phps-mode-parser-sdt--bookkeeping-symbol-stack)
+ (let ((symbol-name (car symbol-list))
+   (symbol-start (nth 2 symbol-list))
+   (symbol-end (nth 3 symbol-list)))
+   (unless (gethash
+symbol-name
+phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+ (let ((symbol-scope (reverse (car (cdr symbol-list)
+   (if (equal (car (car symbol-scope)) 'namespace)
+   (let ((namespace-name (car (cdr (car symbol-scope)
+ (setcar symbol-scope (list 'interface class-name))
+ (push (list 'namespace namespace-name) symbol-scope))
+ (push
+  (list 'trait class-name)
+  symbol-scope))
+   (setq symbol-scope (reverse symbol-scope))
+   (setcar
+(cdr symbol-list)
+symbol-scope)))
+
`(
  ast-type
  trait-declaration-statement
@@ -2316,8 +2368,7 @@
  backup-doc-comment
  ,(nth 2 args)
  class-statement-list
- ,(nth 4 args)
- ))
+ ,(nth 4 args)))
  phps-mode-parser--table-translations)
 
 ;; 191 ((interface_declaration_statement) (T_INTERFACE T_STRING 
interface_extends_list backup_doc_comment "{" class_statement_list "}"))
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index acabb60f85..8190db8fb0 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -379,14 +379,12 @@
'((" namespace myNamespace class myClass function myMethod id $argument3" 
((180 190))) (" namespace myNamespace class myClass function myMethod id 
$argument2" ((160 170))) (" namespace myNamespace class myClass function 
myMethod id $argument1" ((140 150) (446 456))) (" namespace myNamespace class 
myClass function myMethod id $this" ((197 581))) (" namespace myNamespace class 
myClass id $property2" ((87 97))) (" namespace myNamespace class myClass id 
$property1" ((58 68))) ((180 190) 1 [...]
 
   (phps-mode-test-ast--should-bookkeep
-   "sayHello();\n$o->sayWorld();\n$o->sayExclamationMark();\n?>"
-   "Trait classes"
-   nil)
+   "var) {\necho 'Hit';\n}\n   
 }\n}\n"
+   "A basic trait class"
+   '((" trait MyTrait function sayHello id $this" ((80 147))) (" trait MyTrait 
id $var" ((35 39))) ((101 104) 1) ((94 99) 1) ((35 39) 1)))
 
-  ;; TODO Add trait class bookkeping test here
   ;; TODO Add test for class properties in class construct here
 
-
   (message "\n-- Ran tests for bookkeeping generation. --"))
 
 (defun phps-mode-test-ast ()



[elpa] externals/phps-mode 962b905ca0 057/135: Bookkeeping working for class non-static properties

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 962b905ca0d35badb218654c1348976aecbbfcd6
Author: Christian Johansson 
Commit: Christian Johansson 

Bookkeeping working for class non-static properties
---
 phps-mode-parser-sdt.el | 71 +++--
 1 file changed, 39 insertions(+), 32 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 7270e6f815..ecd0168bc7 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -635,7 +635,14 @@
((equal space-type 'function)
 (setq function space-name))
((equal space-type 'object-operator)
-(setq function nil))
+(let ((downcased-space-name
+   (downcase space-name)))
+  (cond
+   ((string= downcased-space-name "$this")
+(setq function nil))
+   (t
+;; TODO Do something here
+
((equal space-type 'static)
 (setq is-static-p t))
 (if (gethash
@@ -692,7 +699,7 @@
 (defun phps-mode-parser-sdt--parse-top-statement ()
   "Parse latest top statement."
;; (message "phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
-   (message "phps-mode-parser-sdt--bookkeeping-symbol-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-stack)
+   ;; (message "phps-mode-parser-sdt--bookkeeping-symbol-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-stack)
 
   ;; Parse bookkeeping writes and reads at every statement terminus
   (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
@@ -708,11 +715,11 @@
   (phps-mode-parser-sdt--get-symbol-uri
symbol-name
symbol-scope)))
-;; (message
-;;  "assign 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
@@ -745,7 +752,11 @@
   (phps-mode-parser-sdt--get-symbol-uri
symbol-name
symbol-scope)))
-(message "symbol-uri: %S" symbol-uri)
+(message
+ "reference symbol uri: %S from %S + %S"
+ symbol-uri
+ symbol-name
+ symbol-scope)
 (cond
 
  ;; Super-global variable
@@ -5687,13 +5698,18 @@
 callable-variable-type
 'callable-variable-simple-variable)
(let* ((simple-variable
-  (plist-get
(plist-get
-callable-variable
-'simple-variable)
-   'variable))
-  (simple-variable-lowercased
-   (downcase simple-variable)))
+(plist-get
+ callable-variable
+ 'simple-variable)
+'variable)))
+ (push
+  (list
+   simple-variable
+   phps-mode-parser-sdt--bookkeeping-namespace
+   (car (cdr (nth 0 terminals)))
+   (cdr (cdr (nth 0 terminals
+  phps-mode-parser-sdt--bookkeeping-symbol-stack)
  (let* ((property (nth 2 args))
 (property-type (plist-get property 'ast-type)))
(when (equal
@@ -5703,24 +5719,15 @@
 (plist-get
  property
  'string)))
-   (cond
-
-((string=
-  simple-variable-lowercased
-  "$this")
- (let ((namespace 
phps-mode-parser-sdt--bookkeeping-namespace))
-   (push (list 'object-operator) namespace)
-   (push
-(list
- property-string
- namespace
- (car (cdr (nth 0 terminals)))
- (cdr (cdr (nth 2 terminals
-
phps-mode-parser-sdt--bookkeeping-symbol-stack)))
-
-(t
- ;; TODO Do something here?
- ))
+   (let ((namespace 
phps-mode-parser-sdt--bookkeeping-namespace))
+ (push (list 'object-operator simple-variable) 
namespace)
+ (push
+

[elpa] externals/phps-mode updated (5fd766964d -> d5bdadc6fc)

2023-01-29 Thread Christian Johansson
cjohansson pushed a change to branch externals/phps-mode.

  from  5fd766964d Updated version to 0.4.30
   new  b1d402cc39 Added some SDT rules
   new  ddc1213d83 Typo in production number
   new  a0b350c316 More work on SDT
   new  a0358daa01 Added SDT for attributes
   new  6816e24e04 More work on attributes SDT
   new  23fcce7ee0 SDT for use-top-statements
   new  f333b4f0fd SDT for possible_comma
   new  a07fd20026 Keeping track of global namespace directly from SDT
   new  393edecde0 Started with bookkeeping index of objects
   new  e74d0fd634 SDT for inner_statement
   new  7a3b86b11d Added SDT for all statements
   new  fd28fcbed3 Added SDT for unset_variables and more
   new  c93e41b57f Fixed new compilation errors in added SDT
   new  5080effb1d Added TODO item
   new  67635aa9ee Added SDT for for-statement and foreach-statements
   new  cfcb795473 SDT for while_statement
   new  8dc2235f17 Added SDT for if_stmt
   new  8c71d3838e Added SDT for type
   new  38ccb4e728 More SDT for argument and union_type and 
intersection_type
   new  f28ea09743 SDT is not using get-list-of-object function anymore
   new  dd672cd243 More SDT
   new  75743d0c25 Merge branch 'master' into feature/full-sdt
   new  44e618ffe3 SDT for trait_alias
   new  911abb044e SDT method_body
   new  66ad034207 SDT member_modifier
   new  610358e2ef SDT for property
   new  c782b18dc0 Merge branch 'master' into feature/full-sdt
   new  34a595fa09 SDT class_const_list
   new  dffe0d0485 More SDT rules
   new  b68d94ee08 More SDT rules
   new  7602348327 More SDT rules
   new  4981a1eb45 SDT rules up to 520
   new  d73af7968e SDT to 538
   new  7dcaa1df9e Added SDT rules for all productions
   new  258551c02a More work on bookkeeping generation via SDT
   new  eb07936ea8 added todo notes
   new  6e43f9f6db More messing around with SDT
   new  c4d9f8d909 More work on SDT
   new  f9ddef260c Passing first bookkeeping test using SDT generated 
bookkeeping
   new  442b5202d4 Bookkeeping via SDT passing second test
   new  0ca63fe2b6 Passing another bookkeeping test via SDT
   new  0e8923c0bd Passed super-globals bookkeeping test via SDT
   new  e887dc91e3 Added TODO items
   new  fb42b49970 Added more TODO items
   new  42b983bb16 More work on bookkeeping via SDT
   new  f26c45586d More work on bookkeeping
   new  86ad9e35ee Renamed symbol id to symbol URI
   new  dd2fadefe7 Bookkeeping class properties
   new  1332919417 Passing another bookkeeping test via SDT
   new  cba467b26c Added TODO items
   new  438ec520fc Passing bookkeeping via SDT for conditional assignments
   new  dbaf508512 Work on getting bookkeeping for class properties working
   new  531c98cf2b Improved bookkeeping of class properties
   new  002b27bfb7 Started on bookkeeping support via SDT for class 
properties via object operator
   new  ad3b10e716 Added variable reference to bookkeeping stack where it 
is referencing $this
   new  7b9f8011f1 More testing
   new  962b905ca0 Bookkeeping working for class non-static properties
   new  b2454f1967 Bookkeeping of static class property
   new  e2f2c86e18 Improved class properties bookkeeping test
   new  7fa721a85d More work on bookkeeping static class properties
   new  cc584ff4d6 Bookkeping of static class properties test passing
   new  0bf9b31fef Passed bookkeeping via SDT for try catch variables
   new  eac10d63e6 Started on bookkeeping of variables inside anonymous 
functions
   new  e1752a3aa3 Bookkeeping of variables inside simple anonymous 
functions
   new  e924ac83b6 Improved bookkeeping test for anonymous function
   new  e614a20ada Added bookkeeping for referenced foreach variables
   new  d33625bb1a Bookkeeping for array assignment passing test
   new  e6bc401d0b Work on improving test for global variable bookkeeping
   new  40d7d88fb8 Work on bookkeeping global variables
   new  a10656fc34 Passing bookkeeping test for global variables
   new  d1b1fd0a19 Started bookkeeping of arrow function variables
   new  eefe70b999 Work on improving symbol URI calculation
   new  ebe28c3c9d Work on improving symbol URI generation for class method 
variables
   new  804a0dbdb9 Added static uri for symbol names
   new  9c67facc86 Work on bookkeeping of class static properties
   new  7bb676dc8b Bookkeeping for anonymous function passing
   new  d464cb1f01 Fixed bookkeeping of global variables
   new  f86d8dc6ac More work on arrow function variable uri
   new  39a6fe03ae Improved is-varadic and is-reference argument flags
   new  ae68e19c0a Passing bookkeeping arrow function
   new  787aaa2bb4 Passing another bookkeeping test
   new  1a1245f186 Passing bookkeeping test isset and empty variables
 

[elpa] externals/phps-mode 0e8923c0bd 042/135: Passed super-globals bookkeeping test via SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 0e8923c0bddd541eaa90822bfedcf5572b39a062
Author: Christian Johansson 
Commit: Christian Johansson 

Passed super-globals bookkeeping test via SDT
---
 phps-mode-parser-sdt.el | 183 +++-
 1 file changed, 120 insertions(+), 63 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index bc5171775b..a0967a37a9 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -606,6 +606,23 @@
   nil
   "Current bookkeeping assignment symbol stack.")
 
+(defvar
+  phps-mode-parser-sdt--bookkeeping--superglobal-variable-p
+  #s(hash-table size 12 test equal rehash-size 1.5 rehash-threshold 0.8125 
data ("$_GET" 1 "$_POST" 1 "$_COOKIE" 1 "$_SESSION" 1 "$_REQUEST" 1 "$GLOBALS" 
1 "$_SERVER" 1 "$_FILES" 1 "$_ENV" 1 "$argc" 1 "$argv" 1 
"$http_​response_​header" 1))
+  "Hash-table of super-global variables.")
+
+(defun phps-mode-parser-sdt--get-namespaced-symbol-name (symbol-name)
+  "Get namespaced SYMBOL-NAME."
+  (if
+  (gethash
+   symbol-name
+   phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+  symbol-name
+(format
+ "%s id %s"
+ phps-mode-parser-sdt--bookkeeping-namespace
+ symbol-name)))
+
 (defun phps-mode-parser-sdt--parse-top-statement ()
   "Parse latest top statement."
;; (message "phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
@@ -647,21 +664,38 @@
   (let ((symbol-name (car symbol-list))
 (symbol-start (car (cdr symbol-list)))
 (symbol-end (car (cdr (cdr symbol-list)
-(if (gethash
- symbol-name
- phps-mode-parser-sdt-bookkeeping)
-(puthash
- (list
-  symbol-start
-  symbol-end)
- 1
- phps-mode-parser-sdt-bookkeeping)
+(cond
+
+ ;; Super-global variable
+ ((gethash
+   symbol-name
+   phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+  (puthash
+   (list
+symbol-start
+symbol-end)
+   1
+   phps-mode-parser-sdt-bookkeeping))
+
+ ;; Declared variable
+ ((gethash
+   symbol-name
+   phps-mode-parser-sdt-bookkeeping)
+  (puthash
+   (list
+symbol-start
+symbol-end)
+   1
+   phps-mode-parser-sdt-bookkeeping))
+
+ ;; Undeclared variable
+ (t
   (puthash
(list
 symbol-start
 symbol-end)
0
-   phps-mode-parser-sdt-bookkeeping
+   phps-mode-parser-sdt-bookkeeping)
 (setq
  phps-mode-parser-sdt--bookkeeping-symbol-stack
  nil)))
@@ -1775,8 +1809,8 @@
 (puthash
  179
  (lambda(args terminals)
-   (message "parameter_list-args: %S" (nth 5 args))
-   (message "parameter_list-terminals: %S" (nth 5 terminals))
+   ;; (message "parameter_list-args: %S" (nth 5 args))
+   ;; (message "parameter_list-terminals: %S" (nth 5 terminals))
 
;; Iterate optional parameters are declare them
(when-let ((parameter-list (nth 5 args)))
@@ -1784,56 +1818,71 @@
(let ((parameter-ast-type (plist-get parameter 'ast-type)))
  (cond
   ((equal parameter-ast-type 'attributed-parameter)
-   (let ((attributed-parameter
+   (let* ((attributed-parameter
   (plist-get
parameter
-   'parameter)))
+   'parameter))
+  (attributed-parameter-name
+   (plist-get attributed-parameter 'ast-name))
+  (symbol-name
+   (phps-mode-parser-sdt--get-namespaced-symbol-name
+attributed-parameter-name))
+  (symbol-start
+   (plist-get attributed-parameter 'ast-start))
+  (symbol-end
+   (plist-get attributed-parameter 'ast-end)))
  (push
   (list
-   (format
-" id %s"
-(plist-get attributed-parameter 'ast-name))
-   (plist-get attributed-parameter 'ast-start)
-   (plist-get attributed-parameter 'ast-end))
+   symbol-name
+   symbol-start
+   symbol-end)
   phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)))
 
-   ;; TODO Should go through stack and modify symbol namespaces
-   (message
-"phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S"
-phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
-   (message
-"phps-mode-parser-sdt--bookkeeping-symbol-stack: %S"
-phps-mode-parser-sdt--bookkeeping-symbol-stack)
+   
+   ;; (message
+   ;;  "phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S"
+   ;;  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack

[elpa] externals/phps-mode 18f1f12fc6 096/135: Added new bookkeeping test for class parameters in constructor method

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 18f1f12fc60d65403e35067fb4baf9598c549ee9
Author: Christian Johansson 
Commit: Christian Johansson 

Added new bookkeeping test for class parameters in constructor method
---
 test/phps-mode-test-ast.el | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 8190db8fb0..be42e58ddd 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -383,7 +383,11 @@
"A basic trait class"
'((" trait MyTrait function sayHello id $this" ((80 147))) (" trait MyTrait 
id $var" ((35 39))) ((101 104) 1) ((94 99) 1) ((35 39) 1)))
 
-  ;; TODO Add test for class properties in class construct here
+  ;; TODO Make this test pass
+  (phps-mode-test-ast--should-bookkeep
+   "

[elpa] externals/phps-mode 86ad9e35ee 047/135: Renamed symbol id to symbol URI

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 86ad9e35eed01ea5906a03f6cc691ccf9e0f49b2
Author: Christian Johansson 
Commit: Christian Johansson 

Renamed symbol id to symbol URI
---
 phps-mode-parser-sdt.el | 37 +++--
 1 file changed, 19 insertions(+), 18 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 22422ec05f..8f2d791aac 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -611,8 +611,8 @@
   #s(hash-table size 12 test equal rehash-size 1.5 rehash-threshold 0.8125 
data ("$_GET" 1 "$_POST" 1 "$_COOKIE" 1 "$_SESSION" 1 "$_REQUEST" 1 "$GLOBALS" 
1 "$_SERVER" 1 "$_FILES" 1 "$_ENV" 1 "$argc" 1 "$argv" 1 
"$http_​response_​header" 1))
   "Hash-table of super-global variables.")
 
-(defun phps-mode-parser-sdt--get-namespaced-symbol-name (symbol-name scope)
-  "Get namespaced SYMBOL-NAME in SCOPE."
+(defun phps-mode-parser-sdt--get-symbol-uri (name scope)
+  "Get URI from symbol NAME in SCOPE."
   (let ((namespace)
 (class)
 (interface)
@@ -634,13 +634,13 @@
((equal space-type 'function)
 (setq function space-name))
 (if (gethash
- symbol-name
+ name
  phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
-symbol-name
+name
   (let ((new-symbol-name
  (format
   " id %s"
-  symbol-name)))
+  name)))
 (when function
   (setq
new-symbol-name
@@ -693,23 +693,24 @@
  (symbol-scope (car (cdr symbol-list)))
  (symbol-start (car (cdr (cdr symbol-list
  (symbol-end (car (cdr (cdr (cdr symbol-list)
- (symbol-id
-  (phps-mode-parser-sdt--get-namespaced-symbol-name
+ (symbol-uri
+  (phps-mode-parser-sdt--get-symbol-uri
symbol-name
symbol-scope)))
-(message "assign id: %S from %S + %S"
- symbol-id
- symbol-name
- symbol-scope)
-(if (gethash symbol-id phps-mode-parser-sdt-bookkeeping)
+(message
+ "assign uri: %S from %S + %S"
+ symbol-uri
+ symbol-name
+ symbol-scope)
+(if (gethash symbol-uri phps-mode-parser-sdt-bookkeeping)
 (puthash
- symbol-id
+ symbol-uri
  (append
-  (gethash symbol-id phps-mode-parser-sdt-bookkeeping)
+  (gethash symbol-uri phps-mode-parser-sdt-bookkeeping)
   (list symbol-start symbol-end))
  phps-mode-parser-sdt-bookkeeping)
   (puthash
-   symbol-id
+   symbol-uri
(list
 (list
  symbol-start
@@ -729,8 +730,8 @@
  (symbol-scope (car (cdr symbol-list)))
  (symbol-start (car (cdr (cdr symbol-list
  (symbol-end (car (cdr (cdr (cdr symbol-list)
- (symbol-id
-  (phps-mode-parser-sdt--get-namespaced-symbol-name
+ (symbol-uri
+  (phps-mode-parser-sdt--get-symbol-uri
symbol-name
symbol-scope)))
 (cond
@@ -748,7 +749,7 @@
 
  ;; Declared variable
  ((gethash
-   symbol-id
+   symbol-uri
phps-mode-parser-sdt-bookkeeping)
   (puthash
(list



[elpa] externals/phps-mode f9ddef260c 039/135: Passing first bookkeeping test using SDT generated bookkeeping

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit f9ddef260c43e4c11fc2c427069876e1ef40232b
Author: Christian Johansson 
Commit: Christian Johansson 

Passing first bookkeeping test using SDT generated bookkeeping
---
 phps-mode-ast-bookkeeping.el |   1 -
 phps-mode-parser-sdt.el  | 213 +++
 2 files changed, 135 insertions(+), 79 deletions(-)

diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index e46e98f642..6bf8875c65 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -250,7 +250,6 @@
 (defun phps-mode-ast-bookkeeping--generate (&optional tree)
   "Generate AST for current buffer or optionally for TREE."
   (setq phps-mode-ast-bookkeeping--index phps-mode-parser-sdt-bookkeeping)
-  (message "phps-mode-parser-sdt--bookkeeping-symbol-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-stack)
   phps-mode-ast-bookkeeping--index)
 
 
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 996b27f2ac..ae931203e3 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -601,6 +601,68 @@
   nil
   "Current bookkeeping symbol stack.")
 
+(defvar-local
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
+  nil
+  "Current bookkeeping assignment symbol stack.")
+
+(defun phps-mode-parser-sdt--parse-statement ()
+  "Parse latest statement."
+   ;; (message "phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+   ;; (message "phps-mode-parser-sdt--bookkeeping-symbol-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-stack)
+
+  ;; Parse bookkeeping writes and reads at every statement terminus
+  (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
+;; TODO Should declare based on start?
+;; Declare variables
+(dolist (
+ symbol-list
+ phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+  (let ((symbol-name (car symbol-list))
+(symbol-start (car (cdr symbol-list)))
+(symbol-end (car (cdr (cdr symbol-list)
+(if (gethash symbol-name phps-mode-parser-sdt-bookkeeping)
+(puthash
+ symbol-name
+ (1+ (gethash symbol-name phps-mode-parser-sdt-bookkeeping))
+ phps-mode-parser-sdt-bookkeeping)
+  (puthash
+   symbol-name
+   1
+   phps-mode-parser-sdt-bookkeeping
+(setq
+ phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
+ nil))
+
+  (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+;; Bookkeeping hit / misses of symbols here
+;; TODO Should consider declaration position as well?
+(dolist (
+ symbol-list
+ phps-mode-parser-sdt--bookkeeping-symbol-stack)
+  (let ((symbol-name (car symbol-list))
+(symbol-start (car (cdr symbol-list)))
+(symbol-end (car (cdr (cdr symbol-list)
+(if (gethash
+ symbol-name
+ phps-mode-parser-sdt-bookkeeping)
+(puthash
+ (list
+  symbol-start
+  symbol-end)
+ 1
+ phps-mode-parser-sdt-bookkeeping)
+  (puthash
+   (list
+symbol-start
+symbol-end)
+   0
+   phps-mode-parser-sdt-bookkeeping
+(setq
+ phps-mode-parser-sdt--bookkeeping-symbol-stack
+ nil)))
+
+
 ;; SDT starts here
 
 ;; 0 ((start) (top_statement_list))
@@ -1323,19 +1385,31 @@
 (puthash
  145
  (lambda(args _terminals)
+   (phps-mode-parser-sdt--parse-statement)
(nth 1 args))
  phps-mode-parser--table-translations)
 
 ;; 146 ((statement) (if_stmt))
-(puthash 146 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+(puthash
+ 146
+ (lambda(args _terminals)
+   (phps-mode-parser-sdt--parse-statement)
+   args)
+ phps-mode-parser--table-translations)
 
 ;; 147 ((statement) (alt_if_stmt))
-(puthash 147 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+(puthash
+ 147
+ (lambda(args _terminals)
+   (phps-mode-parser-sdt--parse-statement)
+   args)
+ phps-mode-parser--table-translations)
 
-;; 148 (T_WHILE "(" expr ")" while_statement))
+;; 148 ((statement) (T_WHILE "(" expr ")" while_statement))
 (puthash
  148
  (lambda(args _terminals)
+   (phps-mode-parser-sdt--parse-statement)
`(
  ast-type
  while-statement
@@ -1350,6 +1424,7 @@
 (puthash
  149
  (lambda(args _terminals)
+   (phps-mode-parser-sdt--parse-statement)
`(
  ast-type
  do-statement
@@ -1360,10 +1435,11 @@
  ))
  phps-mode-parser--table-translations)
 
-;; 150 (T_FOR "(" for_exprs ";" for_exprs ";" for_exprs ")" for_statement))
+;; 150 ((statement) (T_FOR "(" for_exprs ";" for_exprs ";" for_exprs ")" 
for_statement))
 (puthash
  150
  (lambda(args _terminals)
+   (phps-mode-parser-sdt--parse-statement)
`(
  ast-type
  for-statement
@@ -1382,6 +1458,7 @@
 (puthash
  151
  (

[elpa] externals/phps-mode d464cb1f01 077/135: Fixed bookkeeping of global variables

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit d464cb1f01f745e324c5ffc25e2b109397a73be3
Author: christian 
Commit: christian 

Fixed bookkeeping of global variables
---
 phps-mode-parser-sdt.el | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 307086b390..faab16fd49 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -640,6 +640,7 @@
 (let ((item (nth scope-index scope))
   (next-scope)
   (next-scope-type)
+  (next-scope-is-global)
   (next-scope-is-this-object-operator)
   (next-scope-is-self-static-member-operator))
 
@@ -649,6 +650,8 @@
 (setq next-scope (nth (1+ scope-index) scope))
 (setq next-scope-type (car next-scope))
 (cond
+ ((equal next-scope-type 'global)
+  (setq next-scope-is-global t))
  ((equal next-scope-type 'object-operator)
   (let ((downcased-scope-name (downcase (car (cdr 
next-scope)
 (when (string= downcased-scope-name "$this")
@@ -673,7 +676,9 @@
 (space-name (car (cdr item
 (cond
 
- ((equal space-type 'namespace)
+ ((and
+   (equal space-type 'namespace)
+   (not next-scope-is-global))
   (let ((potential-uri-count (length potential-uris))
 (potential-uri-index 0))
 (while (< potential-uri-index potential-uri-count)
@@ -682,7 +687,9 @@
(format " namespace %s%s" space-name (nth 
potential-uri-index potential-uris)))
   (setq potential-uri-index (1+ potential-uri-index)
 
- ((equal space-type 'class)
+ ((and
+   (equal space-type 'class)
+   (not next-scope-is-global))
   (let ((potential-uri-count (length potential-uris))
 (potential-uri-index 0))
 (while (< potential-uri-index potential-uri-count)
@@ -691,7 +698,9 @@
(format " class %s%s" space-name (nth 
potential-uri-index potential-uris)))
   (setq potential-uri-index (1+ potential-uri-index)
 
- ((equal space-type 'interface)
+ ((and
+   (equal space-type 'interface)
+   (not next-scope-is-global))
   (let ((potential-uri-count (length potential-uris))
 (potential-uri-index 0))
 (while (< potential-uri-index potential-uri-count)
@@ -700,7 +709,9 @@
(format " interface %s%s" space-name (nth 
potential-uri-index potential-uris)))
   (setq potential-uri-index (1+ potential-uri-index)
 
- ((equal space-type 'trait)
+ ((and
+   (equal space-type 'trait)
+   (not next-scope-is-global))
   (let ((potential-uri-count (length potential-uris))
 (potential-uri-index 0))
 (while (< potential-uri-index potential-uri-count)
@@ -712,6 +723,7 @@
  ((and
(equal space-type 'function)
(not (or
+ next-scope-is-global
  next-scope-is-this-object-operator
  next-scope-is-self-static-member-operator)))
   (let ((potential-uri-count (length potential-uris))



[elpa] externals/phps-mode 776c818ff9 121/135: Passing some more imenu tests

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 776c818ff905c8e53378dabe7d209eb0e19f489c
Author: Christian Johansson 
Commit: Christian Johansson 

Passing some more imenu tests
---
 phps-mode-ast.el   |  64 +++--
 phps-mode-parser-sdt.el| 668 -
 test/phps-mode-test-ast.el |   4 +-
 3 files changed, 407 insertions(+), 329 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 7d4c4f18eb..3d5d4cc65c 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -75,8 +75,6 @@
 (phps-mode-debug-message
  (message "\nTranslation:\n%S\n\n" translation))
 
-(message "phps-mode-parser-sdt-symbol-imenu--table: %S" 
phps-mode-parser-sdt-symbol-imenu--table)
-
 ;; Convert imenu index from hash-table to list structure here
 (let ((imenu-index))
   (maphash
@@ -91,11 +89,38 @@
 (v2-index))
 (maphash
  (lambda (k3 v3)
-   (if (symbolp k3)
-   (setq v2-index v3))
-   (push
-`(,k3 . ,v3)
-v2-list))
+   (if (hash-table-p v3)
+   (let ((v3-list)
+ (v3-index))
+ (maphash
+  (lambda (k4 v4)
+(if (symbolp k4)
+(setq v3-index v4)
+  (push `(,k4 . ,v4) v3-list)))
+  v3)
+
+ ;; Sort level 4
+ (setq
+  v3-list
+  (sort
+   v3-list
+   (lambda (a b)
+ (cond
+  ((and
+(listp (cdr a))
+(listp (cdr b)))
+   (< (cdr (car (car (cdr a (cdr (car 
(car (cdr b))
+  ((listp (cdr a))
+   (< (cdr (car (car (cdr a (cdr b)))
+  ((listp (cdr b))
+   (< (cdr a) (cdr (car (car (cdr b))
+  (t
+   (< (cdr a) (cdr b)))
+ (push `(declaration . ,v3-index) v3-list)
+ (push `(,k3 ,v3-list) v2-list))
+ (if (symbolp k3)
+ (setq v2-index v3))
+ (push `(,k3 . ,v3) v2-list)))
  v2)
 
 ;; Sort level 3
@@ -104,11 +129,21 @@
  (sort
   v2-list
   (lambda (a b)
-(< (cdr a) (cdr b)
+(cond
+ ((and
+   (listp (cdr a))
+   (listp (cdr b)))
+  (< (cdr (car (car (cdr a (cdr (car (car (cdr 
b))
+ ((listp (cdr a))
+  (< (cdr (car (car (cdr a (cdr b)))
+ ((listp (cdr b))
+  (< (cdr a) (cdr (car (car (cdr b))
+ (t
+  (< (cdr a) (cdr b)))
 (push `(declaration . ,v2-index) v2-list)
 (push `(,k2 ,v2-list) v-list))
 (if (symbolp k2)
-  (setq v-index v2)
+(setq v-index v2)
   (push `(,k2 . ,v2) v-list
 v)
 
@@ -152,17 +187,6 @@
(t
 (< (cdr a) (cdr b)))
 
-  ;; TODO sort imenu-index here
-  ;; (setq
-  ;;  imenu-index
-  ;;  (sort
-  ;;   imenu-index
-  ;;   (lambda (a b)
-  ;; (cond
-  ;;  ((and
-  ;;(listp a)
-  ;;(listp b))
-  ;;   (if ()
   (setq
phps-mode-parser-sdt-symbol-imenu
imenu-index))
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index f2754a8277..804eacc724 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -877,7 +877,7 @@
   ;; Add imenu class, trait, interface and functions here
   (when
   phps-mode-parser-sdt-symbol-imenu--namespace
-(message "phps-mode-parser-sdt-symbol-imenu--namespace: %S" 
phps-mode-parser-sdt-symbol-imenu--namespace)
+;; (message "phps-mode-parser-sdt-symbol-imenu--namespace: %S" 
phps-mode-parser-sdt-symbol-imenu--namespace)
   

[elpa] externals/phps-mode 7602348327 031/135: More SDT rules

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 7602348327fc16a4bcdd258355e41eb20d67fc6f
Author: Christian Johansson 
Commit: Christian Johansson 

More SDT rules
---
 phps-mode-parser-sdt.el | 248 +++-
 1 file changed, 205 insertions(+), 43 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 912864f7fa..74ec6bf2ca 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -4326,80 +4326,242 @@
  ,(append (nth 0 args) (list (nth 2 args)
  phps-mode-parser--table-translations)
 
-;; TODO Was here
-
-;; inline_function -> (function returns_ref backup_doc_comment "(" 
parameter_list ")" lexical_vars return_type backup_fn_flags "{" 
inner_statement_list "}" backup_fn_flags)
+;; 451 ((lexical_var_list) (lexical_var))
 (puthash
- 439
- (lambda(args terminals)
+ 451
+ (lambda(args _terminals)
`(
  ast-type
- inline-function
- ast-start
- ,(car (cdr (nth 9 terminals)))
- ast-end
- ,(cdr (cdr (nth 11 terminals)))
- returns-ref
- ,(nth 1 args)
- backup-doc-comment
- ,(nth 2 args)
- parameter-list
- ,(nth 4 args)
- lexical-vars
- ,(nth 6 args)
- return-type
- ,(nth 7 args)
- backup-fn-flags-1
- ,(nth 8 args)
- inner-statement-list
- ,(nth 10 args)
- backup-fn-flags-2
- ,(nth 12 args)
- ))
+ lexical-var-list
+ ,args))
  phps-mode-parser--table-translations)
 
-;; lexical_var -> (T_VARIABLE)
+;; 452 ((lexical_var) (T_VARIABLE))
 (puthash
  452
- (lambda(args terminals)
+ (lambda(args _terminals)
`(
  ast-type
- lexical-var
- ast-name
- ,args
- ast-start
- ,(car (cdr terminals))
- ast-end
- ,(cdr (cdr terminals))
- ))
+ lexical-var-variable
+ ,args))
+ phps-mode-parser--table-translations)
+
+;; 453 ((lexical_var) (ampersand T_VARIABLE))
+(puthash
+ 453
+ (lambda(args _terminals)
+   `(
+ ast-type
+ lexical-var-reference
+ ,args))
  phps-mode-parser--table-translations)
 
-;; function_call -> (name argument_list)
+;; 454 ((function_call) (name argument_list))
 (puthash
  454
  (lambda(args _terminals)
`(
  ast-type
  function-call
- ast-name
+ name
  ,(nth 0 args)
  argument-list
- ,(nth 1 args)
- ))
+ ,(nth 1 args)))
+ phps-mode-parser--table-translations)
+
+;; 455 ((function_call) (class_name T_PAAMAYIM_NEKUDOTAYIM member_name 
argument_list))
+(puthash
+ 455
+ (lambda(args _terminals)
+   `(
+ ast-type
+ function-call-class
+ class-name
+ ,(nth 0 args)
+ member-name
+ ,(nth 2 args)
+ argument-list
+ ,(nth 3 args)))
+ phps-mode-parser--table-translations)
+
+;; 456 ((function_call) (variable_class_name T_PAAMAYIM_NEKUDOTAYIM 
member_name argument_list))
+(puthash
+ 456
+ (lambda(args _terminals)
+   `(
+ ast-type
+ function-call-variable-class
+ variable-class-name
+ ,(nth 0 args)
+ member-name
+ ,(nth 2 args)
+ argument-list
+ ,(nth 3 args)))
+ phps-mode-parser--table-translations)
+
+;; 457 ((function_call) (callable_expr argument_list))
+(puthash
+ 457
+ (lambda(args _terminals)
+   `(
+ ast-type
+ function-call-callable-expr
+ callable-expr
+ ,(nth 0 args)
+ argument-list
+ ,(nth 1 args)))
+ phps-mode-parser--table-translations)
+
+;; 458 ((class_name) (T_STATIC))
+(puthash
+ 458
+ (lambda(args _terminals)
+   `(
+ ast-type
+ class-name-static))
+ phps-mode-parser--table-translations)
+
+;; 459 ((class_name) (name))
+(puthash
+ 459
+ (lambda(args _terminals)
+   `(
+ ast-type
+ class-name-name
+ name
+ ,args))
+ phps-mode-parser--table-translations)
+
+;; 460 ((class_name_reference) (class_name))
+(puthash
+ 460
+ (lambda(args _terminals)
+   `(
+ ast-type
+ class-name-reference-class-name
+ class-name
+ ,args))
+ phps-mode-parser--table-translations)
+
+;; 461 ((class_name_reference) (new_variable))
+(puthash
+ 461
+ (lambda(args _terminals)
+   `(
+ ast-type
+ class-name-reference-new-variable
+ new-variable
+ ,args))
+ phps-mode-parser--table-translations)
+
+;; 462 ((class_name_reference) ("(" expr ")"))
+(puthash
+ 462
+ (lambda(args _terminals)
+   `(
+ ast-type
+ class-name-reference-expr
+ expr
+ ,(nth 1 args)))
+ phps-mode-parser--table-translations)
+
+;; 463 ((exit_expr) (%empty))
+(puthash
+ 463
+ (lambda(args _terminals)
+   `(
+ ast-type
+ exit-expr))
+ phps-mode-parser--table-translations)
+
+;; 464 ((exit_expr) ("(" optional_expr ")"))
+(puthash
+ 464
+ (lambda(args _terminals)
+   `(
+ ast-type
+ exit-expr-optional-expr
+ optional-expr
+ ,(nth 1 args)))
+ phps-mode-parser--table-translations)
+
+;; 465 ((backticks_expr) (%empty))
+(puthash
+ 465
+ (lambda(args _terminals)
+   `(
+ ast-type
+ backticks-expr-empty))
+ phps-mode-parser--table-translations)
+
+;; 466 ((backticks_expr) (T_ENCAPSED_AND_WHITESPACE))
+(puthash
+ 466

[elpa] externals/phps-mode 1afe6aaec7 086/135: Passing more tests for static variables

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 1afe6aaec767f48da0a156f675c0964770c6d079
Author: Christian Johansson 
Commit: Christian Johansson 

Passing more tests for static variables
---
 phps-mode-parser-sdt.el| 9 -
 test/phps-mode-test-ast.el | 6 +++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index ddb9bea944..ac09147928 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1800,7 +1800,14 @@
phps-mode-parser-sdt--bookkeeping-namespace
variable-start
variable-end)
-  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)))
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+ (push
+  (list
+   variable-name
+   phps-mode-parser-sdt--bookkeeping-namespace
+   variable-start
+   variable-end)
+  phps-mode-parser-sdt--bookkeeping-symbol-stack)))
`(
  ast-type
  static-statement
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 4dde441bb1..7c0e498711 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -331,17 +331,17 @@
   (phps-mode-test-ast--should-bookkeep
"variable) {}\n  
  if ($this->variable2) {}\nif ($this->variable3) {}\nif 
($this->variable4) {}\nif (self::$variable4) {}\nif 
(self::$variable5) {}\nif (self::$varia [...]



[elpa] externals/phps-mode 66c02b9be1 083/135: Passing test for bookkeeping of interface variables

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 66c02b9be1eb3dbf147ba2caaf3f2b6249e17661
Author: Christian Johansson 
Commit: Christian Johansson 

Passing test for bookkeeping of interface variables
---
 phps-mode-parser-sdt.el| 32 
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index bf35794061..68e343d11f 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2293,6 +2293,38 @@
 (puthash
  191
  (lambda(args terminals)
+   ;; Go through stacks and modify symbol name-spaces
+   ;; but only for non-super-global variables.
+   ;; 
+   ;; Should place class scope first in scope
+   ;; unless a namespace exists, in that case it should be placed second in 
scope
+   (let ((class-name (nth 1 args)))
+ (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
+   (dolist (
+symbol-list
+phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+ (let ((symbol-name (car symbol-list))
+   (symbol-start (nth 2 symbol-list))
+   (symbol-end (nth 3 symbol-list)))
+   (unless (gethash
+symbol-name
+phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+ (let ((symbol-scope (reverse (car (cdr symbol-list)
+   (if (equal (car (car symbol-scope)) 'namespace)
+   (let ((namespace-name (car (cdr (car symbol-scope)
+ (setcar symbol-scope (list 'interface class-name))
+ (push (list 'namespace namespace-name) symbol-scope))
+ (push
+  (list 'interface class-name)
+  symbol-scope))
+   (setq symbol-scope (reverse symbol-scope))
+   (setcar
+(cdr symbol-list)
+symbol-scope)
+   (push
+(list symbol-name symbol-scope symbol-start symbol-end)
+phps-mode-parser-sdt--bookkeeping-symbol-stack)))
+
`(
  ast-type
  interface-declaration-statement
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 4930dacd01..1fb50e6b56 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -301,7 +301,7 @@
   (phps-mode-test-ast--should-bookkeep
"

[elpa] externals/phps-mode eb07936ea8 036/135: added todo notes

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit eb07936ea8323469a1680aade7546b8de2e5dbbb
Author: Christian Johansson 
Commit: Christian Johansson 

added todo notes
---
 phps-mode-parser-sdt.el   |  6 ++
 test/phps-mode-test-ast.el|  4 ++--
 test/phps-mode-test-parser.el | 12 ++--
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index c4c3f52583..38c875efc3 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -3161,6 +3161,12 @@
 (puthash
  359
  (lambda(args terminals)
+   ;; TODO Should probably have a expression / statement buffer of mentioned 
symbols and do a parse each time a expression / statement reaches its terminus
+
+   ;; TODO Declare variable in bookkeeping and imenu here
+   (message "expr-assign-variable-by-expr")
+   (message "args: %S" args)
+   (message "terminals: %S" terminals)
`(
  ast-type
  expr-assign-variable-by-expr
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index b52a37be96..0b08687110 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -26,7 +26,7 @@
(lambda()
   (let ((parse (phps-mode-parser-parse)))
 (message "Left-to-right with right-most derivation:\n%S\n" parse)
-(dolist (production-number (reverse parse))
+(dolist (production-number parse)
   (let ((production
  (phps-mode-parser--get-grammar-production-by-number
   production-number)))
@@ -65,7 +65,7 @@
(lambda()
   (let ((parse (phps-mode-parser-parse)))
 (message "Left-to-right with right-most derivation:\n%S\n" parse)
-(dolist (production-number (reverse parse))
+(dolist (production-number parse)
   (let ((production
  (phps-mode-parser--get-grammar-production-by-number
   production-number)))
diff --git a/test/phps-mode-test-parser.el b/test/phps-mode-test-parser.el
index c12c38d2fe..44a5eceb53 100644
--- a/test/phps-mode-test-parser.el
+++ b/test/phps-mode-test-parser.el
@@ -76,7 +76,7 @@
 
  (let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation:\n%S\n" parse)
-   (dolist (production-number (reverse parse))
+   (dolist (production-number parse)
  (let ((production
 (phps-mode-parser--get-grammar-production-by-number
  production-number)))
@@ -129,7 +129,7 @@
(lambda()
  (let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation:\n%S\n" parse)
-   (dolist (production-number (reverse parse))
+   (dolist (production-number parse)
  (let ((production
 (phps-mode-parser--get-grammar-production-by-number
  production-number)))
@@ -150,7 +150,7 @@
(lambda()
  (let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation:\n%S\n" parse)
-   (dolist (production-number (reverse parse))
+   (dolist (production-number parse)
  (let ((production
 (phps-mode-parser--get-grammar-production-by-number
  production-number)))
@@ -171,7 +171,7 @@
(lambda()
  (let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation:\n%S\n" parse)
-   (dolist (production-number (reverse parse))
+   (dolist (production-number parse)
  (let ((production
 (phps-mode-parser--get-grammar-production-by-number
  production-number)))
@@ -192,7 +192,7 @@
(lambda()
  (let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation:\n%S\n" parse)
-   (dolist (production-number (reverse parse))
+   (dolist (production-number parse)
  (let ((production
 (phps-mode-parser--get-grammar-production-by-number
  production-number)))
@@ -213,7 +213,7 @@
(lambda()
  (let ((parse (phps-mode-parser-parse)))
(message "Left-to-right with right-most derivation:\n%S\n" parse)
-   (dolist (production-number (reverse parse))
+   (dolist (production-number parse)
  (let ((production
 (phps-mode-parser--get-grammar-production-by-number
  production-number)))



[elpa] externals/phps-mode 787aaa2bb4 081/135: Passing another bookkeeping test

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 787aaa2bb48e32338b8416a74269b4b3bc94a46d
Author: Christian Johansson 
Commit: Christian Johansson 

Passing another bookkeeping test
---
 test/phps-mode-test-ast.el | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index da96e06aee..51c7758fd9 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -283,15 +283,15 @@
"Bookkeeping in arrow functions"
'((" id $y" ((7 9))) ((7 9) 1) (" id $fn1" ((15 19))) (" arrow 1 id $x" 
((25 27))) ((25 27) 1) ((37 39) 1) ((32 34) 1) ((15 19) 1) (" id $z" ((41 43))) 
((41 43) 1) (" id $fn" ((49 52))) (" arrow 3 id $x2" ((58 61))) (" arrow 2 id 
$y2" ((69 72))) ((58 61) 1) ((69 72) 1) ((89 91) 1) ((83 86) 1) ((77 80) 1) 
((49 52) 1) (" arrow 4 id $x3" ((102 105))) ((102 105) 1) ((110 113) 1) (" id 
$x4" ((115 118))) ((115 118) 1) ((144 147) 1) (" arrow 6 id $x5" ((152 155))) 
((152 155) 1) ((165 168) 1) [...]
 
-  (phps-mode-test-ast--should-bookkeep
-   " 'random');\nif ($z->name) {\necho 
'Hit';\n}"
-   "Bookkeeping ignoring variable properties"
-   '((" id $z" 1) ((7 9) 1) ((52 54) 1)))
+  ;; (phps-mode-test-ast--should-bookkeep
+  ;;  " 'random');\nif ($z->name) {\n
echo 'Hit';\n}"
+  ;;  "Bookkeeping ignoring variable properties"
+  ;;  '((" id $z" 1) ((7 9) 1) ((52 54) 1)))
 
   (phps-mode-test-ast--should-bookkeep
"

[elpa] externals/phps-mode e6bc401d0b 068/135: Work on improving test for global variable bookkeeping

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit e6bc401d0bd601431310c06528d0356c8a1726b9
Author: Christian Johansson 
Commit: Christian Johansson 

Work on improving test for global variable bookkeeping
---
 phps-mode-parser-sdt.el| 30 --
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 29 insertions(+), 3 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 9d4866167a..c79fdef75a 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -647,6 +647,11 @@
 (setq function space-name))
((equal space-type 'anonymous-function)
 (setq anonymous-function space-name))
+   ((equal space-type 'global)
+(setq namespace nil)
+(setq class nil)
+(setq function nil)
+(setq anonymous-function nil))
((equal space-type 'object-operator)
 (let ((downcased-space-name
(downcase space-name)))
@@ -1694,12 +1699,33 @@
 (puthash
  155
  (lambda(args _terminals)
+   (let ((global-var-list (nth 1 args)))
+ (dolist (global-var global-var-list)
+   (let ((global-var-type (plist-get global-var 'ast-type)))
+ (cond
+  ((equal global-var-type 'simple-variable-variable)
+   (let ((variable-name (plist-get global-var 'variable))
+ (variable-start (plist-get global-var 'ast-start))
+ (variable-end (plist-get global-var 'ast-end)))
+ (push
+  (list
+   variable-name
+   phps-mode-parser-sdt--bookkeeping-namespace
+   variable-start
+   variable-end)
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+ (push
+  (list
+   variable-name
+   '((global))
+   variable-start
+   variable-end)
+  phps-mode-parser-sdt--bookkeeping-symbol-stack)))
`(
  ast-type
  global-statement
  global-var-list
- ,(nth 1 args)
- ))
+ ,(nth 1 args)))
  phps-mode-parser--table-translations)
 
 ;; 156 ((statement) (T_STATIC static_var_list ";"))
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 15621b146a..e21aff41eb 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -274,7 +274,7 @@
'((" id $bandom" ((18 25))) (" id $random" ((9 16))) ((18 25) 1) ((9 16) 1) 
((45 52) 1) ((78 85) 1)))
 
   (phps-mode-test-ast--should-bookkeep
-   "

[elpa] externals/phps-mode 7a3b86b11d 011/135: Added SDT for all statements

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 7a3b86b11d2adf950a6785e0633740037288a853
Author: Christian Johansson 
Commit: Christian Johansson 

Added SDT for all statements
---
 phps-mode-ast-bookkeeping.el |   4 +-
 phps-mode-parser-sdt.el  | 208 +++
 2 files changed, 155 insertions(+), 57 deletions(-)

diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index eb92db8cf9..e4fd2b2b9e 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -275,12 +275,12 @@
 ;; Set global namespace (if any)
 (when global-namespace
   (let ((had-scope-p scope))
-(when had-scopep
+(when had-scope-p
   (setq scope (reverse scope)))
 (push
  (list 'type 'namespace 'name global-namespace)
  scope)
-(when had-scopep
+(when had-scope-p
   (setq scope (reverse scope)
 
 (let ((type (plist-get item 'ast-type)))
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 532f637032..a68fe8ca25 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -949,7 +949,7 @@
`(
  ast-type
  attribute-group
- children
+ attribute-decl
  (,args)
  ))
  phps-mode-parser--table-translations)
@@ -961,7 +961,7 @@
`(
  ast-type
  attribute-group
- children
+ attribute-group
  ,(append (plist-get (nth 0 args) 'ast-type) (list (nth 2 args)))
  ))
  phps-mode-parser--table-translations)
@@ -973,7 +973,7 @@
`(
  ast-type
  attribute
- children
+ attribute-group
  ,(nth 1 args)
  ))
  phps-mode-parser--table-translations)
@@ -985,7 +985,7 @@
`(
  ast-type
  attributes
- children
+ attributes
  (,attribute)
  ))
  phps-mode-parser--table-translations)
@@ -997,7 +997,7 @@
`(
  ast-type
  attributes
- children
+ attributes
  ,(append (plist-get (nth 0 args) 'children) (list (nth 1 args)))
  ))
  phps-mode-parser--table-translations)
@@ -1062,7 +1062,7 @@
  ,(car (cdr (nth 2 terminals)))
  end
  ,(car (cdr (nth 4 terminals)))
- children
+ top-statement-list
  ,(nth 3 args)
  ))
  phps-mode-parser--table-translations)
@@ -1080,7 +1080,7 @@
  ,(car (cdr (nth 1 terminals)))
  end
  ,(car (cdr (nth 3 terminals)))
- children
+ top-statement-list
  ,(nth 2 args)
  ))
  phps-mode-parser--table-translations)
@@ -1360,53 +1360,97 @@
(nth 1 args))
  phps-mode-parser--table-translations)
 
-;; statement -> (T_WHILE "(" expr ")" while_statement)
+;; 146 ((statement) (if_stmt))
+(puthash 146 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 147 ((statement) (alt_if_stmt))
+(puthash 147 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
+
+;; 148 (T_WHILE "(" expr ")" while_statement))
 (puthash
  148
  (lambda(args _terminals)
`(
  ast-type
- while
- condition
- ,(phps-mode-parser-sdt--get-list-of-object (nth 2 args))
- children
- ,(phps-mode-parser-sdt--get-list-of-object (nth 4 args)))
+ while-statement
+ expr
+ ,(nth 2 args)
+ while-statement
+ ,(nth 4 args))
)
  phps-mode-parser--table-translations)
 
-;; statement -> (T_DO statement T_WHILE "(" expr ")" ";")
+;; 149 ((statement) (T_DO statement T_WHILE "(" expr ")" ";"))
 (puthash
  149
  (lambda(args _terminals)
`(
  ast-type
- do-while
- children
- ,(phps-mode-parser-sdt--get-list-of-object (nth 1 args))
- condition
- ,(phps-mode-parser-sdt--get-list-of-object (nth 4 args))
+ do-statement
+ statement
+ ,(nth 1 args)
+ expr
+ ,(nth 4 args)
  ))
  phps-mode-parser--table-translations)
 
-;; statement -> (T_FOR "(" for_exprs ";" for_exprs ";" for_exprs ")" 
for_statement)
+;; 150 (T_FOR "(" for_exprs ";" for_exprs ";" for_exprs ")" for_statement))
 (puthash
  150
  (lambda(args _terminals)
`(
  ast-type
- for
+ for-statement
  initial
- ,(phps-mode-parser-sdt--get-list-of-object (nth 2 args))
+ ,(nth 2 args)
  test
- ,(phps-mode-parser-sdt--get-list-of-object (nth 4 args))
+ ,(nth 4 args)
  incremental
- ,(phps-mode-parser-sdt--get-list-of-object (nth 6 args))
- children
- ,(phps-mode-parser-sdt--get-list-of-object (nth 8 args))
+ ,(nth 6 args)
+ for-statement
+ ,(nth 8 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 151 ((statement) (T_SWITCH "(" expr ")" switch_case_list))
+(puthash
+ 151
+ (lambda(args _terminals)
+   `(
+ ast-type
+ switch-statement
+ expr
+ ,(nth 2 args)
+ switch-case-list
+ ,(nth 4 args)
  ))
  phps-mode-parser--table-translations)
 
-;; statement -> (T_RETURN optional_expr ";")
+;; 152 ((statement) (T_BREAK optional_expr ";"))
+(puthash
+ 152
+ (lambda(args _terminals)
+   `(
+ ast-type
+ b

[elpa] externals/phps-mode 7609f09f04 090/135: More bookkeeping final touches

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 7609f09f043627f9ff487b8eb358d65224822b99
Author: Christian Johansson 
Commit: Christian Johansson 

More bookkeeping final touches
---
 phps-mode-parser-sdt.el| 40 
 test/phps-mode-test-ast.el |  6 --
 2 files changed, 32 insertions(+), 14 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 7904d8ccf4..5054cbacac 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -667,13 +667,14 @@
  (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
+(when (equal next-scope-index (1+ scope-index))
+  (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)))
 
@@ -3323,6 +3324,7 @@
   (attributed-class-statement-type
(plist-get attributed-class-statement 'ast-type)))
  (cond
+  ;; Property
   ((equal attributed-class-statement-type 'property)
(let ((property-list
   (plist-get attributed-class-statement 'subject))
@@ -3336,7 +3338,9 @@
(let ((property-type
   (plist-get property 'ast-type)))
  (cond
-  ((equal property-type 'property-variable)
+  ((or
+(equal property-type 'property-variable)
+(equal property-type 'property-assigned-variable))
(let ((symbol-name
   (plist-get property 'variable))
  (symbol-start
@@ -3353,7 +3357,14 @@
symbol-scope
symbol-start
symbol-end)
-  
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+ (push
+  (list
+   symbol-name
+   symbol-scope
+   symbol-start
+   symbol-end)
+  phps-mode-parser-sdt--bookkeeping-symbol-stack
 
   ;; Method Declaration
   ((equal attributed-class-statement-type 'method)
@@ -3400,8 +3411,6 @@
(plist-get attributed-class-statement 'ast-end))
   phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
 
-   ;; TODO if we have a arrow function scope function should come 
before it (to the right)
-
;; Add function scope to symbol assignments
(when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
  (dolist (
@@ -3470,7 +3479,14 @@
  symbol-scope
  symbol-start
  symbol-end)
-
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)))
+phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+   (push
+(list
+ symbol-name
+ symbol-scope
+ symbol-start
+ symbol-end)
+phps-mode-parser-sdt--bookkeeping-symbol-stack)))
 
`(
  ast-type
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 091167e56a..f5c1c25482 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -236,7 +236,7 @@
   (phps-mode-test-ast--should-bookkeep
" $value) {\nif ($key || $value) {\necho 'Hit';\n  
  }\n}\nfor ($i = 0; $i < count($items); $i++) {\nif ($i) {\necho 
'Hit';\n}\n}\nif ($a = 123) {\nif ($a) {\necho 'Hit';\n
}\n}\nwhile ($b = 123) {\nif ($a) {\necho 'Hit';\n}\n}\ndo {\n  
  echo 'Hit';\n} while ( [...]
@@ -246,7 +246,7 @@
   (phps-mode-test-ast--should-bookkeep
"var1) {\necho 
'Hit';\n}\nif (self::$var1) {\necho 'Miss';\n   
 }\nif (self::$va

[elpa] externals/phps-mode a10656fc34 070/135: Passing bookkeeping test for global variables

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit a10656fc343a2298004d699fcc5576135e83c15b
Author: Christian Johansson 
Commit: Christian Johansson 

Passing bookkeeping test for global variables
---
 phps-mode-parser-sdt.el| 38 +++---
 test/phps-mode-test-ast.el |  4 ++--
 2 files changed, 25 insertions(+), 17 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 6fe350a325..1b1470 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -752,11 +752,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
@@ -811,14 +811,15 @@
  symbol-hit
  phps-mode-parser-sdt-bookkeeping)
 
-(message
- "reference symbol uri: %S from %S + %S, start: %S, end: %S, hit?: %S"
- symbol-uri
- symbol-name
- symbol-scope
- symbol-start
- symbol-end
- symbol-hit)))
+;; (message
+;;  "reference symbol uri: %S from %S + %S, start: %S, end: %S, hit?: 
%S"
+;;  symbol-uri
+;;  symbol-name
+;;  symbol-scope
+;;  symbol-start
+;;  symbol-end
+;;  symbol-hit)
+))
 (setq
  phps-mode-parser-sdt--bookkeeping-symbol-stack
  nil)))
@@ -1976,7 +1977,7 @@
 (puthash
  179
  (lambda(args terminals)
-   ;; (message "parameter_list-args: %S" (nth 5 args))
+   ;; (message "179-parameter_list-args: %S" (nth 5 args))
;; (message "parameter_list-terminals: %S" (nth 5 terminals))
 
;; Iterate optional parameters are declare them as new variable declarations
@@ -2005,7 +2006,14 @@
symbol-scope
symbol-start
symbol-end)
-  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)))
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+ (push
+  (list
+   symbol-name
+   symbol-scope
+   symbol-start
+   symbol-end)
+  phps-mode-parser-sdt--bookkeeping-symbol-stack)))
 
;; (message "before:")
;; (message
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index e21aff41eb..6248d3ae05 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -226,7 +226,7 @@
   (phps-mode-test-ast--should-bookkeep
" $x + $y;\n$z = 1;\n$fn = fn($x2) => 
fn($y2) => $x2 * $y2 + $z;\nfn(array $x3) => $x3;\n$x4 = 4;\nstatic fn(): int 
=> $x4;\nfn($x5 = 42) => $x5;\nfn(&$x6) => $x6;\nfn&($x7) => $x7;\nfn($x8, 
...$rest) => $rest;"



[elpa] externals/phps-mode dbaf508512 052/135: Work on getting bookkeeping for class properties working

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit dbaf508512060a34c751a526b08822bfce06261d
Author: Christian Johansson 
Commit: Christian Johansson 

Work on getting bookkeeping for class properties working
---
 phps-mode-parser-sdt.el | 95 +++--
 1 file changed, 77 insertions(+), 18 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 5b3fbfd2bd..6416030b93 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2930,14 +2930,14 @@
  ast-start
  ,(car (cdr terminals))
  ast-end
- ,(cdr (cdr terminals))
- ))
+ ,(cdr (cdr terminals
  phps-mode-parser--table-translations)
 
 ;; 295 ((static_var) (T_VARIABLE "=" expr))
 (puthash
  295
  (lambda(args terminals)
+   ;; TODO Should bookkeep here
`(
  ast-type
  variable
@@ -2950,8 +2950,7 @@
  ast-start
  ,(car (cdr (nth 0 terminals)))
  ast-end
- ,(cdr (cdr (nth 0 terminals)))
- ))
+ ,(cdr (cdr (nth 0 terminals)
  phps-mode-parser--table-translations)
 
 ;; 296 ((class_statement_list) (class_statement_list class_statement))
@@ -2994,6 +2993,7 @@
 (puthash
  299
  (lambda(args terminals)
+   ;; TODO Bookkeep class constants here
`(
  ast-type
  constant
@@ -3004,8 +3004,7 @@
  ast-start
  ,(car (cdr (car (nth 2 terminals
  ast-end
- ,(cdr (cdr (car (nth 2 terminals
- ))
+ ,(cdr (cdr (car (nth 2 terminals))
  phps-mode-parser--table-translations)
 
 ;; 300 ((attributed_class_statement) (method_modifiers function returns_ref 
identifier backup_doc_comment "(" parameter_list ")" return_type 
backup_fn_flags method_body backup_fn_flags))
@@ -3106,28 +3105,84 @@
 (puthash
  302
  (lambda(args _terminals)
+   (let* ((attributed-class-statement
+   args)
+  (attributed-class-statement-type
+   (plist-get attributed-class-statement 'ast-type)))
+ (cond
+  ((equal attributed-class-statement-type 'property)
+   (let ((property-list
+  (plist-get attributed-class-statement 'subject)))
+ (dolist (property property-list)
+   (let ((property-type
+  (plist-get property 'ast-type)))
+ (cond
+  ((equal property-type 'property-variable)
+   ;; TODO Bookkeep proerty-variable here
+   (let ((symbol-name
+  (plist-get property 'variable))
+ (symbol-start
+  (plist-get property 'ast-start))
+ (symbol-end
+  (plist-get property 'ast-end))
+ (symbol-scope
+  phps-mode-parser-sdt--bookkeeping-namespace))
+ (push
+  (list
+   symbol-name
+   symbol-scope
+   symbol-start
+   symbol-end)
+  
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
+
`(
  ast-type
  class-statement
  attributed-class-statement
- ,args
- )
-   )
+ ,args))
  phps-mode-parser--table-translations)
 
 ;; 303 ((class_statement) (attributes attributed_class_statement))
 (puthash
  303
  (lambda(args _terminals)
+   (let* ((attributed-class-statement
+   (nth 1 args))
+  (attributed-class-statement-type
+   (plist-get attributed-class-statement 'ast-type)))
+ (cond
+  ((equal attributed-class-statement-type 'property)
+   (let ((property-list
+  (plist-get attributed-class-statement 'subject)))
+ (dolist (property property-list)
+   (let ((property-type
+  (plist-get property 'ast-type)))
+ (cond
+  ((equal property-type 'property-variable)
+   ;; TODO Bookkeep proerty-variable here
+   (let ((symbol-name
+  (plist-get property 'variable))
+ (symbol-start
+  (plist-get property 'ast-start))
+ (symbol-end
+  (plist-get property 'ast-end))
+ (symbol-scope
+  phps-mode-parser-sdt--bookkeeping-namespace))
+ (push
+  (list
+   symbol-name
+   symbol-scope
+   symbol-start
+   symbol-end)
+  
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
+
`(
  ast-type
  class-statement
  attributes
  ,(nth 0 args)
  attributed-class-statement
- ,(nth 1 args)
- )
-   )
+ ,(nth 1 args)))
  phps-mode-parser--table-translations)
 
 ;; 304 ((class_statement) (T_USE class_name_list trait_adaptations))
@@ -3140,9 +3195,7 @@
  class-name-list
  ,(nth 1 args)
  trait-adaptations
- ,(nth 2 args)
- )
-   )
+ ,(nth 2 args)))
  phps-mode-parser--table-translations)
 
 ;; 305 ((class_name_list

[elpa] externals/phps-mode 911abb044e 024/135: SDT method_body

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 911abb044e5553b22044b50c0fefa3d47b90de88
Author: Christian Johansson 
Commit: Christian Johansson 

SDT method_body
---
 phps-mode-parser-sdt.el | 49 ++---
 1 file changed, 38 insertions(+), 11 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 53e7f56572..a32b476a0d 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2805,25 +2805,52 @@
  )
phps-mode-parser--table-translations))
 
+;; 319 ((trait_method_reference) (identifier))
+(puthash
+ 319
+ (lambda(args _terminals)
+   `(
+ ast-type
+ trait-method-reference-identifier
+ identifier
+ ,args)
+   )
+ phps-mode-parser--table-translations)
 
-;; TODO WAS HERE
-
-
-
-;; method_body -> (";")
+;; 320 ((trait_method_reference) (absolute_trait_method_reference))
 (puthash
- 322
- (lambda(_args _terminals)
-   nil)
+ 320
+ (lambda(args _terminals)
+   `(
+ ast-type
+ trait-method-reference-absolute
+ absolute-trait-method-reference
+ ,args)
+   )
  phps-mode-parser--table-translations)
 
-;; method_body -> ("{" inner_statement_list "}")
+;; 321 ((absolute_trait_method_reference) (class_name T_PAAMAYIM_NEKUDOTAYIM 
identifier))
 (puthash
- 323
+ 321
  (lambda(args _terminals)
-   (nth 1 args))
+   `(
+ ast-type
+ absolute-trait-method-reference
+ class-name
+ ,(nth 0 args)
+ member
+ ,(nth 2 args)
+ ))
  phps-mode-parser--table-translations)
 
+;; 322 ((method_body) (";"))
+(puthash 322 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 323 ((method_body) ("{" inner_statement_list "}"))
+(puthash 323 (lambda(args _terminals) (nth 1 args)) 
phps-mode-parser--table-translations)
+
+;; TODO Was here
+
 ;; variable_modifiers -> (T_VAR)
 (puthash
  325



[elpa] externals/phps-mode 807c834649 116/135: More work on imenu generation

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 807c834649ff52ed2ae9bc76de4f5c84159d3cb8
Author: Christian Johansson 
Commit: Christian Johansson 

More work on imenu generation
---
 phps-mode-ast.el| 37 +
 phps-mode-parser-sdt.el |  2 +-
 2 files changed, 34 insertions(+), 5 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 2315456a83..dbe79d0d72 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -75,10 +75,39 @@
 (phps-mode-debug-message
  (message "\nTranslation:\n%S\n\n" translation))
 
-;; TODO Build imenu  in `phps-mode-parser-sdt-symbol-imenu' by collecting:
-;; * `phps-mode-parser-sdt-symbol-imenu--classes'
-;; * `phps-mode-parser-sdt-symbol-imenu--functions'
-;; * `phps-mode-parser-sdt-symbol-imenu--namespaces'
+;; Convert imenu index from hash-table to list structure here
+(let ((imenu-index))
+  (maphash
+   (lambda (k v)
+ (if (hash-table-p v)
+ (let ((v-list))
+   (maphash
+(lambda (k2 v2)
+  (if hash-table-p v2
+(let ((v2-list))
+  (maphash
+   (lambda (k3 v3)
+ (push
+  `(,k3 . ,v3)
+  v2-list))
+   v2)
+  (push
+   `(,k2 ,v2-list)
+   v-list))
+(push
+ `(,k2 . ,v2)
+ v-list)))
+v)
+   (push
+`(,k ,v-list)
+imenu-index))
+   (push
+`(,k . ,v)
+imenu-index)))
+   phps-mode-parser-sdt-symbol-imenu--table)
+  (setq
+   phps-mode-parser-sdt-symbol-imenu
+   imenu-index))
 
 (setq
  phps-mode-ast--tree
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 016dce133f..48f9e5ad52 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -915,7 +915,7 @@
 ;; Collect namespace, class, interface, trait and function here
 (dolist (symbol-scope-item symbol-scope)
   (let ((symbol-scope-item-type (nth 0 symbol-scope))
-(symbol-scope-item-name (nth 1 symbol-scop)))
+(symbol-scope-item-name (nth 1 symbol-scope)))
 (cond
  ((equal symbol-scope-item-type 'namespace)
   (setq symbol-namespace symbol-scope-item-name))



[elpa] externals/phps-mode 34a595fa09 028/135: SDT class_const_list

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 34a595fa0924de892f1d2c3889b7334a4b5ec2fb
Author: Christian Johansson 
Commit: Christian Johansson 

SDT class_const_list
---
 phps-mode-parser-sdt.el | 30 ++
 1 file changed, 30 insertions(+)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 17f4876e32..ce52e16b60 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2929,6 +2929,36 @@
  ))
  phps-mode-parser--table-translations)
 
+;; 341 ((class_const_list) (class_const_list "," class_const_decl))
+(puthash
+ 341
+ `(lambda(args _terminals)
+(append ,(nth 1 args) ,(nth 3 args)))
+ phps-mode-parser--table-translations)
+
+;; 342 ((class_const_list) (class_const_decl))
+(puthash
+ 342
+ (lambda(args _terminals)
+(list args))
+ phps-mode-parser--table-translations)
+
+;; 343 ((class_const_decl) (identifier "=" expr backup_doc_comment))
+(puthash
+ 343
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-assignment
+ ast-identifier
+ ,(nth 0 args)
+ ast-expr
+ ,(nth 2 args)
+ ast-backup-expression
+ ,(nth 3 args)))
+ phps-mode-parser--table-translations)
+
+
 ;; TODO Was here
 
 ;; expr -> ("[" array_pair_list "]" "=" expr)



[elpa] externals/phps-mode e74d0fd634 010/135: SDT for inner_statement

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit e74d0fd634a722cebc26430c498f59a3d137e6cd
Author: Christian Johansson 
Commit: Christian Johansson 

SDT for inner_statement
---
 phps-mode-ast-bookkeeping.el | 39 ---
 phps-mode-parser-sdt.el  | 90 ++--
 test/phps-mode-test-ast.el   | 18 +
 3 files changed, 123 insertions(+), 24 deletions(-)

diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index c4675fc559..eb92db8cf9 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -254,7 +254,8 @@
 (bookkeeping-objects)
 (inline-function-count 0)
 (arrow-function-count 0)
-(defined-count 0))
+(defined-count 0)
+(global-namespace))
 (while bookkeeping-stack
   (let ((item-raw (pop bookkeeping-stack))
 (item)
@@ -271,6 +272,17 @@
item
item-raw))
 
+;; Set global namespace (if any)
+(when global-namespace
+  (let ((had-scope-p scope))
+(when had-scopep
+  (setq scope (reverse scope)))
+(push
+ (list 'type 'namespace 'name global-namespace)
+ scope)
+(when had-scopep
+  (setq scope (reverse scope)
+
 (let ((type (plist-get item 'ast-type)))
   (cond
 
@@ -472,9 +484,10 @@
 (let ((name (plist-get item 'name))
   (sub-scope scope))
   (push `(type namespace name ,name) sub-scope)
-  (when-let ((children (reverse (plist-get item 'children
-(dolist (child children)
-  (push `(,sub-scope ,child) bookkeeping-stack)
+  (if-let ((children (reverse (plist-get item 'children
+  (dolist (child children)
+(push `(,sub-scope ,child) bookkeeping-stack))
+(setq global-namespace name
 
((equal type 'class)
 (let ((name (plist-get item 'name))
@@ -931,7 +944,7 @@
 
(phps-mode-ast-bookkeeping--generate-symbol-scope-string
  sub-scope
  property-name))
-   (bookkeeping-object
+   (bookkeeping-object2
 (list
  object-start
  object-end))
@@ -956,11 +969,11 @@
t)))
   (if predefined
   (puthash
-   bookkeeping-object
+   bookkeeping-object2
1
bookkeeping)
 (puthash
- bookkeeping-object
+ bookkeeping-object2
  0
  bookkeeping)
 
@@ -1047,7 +1060,7 @@
 
(phps-mode-ast-bookkeeping--generate-symbol-scope-string
  sub-scope
  property-name))
-   (bookkeeping-object
+   (bookkeeping-object2
 (list
  object-start
  object-end))
@@ -1072,11 +1085,11 @@
t)))
   (if predefined
   (puthash
-   bookkeeping-object
+   bookkeeping-object2
1
bookkeeping)
 (puthash
- bookkeeping-object
+ bookkeeping-object2
  0
  bookkeeping)
 
@@ -1159,7 +1172,7 @@
  sub-scope
  object-name
  t))
-   (bookkeeping-object
+   (bookkeeping-object2
 (list
  object-start
  object-end))
@@ -1180,11 +1193,11 @@
t)))
   (if predefined
   (puthash
-   bookkeeping-object
+   bookkeeping-object2
1
bookkeeping)
 (puthash
- bookkeeping-object
+ bookkeeping-object2
  0
  bookkeeping)
 
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index bfe93e9c30..532f637032 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1251,15 +1251,84 @@
 
 ;; 131 ((inline_use_declaration) (unprefixed_use_declaration))
 (puthash
- 130
+ 131
  (lambda(a

[elpa] externals/phps-mode 002b27bfb7 054/135: Started on bookkeeping support via SDT for class properties via object operator

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 002b27bfb7ce0f7f5f75a59639cc2a22b30e3658
Author: Christian Johansson 
Commit: Christian Johansson 

Started on bookkeeping support via SDT for class properties via object 
operator
---
 phps-mode-parser-sdt.el | 10 ++
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index cdbed20839..87670c476d 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -3689,14 +3689,15 @@
  ))
  phps-mode-parser--table-translations)
 
-;; 356 ((echo_expr_list) (echo_expr_list "," echo_expr))
+;; 356 ((expr) (variable))
 (puthash
  356
  (lambda(args _terminals)
`(
  ast-type
- echo-expr-list
- ,(append (list (nth 0 args)) (list (nth 2 args)
+ expr-variable
+ variable
+ ,args))
  phps-mode-parser--table-translations)
 
 ;; 357 ((expr) (T_LIST "(" array_pair_list ")" "=" expr))
@@ -5640,6 +5641,7 @@
 (puthash
  513
  (lambda(args _terminals)
+   ;; TODO Add to stack variable reference here
`(
  ast-type
  variable-array-object-dereferenceable-property-name
@@ -5861,7 +5863,7 @@
  (lambda(args _terminals)
`(
  ast-type
- properyt-name-string
+ property-name-string
  string
  ,args))
  phps-mode-parser--table-translations)



[elpa] externals/phps-mode 40d7d88fb8 069/135: Work on bookkeeping global variables

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 40d7d88fb883c234a2666eb4637f076dbf6b499f
Author: Christian Johansson 
Commit: Christian Johansson 

Work on bookkeeping global variables
---
 phps-mode-parser-sdt.el | 68 -
 1 file changed, 28 insertions(+), 40 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index c79fdef75a..6fe350a325 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -752,11 +752,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
@@ -788,44 +788,37 @@
  (symbol-uri
   (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)
+   symbol-scope))
+ (symbol-hit 0))
 (cond
 
  ;; Super-global variable
  ((gethash
symbol-name
phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
-  (puthash
-   (list
-symbol-start
-symbol-end)
-   1
-   phps-mode-parser-sdt-bookkeeping))
+  (setq symbol-hit 1))
 
  ;; Declared variable
  ((gethash
symbol-uri
phps-mode-parser-sdt-bookkeeping)
-  (puthash
-   (list
-symbol-start
-symbol-end)
-   1
-   phps-mode-parser-sdt-bookkeeping))
-
- ;; Undeclared variable
- (t
-  (puthash
-   (list
-symbol-start
-symbol-end)
-   0
-   phps-mode-parser-sdt-bookkeeping)
+  (setq symbol-hit 1)))
+
+(puthash
+ (list
+  symbol-start
+  symbol-end)
+ symbol-hit
+ phps-mode-parser-sdt-bookkeeping)
+
+(message
+ "reference symbol uri: %S from %S + %S, start: %S, end: %S, hit?: %S"
+ symbol-uri
+ symbol-name
+ symbol-scope
+ symbol-start
+ symbol-end
+ symbol-hit)))
 (setq
  phps-mode-parser-sdt--bookkeeping-symbol-stack
  nil)))
@@ -1699,6 +1692,8 @@
 (puthash
  155
  (lambda(args _terminals)
+   (dolist (stack-item phps-mode-parser-sdt--bookkeeping-symbol-stack)
+ (push '(global) (nth 1 stack-item)))
(let ((global-var-list (nth 1 args)))
  (dolist (global-var global-var-list)
(let ((global-var-type (plist-get global-var 'ast-type)))
@@ -1713,14 +1708,7 @@
phps-mode-parser-sdt--bookkeeping-namespace
variable-start
variable-end)
-  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
- (push
-  (list
-   variable-name
-   '((global))
-   variable-start
-   variable-end)
-  phps-mode-parser-sdt--bookkeeping-symbol-stack)))
+  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)))
`(
  ast-type
  global-statement



[elpa] externals/phps-mode d456658676 089/135: Passing bookkeeping test for $this inside arrow function

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit d4566586764e1ce3ca88e8b55e68dcac4fe849c9
Author: Christian Johansson 
Commit: Christian Johansson 

Passing bookkeeping test for $this inside arrow function
---
 phps-mode-parser-sdt.el| 76 +-
 test/phps-mode-test-ast.el |  6 ++--
 2 files changed, 51 insertions(+), 31 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 3382481f34..7904d8ccf4 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -642,30 +642,40 @@
   ;; 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
- ((equal next-scope-type 'global)
-  (setq next-scope-is-global t))
- ((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 ((next-scope-index (1+ scope-index)))
+  (setq next-scope (nth next-scope-index scope))
+  (setq next-scope-type (car next-scope))
+
+  ;; When next scope is arrow function, ignore it
+  (while (and
+  (equal next-scope-type 'arrow-function)
+  (< next-scope-index (1- scope-count)))
+(setq next-scope-index (1+ next-scope-index))
+(setq next-scope (nth next-scope-index scope))
+(setq next-scope-type (car next-scope)))
+
+  (cond
+   ((equal next-scope-type 'global)
+(setq next-scope-is-global t))
+   ((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
@@ -769,6 +779,7 @@
   (let ((potential-uri-count (length potential-uris))
 (potential-uri-index 0)
 (matching-uri))
+(message "potential-uris: %S" potential-uris)
 
 ;; Iterate potential-uris, select first match or if no match return 
the first
 (while (< potential-uri-index potential-uri-count)
@@ -3344,6 +3355,7 @@
symbol-end)
   
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
 
+  ;; Method Declaration
   ((equal attributed-class-statement-type 'method)
;; Go through stacks and modify symbol namespaces
;; - add function scope but only for:
@@ -3367,6 +3379,7 @@
'parameter-list))
  (is-static-p))
 
+ ;; Is static method?
 

[elpa] externals/phps-mode e614a20ada 066/135: Added bookkeeping for referenced foreach variables

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit e614a20ada15e5c1ddec8710a0ceb6e4cef0443b
Author: Christian Johansson 
Commit: Christian Johansson 

Added bookkeeping for referenced foreach variables
---
 phps-mode-parser-sdt.el| 49 +-
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 45 insertions(+), 6 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index a626eb02a5..a2bd37905b 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2375,8 +2375,46 @@
 ;; 205 ((foreach_variable) (ampersand variable))
 (puthash
  205
- (lambda(args _terminals)
-   ;; TODO Declare variable here
+ (lambda(args terminals)
+   ;; Save variable declaration in bookkeeping buffer
+   (let* ((variable (nth 1 args))
+  (variable-type (plist-get variable 'ast-type)))
+ (cond
+  ((equal variable-type 'variable-callable-variable)
+   (let* ((callable-variable (plist-get variable 'callable-variable))
+  (callable-variable-type (plist-get callable-variable 'ast-type)))
+ (cond
+  ((equal callable-variable-type 'callable-variable-simple-variable)
+   (let ((callable-variable-simple-variable
+  (plist-get callable-variable 'simple-variable)))
+ (let ((callable-variable-simple-variable-type
+(plist-get
+ callable-variable-simple-variable
+ 'ast-type)))
+   (cond
+((equal
+  callable-variable-simple-variable-type
+  'simple-variable-variable)
+ (let* ((variable-name
+ (plist-get
+  callable-variable-simple-variable
+  'variable))
+(symbol-name
+ variable-name)
+(symbol-start
+ (car (cdr (nth 1 terminals
+(symbol-end
+ (cdr (cdr (nth 1 terminals
+(symbol-scope
+ phps-mode-parser-sdt--bookkeeping-namespace))
+   ;; (message "declared foreach variable from terminals: %S" 
(nth 1 terminals))
+   (push
+(list
+ symbol-name
+ symbol-scope
+ symbol-start
+ symbol-end)
+
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
 
`(
  ast-type
@@ -2444,8 +2482,7 @@
  ast-type
  foreach-statement
  statement
- ,args
- ))
+ ,args))
  phps-mode-parser--table-translations)
 
 ;; 211 ((foreach_statement) (":" inner_statement_list T_ENDFOREACH ";"))
@@ -5937,7 +5974,9 @@
   (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)))
+   (setq
+namespace
+(pop phps-mode-parser-sdt--bookkeeping-namespace-stack)))
  (push
   (list
symbol-name
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 7883ec8207..b6485e2ecc 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -266,7 +266,7 @@
   (phps-mode-test-ast--should-bookkeep
" &$item2) 
{\nif ($item) {\necho 'Hit';\n}\n}"
"Bookkeeping of foreach reference variable declaration"
-   '((" id $items" 1) ((7 13) 1) ((41 47) 1) (" id $item" 1) ((52 57) 1) ((69 
74) 1) ((115 121) 1) (" id $key" 1) ((125 129) 1) (" id $item2" 1) ((134 140) 
1) ((152 157) 1)))
+   '((" id $items" ((7 13))) ((7 13) 1) (" id $item" ((52 57))) ((69 74) 1) 
((52 57) 1) ((41 47) 1) (" id $item2" ((134 140))) (" id $key" ((125 129))) 
((152 157) 1) ((134 140) 1) ((125 129) 1) ((115 121) 1)))
 
   (phps-mode-test-ast--should-bookkeep
"

[elpa] externals/phps-mode 6d3cadbdf0 104/135: More integration of new imenu and bookkeeping via SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 6d3cadbdf0c3dc02c0030a8a812cc33d2679c57c
Author: Christian Johansson 
Commit: Christian Johansson 

More integration of new imenu and bookkeeping via SDT
---
 phps-mode-ast.el  |  1 +
 phps-mode-lex-analyzer.el | 10 --
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index f73cd46f4d..7c39a818c1 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -15,6 +15,7 @@
 
 ;;; Variables:
 
+
 (defvar-local
   phps-mode-ast--parse-trail
   nil
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 320e3c12d3..dc1ec31bee 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -1147,7 +1147,9 @@
   (generate-new-buffer "*PHPs Lexer*"))
  (parse-error)
  (parse-trail)
- (ast-tree))
+ (ast-tree)
+ (bookkeeping)
+ (imenu))
 
 ;; Create temporary buffer and run lexer in it
 (when (get-buffer buffer)
@@ -1231,6 +1233,8 @@
 ;; Need to copy buffer-local values before killing buffer
 (setq parse-trail phps-mode-ast--parse-trail)
 (setq ast-tree phps-mode-ast--tree)
+(setq bookkeeping phps-mode-parser-sdt-bookkeeping)
+(setq imenu phps-mode-parser-sdt-symbol-imenu)
 
 (kill-buffer)))
 
@@ -1245,7 +1249,9 @@
 nest-location-stack
 parse-trail
 parse-error
-ast-tree)))
+ast-tree
+bookkeeping
+imenu)))
 
   ;; Save cache if possible and permitted
   (when (and



[elpa] externals/phps-mode 16a63da318 113/135: More TODO items for bookkeeping

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 16a63da318eb1bfc40371fdaf0766d650f0443c4
Author: Christian Johansson 
Commit: Christian Johansson 

More TODO items for bookkeeping
---
 test/phps-mode-test-ast.el | 453 +++--
 1 file changed, 233 insertions(+), 220 deletions(-)

diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 73544ed977..316772c8da 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -124,230 +124,243 @@
 (funcall logic)
 (message "Passed test for %S\n" name)))
 
-(defun phps-mode-test-ast-bookkeeping ()
-  "Run test for bookkeeping generation."
-  (message "-- Running tests for bookkeeping generation... --\n")
-
-  (phps-mode-test-ast--should-bookkeep
-   " $value) {\nif ($key || $value) {\necho 'Hit';\n  
  }\n}\nfor ($i = 0; $i < count($items); $i++) {\nif ($i) {\necho 
'Hit';\n}\n}\nif ($a = 123) {\nif ($a) {\necho 'Hit';\n
}\n}\nwhile ($b = 123) {\nif ($a) {\necho 'Hit';\n}\n}\ndo {\n  
  echo 'Hit';\n} while ( [...]
-   "Bookkeeping of conditional assignments"
-   '(((36 42) 1) ((97 102) 2) ((80 85) 2) ((70 76) 1) ((187 193) 3) ((179 183) 
4) ((161 167) 3) ((153 157) 4) ((143 149) 1) ((274 276) 5) ((258 260) 5) ((249 
255) 1) ((238 240) 5) ((230 232) 5) ((332 334) 6) ((312 314) 6) ((393 395) 6) 
((373 375) 7) ((457 459) 8))
-   '(("id $items" . 36) ("id $item" . 80) ("id $value" . 161) ("id $key" . 
153) ("id $i" . 230) ("id $a" . 312) ("id $b" . 373) ("id $c" . 457)))
-
-  (phps-mode-test-ast--should-bookkeep
-   "var1) {\necho 
'Hit';\n}\nif (self::$var1) {\necho 'Miss';\n   
 }\nif (self::$var2) {\necho 'Hit';\n}\nif 
(static::$var2) {\n [...]
-   "Bookkeeping of class properties"
-   '(((639 643) 0) ((632 637) 3) ((578 582) 4) ((571 576) 3) ((517 521) 5) 
((510 515) 3) ((455 460) 6) ((392 397) 6) ((330 335) 0) ((270 274) 7) ((263 
268) 3) ((208 213) 3) ((160 165) 4) ((145 150) 5) ((127 132) 6) ((93 98) 7) 
((751 756) 0))
-   '(("class myClass" . 54) ("class myClass function __construct" . 194) 
("class myClass function __construct id $this" . 194) ("class myClass id $var4" 
. 160) ("class myClass id $var3" . 145) ("class myClass static id $var2" . 127) 
("class myClass id $var1" . 93)))
-
-  (phps-mode-test-ast--should-bookkeep
-   "random();\n$this->random['abc'] = 
123;\n}\n}"
-   "Method calls should be avoided in bookkeeping"
-   '(((121 127) 0) ((114 119) 3) ((89 94) 3))
-   '(("class myClass" . 13) ("class myClass function __construct" . 79) 
("class myClass function __construct id $this" . 79)))
-
-  (phps-mode-test-ast--should-bookkeep
-   " &$item2) 
{\nif ($item) {\necho 'Hit';\n}\n}"
-   "Bookkeeping of foreach reference variable declaration"
-   '(((7 13) 1) ((69 74) 2) ((52 57) 2) ((41 47) 1) ((152 157) 2) ((134 140) 
3) ((125 129) 4) ((115 121) 1))
-   '(("id $items" . 7) ("id $item" . 52) ("id $item2" . 134) ("id $key" . 
125)))
-
-  (phps-mode-test-ast--should-bookkeep
-   " $x + $y;\n$z = 1;\n$fn = fn($x2) => 
fn($y2) => $x2 * $y2 + $z;\nfn(array $x3) => $x3;\n$x4 = 4;\nstatic fn(): int 
=> $x4;\nfn($x5 = 42) => $x5;\nfn(&$x6) => $x6;\nfn&($x7) => $x7;\nfn($x8, 
...$rest) => $rest;"
-   "Bookkeeping in arrow functions"
-   '(((7 9) 1) ((25 27) 3) ((37 39) 1) ((32 34) 3) ((15 19) 2) ((41 43) 4) 
((58 61) 6) ((69 72) 7) ((89 91) 4) ((83 86) 7) ((77 80) 6) ((49 52) 5) ((102 
105) 8) ((110 113) 8) ((115 118) 9) ((144 147) 9) ((152 155) 10) ((165 168) 10) 
((174 177) 11) ((182 185) 11) ((191 194) 12) ((199 202) 12) ((215 220) 13) 
((207 210) 14) ((225 230) 13))
-   '(("id $y" . 7) ("id $fn1" . 15) ("arrow 1 id $x" . 25) ("id $z" . 41) ("id 
$fn" . 49) ("arrow 3 id $x2" . 58) ("arrow 2 id $y2" . 69) ("arrow 4 id $x3" . 
102) ("id $x4" . 115) ("arrow 6 id $x5" . 152) ("arrow 7 id $x6" . 174) ("arrow 
8 id $x7" . 191) ("arrow 9 id $rest" . 215) ("arrow 9 id $x8" . 207)))
-
-  ;; (phps-mode-test-ast--should-bookkeep
-  ;;  " 'random');\nif ($z->name) {\n
echo 'Hit';\n}"
-  ;;  "Bookkeeping ignoring variable properties"
-  ;;  '((" id $z" 1) ((7 9) 1) ((52 54) 1)))
-
-  (phps-mode-test-ast--should-bookkeep
-   " $page)\n{\nif 
(isset($pages)) {\nif ($a) {\necho 'Hit';\n}\n  
  if ($uri) {\necho 'Hit';\n}\nif ($page) {\n   
 echo 'Hit';\n}\n}\n}\n"
-   "Bookkeeping of foreach variable inside if (isset()) block"
-   '(((8 10) 1) ((204 209) 3) ((150 154) 4) ((98 100) 1) ((75 81) 2) ((52 57) 
3) ((44 48) 4) ((38 40) 1))
-   '(("id $a" . 8) ("id $pages" . 75) ("id $page" . 52) ("id $uri" . 44)))
-
-  (phps-mode-test-ast--should-bookkeep
-   "variable) {}\n  
  if ($this->variable2) {}\nif ($this->variable3) {}\nif 
($this->variable4) {}\nif (self::$variable4) {}\nif 
(self::$variable5) {}\nif (self

[elpa] externals/phps-mode a84bfdccd3 120/135: More fighting the AST

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit a84bfdccd35456364181a18ce679261e5f9c1582
Author: Christian Johansson 
Commit: Christian Johansson 

More fighting the AST
---
 phps-mode-parser-sdt.el | 244 +++-
 1 file changed, 118 insertions(+), 126 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index b58268f7e4..f2754a8277 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -878,7 +878,7 @@
   (when
   phps-mode-parser-sdt-symbol-imenu--namespace
 (message "phps-mode-parser-sdt-symbol-imenu--namespace: %S" 
phps-mode-parser-sdt-symbol-imenu--namespace)
-(let ((imenu-nail (format "namespace %s" 
phps-mode-parser-sdt-symbol-imenu--namespace)))
+(let ((imenu-nail (format "namespace %s" (nth 0 
phps-mode-parser-sdt-symbol-imenu--namespace
   (unless
   (gethash
imenu-nail
@@ -888,10 +888,11 @@
  (make-hash-table :test 'equal)
  phps-mode-parser-sdt-symbol-imenu--table
 
+(message "\nphps-mode-parser-sdt-symbol-imenu--stack: %S" 
phps-mode-parser-sdt-symbol-imenu--stack)
   (when phps-mode-parser-sdt-symbol-imenu--stack
 ;; Go through imenu stack and add new items to imenu index
-(message "phps-mode-parser-sdt-symbol-imenu--stack: %S" 
phps-mode-parser-sdt-symbol-imenu--stack)
-(let ((imenu-namespace)
+(let ((imenu-namespace
+   phps-mode-parser-sdt-symbol-imenu--namespace)
   (imenu-class)
   (imenu-trait)
   (imenu-interface)
@@ -1132,6 +1133,8 @@
phps-mode-parser-sdt-symbol-imenu--table)))
 (setq phps-mode-parser-sdt-symbol-imenu--stack nil))
 
+  (message "phps-mode-parser-sdt-symbol-imenu--table: %S" 
phps-mode-parser-sdt-symbol-imenu--table)
+
   ;; Parse bookkeeping writes and reads at every statement terminus
   (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
 ;; Declare variables
@@ -1164,6 +1167,9 @@
   (setq symbol-interface (car (nth 7 (nth 1 symbol-uri-object)
 (when (nth 9 (nth 1 symbol-uri-object))
   (setq symbol-function (car (nth 9 (nth 1 symbol-uri-object)
+
+(message "symbol-name: %S" symbol-name)
+(message "symbol-scope: %S" symbol-scope)
 (message "symbol-namespace: %S" symbol-namespace)
 (message "symbol-class: %S" symbol-class)
 (message "symbol-trait: %S" symbol-trait)
@@ -1889,7 +1895,8 @@
 ;; 83 ((top_statement_list) (top_statement_list top_statement))
 (puthash
  83
- (lambda(args _terminals) (if (car args) (append (car args) (cdr args)) (cdr 
args)))
+ (lambda(args _terminals)
+   (if (car args) (append (car args) (cdr args)) (cdr args)))
  phps-mode-parser--table-translations)
 
 ;; 84 ((top_statement_list) (%empty))
@@ -1899,11 +1906,65 @@
 (puthash
  85
  (lambda(args terminals)
-   args)
+   (let ((name args)
+ (index (car (cdr terminals
+
+ ;; Add to imenu if not there already
+ (let ((imenu-nail (format "namespace %s" name)))
+   (unless (gethash
+imenu-nail
+phps-mode-parser-sdt-symbol-imenu--table)
+ (let ((namespace-table (make-hash-table :test 'equal)))
+   (puthash
+'declaration
+index
+namespace-table)
+   (puthash
+imenu-nail
+namespace-table
+phps-mode-parser-sdt-symbol-imenu--table
+
+ (push
+  (list 'namespace name index)
+  phps-mode-parser-sdt--bookkeeping-namespace)
+ (setq
+  phps-mode-parser-sdt-symbol-imenu--namespace
+  (list name (car (cdr terminals
+
+ args))
  phps-mode-parser--table-translations)
 
 ;; 86 ((namespace_declaration_name) (T_NAME_QUALIFIED))
-(puthash 86 (lambda(_args terminals) terminals) 
phps-mode-parser--table-translations)
+(puthash
+ 86
+ (lambda(args terminals)
+   (let ((name args)
+ (index (car (cdr terminals
+
+ ;; Add to imenu if not there already
+ (let ((imenu-nail (format "namespace %s" name)))
+   (unless (gethash
+imenu-nail
+phps-mode-parser-sdt-symbol-imenu--table)
+ (let ((namespace-table (make-hash-table :test 'equal)))
+   (puthash
+'declaration
+index
+namespace-table)
+   (puthash
+imenu-nail
+namespace-table
+phps-mode-parser-sdt-symbol-imenu--table
+
+ (push
+  (list 'namespace name index)
+  phps-mode-parser-sdt--bookkeeping-namespace)
+ (setq
+  phps-mode-parser-sdt-symbol-imenu--namespace
+  (list name (car (cdr terminals
+
+ args))
+ phps-mode-parser--table-translations)
 
 ;; 87 ((namespace_name) (T_STRING))
 (puthash 87 (lambda(args _terminals) args) 
phps-mode-parser--table-translations)
@@ -2037,7 +2098,7 @@
args)
  phps-mode-parser--table-translations)
 
-;; 109 ((top_statement) (attributed_statement))
+;; 109 ((top_statement) 

[elpa] externals/phps-mode f26c45586d 046/135: More work on bookkeeping

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit f26c45586d80af2986e5abe446976956b007167c
Author: Christian Johansson 
Commit: Christian Johansson 

More work on bookkeeping
---
 phps-mode-parser-sdt.el | 135 +---
 1 file changed, 81 insertions(+), 54 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 668ac6e88a..22422ec05f 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -611,15 +611,15 @@
   #s(hash-table size 12 test equal rehash-size 1.5 rehash-threshold 0.8125 
data ("$_GET" 1 "$_POST" 1 "$_COOKIE" 1 "$_SESSION" 1 "$_REQUEST" 1 "$GLOBALS" 
1 "$_SERVER" 1 "$_FILES" 1 "$_ENV" 1 "$argc" 1 "$argv" 1 
"$http_​response_​header" 1))
   "Hash-table of super-global variables.")
 
-(defun phps-mode-parser-sdt--get-namespaced-symbol-name (symbol-name)
-  "Get namespaced SYMBOL-NAME."
+(defun phps-mode-parser-sdt--get-namespaced-symbol-name (symbol-name scope)
+  "Get namespaced SYMBOL-NAME in SCOPE."
   (let ((namespace)
 (class)
 (interface)
 (trait)
 (function))
-(when phps-mode-parser-sdt--bookkeeping-namespace
-  (dolist (item phps-mode-parser-sdt--bookkeeping-namespace)
+(when scope
+  (dolist (item scope)
 (let ((space-type (car item))
   (space-name (car (cdr item
   (cond
@@ -689,18 +689,27 @@
 (dolist (
  symbol-list
  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
-  (let ((symbol-name (car symbol-list))
-(symbol-start (car (cdr symbol-list)))
-(symbol-end (car (cdr (cdr symbol-list)
-(if (gethash symbol-name phps-mode-parser-sdt-bookkeeping)
+  (let* ((symbol-name (car symbol-list))
+ (symbol-scope (car (cdr symbol-list)))
+ (symbol-start (car (cdr (cdr symbol-list
+ (symbol-end (car (cdr (cdr (cdr symbol-list)
+ (symbol-id
+  (phps-mode-parser-sdt--get-namespaced-symbol-name
+   symbol-name
+   symbol-scope)))
+(message "assign id: %S from %S + %S"
+ symbol-id
+ symbol-name
+ symbol-scope)
+(if (gethash symbol-id phps-mode-parser-sdt-bookkeeping)
 (puthash
- symbol-name
+ symbol-id
  (append
-  (gethash symbol-name phps-mode-parser-sdt-bookkeeping)
+  (gethash symbol-id phps-mode-parser-sdt-bookkeeping)
   (list symbol-start symbol-end))
  phps-mode-parser-sdt-bookkeeping)
   (puthash
-   symbol-name
+   symbol-id
(list
 (list
  symbol-start
@@ -711,14 +720,19 @@
  nil))
 
   (when phps-mode-parser-sdt--bookkeeping-symbol-stack
-;; Bookkeeping hit / misses of symbols here
+;; Bookkeeping hit / misses of symbol references here
 ;; TODO Should consider declaration position as well?
 (dolist (
  symbol-list
  phps-mode-parser-sdt--bookkeeping-symbol-stack)
-  (let ((symbol-name (car symbol-list))
-(symbol-start (car (cdr symbol-list)))
-(symbol-end (car (cdr (cdr symbol-list)
+  (let* ((symbol-name (car symbol-list))
+ (symbol-scope (car (cdr symbol-list)))
+ (symbol-start (car (cdr (cdr symbol-list
+ (symbol-end (car (cdr (cdr (cdr symbol-list)
+ (symbol-id
+  (phps-mode-parser-sdt--get-namespaced-symbol-name
+   symbol-name
+   symbol-scope)))
 (cond
 
  ;; Super-global variable
@@ -734,7 +748,7 @@
 
  ;; Declared variable
  ((gethash
-   symbol-name
+   symbol-id
phps-mode-parser-sdt-bookkeeping)
   (puthash
(list
@@ -1889,8 +1903,9 @@
   (attributed-parameter-name
(plist-get attributed-parameter 'ast-name))
   (symbol-name
-   (phps-mode-parser-sdt--get-namespaced-symbol-name
-attributed-parameter-name))
+   attributed-parameter-name)
+  (symbol-scope
+   phps-mode-parser-sdt--bookkeeping-namespace)
   (symbol-start
(plist-get attributed-parameter 'ast-start))
   (symbol-end
@@ -1898,19 +1913,21 @@
  (push
   (list
symbol-name
+   symbol-scope
symbol-start
symbol-end)
   phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)))
 
-   ;; (message
-   ;;  "phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack: %S"
-   ;;  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
-   ;; (message
-   ;;  "phps-mode-parser-sdt--bookkeeping-symbol-stack: %S"
-   ;;  phps-mode-parser-sdt--bookkeeping-symbol-stack)
+ 

[elpa] externals/phps-mode d5bdadc6fc 135/135: Improved installation documentation

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit d5bdadc6fc993d498db91f396f0ec1383bd96a58
Author: christian 
Commit: christian 

Improved installation documentation
---
 README.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/README.md b/README.md
index 550df3e73a..34791c6c86 100644
--- a/README.md
+++ b/README.md
@@ -109,8 +109,9 @@ Enable with:
 (setq phps-mode-async-process-using-async-el nil))
 ```
 
-### Load and configure using regular emacs-lisp with flycheck support, no 
asynchronous support
+### Install, load and configure using regular emacs-lisp with flycheck 
support, no asynchronous support
 ``` emacs-lisp
+(package-install 'phps-mode)
 (require 'phps-mode)
 (add-to-list 'auto-mode-alist '("\\.\\(php\\|phtml\\)\\'" . phps-mode))
 (phps-mode-flycheck-setup)



[elpa] externals/phps-mode b68d94ee08 030/135: More SDT rules

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit b68d94ee08f377d2f4da909447b8dff0e1bfb3fa
Author: Christian Johansson 
Commit: Christian Johansson 

More SDT rules
---
 phps-mode-parser-sdt.el | 603 +---
 1 file changed, 572 insertions(+), 31 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 7456a864f0..912864f7fa 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -3736,31 +3736,474 @@
  ))
  phps-mode-parser--table-translations)
 
-;; TODO Was here
+;; 401 ((expr) (expr T_IS_IDENTICAL expr))
+(puthash
+ 401
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-is-identical-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
 
-;; expr -> (T_STATIC inline_function)
+;; 402 ((expr) (expr T_IS_NOT_IDENTICAL expr))
 (puthash
- 436
+ 402
  (lambda(args _terminals)
`(
- 'ast-type
- 'static-inline-function
- 'inline-function
- ,(nth 1 args)
+ ast-type
+ expr-is-not-identical-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)
  ))
  phps-mode-parser--table-translations)
 
-;; inline_function -> (function returns_ref backup_doc_comment "(" 
parameter_list ")" lexical_vars return_type backup_fn_flags "{" 
inner_statement_list "}" backup_fn_flags)
+;; 403 ((expr) (expr T_IS_EQUAL expr))
+(puthash
+ 403
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-comparison-is-equal-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 404 ((expr) (expr T_IS_NOT_EQUAL expr))
+(puthash
+ 404
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-comparison-is-not-equal-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 405 ((expr) (expr "<" expr))
+(puthash
+ 405
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-comparison-is-less-than-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 406 ((expr) (expr T_IS_SMALLER_OR_EQUAL expr))
+(puthash
+ 406
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-comparison-is-less-or-equal-than-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 407 ((expr) (expr ">" expr))
+(puthash
+ 407
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-comparison-is-greater-than-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 408 ((expr) (expr T_IS_GREATER_OR_EQUAL expr))
+(puthash
+ 408
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-comparison-is-greater-or-equal-than-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 409 ((expr) (expr T_SPACESHIP expr))
+(puthash
+ 409
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-comparison-spaceship-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 410 ((expr) (expr T_INSTANCEOF class_name_reference))
+(puthash
+ 410
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-type-instance-of
+ expr-1
+ ,(nth 0 args)
+ class-name-reference
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 411 ((expr) ("(" expr ")"))
+(puthash
+ 411
+ (lambda(args _terminals)
+   (nth 1 args))
+ phps-mode-parser--table-translations)
+
+;; 412 ((expr) (new_expr))
+(puthash
+ 412
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-new-expr
+ expr
+ ,args))
+   (nth 1 args)
+ phps-mode-parser--table-translations)
+
+;; 413 ((expr) (expr "?" expr ":" expr))
+(puthash
+ 413
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-ternary-expr
+ expr-test
+ ,(nth 0 args)
+ expr-true
+ ,(nth 2 args)
+ expr-false
+ ,(nth 4 args)))
+ phps-mode-parser--table-translations)
+
+;; 414 ((expr) (expr "?" ":" expr))
+(puthash
+ 414
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-ternary-expr
+ expr-test
+ ,(nth 0 args)
+ expr-true
+ ,(nth 0 args)
+ expr-false
+ ,(nth 3 args)))
+ phps-mode-parser--table-translations)
+
+;; 415 ((expr) (expr T_COALESCE expr))
+(puthash
+ 415
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-coalesce-expr
+ expr-1
+ ,(nth 0 args)
+ expr-2
+ ,(nth 2 args)))
+ phps-mode-parser--table-translations)
+
+;; 416 ((expr) (internal_functions_in_yacc))
+(puthash
+ 416
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-internal-functions-in-yacc
+ expr-internal-functions-in-yacc
+ ,args))
+ phps-mode-parser--table-translations)
+
+;; 417 ((expr) (T_INT_CAST expr))
+(puthash
+ 417
+ (lambda(args _terminals)
+   `(
+ ast-type
+  

[elpa] externals/phps-mode ae68e19c0a 080/135: Passing bookkeeping arrow function

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit ae68e19c0ae11baef1ab7a64a75adeacde838f04
Author: Christian Johansson 
Commit: Christian Johansson 

Passing bookkeeping arrow function
---
 phps-mode-parser-sdt.el| 57 +++---
 test/phps-mode-test-ast.el |  2 +-
 2 files changed, 29 insertions(+), 30 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 6f2d4bbaa9..8537608f76 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -763,9 +763,9 @@
(format " arrow %s%s" space-name (nth 
potential-uri-index potential-uris))
new-potential-uris)
   (setq potential-uri-index (1+ potential-uri-index)))
-(setq potential-uris (append potential-uris 
new-potential-uris))
-(message "new-potential-uris: %S" new-potential-uris)
-(message "potential-uris: %S" potential-uris)
+(setq potential-uris (append new-potential-uris 
potential-uris))
+;; (message "new-potential-uris: %S" new-potential-uris)
+;; (message "potential-uris: %S" potential-uris)
 ))
 
  ;; TODO Below should alter symbol namespaces instead of build 
namespace data
@@ -782,15 +782,16 @@
   (let ((potential-uri-count (length potential-uris))
 (potential-uri-index 0)
 (matching-uri))
+
 ;; Iterate potential-uris, select first match or if no match return 
the first
 (while (< potential-uri-index potential-uri-count)
   (setf
(nth potential-uri-index potential-uris)
(format "%s id %s" (nth potential-uri-index potential-uris) name))
-  (setq potential-uri-index (1+ potential-uri-index))
   (let ((potential-uri (nth potential-uri-index potential-uris)))
 (when (gethash potential-uri phps-mode-parser-sdt-bookkeeping)
-  (setq matching-uri potential-uri
+  (setq matching-uri potential-uri)))
+  (setq potential-uri-index (1+ potential-uri-index)))
 (if matching-uri
 matching-uri
   (nth 0 potential-uris))
@@ -5192,7 +5193,6 @@
 (puthash
  440
  (lambda(args terminals)
-   ;; TODO Perform bookkeeping here
(let ((namespace
   phps-mode-parser-sdt--bookkeeping-namespace)
  (parameter-list
@@ -5206,6 +5206,27 @@
phps-mode-parser-sdt--bookkeeping-arrow-function-count)
   namespace)
 
+ ;; Go through symbol stack in scope and add namespace
+ (when phps-mode-parser-sdt--bookkeeping-symbol-stack
+   (dolist (
+symbol-list
+phps-mode-parser-sdt--bookkeeping-symbol-stack)
+ (let ((symbol-name (nth 0 symbol-list))
+   (symbol-namespace (nth 1 symbol-list))
+   (symbol-start (nth 2 symbol-list)))
+   (unless (gethash
+symbol-name
+phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
+ (let ((symbol-scope (car (cdr symbol-list
+   (push
+(list
+ 'arrow-function
+ phps-mode-parser-sdt--bookkeeping-arrow-function-count)
+symbol-scope)
+   (setcar
+(cdr symbol-list)
+symbol-scope))
+
  ;; Go through parameters and assign variables inside function
  (when parameter-list
(dolist (parameter parameter-list)
@@ -5236,29 +5257,7 @@
  namespace
  parameter-start
  parameter-end)
-phps-mode-parser-sdt--bookkeeping-symbol-stack)))
-
- ;; Go through phps-mode-parser-sdt--bookkeeping-symbol-stack in scope and 
add namespace
- (when phps-mode-parser-sdt--bookkeeping-symbol-stack
-   (dolist (
-symbol-list
-phps-mode-parser-sdt--bookkeeping-symbol-stack)
- (let ((symbol-name (nth 0 symbol-list))
-   (symbol-namespace (nth 1 symbol-list))
-   (symbol-start (nth 2 symbol-list)))
-   (unless (gethash
-symbol-name
-phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
- (let ((symbol-scope (car (cdr symbol-list
-   (push
-(list
- 'arrow-function
- phps-mode-parser-sdt--bookkeeping-arrow-function-count)
-symbol-scope)
-   (setcar
-(cdr symbol-list)
-symbol-scope)))
-
+phps-mode-parser-sdt--bookkeeping-symbol-stack
`(
  ast-type
  inline-fn
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index a824a3a67a..da96e06aee 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -281,7 +281,7 @@
   (phps-mode-test-ast--should

[elpa] externals/phps-mode 749659769c 115/135: More work on imenu generation via SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 749659769c2fed26dd6fa8665a96484c0e206e31
Author: Christian Johansson 
Commit: Christian Johansson 

More work on imenu generation via SDT
---
 phps-mode-ast.el   |   10 +-
 phps-mode-parser-sdt.el| 1139 ++--
 test/phps-mode-test-ast.el |   15 +-
 3 files changed, 679 insertions(+), 485 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 6d8a2683bb..2315456a83 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -39,14 +39,14 @@
phps-mode-parser-sdt-symbol-table-index
0)
   (setq
-   phps-mode-parser-sdt-symbol-imenu--classes
+   phps-mode-parser-sdt-symbol-imenu--table
(make-hash-table :test 'equal))
   (setq
-   phps-mode-parser-sdt-symbol-imenu--functions
-   (make-hash-table :test 'equal))
+   phps-mode-parser-sdt-symbol-imenu--namespace
+   nil)
   (setq
-   phps-mode-parser-sdt-symbol-imenu--namespaces
-   (make-hash-table :test 'equal))
+   phps-mode-parser-sdt-symbol-imenu--stack
+   nil)
   (setq
phps-mode-parser-sdt-symbol-table
(make-hash-table :test 'equal))
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 402ce7c236..016dce133f 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -612,19 +612,19 @@
   "Imenu for symbols of parse.")
 
 (defvar-local
-  phps-mode-parser-sdt-symbol-imenu--classes
+  phps-mode-parser-sdt-symbol-imenu--table
   nil
-  "Symbols inside class / interface / trait scope.")
+  "Symbols inside namespaces.")
 
 (defvar-local
-  phps-mode-parser-sdt-symbol-imenu--functions
+  phps-mode-parser-sdt-symbol-imenu--stack
   nil
-  "Symbols inside class scope.")
+  "Current imenu namespace.")
 
 (defvar-local
-  phps-mode-parser-sdt-symbol-imenu--namespaces
+  phps-mode-parser-sdt-symbol-imenu--namespace
   nil
-  "Symbols inside namespaces.")
+  "Current imenu namespace.")
 
 (defvar-local
   phps-mode-parser-sdt--bookkeeping-namespace
@@ -721,8 +721,8 @@
 (cond
 
  ((equal space-type 'namespace)
-  (setq scope-namespace (list space-name (nth 2 item)))
   (unless next-scope-is-global
+(setq scope-namespace (list space-name (nth 2 item)))
 (let ((potential-uri-count (length potential-uris))
   (potential-uri-index 0))
   (while (< potential-uri-index potential-uri-count)
@@ -735,8 +735,8 @@
 (setq potential-uri-index (1+ potential-uri-index))
 
  ((equal space-type 'class)
-  (setq scope-class (list space-name (nth 2 item)))
   (unless next-scope-is-global
+(setq scope-class (list space-name (nth 2 item)))
 (let ((potential-uri-count (length potential-uris))
   (potential-uri-index 0))
   (while (< potential-uri-index potential-uri-count)
@@ -749,8 +749,8 @@
 (setq potential-uri-index (1+ potential-uri-index))
 
  ((equal space-type 'interface)
-  (setq scope-interface (list space-name (nth 2 item)))
   (unless next-scope-is-global
+(setq scope-interface (list space-name (nth 2 item)))
 (let ((potential-uri-count (length potential-uris))
   (potential-uri-index 0))
   (while (< potential-uri-index potential-uri-count)
@@ -763,8 +763,8 @@
 (setq potential-uri-index (1+ potential-uri-index))
 
  ((equal space-type 'trait)
-  (setq scope-trait (list space-name (nth 2 item)))
   (unless next-scope-is-global
+(setq scope-trait (list space-name (nth 2 item)))
 (let ((potential-uri-count (length potential-uris))
   (potential-uri-index 0))
   (while (< potential-uri-index potential-uri-count)
@@ -777,11 +777,11 @@
 (setq potential-uri-index (1+ potential-uri-index))
 
  ((equal space-type 'function)
-  (setq scope-function (list space-name (nth 2 item)))
   (unless (or
next-scope-is-global
next-scope-is-this-object-operator
next-scope-is-self-static-member-operator)
+(setq scope-function (list space-name (nth 2 item)))
 (let ((potential-uri-count (length potential-uris))
   (potential-uri-index 0))
   (while (< potential-uri-index potential-uri-count)
@@ -836,414 +836,13 @@
 ))
 
  )))
-(setq scope-index (1+ scope-index
-
-;; Namespace
-(when scope-namespace
-  (let ((scope-uri (format "namesp

[elpa] externals/phps-mode 23ba458f20 133/135: Updated version and date for 0.4.31

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 23ba458f203a331755f3d56083c2c325b25e7134
Author: christian 
Commit: christian 

Updated version and date for 0.4.31
---
 phps-mode.el | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/phps-mode.el b/phps-mode.el
index 6a72bec4ca..3682966e87 100644
--- a/phps-mode.el
+++ b/phps-mode.el
@@ -5,8 +5,8 @@
 ;; Author: Christian Johansson 
 ;; Maintainer: Christian Johansson 
 ;; Created: 3 Mar 2018
-;; Modified: 4 Nov 2022
-;; Version: 0.4.30
+;; Modified: 29 Feb 2023
+;; Version: 0.4.31
 ;; Keywords: tools, convenience
 ;; URL: https://github.com/cjohansson/emacs-phps-mode
 



[elpa] externals/phps-mode 5080effb1d 014/135: Added TODO item

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 5080effb1db3565a5f2ff70528b7470047b0f25e
Author: Christian Johansson 
Commit: Christian Johansson 

Added TODO item
---
 phps-mode-parser-sdt.el | 1 +
 1 file changed, 1 insertion(+)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index cb1b5ee337..9e52670a92 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -585,6 +585,7 @@
 
 
 ;; TODO Remove function (phps-mode-parser-sdt--get-list-of-object)
+;; TODO Stop using children generic name
 
 
 (require 'phps-mode-parser)



[elpa] externals/phps-mode bddf800099 111/135: Added failing test

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit bddf800099b689a645cd6972f84bdb85e8b13a77
Author: Christian Johansson 
Commit: Christian Johansson 

Added failing test
---
 test/phps-mode-test-ast.el | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index e54943cbb2..751c410487 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -340,6 +340,12 @@
'(((126 134) 3) ((105 109) 5) ((78 83) 7))
'(("class Person" . 13) ("class Person function __construct") ("class 
Person function __construct id $address" . 126) ("class Person id $address" . 
126) ("class Person function __construct id $age" . 105) ("class Person id 
$age" . 105) ("class Person function __construct id $name" . 78) ("class Person 
id $name" . 78)))
 
+  (phps-mode-test-ast--should-bookkeep
+   "

[elpa] externals/phps-mode 7dcaa1df9e 034/135: Added SDT rules for all productions

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 7dcaa1df9e94148a22f4e5c40f13bf0d8d0e3d82
Author: Christian Johansson 
Commit: Christian Johansson 

Added SDT rules for all productions
---
 phps-mode-parser-sdt.el | 401 ++--
 1 file changed, 358 insertions(+), 43 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index cfe935c2ed..265bba60e9 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1148,7 +1148,7 @@
  inline-use-declarations
  ,(append (nth 0 args) (list (nth 2 args)))
  ))
-   phps-mode-parser--table-translations)
+ phps-mode-parser--table-translations)
 
 ;; 126 ((inline_use_declarations) (inline_use_declaration))
 (puthash
@@ -1159,7 +1159,7 @@
  inline-use-declarations
  ,(list (nth 1 args))
  ))
-   phps-mode-parser--table-translations)
+ phps-mode-parser--table-translations)
 
 ;; 127 ((unprefixed_use_declarations) (unprefixed_use_declarations "," 
unprefixed_use_declaration))
 (puthash
@@ -1170,7 +1170,7 @@
  unprefixed-use-declarations
  ,(append (nth 0 args) (list (nth 2 args)))
  ))
-   phps-mode-parser--table-translations)
+ phps-mode-parser--table-translations)
 
 ;; 128 ((unprefixed_use_declarations) (unprefixed_use_declaration))
 (puthash
@@ -1180,8 +1180,8 @@
  ast-type
  unprefixed-use-declarations
  ,(list args))
- )
-   phps-mode-parser--table-translations)
+   )
+ phps-mode-parser--table-translations)
 
 ;; 129 ((use_declarations) (use_declarations "," use_declaration))
 (puthash
@@ -1858,7 +1858,7 @@
  ,(nth 1 args)
  )
)
-   phps-mode-parser--table-translations)
+ phps-mode-parser--table-translations)
 
 ;; 198 ((extends_from) (%empty))
 (puthash 198 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
@@ -2568,8 +2568,8 @@
  296
  (lambda(args _terminals)
(if (car args)
- (append (car args) (cdr args))
-   (cdr args)))
+   (append (car args) (cdr args))
+ (cdr args)))
  phps-mode-parser--table-translations)
 
 ;; 297 ((class_statement_list) (%empty))
@@ -2744,8 +2744,8 @@
  ,(nth 0 args)
  instead-of
  ,(nth 2 args)
- )
-   phps-mode-parser--table-translations))
+ ))
+ phps-mode-parser--table-translations)
 
 ;; 315 ((trait_alias) (trait_method_reference T_AS T_STRING))
 (puthash
@@ -2758,8 +2758,8 @@
  ,(nth 0 args)
  as
  ,(nth 2 args)
- )
-   phps-mode-parser--table-translations))
+ ))
+ phps-mode-parser--table-translations)
 
 ;; 316 ((trait_alias) (trait_method_reference T_AS reserved_non_modifiers))
 (puthash
@@ -2772,8 +2772,8 @@
  ,(nth 0 args)
  as
  ,(nth 2 args)
- )
-   phps-mode-parser--table-translations))
+ ))
+ phps-mode-parser--table-translations)
 
 ;; 317 ((trait_alias) (trait_method_reference T_AS member_modifier identifier))
 (puthash
@@ -2788,8 +2788,8 @@
  ,(nth 2 args)
  identifier
  ,(nth 3 args)
- )
-   phps-mode-parser--table-translations))
+ ))
+ phps-mode-parser--table-translations)
 
 ;; 318 ((trait_alias) (trait_method_reference T_AS member_modifier))
 (puthash
@@ -2802,8 +2802,8 @@
  ,(nth 0 args)
  as
  ,(nth 2 args)
- )
-   phps-mode-parser--table-translations))
+ ))
+ phps-mode-parser--table-translations)
 
 ;; 319 ((trait_method_reference) (identifier))
 (puthash
@@ -2813,8 +2813,7 @@
  ast-type
  trait-method-reference-identifier
  identifier
- ,args)
-   )
+ ,args))
  phps-mode-parser--table-translations)
 
 ;; 320 ((trait_method_reference) (absolute_trait_method_reference))
@@ -2932,15 +2931,15 @@
 ;; 341 ((class_const_list) (class_const_list "," class_const_decl))
 (puthash
  341
- `(lambda(args _terminals)
-(append ,(nth 1 args) ,(nth 3 args)))
+ (lambda(args _terminals)
+   `(append ,(nth 1 args) ,(nth 3 args)))
  phps-mode-parser--table-translations)
 
 ;; 342 ((class_const_list) (class_const_decl))
 (puthash
  342
  (lambda(args _terminals)
-(list args))
+   (list args))
  phps-mode-parser--table-translations)
 
 ;; 343 ((class_const_decl) (identifier "=" expr backup_doc_comment))
@@ -3123,8 +3122,7 @@
`(
  ast-type
  echo-expr-list
- ,(append (nth 0 args) (list (nth 2 args))
- ))
+ ,(append (list (nth 0 args)) (list (nth 2 args)
  phps-mode-parser--table-translations)
 
 ;; 357 ((expr) (T_LIST "(" array_pair_list ")" "=" expr))
@@ -3163,7 +3161,7 @@
  expr-assign-variable
  variable
  ,(nth 0 args)
- ,expr
+ expr
  ,(nth 2 args)
  ast-index
  ,(car (cdr (nth 0 terminals)))
@@ -3183,7 +3181,7 @@
  expr-assign-variable-by-reference
  variable
  ,(nth 0 args)
- ,expr
+ reference
  ,(nth 2 args)
  ast-index
  ,(car (cdr (nth 0 terminals)))
@@ -3892,7 +3890,6 @@
  expr-new-expr
  expr
  ,args))
-   (nth 1 args)
  phps-mode-parser--table-translations)
 
 ;; 413 ((expr) (expr "?" expr ":" expr))
@@ -5316,49 +5313,367 @@
  ,ar

[elpa] externals/phps-mode cfcb795473 016/135: SDT for while_statement

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit cfcb79547318dbb44ba7a14b25696fcfed6ac87b
Author: Christian Johansson 
Commit: Christian Johansson 

SDT for while_statement
---
 phps-mode-parser-sdt.el | 136 
 1 file changed, 136 insertions(+)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index cc7ea74022..3699943246 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2025,6 +2025,142 @@
  ))
  phps-mode-parser--table-translations)
 
+;; 212 ((declare_statement) (statement))
+(puthash
+ 212
+ (lambda(args _terminals)
+   `(
+ ast-type
+ declare-statement
+ statement
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 213 ((declare_statement) (":" inner_statement_list T_ENDDECLARE ";"))
+(puthash
+ 213
+ (lambda(args _terminals)
+   `(
+ ast-type
+ declare-statement
+ inner-statement-list
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 214 ((switch_case_list) ("{" case_list "}"))
+(puthash 214 (lambda(args _terminals) (nth 1 args)) 
phps-mode-parser--table-translations)
+
+;; 215 ((switch_case_list) ("{" ";" case_list "}"))
+(puthash 214 (lambda(args _terminals) (nth 2 args)) 
phps-mode-parser--table-translations)
+
+;; 216 ((switch_case_list) (":" case_list T_ENDSWITCH ";"))
+(puthash 214 (lambda(args _terminals) (nth 1 args)) 
phps-mode-parser--table-translations)
+
+;; 217 ((switch_case_list) (":" ";" case_list T_ENDSWITCH ";"))
+(puthash 217 (lambda(args _terminals) (nth 2 args)) 
phps-mode-parser--table-translations)
+
+;; 218 ((case_list) (%empty))
+(puthash 218 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 219 ((case_list) (case_list T_CASE expr case_separator 
inner_statement_list))
+(puthash
+ 219
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-case-list
+ expr
+ ,(nth 2 args)
+ inner-statement-list
+ ,(nth 4 args)))
+ phps-mode-parser--table-translations)
+
+;; 220 ((case_list) (case_list T_DEFAULT case_separator inner_statement_list))
+(puthash
+ 220
+ (lambda(args _terminals)
+   `(
+ ast-type
+ default-case-list
+ inner-statement-list
+ ,(nth 3 args)))
+ phps-mode-parser--table-translations)
+
+;; 221 ((case_separator) (":"))
+(puthash 221 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 222 ((case_separator) (":"))
+(puthash 222 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 223 ((match) (T_MATCH "(" expr ")" "{" match_arm_list "}"))
+(puthash
+ 223
+ (lambda(args _terminals)
+   `(
+ ast-type
+ match
+ expr
+ ,(nth 2 args)
+ match-arm-list
+ ,(nth 5 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 224 ((match_arm_list) (%empty))
+(puthash 224 (lambda(_args _terminals) nil) 
phps-mode-parser--table-translations)
+
+;; 225 ((match_arm_list) (non_empty_match_arm_list possible_comma))
+(puthash 225 (lambda(args _terminals) (nth 0 args)) 
phps-mode-parser--table-translations)
+
+;; 226 ((non_empty_match_arm_list) (match_arm))
+(puthash 226 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
+
+;; 227 ((non_empty_match_arm_list) (non_empty_match_arm_list "," match_arm))
+(puthash
+ 227
+ (lambda(args _terminals)
+   (append (nth 0 args) (list (nth 2 args
+ phps-mode-parser--table-translations)
+
+;; 228 ((match_arm) (match_arm_cond_list possible_comma T_DOUBLE_ARROW expr))
+(puthash
+ 228
+ (lambda(args _terminals)
+   `(
+ ast-type
+ cond-match-arm
+ match-arm-cond-list
+ ,(nth 0 args)
+ expr
+ ,(nth 3 args)))
+ phps-mode-parser--table-translations)
+
+;; 229 ((match_arm) (T_DEFAULT possible_comma T_DOUBLE_ARROW expr))
+(puthash
+ 229
+ (lambda(args _terminals)
+   `(
+ ast-type
+ default-match-arm
+ expr
+ ,(nth 3 args)))
+ phps-mode-parser--table-translations)
+
+;; 230 ((match_arm_cond_list) (expr))
+(puthash 230 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
+
+;; 231 ((match_arm_cond_list) (match_arm_cond_list "," expr))
+(puthash 231 (lambda(args _terminals) (append (nth 0 args) (list (nth 2 
args phps-mode-parser--table-translations)
+
+;; 233 ((while_statement) (statement))
+(puthash 233 (lambda(args _terminals) (list args)) 
phps-mode-parser--table-translations)
+
+;; 234 ((while_statement) (":" inner_statement_list T_ENDWHILE ";"))
+(puthash 234 (lambda(args _terminals) (nth 1 args)) 
phps-mode-parser--table-translations)
+
+
 ;; TODO Was here 285 is half
 
 



[elpa] externals/phps-mode 6e43f9f6db 037/135: More messing around with SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 6e43f9f6db88159fe01f371a034c7bc49d1df7bb
Author: Christian Johansson 
Commit: Christian Johansson 

More messing around with SDT
---
 phps-mode-parser-sdt.el | 23 +++
 1 file changed, 23 insertions(+)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 38c875efc3..779dfff2ed 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -596,6 +596,11 @@
   ""
   "Current bookkeeping namespace.")
 
+(defvar-local
+  phps-mode-parser-sdt-bookkeeping-symbol-stack
+  nil
+  "Current bookkeeping symbol stack.")
+
 ;; SDT starts here
 
 ;; 0 ((start) (top_statement_list))
@@ -3162,11 +3167,22 @@
  359
  (lambda(args terminals)
;; TODO Should probably have a expression / statement buffer of mentioned 
symbols and do a parse each time a expression / statement reaches its terminus
+   (let ((variable-type (plist-get (nth 0 args) 'ast-type)))
+ (cond
+  ((equal variable-type 'variable-callable-variable)
+   (let* ((callable-variable (plist-get (nth 0 args) 'callable-variable))
+  (callable-variable-type (plist-get callable-variable 'ast-type)))
+ (cond
+  ((equal callable-variable-type 'callable-variable-simple-variable)
+   (let ((callable-variable-simple-variable (plist-get 
callable-variable 'simple-variable)))
+ (message "callable-variable-simple-variable: %S" 
callable-variable-simple-variable)
+ )))
 
;; TODO Declare variable in bookkeeping and imenu here
(message "expr-assign-variable-by-expr")
(message "args: %S" args)
(message "terminals: %S" terminals)
+   (message "stack: %S" phps-mode-parser-sdt-bookkeeping-symbol-stack)
`(
  ast-type
  expr-assign-variable-by-expr
@@ -4942,6 +4958,7 @@
`(
  ast-type
  callable-variable-simple-variable
+ simple-variable
  ,args))
  phps-mode-parser--table-translations)
 
@@ -5069,6 +5086,12 @@
"%s id %s"
phps-mode-parser-sdt-bookkeeping-namespace
args)))
+ (push
+  (list
+   namespaced-variable
+ (car (cdr terminals))
+ (cdr (cdr terminals)))
+  phps-mode-parser-sdt-bookkeeping-symbol-stack)
 
  ;; Bookkeep whether we hit or miss the variable
  (if (gethash



[elpa] externals/phps-mode c4d9f8d909 038/135: More work on SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit c4d9f8d909fb78e5fafa9036e06ecf9873e64301
Author: Christian Johansson 
Commit: Christian Johansson 

More work on SDT
---
 phps-mode-ast-bookkeeping.el |  1 +
 phps-mode-parser-sdt.el  | 38 ++
 2 files changed, 31 insertions(+), 8 deletions(-)

diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index 6bf8875c65..e46e98f642 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -250,6 +250,7 @@
 (defun phps-mode-ast-bookkeeping--generate (&optional tree)
   "Generate AST for current buffer or optionally for TREE."
   (setq phps-mode-ast-bookkeeping--index phps-mode-parser-sdt-bookkeeping)
+  (message "phps-mode-parser-sdt--bookkeeping-symbol-stack: %S" 
phps-mode-parser-sdt--bookkeeping-symbol-stack)
   phps-mode-ast-bookkeeping--index)
 
 
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 779dfff2ed..996b27f2ac 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -592,12 +592,12 @@
   "Bookkeeping")
 
 (defvar-local
-  phps-mode-parser-sdt-bookkeeping-namespace
+  phps-mode-parser-sdt--bookkeeping-namespace
   ""
   "Current bookkeeping namespace.")
 
 (defvar-local
-  phps-mode-parser-sdt-bookkeeping-symbol-stack
+  phps-mode-parser-sdt--bookkeeping-symbol-stack
   nil
   "Current bookkeeping symbol stack.")
 
@@ -3176,13 +3176,34 @@
   ((equal callable-variable-type 'callable-variable-simple-variable)
(let ((callable-variable-simple-variable (plist-get 
callable-variable 'simple-variable)))
  (message "callable-variable-simple-variable: %S" 
callable-variable-simple-variable)
- )))
+ (let ((callable-variable-simple-variable-type
+(plist-get
+ callable-variable-simple-variable
+ 'ast-type)))
+   (cond
+((equal
+  callable-variable-simple-variable-type
+  'simple-variable-variable)
+ (push
+  (list
+   'write
+   (format
+"%s id %s"
+phps-mode-parser-sdt--bookkeeping-namespace
+(plist-get
+ callable-variable-simple-variable
+ 'variable))
+   (car (cdr (car terminals)))
+   (cdr (cdr (car terminals
+  phps-mode-parser-sdt--bookkeeping-symbol-stack)))
+
+   ;; TODO Should parse bookkeeping writes and reads at every statement 
terminus
 
;; TODO Declare variable in bookkeeping and imenu here
(message "expr-assign-variable-by-expr")
(message "args: %S" args)
(message "terminals: %S" terminals)
-   (message "stack: %S" phps-mode-parser-sdt-bookkeeping-symbol-stack)
+   (message "stack: %S" phps-mode-parser-sdt--bookkeeping-symbol-stack)
`(
  ast-type
  expr-assign-variable-by-expr
@@ -5084,14 +5105,15 @@
(let ((namespaced-variable
   (format
"%s id %s"
-   phps-mode-parser-sdt-bookkeeping-namespace
+   phps-mode-parser-sdt--bookkeeping-namespace
args)))
  (push
   (list
+   'read
namespaced-variable
- (car (cdr terminals))
- (cdr (cdr terminals)))
-  phps-mode-parser-sdt-bookkeeping-symbol-stack)
+   (car (cdr terminals))
+   (cdr (cdr terminals)))
+  phps-mode-parser-sdt--bookkeeping-symbol-stack)
 
  ;; Bookkeep whether we hit or miss the variable
  (if (gethash



[elpa] externals/phps-mode 258551c02a 035/135: More work on bookkeeping generation via SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 258551c02a3ab6b30c5f04e925a75b9da31f0a50
Author: Christian Johansson 
Commit: Christian Johansson 

More work on bookkeeping generation via SDT
---
 phps-mode-ast-bookkeeping.el | 1077 +-
 phps-mode-parser-sdt.el  |   48 +-
 2 files changed, 48 insertions(+), 1077 deletions(-)

diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
index e4fd2b2b9e..6bf8875c65 100644
--- a/phps-mode-ast-bookkeeping.el
+++ b/phps-mode-ast-bookkeeping.el
@@ -249,1081 +249,8 @@
 
 (defun phps-mode-ast-bookkeeping--generate (&optional tree)
   "Generate AST for current buffer or optionally for TREE."
-  (let ((bookkeeping (make-hash-table :test 'equal))
-(bookkeeping-stack (if tree tree phps-mode-ast--tree))
-(bookkeeping-objects)
-(inline-function-count 0)
-(arrow-function-count 0)
-(defined-count 0)
-(global-namespace))
-(while bookkeeping-stack
-  (let ((item-raw (pop bookkeeping-stack))
-(item)
-(scope))
-(if (listp (car item-raw))
-(progn
-  (setq
-   scope
-   (car item-raw))
-  (setq
-   item
-   (car (cdr item-raw
-  (setq
-   item
-   item-raw))
-
-;; Set global namespace (if any)
-(when global-namespace
-  (let ((had-scope-p scope))
-(when had-scope-p
-  (setq scope (reverse scope)))
-(push
- (list 'type 'namespace 'name global-namespace)
- scope)
-(when had-scope-p
-  (setq scope (reverse scope)
-
-(let ((type (plist-get item 'ast-type)))
-  (cond
-
-   ((equal type 'simple-variable)
-(let* ((object-name (plist-get item 'name))
-   (object-start (plist-get item 'start))
-   (object-end (plist-get item 'end))
-   (ids
-(phps-mode-ast-bookkeeping--generate-variable-scope-string
- scope
- object-name
- t))
-   (object
-(list
- object-start
- object-end))
-   (defined-p 0)
-   (bookkeeping-object
-(list
- 'type type
- 'name object-name
- 'scope scope
- 'start object-start
- 'end object-end)))
-  (push
-   bookkeeping-object
-   bookkeeping-objects)
-
-  (dolist (id ids)
-(when (gethash id bookkeeping)
-  (setq
-   defined-p
-   1)))
-
-  ;; Is it a super-global variable?
-  (when
-  (gethash
-   (plist-get item 'name)
-   phps-mode-ast-bookkeeping--superglobal-variable-p)
-(setq
- defined-p
- 1))
-  (puthash
-   object
-   defined-p
-   bookkeeping)))
-
-   ((equal type 'static-variables-statement)
-(when-let ((variables (reverse (plist-get item 'static-var-list
-  (dolist (variable variables)
-(let* ((object-name (plist-get variable 'name))
-   (object-start (plist-get variable 'start))
-   (object-end (plist-get variable 'end))
-   (ids
-
(phps-mode-ast-bookkeeping--generate-variable-scope-string
- scope
- object-name))
-   (object
-(list
- object-start
- object-end))
-   (bookkeeping-object
-(list
- 'type type
- 'name object-name
- 'scope scope
- 'start object-start
- 'end object-end)))
-  (push
-   bookkeeping-object
-   bookkeeping-objects)
-
-  (dolist (id ids)
-(puthash
- id
- 1
- bookkeeping))
-  (puthash
-   object
-   1
-   bookkeeping)
-
-   ((equal type 'function)
-(let ((name (plist-get item 'name))
-  (sub-scope scope))
-  (push `(type function name ,name) sub-scope)
-  (when-let ((parameter-list (plist-get item 'parameter-list)))
-(dolist (parameter parameter-list)
-  (let* ((object-name (plist-get parameter 'na

[elpa] externals/phps-mode b21c9f3f3a 107/135: Imenu generation via SDT all tests now passing

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit b21c9f3f3abc13db25f57c34eb4e4ec16eef138e
Author: Christian Johansson 
Commit: Christian Johansson 

Imenu generation via SDT all tests now passing
---
 phps-mode-parser-sdt.el| 68 ++---
 test/phps-mode-test-ast.el | 76 +++---
 2 files changed, 102 insertions(+), 42 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 0070657163..1170a74429 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -839,6 +839,10 @@
 scope-start
 scope-end)
phps-mode-parser-sdt-symbol-table)
+  (puthash
+   scope-uri
+   (list phps-mode-parser-sdt-symbol-table-index)
+   phps-mode-parser-sdt-symbol-table-by-uri)
   (push
`(,scope-uri . ,scope-start)
phps-mode-parser-sdt-symbol-imenu
@@ -864,6 +868,10 @@
 scope-start
 scope-end)
phps-mode-parser-sdt-symbol-table)
+  (puthash
+   scope-uri
+   (list phps-mode-parser-sdt-symbol-table-index)
+   phps-mode-parser-sdt-symbol-table-by-uri)
   (push
`(,scope-uri . ,scope-start)
phps-mode-parser-sdt-symbol-imenu)))
@@ -884,6 +892,10 @@
   scope-start
   scope-end)
  phps-mode-parser-sdt-symbol-table)
+(puthash
+ scope-uri
+ (list phps-mode-parser-sdt-symbol-table-index)
+ phps-mode-parser-sdt-symbol-table-by-uri)
 (push
  `(,scope-uri . ,scope-start)
  phps-mode-parser-sdt-symbol-imenu)
@@ -909,6 +921,10 @@
 scope-start
 scope-end)
phps-mode-parser-sdt-symbol-table)
+  (puthash
+   scope-uri
+   (list phps-mode-parser-sdt-symbol-table-index)
+   phps-mode-parser-sdt-symbol-table-by-uri)
   (push
`(,scope-uri . ,scope-start)
phps-mode-parser-sdt-symbol-imenu)))
@@ -929,6 +945,10 @@
   scope-start
   scope-end)
  phps-mode-parser-sdt-symbol-table)
+(puthash
+ scope-uri
+ (list phps-mode-parser-sdt-symbol-table-index)
+ phps-mode-parser-sdt-symbol-table-by-uri)
 (push
  `(,scope-uri . ,scope-start)
  phps-mode-parser-sdt-symbol-imenu)
@@ -954,6 +974,10 @@
 scope-start
 scope-end)
phps-mode-parser-sdt-symbol-table)
+  (puthash
+   scope-uri
+   (list phps-mode-parser-sdt-symbol-table-index)
+   phps-mode-parser-sdt-symbol-table-by-uri)
   (push
`(,scope-uri . ,scope-start)
phps-mode-parser-sdt-symbol-imenu)))
@@ -974,6 +998,10 @@
   scope-start
   scope-end)
  phps-mode-parser-sdt-symbol-table)
+(puthash
+ scope-uri
+ (list phps-mode-parser-sdt-symbol-table-index)
+ phps-mode-parser-sdt-symbol-table-by-uri)
 (push
  `(,scope-uri . ,scope-start)
  phps-mode-parser-sdt-symbol-imenu)
@@ -1002,6 +1030,10 @@
   scope-start
   scope-end)
  phps-mode-parser-sdt-symbol-table)
+(puthash
+ scope-uri
+ (list phps-mode-parser-sdt-symbol-table-index)
+ phps-mode-parser-sdt-symbol-table-by-uri)
 (push
  `(,scope-uri . ,scope-start)
  phps-mode-parser-sdt-symbol-imenu
@@ -1025,6 +1057,10 @@
   scope-start
   scope-end)
  phps-mode-parser-sdt-symbol-table)
+(puthash
+ scope-uri
+ (list phps-mode-parser-sdt-symbol-table-index)
+ phps-mode-parser-sdt-symbol-table-by-uri)
 (push
  `(,scope-uri . ,scope-start)
  phps-mode-parser-sdt-symbol-imenu
@@ -1048,6 +1084,10 @@
   scope-start
   scope-end)
  phps-mode-parser-sdt-symbol-table)
+(puthash
+ scope-uri
+ (list phps-mode-parser-sdt-symbol-table-index)
+ phps-mode-parser-sdt-symbol-table-by-uri)
 

[elpa] externals/phps-mode ae516f9e19 105/135: Using separate imenu items for redeclared symbols

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit ae516f9e19521ef4fb5bcc1657ef7ee75b19bcc3
Author: Christian Johansson 
Commit: Christian Johansson 

Using separate imenu items for redeclared symbols
---
 phps-mode-parser-sdt.el| 13 ++---
 test/phps-mode-test-ast.el |  6 +++---
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 2e72e4b18a..fc4c5fefe6 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -647,6 +647,8 @@
name
phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
   name
+;; TODO Should capture unique scopes (without the id)
+;; with name and place on the imenu list
 (let ((potential-uris (list "")))
   (when scope
 (let ((scope-count (length scope))
@@ -857,9 +859,14 @@
 ;; and place a reference to it in the symbol URI hash-map
 (if (gethash symbol-uri phps-mode-parser-sdt-symbol-table-by-uri)
 (progn
-  (push
-   `(,symbol-uri . ,symbol-start)
-   phps-mode-parser-sdt-symbol-imenu)
+  (let ((symbol-uri-duplicate
+ (format
+  "%s (%d)"
+  symbol-uri
+  (1+ (length (gethash symbol-uri 
phps-mode-parser-sdt-symbol-table-by-uri))
+(push
+ `(,symbol-uri-duplicate . ,symbol-start)
+ phps-mode-parser-sdt-symbol-imenu))
 
   (puthash
phps-mode-parser-sdt-symbol-table-index
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 65ebb01de2..94604729d1 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -256,7 +256,7 @@
"property2) {\necho 'was here';\n}\n/* 
@codingStandardsIgnoreEnd */\nif (\n$argument1\n
&& $argument2\n&& $argument3\n&& $argument4\n   
 && !empty($argument1['index'])\n  [...]
"Bookkeeping of properties inside if condition list"
'(((180 190) 1) ((160 170) 2) ((140 150) 3) ((544 553) 7) ((537 542) 4) 
((514 524) 3) ((489 498) 7) ((482 487) 4) ((446 456) 3) ((413 423) 0) ((387 
397) 1) ((361 371) 2) ((335 345) 3) ((218 227) 6) ((211 216) 4) ((87 97) 6) 
((58 68) 7))
-  '(("namespace myNamespace class myClass function myMethod id $argument3" . 
180) ("namespace myNamespace class myClass function myMethod id $argument2" . 
160) ("namespace myNamespace class myClass function myMethod id $argument1" . 
140) ("namespace myNamespace class myClass function myMethod id $this" . 197) 
("namespace myNamespace class myClass function myMethod id $argument1" . 446) 
("namespace myNamespace class myClass id $property2" . 87) ("namespace 
myNamespace class myClass id $pr [...]
+  '(("namespace myNamespace class myClass function myMethod id $argument3" . 
180) ("namespace myNamespace class myClass function myMethod id $argument2" . 
160) ("namespace myNamespace class myClass function myMethod id $argument1" . 
140) ("namespace myNamespace class myClass function myMethod id $this" . 197) 
("namespace myNamespace class myClass function myMethod id $argument1 (2)" . 
446) ("namespace myNamespace class myClass id $property2" . 87) ("namespace 
myNamespace class myClass id [...]
 
   (phps-mode-test-ast--should-bookkeep
"var) {\necho 'Hit';\n}\n   
 }\n}\n"



[elpa] externals/phps-mode dffe0d0485 029/135: More SDT rules

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit dffe0d04859813cd34ca58789053b4b5ffe9697c
Author: Christian Johansson 
Commit: Christian Johansson 

More SDT rules
---
 phps-mode-parser-sdt.el | 639 +---
 1 file changed, 553 insertions(+), 86 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index ce52e16b60..7456a864f0 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2958,33 +2958,212 @@
  ,(nth 3 args)))
  phps-mode-parser--table-translations)
 
+;; 344 ((const_decl) (T_STRING "=" expr backup_doc_comment))
+(puthash
+ 344
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-string-assignment
+ ast-string
+ ,(nth 0 args)
+ ast-expr
+ ,(nth 2 args)
+ ast-backup-expression
+ ,(nth 3 args)))
+ phps-mode-parser--table-translations)
 
-;; TODO Was here
+;; 345 ((echo_expr_list) (echo_expr_list "," echo_expr))
+(puthash
+ 345
+ (lambda(args _terminals)
+   `(
+ ast-type
+ echo-expr-list
+ ast-echo-expr-list
+ ,(nth 0 args)
+ ast-echo-expr
+ ,(nth 2 args)))
+ phps-mode-parser--table-translations)
+
+;; 346 ((echo_expr_list) (echo_expr))
+(puthash
+ 346
+ (lambda(args _terminals)
+   `(
+ ast-type
+ echo-expr-list
+ ast-echo-expr
+ ,args))
+ phps-mode-parser--table-translations)
+
+;; 347 ((echo_expr) (expr))
+(puthash
+ 347
+ (lambda(args _terminals)
+   `(
+ ast-type
+ echo-expr
+ ast-expr
+ ,args))
+ phps-mode-parser--table-translations)
+
+;; 348 ((for_exprs) (%empty))
+(puthash
+ 348
+ (lambda(args _terminals)
+   `(
+ ast-type
+ empty-for-exprs
+ ))
+ phps-mode-parser--table-translations)
+
+;; 349 ((for_exprs) (non_empty_for_exprs))
+(puthash
+ 349
+ (lambda(args _terminals)
+   `(
+ ast-type
+ non-empty-for-exprs
+ ast-for-expr
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 350 ((non_empty_for_exprs) (non_empty_for_exprs "," expr))
+(puthash
+ 350
+ (lambda(args _terminals)
+   `(
+ ast-type
+ non-empty-for-exprs
+ ast-for-expr
+ ,(nth 0 args)
+ ast-expr
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 351 ((non_empty_for_exprs) (expr))
+(puthash
+ 351
+ (lambda(args _terminals)
+   `(
+ ast-type
+ non-empty-for-exprs
+ ast-expr
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 352 ((anonymous_class) (T_CLASS ctor_arguments extends_from implements_list 
backup_doc_comment "{" class_statement_list "}"))
+(puthash
+ 352
+ (lambda(args _terminals)
+   `(
+ ast-type
+ anonymous-class
+ ctor-arguments
+ ,(nth 1 args)
+ extends-from
+ ,(nth 2 args)
+ implements-list
+ ,(nth 3 args)
+ backup-doc-comment
+ ,(nth 4 args)
+ class-statement-list
+ ,(nth 6 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 353 ((new_expr) (T_NEW class_name_reference ctor_arguments))
+(puthash
+ 353
+ (lambda(args _terminals)
+   `(
+ ast-type
+ new-expr-class
+ class-name
+ ,(nth 1 args)
+ ctor-arguments
+ ,(n 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 354 ((new_expr) (T_NEW anonymous_class))
+(puthash
+ 354
+ (lambda(args _terminals)
+   `(
+ ast-type
+ new-expr-anonymous-class
+ anonymous-class
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
 
-;; expr -> ("[" array_pair_list "]" "=" expr)
+;; 355 ((new_expr) (T_NEW attributes anonymous_class))
+(puthash
+ 355
+ (lambda(args _terminals)
+   `(
+ ast-type
+ new-expr-attributed-anonymous-class
+ attributes
+ ,(nth 1 args)
+ anonymous-class
+ ,(nth 2 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 356 ((echo_expr_list) (echo_expr_list "," echo_expr))
+(puthash
+ 356
+ (lambda(args _terminals)
+   `(
+ ast-type
+ echo-expr-list
+ ,(append (nth 0 args) (list (nth 2 args))
+ ))
+ phps-mode-parser--table-translations)
+
+;; 357 ((expr) (T_LIST "(" array_pair_list ")" "=" expr))
+(puthash
+ 357
+ (lambda(args _terminals)
+   `(
+ ast-type
+ expr-list
+ ,(nth 2 args)
+ expr
+ ,(nth 4 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 358 ((expr) ("[" array_pair_list "]" "=" expr))
 (puthash
  358
  (lambda(args _terminals)
`(
  ast-type
- assign-variables-from-array
- keys
+ expr-list
+ array-pair-list
  ,(nth 1 args)
- values
+ expr
  ,(nth 4 args)
  ))
  phps-mode-parser--table-translations)
 
-;; expr -> (variable "=" expr)
+;; 359 ((expr) (variable "=" expr))
 (puthash
  359
  (lambda(args terminals)
`(
  ast-type
- assign-variable
- key
+ expr-assign-variable
+ variable
  ,(nth 0 args)
- value
+ ,expr
  ,(nth 2 args)
  ast-index
  ,(car (cdr (nth 0 terminals)))
@@ -2995,282 +3174,570 @@
  ))
  phps-mode-parser--table-translations)
 
-;; expr -> (variable T_INC)
+;; 360 ((expr) (variable

[elpa] externals/phps-mode 442b5202d4 040/135: Bookkeeping via SDT passing second test

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 442b5202d4e0292ec5d22823459cd2a743dcb7d3
Author: Christian Johansson 
Commit: Christian Johansson 

Bookkeeping via SDT passing second test
---
 phps-mode-ast.el| 9 +
 phps-mode-parser-sdt.el | 1 +
 2 files changed, 10 insertions(+)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 2a4e4eaaa3..8c18b631b9 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -30,6 +30,15 @@
 
 (defun phps-mode-ast--generate ()
   "Generate AST for current buffer."
+  (setq
+   phps-mode-parser-sdt-bookkeeping
+   (make-hash-table :test 'equal))
+  (setq
+   phps-mode-parser-sdt--bookkeeping-namespace
+   "")
+  (setq
+   phps-mode-parser-sdt--bookkeeping-symbol-stack
+   nil)
   (let* ((result (phps-mode-parser--parse t))
  (parse-trail (nth 0 result))
  (translation (nth 1 result))
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index ae931203e3..1f10ecd559 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -3283,6 +3283,7 @@
 ((equal
   callable-variable-simple-variable-type
   'simple-variable-variable)
+ ;; (message "declared variable from terminals: %S" terminals)
  (push
   (list
(format



[elpa] externals/phps-mode 249f8a2a4d 087/135: Work on bookkeeping class static variable

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 249f8a2a4d04b46dfec69a937e7e28b4dcfd687a
Author: Christian Johansson 
Commit: Christian Johansson 

Work on bookkeeping class static variable
---
 phps-mode-parser-sdt.el| 14 +-
 test/phps-mode-test-ast.el |  2 ++
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index ac09147928..991e3068ba 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -6218,10 +6218,6 @@
  (symbol-end
   (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
@@ -6277,7 +6273,15 @@
(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)
+ (setf
+  (nth 1 (car phps-mode-parser-sdt--bookkeeping-symbol-stack))
+  namespace)))
+  ((equal class-name-type 'class-name-static)
+   (let ((namespace phps-mode-parser-sdt--bookkeeping-namespace))
+ (push (list 'static-member "static") namespace)
+ (setf
+  (nth 1 (car phps-mode-parser-sdt--bookkeeping-symbol-stack))
+  namespace)
`(
  ast-type
  static-member-class-name
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 7c0e498711..840add33be 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -343,6 +343,8 @@
"Bookkeeping of static variables in different scopes without namespaces"
'((" id $a" ((15 17))) ((15 17) 1) ((24 26) 1) (" function test id $a" ((61 
63))) ((73 75) 1) ((61 63) 1) (" class There function here id $this" ((121 
166))) (" class There function here id $a" ((138 140))) ((154 156) 1) ((138 
140) 1)))
 
+  ;; TODO WAS HERE
+
   (phps-mode-test-ast--should-bookkeep
"variable) {}\n  
  if ($this->variable2) {}\nif ($this->variable3) {}\nif 
($this->variable4) {}\nif (self::$variable4) {}\nif 
(self::$variable5) {}\nif (self::$varia [...]
"Bookkeeping of typed class variables"



[elpa] externals/phps-mode 579034d1c6 127/135: Passing imenu test via SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 579034d1c6366b35453071ec923161d8d2feb932
Author: christian 
Commit: christian 

Passing imenu test via SDT
---
 phps-mode-ast.el   |  4 +--
 phps-mode-parser-sdt.el| 65 ++---
 test/phps-mode-test-ast.el | 90 +++---
 3 files changed, 91 insertions(+), 68 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 8ade386522..377502ab22 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -119,8 +119,8 @@
  (push `("declaration" . ,v3-index) v3-list)
  (push `(,k3 ,v3-list) v2-list))
  (if (symbolp k3)
- (setq v2-index v3))
- (push `(,k3 . ,v3) v2-list)))
+ (setq v2-index v3)
+ (push `(,k3 . ,v3) v2-list
  v2)
 
 ;; Sort level 3
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index ff6135e7ed..d5071c3566 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -913,6 +913,14 @@
 (setq imenu-trait (list imenu-item-name imenu-item-start)))
((equal imenu-item-type 'function)
 (setq imenu-function (list imenu-item-name 
imenu-item-start))
+
+  ;; (message "\nimenu-namespace: %S" imenu-namespace)
+  ;; (message "imenu-class: %S" imenu-class)
+  ;; (message "imenu-trait: %S" imenu-trait)
+  ;; (message "imenu-interface: %S" imenu-interface)
+  ;; (message "imenu-function: %S" imenu-function)
+
+
   (cond
 
(imenu-namespace
@@ -1134,7 +1142,7 @@
phps-mode-parser-sdt-symbol-imenu--table)
 (setq phps-mode-parser-sdt-symbol-imenu--stack nil))
 
-(message "phps-mode-parser-sdt-symbol-imenu--table: %S" 
phps-mode-parser-sdt-symbol-imenu--table)
+;; (message "phps-mode-parser-sdt-symbol-imenu--table: %S" 
phps-mode-parser-sdt-symbol-imenu--table)
 
   ;; Parse bookkeeping writes and reads at every statement terminus
   (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
@@ -1169,13 +1177,13 @@
 (when (nth 9 (nth 1 symbol-uri-object))
   (setq symbol-function (car (nth 9 (nth 1 symbol-uri-object)
 
-(message "\nsymbol-name: %S" symbol-name)
-(message "symbol-scope: %S" symbol-scope)
-(message "symbol-namespace: %S" symbol-namespace)
-(message "symbol-class: %S" symbol-class)
-(message "symbol-trait: %S" symbol-trait)
-(message "symbol-interface: %S" symbol-interface)
-(message "symbol-function: %S" symbol-function)
+;; (message "\nsymbol-name: %S" symbol-name)
+;; (message "symbol-scope: %S" symbol-scope)
+;; (message "symbol-namespace: %S" symbol-namespace)
+;; (message "symbol-class: %S" symbol-class)
+;; (message "symbol-trait: %S" symbol-trait)
+;; (message "symbol-interface: %S" symbol-interface)
+;; (message "symbol-function: %S" symbol-function)
 
 ;; Place symbol in imenu if not there already
 (cond
@@ -1410,7 +1418,7 @@
 
  ;; Symbol is inside trait
  (symbol-trait
-  (let ((imenu-nail (format "trait %s" symbol-class)))
+  (let ((imenu-nail (format "trait %s" symbol-trait)))
 (cond
 
  ;; Symbol is inside function inside trait
@@ -1450,7 +1458,7 @@
 
  ;; Symbol is inside interface
  (symbol-interface
-  (let ((imenu-nail (format "interface %s" symbol-class)))
+  (let ((imenu-nail (format "interface %s" symbol-interface)))
 (cond
 
  ;; Symbol is inside function inside interface
@@ -3370,7 +3378,7 @@
;; unless a namespace exists, in that case it should be placed second in 
scope
(let ((class-name (nth 1 args))
  (class-start (car (cdr (nth 1 terminals
- (class-end (cdr (cdr (nth 1 terminals)
+ (class-end (cdr (cdr (nth 6 terminals)
 
  ;; Add class scope to all functions in class
  (when phps-mode-parser-sdt-symbol-imenu--stack
@@ -3383,11 +3391,10 @@
   (item-index 0))
  (while (< item-index item-count)
(let* ((item (nth item-index items))
-  (item-start (nth 2 item))
-  (item-end (nth 3 item)))
+  (item-start (nth 2 item)))
  (when (and
 (>= item-start class-start)
-(<= item-end class-end))
+(<= item-start class-end))
(push
 (list 'interface class-name class-start class-end)
 (nth imenu-stack-index 
phps-mode-parser-sdt-symbol-imenu--stack))
@@ -4393,13 +4400,14 @@
  ast-index
 

[elpa] externals/phps-mode 3332b2bfa9 109/135: Fixes syntax coloring of super-globals

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 3332b2bfa9a3fca0c308e565b48a600568dd5a28
Author: Christian Johansson 
Commit: Christian Johansson 

Fixes syntax coloring of super-globals
---
 phps-mode-lex-analyzer.el | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index dc1ec31bee..1f94cca127 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -164,9 +164,9 @@
 (cond
 
  ((when bookkeeping-value
-(if (> bookkeeping-value 0)
-'font-lock-variable-name-face
-  'font-lock-warning-face)))
+(if (= bookkeeping-value 0)
+'font-lock-warning-face
+  'font-lock-variable-name-face)))
 
  ((when-let ((face
   (gethash



[elpa] externals/phps-mode 61d3e7b1e0 093/135: Passing bookkeeping test but via SDT

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 61d3e7b1e0ec6c8d1dd70bf5a26fa9f101f5b124
Author: Christian Johansson 
Commit: Christian Johansson 

Passing bookkeeping test but via SDT
---
 phps-mode-parser-sdt.el| 23 ---
 test/phps-mode-test-ast.el | 11 +--
 2 files changed, 9 insertions(+), 25 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 2db915af81..6926c821ea 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -816,10 +816,12 @@
symbol-scope)))
 
 (message
- "assign symbol uri: %S from %S + %S"
+ "assign symbol uri: %S from %S + %S, start: %S, end: %S"
  symbol-uri
  symbol-name
- symbol-scope)
+ symbol-scope
+ symbol-start
+ symbol-end)
 
 (if (gethash symbol-uri phps-mode-parser-sdt-bookkeeping)
 (puthash
@@ -3783,23 +3785,6 @@
 (puthash
  340
  (lambda(args terminals)
-   ;; Save variable declaration in bookkeeping buffer
-   (let* ((symbol-name
-   (nth 0 args))
-  (symbol-start
-   (car (cdr (car terminals
-  (symbol-end
-   (cdr (cdr (car terminals
-  (symbol-scope
-   phps-mode-parser-sdt--bookkeeping-namespace))
- (push
-  (list
-   symbol-name
-   symbol-scope
-   symbol-start
-   symbol-end)
-  phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
-
`(
  ast-type
  property-assigned-variable
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index ca213fa2ae..a464055f95 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -236,7 +236,7 @@
   (phps-mode-test-ast--should-bookkeep
" $value) {\nif ($key || $value) {\necho 'Hit';\n  
  }\n}\nfor ($i = 0; $i < count($items); $i++) {\nif ($i) {\necho 
'Hit';\n}\n}\nif ($a = 123) {\nif ($a) {\necho 'Hit';\n
}\n}\nwhile ($b = 123) {\nif ($a) {\necho 'Hit';\n}\n}\ndo {\n  
  echo 'Hit';\n} while ( [...]
@@ -246,7 +246,7 @@
   (phps-mode-test-ast--should-bookkeep
"var1) {\necho 
'Hit';\n}\nif (self::$var1) {\necho 'Miss';\n   
 }\nif (self::$var2) {\necho 'Hit';\n}\nif 
(static::$var2) {\n [...]
"Bookkeeping of class properties"
-   '((" 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) (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) ((160 165) 1) ((145 150) 1) ((127 132) 1) ((93 98) 1) 
((751 756) 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) ((160 165) 1) ((145 150) 1) ((127 132) 1) ((93 98) 1) ((751 756) 
0)))
 
   (phps-mode-test-ast--should-bookkeep
" $this->tost . $d . $e;\n
}\n}\n\n$a = new myClass();\necho $a->test('def')('ghi');"
"Bookkeeping of $this reference inside arrow function inside of method"
-   '((" class myClass function test id $d" ((76 78))) (" class myClass 
function test id $this" ((84 139))) (" class myClass arrow 1 function test id 
$e" ((104 106))) (" class myClass id $tost" ((36 41) (36 41))) ((76 78) 1) 
((104 106) 1) ((130 132) 1) ((125 127) 1) ((118 122) 1) ((111 116) 1) ((36 41) 
1) (" id $a" ((143 145))) ((143 145) 1) ((168 170) 1)))
-
-  ;; TODO this is wrong: '(" class myClass id $var" ((35 39))) for below
+   '((" class myClass function test id $d" ((76 78))) (" class myClass 
function test id $this" ((84 139))) (" class myClass arrow 1 function test id 
$e" ((104 106))) (" class myClass id $tost" ((36 41))) ((76 78) 1) ((104 106) 
1) ((130 132) 1) ((125 127) 1) ((118 122) 1) ((111 116) 1) ((36 41) 1) (" id 
$a" ((143 145))) ((143 145) 1) ((168 170) 1)))
 
   (phps-mode-test-ast--should-bookkeep
" self::$var . $a . $b;\n
}\n}\n\necho myClass::myMethod('4')('5');"
"Bookkeeping of self reference inside arrow function inside of static 
method"
-   '((" class myClass static id $var" 1) ((30 34) 1) (" class myClass function 
myMethod id $a" 1) ((69 71) 1) (" class myClass function myMethod arrow 
function 1 id $b" 1) ((85 87) 1) ((98 102) 1) ((105 107) 1) ((110 112) 1)))
+   '((" class myClass function myMethod id $a" ((78 80))) (" class myClass 
arrow 1 function myMethod id $b" ((106 108))) (" class myClass static id $var" 
((35 39))) ((78 80) 1) ((106 108) 1) (

[elpa] externals/phps-mode 4981a1eb45 032/135: SDT rules up to 520

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 4981a1eb458f8801bc2d961d703b6fd9c5d9f7de
Author: Christian Johansson 
Commit: Christian Johansson 

SDT rules up to 520
---
 phps-mode-parser-sdt.el | 560 
 1 file changed, 473 insertions(+), 87 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 74ec6bf2ca..5a68dfdf5d 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -4560,183 +4560,569 @@
  ))
  phps-mode-parser--table-translations)
 
-;; TODO Was here
-
-;; dereferencable_scalar -> (T_CONSTANT_ENCAPSED_STRING)
+;; 472 ((dereferenceable_scalar) (T_CONSTANT_ENCAPSED_STRING))
 (puthash
  472
  (lambda(args _terminals)
-   (substring args 1 -1))
+   `(
+ ast-type
+ dereferencable-scalar-constant-encapsed-string
+ constant-encapsed-string
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 473 ((dereferenceable_scalar) ("\"" encaps_list "\""))
+(puthash
+ 473
+ (lambda(args _terminals)
+   `(
+ ast-type
+ dereferencable-scalar-encaps-list
+ encaps-list
+ ,args
+ ))
  phps-mode-parser--table-translations)
 
-;; scalar -> (T_LNUMBER)
+;; 474 ((scalar) (T_LNUMBER))
 (puthash
  474
  (lambda(args _terminals)
-   (string-to-number args))
+   `(
+ ast-type
+ dereferencable-scalar-scalar
+ scalar
+ ,args
+ ))
  phps-mode-parser--table-translations)
 
-;; scalar -> (T_DNUMBER)
+;; 475 ((scalar) (T_DNUMBER))
 (puthash
  475
  (lambda(args _terminals)
-   (string-to-number args))
+   `(
+ ast-type
+ dereferencable-scalar-scalar
+ scalar
+ ,args
+ ))
  phps-mode-parser--table-translations)
 
-;; callable_variable -> (array_object_dereferenceable "[" optional_expr "]")
+;; 476 ((scalar) (T_START_HEREDOC T_ENCAPSED_AND_WHITESPACE T_END_HEREDOC))
 (puthash
- 506
+ 476
  (lambda(args _terminals)
`(
  ast-type
- callable-variable
- array-object-dereferencable
- array-index
+ dereferencable-scalar-scalar
+ scalar
  ,(nth 2 args)
  ))
  phps-mode-parser--table-translations)
 
-;; callable_variable -> (array_object_dereferenceable "{" expr "}")
+;; 477 ((scalar) (T_START_HEREDOC T_END_HEREDOC))
 (puthash
- 507
+ 477
+ (lambda(args _terminals)
+   `(
+ ast-type
+ dereferencable-scalar-scalar
+ scalar
+ ""
+ ))
+ phps-mode-parser--table-translations)
+
+;; 478 ((scalar) (T_START_HEREDOC encaps_list T_END_HEREDOC))
+(puthash
+ 478
+ (lambda(args _terminals)
+   `(
+ ast-type
+ dereferencable-scalar-scalar
+ scalar
+ ,(nth 1 args)
+ ))
+ phps-mode-parser--table-translations)
+
+;; 479 ((scalar) (dereferenceable_scalar))
+(puthash
+ 479
+ (lambda(args _terminals)
+   `(
+ ast-type
+ scalar-dereferencable-scalar
+ dereferenceable-scalar
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 480 ((scalar) (constant))
+(puthash
+ 480
+ (lambda(args _terminals)
+   `(
+ ast-type
+ scalar-constant
+ constant
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 481 ((scalar) (class_constant))
+(puthash
+ 481
+ (lambda(args _terminals)
+   `(
+ ast-type
+ scalar-class-constant
+ class-constant
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 482 ((constant) (name))
+(puthash
+ 482
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-name
+ name
+ ,args
+ ))
+ phps-mode-parser--table-translations)
+
+;; 483 ((constant) (T_LINE))
+(puthash
+ 483
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-line
+ ))
+ phps-mode-parser--table-translations)
+
+;; 484 ((constant) (T_FILE))
+(puthash
+ 484
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-file
+ ))
+ phps-mode-parser--table-translations)
+
+;; 485 ((constant) (T_DIR))
+(puthash
+ 485
  (lambda(args _terminals)
`(
  ast-type
+ constant-dir
+ ))
+ phps-mode-parser--table-translations)
+
+;; 486 ((constant) (T_TRAIT_C))
+(puthash
+ 486
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-trait
+ ))
+ phps-mode-parser--table-translations)
+
+;; 487 ((constant) (T_METHOD_C))
+(puthash
+ 487
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-method
+ ))
+ phps-mode-parser--table-translations)
+
+;; 488 ((constant) (T_FUNC_C))
+(puthash
+ 488
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-function
+ ))
+ phps-mode-parser--table-translations)
+
+;; 489 ((constant) (T_NS_C))
+(puthash
+ 489
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-namespace
+ ))
+ phps-mode-parser--table-translations)
+
+;; 490 ((constant) (T_CLASS_C))
+(puthash
+ 490
+ (lambda(args _terminals)
+   `(
+ ast-type
+ constant-class
+ ))
+ phps-mode-parser--table-translations)
+
+;; 491 ((class_constant) (class_name T_PAAMAYIM_NEKUDOTAYIM identifier))
+(puthash
+ 491
+ (lambda(args _terminals)
+   `(
+ ast-type
+ class-constant-class-na

[elpa] externals/phps-mode 330e6fd6cc 128/135: Superglobals and $this not included in imenu index

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit 330e6fd6ccfb35cd7627fb5c469fb2b768e1b6c7
Author: christian 
Commit: christian 

Superglobals and $this not included in imenu index
---
 phps-mode-ast.el   |  30 ++--
 phps-mode-parser-sdt.el| 402 +++--
 test/phps-mode-test-ast.el |  45 +++--
 3 files changed, 244 insertions(+), 233 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 377502ab22..1e5e09fcb1 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -109,15 +109,15 @@
   ((and
 (listp (cdr a))
 (listp (cdr b)))
-   (< (cdr (car (car (cdr a (cdr (car 
(car (cdr b))
+   (< (cdr (car (cdr a))) (cdr (car (cdr 
b)
   ((listp (cdr a))
-   (< (cdr (car (car (cdr a (cdr b)))
+   (< (cdr (car (cdr a))) (cdr b)))
   ((listp (cdr b))
-   (< (cdr a) (cdr (car (car (cdr b))
+   (< (cdr a) (cdr (car (cdr b)
   (t
(< (cdr a) (cdr b)))
  (push `("declaration" . ,v3-index) v3-list)
- (push `(,k3 ,v3-list) v2-list))
+ (push (append (list k3) v3-list) v2-list))
  (if (symbolp k3)
  (setq v2-index v3)
  (push `(,k3 . ,v3) v2-list
@@ -133,15 +133,15 @@
  ((and
(listp (cdr a))
(listp (cdr b)))
-  (< (cdr (car (car (cdr a (cdr (car (car (cdr 
b))
+  (< (cdr (car (cdr a))) (cdr (car (cdr b)
  ((listp (cdr a))
-  (< (cdr (car (car (cdr a (cdr b)))
+  (< (cdr (car (cdr a))) (cdr b)))
  ((listp (cdr b))
-  (< (cdr a) (cdr (car (car (cdr b))
+  (< (cdr a) (cdr (car (cdr b)
  (t
   (< (cdr a) (cdr b)))
 (push `("declaration" . ,v2-index) v2-list)
-(push `(,k2 ,v2-list) v-list))
+(push (append (list k2) v2-list) v-list))
 (if (symbolp k2)
 (setq v-index v2)
   (push `(,k2 . ,v2) v-list
@@ -157,15 +157,15 @@
 ((and
   (listp (cdr a))
   (listp (cdr b)))
- (< (cdr (car (car (cdr a (cdr (car (car (cdr b))
+ (< (cdr (car (cdr a))) (cdr (car (cdr b)
 ((listp (cdr a))
- (< (cdr (car (car (cdr a (cdr b)))
+ (< (cdr (car (cdr a))) (cdr b)))
 ((listp (cdr b))
- (< (cdr a) (cdr (car (car (cdr b))
+ (< (cdr a) (cdr (car (cdr b)
 (t
  (< (cdr a) (cdr b)))
(push `("declaration" . ,v-index) v-list)
-   (push `(,k ,v-list) imenu-index))
+   (push (append (list k) v-list) imenu-index))
(push `(,k . ,v) imenu-index)))
phps-mode-parser-sdt-symbol-imenu--table)
 
@@ -179,11 +179,11 @@
((and
  (listp (cdr a))
  (listp (cdr b)))
-(< (cdr (car (car (cdr a (cdr (car (car (cdr b))
+(< (cdr (car (cdr a))) (cdr (car (cdr b)
((listp (cdr a))
-(< (cdr (car (car (cdr a (cdr b)))
+(< (cdr (car (cdr a))) (cdr b)))
((listp (cdr b))
-(< (cdr a) (cdr (car (car (cdr b))
+(< (cdr a) (cdr (car (cdr b)
(t
 (< (cdr a) (cdr b)))
 
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index d5071c3566..220d74e7bd 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -864,10 +864,10 @@
 (if matching-uri
 (list
  matching-uri
- (list 'namespace scope-namespace 'class scope-class 'trait 
scope-trait 'interface scope-interface 'function scope-function))
+ (list 'namespace scope-namespace 'class scope-class 'trait 
scope-trait 'interface scope-interface 'function scope-function 'superglobal 
nil))
   (list
(nth 0 potential-uris)
-   (list 'namespace scope-namespace 'class s

[elpa] externals/phps-mode e8a5dbe153 126/135: Fix for trait and interface imenu

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit e8a5dbe15301efb819cabf19d1abcb5963d7f195
Author: christian 
Commit: christian 

Fix for trait and interface imenu
---
 phps-mode-parser-sdt.el | 12 ++--
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 89ab76a622..ff6135e7ed 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1005,7 +1005,7 @@
 imenu-nail
 phps-mode-parser-sdt-symbol-imenu--table))
 (let ((imenu-object (make-hash-table :test 'equal)))
-  (puthash 'declaration (nth 1 imenu-class) imenu-object)
+  (puthash 'declaration (nth 1 imenu-interface) 
imenu-object)
   (puthash
imenu-nail2
imenu-object
@@ -1098,7 +1098,7 @@
imenu-nail
phps-mode-parser-sdt-symbol-imenu--table)
 (let ((imenu-object (make-hash-table :test 'equal)))
-  (puthash 'declaration (nth 1 imenu-class) imenu-object)
+  (puthash 'declaration (nth 1 imenu-interface) imenu-object)
   (puthash
imenu-nail
imenu-object
@@ -3288,11 +3288,11 @@
  ;; Add class to imenu stack
  (if phps-mode-parser-sdt-symbol-imenu--stack
  (push
-  (list (list 'class class-name class-start class-end))
+  (list (list 'trait class-name class-start class-end))
   phps-mode-parser-sdt-symbol-imenu--stack)
(setq
 phps-mode-parser-sdt-symbol-imenu--stack
-(list (list (list 'class class-name class-start class-end)
+(list (list (list 'trait class-name class-start class-end)
 
  (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
(dolist (
@@ -3398,11 +3398,11 @@
  ;; Add class to imenu stack
  (if phps-mode-parser-sdt-symbol-imenu--stack
  (push
-  (list (list 'class class-name class-start class-end))
+  (list (list 'interface class-name class-start class-end))
   phps-mode-parser-sdt-symbol-imenu--stack)
(setq
 phps-mode-parser-sdt-symbol-imenu--stack
-(list (list (list 'class class-name class-start class-end)
+(list (list (list 'interface class-name class-start class-end)
 
  (when phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack
(dolist (



[elpa] externals/phps-mode be00689e6f 119/135: Fixed sorting of imenu

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit be00689e6f2f654c45d39152f739f72b6d7ca0e4
Author: Christian Johansson 
Commit: Christian Johansson 

Fixed sorting of imenu
---
 phps-mode-ast.el   | 92 --
 phps-mode-parser-sdt.el| 24 
 test/phps-mode-test-ast.el |  2 +-
 3 files changed, 74 insertions(+), 44 deletions(-)

diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index a6d9994243..7d4c4f18eb 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -82,38 +82,76 @@
   (maphash
(lambda (k v)
  (if (hash-table-p v)
- (let ((v-list))
+ (let ((v-list)
+   (v-index))
(maphash
 (lambda (k2 v2)
   (if (hash-table-p v2)
-(let ((v2-list))
-  (maphash
-   (lambda (k3 v3)
- (push
-  `(,k3 . ,v3)
-  v2-list))
-   v2)
-  (setq
-   v2-list
-   (sort
-v2-list
-(lambda (a b)
-  (< (cdr a) (cdr b)
-  (push
-   `(,k2 ,v2-list)
-   v-list))
-(push
- `(,k2 . ,v2)
- v-list)))
+  (let ((v2-list)
+(v2-index))
+(maphash
+ (lambda (k3 v3)
+   (if (symbolp k3)
+   (setq v2-index v3))
+   (push
+`(,k3 . ,v3)
+v2-list))
+ v2)
+
+;; Sort level 3
+(setq
+ v2-list
+ (sort
+  v2-list
+  (lambda (a b)
+(< (cdr a) (cdr b)
+(push `(declaration . ,v2-index) v2-list)
+(push `(,k2 ,v2-list) v-list))
+(if (symbolp k2)
+  (setq v-index v2)
+  (push `(,k2 . ,v2) v-list
 v)
-   ;; TODO Sort by index here
-   (push
-`(,k ,v-list)
-imenu-index))
-   (push
-`(,k . ,v)
-imenu-index)))
+
+   ;; Sort level 2
+   (setq
+v-list
+(sort
+ v-list
+ (lambda (a b)
+   (cond
+((and
+  (listp (cdr a))
+  (listp (cdr b)))
+ (< (cdr (car (car (cdr a (cdr (car (car (cdr b))
+((listp (cdr a))
+ (< (cdr (car (car (cdr a))) (cdr b
+((listp (cdr b))
+ (< (cdr a) (cdr (car (car (cdr b))
+(t
+ (< (cdr a) (cdr b)))
+   (push `(declaration . ,v-index) v-list)
+   (push `(,k ,v-list) imenu-index))
+   (push `(,k . ,v) imenu-index)))
phps-mode-parser-sdt-symbol-imenu--table)
+
+  ;; Sort level 1
+  (setq
+   imenu-index
+   (sort
+imenu-index
+(lambda (a b)
+  (cond
+   ((and
+ (listp (cdr a))
+ (listp (cdr b)))
+(< (cdr (car (car (cdr a (cdr (car (car (cdr b))
+   ((listp (cdr a))
+(< (cdr (car (car (cdr a))) (cdr b
+   ((listp (cdr b))
+(< (cdr a) (cdr (car (car (cdr b))
+   (t
+(< (cdr a) (cdr b)))
+
   ;; TODO sort imenu-index here
   ;; (setq
   ;;  imenu-index
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 2a471daf99..b58268f7e4 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -661,7 +661,9 @@
   (if (gethash
name
phps-mode-parser-sdt--bookkeeping--superglobal-variable-p)
-  name
+  (list
+   name
+   (list 'namespace nil 'class nil 'trait nil 'interface nil 'function nil 
'superglobal t))
 (let ((potential-uris (list ""))
   (scope-namespace)
   (scope-class)
@@ -1524,12 +1526,7 @@
  (format
   "%s (%d)"
   symbol-uri
-  (1+ (length (gethash symbol-uri 
phps-mode-parser-sdt-symbol-table-by-uri))
-;; TODO Place symbol in the correct place of the hierarchy here
-;; (push
-;;  `(,symbol-uri-duplicate . ,symbol-start)
-;;  phps-mode-parser-sdt-symbol-imenu)
-)
+  (1+ (le

[elpa] externals/phps-mode c0c37bafd9 110/135: Added some TODO items

2023-01-29 Thread Christian Johansson
branch: externals/phps-mode
commit c0c37bafd944ef01b468d06aebe9c73cc1a49142
Author: Christian Johansson 
Commit: Christian Johansson 

Added some TODO items
---
 phps-mode-parser-sdt.el | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index e1e91a35f7..88dae66d7a 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -2,6 +2,9 @@
 
 ;; Copyright (C) 2018-2022  Free Software Foundation, Inc.
 
+;; TODO 1. Should make imenu hierarchical
+;; TODO 2. Should fix bookkeeping issues in real-world example files
+;; TODO 3. (FUTURE) Fix bookkeeping in scope if-isset/!empty blocks
 
 ;;; Commentary:
 



  1   2   >