1

I am trying to parse the > character in Clojure Instaparse. I have tried |> and |\> but the parser doesn't seem to recognize any of these. Does anyone know the correct syntax?

cfrick
  • 35,203
  • 6
  • 56
  • 68
yazz.com
  • 57,320
  • 66
  • 234
  • 385

1 Answers1

5

You would just handle them as strings. E.g.:

((insta/parser 
   "S = '<' tag '>'
   tag = #'\\w+'
   ") "<html>")
; [:S "<" [:tag "html"] ">"]

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

((insta/parser 
   "S = <'<'> tag <'>'>
   tag = #'\\w+'
   ")  "<html>")
; [:S [:tag "html"]]
cfrick
  • 35,203
  • 6
  • 56
  • 68