comparison runtime/syntax/haml.vim @ 1668:0b796e045c42 v7.2b.000

updated for version 7.2b-000
author vimboss
date Sun, 13 Jul 2008 17:41:49 +0000
parents
children 5232b9862f23
comparison
equal deleted inserted replaced
1667:131dbd3d2a4b 1668:0b796e045c42
1 " Vim syntax file
2 " Language: Haml
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.info>
4 " Filenames: *.haml
5
6 if exists("b:current_syntax")
7 finish
8 endif
9
10 if !exists("main_syntax")
11 let main_syntax = 'haml'
12 endif
13 let b:ruby_no_expensive = 1
14
15 runtime! syntax/html.vim
16 unlet! b:current_syntax
17 silent! syn include @hamlSassTop syntax/sass.vim
18 unlet! b:current_syntax
19 syn include @hamlRubyTop syntax/ruby.vim
20
21 syn case match
22
23 syn cluster hamlComponent contains=hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
24 syn cluster hamlEmbeddedRuby contains=hamlAttributes,hamlObject,hamlRuby,hamlRubyFilter
25 syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment
26
27 syn match hamlBegin "^\s*[<>&]\@!" nextgroup=hamlTag,hamlAttributes,hamlClassChar,hamlIdChar,hamlObject,hamlRuby,hamlPlainChar,hamlInterpolatable
28
29 syn match hamlTag "%\w\+" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent
30 syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent
31 syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent
32 syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable
33 syn match hamlSelfCloser "/" contained
34 syn match hamlClassChar "\." contained nextgroup=hamlClass
35 syn match hamlIdChar "#" contained nextgroup=hamlId
36 syn match hamlClass "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
37 syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent
38 syn region hamlDocType start="^\s*!!!" end="$"
39
40 syn region hamlRuby matchgroup=hamlRubyOutputChar start="[=~]" end="$" contained contains=@hamlRubyTop keepend
41 syn region hamlRuby matchgroup=hamlRubyChar start="-" end="$" contained contains=@hamlRubyTop keepend
42 syn match hamlPlainChar "\\" contained
43 syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="==" end="$" keepend contained contains=hamlInterpolation
44 syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contained contains=@hamlRubyTop
45
46 syn match hamlHelper "\<action_view?\|\.\@<!\<\%(flatten\|open\|puts\)" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
47 syn keyword hamlHelper capture_haml find_and_preserve html_attrs init_haml_helpers list_of preced preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop,rubyInterpolation
48
49 syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|erb\|redcloth\|textile\|markdown\)\s*$" end="^\%(\z1 \)\@!" contains=htmlTag,htmlEndTag,htmlSpecialChar,htmlComment,@htmlTop
50 syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \)\@!" contains=@hamlRubyTop
51 syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \)\@!" contains=@hamlSassTop
52
53 syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlJavaScript keepend
54 syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \)\@!" contains=@hamlTop,@htmlCss keepend
55 syn match hamlError "\$" contained
56
57 syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \)\@!" contains=rubyTodo
58 syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \)\@!" contains=@hamlTop,rubyTodo
59 syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment
60
61 hi def link hamlSelfCloser Special
62 hi def link hamlDespacer Special
63 hi def link hamlClassChar Special
64 hi def link hamlIdChar Special
65 hi def link hamlTag Special
66 hi def link hamlClass Type
67 hi def link hamlId Identifier
68 hi def link hamlPlainChar Special
69 hi def link hamlInterpolatableChar hamlRubyChar
70 hi def link hamlRubyOutputChar hamlRubyChar
71 hi def link hamlRubyChar Special
72 hi def link hamlInterpolationDelimiter Delimiter
73 hi def link hamlDocType PreProc
74 hi def link hamlFilter PreProc
75 hi def link hamlAttributesDelimiter Delimiter
76 hi def link hamlObjectDelimiter Delimiter
77 hi def link hamlHelper Function
78 hi def link hamlHtmlComment hamlComment
79 hi def link hamlComment Comment
80 hi def link hamlIEConditional SpecialComment
81 hi def link hamlError Error
82
83 let b:current_syntax = "haml"
84
85 " vim:set sw=2: