class_docstr: Base lexer for shell sessions.
  
  .. versionadded:: 2.1
code: def get_tokens_unprocessed(self, text):
      innerlexer = self._innerLexerCls(**self.options)
  
      pos = 0
      curcode = ""
      insertions = []
      backslash_continuation = False
  
      for match in line_re.finditer(text):
          line = match.group()
  
          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.
              if not insertions:
                  pos = match.start()
  
              insertions.append(
                  (len(curcode), [(0, Generic.Prompt, m.group(1))])
              )
              curcode += m.group(2)
              backslash_continuation = curcode.endswith("\\\n")
          elif backslash_continuation:
              if line.startswith(self._ps2):
                  insertions.append(
                      (
                          len(curcode),
                          [(0, Generic.Prompt, line[: len(self._ps2)])],
                      )
                  )
                  curcode += line[len(self._ps2) :]
              else:
                  curcode += line
              backslash_continuation = curcode.endswith("\\\n")
          elif self._bare_continuation and line.startswith(self._ps2):
              insertions.append(
                  (
                      len(curcode),
                      [(0, Generic.Prompt, line[: len(self._ps2)])],
                  )
              )
              curcode += line[len(self._ps2) :]
          else:
              if insertions:
                  toks = innerlexer.get_tokens_unprocessed(curcode)
                  for i, t, v in do_insertions(insertions, toks):
                      yield pos + i, t, v
              yield match.start(), Generic.Output, line
              insertions = []
              curcode = ""
      if insertions:
          for i, t, v in do_insertions(
              insertions, innerlexer.get_tokens_unprocessed(curcode)
          ):
              yield pos + i, t, v
  
imports: import re
  from pygments.lexer import Lexer, RegexLexer, do_insertions, bygroups, include, default, this, using, words, line_re
  from pygments.token import Punctuation, Whitespace, Text, Comment, Operator, Keyword, Name, String, Number, Generic
  from pygments.util import shebang_matches
label_desc: Use image node_id 1 for calling the ShellSessionBaseLexer obj's underlying member method code with example usage: obj.get_tokens_unprocessed(text) without return types