Hi,
I tried out a double quoted string parser in parsatron. I'd appreciate it
very much if someone could review it and let me know if it looks okay.
(ns mycode.core
(:require [the.parsatron :as p]))
(p/defparser optional [p default-value]
(p/either (p/attempt p) (p/always default-value)))
Hi,
Am Montag, 3. Februar 2014 10:26:56 UTC+1 schrieb Kashyap CK:
(p/defparser -char-parser []
(p/let- [
_e (optional (p/char \\) nil)
_c (if _e (p/token #(#{\ \\ \n \r \t} %)) (p/token #(not= %
\)))
] (p/always (if _e (escape-map _c) _c
Thank you very much Phillip for the tip - #(#{\ \\ \n \r \t} %)) ;; =
#{\ \\ \n \r \t}
I use the escape-map to get the value of various escape sequence - for
example, I want to transform \n in the input text to \newline.
Regards,
Kashyap
On Monday, February 3, 2014 6:56:52 PM UTC+5:30,