This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-09
Channels
- # beginners (108)
- # boot (14)
- # cider (8)
- # clara (13)
- # cljs-dev (63)
- # cljsrn (5)
- # clojure (57)
- # clojure-brasil (1)
- # clojure-italy (69)
- # clojure-losangeles (10)
- # clojure-nl (6)
- # clojure-poland (2)
- # clojure-spec (6)
- # clojure-uk (50)
- # clojurescript (116)
- # core-async (1)
- # cursive (9)
- # data-science (8)
- # datascript (4)
- # datomic (43)
- # duct (2)
- # editors (1)
- # fulcro (29)
- # instaparse (7)
- # jobs (6)
- # keechma (3)
- # mount (16)
- # off-topic (61)
- # om (10)
- # onyx (5)
- # parinfer (17)
- # pedestal (2)
- # portkey (5)
- # quil (2)
- # re-frame (84)
- # reagent (9)
- # remote-jobs (2)
- # ring-swagger (2)
- # shadow-cljs (17)
- # slack-help (1)
- # tools-deps (29)
- # vim (23)
@misha I think you are just under-escaping. Try
(insta/parse
(insta/parser "s = #'\\\\\\\\'")
"\\\\")
Since instaparse and Clojure strings both have their own notation of backslash escaping, you unfortunately have to use an obscene amount of backslashes to convey a legitimate backslash character
As that section in the readme explains, one way to get more predictable escaping behavior is to store your grammar in a separate resource file, and that removes one of the layers of escaping (Clojure strings)
@aengelberg thank you, that works. I already put grammar and source string into their own files, before asking for help, might have missed something (like ns reload).
how can I distinguish between \n
within a text, and a line end in multiline text? Can I do it without relying on next line's grammar/content? For example, here I need to extract "Simple__ communication example\non several lines" as a single value, w/o including "Alice". Is there a landmark I can use to stop at "visual" line's end?:
title __Simple__ communication example\non several lines
Alice -> Bob: Authentication Request
I tried #'(?m)...$'
regex flag, but I doubt it will receive "visual" line as an input.@misha yeah, from the regex's perspective it's matching against the entire rest of the string, so $
means "end of file", not "end of line". You could use regex's lookahead feature to detect and end of line, like (?=\r?\n)