Skip to content

Commit

Permalink
Ensure spaces outside strings are all whitespaces.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmzambon committed Aug 30, 2022
1 parent b54962b commit eaf0963
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
11 changes: 7 additions & 4 deletions pygments/lexers/configs.py
Expand Up @@ -46,15 +46,18 @@ class IniLexer(RegexLexer):
(r'\s+', Whitespace),
(r'[;#].*', Comment.Single),
(r'\[.*?\]$', Keyword),
(r'(.*?)([  \t]*)(=)([  \t]*)([^;#\n]*[  \t]\\\n)',
bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String), "value"),
(r'(.*?)([  \t]*)(=)([  \t]*)([^;#\n]*)',
(r'(.*?)([  \t]*)(=)([  \t]*)([^;#\n]*)(\\)(\s+)',
bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String, Text, Whitespace),
"value"),
(r'(.*?)([  \t]*)(=)([  \t]*)([^ ;#\n]*(?: [^ ;#\n]+)*)',
bygroups(Name.Attribute, Whitespace, Operator, Whitespace, String)),
# standalone option, supported by some INI parsers
(r'(.+?)$', Name.Attribute),
],
'value': [ # line continuation
(r'.*\\[ \t]*\n', String),
(r'\s+', Whitespace),
(r'(\s*)(.*)(\\)([ \t]*)',
bygroups(Whitespace, String, Text, Whitespace)),
(r'.*$', String, "#pop"),
],
}
Expand Down
13 changes: 8 additions & 5 deletions tests/examplefiles/ini/test.ini.output

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit eaf0963

Please sign in to comment.