PageRenderTime 18ms CodeModel.GetById 10ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 1ms

/Misc/Vim/syntax_test.py

http://unladen-swallow.googlecode.com/
Python | 62 lines | 39 code | 1 blank | 22 comment | 1 complexity | c44314f8e9c9f8c3f30dc2be7720fe2f MD5 | raw file
 1"""Test file for syntax highlighting of editors.
 2
 3Meant to cover a wide range of different types of statements and expressions.
 4Not necessarily sensical or comprehensive (assume that if one exception is
 5highlighted that all are, for instance).
 6
 7Extraneous trailing whitespace can't be tested because of svn pre-commit hook
 8checks for such things.
 9
10"""
11# Comment
12# OPTIONAL: XXX catch your attention
13
14# Statements
15from __future__ import with_statement  # Import
16from sys import path as thing
17assert True # keyword
18def foo():  # function definition
19    return []
20class Bar(object):  # Class definition
21    def __enter__(self):
22        pass
23    def __exit__(self, *args):
24        pass
25foo()  # UNCOLOURED: function call
26while False:  # 'while'
27    continue
28for x in foo():  # 'for'
29    break
30with Bar() as stuff:
31    pass
32if False: pass  # 'if'
33elif False: pass
34else: pass
35
36# Constants
37'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted
38"double-quote"
39"""triple double-quote"""
40'''triple single-quote'''
41r'raw'
42ur'unicode raw'
43'escape\n'
44'\04'  # octal
45'\xFF' # hex
46'\u1111' # unicode character
471  # Integral
481L
491.0  # Float
50.1
511+2j  # Complex
52
53# Expressions
541 and 2 or 3  # Boolean operators
552 < 3  # UNCOLOURED: comparison operators
56spam = 42  # UNCOLOURED: assignment
572 + 3  # UNCOLOURED: number operators
58[]  # UNCOLOURED: list
59{}  # UNCOLOURED: dict
60(1,)  # UNCOLOURED: tuple
61all  # Built-in functions
62GeneratorExit  # Exceptions