[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phpinspect 0d222ddd62 4/5: Remove phpinspect-toc.el
From: |
ELPA Syncer |
Subject: |
[elpa] externals/phpinspect 0d222ddd62 4/5: Remove phpinspect-toc.el |
Date: |
Sun, 22 Sep 2024 03:59:03 -0400 (EDT) |
branch: externals/phpinspect
commit 0d222ddd62510990529b43a2d505a26eaac3355c
Author: Hugo Thunnissen <devel@hugot.nl>
Commit: Hugo Thunnissen <devel@hugot.nl>
Remove phpinspect-toc.el
---
phpinspect-bmap.el | 46 ---------------------------
phpinspect-toc.el | 83 -------------------------------------------------
test/phpinspect-test.el | 1 -
test/test-toc.el | 59 -----------------------------------
4 files changed, 189 deletions(-)
diff --git a/phpinspect-bmap.el b/phpinspect-bmap.el
index 195afd6bef..dcc1f109ab 100644
--- a/phpinspect-bmap.el
+++ b/phpinspect-bmap.el
@@ -58,27 +58,6 @@ map parsed tokens to metadata about them and vice versa."
:type list)
(overlays (phpinspect-make-splayt)
:type phpinspect-splayt)
- ;; (declarations (phpinspect-make-splayt)
- ;; :type phpinspect-splayt
- ;; :documentation "The declaration tokens encountered.")
- ;; (imports (phpinspect-make-splayt)
- ;; :type phpinspect-splayt
- ;; :documentation "The import statements encountered.")
- ;; (used-traits (phpinspect-make-splayt)
- ;; :type phpinspect-splayt
- ;; :documentation "The trait use statements encountered.")
- ;; (functions (phpinspect-make-splayt)
- ;; :type phpinspect-splayt
- ;; :documentation "The function definitions encountered.")
- ;; (classes (phpinspect-make-splayt)
- ;; :type phpinspect-splayt
- ;; :documentation "The classes encountered.")
- ;; (class-variables (phpinspect-make-splayt)
- ;; :type phpinspect-splayt
- ;; :documentation "The class attribute variables
encountered")
- ;; (namespaces (phpinspect-make-splayt)
- ;; :type phpinspect-splayt
- ;; :documentation "The namespaces encountered")
(-root-meta nil
:type phpinspect-meta)
(last-token-start nil
@@ -152,31 +131,6 @@ map parsed tokens to metadata about them and vice versa."
(setq whitespace-before ""))
(puthash start token-meta starts)
-
- ;; (cond
- ;; ((phpinspect-use-import-p (phpinspect-meta-token token-meta))
- ;; (phpinspect-splayt-insert
- ;; (phpinspect-bmap-imports bmap) (phpinspect-meta-start token-meta)
token-meta))
- ;; ((phpinspect-use-trait-p (phpinspect-meta-token token-meta))
- ;; (phpinspect-splayt-insert
- ;; (phpinspect-bmap-used-traits bmap) (phpinspect-meta-start
token-meta) token-meta))
- ;; ((phpinspect-class-p (phpinspect-meta-token token-meta))
- ;; (phpinspect-splayt-insert
- ;; (phpinspect-bmap-classes bmap) (phpinspect-meta-start token-meta)
token-meta))
- ;; ((phpinspect-declaration-p (phpinspect-meta-token token-meta))
- ;; (phpinspect-splayt-insert
- ;; (phpinspect-bmap-declarations bmap) (phpinspect-meta-start
token-meta) token-meta))
- ;; ((phpinspect-function-p (phpinspect-meta-token token-meta))
- ;; (phpinspect-splayt-insert
- ;; (phpinspect-bmap-functions bmap) (phpinspect-meta-start token-meta)
token-meta))
- ;; ((phpinspect-namespace-p (phpinspect-meta-token token-meta))
- ;; (phpinspect-splayt-insert
- ;; (phpinspect-bmap-namespaces bmap) (phpinspect-meta-start token-meta)
token-meta))
- ;; ((or (phpinspect-const-p (phpinspect-meta-token token-meta))
- ;; (phpinspect-class-variable-p (phpinspect-meta-token token-meta)))
- ;; (phpinspect-splayt-insert
- ;; (phpinspect-bmap-class-variables bmap) (phpinspect-meta-start
token-meta) token-meta)))
-
(if existing-end
(push token existing-end)
(puthash end (list token-meta) ends))
diff --git a/phpinspect-toc.el b/phpinspect-toc.el
deleted file mode 100644
index 8c5d978087..0000000000
--- a/phpinspect-toc.el
+++ /dev/null
@@ -1,83 +0,0 @@
-;;; phpinspect-toc.el --- PHP parsing and completion package -*-
lexical-binding: t; -*-
-
-;; Copyright (C) 2021-2023 Free Software Foundation, Inc
-
-;; Author: Hugo Thunnissen <devel@hugot.nl>
-;; Keywords: php, languages, tools, convenience
-;; Version: 2.1.0
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;;; Code:
-
-(require 'phpinspect-splayt)
-(eval-when-compile
- (require 'phpinspect-meta))
-
-(defun phpinspect-make-toc (&optional tree)
- (let ((table (make-hash-table :test #'eq :size 20 :rehash-size 2.0)))
- (if tree
- (phpinspect-splayt-traverse-lr (meta tree)
- (puthash (phpinspect-meta-token meta) meta table))
- (setq tree (phpinspect-make-splayt)))
-
- (list tree table)))
-
-(define-inline phpinspect-toc-register (toc meta)
- (inline-letevals (toc meta)
- (inline-quote
- (progn
- (phpinspect-splayt-insert (phpinspect-toc-tree ,toc)
(phpinspect-meta-start ,meta) ,meta)
- (puthash (phpinspect-meta-token ,meta) ,meta (phpinspect-toc-table
,toc))))))
-
-(define-inline phpinspect-toc-tree (toc)
- (inline-quote (car ,toc)))
-
-(define-inline phpinspect-toc-table (toc)
- (inline-quote (cadr ,toc)))
-
-(defun phpinspect-toc-update (toc new-tree)
- (let ((current-tree (phpinspect-toc-tree toc))
- (new-table (make-hash-table :test #'eq :size 20 :rehash-size 2.0))
- new deleted)
-
- (phpinspect-splayt-traverse-lr (meta new-tree)
- (puthash (phpinspect-meta-token meta) meta new-table)
- (push meta new))
-
- (phpinspect-splayt-traverse-lr (meta current-tree)
- (if (phpinspect-meta-deleted meta)
- (push meta deleted)
- (progn
- (phpinspect-splayt-insert new-tree (phpinspect-meta-start meta) meta)
- (puthash (phpinspect-meta-token meta) meta new-table))))
-
- (setf (phpinspect-toc-tree toc) new-tree)
- (setf (phpinspect-toc-table toc) new-table)
-
- (list new deleted)))
-
-(defun phpinspect-toc-token-at-point (toc point)
- (let ((result (phpinspect-splayt-find-largest-before (phpinspect-toc-tree
toc) (+ point 1))))
- (and result (phpinspect-meta-overlaps-point result point) result)))
-
-(defun phpinspect-toc-token-at-or-after-point (toc point)
- (phpinspect-splayt-find-smallest-after (phpinspect-toc-tree toc) (- point
1)))
-
-(defun phpinspect-toc-tokens-in-region (toc start end)
- (phpinspect-splayt-find-all-between (phpinspect-toc-tree toc) start end))
-
-(provide 'phpinspect-toc)
diff --git a/test/phpinspect-test.el b/test/phpinspect-test.el
index e0b7691b2f..21f58cefe2 100644
--- a/test/phpinspect-test.el
+++ b/test/phpinspect-test.el
@@ -333,7 +333,6 @@ class FlufferUpper
(load-file (concat phpinspect-test-directory "/test-parse-context.el"))
(load-file (concat phpinspect-test-directory "/test-splayt.el"))
(load-file (concat phpinspect-test-directory "/test-pipeline.el"))
-(load-file (concat phpinspect-test-directory "/test-toc.el"))
(load-file (concat phpinspect-test-directory "/test-meta.el"))
(load-file (concat phpinspect-test-directory "/test-resolve.el"))
(load-file (concat phpinspect-test-directory "/test-imports.el"))
diff --git a/test/test-toc.el b/test/test-toc.el
deleted file mode 100644
index aeeca7222b..0000000000
--- a/test/test-toc.el
+++ /dev/null
@@ -1,59 +0,0 @@
-;;; test-edtrack.el --- Unit tests for phpinspect.el -*- lexical-binding: t;
-*-
-
-(require 'phpinspect-toc)
-(require 'phpinspect-splayt)
-(require 'phpinspect-meta)
-
-(ert-deftest phpinspect-make-toc ()
- (let ((tokens (phpinspect-make-splayt))
- toc)
- (phpinspect-splayt-insert tokens 1 (phpinspect-make-meta nil 1 20 ""
'token1))
- (phpinspect-splayt-insert tokens 40 (phpinspect-make-meta nil 40 45 ""
'token2))
- (phpinspect-splayt-insert tokens 55 (phpinspect-make-meta nil 55 70 ""
'token3))
-
- (setq toc (phpinspect-make-toc tokens))
-
- (should (= 3 (hash-table-count (phpinspect-toc-table toc))))
- (should (= 3 (length (phpinspect-splayt-to-list (phpinspect-toc-tree
toc)))))))
-
-(ert-deftest phpinspect-update-toc ()
- (let ((tokens (phpinspect-make-splayt))
- (root (phpinspect-make-meta nil 1 200 "" 'root))
- (new-root (phpinspect-make-meta nil 1 400 "" 'root))
- (tok1 (phpinspect-make-meta nil 1 20 "" 'token1))
- (tok2 (phpinspect-make-meta nil 40 45 "" 'token2))
- (tok3 (phpinspect-make-meta nil 55 70 "" 'token3))
- (tok4 (phpinspect-make-meta nil 71 91 "" 'token4))
- new-tokens toc)
-
- (phpinspect-meta-set-parent tok1 root)
- (phpinspect-meta-set-parent tok2 root)
- (phpinspect-meta-set-parent tok3 root)
-
- (phpinspect-splayt-insert tokens 1 tok1)
- (phpinspect-splayt-insert tokens 40 tok2)
- (phpinspect-splayt-insert tokens 55 tok3)
-
- (setq toc (phpinspect-make-toc tokens))
-
- (dolist (tok (list tok2 tok3 tok4))
- (phpinspect-meta-detach-parent tok)
- (phpinspect-meta-set-parent tok new-root))
-
- (setq new-tokens (phpinspect-make-splayt))
- (phpinspect-splayt-insert new-tokens 71 tok4)
-
- (phpinspect-meta-delete root)
-
- (pcase-let ((`(,result-new ,result-deleted) (phpinspect-toc-update toc
new-tokens)))
- (should (= 1 (length result-new)))
- (should (= 1 (length result-deleted)))
-
- (should (eq tok1 (car result-deleted)))
- (should (eq tok4 (car result-new))))
-
- (should (equal '(token2 token3)
- (mapcar #'phpinspect-meta-token
(phpinspect-toc-tokens-in-region toc 0 70))))
-
- (should (equal '(token2 token3 token4)
- (mapcar #'phpinspect-meta-token
(phpinspect-toc-tokens-in-region toc 0 91))))))