Repository navigation
Commit e3a3c54
Fix Haskell lexer: handle escape sequences in character literals (#3069)
* fix: handle escape sequences in Haskell character literals
The root-state pattern for character literals only matched single
non-backslash characters like 'a'. Escape sequences like '\n', '\t',
'\\' were incorrectly tokenized as Keyword.Type + Name fragments.
Added a pattern for '\.' (backslash + any char) to match escape
character literals, placed after the existing non-escape pattern.
Fixes #1795
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* test: add snippet test for escape character literals
Covers '\n', '\t', '\\', and 'a' tokenization as Literal.String.Char.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
* test: regenerate Haskell and LHS golden outputs
Update expected token outputs for example.hs and Sudoku.lhs
to reflect the new escape character literal tokenization.
---------
Co-authored-by: Matt Van Horn <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>1 parent d7c3453 commit e3a3c54
4 files changed
Lines changed: 22 additions & 6 deletions
File tree
- pygments/lexers
- tests
- examplefiles
- haskell
- lhs
- snippets/haskell
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
| 57 | + | |
57 | 58 | | |
58 | 59 | | |
59 | 60 | | |
| |||
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
0 commit comments