Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes Class Reference
Inheritance diagram for
Inheritance graph
Collaboration diagram for
Collaboration graph

List of all members.

Public Member Functions

def __init__
def filter

Public Attributes


Detailed Description

Raise an exception when the lexer generates an error token.

Options accepted:

`excclass` : Exception class
  The exception class to raise.
  The default is `pygments.filters.ErrorToken`.

*New in Pygments 0.8.*

Definition at line 178 of file

Constructor & Destructor Documentation

Definition at line 191 of file

00192     def __init__(self, **options):
00193         Filter.__init__(self, **options)
00194         self.exception = options.get('excclass', ErrorToken)
00195         try:
00196             # issubclass() will raise TypeError if first argument is not a class
00197             if not issubclass(self.exception, Exception):
00198                 raise TypeError
00199         except TypeError:
00200             raise OptionError('excclass option is not an exception class')

Member Function Documentation

Definition at line 201 of file

00202     def filter(self, lexer, stream):
00203         for ttype, value in stream:
00204             if ttype is Error:
00205                 raise self.exception(value)
00206             yield ttype, value

Member Data Documentation

Definition at line 193 of file

The documentation for this class was generated from the following file: