blob: 7dc9b955b0465989aa7e8294964742dab6b9d0b9 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" Vim syntax file
2" Language: Pyrex
3" Maintainer: Marco Barisione <marco.bari@people.it>
4" URL: http://marcobari.altervista.org/pyrex_vim.html
Bram Moolenaar5c736222010-01-06 20:54:52 +01005" Last Change: 2009 Nov 09
Bram Moolenaar071d4272004-06-13 20:20:40 +00006
7" For version 5.x: Clear all syntax items
8" For version 6.x: Quit when a syntax file was already loaded
9if version < 600
10 syntax clear
11elseif exists("b:current_syntax")
12 finish
13endif
14
15" Read the Python syntax to start with
16if version < 600
17 so <sfile>:p:h/python.vim
18else
19 runtime! syntax/python.vim
20 unlet b:current_syntax
21endif
22
23" Pyrex extentions
24syn keyword pyrexStatement cdef typedef ctypedef sizeof
25syn keyword pyrexType int long short float double char object void
26syn keyword pyrexType signed unsigned
27syn keyword pyrexStructure struct union enum
Bram Moolenaar5c736222010-01-06 20:54:52 +010028syn keyword pyrexInclude include cimport
Bram Moolenaar071d4272004-06-13 20:20:40 +000029syn keyword pyrexAccess public private property readonly extern
30" If someome wants Python's built-ins highlighted probably he
31" also wants Pyrex's built-ins highlighted
32if exists("python_highlight_builtins") || exists("pyrex_highlight_builtins")
33 syn keyword pyrexBuiltin NULL
34endif
35
36" This deletes "from" from the keywords and re-adds it as a
37" match with lower priority than pyrexForFrom
Bram Moolenaar5c736222010-01-06 20:54:52 +010038syn clear pythonInclude
39syn keyword pythonInclude import
40syn match pythonInclude "from"
Bram Moolenaar071d4272004-06-13 20:20:40 +000041
42" With "for[^:]*\zsfrom" VIM does not match "for" anymore, so
43" I used the slower "\@<=" form
44syn match pyrexForFrom "\(for[^:]*\)\@<=from"
45
46" Default highlighting
47if version >= 508 || !exists("did_pyrex_syntax_inits")
48 if version < 508
49 let did_pyrex_syntax_inits = 1
50 command -nargs=+ HiLink hi link <args>
51 else
52 command -nargs=+ HiLink hi def link <args>
53 endif
54 HiLink pyrexStatement Statement
55 HiLink pyrexType Type
56 HiLink pyrexStructure Structure
Bram Moolenaar5c736222010-01-06 20:54:52 +010057 HiLink pyrexInclude PreCondit
Bram Moolenaar071d4272004-06-13 20:20:40 +000058 HiLink pyrexAccess pyrexStatement
59 if exists("python_highlight_builtins") || exists("pyrex_highlight_builtins")
60 HiLink pyrexBuiltin Function
61 endif
62 HiLink pyrexForFrom Statement
63
64 delcommand HiLink
65endif
66
67let b:current_syntax = "pyrex"