parsatron icon indicating copy to clipboard operation
parsatron copied to clipboard

Bug in `between` function

Open cloudyhug opened this issue 4 years ago • 0 comments

Hello. I just tried to use the between function to parse a string literal. However, when comparing the use of between and a hand-made version of it, between throws an Unexpected token [...] error whereas the hand-made version works as intended.

(defparser p-quote [] (char \"))

(println (run (let->> [_ (p-quote)
                       x (char \a)
                       _ (p-quote)]
  (always x)) "\"a\""))
;=> a
;=> nil

(println (run (between (p-quote)
                       (char \a)
                       (p-quote))
              "\"a\""))
;=> Unexpected token 'a' at line: 1 column: 2

I don't know if it comes from my file or the library. I use these dependencies:

[[org.clojure/clojure "1.10.1"]
 [the/parsatron "0.0.8"]]

cloudyhug avatar Sep 21 '20 16:09 cloudyhug