How do you both ignore invisibles during parsing, and meaningfully use them?

For example:



(someFn a b c d)


Ignore all the spaces is needed, except when inside an expression.

I’ve been trying with @skip {} { ... } and @skip { invisibles }
And these seem to conflict with:

list<item> { item (invisibles item)* }

But I get unactionable errors and am not sure what to do.

Inconsistent skip sets after StartToken

Mixing different skip sets in a grammar only works when the rules with non-global skip sets are unambiguously delimited on both sides, so that there is no parse state where different skip sets apply. In your example, after parsing an item, it is not clear whether the rule is done (in which case the outer skip set would apply) or not (in which case the scoped skip set applies), so the parser doesn’t know what to skip in that state.

I think part of my problem here is that I’m trying to skip all text that isn’t explicitly declared by “the grammar I want” (which I still want to do, but I don’t know how to do it proper – invisible characters are insignificant for the most part, but do need to exist, but aren’t part of the tokens)

Related issues:

Atm, I don’t know how to handle “any text other than my delimeters” when my delimeters are more than one character – because I can have { as “just text”, ya know?

A delimiter like {{ requires lookahead, so perhaps what you want is an external tokenizer that peeks forward two characters.