Back to index

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

List of all members.

Public Member Functions

def __init__
def is_in
def get_tokens_unprocessed

Static Public Attributes

string name = 'VimL'
list aliases = ['vim']
list filenames = ['*.vim', '.vimrc']
list mimetypes = ['text/x-vim']
 flags = re.MULTILINE
dictionary tokens

Private Attributes


Detailed Description

Lexer for VimL script files.

*New in Pygments 0.8.*

Definition at line 727 of file

Constructor & Destructor Documentation

Definition at line 761 of file

00762     def __init__(self, **options):
00763         from pygments.lexers._vimbuiltins import command, option, auto
00764         self._cmd = command
00765         self._opt = option
00766         self._aut = auto
00768         RegexLexer.__init__(self, **options)

Member Function Documentation

Definition at line 791 of file

00792     def get_tokens_unprocessed(self, text):
00793         # TODO: builtins are only subsequent tokens on lines
00794         #       and 'keywords' only happen at the beginning except
00795         #       for :au ones
00796         for index, token, value in \
00797             RegexLexer.get_tokens_unprocessed(self, text):
00798             if token is Name.Other:
00799                 if self.is_in(value, self._cmd):
00800                     yield index, Keyword, value
00801                 elif self.is_in(value, self._opt) or \
00802                      self.is_in(value, self._aut):
00803                     yield index, Name.Builtin, value
00804                 else:
00805                     yield index, Text, value
00806             else:
00807                 yield index, token, value

Here is the call graph for this function:

Here is the caller graph for this function:

def (   self,

Definition at line 769 of file

00770     def is_in(self, w, mapping):
00771         r"""
00772         It's kind of difficult to decide if something might be a keyword
00773         in VimL because it allows you to abbreviate them.  In fact,
00774         'ab[breviate]' is a good example.  :ab, :abbre, or :abbreviate are
00775         valid ways to call it so rather than making really awful regexps
00776         like::
00778             \bab(?:b(?:r(?:e(?:v(?:i(?:a(?:t(?:e)?)?)?)?)?)?)?)?\b
00780         we match `\b\w+\b` and then call is_in() on those tokens.  See
00781         `scripts/` for how the lists are extracted.
00782         """
00783         p = bisect(mapping, (w,))
00784         if p > 0:
00785             if mapping[p-1][0] == w[:len(mapping[p-1][0])] and \
00786                mapping[p-1][1][:len(w)] == w: return True
00787         if p < len(mapping):
00788             return mapping[p][0] == w[:len(mapping[p][0])] and \
00789                    mapping[p][1][:len(w)] == w
00790         return False

Here is the caller graph for this function:

Member Data Documentation

Definition at line 765 of file

Definition at line 763 of file

Definition at line 764 of file

Definition at line 734 of file

list = ['*.vim', '.vimrc'] [static]

Definition at line 735 of file

Definition at line 737 of file

Definition at line 736 of file

Definition at line 733 of file

Initial value:
        'root': [
            # Who decided that doublequote was a good comment character??
            (r'^\s*".*', Comment),            (r'(?<=\s)"[^\-:.%#=*].*', Comment),

            (r'[ \t]+', Text),
            # TODO: regexes can have other delims
            (r'/(\\\\|\\/|[^\n/])*/', String.Regex),
            (r'"(\\\\|\\"|[^\n"])*"', String.Double),
            (r"'(\\\\|\\'|[^\n'])*'", String.Single),
            (r'-?\d+', Number),
            (r'#[0-9a-f]{6}', Number.Hex),
            (r'^:', Punctuation),
            (r'[()<>+=!|,~-]', Punctuation), # Inexact list.  Looks decent.
            (r'\b(NONE|bold|italic|underline|dark|light)\b', Name.Builtin),
            (r'\b\w+\b', Name.Other), # These are postprocessed below
            (r'.', Text),

Definition at line 739 of file

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