Package web2py :: Package gluon :: Module highlight :: Class Highlighter |
[hide private]
[frames] | no frames]

# Class Highlighter

source code

    object --+
             |
            Highlighter

Do syntax highlighting.

Instance Methods | [hide private]
__init__(self, mode, link=1, styles=`{``}`) Initialise highlighter:... | source code
c_tokenizer(self, token, match, style) Callback for C specific highlighting. | source code
python_tokenizer(self, token, match, style) Callback for python specific highlighting. | source code
html_tokenizer(self, token, match, style) Callback for HTML specific highlighting. | source code
highlight(self, data) Syntax highlight some python code. | source code
change_style(self, token, style) Generate output to change from existing style to another style only. | source code
Inherited from `object`: `__delattr__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__str__`

Class Variables | [hide private]
| all_styles = ``{``'``C``'``:` `(`<function c_tokenizer at 0xaf97d0>`,` `(``(``'``COM``...``

Properties | [hide private]
Inherited from `object`: `__class__`

Method Details | [hide private]

### __init__(self, mode, link=1, styles=`{``}`) (Constructor) | source code
    Initialise highlighter:
        mode = language (PYTHON, WEB2PY,C, CPP, HTML, HTML_PLAIN)
Overrides: object.__init__

### highlight(self, data) | source code
Syntax highlight some python code. Returns html version of code.

Class Variable Details | [hide private]

  ### all_styles Value:
      {'C': (<function c_tokenizer at 0xaf97d0>,
             (('COMMENT',
               re.compile(r'//.*\r?\n'),
               'color: green; font-style: italic'),
              ('MULTILINECOMMENT',
               re.compile(r'(?s)/\*.*?\*/'),
               'color: green; font-style: italic'),
              ('PREPROCESSOR', re.compile(r'(?s)\s*#.*?[^\\]\s*\n'), 'color:
      ...