class Rouge::Lexers::Python

def self.builtins

def self.builtins
  @builtins ||= Set.new %w(
    __import__ abs aiter all anext any apply ascii
    basestring bin bool buffer breakpoint bytearray bytes
    callable chr classmethod cmp coerce compile complex
    delattr dict dir divmod enumerate eval exec execfile exit
    file filter float format frozenset getattr globals
    hasattr hash help hex
    id input int intern isinstance issubclass iter len list locals long
    map max memoryview min next object oct open ord pow print property
    range raw_input reduce reload repr reversed round set setattr slice
    sorted staticmethod str sum super tuple type unichr unicode vars
    xrange zip
  )
end

def self.builtins_pseudo

def self.builtins_pseudo
  @builtins_pseudo ||= Set.new %w(None Ellipsis NotImplemented False True)
end

def self.detect?(text)

def self.detect?(text)
  return true if text.shebang?(/pythonw?(?:[23](?:\.\d+)?)?/)
end

def self.exceptions

def self.exceptions
  @exceptions ||= Set.new %w(
    ArithmeticError AssertionError AttributeError BaseException
    BaseExceptionGroup BlockingIOError BrokenPipeError BufferError
    BytesWarning ChildProcessError ConnectionAbortedError ConnectionError
    ConnectionRefusedError ConnectionResetError DeprecationWarning
    EOFError EnvironmentError EncodingWarning Exception ExceptionGroup
    FileExistsError FileNotFoundError FloatingPointError FutureWarning
    GeneratorExit IOError ImportError ImportWarning IndentationError
    IndexError InterruptedError IsADirectoryError
    KeyError KeyboardInterrupt LookupError
    MemoryError ModuleNotFoundError
    NameError NotADirectoryError NotImplemented NotImplementedError
    OSError OverflowError OverflowWarning PendingDeprecationWarning
    PermissionError ProcessLookupError PythonFinalizationError
    RecursionError ReferenceError ResourceWarning RuntimeError RuntimeWarning
    StandardError StopAsyncIteration StopIteration SyntaxError SyntaxWarning
    SystemError SystemExit TabError TimeoutError TypeError
    UnboundLocalError UnicodeDecodeError UnicodeEncodeError UnicodeError
    UnicodeTranslateError UnicodeWarning UserWarning ValueError VMSError
    Warning WindowsError
    ZeroDivisionError
  )
end

def self.keywords

def self.keywords
  @keywords ||= Set.new %w(
    assert break continue del elif else except exec
    finally for global if lambda pass print raise
    return try while yield as with from import
    async await nonlocal
  )
end

def current_string

def current_string
  @current_string ||= StringRegister.new
end