parsley icon indicating copy to clipboard operation
parsley copied to clipboard

Question: parsing multi-line strings

Open maryrosecook opened this issue 13 years ago • 4 comments

Hiya. Really enjoying using parsley. I've got a grammar up and running that can parse a number of different expressions. However, I'm struggling with defining the rules to allow lists of expressions where each expression is separated by a new line. For example:

"a\na\na\n"

I thought this grammar would parse the string above:

(def parse (parser { :main :block, :space :ws?, :root-tag :root } :block [#"i" #"\n" :+] :ws #"[ \t\r]+" ))

But I get a shift/reduce error. Could you offer me any pointers?

Thanks a lot.

maryrosecook avatar Jun 08 '12 20:06 maryrosecook

Hi Mary-Rose, It's #1 on my todo list. Technically Parsley has no lookup so blocks need an end delimiter. I've got the relevant paper at hand, I just need time. Sorry for the answer.

cgrand avatar Jun 08 '12 21:06 cgrand

Ah, OK. Thanks. It's good to know I wasn't going crazy! Thank you for the prompt reply.

maryrosecook avatar Jun 08 '12 21:06 maryrosecook

FWIW, I'd love to see handling for such cases included. I know you've been busy with other projects the last several months, but is there still a chance this will make it into parsley at some point?

Thanks for all your work!

dfreeman avatar Jan 18 '13 04:01 dfreeman

Is this issue closed ?

clojj avatar Sep 08 '13 17:09 clojj