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

Highlight a normal Name token with a different token type.


    filter = NameHighlightFilter(
        names=['foo', 'bar', 'baz'],

This would highlight the names "foo", "bar" and "baz"
as functions. `Name.Function` is the default token type.

Options accepted:

`names` : list of strings
  A list of names that should be given the different token type.
  There is no default.
`tokentype` : TokenType or string
  A token type or a string containing a token type name that is
  used for highlighting the strings in `names`.  The default is

Definition at line 133 of file

Constructor & Destructor Documentation

Definition at line 158 of file

00159     def __init__(self, **options):
00160         Filter.__init__(self, **options)
00161         self.names = set(get_list_opt(options, 'names', []))
00162         tokentype = options.get('tokentype')
00163         if tokentype:
00164             self.tokentype = string_to_tokentype(tokentype)
00165         else:
00166             self.tokentype = Name.Function

Member Function Documentation

def (   self,

Definition at line 167 of file

00168     def filter(self, lexer, stream):
00169         for ttype, value in stream:
00170             if ttype is Name and value in self.names:
00171                 yield self.tokentype, value
00172             else:
00173                 yield ttype, value

Member Data Documentation

Definition at line 160 of file

Definition at line 163 of file

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