source: vendor/python/2.5/Misc/Vim/vim_syntax.py

Last change on this file was 3225, checked in by bird, 19 years ago

Python 2.5

File size: 8.7 KB
Line 
1from __future__ import with_statement
2
3import keyword
4import exceptions
5import __builtin__
6from string import Template
7
8comment_header = """" Auto-generated Vim syntax file for Python
9"
10" To use: copy or symlink to ~/.vim/syntax/python.vim"""
11
12statement_header = """
13if exists("b:current_syntax")
14 finish
15endif"""
16
17statement_footer = '''
18" Uncomment the 'minlines' statement line and comment out the 'maxlines'
19" statement line; changes behaviour to look at least 2000 lines previously for
20" syntax matches instead of at most 200 lines
21syn sync match pythonSync grouphere NONE "):$"
22syn sync maxlines=200
23"syn sync minlines=2000
24
25let b:current_syntax = "python"'''
26
27looping = ('for', 'while')
28conditionals = ('if', 'elif', 'else')
29boolean_ops = ('and', 'in', 'is', 'not', 'or')
30import_stmts = ('import', 'from')
31object_defs = ('def', 'class')
32
33exception_names = frozenset(exc for exc in dir(exceptions)
34 if not exc.startswith('__'))
35
36# Need to include functions that start with '__' (e.g., __import__), but
37# nothing that comes with modules (e.g., __name__), so just exclude anything in
38# the 'exceptions' module since we want to ignore exceptions *and* what any
39# module would have
40builtin_names = frozenset(builtin for builtin in dir(__builtin__)
41 if builtin not in dir(exceptions))
42
43escapes = (r'+\\[abfnrtv\'"\\]+', r'"\\\o\{1,3}"', r'"\\x\x\{2}"',
44 r'"\(\\u\x\{4}\|\\U\x\{8}\)"', r'"\\$"')
45
46todos = ("TODO", "FIXME", "XXX")
47