summaryrefslogtreecommitdiff
path: root/lisp/ldg-regex.el
diff options
context:
space:
mode:
authorGeorge Kettleborough <g.kettleborough@member.fsf.org>2013-04-16 16:45:01 +0100
committerGeorge Kettleborough <g.kettleborough@member.fsf.org>2013-04-16 16:45:01 +0100
commit03b3ef5f0b56286f7ee8498588f5d07c19d8b6f6 (patch)
tree72d04693a23f500c8839c6e6d3450a1a33b60937 /lisp/ldg-regex.el
parenta052898b601da0e09fe3e45e2f2938221c7265bd (diff)
downloadledger-03b3ef5f0b56286f7ee8498588f5d07c19d8b6f6.tar.gz
ledger-03b3ef5f0b56286f7ee8498588f5d07c19d8b6f6.tar.bz2
ledger-03b3ef5f0b56286f7ee8498588f5d07c19d8b6f6.zip
Make union of regexps at compile time
Diffstat (limited to 'lisp/ldg-regex.el')
-rw-r--r--lisp/ldg-regex.el6
1 files changed, 5 insertions, 1 deletions
diff --git a/lisp/ldg-regex.el b/lisp/ldg-regex.el
index bf7e6c95..c9e60e71 100644
--- a/lisp/ldg-regex.el
+++ b/lisp/ldg-regex.el
@@ -78,7 +78,11 @@
"\\|"
ledger-metadata-regex))
-
+(defmacro rx-static-or (&rest rx-strs)
+ "Returns rx union of regexps which can be symbols that eval to strings."
+ `(rx (or ,@(mapcar #'(lambda (rx-str)
+ `(regexp ,(eval rx-str)))
+ rx-strs))))
(defmacro ledger-define-regexp (name regex docs &rest args)
"Simplify the creation of a Ledger regex and helper functions."