8000 TOML: fix bug with eager literal strings · pygments/pygments@220a2a9 · GitHub
[go: up one dir, main page]

Skip to content 8000

Commit 220a2a9

Browse files
committed
TOML: fix bug with eager literal strings
1 parent 5cf7389 commit 220a2a9

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

pygments/lexers/configs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1260,7 +1260,7 @@ class TOMLLexer(RegexLexer):
12601260
(r'[^"\\]+', String.Double),
12611261
],
12621262
'literal-string': [
1263-
(r".*'", String.Single, '#pop'),
1263+
(r".*?'", String.Single, '#pop'),
12641264
],
12651265
'multiline-basic-string': [
12661266
(r'"""', String.Double, '#pop'),

tests/examplefiles/toml/example.toml.output

Lines changed: 11 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/snippets/toml/strings-eager.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@ spam = '''same with a''' # multiline '''literal string'''
2121
'=' Operator
2222
' ' Text.Whitespace
2323
"'" Literal.String.Single
24-
"same with a' # basic 'string'" Literal.String.Single
24+
"same with a'" Literal.String.Single
25+
' ' Text.Whitespace
26+
"# basic 'string'" Comment.Single
2527
'\n' Text.Whitespace
2628

2729
'baz' Name

0 commit comments

Comments
 (0)
0