How do you get instaparse to skip whitespace?
Asked Answered
H

1

5

How do you get instaparse to skip whitespace between tokens?

(I could of course define whitespace as a token in its own right and insert it between all the elements on the right hand side of every rule, but I'm dealing with a grammar that has over three hundred rules, and hoping for a way to say it once rather than three hundred times.)

Housebroken answered 11/4, 2016 at 18:38 Comment(0)
R
9

You can pass an optional parameter to turn on auto-whitespace:

(doc insta/parser)
-------------------------
instaparse.core/parser
([grammar-specification & {:as options}])
   :auto-whitespace (:standard or :comma)
   or
   :auto-whitespace custom-whitespace-parser
Rodman answered 11/4, 2016 at 19:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.