Skip to content

ListOf handling newline characters #297

Answered by pdubroy
drush asked this question in Help
Discussion options

You must be logged in to vote

Hi Darren,

If your language has significant newlines, it probably makes sense to redefine the space rule. That will change the behavior of the implicit space skipping. The built-in definition includes any character from \x00 up to and including \x20 (space). E.g., you might want to define the space rule like this:

space := ~"\n" "\x00".."\x20"

Alternatively you could use listOf rather than ListOf, which would eliminate implicit space skipping, so you'd need to do it yourself. E.g., something like this may work:

Columns = listOf<ident, delim>
delim = spaceNoNL* ("\n" | ",")
spaceNoNL = ~"\n" "\x00".."\x20"

Does that help?

Replies: 1 comment 1 reply

Comment options

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

Answer selected by pdubroy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants