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

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

[elpa] master a45d8f4 03/60: Error propagation to pl-until


From: Junpeng Qiu
Subject: [elpa] master a45d8f4 03/60: Error propagation to pl-until
Date: Tue, 25 Oct 2016 17:45:12 +0000 (UTC)

branch: master
commit a45d8f4b01c3d7bcca6d536943ed987fc79018fa
Author: Junpeng Qiu <address@hidden>
Commit: Junpeng Qiu <address@hidden>

    Error propagation to pl-until
---
 parsec.el |   18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/parsec.el b/parsec.el
index 01f2309..1b52e22 100644
--- a/parsec.el
+++ b/parsec.el
@@ -100,13 +100,17 @@
 (defalias 'pl-parse 'pl-try)
 
 (defmacro pl-until (parser &optional &key skip)
-  `(catch 'done
-     (while (not (eobp))
-       (catch 'failed
-         (throw 'done ,parser))
-       ,(if skip
-            `(,skip 1)
-          `(forward-char 1)))))
+  (let ((error-sym (make-symbol "error-message")))
+    `(let (,error-sym)
+       (catch 'done
+         (while (not (eobp))
+           (when (setq ,error-sym
+                       (catch 'failed
+                         (throw 'done ,parser)))
+             (error ,error-sym))
+           ,(if skip
+                `(,skip 1)
+              `(forward-char 1)))))))
 
 (defmacro pl-many (parser)
   (let ((res (make-symbol "results"))



reply via email to

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