[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode ddc5b5aa2a 112/135: Using sorted bookkeeping
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode ddc5b5aa2a 112/135: Using sorted bookkeeping for test |
Date: |
Sun, 29 Jan 2023 03:11:09 -0500 (EST) |
branch: externals/phps-mode
commit ddc5b5aa2aa109b66bc7bd3edafe4ee9989d7248
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Using sorted bookkeeping for test
---
phps-mode-parser-sdt.el | 31 ++++++++++++++++++-------------
phps-mode-test.el | 7 ++++++-
test/phps-mode-test-ast.el | 20 ++++++++------------
3 files changed, 32 insertions(+), 26 deletions(-)
diff --git a/phps-mode-parser-sdt.el b/phps-mode-parser-sdt.el
index 88dae66d7a..df265fe62e 100644
--- a/phps-mode-parser-sdt.el
+++ b/phps-mode-parser-sdt.el
@@ -1262,7 +1262,7 @@
;; Declare variables
(dolist (
symbol-list
- phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack)
+ (reverse
phps-mode-parser-sdt--bookkeeping-symbol-assignment-stack))
(let* ((symbol-name (car symbol-list))
(symbol-scope (car (cdr symbol-list)))
(symbol-start (car (cdr (cdr symbol-list))))
@@ -1356,27 +1356,32 @@
((gethash
symbol-uri
phps-mode-parser-sdt-symbol-table-by-uri)
+ ;; (message "matches: %S" (gethash
+ ;; symbol-uri
+ ;; phps-mode-parser-sdt-symbol-table-by-uri))
(let* ((matching-symbol-ids
(gethash
symbol-uri
phps-mode-parser-sdt-symbol-table-by-uri))
(matching-symbol-index 0)
(matching-symbol-count (length matching-symbol-ids))
- (matching-hit)
- (matching-symbol-id
- (nth matching-symbol-index matching-symbol-ids))
- (matching-symbol
- (gethash
- matching-symbol-id
- phps-mode-parser-sdt-symbol-table))
- (matching-symbol-start
- (nth 1 matching-symbol)))
+ (matching-hit))
(while (and
(not matching-hit)
(< matching-symbol-index matching-symbol-count))
- (when (<= matching-symbol-start symbol-start)
- (setq matching-hit t)
- (setq symbol-hit matching-symbol-id))
+ (let* ((matching-symbol-id
+ (nth matching-symbol-index matching-symbol-ids))
+ (matching-symbol
+ (gethash
+ matching-symbol-id
+ phps-mode-parser-sdt-symbol-table))
+ (matching-symbol-start
+ (nth 1 matching-symbol)))
+ ;; (message "matching-symbol: %S" matching-symbol)
+ ;; (message "matching-symbol-start: %S" matching-symbol-start)
+ (when (<= matching-symbol-start symbol-start)
+ (setq matching-hit t)
+ (setq symbol-hit matching-symbol-id)))
(setq matching-symbol-index (1+ matching-symbol-index))))))
(puthash
diff --git a/phps-mode-test.el b/phps-mode-test.el
index ef62b64e97..b4e65ffe7f 100644
--- a/phps-mode-test.el
+++ b/phps-mode-test.el
@@ -178,7 +178,12 @@
hash-table)
(if un-sorted
(nreverse result)
- (sort (nreverse result) (lambda (a b) (< (car a) (car b))))))
+ (sort
+ (nreverse result)
+ (lambda (a b)
+ (if (listp (car a))
+ (< (car (car a)) (car (car b)))
+ (< (car a) (car b)))))))
nil)))
(transient-mark-mode t)
diff --git a/test/phps-mode-test-ast.el b/test/phps-mode-test-ast.el
index 751c410487..73544ed977 100644
--- a/test/phps-mode-test-ast.el
+++ b/test/phps-mode-test-ast.el
@@ -40,26 +40,22 @@
;; (message "symbol-table: \n%S\n" phps-mode-parser-sdt-symbol-table)
;; (message "phps-mode-parser-sdt-symbol-table-by-uri: \n%S\n"
phps-mode-parser-sdt-symbol-table-by-uri)
- (unless
- (equal
- (phps-mode-test--hash-to-list
- phps-mode-parser-sdt-bookkeeping
- t)
- expected-bookkeeping)
+ (unless (equal
+ (phps-mode-test--hash-to-list
+ phps-mode-parser-sdt-bookkeeping)
+ expected-bookkeeping)
(message
"expected-bookkeeping:\n%S\n"
expected-bookkeeping)
(message
"actual-bookkeeping:\n%S\n"
(phps-mode-test--hash-to-list
- phps-mode-parser-sdt-bookkeeping
- t)))
+ phps-mode-parser-sdt-bookkeeping)))
(should
(equal
(phps-mode-test--hash-to-list
- phps-mode-parser-sdt-bookkeeping
- t)
+ phps-mode-parser-sdt-bookkeeping)
expected-bookkeeping))
(when expected-imenu
@@ -343,8 +339,8 @@
(phps-mode-test-ast--should-bookkeep
"<?php\nfunction myFunction()\n{\n $variable = 123;\n if ($variable
=== 456) {\n $variable = 789;\n }\n}\n"
"Variable inside function with assignment inside conditional block"
- '(((89 98) 1) ((60 69) 1) ((35 44) 1))
- '(("myFunction" . 16)))
+ '(((35 44) 2) ((60 69) 2) ((89 98) 2))
+ '(("function myFunction" . 16) ("function myFunction id $variable" . 35)
("function myFunction id $variable (2)" . 89)))
(message "\n-- Ran tests for bookkeeping generation. --"))
- [elpa] externals/phps-mode f053587ff6 091/135: Passing another bookkeeping test, (continued)
- [elpa] externals/phps-mode f053587ff6 091/135: Passing another bookkeeping test, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 9c43bc30c4 103/135: Removed old bookkeeping and imenu and integrated new via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode a447ae69ba 106/135: Starting on generating imenu index for namespaces, classes, methods, traits, interfaces via SDT, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 16a63da318 113/135: More TODO items for bookkeeping, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 807c834649 116/135: More work on imenu generation, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode a84bfdccd3 120/135: More fighting the AST, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 23ba458f20 133/135: Updated version and date for 0.4.31, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode d5bdadc6fc 135/135: Improved installation documentation, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 8259e390b4 092/135: Added TODO item, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 9f21c86dd1 108/135: SDT integration now passing byte-compilation, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode ddc5b5aa2a 112/135: Using sorted bookkeeping for test,
Christian Johansson <=
- [elpa] externals/phps-mode b7d5d7823c 118/135: Starting on sorting imenu, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode be00689e6f 119/135: Fixed sorting of imenu, Christian Johansson, 2023/01/29
- [elpa] externals/phps-mode 330e6fd6cc 128/135: Superglobals and $this not included in imenu index, Christian Johansson, 2023/01/29