class_docstr: Lexer for Typographic Number Theory, as described in the book
  Gödel, Escher, Bach, by Douglas R. Hofstadter
  
  .. versionadded:: 2.7
class_docstr_tok: ["Lexer","for","Typographic","Number","Theory",",","as","described","in","the","book","G\u00f6del",",","Escher",",","Bach",",","by","Douglas","R.","Hofstadter","..","versionadded",":",":","2.7"]
docstr: Tokenize a rule.
docstr_tok: ["Tokenize","a","rule","."]
code: def rule(self, start, text):
      """Tokenize a rule."""
      match = self.RULES.match(text, start)
      if match is None:
          raise AssertionError
      groups = sorted(match.regs[1:])  # exclude whole match
      for group in groups:
          if group[0] >= 0:  # this group matched
              self.cur.append((start, Keyword, text[start : group[0]]))
              self.cur.append(
                  (group[0], Number.Integer, text[group[0] : group[1]])
              )
              if group[1] != match.end():
                  self.cur.append(
                      (group[1], Keyword, text[group[1] : match.end()])
                  )
              break
      else:
          self.cur.append((start, Keyword, text[start : match.end()]))
      return match.end()
  
file_path: catboost/contrib/python/Pygments/py3/pygments/lexers/tnt.py
imports: import re
  from pygments.lexer import Lexer
  from pygments.token import Text, Comment, Operator, Keyword, Name, Number, Punctuation, Error
label_desc: Use image node_id 6 for calling the TNTLexer obj's underlying member method code with example usage: obj.rule(start, text) and returns: match