emacs-elpa-diffs
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]