Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
MoinMoin.support.pygments.filters.RaiseOnErrorTokenFilter Class Reference
Inheritance diagram for MoinMoin.support.pygments.filters.RaiseOnErrorTokenFilter:
Inheritance graph
[legend]
Collaboration diagram for MoinMoin.support.pygments.filters.RaiseOnErrorTokenFilter:
Collaboration graph
[legend]

List of all members.

Public Member Functions

def __init__
def filter

Public Attributes

 exception

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 __init__.py.


Constructor & Destructor Documentation

Definition at line 191 of file __init__.py.

00191 
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 __init__.py.

00201 
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
00207 


Member Data Documentation

Definition at line 193 of file __init__.py.


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