1" Vim syntax file
2" Language:	   SPYCE
3" Maintainer:	 Rimon Barr <rimon AT acm DOT org>
4" URL:		     http://spyce.sourceforge.net
5" Last Change: 2009 Nov 11
6
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" we define it here so that included files can test for it
16if !exists("main_syntax")
17  let main_syntax='spyce'
18endif
19
20" Read the HTML syntax to start with
21let b:did_indent = 1	     " don't perform HTML indentation!
22let html_no_rendering = 1    " do not render <b>,<i>, etc...
23if version < 600
24  so <sfile>:p:h/html.vim
25else
26  runtime! syntax/html.vim
27  unlet b:current_syntax
28  syntax spell default  " added by Bram
29endif
30
31" include python
32syn include @Python <sfile>:p:h/python.vim
33syn include @Html <sfile>:p:h/html.vim
34
35" spyce definitions
36syn keyword spyceDirectiveKeyword include compact module import contained
37syn keyword spyceDirectiveArg name names file contained
38syn region  spyceDirectiveString start=+"+ end=+"+ contained
39syn match   spyceDirectiveValue "=[\t ]*[^'", \t>][^, \t>]*"hs=s+1 contained
40
41syn match spyceBeginErrorS  ,\[\[,
42syn match spyceBeginErrorA  ,<%,
43syn cluster spyceBeginError contains=spyceBeginErrorS,spyceBeginErrorA
44syn match spyceEndErrorS    ,\]\],
45syn match spyceEndErrorA    ,%>,
46syn cluster spyceEndError contains=spyceEndErrorS,spyceEndErrorA
47
48syn match spyceEscBeginS       ,\\\[\[,
49syn match spyceEscBeginA       ,\\<%,
50syn cluster spyceEscBegin contains=spyceEscBeginS,spyceEscBeginA
51syn match spyceEscEndS	       ,\\\]\],
52syn match spyceEscEndA	       ,\\%>,
53syn cluster spyceEscEnd contains=spyceEscEndS,spyceEscEndA
54syn match spyceEscEndCommentS  ,--\\\]\],
55syn match spyceEscEndCommentA  ,--\\%>,
56syn cluster spyceEscEndComment contains=spyceEscEndCommentS,spyceEscEndCommentA
57
58syn region spyceStmtS      matchgroup=spyceStmtDelim start=,\[\[, end=,\]\], contains=@Python,spyceLambdaS,spyceLambdaA,spyceBeginError keepend
59syn region spyceStmtA      matchgroup=spyceStmtDelim start=,<%, end=,%>, contains=@Python,spyceLambdaS,spyceLambdaA,spyceBeginError keepend
60syn region spyceChunkS     matchgroup=spyceChunkDelim start=,\[\[\\, end=,\]\], contains=@Python,spyceLambdaS,spyceLambdaA,spyceBeginError keepend
61syn region spyceChunkA     matchgroup=spyceChunkDelim start=,<%\\, end=,%>, contains=@Python,spyceLambdaS,spyceLambdaA,spyceBeginError keepend
62syn region spyceEvalS      matchgroup=spyceEvalDelim start=,\[\[=, end=,\]\], contains=@Python,spyceLambdaS,spyceLambdaA,spyceBeginError keepend
63syn region spyceEvalA      matchgroup=spyceEvalDelim start=,<%=, end=,%>, contains=@Python,spyceLambdaS,spyceLambdaA,spyceBeginError keepend
64syn region spyceDirectiveS matchgroup=spyceDelim start=,\[\[\., end=,\]\], contains=spyceBeginError,spyceDirectiveKeyword,spyceDirectiveArg,spyceDirectiveValue,spyceDirectiveString keepend
65syn region spyceDirectiveA matchgroup=spyceDelim start=,<%@, end=,%>, contains=spyceBeginError,spyceDirectiveKeyword,spyceDirectiveArg,spyceDirectiveValue,spyceDirectiveString keepend
66syn region spyceCommentS   matchgroup=spyceCommentDelim start=,\[\[--, end=,--\]\],
67syn region spyceCommentA   matchgroup=spyceCommentDelim start=,<%--, end=,--%>,
68syn region spyceLambdaS    matchgroup=spyceLambdaDelim start=,\[\[spy!\?, end=,\]\], contains=@Html,@spyce extend
69syn region spyceLambdaA    matchgroup=spyceLambdaDelim start=,<%spy!\?, end=,%>, contains=@Html,@spyce extend
70
71syn cluster spyce contains=spyceStmtS,spyceStmtA,spyceChunkS,spyceChunkA,spyceEvalS,spyceEvalA,spyceCommentS,spyceCommentA,spyceDirectiveS,spyceDirectiveA
72
73syn cluster htmlPreproc contains=@spyce
74
75hi link spyceDirectiveKeyword	Special
76hi link spyceDirectiveArg	Type
77hi link spyceDirectiveString	String
78hi link spyceDirectiveValue	String
79
80hi link spyceDelim		Special
81hi link spyceStmtDelim		spyceDelim
82hi link spyceChunkDelim		spyceDelim
83hi link spyceEvalDelim		spyceDelim
84hi link spyceLambdaDelim	spyceDelim
85hi link spyceCommentDelim	Comment
86
87hi link spyceBeginErrorS	Error
88hi link spyceBeginErrorA	Error
89hi link spyceEndErrorS		Error
90hi link spyceEndErrorA		Error
91
92hi link spyceStmtS		spyce
93hi link spyceStmtA		spyce
94hi link spyceChunkS		spyce
95hi link spyceChunkA		spyce
96hi link spyceEvalS		spyce
97hi link spyceEvalA		spyce
98hi link spyceDirectiveS		spyce
99hi link spyceDirectiveA		spyce
100hi link spyceCommentS		Comment
101hi link spyceCommentA		Comment
102hi link spyceLambdaS		Normal
103hi link spyceLambdaA		Normal
104
105hi link spyce			Statement
106
107let b:current_syntax = "spyce"
108if main_syntax == 'spyce'
109  unlet main_syntax
110endif
111
112