Permalink
Browse files

added none-of and eol parsers like haskell

  • Loading branch information...
1 parent f26580a commit 98ca6d8b4f61df8526312dc4a8835a2e2150d91b Jason Jackson committed Jun 4, 2011
Showing with 9 additions and 0 deletions.
  1. +9 −0 src/eu/dnetlib/clojure/clarsec.clj
@@ -78,6 +78,10 @@
(consumed "" "")
(failed)))))
+(def eol
+ (>> (optional (satisfy #(= % \return)))
+ (satisfy #(= % \newline))))
+
(def fail (make-monad 'Parser (fn p-fail [strn] (failed))))
(defn satisfy [pred]
@@ -146,6 +150,11 @@
(let [str-chars (into #{} target-strn)]
(satisfy #(contains? str-chars %))))
+(defn none-of [exclusion-strn]
+ (let [str-chars (into #{} exclusion-strn)]
+ (satisfy #(not (contains? str-chars %)))))
+
+
(def space (one-of " \r\n\t"))
(def spaces (many space))

0 comments on commit 98ca6d8

Please sign in to comment.