summaryrefslogtreecommitdiff
path: root/pygments
diff options
context:
space:
mode:
authorMatthäus G. Chajdas <dev@anteru.net>2022-12-04 15:52:40 +0100
committerMatthäus G. Chajdas <dev@anteru.net>2022-12-04 15:52:40 +0100
commit2f78a7bf950cfbf84a47156cb7dfd5da962d4784 (patch)
tree9e8d0f313b250f5da274a70dfb1e452155d21273 /pygments
parent6665e5118c66ed3a0b35a2695209a952dbe6ac7d (diff)
downloadpygments-git-2f78a7bf950cfbf84a47156cb7dfd5da962d4784.tar.gz
Improve whitespace handling in the BashLexer.
Diffstat (limited to 'pygments')
-rw-r--r--pygments/lexers/shell.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/pygments/lexers/shell.py b/pygments/lexers/shell.py
index e25274eb..be268d73 100644
--- a/pygments/lexers/shell.py
+++ b/pygments/lexers/shell.py
@@ -12,7 +12,7 @@ import re
from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, \
include, default, this, using, words, line_re
-from pygments.token import Punctuation, \
+from pygments.token import Punctuation, Whitespace, \
Text, Comment, Operator, Keyword, Name, String, Number, Generic
from pygments.util import shebang_matches
@@ -56,7 +56,7 @@ class BashLexer(RegexLexer):
'basic': [
(r'\b(if|fi|else|while|in|do|done|for|then|return|function|case|'
r'select|continue|until|esac|elif)(\s*)\b',
- bygroups(Keyword, Text)),
+ bygroups(Keyword, Whitespace)),
(r'\b(alias|bg|bind|break|builtin|caller|cd|command|compgen|'
r'complete|declare|dirs|disown|echo|enable|eval|exec|exit|'
r'export|false|fc|fg|getopts|hash|help|history|jobs|kill|let|'
@@ -67,7 +67,7 @@ class BashLexer(RegexLexer):
(r'\A#!.+\n', Comment.Hashbang),
(r'#.*\n', Comment.Single),
(r'\\[\w\W]', String.Escape),
- (r'(\b\w+)(\s*)(\+?=)', bygroups(Name.Variable, Text, Operator)),
+ (r'(\b\w+)(\s*)(\+?=)', bygroups(Name.Variable, Whitespace, Operator)),
(r'[\[\]{}()=]', Operator),
(r'<<<', Operator), # here-string
(r'<<-?\s*(\'?)\\?(\w+)[\w\W]+?\2', String),
@@ -81,7 +81,7 @@ class BashLexer(RegexLexer):
(r';', Punctuation),
(r'&', Punctuation),
(r'\|', Punctuation),
- (r'\s+', Text),
+ (r'\s+', Whitespace),
(r'\d+\b', Number),
(r'[^=\s\[\]{}()$"\'`\\<&|;]+', Text),
(r'<', Text),