Permalink
Browse files

factor< and factor<= are no longer macros

  • Loading branch information...
1 parent ecf83f1 commit f76b6e8c55ac4ff4e7a4c8ca51e5290f50be820a joshua-choi committed May 28, 2009
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/name/choi/joshua/fnparse.clj
@@ -326,17 +326,17 @@
(with-monad parser-m
(m-seq (replicate factor subrule))))
-(defmacro factor<
+(defn factor<
"Same as the factor= function, except that the new rule eats up tokens only until the
given subrule is fulfilled one less times than the factor. The new rule would never fail.
(factor< 3 :a) would eat the first two tokens [:a :a :a :a :b] and return:
[[:a :a] (list :a :a :b)].
(factor< 3 :a) would eat the first three tokens [:b] and return:
[nil (list :b)]"
[factor subrule]
- `(alt (factor= ~(dec factor) ~subrule) (rep< ~factor ~subrule)))
+ (alt (factor= (dec factor) subrule) (rep< factor subrule)))
-(defmacro factor<=
+(defn factor<=
"Same as the factor= function, except that the new rule always succeeds, consuming tokens
until the subrule is fulfilled the same amount of times as the given factor. The new rule
would never fail.
@@ -345,7 +345,7 @@
(factor<= 3 :a) would eat the first three tokens [:b] and return:
[nil (list :b)]"
[factor subrule]
- `(alt (factor= ~factor ~subrule) (rep< ~factor ~subrule)))
+ (alt (factor= factor subrule) (rep< factor subrule)))
(defn failpoint
"Creates a rule that applies a failpoint to a subrule. When the subrule fails—i.e., it

0 comments on commit f76b6e8

Please sign in to comment.