This repository has been archived by the owner on Sep 8, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix escape sequences in Python's strings (rouge-ruby#1508)
Version 3.18.0 of Rouge included a new mechanism for handling strings in the Python lexer. One of the consequences of that change was that raw strings would break if they included 'invalid' escape sequences. This is a mistake as raw strings do not have 'invalid' escape sequences. This commit fixes this error by changing the approach that the Python lexer takes to escape sequences more generally. Rather than dividing recognised and unrecognised escape sequences into 'valid' and 'invalid', it simply treats unrecognised escape sequences as ordinary strings. The result of this is that all escape sequences in raw strings produce `Str` tokens. In other types of strings, recognised escape sequences produce `Str::Escape` tokens and unrecognised escape sequences produce `Str` tokens.
- Loading branch information