summaryrefslogtreecommitdiffstats
path: root/contrib/python/Pygments/py2/pygments/lexers/shell.py
diff options
context:
space:
mode:
authorshadchin <[email protected]>2022-02-10 16:44:39 +0300
committerDaniil Cherednik <[email protected]>2022-02-10 16:44:39 +0300
commite9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (patch)
tree64175d5cadab313b3e7039ebaa06c5bc3295e274 /contrib/python/Pygments/py2/pygments/lexers/shell.py
parent2598ef1d0aee359b4b6d5fdd1758916d5907d04f (diff)
Restoring authorship annotation for <[email protected]>. Commit 2 of 2.
Diffstat (limited to 'contrib/python/Pygments/py2/pygments/lexers/shell.py')
-rw-r--r--contrib/python/Pygments/py2/pygments/lexers/shell.py46
1 files changed, 23 insertions, 23 deletions
diff --git a/contrib/python/Pygments/py2/pygments/lexers/shell.py b/contrib/python/Pygments/py2/pygments/lexers/shell.py
index c64f151dd40..c12cb3f137f 100644
--- a/contrib/python/Pygments/py2/pygments/lexers/shell.py
+++ b/contrib/python/Pygments/py2/pygments/lexers/shell.py
@@ -154,9 +154,9 @@ class ShellSessionBaseLexer(Lexer):
.. versionadded:: 2.1
"""
-
- _venv = re.compile(r'^(\([^)]*\))(\s*)')
-
+
+ _venv = re.compile(r'^(\([^)]*\))(\s*)')
+
def get_tokens_unprocessed(self, text):
innerlexer = self._innerLexerCls(**self.options)
@@ -170,21 +170,21 @@ class ShellSessionBaseLexer(Lexer):
if backslash_continuation:
curcode += line
backslash_continuation = curcode.endswith('\\\n')
- continue
-
- venv_match = self._venv.match(line)
- if venv_match:
- venv = venv_match.group(1)
- venv_whitespace = venv_match.group(2)
- insertions.append((len(curcode),
- [(0, Generic.Prompt.VirtualEnv, venv)]))
- if venv_whitespace:
- insertions.append((len(curcode),
- [(0, Text, venv_whitespace)]))
- line = line[venv_match.end():]
-
- m = self._ps1rgx.match(line)
- if m:
+ continue
+
+ venv_match = self._venv.match(line)
+ if venv_match:
+ venv = venv_match.group(1)
+ venv_whitespace = venv_match.group(2)
+ insertions.append((len(curcode),
+ [(0, Generic.Prompt.VirtualEnv, venv)]))
+ if venv_whitespace:
+ insertions.append((len(curcode),
+ [(0, Text, venv_whitespace)]))
+ line = line[venv_match.end():]
+
+ m = self._ps1rgx.match(line)
+ if m:
# To support output lexers (say diff output), the output
# needs to be broken by prompts whenever the output lexer
# changes.
@@ -227,9 +227,9 @@ class BashSessionLexer(ShellSessionBaseLexer):
mimetypes = ['application/x-shell-session', 'application/x-sh-session']
_innerLexerCls = BashLexer
- _ps1rgx = re.compile(
+ _ps1rgx = re.compile(
r'^((?:(?:\[.*?\])|(?:\(\S+\))?(?:| |sh\S*?|\w+\S+[@:]\S+(?:\s+\S+)' \
- r'?|\[\S+[@:][^\n]+\].+))\s*[$#%])(.*\n?)')
+ r'?|\[\S+[@:][^\n]+\].+))\s*[$#%])(.*\n?)')
_ps2 = '>'
@@ -556,7 +556,7 @@ class MSDOSSessionLexer(ShellSessionBaseLexer):
mimetypes = []
_innerLexerCls = BatchLexer
- _ps1rgx = re.compile(r'^([^>]*>)(.*\n?)')
+ _ps1rgx = re.compile(r'^([^>]*>)(.*\n?)')
_ps2 = 'More? '
@@ -641,7 +641,7 @@ class TcshSessionLexer(ShellSessionBaseLexer):
mimetypes = []
_innerLexerCls = TcshLexer
- _ps1rgx = re.compile(r'^([^>]+>)(.*\n?)')
+ _ps1rgx = re.compile(r'^([^>]+>)(.*\n?)')
_ps2 = '? '
@@ -772,7 +772,7 @@ class PowerShellSessionLexer(ShellSessionBaseLexer):
mimetypes = []
_innerLexerCls = PowerShellLexer
- _ps1rgx = re.compile(r'^(PS [^>]+> )(.*\n?)')
+ _ps1rgx = re.compile(r'^(PS [^>]+> )(.*\n?)')
_ps2 = '>> '