cpython/Misc/Vim/syntax_test.py

63 lines
1.4 KiB
Python
Raw Normal View History

"""Test file for syntax highlighting of editors.
Meant to cover a wide range of different types of statements and expressions.
Not necessarily sensical or comprehensive (assume that if one exception is
highlighted that all are, for instance).
Merged revisions 60383-60407 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r60388 | thomas.heller | 2008-01-28 09:44:13 +0100 (Mon, 28 Jan 2008) | 1 line Revert rev. 59925, it breaks comtypes (I need to further examine this). ........ r60397 | raymond.hettinger | 2008-01-28 21:34:33 +0100 (Mon, 28 Jan 2008) | 5 lines Make PySet_Add() work with frozensets. Works like PyTuple_SetItem() to build-up values in a brand new frozenset. Also, PyFrozenSet_New() is now guaranteed to produce a distinct new frozenset. ........ r60398 | raymond.hettinger | 2008-01-28 22:34:30 +0100 (Mon, 28 Jan 2008) | 1 line Let marshal built-up sets and frozensets one element at a time (without creating an intermediate tuple). ........ r60399 | raymond.hettinger | 2008-01-28 22:47:42 +0100 (Mon, 28 Jan 2008) | 1 line Factor-out common code with a new macro ........ r60400 | raymond.hettinger | 2008-01-28 22:48:07 +0100 (Mon, 28 Jan 2008) | 1 line Factor-out common code with a new macro ........ r60401 | raymond.hettinger | 2008-01-28 22:51:25 +0100 (Mon, 28 Jan 2008) | 1 line Removed unnecessary conditional (spotted by Neal Norwitz). ........ r60403 | gregory.p.smith | 2008-01-29 00:21:00 +0100 (Tue, 29 Jan 2008) | 4 lines Disable use of BerkeleyDB 4.6.x to see what the odd platform buildbots think. In particular, neal norwitz has traced an Ubuntu sparc64 crash to the Lib/test/bsddb/test_basics.py test when opening a db with DB_THREAD. ........ r60405 | brett.cannon | 2008-01-29 05:13:07 +0100 (Tue, 29 Jan 2008) | 2 lines Fix the reindent rule to use $(BUILDPYTHON). ........ r60406 | brett.cannon | 2008-01-29 05:18:04 +0100 (Tue, 29 Jan 2008) | 3 lines Update Vim syntax highlighting to specify what revision was used to generate the file. ........ r60407 | brett.cannon | 2008-01-29 05:20:56 +0100 (Tue, 29 Jan 2008) | 2 lines Ignore .pyc and .pyo files. ........
2008-01-29 08:18:50 -04:00
Extraneous trailing whitespace can't be tested because of svn pre-commit hook
checks for such things.
"""
# Comment
# OPTIONAL: XXX catch your attention
# Statements
2006-03-01 16:53:08 -04:00
from __future__ import with_statement # Import
from sys import path as thing
assert True # keyword
def foo(): # function definition
return []
class Bar(object): # Class definition
2006-03-01 16:53:08 -04:00
def __enter__(self):
pass
def __exit__(self, *args):
pass
foo() # UNCOLOURED: function call
while False: # 'while'
continue
for x in foo(): # 'for'
break
2006-03-01 16:53:08 -04:00
with Bar() as stuff:
pass
if False: pass # 'if'
elif False: pass
2006-03-01 16:53:08 -04:00
else: pass
# Constants
'single-quote', u'unicode' # Strings of all kinds; prefixes not highlighted
"double-quote"
"""triple double-quote"""
'''triple single-quote'''
r'raw'
ur'unicode raw'
'escape\n'
'\04' # octal
'\xFF' # hex
'\u1111' # unicode character
1 # Integral
1L
1.0 # Float
.1
1+2j # Complex
# Expressions
1 and 2 or 3 # Boolean operators
2 < 3 # UNCOLOURED: comparison operators
spam = 42 # UNCOLOURED: assignment
2 + 3 # UNCOLOURED: number operators
[] # UNCOLOURED: list
{} # UNCOLOURED: dict
(1,) # UNCOLOURED: tuple
all # Built-in functions
GeneratorExit # Exceptions