class_docstr: For Matlab sessions.  Modeled after PythonConsoleLexer.
  Contributed by Ken Schutte <kschutte@csail.mit.edu>.
  
  .. versionadded:: 0.10
code: def get_tokens_unprocessed(self, text):
      mlexer = MatlabLexer(**self.options)
  
      curcode = ""
      insertions = []
      continuation = False
  
      for match in line_re.finditer(text):
          line = match.group()
  
          if line.startswith(">> "):
              insertions.append(
                  (len(curcode), [(0, Generic.Prompt, line[:3])])
              )
              curcode += line[3:]
  
          elif line.startswith(">>"):
              insertions.append(
                  (len(curcode), [(0, Generic.Prompt, line[:2])])
              )
              curcode += line[2:]
  
          elif line.startswith("???"):
              idx = len(curcode)
  
              # without is showing error on same line as before...?
              # line = "\n" + line
              token = (0, Generic.Traceback, line)
              insertions.append((idx, [token]))
          elif continuation and insertions:
              # line_start is the length of the most recent prompt symbol
              line_start = len(insertions[-1][-1][-1])
              # Set leading spaces with the length of the prompt to be a generic prompt
              # This keeps code aligned when prompts are removed, say with some Javascript
              if line.startswith(" " * line_start):
                  insertions.append(
                      (
                          len(curcode),
                          [(0, Generic.Prompt, line[:line_start])],
                      )
                  )
                  curcode += line[line_start:]
              else:
                  curcode += line
          else:
              if curcode:
                  yield from do_insertions(
                      insertions, mlexer.get_tokens_unprocessed(curcode)
                  )
                  curcode = ""
                  insertions = []
  
              yield match.start(), Generic.Output, line
  
          # Does not allow continuation if a comment is included after the ellipses.
          # Continues any line that ends with ..., even comments (lines that start with %)
          if line.strip().endswith("..."):
              continuation = True
          else:
              continuation = False
  
      if curcode:  # or item:
          yield from do_insertions(
              insertions, mlexer.get_tokens_unprocessed(curcode)
          )
  
file_path: catboost/contrib/python/Pygments/py3/pygments/lexers/matlab.py
imports: import re
  from pygments.lexer import Lexer, RegexLexer, bygroups, default, words, do_insertions, include
  from pygments.token import Text, Comment, Operator, Keyword, Name, String, Number, Punctuation, Generic, Whitespace
  from pygments.lexers import _scilab_builtins
label_desc: Use image node_id 1 for calling the MatlabSessionLexer obj's underlying member method code with example usage: obj.get_tokens_unprocessed(text) without return types