branch: externals/phpinspect commit 8d4bc6cf7e053272b0211c116954a55ef8095420 Author: Hugo Thunnissen <de...@hugot.nl> Commit: Hugo Thunnissen <de...@hugot.nl>
Remove unused/commented code --- phpinspect-change.el | 46 +------- phpinspect-edtrack.el | 271 ------------------------------------------------ phpinspect-parser.el | 42 ++------ test/phpinspect-test.el | 1 - test/test-edtrack.el | 134 ------------------------ test/test-parser.el | 73 ------------- 6 files changed, 12 insertions(+), 555 deletions(-) diff --git a/phpinspect-change.el b/phpinspect-change.el index 499d0fa35d..32e028e0e1 100644 --- a/phpinspect-change.el +++ b/phpinspect-change.el @@ -39,8 +39,6 @@ (pre-change-length (phpi-change-prev-length change)) (content (phpi-change-content change))) - ;;(message "Applying change: %s" content) - (with-current-buffer buffer (delete-region start (+ start pre-change-length)) (goto-char start) @@ -101,55 +99,15 @@ (phpi-change-delta change) (phpi-change-prev-end change) point)) - ;; (if (> point (phpi-change-end change)) - ;; (if (> (- point (phpi-change-prev-end change)) - ;; (phpi-change-delta change)) - ;; (- point (phpi-change-delta change)) - ;; (phpi-change-end change)) -;; point)) - -;; (defun phpi-calculate-pre-point (delta end point) -;; (message "delta %s, prev-end %s, point %s" delta end point) -;; (let ((delta-region (if (< 0 delta) -;; (phpinspect-make-region (- end delta) end) -;; (phpinspect-make-region end (- end delta))))) -;; (message "delta region: %s" delta-region) - ;; (if (< ( delta-region) point) - ;; (- point delta) - - - ;; (if (< (phpinspect-region-end delta-region) point) - ;; (- point delta) - - - ;; (if (< 0 delta) - ;; (phpinspect-region-start delta-region) - ;; point)) - ;; point)))) - - ;; (if (> 0 delta) - ;; (if (< (phpinspect-region-end delta-region) point) - ;; (- point delta) - ;; (if (phpinspect-region-overlaps-point delta-region point) - ;; end - ;; point)) - ;; (if (< 0 delta) - ;; (if (< (phpinspect-region-end delta-region) point) - ;; (- point delta) - ;; (if (< end point) - ;; end - ;; point)) - ;; point)))) (defun phpi-change-pre-position (change point) -;; (message "Start %d" point) (if (<= (phpi-change-end change) point) (- point (phpi-change-delta change)) (if (and (< 0 (phpi-change-delta change)) (> (phpi-change-end change) point) (<= (phpi-change-prev-end change) point)) - (progn ;;(message "JAAAA: %s voor %s" (phpi-change-prev-end change) point) - (phpi-change-prev-end change)) + (progn + (phpi-change-prev-end change)) point))) (defun phpi-change-overlaps-point (change point) diff --git a/phpinspect-edtrack.el b/phpinspect-edtrack.el deleted file mode 100644 index d04ad0ecac..0000000000 --- a/phpinspect-edtrack.el +++ /dev/null @@ -1,271 +0,0 @@ -;;; phpinspect-edtrack.el --- PHP parsing and completion package -*- lexical-binding: t; -*- - -;; Copyright (C) 2021-2023 Free Software Foundation, Inc - -;; Author: Hugo Thunnissen <de...@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-util) -(require 'phpinspect-token-predicates) - -(eval-when-compile - (require 'phpinspect-meta) - (phpinspect--declare-log-group 'edtrack)) - -(cl-defstruct (phpinspect-edtrack (:constructor phpinspect-make-edtrack)) - (edits nil - :type list) - (taint-pool nil - :type list) - (last-edit nil - :type cons - :documentation "Last registered edit") - (last-edit-start -1 - :type integer - :documentation "Last registered edit start position")) - -(define-inline phpinspect-edit-local-delta (edit) - "The change in the end position of EDIT's region. - -This is equal to [after-change-length] - [pre-change-length]." - (inline-quote (or (cdar ,edit) 0))) - -(define-inline phpinspect-edit-original-end (edit) - "The original end position of EDIT." - (inline-quote (or (caar ,edit) 0))) - -(define-inline phpinspect-edit-preceding (edit) - (inline-quote (cdr ,edit))) - -(defsubst phpinspect-edit-delta (edit) - (let ((delta (phpinspect-edit-local-delta edit)) - (previous-edit edit)) - (while (setq previous-edit (cdr previous-edit)) - (setq delta (+ delta (phpinspect-edit-local-delta previous-edit)))) - delta)) - -(define-inline phpinspect-edit-end (edit) - "The current end position of EDIT. - -This is equal to the original end position of EDIT + the delta's -of all known edits before EDIT's start." - (inline-letevals (edit) - (inline-quote - (+ (phpinspect-edit-original-end ,edit) - (phpinspect-edit-delta (phpinspect-edit-preceding ,edit)))))) - -(defsubst phpinspect-edtrack-original-position-at-point (track point) - "Calculate position of POINT if no edits had been made." - (let ((edit (phpinspect-edtrack-edits track)) - ;; `end' will be the end position of the last edit before POINT - end) - - (let (last-end) - ;; Find last edit before point - (while (and edit (<= point (setq last-end (phpinspect-edit-end edit)))) - (setq end last-end - edit (cdr edit))) - - ;; If edit is non-nil, last-end will be the end of edit. If edit is nil, - ;; there were no edits before POINT. - (setq end (if edit last-end 0))) - - (if edit - ;; Subtract cumulative edit delta - (let ((pos (- point (phpinspect-edit-delta edit)))) - - ;; When point is within the edit delta's range, correct the delta by the - ;; amount of encroachment. - (let ((encroached (- (+ end (phpinspect-edit-local-delta edit)) point))) - (if (< 0 encroached) - (+ pos encroached) - pos))) - - ;; else: no edits have taken place, return POINT - point))) - -(defsubst phpinspect-edtrack-current-position-at-point (track point) - "Like `phpinspect-edtrack-original-position-at-point' but in reverse. - -Calculate the current position in of original POINT, based on edits performed." - (let ((edit (phpinspect-edtrack-edits track))) - ;; Find last edit before point - (while (and edit (<= point (phpinspect-edit-original-end edit))) - (setq edit (cdr edit))) - - (if edit - ;; Subtract cumulative edit delta - (+ point (phpinspect-edit-delta edit)) - ;; else: no edits have taken place, return POINT - point))) - -(define-inline phpinspect-taint-start (taint) - (inline-quote (car ,taint))) - -(define-inline phpinspect-taint-end (taint) - (inline-quote (cdr ,taint))) - -(define-inline phpinspect-make-taint (start end) - (inline-quote (cons ,start ,end))) - -(defsubst phpinspect-taint-overlaps-point (taint point) - (and (> (phpinspect-taint-end taint) point) - (<= (phpinspect-taint-start taint) point))) - -(defsubst phpinspect-taint-overlaps-region (taint start end) - (or (phpinspect-taint-overlaps-point taint start) - (phpinspect-taint-overlaps-point taint end) - (and (> end (phpinspect-taint-start taint)) - (<= start (phpinspect-taint-start taint))) - (and (> end (phpinspect-taint-end taint)) - (<= start (phpinspect-taint-end taint))))) - -(defsubst phpinspect-taint-overlaps (taint1 taint2) - (or (phpinspect-taint-overlaps-point taint1 (phpinspect-taint-start taint2)) - (phpinspect-taint-overlaps-point taint1 (phpinspect-taint-end taint2)) - (phpinspect-taint-overlaps-point taint2 (phpinspect-taint-start taint1)) - (phpinspect-taint-overlaps-point taint2 (phpinspect-taint-end taint1)))) - -(defsubst phpinspect-taint-overlaps-meta (taint meta) - (or (phpinspect-taint-overlaps-point taint (phpinspect-meta-start meta)) - (phpinspect-taint-overlaps-point taint (phpinspect-meta-end meta)) - (phpinspect-meta-overlaps-point meta (phpinspect-taint-start taint)) - (phpinspect-meta-overlaps-point meta (phpinspect-taint-end taint)))) - -(defsubst phpinspect-edtrack-register-taint (track start end) - (let ((pool (phpinspect-edtrack-taint-pool track)) - (idx 0) - (overlap-start) - (overlap-end) - (left-neighbour) - (taint (phpinspect-make-taint start end))) - (catch 'break - (while pool - (if (phpinspect-taint-overlaps taint (car pool)) - (progn - (when (< (phpinspect-taint-start (car pool)) start) - (setcar taint (phpinspect-taint-start (car pool)))) - (when (> (phpinspect-taint-end (car pool)) end) - (setcdr taint (phpinspect-taint-end (car pool)))) - - (when (not overlap-start) - (setq overlap-start idx)) - (setq overlap-end idx)) - - ;; Else - (when overlap-start - (throw 'break nil)) - - (when (> start (phpinspect-taint-end (car pool))) - (setq left-neighbour pool) - (throw 'break nil))) - - (setq pool (cdr pool) - idx (+ idx 1)))) - - (cond (overlap-start - (setq pool (phpinspect-edtrack-taint-pool track)) - (setcar (nthcdr overlap-start pool) taint) - (setcdr (nthcdr overlap-start pool) (nthcdr (+ 1 overlap-end) pool))) - (left-neighbour - (setcdr left-neighbour (cons taint (cdr left-neighbour)))) - (t - (push taint (phpinspect-edtrack-taint-pool track)))))) - -(defsubst phpinspect-edtrack-register-edit (track start end pre-change-length) - (phpinspect--log - "Edtrack registered change: [start: %d, end: %d, pre-change-length: %d]" - start end pre-change-length) - - (let ((original-start (phpinspect-edtrack-original-position-at-point track start))) - (phpinspect-edtrack-register-taint - track original-start (+ original-start pre-change-length))) - - (let ((edit-before (phpinspect-edtrack-edits track))) - (while (and edit-before (< end (phpinspect-edit-end edit-before))) - (setq edit-before (cdr edit-before))) - - (let ((delta ;; The delta of this edit. - (- (- end start) pre-change-length)) - new-edit) - (setq new-edit (cons - ;; The end location of the edited region, before being - ;; edited, with the delta of edits that happened at - ;; preceding points in the buffer subtracted. This - ;; corresponds with the original position of the region - ;; end before the buffer was ever edited. - (phpinspect-edtrack-original-position-at-point - track (+ start pre-change-length)) - delta)) - (if edit-before - (progn - (setcdr edit-before (cons (car edit-before) (cdr edit-before))) - (setcar edit-before new-edit)) - (if (phpinspect-edtrack-edits track) - (push new-edit (cdr (last (phpinspect-edtrack-edits track)))) - (push new-edit (phpinspect-edtrack-edits track))))))) - - -(defsubst phpinspect-edtrack-clear-taint-pool (track) - (setf (phpinspect-edtrack-taint-pool track) nil)) - -(defsubst phpinspect-edtrack-clear (track) - (setf (phpinspect-edtrack-edits track) nil) - (setf (phpinspect-edtrack-last-edit track) nil) - (setf (phpinspect-edtrack-last-edit-start track) -1) - (phpinspect-edtrack-clear-taint-pool track)) - - -(defsubst phpinspect-edtrack-make-taint-iterator (track) - (cons (car (phpinspect-edtrack-taint-pool track)) - (cl-copy-list (cdr (phpinspect-edtrack-taint-pool track))))) - -(define-inline phpinspect-taint-iterator-current (iter) - (inline-quote (car ,iter))) - -(define-inline phpinspect-taint-iterator-follow (iter pos) - (inline-letevals (iter pos) - (inline-quote - (or (while (and (phpinspect-taint-iterator-current ,iter) - (> ,pos (phpinspect-taint-end - (phpinspect-taint-iterator-current ,iter)))) - (setf (phpinspect-taint-iterator-current ,iter) (pop (cdr ,iter)))) - (phpinspect-taint-iterator-current ,iter))))) - -(define-inline phpinspect-taint-iterator-token-is-tainted-p (iter meta) - (inline-letevals (iter meta) - (inline-quote - (or (and (phpinspect-taint-iterator-follow ,iter (phpinspect-meta-start ,meta)) - (phpinspect-taint-overlaps-meta - (phpinspect-taint-iterator-current ,iter) ,meta)) - ;; Incomplete tokens should be regarded as tainted regardless of - ;; region, as their end-position is unlikely to be correct. - (phpinspect-incomplete-token-p (phpinspect-meta-token ,meta)))))) - -(define-inline phpinspect-taint-iterator-region-is-tainted-p (iter start end) - (inline-letevals (iter start end) - (inline-quote - (and (phpinspect-taint-iterator-follow ,iter ,start) - (phpinspect-taint-overlaps-region - (phpinspect-taint-iterator-current ,iter) ,start ,end))))) - -(provide 'phpinspect-edtrack) -;;; phpinspect-edtrack.el ends here diff --git a/phpinspect-parser.el b/phpinspect-parser.el index e282e11cee..07c617a456 100644 --- a/phpinspect-parser.el +++ b/phpinspect-parser.el @@ -148,11 +148,6 @@ text at point and returns the resulting token." ;; Set point-offset-base for more efficient execution of ;; `phpinspect-meta-start' and related functions. (dlet ((phpinspect-meta--point-offset-base original-point)) - ;; (while (and token-meta (phpinspect-taint-iterator-token-is-tainted-p taint-iterator token-meta)) - ;; (pp taint-iterator) - ;; (message "finding child of %s" (phpinspect-meta-string token-meta)) - ;; (setq token-meta (phpinspect-meta-find-child-starting-at token-meta original-point))) - (if (or (not token-meta) (not (phpinspect--token-recyclable-p (phpinspect-meta-token token-meta))) (phpinspect-root-p (phpinspect-meta-token token-meta)) @@ -308,32 +303,16 @@ is able to reuse an already parsed tree." (result ;; Look for an already parsted token at POINT to ;; adopt into new tree. - (or (phpinspect--recycle-token - context - change - start-position - (setq original-position - (phpi-change-pre-position change start-position)) - (phpinspect-bmap-token-starting-at previous-bmap original-position) - tokens-rear - ,(if delimiter-predicate `(quote ,delimiter-predicate) 'nil) - continue-condition) - ;; There is no token at POINT exactly. Attempt - ;; to find any other adoptable token after - ;; POINT. - ;; (when-let - ;; ((token-after (phpinspect-bmap-token-starting-after previous-bmap original-position)) - ;; (start (phpinspect-meta-start token-after)) - ;; ((not (phpi-change-tainted-region-p - ;; change original-position (+ start (phpinspect-meta-width token-after))))) - ;; ;;(current-start (+ start-position (- start original-position)))) - ;; (current-start (+ start (- original-position start-position)))) - ;; ;; (message "YAAS: (%d,%d) '%s'" start current-start (buffer-substring current-start (point-max))) - ;; (phpinspect--recycle-token - ;; context change current-start start token-after tokens-rear - ;; ,(if delimiter-predicate `(quote ,delimiter-predicate) 'nil))) - - )) + (phpinspect--recycle-token + context + change + start-position + (setq original-position + (phpi-change-pre-position change start-position)) + (phpinspect-bmap-token-starting-at previous-bmap original-position) + tokens-rear + ,(if delimiter-predicate `(quote ,delimiter-predicate) 'nil) + continue-condition)) ;; `phpinspect--recycle-token' will return the symbol ;; 'tainted' when the token that it tried to reuse @@ -344,7 +323,6 @@ is able to reuse an already parsed tree." ;; Re-using tokens was a success, update tokens-rear ((setq tokens-rear result)))) - ;;(message "recycled") ;; Skip over whitespace after so that we don't do a full ;; run down all of the handlers during the next iteration diff --git a/test/phpinspect-test.el b/test/phpinspect-test.el index f08e408bdc..440089456f 100644 --- a/test/phpinspect-test.el +++ b/test/phpinspect-test.el @@ -327,7 +327,6 @@ class FlufferUpper (load-file (concat phpinspect-test-directory "/test-type.el")) (load-file (concat phpinspect-test-directory "/test-util.el")) (load-file (concat phpinspect-test-directory "/test-bmap.el")) -(load-file (concat phpinspect-test-directory "/test-edtrack.el")) (load-file (concat phpinspect-test-directory "/test-resolvecontext.el")) (load-file (concat phpinspect-test-directory "/test-parser.el")) (load-file (concat phpinspect-test-directory "/test-parse-context.el")) diff --git a/test/test-edtrack.el b/test/test-edtrack.el deleted file mode 100644 index adc2391578..0000000000 --- a/test/test-edtrack.el +++ /dev/null @@ -1,134 +0,0 @@ -;;; test-edtrack.el --- Unit tests for phpinspect.el -*- lexical-binding: t; -*- - -(require 'ert) -(require 'phpinspect-edtrack) -(require 'phpinspect-meta) - -(ert-deftest phpinspect-edit-end () - (let ((edit (list (cons 10 3) (cons 6 5) (cons 4 -2)))) - (should (= 13 (phpinspect-edit-end edit))))) - -(ert-deftest phpinspect-edtrack-register-edit () - (let* ((edtrack (phpinspect-make-edtrack))) - (phpinspect-edtrack-register-edit edtrack 5 10 10) - (phpinspect-edtrack-register-edit edtrack 100 200 150) - (phpinspect-edtrack-register-edit edtrack 15 22 7) - - (should (equal `((255 . -50) (27 . 0) (15 . -5)) (phpinspect-edtrack-edits edtrack))))) - -(ert-deftest phpinspect-edtrack-register-encroaching-edit () - (let* ((edtrack (phpinspect-make-edtrack))) - (phpinspect-edtrack-register-edit edtrack 5 10 0) - (phpinspect-edtrack-register-edit edtrack 100 150 25) - - ;; Encroaches on delta of edit before by 15 points ((125 + 25) - 135 = 15), - ;; so the original end position should be calculated as 135 - (25 - 15) - 5 = 120 - ;; (see also `phpinspect-edtrack-original-position-at-point') - (phpinspect-edtrack-register-edit edtrack 135 170 0) - - (should (equal `((120 . 35) (120 . 25) (5 . 5)) (phpinspect-edtrack-edits edtrack))))) - - -(ert-deftest phpinspect-edtrack-orginal-position-at-point () - (let ((track (phpinspect-make-edtrack))) - (phpinspect-edtrack-register-edit track 10 20 0) - (should (= 10 (phpinspect-edtrack-original-position-at-point track 20))) - (should (= 10 (phpinspect-edtrack-original-position-at-point track 15))) - (phpinspect-edtrack-register-edit track 30 40 5) - (should (= 35 (phpinspect-edtrack-original-position-at-point track 50))) - (should (= 25 (phpinspect-edtrack-original-position-at-point track 39))))) - -(ert-deftest phpinsepct-edtrack-register-multi-edits () - (let ((track (phpinspect-make-edtrack))) - (phpinspect-edtrack-register-edit track 10 20 5) - (phpinspect-edtrack-register-edit track 25 30 0) - (phpinspect-edtrack-register-edit track 13 20 0) - - (should (= 42 (phpinspect-edtrack-current-position-at-point track 25))))) - -(ert-deftest phpinspect-edtrack-register-multi-edits-deletions () - (let ((track (phpinspect-make-edtrack))) - (phpinspect-edtrack-register-edit track 10 20 5) - (phpinspect-edtrack-register-edit track 25 30 20) - (phpinspect-edtrack-register-edit track 13 20 0) - - (should (= 42 (phpinspect-edtrack-current-position-at-point track 45))))) - -(ert-deftest phpinspect-edtrack-register-taint () - (let* ((track (phpinspect-make-edtrack))) - (phpinspect-edtrack-register-taint track 0 5) - (phpinspect-edtrack-register-taint track 10 20) - (should (equal (list (cons 0 5) (cons 10 20)) (phpinspect-edtrack-taint-pool track))) - - (phpinspect-edtrack-register-taint track 3 20) - - (should (equal (list (cons 0 20)) (phpinspect-edtrack-taint-pool track))))) - -(ert-deftest phpinspect-edtrack-taint-iterator () - (let ((track (phpinspect-make-edtrack)) - (iterator)) - (phpinspect-edtrack-register-taint track 120 150) - (phpinspect-edtrack-register-taint track 5 30) - (phpinspect-edtrack-register-taint track 25 50) - (phpinspect-edtrack-register-taint track 70 100) - - (setq iterator (phpinspect-edtrack-make-taint-iterator track)) - - (should-not (phpinspect-taint-iterator-token-is-tainted-p - iterator (phpinspect-make-meta nil 1 4 nil nil))) - - (should (phpinspect-taint-iterator-token-is-tainted-p - iterator (phpinspect-make-meta nil 4 7 nil nil))) - - (should (phpinspect-taint-iterator-token-is-tainted-p - iterator (phpinspect-make-meta nil 20 30 nil nil))) - - (should-not (phpinspect-taint-iterator-token-is-tainted-p - iterator (phpinspect-make-meta nil 51 55 nil nil))) - - (should (phpinspect-taint-iterator-token-is-tainted-p - iterator (phpinspect-make-meta nil 65 73 nil nil))) - - (should (phpinspect-taint-iterator-token-is-tainted-p - iterator (phpinspect-make-meta nil 100 130 nil nil))))) - -(ert-deftest phpinspect-edtrack-edit-derived-taint-iterator () - (let ((track (phpinspect-make-edtrack)) - iterator) - (phpinspect-edtrack-register-edit track 10 20 5) - (phpinspect-edtrack-register-edit track 15 30 0) - (phpinspect-edtrack-register-edit track 20 25 10) - - (setq iterator (phpinspect-edtrack-make-taint-iterator track)) - - (should (phpinspect-taint-iterator-region-is-tainted-p iterator 15 20)) - (should (phpinspect-taint-iterator-region-is-tainted-p iterator 25 30)) - (should-not (phpinspect-taint-iterator-region-is-tainted-p iterator 30 35)))) - -(ert-deftest phpinspect-edtrack-taint-overlapping-edits () - (let ((track (phpinspect-make-edtrack))) - (phpinspect-edtrack-register-edit track 10 20 5) - - (should (equal (list (cons 10 15)) (phpinspect-edtrack-taint-pool track))) - - (phpinspect-edtrack-register-edit track 15 0 1) - (should (equal (list (cons 10 16)) (phpinspect-edtrack-taint-pool track))))) - -(ert-deftest phpinspect-edtrack-register-multi-edits-same-start () - (let ((track (phpinspect-make-edtrack))) - (phpinspect-edtrack-register-edit track 10 11 0) - (phpinspect-edtrack-register-edit track 10 10 1) - - (should (equal (list (cons 10 -1) (cons 10 1)) (phpinspect-edtrack-edits track))))) - -(ert-deftest phpinspect-edtrack-undo () - (let ((track (phpinspect-make-edtrack))) - (phpinspect-edtrack-register-edit track 10 10 10) - (phpinspect-edtrack-register-edit track 10 10 10) - (phpinspect-edtrack-register-edit track 10 30 0) - - (should (= 30 (phpinspect-edtrack-original-position-at-point track 30))) - (should (= 20 (phpinspect-edtrack-original-position-at-point track 20))) - (should (= 15 (phpinspect-edtrack-original-position-at-point track 15))) - (should (= 35 (phpinspect-edtrack-original-position-at-point track 35))) - (should (= 10 (phpinspect-edtrack-original-position-at-point track 10))))) diff --git a/test/test-parser.el b/test/test-parser.el index b2a87855fb..b188200e4d 100644 --- a/test/test-parser.el +++ b/test/test-parser.el @@ -61,79 +61,6 @@ class TestClass { (should (phpinspect-list-p (phpinspect-meta-token parent))) (should (phpinspect-block-p (phpinspect-meta-token (phpinspect-meta-parent parent))))))) -;; (ert-deftest phpinspect-parse-string-incrementally-single-edit () -;; (let ((ctx (phpinspect-make-pctx :incremental t :bmap (phpinspect-make-bmap)))) -;; (phpinspect-with-parse-context ctx -;; (phpinspect-parse-string " : 'abc' ")) - -;; (let* ((bmap (phpinspect-pctx-bmap ctx)) -;; (children (thread-last (phpinspect-bmap-root-meta bmap) -;; (phpinspect-meta-children) -;; (phpinspect-splayt-to-list))) -;; (string-meta (car children))) - -;; (should (length= children 1)) -;; (should (phpinspect-string-p (phpinspect-meta-token string-meta))) -;; (should (= 5 (phpinspect-meta-width string-meta))) -;; (should (= 5 (phpinspect-meta-start string-meta))) -;; (should (= 10 (phpinspect-meta-end string-meta))) - -;; (let ((edit-tracker (phpinspect-make-edtrack))) -;; (phpinspect-edtrack-register-edit edit-tracker 1 1 1) - -;; (let ((prev-string-meta string-meta) -;; (ctx (phpinspect-make-pctx :incremental t -;; :previous-bmap bmap -;; :bmap (phpinspect-make-bmap) -;; :edtrack edit-tracker))) -;; (phpinspect-with-parse-context ctx -;; (phpinspect-parse-string " : 'abc' ")) - -;; (setq children (thread-last (phpinspect-bmap-root-meta (phpinspect-pctx-bmap ctx)) -;; (phpinspect-meta-children) -;; (phpinspect-splayt-to-list)) -;; string-meta (car children)) - -;; ;;(message "%s" (mapcar #'phpinspect-meta-string children)) - -;; (should (length= children 1)) -;; (should (eq prev-string-meta string-meta)) -;; (should (phpinspect-string-p (phpinspect-meta-token string-meta))) -;; (should (= 5 (phpinspect-meta-width string-meta))) -;; (should (= 4 (phpinspect-meta-start string-meta))) -;; (should (= 9 (phpinspect-meta-end string-meta)))))))) - -;; (ert-deftest phpinspect-parse-string-incrementally-muti-edit () -;; (let ((ctx (phpinspect-make-pctx :incremental t :bmap (phpinspect-make-bmap)))) -;; (phpinspect-with-parse-context ctx -;; (phpinspect-parse-string " : 'abc' ")) - -;; (let ((edit-tracker (phpinspect-make-edtrack))) -;; (phpinspect-edtrack-register-edit edit-tracker 1 1 1) -;; (phpinspect-edtrack-register-edit edit-tracker 2 5 0) - -;; (let ((prev-string-meta (phpinspect-meta-first-child (phpinspect-bmap-root-meta (phpinspect-pctx-bmap ctx)))) -;; (ctx (phpinspect-make-pctx :incremental t -;; :previous-bmap (phpinspect-pctx-bmap ctx) -;; :bmap (phpinspect-make-bmap) -;; :edtrack edit-tracker))) -;; (phpinspect-with-parse-context ctx -;; (phpinspect-parse-string " : 'abc' ")) - -;; (let* ((children (thread-last (phpinspect-bmap-root-meta (phpinspect-pctx-bmap ctx)) -;; (phpinspect-meta-children) -;; (phpinspect-splayt-to-list))) -;; (string-meta (car children))) - - -;; ;;(message "%s" (mapcar #'phpinspect-meta-string children)) -;; (should (length= children 1)) -;; (should (eq prev-string-meta string-meta)) -;; (should (phpinspect-string-p (phpinspect-meta-token string-meta))) -;; (should (= 5 (phpinspect-meta-width string-meta))) -;; (should (= 7 (phpinspect-meta-start string-meta))) -;; (should (= 12 (phpinspect-meta-end string-meta)))))))) - (ert-deftest phpinspect-parse-comma () (let* ((code "(,)") (ctx (phpinspect-make-pctx :incremental t :bmap (phpinspect-make-bmap)))