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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/phps-mode 83dd8e8: Improved error-reporting and error-h


From: Christian Johansson
Subject: [elpa] externals/phps-mode 83dd8e8: Improved error-reporting and error-handling
Date: Wed, 19 Feb 2020 01:04:47 -0500 (EST)

branch: externals/phps-mode
commit 83dd8e8fdc77b70c76bcff897768c1f635407f63
Author: Christian Johansson <address@hidden>
Commit: Christian Johansson <address@hidden>

    Improved error-reporting and error-handling
---
 phps-mode-lex-analyzer.el | 24 +++++++++++++++---------
 phps-mode-lexer.el        |  6 +++---
 phps-mode-serial.el       | 12 ++++++------
 phps-mode.el              |  4 ++--
 4 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/phps-mode-lex-analyzer.el b/phps-mode-lex-analyzer.el
index 3c5fa13..51d2460 100644
--- a/phps-mode-lex-analyzer.el
+++ b/phps-mode-lex-analyzer.el
@@ -2380,15 +2380,21 @@ SQUARE-BRACKET-LEVEL and ROUND-BRACKET-LEVEL."
           (setq semantic-lex-syntax-table phps-mode-syntax-table))
         (setq semantic-lex-analyzer #'phps-mode-lex-analyzer--re2c-lex)
 
-        ;; Run lexer or incremental lexer
-        (if (and start end)
-            (let ((incremental-tokens (semantic-lex start end)))
-              (setq
-               phps-mode-lex-analyzer--tokens
-               (append tokens incremental-tokens)))
-          (setq
-           phps-mode-lex-analyzer--tokens
-           (semantic-lex-buffer)))
+        ;; Catch errors to kill generated buffer
+        (condition-case conditions
+            (progn
+              ;; Run lexer or incremental lexer
+              (if (and start end)
+                  (let ((incremental-tokens (semantic-lex start end)))
+                    (setq
+                     phps-mode-lex-analyzer--tokens
+                     (append tokens incremental-tokens)))
+                (setq
+                 phps-mode-lex-analyzer--tokens
+                 (semantic-lex-buffer))))
+          (error (progn
+                   (kill-buffer)
+                   (signal 'error (cdr conditions)))))
 
         ;; Copy variables outside of buffer
         (setq state phps-mode-lexer--state)
diff --git a/phps-mode-lexer.el b/phps-mode-lexer.el
index 437ef39..b7771b7 100644
--- a/phps-mode-lexer.el
+++ b/phps-mode-lexer.el
@@ -149,7 +149,7 @@
       (signal
        'error
        (list
-        (format "PHPs Lexer Error - Trying to pop last state at %d" (point))
+        (format "Trying to pop last state at %d" (point))
         (point))))))
 
 (defun phps-mode-lexer--MOVE_FORWARD (position)
@@ -545,7 +545,7 @@
          (signal
           'error (list
                   (format
-                   "PHPs Lexer Error - The (real) cast is deprecated, use 
(float) instead at %d"
+                   "The (real) cast is deprecated, use (float) instead at %d"
                    (match-beginning 0)
                    )
                   (match-beginning 0)
@@ -1106,7 +1106,7 @@
                (signal
                 'error
                 (list (format
-                       "PHPs Lexer Error - Unterminated comment starting at %d"
+                       "Un-terminated comment starting at %d"
                        (point))
                       (point)
                       )))))))
diff --git a/phps-mode-serial.el b/phps-mode-serial.el
index 945e978..5b5ce77 100644
--- a/phps-mode-serial.el
+++ b/phps-mode-serial.el
@@ -60,7 +60,7 @@
                         (progn
                           (let ((start-return (funcall start)))
                             (list 'success start-return start-time)))
-                      (error (list 'error conditions start-time))))
+                      (error (list 'error (cdr conditions) start-time))))
                   (lambda (start-return)
                     (let ((status (car start-return))
                           (value (car (cdr start-return)))
@@ -84,7 +84,7 @@
                             (progn
                               (let ((return (funcall end value)))
                                 (setq end-return (list 'success return 
start-time))))
-                          (error (setq end-return (list 'error conditions 
start-time))))
+                          (error (setq end-return (list 'error (cdr 
conditions) start-time))))
 
                         ;; Profile execution in debug mode
                         (let* ((end-time (current-time))
@@ -116,7 +116,7 @@
                 (condition-case conditions
                     (let ((return (funcall start)))
                       (setq start-return (list 'success return start-time)))
-                  (error (setq start-return (list 'error conditions 
start-time))))
+                  (error (setq start-return (list 'error (cdr conditions) 
start-time))))
 
                 ;; Profile execution in debug mode
                 (let* ((end-time (current-time))
@@ -139,7 +139,7 @@
                     (condition-case conditions
                         (let ((return (funcall end value)))
                           (setq end-return (list 'success return start-time)))
-                      (error (setq end-return (list 'error conditions 
start-time))))
+                      (error (setq end-return (list 'error (cdr conditions) 
start-time))))
 
                     ;; Profile execution
                     (let* ((end-time (current-time))
@@ -169,7 +169,7 @@
             (progn
               (let ((return (funcall start)))
                 (setq start-return (list 'success return start-time))))
-          (error (setq start-return (list 'error conditions start-time))))
+          (error (setq start-return (list 'error (cdr conditions) 
start-time))))
 
         ;; Profile execution in debug mode
         (let* ((end-time (current-time))
@@ -194,7 +194,7 @@
             (condition-case conditions
                 (let ((return (funcall end value)))
                   (setq end-return (list 'success return start-time)))
-              (error (setq end-return (list 'error conditions start-time))))
+              (error (setq end-return (list 'error (cdr conditions) 
start-time))))
 
             ;; Profile execution in debug mode
             (let* ((end-time (current-time))
diff --git a/phps-mode.el b/phps-mode.el
index 107aa71..d0fe190 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: 18 Feb 2020
-;; Version: 0.3.34
+;; Modified: 19 Feb 2020
+;; Version: 0.3.35
 ;; Keywords: tools, convenience
 ;; URL: https://github.com/cjohansson/emacs-phps-mode
 



reply via email to

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