Re: Line/string triage?

>
> > That feels like it would be a significant departure from the current
> semantics where I would expect ![L] to match and consume one non-letter
> character.
>

The current semantics is for ~[L] which means match and consume one
non-letter character. The not operator ! is merely a proposal. :-)

Anchoring (matching without consuming) does feel different, but don’t we
> already have ~[L] to match and consume one non-letter character.


It is different, but since we are talking about a new not operator (!), I
was merely thinking that if we have a grammar:

line : !"chapter", ~[#a]+.

The not operator performs a lookahead and blocks further entry into the
rule, but there is nothing that requires the rule to actually consume the
lookahead after it has been checked, right?

Therefore we could place the not at the end of a rule! The typical use case
would be to greedy accumulate all letters into an identifier and then stop
when there are no more letters. End of file also satifies ![L].

Usually the lexer does this, if you have one.

//Fredrik

Received on Saturday, 22 March 2025 09:37:54 UTC