class Rouge::Lexers::Python

Public Class Methods

builtins() click to toggle source
# File lib/rouge/lexers/python.rb, line 27
def self.builtins
  @builtins ||= %w(
    __import__ abs all any apply ascii basestring bin bool buffer
    bytearray bytes callable chr classmethod cmp coerce compile
    complex delattr dict dir divmod enumerate eval execfile exit
    file filter float format frozenset getattr globals hasattr hash hex id
    input int intern isinstance issubclass iter len list locals
    long map max memoryview min next object oct open ord pow 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
builtins_pseudo() click to toggle source
# File lib/rouge/lexers/python.rb, line 41
def self.builtins_pseudo
  @builtins_pseudo ||= %w(self None Ellipsis NotImplemented False True)
end
detect?(text) click to toggle source
# File lib/rouge/lexers/python.rb, line 14
def self.detect?(text)
  return true if text.shebang?(/pythonw?(?:[23](?:\.\d+)?)?/)
end
exceptions() click to toggle source
# File lib/rouge/lexers/python.rb, line 45
def self.exceptions
  @exceptions ||= %w(
    ArithmeticError AssertionError AttributeError
    BaseException BlockingIOError BrokenPipeError BufferError
    BytesWarning ChildProcessError ConnectionAbortedError
    ConnectionError ConnectionRefusedError ConnectionResetError
    DeprecationWarning EOFError EnvironmentError
    Exception 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
    ProcessLookupError 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
keywords() click to toggle source
# File lib/rouge/lexers/python.rb, line 18
def self.keywords
  @keywords ||= %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 yield
    async await nonlocal
  )
end

Public Instance Methods

current_string() click to toggle source
# File lib/rouge/lexers/python.rb, line 72
def current_string
  @string_register ||= StringRegister.new
end