emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phps-mode bcf0c68945 038/212: AST-imenu and AST-bookkee


From: Christian Johansson
Subject: [elpa] externals/phps-mode bcf0c68945 038/212: AST-imenu and AST-bookkeeping now in standalone files
Date: Wed, 26 Jan 2022 01:50:21 -0500 (EST)

branch: externals/phps-mode
commit bcf0c6894502a36ec84acb279dd4ebb1bfeeb7d9
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>

    AST-imenu and AST-bookkeeping now in standalone files
---
 phps-mode-ast-bookkeeping.el | 591 ++++++++++++++++++++++++++++++++++++++
 phps-mode-ast-imenu.el       |  92 ++++++
 phps-mode-ast.el             | 657 +------------------------------------------
 phps-mode-parser-sdt.el      |  67 +++--
 test/phps-mode-test-ast.el   | 212 ++++++++------
 5 files changed, 854 insertions(+), 765 deletions(-)

diff --git a/phps-mode-ast-bookkeeping.el b/phps-mode-ast-bookkeeping.el
new file mode 100644
index 0000000000..72437dcef3
--- /dev/null
+++ b/phps-mode-ast-bookkeeping.el
@@ -0,0 +1,591 @@
+;;; phps-mode-ast-bookkeeping.el --- Bookkeeping from AST -*- lexical-binding: 
t -*-
+
+;; Copyright (C) 2018-2021  Free Software Foundation, Inc.
+
+
+;;; Commentary:
+
+
+;;; Code:
+
+
+(require 'phps-mode-ast)
+
+
+;;; Variables:
+
+
+(defvar-local
+  phps-mode-ast-bookkeeping--index
+  nil
+  "Bookkeeping for current buffer.")
+
+(defvar
+  phps-mode-ast-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.")
+
+
+;; Functions:
+
+
+(defun phps-mode-ast-bookkeeping--generate-symbol-namespace
+    (&optional namespace class function)
+  "Generate symbol namespace for NAMESPACE, CLASS and FUNCTION."
+  (let ((symbol-namespace ""))
+    (when namespace
+      (setq
+       symbol-namespace
+       (format
+        "%s namespace %s"
+        symbol-namespace
+        namespace)))
+    (when class
+      (setq
+       symbol-namespace
+       (format
+        "%s class %s"
+        symbol-namespace
+        class)))
+    (when function
+      (setq
+       symbol-namespace
+       (format
+        "%s function %s"
+        symbol-namespace
+        function)))
+    symbol-namespace))
+
+(defun phps-mode-ast-bookkeeping--generate-variable-namespace
+    (&optional namespace class function)
+  "Generate variable namespace for NAMESPACE, CLASS and FUNCTION."
+  (let ((variable-namespace ""))
+    (when class
+      (when namespace
+        (setq
+         variable-namespace
+         (format
+          "%s namespace %s"
+          variable-namespace
+          namespace)))
+      (setq
+       variable-namespace
+       (format
+        "%s class %s"
+        variable-namespace
+        class)))
+    (when function
+      (setq
+       variable-namespace
+       (format
+        "%s function %s"
+        variable-namespace
+        function)))
+    variable-namespace))
+
+(defun phps-mode-ast-bookkeeping--generate ()
+  "Generate AST for current buffer."
+  (let ((bookkeeping (make-hash-table :test 'equal))
+        (bookkeeping-stack phps-mode-ast--tree))
+    (while bookkeeping-stack
+      (let ((item-raw (pop bookkeeping-stack))
+            (item)
+            (class)
+            (function)
+            (namespace)
+            (variable-namespace "")
+            (symbol-namespace ""))
+        (if (listp (car item-raw))
+            (progn
+              (setq
+               class
+               (nth 0 (car item-raw)))
+              (setq
+               function
+               (nth 1 (car item-raw)))
+              (setq
+               namespace
+               (nth 2 (car item-raw)))
+              (setq
+               item
+               (car (cdr item-raw)))
+              (setq
+               symbol-namespace
+               (phps-mode-ast-bookkeeping--generate-symbol-namespace
+                namespace
+                class
+                function))
+              (setq
+               variable-namespace
+               (phps-mode-ast-bookkeeping--generate-variable-namespace
+                namespace
+                class
+                function)))
+          (setq
+           item
+           item-raw))
+
+        (let ((type (plist-get item 'ast-type)))
+          (cond
+
+           ((equal type 'simple-variable)
+            (let ((id (format
+                       "%s id %s"
+                       variable-namespace
+                       (plist-get item 'name)))
+                  (object (list
+                           (plist-get item 'start)
+                           (plist-get item 'end)))
+                  (defined-p 0))
+
+              (when (gethash id bookkeeping)
+                (setq
+                 defined-p
+                 1))
+
+              ;; Is 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 'function)
+            (let* ((name (plist-get item 'name))
+                   (subnamespace
+                    (format
+                     "%s function %s"
+                     symbol-namespace
+                     name)))
+              (when-let ((parameters (reverse (plist-get item 'parameters))))
+                (dolist (parameter parameters)
+                  (let ((id (format
+                             "%s id %s"
+                             subnamespace
+                             (plist-get parameter 'name)))
+                        (object (list
+                                 (plist-get parameter 'start)
+                                 (plist-get parameter 'end))))
+                    (puthash
+                     id
+                     1
+                     bookkeeping)
+                    (puthash
+                     object
+                     1
+                     bookkeeping))))
+
+              (when-let ((children (reverse (plist-get item 'children))))
+                (dolist (child children)
+                  (push
+                   (list
+                    (list
+                     class
+                     name
+                     namespace)
+                    child)
+                   bookkeeping-stack)))))
+
+           ((equal type 'method)
+            (let* ((name (plist-get item 'name))
+                   (subnamespace
+                    (format
+                     "%s function %s"
+                     symbol-namespace
+                     name)))
+
+              ;; TODO should only do this is method is not static
+              (let ((this-id
+                     (format
+                      "%s id %s"
+                      subnamespace
+                      "$this")))
+                (puthash
+                 this-id
+                 1
+                 bookkeeping))
+              (when-let ((parameters (reverse (plist-get item 'parameters))))
+                (dolist (parameter parameters)
+                  (let ((id (format
+                             "%s id %s"
+                             subnamespace
+                             (plist-get parameter 'name)))
+                        (object (list
+                                 (plist-get parameter 'start)
+                                 (plist-get parameter 'end))))
+                    (puthash
+                     id
+                     1
+                     bookkeeping)
+                    (puthash
+                     object
+                     1
+                     bookkeeping))))
+
+              (when-let ((children (reverse (plist-get item 'children))))
+                (dolist (child children)
+                  (push
+                   (list
+                    (list
+                     class
+                     name
+                     namespace)
+                    child)
+                   bookkeeping-stack)))))
+
+           ((equal type 'namespace)
+            (let* ((name (plist-get item 'name)))
+              (when-let ((children (reverse (plist-get item 'children))))
+                (dolist (child children)
+                  (push
+                   (list
+                    (list
+                     class
+                     function
+                     name)
+                    child)
+                   bookkeeping-stack)))))
+
+           ((equal type 'class)
+            (let ((name (plist-get item 'name)))
+              (when-let ((children (reverse (plist-get item 'children))))
+                (dolist (child children)
+                  (push
+                   (list
+                    (list
+                     name
+                     function
+                     namespace)
+                    child)
+                   bookkeeping-stack)))))
+
+           ((equal type 'if)
+            (when-let ((children (reverse (plist-get item 'children))))
+              (dolist (child children)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  child)
+                 bookkeeping-stack)))
+            (when-let ((conditions (reverse (plist-get item 'condition))))
+              (dolist (condition conditions)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  condition)
+                 bookkeeping-stack))))
+
+           ((equal type 'foreach)
+            (when-let ((children (reverse (plist-get item 'children))))
+              (dolist (child children)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  child)
+                 bookkeeping-stack)))
+            (when-let ((value (plist-get item 'value)))
+              (push
+               (list
+                (list
+                 class
+                 function
+                 namespace)
+                (list
+                 'ast-type
+                 'assign-variable
+                 'key
+                 value))
+               bookkeeping-stack))
+            (when-let ((key (plist-get item 'key)))
+              (push
+               (list
+                (list
+                 class
+                 function
+                 namespace)
+                (list
+                 'ast-type
+                 'assign-variable
+                 'key
+                 key))
+               bookkeeping-stack))
+            (when-let ((expression (reverse (plist-get item 'expression))))
+              (dolist (expr expression)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  expr)
+                 bookkeeping-stack))))
+
+           ((equal type 'for)
+            (when-let ((children (reverse (plist-get item 'children))))
+              (dolist (child children)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  child)
+                 bookkeeping-stack)))
+            (when-let ((children (reverse (plist-get item 'incremental))))
+              (dolist (child children)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  child)
+                 bookkeeping-stack)))
+            (when-let ((children (reverse (plist-get item 'test))))
+              (dolist (child children)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  child)
+                 bookkeeping-stack)))
+            (when-let ((children (reverse (plist-get item 'initial))))
+              (dolist (child children)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  child)
+                 bookkeeping-stack))))
+
+           ((equal type 'while)
+            (when-let ((children (reverse (plist-get item 'children))))
+              (dolist (child children)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  child)
+                 bookkeeping-stack)))
+            (when-let ((conditions (reverse (plist-get item 'condition))))
+              (dolist (condition conditions)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  condition)
+                 bookkeeping-stack))))
+
+           ((equal type 'do-while)
+            (when-let ((conditions (reverse (plist-get item 'condition))))
+              (dolist (condition conditions)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  condition)
+                 bookkeeping-stack)))
+            (when-let ((children (reverse (plist-get item 'children))))
+              (dolist (child children)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  child)
+                 bookkeeping-stack))))
+
+           ((equal type 'assign-property-variable)
+            (let ((id (format
+                       "%s id %s"
+                       variable-namespace
+                       (plist-get item 'key)))
+                  (object (list
+                           (plist-get item 'start)
+                           (plist-get item 'end)))
+                  (defined 1))
+              (when-let ((predefined (gethash id bookkeeping)))
+                (setq
+                 defined
+                 (1+ predefined)))
+              (puthash
+               id
+               defined
+               bookkeeping)
+              (puthash
+               object
+               defined
+               bookkeeping)))
+
+           ((equal type 'assign-variable)
+            (let ((id (format
+                       "%s id %s"
+                       variable-namespace
+                       (plist-get (plist-get item 'key) 'name)))
+                  (object (list
+                           (plist-get (plist-get item 'key) 'start)
+                           (plist-get (plist-get item 'key) 'end)))
+                  (defined 1))
+              (when-let ((predefined (gethash id bookkeeping)))
+                (setq
+                 defined
+                 (1+ predefined)))
+              (puthash
+               id
+               defined
+               bookkeeping)
+              (puthash
+               object
+               defined
+               bookkeeping)
+              (when-let ((exps (plist-get item 'value)))
+                (when (listp exps)
+                  (dolist (exp exps)
+                    (push
+                     (list
+                      (list
+                       class
+                       function
+                       namespace)
+                      exp)
+                     bookkeeping-stack))))))
+
+           ((equal type 'property)
+            (let ((subject (plist-get item 'subject))
+                  (static-p))
+              (when-let ((modifiers (plist-get item 'modifiers)))
+                (dolist (modifier modifiers)
+                  (when (equal modifier 'static)
+                    (setq
+                     static-p
+                     t))))
+              (if (stringp subject)
+                  (let ((id))
+                    (if static-p
+                        (setq
+                         id
+                         (format
+                          "%s static id %s"
+                          variable-namespace
+                          subject))
+                      (setq
+                       id
+                       (format
+                        "%s id %s"
+                        variable-namespace
+                        subject)))
+                    (let ((object (list
+                                   (plist-get item 'start)
+                                   (plist-get item 'end)))
+                          (defined 1))
+                      ;; (message "id: %S from %S" id item)
+                      (when-let ((predefined (gethash id bookkeeping)))
+                        (setq
+                         defined
+                         (1+ predefined)))
+                      (puthash
+                       id
+                       defined
+                       bookkeeping)
+                      (puthash
+                       object
+                       defined
+                       bookkeeping)))
+                (let ((class-namespace class))
+                  (when static-p
+                    (setq
+                     class-namespace
+                     (format
+                      "%s static"
+                      class-namespace)))
+                  (push
+                   (list
+                    (list
+                     class-namespace
+                     function
+                     namespace)
+                    subject)
+                   bookkeeping-stack)))))
+
+           ((equal type 'function_call)
+            (when-let ((arguments (plist-get item 'argument_list)))
+              (dolist (argument arguments)
+                (push
+                 (list
+                  (list
+                   class
+                   function
+                   namespace)
+                  argument)
+                 bookkeeping-stack))))
+
+           ((equal type 'increment-variable)
+            (push
+             (list
+              (list
+               class
+               function
+               namespace)
+              (plist-get item 'variable))
+             bookkeeping-stack))
+
+           ((equal type 'array-object-dereferencable)
+            (let* ((subject (plist-get item 'subject))
+                   (property-name (plist-get item 'property))
+                   (downcase-subject-name (downcase (plist-get subject 
'name))))
+
+              (cond
+
+               ((string= downcase-subject-name "$this")
+                (let ((sub-variable-namespace
+                       (phps-mode-ast-bookkeeping--generate-variable-namespace
+                        namespace
+                        nil
+                        function))
+                      (sub-symbol-namespace
+                       (phps-mode-ast-bookkeeping--generate-variable-namespace
+                        namespace
+                        nil
+                        function)))
+                  ;; TODO Check bookkeeping here
+                  ;; (gethash id bookkeeping)
+                  ))
+
+               )))
+
+           ))))
+    (setq
+     phps-mode-ast-bookkeeping--index
+     bookkeeping)
+
+    (message "\nBookkeeping\n:%S\n" bookkeeping)
+    phps-mode-ast-bookkeeping--index))
+
+
+(provide 'phps-mode-ast-bookkeeping)
+;;; phps-mode-ast-bookkeeping.el ends here
diff --git a/phps-mode-ast-imenu.el b/phps-mode-ast-imenu.el
new file mode 100644
index 0000000000..082c789bc5
--- /dev/null
+++ b/phps-mode-ast-imenu.el
@@ -0,0 +1,92 @@
+;;; phps-mode-ast-imenu.el --- Imenu from AST -*- lexical-binding: t -*-
+
+;; Copyright (C) 2018-2021  Free Software Foundation, Inc.
+
+
+;;; Commentary:
+
+
+;;; Code:
+
+
+(require 'phps-mode-ast)
+
+(defvar-local
+  phps-mode-ast-imenu--index
+  nil
+  "Imenu for current buffer.")
+
+(defun phps-mode-ast-imenu--generate ()
+  "Generate imenu from AST."
+  (let ((imenu-index))
+    (dolist (item phps-mode-ast--tree)
+      (let ((children (plist-get item 'children))
+            (item-type (plist-get item 'ast-type))
+            (item-index (plist-get item 'index))
+            (item-name (plist-get item 'name))
+            (parent))
+        (when (and
+               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)
+                                  (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))
+                   imenu-index)))
+            (push
+             `(,item-name . ,item-index)
+             imenu-index)))))
+    (setq
+     phps-mode-ast-imenu--index
+     (reverse imenu-index)))
+
+  (message "imenu:\n%S\n\n" phps-mode-ast-imenu--index)
+  phps-mode-ast-imenu--index)
+
+
+(provide 'phps-mode-ast-imenu)
+;;; phps-mode-ast-imenu.el ends here
diff --git a/phps-mode-ast.el b/phps-mode-ast.el
index 0f88380ef7..a25ee95567 100644
--- a/phps-mode-ast.el
+++ b/phps-mode-ast.el
@@ -15,101 +15,16 @@
 ;;; Variables:
 
 
-(defvar-local
-  phps-mode-ast--bookkeeping
-  nil
-  "Bookkeeping for current buffer.")
-
-(defvar-local
-  phps-mode-ast--imenu
-  nil
-  "Imenu for current buffer.")
-
 (defvar-local
   phps-mode-ast--tree
   nil
   "Tree for current buffer.")
 
-(defvar
-  phps-mode-ast--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.")
-
-;; Macros
-
-
-(defun phps-mode-ast--get-list-of-objects (objects)
-  "Get list of OBJECTS."
-  (cond
-
-   ((and (listp objects)
-         (plist-get objects 'ast-type))
-    (list objects))
-
-   ((listp objects)
-    objects)
-
-   (t (list objects))))
-
 
 ;; Functions:
 
 
-(defun phps-mode-bookkeeping-generate-symbol-namespace
-    (&optional namespace class function)
-  "Generate symbol namespace for NAMESPACE, CLASS and FUNCTION."
-  (let ((symbol-namespace ""))
-    (when namespace
-      (setq
-       symbol-namespace
-       (format
-        "%s namespace %s"
-        symbol-namespace
-        namespace)))
-    (when class
-      (setq
-       symbol-namespace
-       (format
-        "%s class %s"
-        symbol-namespace
-        class)))
-    (when function
-      (setq
-       symbol-namespace
-       (format
-        "%s function %s"
-        symbol-namespace
-        function)))
-    symbol-namespace))
-
-(defun phps-mode-bookkeeping-generate-variable-namespace
-    (&optional namespace class function)
-  "Generate variable namespace for NAMESPACE, CLASS and FUNCTION."
-  (let ((variable-namespace ""))
-    (when class
-      (when namespace
-        (setq
-         variable-namespace
-         (format
-          "%s namespace %s"
-          variable-namespace
-          namespace)))
-      (setq
-       variable-namespace
-       (format
-        "%s class %s"
-        variable-namespace
-        class)))
-    (when function
-      (setq
-       variable-namespace
-       (format
-        "%s function %s"
-        variable-namespace
-        function)))
-    variable-namespace))
-
-(defun phps-mode-ast-generate ()
+(defun phps-mode-ast--generate ()
   "Generate AST for current buffer."
   (let ((translation (phps-mode-parser-translate))
         (namespace)
@@ -168,576 +83,10 @@
      (reverse ast))
 
     (message "AST:\n%S\n\n" ast)
-
-    (let ((imenu-index))
-      (dolist (item ast)
-        (let ((children (plist-get item 'children))
-              (item-type (plist-get item 'ast-type))
-              (item-index (plist-get item 'index))
-              (item-name (plist-get item 'name))
-              (parent))
-          (when (and
-                 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)
-                                    (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))
-                     imenu-index)))
-              (push
-               `(,item-name . ,item-index)
-               imenu-index)))))
-      (setq
-       phps-mode-ast--imenu
-       (reverse imenu-index)))
-
-    (message "imenu:\n%S\n\n" phps-mode-ast--imenu)
-
-    ;; TODO Build bookkeeping here
-    (let ((bookkeeping-stack ast))
-      (while bookkeeping-stack
-        (let ((item-raw (pop bookkeeping-stack))
-              (item)
-              (class)
-              (function)
-              (namespace)
-              (variable-namespace "")
-              (symbol-namespace ""))
-          (if (listp (car item-raw))
-              (progn
-                (setq
-                 class
-                 (nth 0 (car item-raw)))
-                (setq
-                 function
-                 (nth 1 (car item-raw)))
-                (setq
-                 namespace
-                 (nth 2 (car item-raw)))
-                (setq
-                 item
-                 (car (cdr item-raw)))
-                (setq
-                 symbol-namespace
-                 (phps-mode-bookkeeping-generate-symbol-namespace
-                  namespace
-                  class
-                  function))
-                (setq
-                 variable-namespace
-                 (phps-mode-bookkeeping-generate-variable-namespace
-                  namespace
-                  class
-                  function)))
-            (setq
-             item
-             item-raw))
-
-          (let ((type (plist-get item 'ast-type)))
-            (cond
-
-             ((equal type 'simple-variable)
-              (let ((id (format
-                         "%s id %s"
-                         variable-namespace
-                         (plist-get item 'name)))
-                    (object (list
-                             (plist-get item 'start)
-                             (plist-get item 'end)))
-                    (defined-p 0))
-
-                (when (gethash id bookkeeping)
-                  (setq
-                   defined-p
-                   1))
-
-                ;; Is a super-global variable?
-                (when (gethash
-                       (plist-get item 'name)
-                       phps-mode-ast--superglobal-variable-p)
-                  (setq
-                   defined-p
-                   1))
-                (puthash
-                 object
-                 defined-p
-                 bookkeeping)))
-
-             ((equal type 'function)
-              (let* ((name (plist-get item 'name))
-                    (subnamespace
-                     (format
-                      "%s function %s"
-                      symbol-namespace
-                      name)))
-                (when-let ((parameters (reverse (plist-get item 'parameters))))
-                  (dolist (parameter parameters)
-                    (let ((id (format
-                               "%s id %s"
-                               subnamespace
-                               (plist-get parameter 'name)))
-                          (object (list
-                                   (plist-get parameter 'start)
-                                   (plist-get parameter 'end))))
-                      (puthash
-                       id
-                       1
-                       bookkeeping)
-                      (puthash
-                       object
-                       1
-                       bookkeeping))))
-
-                (when-let ((children (reverse (plist-get item 'children))))
-                  (dolist (child children)
-                    (push
-                     (list
-                      (list
-                       class
-                       name
-                       namespace)
-                      child)
-                     bookkeeping-stack)))))
-
-             ((equal type 'method)
-              (let* ((name (plist-get item 'name))
-                     (subnamespace
-                      (format
-                       "%s function %s"
-                       symbol-namespace
-                       name)))
-
-                ;; TODO should only do this is method is not static
-                (let ((this-id
-                       (format
-                        "%s id %s"
-                        subnamespace
-                        "$this")))
-                  (puthash
-                   this-id
-                   1
-                   bookkeeping))
-                (when-let ((parameters (reverse (plist-get item 'parameters))))
-                  (dolist (parameter parameters)
-                    (let ((id (format
-                               "%s id %s"
-                               subnamespace
-                               (plist-get parameter 'name)))
-                          (object (list
-                                   (plist-get parameter 'start)
-                                   (plist-get parameter 'end))))
-                      (puthash
-                       id
-                       1
-                       bookkeeping)
-                      (puthash
-                       object
-                       1
-                       bookkeeping))))
-
-                (when-let ((children (reverse (plist-get item 'children))))
-                  (dolist (child children)
-                    (push
-                     (list
-                      (list
-                       class
-                       name
-                       namespace)
-                      child)
-                     bookkeeping-stack)))))
-
-             ((equal type 'namespace)
-              (let* ((name (plist-get item 'name)))
-                (when-let ((children (reverse (plist-get item 'children))))
-                  (dolist (child children)
-                    (push
-                     (list
-                      (list
-                       class
-                       function
-                       name)
-                      child)
-                     bookkeeping-stack)))))
-
-             ((equal type 'class)
-              (let ((name (plist-get item 'name)))
-                (when-let ((children (reverse (plist-get item 'children))))
-                  (dolist (child children)
-                    (push
-                     (list
-                      (list
-                       name
-                       function
-                       namespace)
-                      child)
-                     bookkeeping-stack)))))
-
-             ((equal type 'if)
-              (when-let ((children (reverse (plist-get item 'children))))
-                (dolist (child children)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    child)
-                   bookkeeping-stack)))
-              (when-let ((conditions (reverse (plist-get item 'condition))))
-                (dolist (condition conditions)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    condition)
-                   bookkeeping-stack))))
-
-             ((equal type 'foreach)
-              (when-let ((children (reverse (plist-get item 'children))))
-                (dolist (child children)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    child)
-                   bookkeeping-stack)))
-              (when-let ((value (plist-get item 'value)))
-                (push
-                 (list
-                  (list
-                   class
-                   function
-                   namespace)
-                  (list
-                   'ast-type
-                   'assign-variable
-                   'key
-                   value))
-                 bookkeeping-stack))
-              (when-let ((key (plist-get item 'key)))
-                (push
-                 (list
-                  (list
-                   class
-                   function
-                   namespace)
-                  (list
-                   'ast-type
-                   'assign-variable
-                   'key
-                   key))
-                 bookkeeping-stack))
-              (when-let ((expression (reverse (plist-get item 'expression))))
-                (dolist (expr expression)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    expr)
-                   bookkeeping-stack))))
-
-             ((equal type 'for)
-              (when-let ((children (reverse (plist-get item 'children))))
-                (dolist (child children)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    child)
-                   bookkeeping-stack)))
-              (when-let ((children (reverse (plist-get item 'incremental))))
-                (dolist (child children)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    child)
-                   bookkeeping-stack)))
-              (when-let ((children (reverse (plist-get item 'test))))
-                (dolist (child children)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    child)
-                   bookkeeping-stack)))
-              (when-let ((children (reverse (plist-get item 'initial))))
-                (dolist (child children)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    child)
-                   bookkeeping-stack))))
-
-             ((equal type 'while)
-              (when-let ((children (reverse (plist-get item 'children))))
-                (dolist (child children)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    child)
-                   bookkeeping-stack)))
-              (when-let ((conditions (reverse (plist-get item 'condition))))
-                (dolist (condition conditions)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    condition)
-                   bookkeeping-stack))))
-
-             ((equal type 'do-while)
-              (when-let ((conditions (reverse (plist-get item 'condition))))
-                (dolist (condition conditions)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    condition)
-                   bookkeeping-stack)))
-              (when-let ((children (reverse (plist-get item 'children))))
-                (dolist (child children)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    child)
-                   bookkeeping-stack))))
-
-             ((equal type 'assign-property-variable)
-              (let ((id (format
-                         "%s id %s"
-                         variable-namespace
-                         (plist-get item 'key)))
-                    (object (list
-                             (plist-get item 'start)
-                             (plist-get item 'end)))
-                    (defined 1))
-                (when-let ((predefined (gethash id bookkeeping)))
-                  (setq
-                   defined
-                   (1+ predefined)))
-                (puthash
-                 id
-                 defined
-                 bookkeeping)
-                (puthash
-                 object
-                 defined
-                 bookkeeping)))
-
-             ((equal type 'assign-variable)
-              (let ((id (format
-                         "%s id %s"
-                         variable-namespace
-                         (plist-get (plist-get item 'key) 'name)))
-                    (object (list
-                             (plist-get (plist-get item 'key) 'start)
-                             (plist-get (plist-get item 'key) 'end)))
-                    (defined 1))
-                (when-let ((predefined (gethash id bookkeeping)))
-                  (setq
-                   defined
-                   (1+ predefined)))
-                (puthash
-                 id
-                 defined
-                 bookkeeping)
-                (puthash
-                 object
-                 defined
-                 bookkeeping)
-                (when-let ((exps (plist-get item 'value)))
-                  (when (listp exps)
-                    (dolist (exp exps)
-                      (push
-                       (list
-                        (list
-                         class
-                         function
-                         namespace)
-                        exp)
-                       bookkeeping-stack))))))
-
-             ((equal type 'property)
-              (let ((subject (plist-get item 'subject))
-                    (static-p))
-                (when-let ((modifiers (plist-get item 'modifiers)))
-                  (dolist (modifier modifiers)
-                    (when (equal modifier 'static)
-                      (setq
-                       static-p
-                       t))))
-                (if (stringp subject)
-                    (let ((id))
-                      (if static-p
-                          (setq
-                           id
-                           (format
-                            "%s static id %s"
-                            variable-namespace
-                            subject))
-                        (setq
-                         id
-                         (format
-                          "%s id %s"
-                          variable-namespace
-                          subject)))
-                      (let ((object (list
-                                     (plist-get item 'start)
-                                     (plist-get item 'end)))
-                            (defined 1))
-                        ;; (message "id: %S from %S" id item)
-                        (when-let ((predefined (gethash id bookkeeping)))
-                          (setq
-                           defined
-                           (1+ predefined)))
-                        (puthash
-                         id
-                         defined
-                         bookkeeping)
-                        (puthash
-                         object
-                         defined
-                         bookkeeping)))
-                  (let ((class-namespace class))
-                    (when static-p
-                      (setq
-                       class-namespace
-                       (format
-                        "%s static"
-                        class-namespace)))
-                    (push
-                     (list
-                      (list
-                       class-namespace
-                       function
-                       namespace)
-                      subject)
-                     bookkeeping-stack)))))
-
-             ((equal type 'function_call)
-              (when-let ((arguments (plist-get item 'argument_list)))
-                (dolist (argument arguments)
-                  (push
-                   (list
-                    (list
-                     class
-                     function
-                     namespace)
-                    argument)
-                   bookkeeping-stack))))
-
-             ((equal type 'increment-variable)
-              (push
-               (list
-                (list
-                 class
-                 function
-                 namespace)
-                (plist-get item 'variable))
-               bookkeeping-stack))
-
-             ((equal type 'array-object-dereferencable)
-              (let* ((subject (plist-get item 'subject))
-                     (property-name (plist-get item 'property))
-                     (downcase-subject (downcase subject)))
-
-                (cond
-
-                 ((string= downcase-subject "$this")
-                  (let ((sub-variable-namespace
-                         (phps-mode-bookkeeping-generate-variable-namespace
-                          namespace
-                          nil
-                          function))
-                        (sub-symbol-namespace
-                         (phps-mode-bookkeeping-generate-variable-namespace
-                          namespace
-                          nil
-                          function)))
-                    ;; TODO Check bookkeeping here
-                    ;; (gethash id bookkeeping)
-                    ))
-
-                 )))
-
-             )))))
-    (setq
-     phps-mode-ast--bookkeeping
-     bookkeeping)
-
-    (message "\nBookkeeping\n:%S\n" bookkeeping)
-
     (setq
      phps-mode-ast--tree
-     ast)))
+     ast)
+    phps-mode-ast--tree))
 
 
 (provide 'phps-mode-ast)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index fde7fc6a29..08ec076dc4 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -11,6 +11,19 @@
 
 (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))))
+
 ;; top_statement_list -> (top_statement_list top_statement)
 (puthash
  79
@@ -108,9 +121,9 @@
            'ast-type
            'while
            'condition
-           (phps-mode-ast--get-list-of-objects (nth 2 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 2 args))
            'children
-           (phps-mode-ast--get-list-of-objects (nth 4 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 4 args)))))
      ast-object))
  phps-mode-parser--table-translations)
 
@@ -123,9 +136,9 @@
            'ast-type
            'do-while
            'children
-           (phps-mode-ast--get-list-of-objects (nth 1 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 1 args))
            'condition
-           (phps-mode-ast--get-list-of-objects (nth 4 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 4 args)))))
      ast-object))
  phps-mode-parser--table-translations)
 
@@ -138,13 +151,13 @@
            'ast-type
            'for
            'initial
-           (phps-mode-ast--get-list-of-objects (nth 2 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 2 args))
            'test
-           (phps-mode-ast--get-list-of-objects (nth 4 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 4 args))
            'incremental
-           (phps-mode-ast--get-list-of-objects (nth 6 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 6 args))
            'children
-           (phps-mode-ast--get-list-of-objects (nth 8 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 8 args)))))
      ast-object))
  phps-mode-parser--table-translations)
 
@@ -157,7 +170,7 @@
            'ast-type
            'echo
            'children
-           (phps-mode-ast--get-list-of-objects (nth 1 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 1 args)))))
      ast-object))
  phps-mode-parser--table-translations)
 
@@ -177,11 +190,11 @@
            'ast-type
            'foreach
            'expression
-           (phps-mode-ast--get-list-of-objects (nth 2 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 2 args))
            'value
            (nth 4 args)
            'children
-           (phps-mode-ast--get-list-of-objects (nth 6 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 6 args)))))
      ast-object))
  phps-mode-parser--table-translations)
 
@@ -194,13 +207,13 @@
            'ast-type
            'foreach
            'expression
-           (phps-mode-ast--get-list-of-objects (nth 2 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 2 args))
            'key
            (nth 4 args)
            'value
            (nth 6 args)
            'children
-           (phps-mode-ast--get-list-of-objects (nth 8 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 8 args)))))
      ast-object))
  phps-mode-parser--table-translations)
 
@@ -227,7 +240,7 @@
            'return-type
            (nth 7 args)
            'children
-           (phps-mode-ast--get-list-of-objects (nth 10 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 10 args)))))
      ;; (message "Function: %S" ast-object)
      ;; (message "args: %S" args)
      ;; (message "terminals: %S" terminals)
@@ -245,9 +258,9 @@
            'name
            (nth 1 args)
            'extends
-           (phps-mode-ast--get-list-of-objects (nth 2 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 2 args))
            'implements
-           (phps-mode-ast--get-list-of-objects (nth 3 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 3 args))
            'index
            (car (cdr (nth 1 terminals)))
            'start
@@ -255,7 +268,7 @@
            'end
            (car (cdr (nth 7 terminals)))
            'children
-           (phps-mode-ast--get-list-of-objects (nth 6 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 6 args)))))
      ;; (message "Class %S" ast-object)
      ;; (message "args: %S" args)
      ;; (message "terminals: %S" terminals)
@@ -273,7 +286,7 @@
            'name
            (nth 1 args)
            'extends
-           (phps-mode-ast--get-list-of-objects (nth 2 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 2 args))
            'index
            (car (cdr (nth 1 terminals)))
            'start
@@ -281,7 +294,7 @@
            'end
            (car (cdr (nth 6 terminals)))
            'children
-           (phps-mode-ast--get-list-of-objects (nth 5 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 5 args)))))
      ;; (message "Interface %S" ast-object)
      ;; (message "args: %S" args)
      ;; (message "terminals: %S" terminals)
@@ -313,9 +326,9 @@
            'ast-type
            'if
            'condition
-           (phps-mode-ast--get-list-of-objects (nth 2 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 2 args))
            'children
-           (phps-mode-ast--get-list-of-objects (nth 4 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 4 args)))))
      ast-object))
  phps-mode-parser--table-translations)
 
@@ -383,7 +396,7 @@
            'ast-type
            'property
            'modifiers
-           (phps-mode-ast--get-list-of-objects (nth 0 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 0 args))
            'type
            (nth 1 args)
            'subject
@@ -404,7 +417,7 @@
            'ast-type
            'method
            'modifiers
-           (phps-mode-ast--get-list-of-objects (nth 0 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 0 args))
            'returns-reference-p
            (not (equal (nth 2 args) nil))
            'name
@@ -414,7 +427,7 @@
            'return-type
            (nth 8 args)
            'children
-           (phps-mode-ast--get-list-of-objects (nth 10 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 10 args))
            'index
            (car (cdr (nth 3 terminals)))
            'start
@@ -502,7 +515,7 @@
            'key
            (nth 0 args)
            'value
-           (phps-mode-ast--get-list-of-objects (nth 2 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 2 args))
            'index
            (car (cdr (nth 0 terminals)))
            'start
@@ -537,7 +550,7 @@
            'key
            (nth 0 args)
            'value
-           (phps-mode-ast--get-list-of-objects (nth 2 args))
+           (phps-mode-parser-sdt--get-list-of-object (nth 2 args))
            'index
            (car (cdr (nth 0 terminals)))
            'start
@@ -562,7 +575,7 @@
            'name
            (nth 0 args)
            'argument_list
-           (phps-mode-ast--get-list-of-objects (nth 1 args)))))
+           (phps-mode-parser-sdt--get-list-of-object (nth 1 args)))))
      ast-object))
  phps-mode-parser--table-translations)
 
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index edcb24f95d..c57b9420f8 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -29,6 +29,8 @@
 (require 'phps-mode)
 (require 'phps-mode-test)
 (require 'phps-mode-ast)
+(require 'phps-mode-ast-bookkeeping)
+(require 'phps-mode-ast-imenu)
 
 (defun phps-mode-test-ast--buffer-contents (buffer-contents name logic)
   (with-temp-buffer
@@ -87,127 +89,140 @@
    "<?php\nclass myClass\n{\n\n    public function myFunction1()\n    {\n      
  echo \"my string with variable {$variable} inside it\";\n    }\n\n    public 
function myFunction2()\n    {\n    }\n\n}"
    "Imenu generated via parser SDT for simple class"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should (equal
-              phps-mode-ast--imenu
+              phps-mode-ast-imenu--index
               '(("myClass" ("myFunction1" . 44) ("myFunction2" . 153)))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\ninterface myInterface {\n    public function myFunctionA() {}\n    
protected function myFunctionB() {}\n}\n"
    "Imenu generated via parser SDT for interface"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should (equal
-              phps-mode-ast--imenu
+              phps-mode-ast-imenu--index
               '(("myInterface" . (("myFunctionA" . 51) ("myFunctionB" . 
91))))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\nfunction myFunctionA() {}\nfunction myFunctionB() {}\n$var = 
function () {\n    echo 'here';\n};"
    "Imenu generated via parser SDT for function-oriented file without 
namespace"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should (equal
-              phps-mode-ast--imenu
+              phps-mode-ast-imenu--index
               '(("myFunctionA" . 16) ("myFunctionB" . 42))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\n\nnamespace MyNamespace;\n\nfunction aFunction() {\n    /**\n     * 
With some contents\n     */\n}\n\nclass MyClass\n{\n\n    /**\n     *\n     
*/\n    public function __construct()\n    {\n        if ($test) {\n        }\n 
   }\n\n    /**\n     *\n     */\n    public function myFunction1()\n    {\n    
    $this->addMessage(\"My random {$message} here\" . ($random > 1 ? \"A\" : 
\"\") . \" was here.\");\n    }\n    \n    /**\n     *\n     */\n    public 
function myFunction2()\n [...]
    "Passed imenu-generation via parser AST for basic object oriented file"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        '(("MyNamespace" ("aFunction" . 41) ("MyClass" ("__construct" . 160) 
("myFunction1" . 261) ("myFunction2" . 433) ("myFunction3" . 513) 
("myFunction4" . 583))))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\n\nnamespace MyNamespaceA\n{\n    function aFunctionA() {\n        
/**\n         * With some contents\n         */\n    }\n    class MyClass\n    
{\n\n        /**\n         *\n         */\n        public function 
__construct()\n        {\n            if ($test) {\n            }\n        
}\n\n        /**\n         *\n         */\n        public function 
myFunction1()\n        {\n            $this->addMessage(\"My random {$message} 
here\" . ($random > 1 ? \"A\" : \"\") . \" was h [...]
    "Passed imenu-generation via parser AST for advanced object oriented file"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        '(("MyNamespaceA" ("aFunctionA" . 46) ("MyClass" ("__construct" . 205) 
("myFunction1" . 338) ("myFunction2" . 542) ("myFunction3" . 646) 
("myFunction4" . 740))) ("aFunctionB" . 807) ("MyClass" ("__construct" . 925) 
("myFunction1" . 1058) ("myFunction2" . 1262) ("myFunction3" . 1366) 
("myFunction4" . 1460)))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\nnamespace myNamespace {\n    class myClass extends myAbstract {\n   
     public function myFunctionA() {}\n        protected function myFunctionB() 
{}\n    }\n}\n"
    "Imenu object-oriented file with namespace, class that extends and 
functions"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        '(("myNamespace" ("myClass" ("myFunctionA" . 94) ("myFunctionB" . 
138))))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements 
myInterface {\n    public function myFunctionA() {}\n    protected function 
myFunctionB() {}\n}\n"
    "Imenu object-oriented file with bracket-less namespace, class that extends 
and implements and functions"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        '(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" . 
148))))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\nclass myClass {}"
    "Imenu empty class"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        '(("myClass" . 13))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\nnamespace myNamespace {}"
    "Imenu empty bracketed namespace"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        '(("myNamespace" . 17))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\nnamespace myNamespace;"
    "Imenu empty namespace without brackets"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        '(("myNamespace" . 17))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\nnamespace myNamespace;\nclass myClass extends myAbstract implements 
myInterface {\n    public function myFunctionA($myArg = null) {}\n    protected 
function myFunctionB($myArg = 'abc') {}\n}\n"
    "Imenu object-oriented file with bracket-less namespace, class that extends 
and implements and functions with optional arguments"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        '(("myNamespace" ("myClass" ("myFunctionA" . 108) ("myFunctionB" . 
161))))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\nnamespace myNamespace\\myNamespace2;\nclass myClass extends 
myAbstract implements myInterface {\n    public function myFunctionA($myArg = 
null) {}\n    protected function myFunctionB($myArg = 'abc') {}\n}\n"
    "Imenu object-oriented file with bracket-less namespace with multiple 
levels, class that extends and implements and functions with optional arguments"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        '(("myNamespace\\myNamespace2" ("myClass" ("myFunctionA" . 121) 
("myFunctionB" . 174))))))))
 
   (phps-mode-test-ast--buffer-contents
    "<?php\nnamespace {}"
    "Imenu empty unnamed bracketed namespace"
    (lambda()
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-imenu--generate)
      (should
       (equal
-       phps-mode-ast--imenu
+       phps-mode-ast-imenu--index
        nil))))
 
   (message "\n-- Ran tests for imenu generation. --"))
@@ -231,9 +246,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $var" 1) (list (list 8 12) 1) (list (list 27 
32) 0) (list (list 73 77) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -251,9 +267,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
    (should (equal
-            (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+            (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
             (list (list " id $var" 1) (list (list 8 12) 1) (list (list 27 31) 
1) (list (list 72 77) 0))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -271,9 +288,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '((" id $var2" 1) ((8 13) 1) (" function myFunction id $var" 1) 
((40 44) 1) (" function myFunction id $var3" 1) ((52 57) 1) ((71 75) 1) ((113 
118) 0) ((157 162) 1) (" function myFunction2 id $abc" 1) ((216 220) 1) ((232 
236) 0) ((275 279) 1) ((316 320) 0) ((347 352) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -291,10 +309,11 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should
       (equal
-       (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+       (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
        (list (list (list 30 35) 1) (list (list 61 67) 1) (list (list 93 101) 
1) (list (list 127 136) 1) (list (list 162 171) 1) (list (list 197 205) 1) 
(list (list 231 239) 1) (list (list 265 272) 1) (list (list 298 303) 1) (list 
(list 329 334) 1) (list (list 360 365) 1)  (list (list 391 414) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -312,10 +331,11 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should
       (equal
-       (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping 1)
+       (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index 1)
        (list (list " id $var" 1) (list (list 37 41) 1) (list " namespace 
myNamespaceA class myClassA id $var2" 1) (list (list 86 91) 1) (list " 
namespace myNamespaceA class myClassA function myFunctionA id $this" 1) (list " 
namespace myNamespaceA class myClassA function myFunctionA id $var3" 1) (list 
(list 128 133) 1) (list " namespace myNamespaceA class myClassA function 
myFunctionA id $var4" 1) (list (list 149 154) 1) (list (list 178 182) 0) (list 
(list 245 250) 0) (list (list 313 318) [...]
 
   (phps-mode-test-ast--buffer-contents
@@ -333,9 +353,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $items" 1) (list (list 36 42) 1) (list (list 70 
76) 1) (list " id $item" 1) (list (list 80 85) 1) (list (list 97 102) 1) (list 
(list 143 149) 1) (list " id $key" 1) (list (list 153 157) 1) (list " id 
$value" 1) (list (list 161 167) 1) (list (list 179 183) 1) (list (list 187 193) 
1) (list " id $i" 1) (list (list 230 232) 1) (list (list 238 240) 1) (list 
(list 249 255) 1) (list (list 258 260) 1) (list (list 274 276) 1) (list " id 
$a" 1) (list (list 312 314) 1 [...]
 
   (phps-mode-test-ast--buffer-contents
@@ -353,9 +374,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " class myParent id $var1" 1) (list (list 93 98) 1) 
(list " class myParent static id $var2" 1) (list (list 127 132) 1) (list " 
class myParent id $var3" 1) (list (list 145 150) 1) (list " class myParent id 
$var4" 1) (list (list 160 165) 1) (list " class myParent function __construct 
id $this" 1) (list (list 208 213) 1) (list (list 263 268) 1) (list (list 270 
274) 1) (list (list 330 335) 0) (list (list 392 397) 1) (list (list 447 452) 1) 
(list (list 454 458) 1) (l [...]
 
   (phps-mode-test-ast--buffer-contents
@@ -373,9 +395,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $e" 1) (list (list 39 41) 1) (list (list 53 55) 
1) (list (list 92 94) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -393,9 +416,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $example" 1) (list (list 8 16) 1) (list " 
anonymous function 1 id $test" 1) (list (list 29 34) 1) (list (list 46 51) 1) 
(list (list 89 97) 0) (list " id $example2" 1) (list (list 131 140) 1) (list " 
anonymous function 2 id $test2" 1) (list (list 153 159) 1) (list " anonymous 
function 2 id $example" 1) (list (list 166 174) 1) (list (list 186 192) 1) 
(list (list 230 238) 1) (list (list 276 285) 0) (list (list 324 333) 0) (list 
(list 371 376) 0) (list (list 40 [...]
 
   (phps-mode-test-ast--buffer-contents
@@ -413,9 +437,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " class myClass function __construct id $this" 1) 
(list (list 89 94) 1) (list (list 114 119) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -433,9 +458,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $items" 1) (list (list 7 13) 1) (list (list 41 
47) 1) (list " id $item" 1) (list (list 52 57) 1) (list (list 69 74) 1) (list 
(list 115 121) 1) (list " id $key" 1) (list (list 125 129) 1) (list " id 
$item2" 1) (list (list 134 140) 1) (list (list 152 157) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -453,9 +479,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $random" 1) (list (list 9 16) 1) (list " id 
$bandom" 1) (list (list 18 25) 1) (list (list 45 52) 1) (list (list 78 85) 1) 
(list " id $random2" 1) (list (list 114 122) 1) (list " id $bandom2" 1) (list 
(list 124 132) 1) (list (list 153 161) 1) (list (list 187 195) 0))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -473,9 +500,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $var" 1) (list (list 8 12) 1) (list " function 
test id $abc" 1) (list (list 35 39) 1) (list " function test id $var" 1) (list 
(list 54 58) 1) (list (list 68 72) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -493,9 +521,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $y" 1) (list (list 7 9) 1) (list " id $fn1" 1) 
(list (list 15 19) 1) (list " arrow function 1 id $x" 1) (list (list 25 27) 1) 
(list (list 32 34) 1) (list (list 37 39) 1) (list " id $z" 1) (list (list 41 
43) 1) (list " id $fn" 1) (list (list 49 52) 1) (list " arrow function 2 id 
$x2" 1) (list (list 58 61) 1) (list " arrow function 2 id $y2" 1) (list (list 
69 72) 1) (list (list 77 80) 1) (list (list 83 86) 1) (list (list 89 91) 1) 
(list " arrow function 3 id  [...]
 
   (phps-mode-test-ast--buffer-contents
@@ -513,9 +542,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $z" 1) (list (list 7 9) 1) (list (list 52 54) 
1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -533,9 +563,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " id $var" 1) (list (list 12 16) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -553,9 +584,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " defined 1 id $x" 1) (list (list 18 20) 1) (list 
(list 33 35) 1) (list " defined 2 id $i" 1) (list (list 77 79) 1) (list " 
defined 2 id $u" 1) (list (list 81 83) 1) (list (list 104 106) 1) (list (list 
168 170) 1) (list (list 232 234) 1) (list (list 302 304) 0) (list (list 355 
357) 0) (list (list 408 410) 0) (list " defined 3 id $y" 1) (list (list 445 
447) 1) (list (list 460 462) 1) (list " defined 4 id $k" 1) (list (list 505 
507) 1) (list " defined 4 id $L" 1)  [...]
 
   (phps-mode-test-ast--buffer-contents
@@ -573,9 +605,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               (list (list " class myInterface function myFunction2 id $x" 1) 
(list (list 84 86) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -593,9 +626,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '(((50 52) 0) (" function myFunction2 id $b" 1) ((87 89) 1) 
((103 105) 1) ((143 145) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -613,9 +647,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '((" id $a" 1) ((8 10) 1) ((38 40) 1) (" id $uri" 1) ((44 48) 1) 
(" id $page" 1) ((52 57) 1) (" defined 1 id $pages" 1) ((75 81) 1) ((98 100) 1) 
((150 154) 1) ((204 209) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -633,9 +668,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '((" defined 1 id $b" 2) ((17 19) 1) ((28 30) 1) (" id $c" 1) 
((42 44) 1) ((55 57) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -653,9 +689,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '(((18 20) 0) ((33 35) 0))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -673,9 +710,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '((" function myFunction id $a" 1) ((28 30) 1) (" function 
myFunction id $b" 1) ((32 34) 1) (" function myFunction id $c" 1) ((36 38) 1) 
(" function myFunction id $d" 1) ((40 42) 1) (" function myFunction id $f" 1) 
((57 59) 1) (" function myFunction id $g" 1) ((61 63) 1) (" function myFunction 
defined 1 id $f" 1) ((79 81) 1) (" function myFunction defined 2 id $g" 1) 
((105 107) 1) ((128 130) 1) ((192 194) 1) ((256 258) 1) ((320 322) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -693,9 +731,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '((" id $var" 1) ((8 12) 1) (" function test id $abc" 1) ((35 
39) 1) (" function test id $var" 1) ((54 58) 1) ((68 72) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -713,9 +752,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '((" id $a" 1) ((15 17) 1) (" id $b" 1) ((19 21) 1) ((28 30) 1) 
(" function myFunction id $c" 1) ((73 75) 1) (" function myFunction id $a" 1) 
((90 92) 1) ((102 104) 1) ((142 144) 0))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -733,9 +773,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '((" id $a" 1) ((15 17) 1) ((24 26) 1) (" function test id $a" 
1) ((61 63) 1) ((73 75) 1) (" class There function here id $this" 1) (" class 
There function here id $a" 1) ((138 140) 1) ((154 156) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -753,9 +794,10 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should (equal
-              (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+              (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
               '((" namespace Here function here id $a" 1) ((66 68) 1) ((82 84) 
1) (" namespace Here class There function Near id $this" 1) (" namespace Here 
class There function Near id $a" 1)  ((177 179) 1) ((197 199) 1) (" id $a" 1) 
((245 247) 1) ((257 259) 1))))))
 
   (phps-mode-test-ast--buffer-contents
@@ -773,10 +815,11 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should
       (equal
-       (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+       (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
        '((" 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) ((46 [...]
 
   (phps-mode-test-ast--buffer-contents
@@ -794,10 +837,11 @@
             production-number
             (car (car production))
             (car (cdr production))))))
-     (phps-mode-ast-generate)
+     (phps-mode-ast--generate)
+     (phps-mode-ast-bookkeeping--generate)
      (should
       (equal
-       (phps-mode-test--hash-to-list phps-mode-ast--bookkeeping t)
+       (phps-mode-test--hash-to-list phps-mode-ast-bookkeeping--index t)
        '((" id $a" 1) ((8 10) 1) (" id $b" 1) ((13 15) 1) (" id $c" 1) ((18 
20) 1) ((31 33) 1) ((51 53) 1) ((99 101) 1) ((119 121) 1) ((167 169) 1) ((187 
189) 1))))))
 
   (message "\n-- Ran tests for bookkeeping generation. --"))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]