diff options
author | Tim Hatch <tim@timhatch.com> | 2014-10-06 21:19:28 -0700 |
---|---|---|
committer | Tim Hatch <tim@timhatch.com> | 2014-10-06 21:19:28 -0700 |
commit | 877a173f8a91b3626dd2681e549a50fa269d717f (patch) | |
tree | af5a43dec8e65a3b0cada2eed17c461b1b8ee49a /pygments | |
parent | 4ad22ff46ce05d7c665d9489c8122b45d5fae082 (diff) | |
download | pygments-877a173f8a91b3626dd2681e549a50fa269d717f.tar.gz |
BashLexer: Correctly handle $'' strings.
Diffstat (limited to 'pygments')
-rw-r--r-- | pygments/lexers/shell.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py index 097ca624..e65fbcb5 100644 --- a/pygments/lexers/shell.py +++ b/pygments/lexers/shell.py @@ -40,8 +40,8 @@ class BashLexer(RegexLexer): 'root': [ include('basic'), (r'`', String.Backtick, 'backticks'), - include('interp'), include('data'), + include('interp'), ], 'interp': [ (r'\$\(\(', Keyword, 'math'), @@ -71,7 +71,8 @@ class BashLexer(RegexLexer): 'data': [ (r'(?s)\$?"(\\\\|\\[0-7]+|\\.|[^"\\$])*"', String.Double), (r'"', String.Double, 'string'), - (r"(?s)\$?'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), + (r"(?s)\$'(\\\\|\\[0-7]+|\\.|[^'\\])*'", String.Single), + (r"(?s)'.*?'", String.Single), (r';', Punctuation), (r'&', Punctuation), (r'\|', Punctuation), @@ -82,7 +83,7 @@ class BashLexer(RegexLexer): ], 'string': [ (r'"', String.Double, '#pop'), - (r'(\\\\|\\[0-7]+|\\[\w\W]|[^"\\$])+', String.Double), + (r'(?s)(\\\\|\\[0-7]+|\\.|[^"\\$])+', String.Double), include('interp'), ], 'curly': [ |