File: pyopencl.vim

package info (click to toggle)
pyopencl 2016.1%2Bgit20161130-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 2,220 kB
  • ctags: 3,039
  • sloc: python: 20,232; cpp: 8,002; lisp: 4,361; makefile: 192; ansic: 103; sh: 1
file content (84 lines) | stat: -rw-r--r-- 2,379 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
" Vim highlighting for PyOpenCL
" -----------------------------
"
" (C) Andreas Kloeckner 2011, MIT license
"
" Uses parts of mako.vim by Armin Ronacher.
"
" Installation:
" Just drop this file into ~/.vim/syntax/pyopencl.vim
"
" Then do 
" :set filetype=pyopencl
" and use 
" """//CL// ...code..."""
" for OpenCL code included in your Python file.
"
" You may also include a line
" vim: filetype=pyopencl.python
" at the end of your file to set the file type automatically.
"
" Optional: Install opencl.vim from
" http://www.vim.org/scripts/script.php?script_id=3157

runtime! syntax/python.vim

unlet b:current_syntax
try
  syntax include @clCode syntax/opencl.vim
catch
  syntax include @clCode syntax/c.vim
endtry

unlet b:current_syntax
syn include @pythonTop syntax/python.vim

" {{{ mako

syn region clmakoLine start="^\s*%" skip="\\$" end="$"
syn region clmakoVariable start=#\${# end=#}# contains=@pythonTop
syn region clmakoBlock start=#<%!# end=#%># keepend contains=@pythonTop

syn match clmakoAttributeKey containedin=clmakoTag contained "[a-zA-Z_][a-zA-Z0-9_]*="
syn region clmakoAttributeValue containedin=clmakoTag contained start=/"/ skip=/\\"/ end=/"/
syn region clmakoAttributeValue containedin=clmakoTag contained start=/'/ skip=/\\'/ end=/'/

syn region clmakoTag start="</\?%\(def\|call\|page\|include\|namespace\|inherit\|self:[_[:alnum:]]\+\)\>" end="/\?>"

" The C highlighter's paren error detection screws up highlighting of 
" Mako variables in C parens--turn it off.

syn clear cParen
syn clear cParenError
if !exists("c_no_bracket_error")
  syn clear cBracket
endif

syn cluster clmakoCode contains=clmakoLine,clmakoVariable,clmakoBlock,clmakoTag

hi link clmakoLine Preproc
hi link clmakoVariable Preproc
hi link clmakoBlock Preproc
hi link clmakoTag Define
hi link clmakoAttributeKey String
hi link clmakoAttributeValue String

" }}}

syn region pythonCLString
      \ start=+[uU]\=\z('''\|"""\)//CL\(:[a-zA-Z_0-9]\+\)\?//+ end="\z1" keepend
      \ contains=@clCode,@clmakoCode

syn region pythonCLRawString
      \ start=+[uU]\=[rR]\z('''\|"""\)//CL\(:[a-zA-Z_0-9]\+\)\?//+ end="\z1" keepend
      \ contains=@clCode,@clmakoCode

" Uncomment if you still want the code highlighted as a string.
" hi link pythonCLString String
" hi link pythonCLRawString String

syntax sync fromstart

let b:current_syntax = "pyopencl"

" vim: foldmethod=marker