about summary refs log tree commit diff
path: root/vim/.vim/syntax
diff options
context:
space:
mode:
Diffstat (limited to 'vim/.vim/syntax')
-rw-r--r--vim/.vim/syntax/pascal.vim373
-rw-r--r--vim/.vim/syntax/python.vim327
2 files changed, 700 insertions, 0 deletions
diff --git a/vim/.vim/syntax/pascal.vim b/vim/.vim/syntax/pascal.vim
new file mode 100644
index 0000000..d2b6060
--- /dev/null
+++ b/vim/.vim/syntax/pascal.vim
@@ -0,0 +1,373 @@
+" Vim syntax file
+" Language:	Pascal
+" Version: 2.8
+" Last Change:	2004/10/17 17:47:30
+" Maintainer:  Xavier Crégut <xavier.cregut@enseeiht.fr>
+" Previous Maintainer:	Mario Eusebio <bio@dq.fct.unl.pt>
+
+" Contributors: Tim Chase <tchase@csc.com>,
+"	Stas Grabois <stsi@vtrails.com>,
+"	Mazen NEIFER <mazen.neifer.2001@supaero.fr>,
+"	Klaus Hast <Klaus.Hast@arcor.net>,
+"	Austin Ziegler <austin@halostatue.ca>,
+"	Markus Koenig <markus@stber-koenig.de>
+
+" For version 5.x: Clear all syntax items
+" For version 6.x: Quit when a syntax file was already loaded
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+
+syn case ignore
+syn sync lines=250
+
+syn keyword pascalBoolean	true false
+syn keyword pascalConditional	if else then
+syn keyword pascalConstant	nil maxint
+syn keyword pascalLabel		case goto label
+syn keyword pascalOperator	and div downto in mod not of or packed with
+syn keyword pascalRepeat	do for do repeat while to until
+syn keyword pascalStatement	procedure function
+syn keyword pascalStatement	program begin end const var type
+syn keyword pascalStruct	record
+syn keyword pascalType		array boolean char integer file pointer real set
+syn keyword pascalType		string text variant
+
+
+    " 20011222az: Added new items.
+syn keyword pascalTodo contained	TODO FIXME XXX DEBUG NOTE
+
+    " 20010723az: When wanted, highlight the trailing whitespace -- this is
+    " based on c_space_errors; to enable, use "pascal_space_errors".
+if exists("pascal_space_errors")
+    if !exists("pascal_no_trail_space_error")
+        syn match pascalSpaceError "\s\+$"
+    endif
+    if !exists("pascal_no_tab_space_error")
+        syn match pascalSpaceError " \+\t"me=e-1
+    endif
+endif
+
+
+
+" String
+if !exists("pascal_one_line_string")
+  syn region  pascalString matchgroup=pascalString start=+'+ end=+'+ contains=pascalStringEscape
+  if exists("pascal_gpc")
+    syn region  pascalString matchgroup=pascalString start=+"+ end=+"+ contains=pascalStringEscapeGPC
+  else
+    syn region  pascalStringError matchgroup=pascalStringError start=+"+ end=+"+ contains=pascalStringEscape
+  endif
+else
+  "wrong strings
+  syn region  pascalStringError matchgroup=pascalStringError start=+'+ end=+'+ end=+$+ contains=pascalStringEscape
+  if exists("pascal_gpc")
+    syn region  pascalStringError matchgroup=pascalStringError start=+"+ end=+"+ end=+$+ contains=pascalStringEscapeGPC
+  else
+    syn region  pascalStringError matchgroup=pascalStringError start=+"+ end=+"+ end=+$+ contains=pascalStringEscape
+  endif
+
+  "right strings
+  syn region  pascalString matchgroup=pascalString start=+'+ end=+'+ oneline contains=pascalStringEscape
+  " To see the start and end of strings:
+  " syn region  pascalString matchgroup=pascalStringError start=+'+ end=+'+ oneline contains=pascalStringEscape
+  if exists("pascal_gpc")
+    syn region  pascalString matchgroup=pascalString start=+"+ end=+"+ oneline contains=pascalStringEscapeGPC
+  else
+    syn region  pascalStringError matchgroup=pascalStringError start=+"+ end=+"+ oneline contains=pascalStringEscape
+  endif
+end
+syn match   pascalStringEscape		contained "''"
+syn match   pascalStringEscapeGPC	contained '""'
+
+
+" syn match   pascalIdentifier		"\<[a-zA-Z_][a-zA-Z0-9_]*\>"
+
+
+if exists("pascal_symbol_operator")
+  syn match   pascalSymbolOperator      "[+\-/*=]"
+  syn match   pascalSymbolOperator      "[<>]=\="
+  syn match   pascalSymbolOperator      "<>"
+  syn match   pascalSymbolOperator      ":="
+  syn match   pascalSymbolOperator      "[()]"
+  syn match   pascalSymbolOperator      "\.\."
+  syn match   pascalSymbolOperator       "[\^.]"
+  syn match   pascalMatrixDelimiter	"[][]"
+  "if you prefer you can highlight the range
+  "syn match  pascalMatrixDelimiter	"[\d\+\.\.\d\+]"
+endif
+
+syn match  pascalNumber		"-\=\<\d\+\>"
+syn match  pascalFloat		"-\=\<\d\+\.\d\+\>"
+syn match  pascalFloat		"-\=\<\d\+\.\d\+[eE]-\=\d\+\>"
+syn match  pascalHexNumber	"\$[0-9a-fA-F]\+\>"
+
+if exists("pascal_no_tabs")
+  syn match pascalShowTab "\t"
+endif
+
+syn region pascalComment	start="(\*\|{"  end="\*)\|}" contains=pascalTodo,pascalSpaceError
+
+
+if !exists("pascal_no_functions")
+  " array functions
+  syn keyword pascalFunction	pack unpack
+
+  " memory function
+  syn keyword pascalFunction	Dispose New
+
+  " math functions
+  syn keyword pascalFunction	Abs Arctan Cos Exp Ln Sin Sqr Sqrt
+
+  " file functions
+  syn keyword pascalFunction	Eof Eoln Write Writeln
+  syn keyword pascalPredefined	Input Output
+
+  if exists("pascal_traditional")
+    " These functions do not seem to be defined in Turbo Pascal
+    syn keyword pascalFunction	Get Page Put 
+  endif
+
+  " ordinal functions
+  syn keyword pascalFunction	Odd Pred Succ
+
+  " transfert functions
+  syn keyword pascalFunction	Chr Ord Round Trunc
+endif
+
+
+if !exists("pascal_traditional")
+
+  syn keyword pascalStatement	constructor destructor implementation inherited
+  syn keyword pascalStatement	interface unit uses
+  syn keyword pascalModifier	absolute assembler external far forward inline
+  syn keyword pascalModifier	interrupt near virtual 
+  syn keyword pascalAcces	private public 
+  syn keyword pascalStruct	object 
+  syn keyword pascalOperator	shl shr xor
+
+  syn region pascalPreProc	start="(\*\$"  end="\*)" contains=pascalTodo
+  syn region pascalPreProc	start="{\$"  end="}"
+
+  syn region  pascalAsm		matchgroup=pascalAsmKey start="\<asm\>" end="\<end\>" contains=pascalComment,pascalPreProc
+
+  syn keyword pascalType	ShortInt LongInt Byte Word
+  syn keyword pascalType	ByteBool WordBool LongBool
+  syn keyword pascalType	Cardinal LongWord
+  syn keyword pascalType	Single Double Extended Comp
+  syn keyword pascalType	PChar
+
+
+  if !exists ("pascal_fpc")
+    syn keyword pascalPredefined	Result
+  endif
+
+  if exists("pascal_fpc")
+    syn region pascalComment        start="//" end="$" contains=pascalTodo,pascalSpaceError
+    syn keyword pascalStatement	fail otherwise operator
+    syn keyword pascalDirective	popstack
+    syn keyword pascalPredefined self
+    syn keyword pascalType	ShortString AnsiString WideString
+  endif
+
+  if exists("pascal_gpc")
+    syn keyword pascalType	SmallInt
+    syn keyword pascalType	AnsiChar
+    syn keyword pascalType	PAnsiChar
+  endif
+
+  if exists("pascal_delphi")
+    syn region pascalComment	start="//"  end="$" contains=pascalTodo,pascalSpaceError
+    syn keyword pascalType	SmallInt Int64
+    syn keyword pascalType	Real48 Currency
+    syn keyword pascalType	AnsiChar WideChar
+    syn keyword pascalType	ShortString AnsiString WideString
+    syn keyword pascalType	PAnsiChar PWideChar
+    syn match  pascalFloat	"-\=\<\d\+\.\d\+[dD]-\=\d\+\>"
+    syn match  pascalStringEscape	contained "#[12][0-9]\=[0-9]\="
+    syn keyword pascalStruct	class dispinterface
+    syn keyword pascalException	try except raise at on finally
+    syn keyword pascalStatement	out
+    syn keyword pascalStatement	library package 
+    syn keyword pascalStatement	initialization finalization uses exports
+    syn keyword pascalStatement	property out resourcestring threadvar
+    syn keyword pascalModifier	contains
+    syn keyword pascalModifier	overridden reintroduce abstract
+    syn keyword pascalModifier	override export dynamic name message
+    syn keyword pascalModifier	dispid index stored default nodefault readonly
+    syn keyword pascalModifier	writeonly implements overload requires resident
+    syn keyword pascalAcces	protected published automated
+    syn keyword pascalDirective	register pascal cvar cdecl stdcall safecall
+    syn keyword pascalOperator	as is
+  endif
+
+  if exists("pascal_no_functions")
+    "syn keyword pascalModifier	read write
+    "may confuse with Read and Write functions.  Not easy to handle.
+  else
+    " control flow functions
+    syn keyword pascalFunction	Break Continue Exit Halt RunError
+
+    " ordinal functions
+    syn keyword pascalFunction	Dec Inc High Low
+
+    " math functions
+    syn keyword pascalFunction	Frac Int Pi
+
+    " string functions
+    syn keyword pascalFunction	Concat Copy Delete Insert Length Pos Str Val
+
+    " memory function
+    syn keyword pascalFunction	FreeMem GetMem MaxAvail MemAvail
+
+    " pointer and address functions
+    syn keyword pascalFunction	Addr Assigned CSeg DSeg Ofs Ptr Seg SPtr SSeg
+
+    " misc functions
+    syn keyword pascalFunction	Exclude FillChar Hi Include Lo Move ParamCount
+    syn keyword pascalFunction	ParamStr Random Randomize SizeOf Swap TypeOf
+    syn keyword pascalFunction	UpCase
+
+    " predefined variables
+    syn keyword pascalPredefined ErrorAddr ExitCode ExitProc FileMode FreeList
+    syn keyword pascalPredefined FreeZero HeapEnd HeapError HeapOrg HeapPtr
+    syn keyword pascalPredefined InOutRes OvrCodeList OvrDebugPtr OvrDosHandle
+    syn keyword pascalPredefined OvrEmsHandle OvrHeapEnd OvrHeapOrg OvrHeapPtr
+    syn keyword pascalPredefined OvrHeapSize OvrLoadList PrefixSeg RandSeed
+    syn keyword pascalPredefined SaveInt00 SaveInt02 SaveInt1B SaveInt21
+    syn keyword pascalPredefined SaveInt23 SaveInt24 SaveInt34 SaveInt35
+    syn keyword pascalPredefined SaveInt36 SaveInt37 SaveInt38 SaveInt39
+    syn keyword pascalPredefined SaveInt3A SaveInt3B SaveInt3C SaveInt3D
+    syn keyword pascalPredefined SaveInt3E SaveInt3F SaveInt75 SegA000 SegB000
+    syn keyword pascalPredefined SegB800 SelectorInc StackLimit Test8087
+
+    " file functions
+    syn keyword pascalFunction	Append Assign BlockRead BlockWrite ChDir Close
+    syn keyword pascalFunction	Erase FilePos FileSize Flush GetDir IOResult
+    syn keyword pascalFunction	MkDir Read Readln Rename Reset Rewrite RmDir
+    syn keyword pascalFunction	Seek SeekEof SeekEoln SetTextBuf Truncate
+
+    " crt unit
+    syn keyword pascalFunction	AssignCrt ClrEol ClrScr Delay DelLine GotoXY
+    syn keyword pascalFunction	HighVideo InsLine KeyPressed LowVideo NormVideo
+    syn keyword pascalFunction	NoSound ReadKey Sound TextBackground TextColor
+    syn keyword pascalFunction	TextMode WhereX WhereY Window
+    syn keyword pascalPredefined CheckBreak CheckEOF CheckSnow DirectVideo
+    syn keyword pascalPredefined LastMode TextAttr WindMin WindMax
+    syn keyword pascalFunction BigCursor CursorOff CursorOn
+    syn keyword pascalConstant Black Blue Green Cyan Red Magenta Brown
+    syn keyword pascalConstant LightGray DarkGray LightBlue LightGreen
+    syn keyword pascalConstant LightCyan LightRed LightMagenta Yellow White
+    syn keyword pascalConstant Blink ScreenWidth ScreenHeight bw40
+    syn keyword pascalConstant co40 bw80 co80 mono
+    syn keyword pascalPredefined TextChar 
+
+    " DOS unit
+    syn keyword pascalFunction	AddDisk DiskFree DiskSize DosExitCode DosVersion
+    syn keyword pascalFunction	EnvCount EnvStr Exec Expand FindClose FindFirst
+    syn keyword pascalFunction	FindNext FSearch FSplit GetCBreak GetDate
+    syn keyword pascalFunction	GetEnv GetFAttr GetFTime GetIntVec GetTime
+    syn keyword pascalFunction	GetVerify Intr Keep MSDos PackTime SetCBreak
+    syn keyword pascalFunction	SetDate SetFAttr SetFTime SetIntVec SetTime
+    syn keyword pascalFunction	SetVerify SwapVectors UnPackTime
+    syn keyword pascalConstant	FCarry FParity FAuxiliary FZero FSign FOverflow
+    syn keyword pascalConstant	Hidden Sysfile VolumeId Directory Archive
+    syn keyword pascalConstant	AnyFile fmClosed fmInput fmOutput fmInout
+    syn keyword pascalConstant	TextRecNameLength TextRecBufSize
+    syn keyword pascalType	ComStr PathStr DirStr NameStr ExtStr SearchRec
+    syn keyword pascalType	FileRec TextBuf TextRec Registers DateTime
+    syn keyword pascalPredefined DosError
+
+    "Graph Unit
+    syn keyword pascalFunction	Arc Bar Bar3D Circle ClearDevice ClearViewPort
+    syn keyword pascalFunction	CloseGraph DetectGraph DrawPoly Ellipse
+    syn keyword pascalFunction	FillEllipse FillPoly FloodFill GetArcCoords
+    syn keyword pascalFunction	GetAspectRatio GetBkColor GetColor
+    syn keyword pascalFunction	GetDefaultPalette GetDriverName GetFillPattern
+    syn keyword pascalFunction	GetFillSettings GetGraphMode GetImage
+    syn keyword pascalFunction	GetLineSettings GetMaxColor GetMaxMode GetMaxX
+    syn keyword pascalFunction	GetMaxY GetModeName GetModeRange GetPalette
+    syn keyword pascalFunction	GetPaletteSize GetPixel GetTextSettings
+    syn keyword pascalFunction	GetViewSettings GetX GetY GraphDefaults
+    syn keyword pascalFunction	GraphErrorMsg GraphResult ImageSize InitGraph
+    syn keyword pascalFunction	InstallUserDriver InstallUserFont Line LineRel
+    syn keyword pascalFunction	LineTo MoveRel MoveTo OutText OutTextXY
+    syn keyword pascalFunction	PieSlice PutImage PutPixel Rectangle
+    syn keyword pascalFunction	RegisterBGIDriver RegisterBGIFont
+    syn keyword pascalFunction	RestoreCRTMode Sector SetActivePage
+    syn keyword pascalFunction	SetAllPallette SetAspectRatio SetBkColor
+    syn keyword pascalFunction	SetColor SetFillPattern SetFillStyle
+    syn keyword pascalFunction	SetGraphBufSize SetGraphMode SetLineStyle
+    syn keyword pascalFunction	SetPalette SetRGBPalette SetTextJustify
+    syn keyword pascalFunction	SetTextStyle SetUserCharSize SetViewPort
+    syn keyword pascalFunction	SetVisualPage SetWriteMode TextHeight TextWidth
+    syn keyword pascalType	ArcCoordsType FillPatternType FillSettingsType
+    syn keyword pascalType	LineSettingsType PaletteType PointType
+    syn keyword pascalType	TextSettingsType ViewPortType
+
+    " string functions
+    syn keyword pascalFunction	StrAlloc StrBufSize StrCat StrComp StrCopy
+    syn keyword pascalFunction	StrDispose StrECopy StrEnd StrFmt StrIComp
+    syn keyword pascalFunction	StrLCat StrLComp StrLCopy StrLen StrLFmt
+    syn keyword pascalFunction	StrLIComp StrLower StrMove StrNew StrPas
+    syn keyword pascalFunction	StrPCopy StrPLCopy StrPos StrRScan StrScan
+    syn keyword pascalFunction	StrUpper
+  endif
+
+endif
+
+" Define the default highlighting.
+" For version 5.7 and earlier: only when not done already
+" For version 5.8 and later: only when an item doesn't have highlighting yet
+if version >= 508 || !exists("did_pascal_syn_inits")
+  if version < 508
+    let did_pascal_syn_inits = 1
+    command -nargs=+ HiLink hi link <args>
+  else
+    command -nargs=+ HiLink hi def link <args>
+  endif
+
+  HiLink pascalAcces		pascalStatement
+  HiLink pascalBoolean		Boolean
+  HiLink pascalComment		Comment
+  HiLink pascalConditional	Conditional
+  HiLink pascalConstant		Constant
+  HiLink pascalDelimiter	Identifier
+  HiLink pascalDirective	pascalStatement
+  HiLink pascalException	Exception
+  HiLink pascalFloat		Float
+  HiLink pascalFunction		Function
+  HiLink pascalLabel		Label
+  HiLink pascalMatrixDelimiter	Identifier
+  HiLink pascalModifier		Type
+  HiLink pascalNumber		Number
+  HiLink pascalOperator		Operator
+  HiLink pascalPredefined	pascalStatement
+  HiLink pascalPreProc		PreProc
+  HiLink pascalRepeat		Repeat
+  HiLink pascalSpaceError	Error
+  HiLink pascalStatement	Statement
+  HiLink pascalString		String
+  HiLink pascalStringEscape	Special
+  HiLink pascalStringEscapeGPC	Special
+  HiLink pascalStringError	Error
+  HiLink pascalStruct		pascalStatement
+  HiLink pascalSymbolOperator	pascalOperator
+  HiLink pascalTodo		Todo
+  HiLink pascalType		Type
+  HiLink pascalUnclassified	pascalStatement
+  "  HiLink pascalAsm		Assembler
+  HiLink pascalError		Error
+  HiLink pascalAsmKey		pascalStatement
+  HiLink pascalShowTab		Error
+
+  delcommand HiLink
+endif
+
+
+let b:current_syntax = "pascal"
+
+" vim: ts=8 sw=2
diff --git a/vim/.vim/syntax/python.vim b/vim/.vim/syntax/python.vim
new file mode 100644
index 0000000..6161eb3
--- /dev/null
+++ b/vim/.vim/syntax/python.vim
@@ -0,0 +1,327 @@
+" Vim syntax file
+" Language:	Python
+" Maintainer:	Zvezdan Petkovic <zpetkovic@acm.org>
+" Last Change:	2015 Sep 15
+" Credits:	Neil Schemenauer <nas@python.ca>
+"		Dmitry Vasiliev
+"
+"		This version is a major rewrite by Zvezdan Petkovic.
+"
+"		- introduced highlighting of doctests
+"		- updated keywords, built-ins, and exceptions
+"		- corrected regular expressions for
+"
+"		  * functions
+"		  * decorators
+"		  * strings
+"		  * escapes
+"		  * numbers
+"		  * space error
+"
+"		- corrected synchronization
+"		- more highlighting is ON by default, except
+"		- space error highlighting is OFF by default
+"
+" Optional highlighting can be controlled using these variables.
+"
+"   let python_no_builtin_highlight = 1
+"   let python_no_doctest_code_highlight = 1
+"   let python_no_doctest_highlight = 1
+"   let python_no_exception_highlight = 1
+"   let python_no_number_highlight = 1
+"   let python_space_error_highlight = 1
+"
+" All the options above can be switched on together.
+"
+"   let python_highlight_all = 1
+"
+
+" For version 5.x: Clear all syntax items.
+" For version 6.x: Quit when a syntax file was already loaded.
+if version < 600
+  syntax clear
+elseif exists("b:current_syntax")
+  finish
+endif
+
+" We need nocompatible mode in order to continue lines with backslashes.
+" Original setting will be restored.
+let s:cpo_save = &cpo
+set cpo&vim
+
+" Keep Python keywords in alphabetical order inside groups for easy
+" comparison with the table in the 'Python Language Reference'
+" https://docs.python.org/2/reference/lexical_analysis.html#keywords,
+" https://docs.python.org/3/reference/lexical_analysis.html#keywords.
+" Groups are in the order presented in NAMING CONVENTIONS in syntax.txt.
+" Exceptions come last at the end of each group (class and def below).
+"
+" Keywords 'with' and 'as' are new in Python 2.6
+" (use 'from __future__ import with_statement' in Python 2.5).
+"
+" Some compromises had to be made to support both Python 3 and 2.
+" We include Python 3 features, but when a definition is duplicated,
+" the last definition takes precedence.
+"
+" - 'False', 'None', and 'True' are keywords in Python 3 but they are
+"   built-ins in 2 and will be highlighted as built-ins below.
+" - 'exec' is a built-in in Python 3 and will be highlighted as
+"   built-in below.
+" - 'nonlocal' is a keyword in Python 3 and will be highlighted.
+" - 'print' is a built-in in Python 3 and will be highlighted as
+"   built-in below (use 'from __future__ import print_function' in 2)
+" - async and await were added in Python 3.5 and are soft keywords.
+"
+syn keyword pythonStatement	False, None, True
+syn keyword pythonStatement	as assert break continue del exec global
+syn keyword pythonStatement	lambda nonlocal pass print return with yield
+syn keyword pythonStatement	class def nextgroup=pythonFunction skipwhite
+syn keyword pythonConditional	elif else if
+syn keyword pythonRepeat	for while
+syn keyword pythonOperator	and in is not or
+syn keyword pythonException	except finally raise try
+syn keyword pythonInclude	from import
+syn keyword pythonAsync		async await
+
+" Decorators (new in Python 2.4)
+syn match   pythonDecorator	"@" display nextgroup=pythonFunction skipwhite
+" The zero-length non-grouping match before the function name is
+" extremely important in pythonFunction.  Without it, everything is
+" interpreted as a function inside the contained environment of
+" doctests.
+" A dot must be allowed because of @MyClass.myfunc decorators.
+syn match   pythonFunction
+      \ "\%(\%(def\s\|class\s\|@\)\s*\)\@<=\h\%(\w\|\.\)*" contained
+
+syn match   pythonComment	"#.*$" contains=pythonTodo,@Spell
+syn keyword pythonTodo		FIXME NOTE NOTES TODO XXX contained
+
+" Triple-quoted strings can contain doctests.
+syn region  pythonString matchgroup=pythonQuotes
+      \ start=+[uU]\=\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
+      \ contains=pythonEscape,@Spell
+syn region  pythonString matchgroup=pythonTripleQuotes
+      \ start=+[uU]\=\z('''\|"""\)+ end="\z1" keepend
+      \ contains=pythonEscape,pythonSpaceError,pythonDoctest,@Spell
+syn region  pythonRawString matchgroup=pythonQuotes
+      \ start=+[uU]\=[rR]\z(['"]\)+ end="\z1" skip="\\\\\|\\\z1"
+      \ contains=@Spell
+syn region  pythonRawString matchgroup=pythonTripleQuotes
+      \ start=+[uU]\=[rR]\z('''\|"""\)+ end="\z1" keepend
+      \ contains=pythonSpaceError,pythonDoctest,@Spell
+
+syn match   pythonEscape	+\\[abfnrtv'"\\]+ contained
+syn match   pythonEscape	"\\\o\{1,3}" contained
+syn match   pythonEscape	"\\x\x\{2}" contained
+syn match   pythonEscape	"\%(\\u\x\{4}\|\\U\x\{8}\)" contained
+" Python allows case-insensitive Unicode IDs: http://www.unicode.org/charts/
+syn match   pythonEscape	"\\N{\a\+\%(\s\a\+\)*}" contained
+syn match   pythonEscape	"\\$"
+
+if exists("python_highlight_all")
+  if exists("python_no_builtin_highlight")
+    unlet python_no_builtin_highlight
+  endif
+  if exists("python_no_doctest_code_highlight")
+    unlet python_no_doctest_code_highlight
+  endif
+  if exists("python_no_doctest_highlight")
+    unlet python_no_doctest_highlight
+  endif
+  if exists("python_no_exception_highlight")
+    unlet python_no_exception_highlight
+  endif
+  if exists("python_no_number_highlight")
+    unlet python_no_number_highlight
+  endif
+  let python_space_error_highlight = 1
+endif
+
+" It is very important to understand all details before changing the
+" regular expressions below or their order.
+" The word boundaries are *not* the floating-point number boundaries
+" because of a possible leading or trailing decimal point.
+" The expressions below ensure that all valid number literals are
+" highlighted, and invalid number literals are not.  For example,
+"
+" - a decimal point in '4.' at the end of a line is highlighted,
+" - a second dot in 1.0.0 is not highlighted,
+" - 08 is not highlighted,
+" - 08e0 or 08j are highlighted,
+"
+" and so on, as specified in the 'Python Language Reference'.
+" https://docs.python.org/2/reference/lexical_analysis.html#numeric-literals
+" https://docs.python.org/3/reference/lexical_analysis.html#numeric-literals
+if !exists("python_no_number_highlight")
+  " numbers (including longs and complex)
+  syn match   pythonNumber	"\<0[oO]\=\o\+[Ll]\=\>"
+  syn match   pythonNumber	"\<0[xX]\x\+[Ll]\=\>"
+  syn match   pythonNumber	"\<0[bB][01]\+[Ll]\=\>"
+  syn match   pythonNumber	"\<\%([1-9]\d*\|0\)[Ll]\=\>"
+  syn match   pythonNumber	"\<\d\+[jJ]\>"
+  syn match   pythonNumber	"\<\d\+[eE][+-]\=\d\+[jJ]\=\>"
+  syn match   pythonNumber
+	\ "\<\d\+\.\%([eE][+-]\=\d\+\)\=[jJ]\=\%(\W\|$\)\@="
+  syn match   pythonNumber
+	\ "\%(^\|\W\)\zs\d*\.\d\+\%([eE][+-]\=\d\+\)\=[jJ]\=\>"
+endif
+
+" Group the built-ins in the order in the 'Python Library Reference' for
+" easier comparison.
+" https://docs.python.org/2/library/constants.html
+" https://docs.python.org/3/library/constants.html
+" http://docs.python.org/2/library/functions.html
+" http://docs.python.org/3/library/functions.html
+" http://docs.python.org/2/library/functions.html#non-essential-built-in-functions
+" http://docs.python.org/3/library/functions.html#non-essential-built-in-functions
+" Python built-in functions are in alphabetical order.
+if !exists("python_no_builtin_highlight")
+  " built-in constants
+  " 'False', 'True', and 'None' are also reserved words in Python 3
+  syn keyword pythonBuiltin	False True None
+  syn keyword pythonBuiltin	NotImplemented Ellipsis __debug__
+  " built-in functions
+  syn keyword pythonBuiltin	abs all any bin bool bytearray callable chr
+  syn keyword pythonBuiltin	classmethod compile complex delattr dict dir
+  syn keyword pythonBuiltin	divmod enumerate eval filter float format
+  syn keyword pythonBuiltin	frozenset getattr globals hasattr hash
+  syn keyword pythonBuiltin	help hex id input int isinstance
+  syn keyword pythonBuiltin	issubclass iter len list locals map max
+  syn keyword pythonBuiltin	memoryview min next object oct open ord pow
+  syn keyword pythonBuiltin	print property range repr reversed round set
+  syn keyword pythonBuiltin	setattr slice sorted staticmethod str
+  syn keyword pythonBuiltin	sum super tuple type vars zip __import__
+  " Python 2 only
+  syn keyword pythonBuiltin	basestring cmp execfile file
+  syn keyword pythonBuiltin	long raw_input reduce reload unichr
+  syn keyword pythonBuiltin	unicode xrange
+  " Python 3 only
+  syn keyword pythonBuiltin	ascii bytes exec
+  " non-essential built-in functions; Python 2 only
+  syn keyword pythonBuiltin	apply buffer coerce intern
+endif
+
+" From the 'Python Library Reference' class hierarchy at the bottom.
+" http://docs.python.org/2/library/exceptions.html
+" http://docs.python.org/3/library/exceptions.html
+if !exists("python_no_exception_highlight")
+  " builtin base exceptions (used mostly as base classes for other exceptions)
+  syn keyword pythonExceptions	BaseException Exception
+  syn keyword pythonExceptions	ArithmeticError BufferError
+  syn keyword pythonExceptions	LookupError
+  " builtin base exceptions removed in Python 3
+  syn keyword pythonExceptions	EnvironmentError StandardError
+  " builtin exceptions (actually raised)
+  syn keyword pythonExceptions	AssertionError AttributeError
+  syn keyword pythonExceptions	EOFError FloatingPointError GeneratorExit
+  syn keyword pythonExceptions	ImportError IndentationError
+  syn keyword pythonExceptions	IndexError KeyError KeyboardInterrupt
+  syn keyword pythonExceptions	MemoryError NameError NotImplementedError
+  syn keyword pythonExceptions	OSError OverflowError ReferenceError
+  syn keyword pythonExceptions	RuntimeError StopIteration SyntaxError
+  syn keyword pythonExceptions	SystemError SystemExit TabError TypeError
+  syn keyword pythonExceptions	UnboundLocalError UnicodeError
+  syn keyword pythonExceptions	UnicodeDecodeError UnicodeEncodeError
+  syn keyword pythonExceptions	UnicodeTranslateError ValueError
+  syn keyword pythonExceptions	ZeroDivisionError
+  " builtin OS exceptions in Python 3
+  syn keyword pythonExceptions	BlockingIOError BrokenPipeError
+  syn keyword pythonExceptions	ChildProcessError ConnectionAbortedError
+  syn keyword pythonExceptions	ConnectionError ConnectionRefusedError
+  syn keyword pythonExceptions	ConnectionResetError FileExistsError
+  syn keyword pythonExceptions	FileNotFoundError InterruptedError
+  syn keyword pythonExceptions	IsADirectoryError NotADirectoryError
+  syn keyword pythonExceptions	PermissionError ProcessLookupError
+  syn keyword pythonExceptions	RecursionError StopAsyncIteration
+  syn keyword pythonExceptions	TimeoutError
+  " builtin exceptions deprecated/removed in Python 3
+  syn keyword pythonExceptions	IOError VMSError WindowsError
+  " builtin warnings
+  syn keyword pythonExceptions	BytesWarning DeprecationWarning FutureWarning
+  syn keyword pythonExceptions	ImportWarning PendingDeprecationWarning
+  syn keyword pythonExceptions	RuntimeWarning SyntaxWarning UnicodeWarning
+  syn keyword pythonExceptions	UserWarning Warning
+  " builtin warnings in Python 3
+  syn keyword pythonExceptions	ResourceWarning
+endif
+
+if exists("python_space_error_highlight")
+  " trailing whitespace
+  syn match   pythonSpaceError	display excludenl "\s\+$"
+  " mixed tabs and spaces
+  syn match   pythonSpaceError	display " \+\t"
+  syn match   pythonSpaceError	display "\t\+ "
+endif
+
+" Do not spell doctests inside strings.
+" Notice that the end of a string, either ''', or """, will end the contained
+" doctest too.  Thus, we do *not* need to have it as an end pattern.
+if !exists("python_no_doctest_highlight")
+  if !exists("python_no_doctest_code_highlight")
+    syn region pythonDoctest
+	  \ start="^\s*>>>\s" end="^\s*$"
+	  \ contained contains=ALLBUT,pythonDoctest,@Spell
+    syn region pythonDoctestValue
+	  \ start=+^\s*\%(>>>\s\|\.\.\.\s\|"""\|'''\)\@!\S\++ end="$"
+	  \ contained
+  else
+    syn region pythonDoctest
+	  \ start="^\s*>>>" end="^\s*$"
+	  \ contained contains=@NoSpell
+  endif
+endif
+
+" Sync at the beginning of class, function, or method definition.
+syn sync match pythonSync grouphere NONE "^\s*\%(def\|class\)\s\+\h\w*\s*("
+
+if version >= 508 || !exists("did_python_syn_inits")
+  if version <= 508
+    let did_python_syn_inits = 1
+    command -nargs=+ HiLink hi link <args>
+  else
+    command -nargs=+ HiLink hi def link <args>
+  endif
+
+  " The default highlight links.  Can be overridden later.
+  HiLink pythonStatement	Statement
+  HiLink pythonConditional	Conditional
+  HiLink pythonRepeat		Repeat
+  HiLink pythonOperator		Operator
+  HiLink pythonException	Exception
+  HiLink pythonInclude		Include
+  HiLink pythonAsync		Statement
+  HiLink pythonDecorator	Define
+  HiLink pythonFunction		Function
+  HiLink pythonComment		Comment
+  HiLink pythonTodo		Todo
+  HiLink pythonString		String
+  HiLink pythonRawString	String
+  HiLink pythonQuotes		String
+  HiLink pythonTripleQuotes	pythonQuotes
+  HiLink pythonEscape		Special
+  if !exists("python_no_number_highlight")
+    HiLink pythonNumber		Number
+  endif
+  if !exists("python_no_builtin_highlight")
+    HiLink pythonBuiltin	Function
+  endif
+  if !exists("python_no_exception_highlight")
+    HiLink pythonExceptions	Structure
+  endif
+  if exists("python_space_error_highlight")
+    HiLink pythonSpaceError	Error
+  endif
+  if !exists("python_no_doctest_highlight")
+    HiLink pythonDoctest	Special
+    HiLink pythonDoctestValue	Define
+  endif
+
+  delcommand HiLink
+endif
+
+let b:current_syntax = "python"
+
+let &cpo = s:cpo_save
+unlet s:cpo_save
+
+" vim:set sw=2 sts=2 ts=8 noet: