class_docstr: Base class for lexers of literate file formats based on LaTeX or Bird-style
  (prefixing each code line with ">").
  
  Additional options accepted:
  
  `litstyle`
      If given, must be ``"bird"`` or ``"latex"``.  If not given, the style
      is autodetected: if the first non-whitespace character in the source
      is a backslash or percent character, LaTeX is assumed, else Bird.
class_docstr_tok: ["Base","class","for","lexers","of","literate","file","formats","based","on","LaTeX","or","Bird-style","(","prefixing","each","code","line","with","``",">","''",")",".","Additional","options","accepted",":","`","litstyle","`","If","given",",","must","be","``","``","bird","''","``","or","``","``","latex","''","``",".","If","not","given",",","the","style","is","autodetected",":","if","the","first","non-whitespace","character","in","the","source","is","a","backslash","or","percent","character",",","LaTeX","is","assumed",",","else","Bird","."]
code: def get_tokens_unprocessed(self, text):
      style = self.options.get("litstyle")
      if style is None:
          style = (text.lstrip()[0:1] in "%\\") and "latex" or "bird"
  
      code = ""
      insertions = []
      if style == "bird":
          # bird-style
          for match in line_re.finditer(text):
              line = match.group()
              m = self.bird_re.match(line)
              if m:
                  insertions.append(
                      (len(code), [(0, Comment.Special, m.group(1))])
                  )
                  code += m.group(2)
              else:
                  insertions.append((len(code), [(0, Text, line)]))
      else:
          # latex-style
          from pygments.lexers.markup import TexLexer
  
          lxlexer = TexLexer(**self.options)
          codelines = 0
          latex = ""
          for match in line_re.finditer(text):
              line = match.group()
              if codelines:
                  if line.lstrip().startswith("\\end{code}"):
                      codelines = 0
                      latex += line
                  else:
                      code += line
              elif line.lstrip().startswith("\\begin{code}"):
                  codelines = 1
                  latex += line
                  insertions.append(
                      (
                          len(code),
                          list(lxlexer.get_tokens_unprocessed(latex)),
                      )
                  )
                  latex = ""
              else:
                  latex += line
          insertions.append(
              (len(code), list(lxlexer.get_tokens_unprocessed(latex)))
          )
      for item in do_insertions(
          insertions, self.baselexer.get_tokens_unprocessed(code)
      ):
          yield item
  
imports: import re
  from pygments.lexer import Lexer, RegexLexer, bygroups, do_insertions, default, include
  from pygments.token import Text, Comment, Operator, Keyword, Name, String, Number, Punctuation, Generic
  from pygments import unistring
label_desc: Use image node_id 2 for calling the LiterateLexer obj's underlying member method code with example usage: obj.get_tokens_unprocessed(text) without return types