Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get instaparse to skip whitespace?

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.)

like image 400
rwallace Avatar asked Apr 11 '16 18:04

rwallace


1 Answers

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
like image 99
Timothy Pratley Avatar answered Oct 21 '22 14:10

Timothy Pratley