instaparse 2025-01-23

Is there a way to leave out a terminal from the parse tree? e.g. I am ignoring whitespace in the parsed output, so I wish it simply wouldn't appear in the generated hiccup.

e.g. my output hiccup currently looks like this

[:QUERY
 [:VALUES
  [:VALUE [:TOKEN "this"]]
  [:SPACE " "]
  [:VALUE [:TOKEN "that"]]
  [:SPACE " "]
  [:VALUE [:TOKEN "other"]]]]
but I wish it just looked like this:
[:QUERY
 [:VALUES
  [:VALUE [:TOKEN "this"]]
  [:VALUE [:TOKEN "that"]]
  [:VALUE [:TOKEN "other"]]]]

I can just remove it myself using clojure.walk or clojure.zip, but perhaps there is way to state this in the grammar?

@simongray from the readme: > In instaparse, you can use angle brackets <> to hide parsed elements, suppressing them from the tree output.

🙏 1

Thank you, I missed that!

👍 1