Skip to content

Consuming white spaces #134

Answered by ColinH
kjbron asked this question in Q&A
Nov 22, 2018 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

There is no way to generally ignore whitespace as it is one of the inherent properties of the PEG approach to not have a separate tokenisation pass.

I'm also unsure what exactly eating spaces for the "entire grammar" would actually mean; if you change the control class to skip whitespace after every successful rule match you would probably allow whitespace in places you don't really want that.

One could of course use another class template to control after which rules whitespace is to be skipped, but that might not be much easier than to embed the appropriate rules in the grammar.

Let us know if you find a solution that could be of general use, we also haven't really thought much about th…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@brouhaha
Comment options

Answer selected by d-frey
Comment options

You must be logged in to vote
1 reply
@ColinH
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #134 on December 09, 2020 09:54.