[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 02ae2ec: Added support for asynchronous lexer
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 02ae2ec: Added support for asynchronous lexer |
Date: |
Thu, 16 Jan 2020 06:03:08 -0500 (EST) |
branch: externals/phps-mode
commit 02ae2ec886c14fa8feb779e04e1ec811872445b7
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>
Added support for asynchronous lexer
---
Makefile | 2 +-
README.md | 46 +++++-
phps-mode-analyzer.el | 386 ++++++++++++++++++++++++++++++++++++--------------
phps-mode-wy-wy.el | 92 ------------
phps-mode.el | 12 +-
5 files changed, 328 insertions(+), 210 deletions(-)
diff --git a/Makefile b/Makefile
index 3a85a6b..9ddbb6f 100644
--- a/Makefile
+++ b/Makefile
@@ -4,7 +4,7 @@ ifdef emacs
endif
EMACS_CMD := $(EMACS) -Q -batch -L .
-EL := admin/phps-mode-automation.el phps-mode-analyzer.el
phps-mode-flymake.el phps-mode-macros.el phps-mode-semantic.el
phps-mode-syntax-table.el phps-mode-tags.el phps-mode-test.el
phps-mode-wy-macros.el phps-mode-wy-wy.el phps-mode.el
test/phps-mode-test-functions.el test/phps-mode-test-integration.el
test/phps-mode-test-lexer.el test/phps-mode-test-parser.el
test/phps-mode-test-syntax-table.el
+EL := admin/phps-mode-automation.el phps-mode-analyzer.el
phps-mode-flymake.el phps-mode-macros.el phps-mode-semantic.el
phps-mode-syntax-table.el phps-mode-tags.el phps-mode-test.el
phps-mode-wy-macros.el phps-mode.el test/phps-mode-test-functions.el
test/phps-mode-test-integration.el test/phps-mode-test-lexer.el
test/phps-mode-test-parser.el test/phps-mode-test-syntax-table.el
ELC := $(EL:.el=.elc)
.PHONY: clean
diff --git a/README.md b/README.md
index d234870..d46cf2c 100644
--- a/README.md
+++ b/README.md
@@ -26,6 +26,7 @@ This mode does not require PHP installed on your computer
because it has a built
* Continuous integration tests using Travis
* Included in GNU ELPA package archive
* A interactive function that can be used interactively to format buffers
`(phps-mode-format-buffer)`
+* Support for asynchronous lexer via processes (`async.el`) or threads
## Roadmap
@@ -52,7 +53,37 @@ If you have downloaded manually i.e. to
`~/.emacs.d/phps-mode/` you need to add
You can install via ELPA (`M-x package-install` + `RET` + `phps-mode` +
`RET`), package will now be loaded automatically when Emacs starts.
-### Install, load and configure via use-package
+## Configuration
+
+### Enable flycheck support
+
+For flycheck support run `(phps-mode-flycheck-setup)`.
+
+### Asynchronous lexer
+
+Enable with `(setq phps-mode-async-process t)`
+
+### Asynchronous lexer via async.el processes
+
+Enable with:
+
+``` emacs-lisp
+(setq phps-mode-async-process t)
+(setq phps-mode-async-process-using-async-el t)
+```
+
+### Asynchronous lexer via threads
+
+Enable with:
+
+``` emacs-lisp
+(setq phps-mode-async-process t)
+(setq phps-mode-async-process-using-async-el nil)
+```
+
+## Installation and Configuration examples
+
+### Install, load and configure via use-package with flycheck support,
asynchronous support via async.el
``` emacs-lisp
(use-package phps-mode
@@ -60,24 +91,29 @@ You can install via ELPA (`M-x package-install` + `RET` +
`phps-mode` + `RET`),
:ensure t
:mode ("\\.php\\'" "\\.phtml\\'")
:config
- (phps-mode-flycheck-setup))
+ (phps-mode-flycheck-setup)
+ (setq phps-mode-async-process t)
+ (setq phps-mode-async-process-using-async-el t))
```
-### Load and configure using use-package
+### Load and configure using use-package with flycheck support, asynchronous
support via threads
``` emacs-lisp
(use-package phps-mode
:after flycheck
:mode ("\\.php\\'" "\\.phtml\\'")
:config
- (phps-mode-flycheck-setup))
+ (phps-mode-flycheck-setup)
+ (setq phps-mode-async-process t)
+ (setq phps-mode-async-process-using-async-el nil))
```
-### Load and configure using regular emacs-lisp
+### Load and configure using regular emacs-lisp with flycheck support, no
asynchronous support
``` emacs-lisp
(require 'phps-mode)
(add-to-list 'auto-mode-alist '("\\.\\(php\\|phtml\\)\\'" . phps-mode))
(phps-mode-flycheck-setup)
+(setq phps-mode-async-process nil)
```
## Read more
diff --git a/phps-mode-analyzer.el b/phps-mode-analyzer.el
index 42bd6e2..39af742 100644
--- a/phps-mode-analyzer.el
+++ b/phps-mode-analyzer.el
@@ -42,6 +42,8 @@
(require 'subr-x)
+(autoload 'async-start "async")
+
(defvar phps-mode-inline-mmm-submode nil
"Symbol declaring what mmm-mode to use as submode in inline areas.")
@@ -51,6 +53,18 @@
(defvar phps-mode-idle-interval 1
"Idle seconds before running the incremental lexer.")
+(defvar phps-mode-async-process nil
+ "Whether or not to use asynchronous process.")
+
+(defvar phps-mode-async-process-using-async-el nil
+ "Use async.el for asynchronous processing.")
+
+(defvar phps-mode-async-processes (make-hash-table :test 'equal)
+ "Table of active asynchronous processes.")
+
+(defvar phps-mode-async-threads (make-hash-table :test 'equal)
+ "Table of active asynchronous threads.")
+
(defvar phps-mode-functions-allow-after-change t
"Flag to tell us whether after change detection is enabled or not.")
@@ -75,12 +89,6 @@
(defvar phps-mode-lexer-states nil
"A list of lists containing start, state and state stack.")
-(defvar phps-mode-lexer-buffer-length nil
- "Length of lexed buffer.")
-
-(defvar phps-mode-lexer-buffer-contents nil
- "Contents of lexed buffer.")
-
;; SETTINGS
@@ -164,6 +172,135 @@
;; FUNCTIONS
+(defun phps-mode-serial-commands (key start end &optional callback)
+ "Run command with KEY, first START and then END, optionally call CALLBACK at
the end."
+ (let ((start-time (current-time)))
+ (if phps-mode-async-process
+ (if phps-mode-async-process-using-async-el
+ (progn
+ (require 'async)
+
+ (phps-mode-debug-message
+ (message "Running serial command asynchronously using async.el
at: %s" start-time))
+
+ ;; Kill async process if process with associated key already
exists
+ (when (and
+ (gethash key phps-mode-async-processes)
+ (process-live-p (gethash key phps-mode-async-processes)))
+ (let ((process-buffer (process-buffer (gethash key
phps-mode-async-processes))))
+ (delete-process (gethash key phps-mode-async-processes))
+ (kill-buffer process-buffer)
+ (phps-mode-debug-message
+ (message "Killed existing buffer and process"))))
+
+ ;; Run command(s) asynchronously
+ (let ((script-filename (file-name-directory (symbol-file
'phps-mode-serial-commands))))
+ (puthash
+ key
+ (async-start
+ (lambda()
+ (add-to-list 'load-path script-filename)
+ (require 'phps-mode)
+ (setq debug-on-signal t)
+ (condition-case conditions
+ (progn
+ (let ((start-return (funcall start)))
+ (list 'success start-return start-time)))
+ (error (list 'error conditions start-time))))
+ (lambda (start-return)
+ (phps-mode-debug-message
+ (message "Async.el return: %s" start-return))
+ (let ((status (car start-return))
+ (value (car (cdr start-return)))
+ (start-time (car (cdr (cdr start-return))))
+ (return nil))
+ ;; (message "Running end code with status %s start-time:
%s" status start-time)
+ (when (string= status "success")
+ ;; (message "Running end code %s with argument: %s"
end value)
+ (condition-case conditions
+ (progn
+ (let ((end-return (funcall end value)))
+ (setq return (list 'success end-return))))
+ (error (setq return (list 'error conditions)))))
+
+ (phps-mode-debug-message
+ (let* ((end-time (current-time))
+ (end-time-float (+ (car end-time) (car (cdr
end-time)) (* (car (cdr (cdr end-time))) 0.000001)))
+ (start-time-float (+ (car start-time) (car (cdr
start-time)) (* (car (cdr (cdr start-time))) 0.000001)))
+ (elapsed (- end-time-float start-time-float)))
+ (message "Asynchronous serial command using async.el
finished, elapsed: %fs" elapsed)))
+
+ (when (string= status "error")
+ (display-warning 'phps-mode (format "Async error %s"
(cdr start-return)) :debug))
+
+ (when (and (boundp 'callback)
+ callback)
+ (funcall callback return)))))
+ phps-mode-async-processes))
+
+ ;; (message "Done running serial command asynchronously using
async.el")
+ (phps-mode-debug-message
+ (message "Done starting asynchronous command using async.el:
%s" key)))
+
+ (phps-mode-debug-message
+ (message "Running serial command asynchronously using threads at:
%s" (car start-time)))
+
+ ;; Kill thread if thread with associated key already exists
+ (when (and
+ (gethash key phps-mode-async-threads)
+ (thread-live-p (gethash key phps-mode-async-threads)))
+ (thread-signal (gethash key phps-mode-async-threads) 'quit nil))
+
+ ;; Run command(s) asynchronously
+ (puthash
+ key
+ (make-thread
+ (lambda()
+ (let ((return nil))
+ (condition-case conditions
+ (progn
+ (let ((start-return (funcall start)))
+ (let ((end-return (funcall end start-return)))
+ (setq return (list 'success end-return)))))
+ (error (setq return (list 'error "Serial command received
error" conditions))))
+
+ (phps-mode-debug-message
+ (let* ((end-time (current-time))
+ (end-time-float (+ (car end-time) (car (cdr end-time))
(* (car (cdr (cdr end-time))) 0.000001)))
+ (start-time-float (+ (car start-time) (car (cdr
start-time)) (* (car (cdr (cdr start-time))) 0.000001)))
+ (elapsed (- end-time-float start-time-float)))
+ (message "Asynchronous serial command using thread
finished, elapsed: %fs" elapsed)))
+
+ (when (and (boundp 'callback)
+ callback)
+ (funcall callback return))))
+ key)
+ phps-mode-async-threads)
+
+ (phps-mode-debug-message
+ (message "Done starting asynchronous serial command using threads:
%s" key)))
+
+ (let ((return nil))
+ (phps-mode-debug-message
+ (message "Running serial command synchronously at: %s" (car
start-time)))
+
+ (condition-case conditions
+ (progn
+ (let ((start-return (funcall start)))
+ (let ((end-return (funcall end start-return)))
+ (setq return (list 'success end-return)))))
+ (error (setq return (list 'error "Serial command received error"
conditions))))
+
+ (phps-mode-debug-message
+ (let* ((end-time (current-time))
+ (end-time-float (+ (car end-time) (car (cdr end-time)) (* (car
(cdr (cdr end-time))) 0.000001)))
+ (start-time-float (+ (car start-time) (car (cdr start-time))
(* (car (cdr (cdr start-time))) 0.000001)))
+ (elapsed (- end-time-float start-time-float)))
+ (message "Synchronous serial command finished, elapsed: %fs"
elapsed)))
+
+ (when (and (boundp 'callback)
+ callback)
+ (funcall callback return))))))
(defun phps-mode-lexer-BEGIN (state)
"Begin STATE."
@@ -1791,46 +1928,52 @@
"Run lexer."
(interactive)
(phps-mode-debug-message (message "Lexer run"))
- (setq-local phps-mode-lexer-buffer-length (1- (point-max)))
- (setq-local phps-mode-lexer-buffer-contents (buffer-substring-no-properties
(point-min) (point-max)))
-
- (let ((result (phps-mode-analyzer-lex-string
phps-mode-lexer-buffer-contents)))
-
- ;; Move variables into this buffers variables
- (setq phps-mode-lexer-tokens (nth 0 result))
- (setq phps-mode-lexer-states (nth 1 result))
- (setq phps-mode-lexer-STATE (nth 2 result))
- (setq phps-mode-lexer-state_stack (nth 3 result))
-
- ;; Apply syntax color on tokens
- (dolist (token phps-mode-lexer-tokens)
- (let ((start (car (cdr token)))
- (end (cdr (cdr token)))
- (token-name (car token)))
- (let ((token-syntax-color (phps-mode-lexer-get-token-syntax-color
token-name)))
- (if token-syntax-color
- (phps-mode-lexer-set-region-syntax-color start end
token-syntax-color)
- (phps-mode-lexer-clear-region-syntax-color start end)))))
-
- (let ((errors (nth 4 result))
- (error-start)
- (error-end))
- (when errors
- (display-warning 'phps-mode (format "Lex Errors: %s" (car errors)))
- (setq error-start (car (cdr errors)))
- (when error-start
- (if (car (cdr (cdr errors)))
- (progn
- (setq error-end (car (cdr (cdr (cdr errors)))))
- (phps-mode-lexer-set-region-syntax-color
- error-start
- error-end
- (list 'font-lock-face 'font-lock-warning-face)))
- (setq error-end (point-max))
- (phps-mode-lexer-set-region-syntax-color
- error-start
- error-end
- (list 'font-lock-face 'font-lock-warning-face))))))))
+
+ (let ((buffer-name (buffer-name))
+ (buffer-contents (buffer-substring-no-properties (point-min)
(point-max))))
+ (phps-mode-serial-commands
+ buffer-name
+ (lambda() (phps-mode-analyzer-lex-string buffer-contents))
+ (lambda(result)
+ (with-current-buffer buffer-name
+
+ ;; Move variables into this buffers variables
+ (setq-local phps-mode-lexer-tokens (nth 0 result))
+ (setq-local phps-mode-lexer-states (nth 1 result))
+ (setq-local phps-mode-lexer-STATE (nth 2 result))
+ (setq-local phps-mode-lexer-state_stack (nth 3 result))
+ (setq-local phps-mode-functions-processed-buffer nil)
+ (phps-mode-analyzer--reset-imenu)
+
+ ;; Apply syntax color on tokens
+ (dolist (token phps-mode-lexer-tokens)
+ (let ((start (car (cdr token)))
+ (end (cdr (cdr token)))
+ (token-name (car token)))
+ (let ((token-syntax-color
(phps-mode-lexer-get-token-syntax-color token-name)))
+ (if token-syntax-color
+ (phps-mode-lexer-set-region-syntax-color start end
token-syntax-color)
+ (phps-mode-lexer-clear-region-syntax-color start end)))))
+
+ (let ((errors (nth 4 result))
+ (error-start)
+ (error-end))
+ (when errors
+ (display-warning 'phps-mode (format "Lex Errors: %s" (car
errors)) :debug)
+ (setq error-start (car (cdr errors)))
+ (when error-start
+ (if (car (cdr (cdr errors)))
+ (progn
+ (setq error-end (car (cdr (cdr (cdr errors)))))
+ (phps-mode-lexer-set-region-syntax-color
+ error-start
+ error-end
+ (list 'font-lock-face 'font-lock-warning-face)))
+ (setq error-end (point-max))
+ (phps-mode-lexer-set-region-syntax-color
+ error-start
+ error-end
+ (list 'font-lock-face 'font-lock-warning-face)))))))))))
(defun phps-mode-analyzer-lex-string (contents &optional start end states
state state-stack tokens)
"Run lexer on CONTENTS."
@@ -1963,9 +2106,6 @@
(change-start phps-mode-analyzer-change-min)
(incremental-start-new-buffer phps-mode-analyzer-change-min))
- ;; Reset processed buffer flag
- (phps-mode-functions-reset-processed-buffer)
-
;; Reset idle timer
(phps-mode-functions--cancel-idle-timer)
@@ -2033,72 +2173,49 @@
(phps-mode-debug-message
(message "Found head states"))
+
+ (push (list 'INCREMENTAL-LEX
incremental-start-new-buffer) log)
+
;; Do partial lex from previous-token-end to
change-stop
- (let ((result (phps-mode-analyzer-lex-string
- (buffer-substring-no-properties
(point-min) (point-max))
- incremental-start-new-buffer
- (point-max)
- head-states
- incremental-state
- incremental-state-stack
- head-tokens)))
- (phps-mode-debug-message
- (message "Incrementally-lexed-string: %s" result))
-
- (setq phps-mode-lexer-tokens (nth 0 result))
- (setq phps-mode-lexer-states (nth 1 result))
- (setq phps-mode-lexer-STATE (nth 2 result))
- (setq phps-mode-lexer-state_stack (nth 3 result))
-
- ;; Apply syntax color on tokens
- (dolist (token phps-mode-lexer-tokens)
- (let ((start (car (cdr token)))
- (end (cdr (cdr token)))
- (token-name (car token)))
-
- ;; Apply syntax color on token
- (let ((token-syntax-color
(phps-mode-lexer-get-token-syntax-color token-name)))
- (if token-syntax-color
- (phps-mode-lexer-set-region-syntax-color
start end token-syntax-color)
- (phps-mode-lexer-clear-region-syntax-color
start end)))))
-
- (let ((errors (nth 4 result))
- (error-start)
- (error-end))
- (when errors
- (display-warning 'phps-mode (format
"Incremental Lex Errors: %s" (car errors)))
- (setq error-start (car (cdr errors)))
- (when error-start
- (if (car (cdr (cdr errors)))
- (progn
- (setq error-end (car (cdr (cdr (cdr
errors)))))
-
(phps-mode-lexer-set-region-syntax-color
- error-start
- error-end
- (list 'font-lock-face
'font-lock-warning-face)))
- (setq error-end (point-max))
- (phps-mode-lexer-set-region-syntax-color
- error-start
- error-end
- (list 'font-lock-face
'font-lock-warning-face))))))
-
- (push (list 'INCREMENTAL-LEX
incremental-start-new-buffer) log)
+ (phps-mode-incremental-lex-string
+ (buffer-name)
+ (buffer-substring-no-properties (point-min)
(point-max))
+ incremental-start-new-buffer
+ (point-max)
+ head-states
+ incremental-state
+ incremental-state-stack
+ head-tokens)
+
+ (phps-mode-debug-message
+ (message "Incremental tokens: %s"
incremental-tokens)))
- (phps-mode-debug-message
- (message "Incremental tokens: %s"
incremental-tokens))))
(push (list 'FOUND-NO-HEAD-STATES
incremental-start-new-buffer) log)
(phps-mode-debug-message
(message "Found no head states"))
+
+ ;; Reset processed buffer flag
+ (phps-mode-functions-reset-processed-buffer)
+
(setq run-full-lexer t)))
+
(push (list 'FOUND-NO-HEAD-TOKENS
incremental-start-new-buffer) log)
(phps-mode-debug-message
(message "Found no head tokens"))
+
+ ;; Reset processed buffer flag
+ (phps-mode-functions-reset-processed-buffer)
+
(setq run-full-lexer t))))
(push (list 'FOUND-NO-CHANGE-POINT-MINIMUM) log)
(phps-mode-debug-message
(message "Found no change point minimum"))
+
+ ;; Reset processed buffer flag
+ (phps-mode-functions-reset-processed-buffer)
+
(setq run-full-lexer t))
(when run-full-lexer
@@ -2109,6 +2226,66 @@
log)))
+(defun phps-mode-incremental-lex-string (buffer-name buffer-contents
incremental-start-new-buffer point-max head-states incremental-state
incremental-state-stack head-tokens)
+ "Incremental lex region."
+ (phps-mode-serial-commands
+ buffer-name
+ (lambda() (phps-mode-analyzer-lex-string
+ buffer-contents
+ incremental-start-new-buffer
+ point-max
+ head-states
+ incremental-state
+ incremental-state-stack
+ head-tokens))
+ (lambda(result)
+ (with-current-buffer buffer-name
+
+ (phps-mode-debug-message
+ (message "Incrementally-lexed-string: %s" result))
+
+ (setq-local phps-mode-lexer-tokens (nth 0 result))
+ (setq-local phps-mode-lexer-states (nth 1 result))
+ (setq-local phps-mode-lexer-STATE (nth 2 result))
+ (setq-local phps-mode-lexer-state_stack (nth 3 result))
+ (setq-local phps-mode-functions-processed-buffer nil)
+ (phps-mode-analyzer--reset-imenu)
+
+ ;; Apply syntax color on tokens
+ (dolist (token phps-mode-lexer-tokens)
+ (let ((start (car (cdr token)))
+ (end (cdr (cdr token)))
+ (token-name (car token)))
+
+ ;; Apply syntax color on token
+ (let ((token-syntax-color (phps-mode-lexer-get-token-syntax-color
token-name)))
+ (if token-syntax-color
+ (phps-mode-lexer-set-region-syntax-color start end
token-syntax-color)
+ (phps-mode-lexer-clear-region-syntax-color start end)))))
+
+ (let ((errors (nth 4 result))
+ (error-start)
+ (error-end))
+ (when errors
+ (display-warning 'phps-mode (format "Incremental Lex Errors: %s"
(car errors)) :debug)
+ (setq error-start (car (cdr errors)))
+ (when error-start
+ (if (car (cdr (cdr errors)))
+ (progn
+ (setq error-end (car (cdr (cdr (cdr errors)))))
+ (phps-mode-lexer-set-region-syntax-color
+ error-start
+ error-end
+ (list 'font-lock-face 'font-lock-warning-face)))
+ (setq error-end (point-max))
+ (phps-mode-lexer-set-region-syntax-color
+ error-start
+ error-end
+ (list 'font-lock-face 'font-lock-warning-face))))))
+
+ (phps-mode-debug-message
+ (message "Incremental tokens: %s" incremental-tokens))))))
+
(defun phps-mode-functions-get-processed-buffer ()
"Get flag for whether buffer is processed or not."
phps-mode-functions-processed-buffer)
@@ -2142,6 +2319,7 @@
(phps-mode-debug-message (message "Processed result: %s" processed))
(setq-local phps-mode-functions-imenu (nth 0 processed))
(setq-local phps-mode-functions-lines-indent (nth 1 processed)))
+ (phps-mode-analyzer--reset-imenu)
(setq-local phps-mode-functions-processed-buffer t))
(phps-mode-debug-message
(when phps-mode-functions-processed-buffer
@@ -3407,13 +3585,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
;; Reset change flag
(phps-mode-functions--reset-changes)
- (phps-mode-functions--cancel-idle-timer)
-
- ;; Update last buffer states
- (setq-local phps-mode-lexer-buffer-length (1-
(point-max)))
- (setq-local
- phps-mode-lexer-buffer-contents
- (buffer-substring-no-properties (point-min)
(point-max))))))))
+ (phps-mode-functions--cancel-idle-timer))))))
(phps-mode-analyzer--alternative-indentation (point))
(phps-mode-debug-message
(message "Did not find indent for line, using alternative
indentation..")))))
diff --git a/phps-mode-wy-wy.el b/phps-mode-wy-wy.el
deleted file mode 100644
index a00ec72..0000000
--- a/phps-mode-wy-wy.el
+++ /dev/null
@@ -1,92 +0,0 @@
-;;; phps-mode-wy-wy.el --- Generated parser support file
-
-;; Copyright (C) 2018-2019 Free Software Foundation, Inc.
-
-;; Author: Christian Johansson
<christianjohansson@Christians-MacBook-Air.local>
-;; Created: 2019-11-13 07:07:16+0100
-;; Keywords: syntax
-;; X-RCS: $Id$
-
-;; This file is not part of GNU Emacs.
-
-;; 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 software 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:
-;;
-;; PLEASE DO NOT MANUALLY EDIT THIS FILE! It is automatically
-;; generated from the grammar file phps-mode-wy.wy.
-
-;;; History:
-;;
-
-;;; Code:
-
-(require 'semantic/lex)
-(eval-when-compile (require 'semantic/bovine))
-
-;;; Prologue
-;;
-
-;;; Declarations
-;;
-(eval-and-compile (defconst phps-mode-wy-wy--expected-conflicts
- nil
- "The number of expected shift/reduce conflicts in this
grammar."))
-
-(defconst phps-mode-wy-wy--keyword-table
- (semantic-lex-make-keyword-table 'nil 'nil)
- "Table of language keywords.")
-
-(defconst phps-mode-wy-wy--token-table
- (semantic-lex-make-type-table 'nil 'nil)
- "Table of lexical tokens.")
-
-(defconst phps-mode-wy-wy--parse-table
- (progn
- (eval-when-compile
- (require 'semantic/wisent/comp))
- (wisent-compile-grammar
- '(nil nil)
- 'nil))
- "Parser table.")
-
-(defun phps-mode-wy-wy--install-parser ()
- "Setup the Semantic Parser."
- (semantic-install-function-overrides
- '((parse-stream . wisent-parse-stream)))
- (setq semantic-parser-name "LALR"
- semantic--parse-table phps-mode-wy-wy--parse-table
- semantic-debug-parser-source "phps-mode-wy.wy"
- semantic-flex-keywords-obarray phps-mode-wy-wy--keyword-table
- semantic-lex-types-obarray phps-mode-wy-wy--token-table)
- ;; Collect unmatched syntax lexical tokens
- (semantic-make-local-hook 'wisent-discarding-token-functions)
- (add-hook 'wisent-discarding-token-functions
- 'wisent-collect-unmatched-syntax nil t))
-
-
-;;; Analyzers
-;;
-
-;;; Epilogue
-;;
-
-(provide 'phps-mode-wy-wy)
-
-;; Local Variables:
-;; version-control: never
-;; no-update-autoloads: t
-;; End:
-
-;;; phps-mode-wy-wy.el ends here
diff --git a/phps-mode.el b/phps-mode.el
index 803b585..b7953f0 100644
--- a/phps-mode.el
+++ b/phps-mode.el
@@ -5,8 +5,8 @@
;; Author: Christian Johansson <address@hidden>
;; Maintainer: Christian Johansson <address@hidden>
;; Created: 3 Mar 2018
-;; Modified: 20 Dec 2019
-;; Version: 0.3.27
+;; Modified: 16 Jan 2019
+;; Version: 0.3.28
;; Keywords: tools, convenience
;; URL: https://github.com/cjohansson/emacs-phps-mode
@@ -37,7 +37,11 @@
;; Improved syntax table in comparison with old PHP major-mode.
;;
;; For flycheck support run `(phps-mode-flycheck-setup)'.
-
+;;
+;; For asynchronous lexer run: `(setq phps-mode-async-process t)'
+;;
+;; For asynchronous lexer via `async.el' instead of threads run:
`(phps-mode-async-process-using-async-el t)'
+;;
;; Please see README.md from the same repository for extended documentation.
@@ -157,8 +161,6 @@
(setq-local phps-mode-functions-lines-indent nil)
(setq-local phps-mode-functions-imenu nil)
(setq-local phps-mode-functions-processed-buffer nil)
- (setq-local phps-mode-lexer-buffer-length nil)
- (setq-local phps-mode-lexer-buffer-contents nil)
(setq-local phps-mode-lexer-tokens nil)
(setq-local phps-mode-lexer-states nil))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [elpa] externals/phps-mode 02ae2ec: Added support for asynchronous lexer,
Christian Johansson <=