Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试解析>Clojure Instaparse 中的字符。我已经尝试过|>,|\>但解析器似乎无法识别其中任何一个。有谁知道正确的语法?
>
|>
|\>
您只需将它们作为字符串处理。例如:
((insta/parser "S = '<' tag '>' tag = #'\\w+' ") "<html>") ; [:S "<" [:tag "html"] ">"]
在 instaparse 中,您可以使用尖括号<>隐藏已解析的元素,从树输出中抑制它们。
<>
((insta/parser "S = <'<'> tag <'>'> tag = #'\\w+' ") "<html>") ; [:S [:tag "html"]]