Skip to content

Implement inverted character class#8

Open
csnover wants to merge 1 commit intoreloginn:mainfrom
csnover:invert-set
Open

Implement inverted character class#8
csnover wants to merge 1 commit intoreloginn:mainfrom
csnover:invert-set

Conversation

@csnover
Copy link

@csnover csnover commented Aug 31, 2025

PIL 20.2: An upper case version of any of those classes represents the complement of the class.

The complements were in the test suite for bare pattern but not for character set, where they were failing. This patch adds a basic test for complement class in a character set.

The implementation looks a little weird. The list of bytes is an ordered list of transition points, not ranges, and the simple inversion trick requires exclusive end indexes. There might be a cleaner and equally or more efficient way to do this but I am a smooth brain.

PIL 20.2: An upper case version of any of those classes represents
the complement of the class.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant