annotate Misc/Vim/syntax_test.py @ 54294:dba767bc3155 legacy-trunk

remove mention of old ctypes version
author Benjamin Peterson <benjamin@python.org>
date Sat, 23 May 2009 20:59:09 +0000
parents 418ad159fe84
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
36652
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
1 """Test file for syntax highlighting of editors.
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
2
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
3 Meant to cover a wide range of different types of statements and expressions.
36659
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
4 Not necessarily sensical or comprehensive (assume that if one exception is
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
5 highlighted that all are, for instance).
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
6
45042
418ad159fe84 Update Vim syntax highlighting to specify what revision was used to generate
Brett Cannon <bcannon@gmail.com>
parents: 38084
diff changeset
7 Extraneous trailing whitespace can't be tested because of svn pre-commit hook
418ad159fe84 Update Vim syntax highlighting to specify what revision was used to generate
Brett Cannon <bcannon@gmail.com>
parents: 38084
diff changeset
8 checks for such things.
36652
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
9
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
10 """
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
11 # Comment
36659
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
12 # OPTIONAL: XXX catch your attention
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
13
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
14 # Statements
36771
f8ffa7cbf960 Update for 'with' statement.
Brett Cannon <bcannon@gmail.com>
parents: 36659
diff changeset
15 from __future__ import with_statement # Import
f8ffa7cbf960 Update for 'with' statement.
Brett Cannon <bcannon@gmail.com>
parents: 36659
diff changeset
16 from sys import path as thing
36659
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
17 assert True # keyword
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
18 def foo(): # function definition
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
19 return []
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
20 class Bar(object): # Class definition
36771
f8ffa7cbf960 Update for 'with' statement.
Brett Cannon <bcannon@gmail.com>
parents: 36659
diff changeset
21 def __enter__(self):
f8ffa7cbf960 Update for 'with' statement.
Brett Cannon <bcannon@gmail.com>
parents: 36659
diff changeset
22 pass
f8ffa7cbf960 Update for 'with' statement.
Brett Cannon <bcannon@gmail.com>
parents: 36659
diff changeset
23 def __exit__(self, *args):
f8ffa7cbf960 Update for 'with' statement.
Brett Cannon <bcannon@gmail.com>
parents: 36659
diff changeset
24 pass
36659
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
25 foo() # UNCOLOURED: function call
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
26 while False: # 'while'
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
27 continue
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
28 for x in foo(): # 'for'
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
29 break
36771
f8ffa7cbf960 Update for 'with' statement.
Brett Cannon <bcannon@gmail.com>
parents: 36659
diff changeset
30 with Bar() as stuff:
f8ffa7cbf960 Update for 'with' statement.
Brett Cannon <bcannon@gmail.com>
parents: 36659
diff changeset
31 pass
36659
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
32 if False: pass # 'if'
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
33 elif False: pass
36771
f8ffa7cbf960 Update for 'with' statement.
Brett Cannon <bcannon@gmail.com>
parents: 36659
diff changeset
34 else: pass
36659
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
35
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
36 # Constants
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
37 'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted
36652
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
38 "double-quote"
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
39 """triple double-quote"""
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
40 '''triple single-quote'''
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
41 r'raw'
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
42 ur'unicode raw'
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
43 'escape\n'
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
44 '\04' # octal
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
45 '\xFF' # hex
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
46 '\u1111' # unicode character
36659
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
47 1 # Integral
36652
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
48 1L
36659
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
49 1.0 # Float
36652
8db985b4086e Add a script that auto-generates a Vim syntax highlighting file for Python.
Brett Cannon <bcannon@gmail.com>
parents:
diff changeset
50 .1
36659
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
51 1+2j # Complex
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
52
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
53 # Expressions
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
54 1 and 2 or 3 # Boolean operators
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
55 2 < 3 # UNCOLOURED: comparison operators
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
56 spam = 42 # UNCOLOURED: assignment
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
57 2 + 3 # UNCOLOURED: number operators
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
58 [] # UNCOLOURED: list
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
59 {} # UNCOLOURED: dict
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
60 (1,) # UNCOLOURED: tuple
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
61 all # Built-in functions
bb48115e6dab Remove line meant to test trailing whitespace since that kind of whitespace is
Brett Cannon <bcannon@gmail.com>
parents: 36658
diff changeset
62 GeneratorExit # Exceptions