Re: Excluding a factor that is not a character set

Sheila Thomson <discuss@bluegumtree.com> writes:
> Several times I have wanted a factor in a rule to be the exclusion of another named rule. A recent example is:
>
> song: ~code, code, line-ending .
> @code: -" ", [Lu], [Lu], digit, digit, digit, digit, digit, digit .
> -digit: ["0"-"9"] .
>
> Where, above, "~code" is what I would like to be able to write; intending to represent everything prior to a substring that matches the code rule.

Well, given that code has to start with space, ~[" "]* probably works.
Negating character classes (“all characters except these”) is supported today.

The more general case “not this nonterminal” is more difficult.
There have been a few discussions around subtraction or exception operators. See https://github.com/invisiblexml/ixml/issues/249 for example, but nothing really solid has developed so far.

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Wednesday, 8 October 2025 06:41:59 UTC