[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/phps-mode 37fdd2e 78/96: Passing all tests with parser
From: |
Christian Johansson |
Subject: |
[elpa] externals/phps-mode 37fdd2e 78/96: Passing all tests with parser integrated somewhat |
Date: |
Fri, 29 Oct 2021 11:14:56 -0400 (EDT) |
branch: externals/phps-mode
commit 37fdd2e0ec093378d867fbc25b269becf309bccf
Author: Christian Johansson <christian@cvj.se>
Commit: Christian Johansson <christian@cvj.se>
Passing all tests with parser integrated somewhat
---
phps-mode-lex-analyzer.el | 56 +++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 54 insertions(+), 2 deletions(-)
diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index cb76e6b..3b0932a 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -93,6 +93,12 @@
(defvar-local phps-mode-lex-analyzer--nest-location-stack nil
"Nest location stack.")
+(defvar-local phps-mode-lex-analyzer--parse-trail nil
+ "Valid parse trail or nil.")
+
+(defvar-local phps-mode-lex-analyzer--parse-error nil
+ "Non-nil means an error.")
+
;; FUNCTIONS
@@ -387,7 +393,10 @@
(phps-mode-lex-analyzer--process-tokens-in-string
(nth 0 lex-result)
buffer-contents)))
- (list lex-result processed-result)))
+ ;; TODO Async parse here?
+ (list
+ lex-result
+ processed-result)))
(lambda(result)
(when (get-buffer buffer-name)
@@ -404,6 +413,27 @@
(setq phps-mode-lex-analyzer--heredoc-label-stack (nth 5
lex-result))
(setq phps-mode-lex-analyzer--nest-location-stack (nth 6
lex-result))
+ ;; TODO Synchronous parse here?
+ (setq phps-mode-lex-analyzer--parse-trail nil)
+ (setq phps-mode-lex-analyzer--parse-error nil)
+ (setq phps-mode-parser-tokens phps-mode-lex-analyzer--tokens)
+ (condition-case conditions
+ (progn
+ (setq
+ phps-mode-lex-analyzer--parse-trail
+ (phps-mode-parser-parse)))
+ (error
+ (message "GOT ERROR 2: %S" conditions)
+ (setq
+ phps-mode-lex-analyzer--parse-error
+ conditions)))
+ ;; (when phps-mode-lex-analyzer--parse-error
+ ;; (display-warning
+ ;; 'phps-mode
+ ;; phps-mode-lex-analyzer--parse-error
+ ;; :warning
+ ;; "*PHPs Parse Errors*"))
+
;; Save processed result
(setq phps-mode-lex-analyzer--processed-buffer-p t)
(setq phps-mode-lex-analyzer--imenu (nth 0 processed-result))
@@ -489,6 +519,7 @@
(phps-mode-lex-analyzer--process-tokens-in-string
(nth 0 lex-result)
buffer-contents)))
+ ;; TODO Async parse here?
(list lex-result processed-result)))
(lambda(result)
@@ -508,6 +539,27 @@
(setq phps-mode-lex-analyzer--heredoc-label-stack (nth 5
lex-result))
(setq phps-mode-lex-analyzer--nest-location-stack (nth 6
lex-result))
+ ;; TODO Synchronous parse here?
+ (setq phps-mode-lex-analyzer--parse-trail nil)
+ (setq phps-mode-lex-analyzer--parse-error nil)
+ (setq phps-mode-parser-tokens phps-mode-lex-analyzer--tokens)
+ (condition-case conditions
+ (progn
+ (setq
+ phps-mode-lex-analyzer--parse-trail
+ (phps-mode-parser-parse)))
+ (error
+ (message "GOT ERROR 1: %S" conditions)
+ (setq
+ phps-mode-lex-analyzer--parse-error
+ conditions)))
+ ;; (when phps-mode-lex-analyzer--parse-error
+ ;; (display-warning
+ ;; 'phps-mode
+ ;; phps-mode-lex-analyzer--parse-error
+ ;; :warning
+ ;; "*PHPs Parse Errors*"))
+
;; Save processed result
(setq phps-mode-lex-analyzer--processed-buffer-p t)
(setq phps-mode-lex-analyzer--imenu (nth 0 processed-result))
@@ -3125,7 +3177,7 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
(unless phps-mode-lex-analyzer--state
(setq phps-mode-lex-analyzer--state 'ST_INITIAL)))
-(defun phps-mode-lex-analyzer--lex-string (contents &optional start end states
state state-stack heredoc-label heredoc-label-stack nest-location-stack tokens
parse)
+(defun phps-mode-lex-analyzer--lex-string (contents &optional start end states
state state-stack heredoc-label heredoc-label-stack nest-location-stack tokens)
"Run lexer on CONTENTS."
;; Create a separate buffer, run lexer inside of it, catch errors and return
them
;; to enable nice presentation
- [elpa] externals/phps-mode a6c5db1 45/96: Updated grammar productions based on automatically parsed grammar from YACC, (continued)
- [elpa] externals/phps-mode a6c5db1 45/96: Updated grammar productions based on automatically parsed grammar from YACC, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 2ac480a 47/96: Started on automatic generation of terminals, non-terminals and start as well, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode eb17d8c 51/96: Improved resuming of parser-generation, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 6af98c4 56/96: Productions are now read automatically again, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 212fd7f 63/96: Fixed warning in byte-compilation, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode fb57c3b 53/96: Started on parser for global declaration, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode e418621 59/96: Projects passes tests and byte-compilation again, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 945571c 65/96: Fixed byte-compilation issues with parser, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 07a983d 66/96: Passing parser tests, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode b551e69 67/96: Added TODO items, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 37fdd2e 78/96: Passing all tests with parser integrated somewhat,
Christian Johansson <=
- [elpa] externals/phps-mode e3b9403 69/96: Removed garbage collection modification, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 1789d15 60/96: Fixed bug in gramamr automation, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 08e1325 74/96: Test of parser not dependent on buffer name, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode eced7be 77/96: Parser now not dependent on lex-analyzer variables, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 4f7126b 70/96: Fixed automation grammar setting of lex-analyzer functions, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode ce5e28e 72/96: Added generated grammar in output of automation, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode e698a2e 64/96: Re-generated parser with automated grammar, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 128868c 75/96: Added another parse test, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode f44577a 79/96: More testing integrating parser and lex-analyzer, Christian Johansson, 2021/10/29
- [elpa] externals/phps-mode 7cfa35c 81/96: Improved error-reporting for parser errors, Christian Johansson, 2021/10/29