[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 673a801311 25/29: Resolved issue of parser bu
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 673a801311 25/29: Resolved issue of parser buffer not closing |
Date: |
Thu, 15 Feb 2024 03:14:38 -0500 (EST) |
branch: externals/phps-mode
commit 673a801311dfbe90dd5f1875cbadc9af4a0af9ca
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Resolved issue of parser buffer not closing
---
TODO.md | 1 -
phps-mode-lex-analyzer.el | 100 ++++++++++++++++++++++------------------------
2 files changed, 48 insertions(+), 53 deletions(-)
diff --git a/TODO.md b/TODO.md
index d229472dab..0528c33773 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,7 +1,6 @@
# TODO
* Perform buffer changes in the middle of a token will make cache reuse lex
over point and this will distort the lex at point but not at points further down
-* *PHPs Parser* buffer are not closed
## Indentation
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 71927a075a..7fcf4c20a4 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -1001,8 +1001,7 @@ of performed operations. Optionally do it
FORCE-SYNCHRONOUS."
"Loaded from file-system cache: %S"
loaded-from-cache))
loaded-from-cache)
- (let* ((buffer (generate-new-buffer "*PHPs Parser*"))
- (cache)
+ (let* ((cache)
(tokens)
(parse-error)
(parse-trail)
@@ -1016,56 +1015,53 @@ of performed operations. Optionally do it
FORCE-SYNCHRONOUS."
cache-key))
;; Create temporary buffer and run lexer in it
- (when (get-buffer buffer)
- (with-current-buffer buffer
- (insert contents)
-
- (let* ((current-time (current-time))
- (end-time
- (+
- (car current-time)
- (car (cdr current-time))
- (* (car (cdr (cdr current-time))) 0.000001))))
- (setq
- timer-start-parser
- end-time))
-
- ;; Error-free parse here
- (condition-case conditions
- (progn
- ;; This will implicitly run the parser as well
- (phps-mode-ast--generate))
- (error
- (setq
- parse-error
- conditions)))
-
- ;; Need to copy buffer-local values before killing buffer
-
- ;; Copy variables outside of buffer
- (setq cache phps-mode-lexer--cached)
- (setq tokens (nreverse phps-mode-lexer--generated-tokens))
- (setq parse-trail phps-mode-ast--parse-trail)
- (setq ast-tree phps-mode-ast--tree)
- (setq bookkeeping phps-mode-parser-sdt-bookkeeping)
- (setq imenu phps-mode-parser-sdt-symbol-imenu)
- (setq symbol-table phps-mode-parser-sdt-symbol-table)
-
- (let* ((current-time
- (current-time))
- (end-time
- (+
- (car current-time)
- (car (cdr current-time))
- (* (car (cdr (cdr current-time))) 0.000001))))
- (setq
- timer-finished-parser
- end-time)
- (setq
- timer-elapsed-parser
- (- timer-finished-parser timer-start-parser)))
-
- (kill-buffer)))
+ (with-temp-buffer
+ (insert contents)
+
+ (let* ((current-time (current-time))
+ (end-time
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001))))
+ (setq
+ timer-start-parser
+ end-time))
+
+ ;; Error-free parse here
+ (condition-case conditions
+ (progn
+ ;; This will implicitly run the parser as well
+ (phps-mode-ast--generate))
+ (error
+ (setq
+ parse-error
+ conditions)))
+
+ ;; Need to copy buffer-local values before killing buffer
+
+ ;; Copy variables outside of buffer
+ (setq cache phps-mode-lexer--cached)
+ (setq tokens (nreverse phps-mode-lexer--generated-tokens))
+ (setq parse-trail phps-mode-ast--parse-trail)
+ (setq ast-tree phps-mode-ast--tree)
+ (setq bookkeeping phps-mode-parser-sdt-bookkeeping)
+ (setq imenu phps-mode-parser-sdt-symbol-imenu)
+ (setq symbol-table phps-mode-parser-sdt-symbol-table)
+
+ (let* ((current-time
+ (current-time))
+ (end-time
+ (+
+ (car current-time)
+ (car (cdr current-time))
+ (* (car (cdr (cdr current-time))) 0.000001))))
+ (setq
+ timer-finished-parser
+ end-time)
+ (setq
+ timer-elapsed-parser
+ (- timer-finished-parser timer-start-parser))))
(let ((data
(list
- [elpa] externals/phps-mode 2cdeaf00e3 07/29: Added new parser unit tests for PHP 8.3, (continued)
- [elpa] externals/phps-mode 2cdeaf00e3 07/29: Added new parser unit tests for PHP 8.3, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode 2f9ba6792c 08/29: Started on integrating new parser with major-mode, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode c51076e329 12/29: Passing unit tests for AST, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode fe91b2a9f3 11/29: Passing more tests for PHP 8.3, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode f9e5d6233f 19/29: Incremental lexer working somewhat again, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode f3ad4ab698 15/29: Started on refactor of parser-lexer relationship, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode cf399d7697 17/29: Fixed some byte compilation issues, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode 23ce2baf9e 16/29: Passing all unit tests again, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode 7e9a744775 24/29: Added todo items, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode e7e23cce60 26/29: Fix for incremental syntax coloring issue, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode 673a801311 25/29: Resolved issue of parser buffer not closing,
Christian Johansson <=
- [elpa] externals/phps-mode 676cfe11e6 28/29: Updated version and change-log, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode e7e5cdacf0 29/29: Fixed bye-compilation warning and missing error declaration, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode ad00c6eac5 27/29: Updated parser generator information and cleaned up code, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode 0262e707ca 05/29: Passing more parsing tests, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode 396397b97d 06/29: Passing all old unit tests for parser, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode c2716544f4 10/29: Started on SDT for PHP 8.3, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode aa2a23c296 18/29: Started on incremental lexer support again, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode 34d34330a2 13/29: Passing unit tests for indentation, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode 9bbd3cd7fa 14/29: Some byte compilation fixes, Christian Johansson, 2024/02/15
- [elpa] externals/phps-mode 5681944d10 20/29: Passing all unit tests and byte compilation with incremental lexer, Christian Johansson, 2024/02/15