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

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

[elpa] externals/parsec 9053adb 02/13: Redefined 'parsec-one-of' in term


From: Stefan Monnier
Subject: [elpa] externals/parsec 9053adb 02/13: Redefined 'parsec-one-of' in terms of 'parsec-or' and 'parsec-ch' for consistency in handling character parsing
Date: Fri, 26 Mar 2021 22:45:54 -0400 (EDT)

branch: externals/parsec
commit 9053adb5c364c364e1b11104c5370c51bc6a3a33
Author: Justin Timmons <justinmtimmons@gmail.com>
Commit: Justin Timmons <justinmtimmons@gmail.com>

    Redefined 'parsec-one-of' in terms of 'parsec-or' and 'parsec-ch' for 
consistency in handling character parsing
---
 parsec.el | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/parsec.el b/parsec.el
index fed0838..efebc89 100644
--- a/parsec.el
+++ b/parsec.el
@@ -601,15 +601,14 @@
         (setq regex-str (concat regex-str "^"))))
     (concat regex-head regex-str regex-end)))
 
-(defun parsec-one-of (&rest chars)
+(defmacro parsec-one-of (&rest chars)
   "Succeed if the current character is in the supplied list of CHARS.
 Return the parsed character.
 
->  (parsec-one-of ?a ?e ?i ?o ?u)
-
-Note this function is just a wrapper of `parsec-re'.  For complicated use 
cases,
-consider using `parsec-re' instead."
-  (parsec-re (format "[%s]" (parsec-make-alternatives chars))))
+>  (parsec-one-of ?a ?e ?i ?o ?u)"
+  (let ((sexp '(parsec-or))
+       (parsers (mapcar (lambda (c) (list #'parsec-ch c)) chars)))
+    (append sexp parsers)))
 
 (defun parsec-none-of (&rest chars)
   "Succeed if the current character not in the supplied list of CHARS.



reply via email to

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