textmate/python.tmbundle — pull request #44 by aroben (2014-10-23 23:13:06+00:00)
Title: Fix highlighting of character classes containing opening brackets

The character-class repository was recursively including itself, which meant that the grammar was saying it was possible to start one character class inside another.

This does not match the semantics of Python regular expressions. Opening brackets inside character classes are interpreted as literal characters, not as opening another, nested character class.

To fix this, I split the character-class repository in two: the character-class now handles matching the entire character class, while the character-class-contents repository handles matching just characters inside the character class.

This fixes the parsing of Python regular expressions like `r'[[]'`.

@sorbits We ran into this when testing out TextMate highlighting on GitHub's staging servers.

/cc @vmg