This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-11-23
Channels
- # aws (2)
- # beginners (57)
- # boot (63)
- # cider (7)
- # clara (1)
- # cljs-dev (1)
- # cljsrn (5)
- # clojure (68)
- # clojure-brasil (1)
- # clojure-dusseldorf (2)
- # clojure-greece (10)
- # clojure-italy (29)
- # clojure-russia (1)
- # clojure-spec (9)
- # clojure-uk (66)
- # clojurescript (16)
- # cursive (18)
- # datomic (19)
- # docker (3)
- # figwheel (2)
- # fulcro (61)
- # instaparse (7)
- # jobs (1)
- # luminus (5)
- # lumo (47)
- # mount (6)
- # off-topic (13)
- # onyx (39)
- # planck (4)
- # portkey (2)
- # re-frame (28)
- # ring (6)
- # ring-swagger (30)
- # rum (3)
- # shadow-cljs (142)
- # spacemacs (5)
- # sql (2)
- # unrepl (61)
- # untangled (2)
Hey guys, I am playing with instaparse and I have a problem contructucting a grammar.
Here is what I am going for
(insta/defparser ex7
"
doc = (text | tag)*
text = #'[^@]*'
tag = '@' #'[a-z]*' inner-text*
inner-text = '{' #'[^}]*' '}'
")
(ex7 "some text @toto{inner text}")
The problem is the parser when parsing a tag
rule won’t consider the inner-text
rule giving me the parse
[:doc [:text "some text "] [:tag "@" "toto"] [:text "{inner text}"]]
instead of the desired
[:doc [:text "some text "] [:tag "@" "toto" [:inner-text "{" "inner text" "}"]]]
Any Idea how I can modify the grammar to consider the inner-text rule
before going back to the text
one ?
@jeremys Maybe change inner-text*
to inner-text* !inner-text
, to ensure that it parses as many inner-texts as it can.
@aengelberg Thx Alex I’ll try to use the lookahead, I haven’t played with that yet.