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