Mercurial > vim
annotate runtime/syntax/haml.vim @ 9965:b329e3ca0dcb v7.4.2256
commit https://github.com/vim/vim/commit/db249f26edf7a5f88d1f4468d08ec5b84f5ab7ad
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Aug 26 16:29:47 2016 +0200
patch 7.4.2256
Problem: Coverity complains about null pointer check.
Solution: Remove wrong and superfluous error check.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 26 Aug 2016 16:30:08 +0200 |
parents | 713a4965ee7f |
children | 43efa4f5a8ea |
rev | line source |
---|---|
1668 | 1 " Vim syntax file |
2415 | 2 " Language: Haml |
3 " Maintainer: Tim Pope <vimNOSPAM@tpope.org> | |
4 " Filenames: *.haml | |
2526
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
5 " Last Change: 2010 Aug 09 |
1668 | 6 |
7 if exists("b:current_syntax") | |
8 finish | |
9 endif | |
10 | |
11 if !exists("main_syntax") | |
12 let main_syntax = 'haml' | |
13 endif | |
14 let b:ruby_no_expensive = 1 | |
15 | |
16 runtime! syntax/html.vim | |
17 unlet! b:current_syntax | |
18 silent! syn include @hamlSassTop syntax/sass.vim | |
19 unlet! b:current_syntax | |
20 syn include @hamlRubyTop syntax/ruby.vim | |
21 | |
22 syn case match | |
23 | |
2526
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
24 syn region rubyCurlyBlock start="{" end="}" contains=@hamlRubyTop contained |
2202 | 25 syn cluster hamlRubyTop add=rubyCurlyBlock |
26 | |
27 syn cluster hamlComponent contains=hamlAttributes,hamlAttributesHash,hamlClassChar,hamlIdChar,hamlObject,hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable | |
28 syn cluster hamlEmbeddedRuby contains=hamlAttributesHash,hamlObject,hamlRuby,hamlRubyFilter | |
1668 | 29 syn cluster hamlTop contains=hamlBegin,hamlPlainFilter,hamlRubyFilter,hamlSassFilter,hamlComment,hamlHtmlComment |
30 | |
2202 | 31 syn match hamlBegin "^\s*\%([<>]\|&[^=~ ]\)\@!" nextgroup=hamlTag,hamlClassChar,hamlIdChar,hamlRuby,hamlPlainChar,hamlInterpolatable |
1668 | 32 |
2415 | 33 syn match hamlTag "%\w\+\%(:\w\+\)\=" contained contains=htmlTagName,htmlSpecialTagName nextgroup=@hamlComponent |
2202 | 34 syn region hamlAttributes matchgroup=hamlAttributesDelimiter start="(" end=")" contained contains=htmlArg,hamlAttributeString,hamlAttributeVariable,htmlEvent,htmlCssDefinition nextgroup=@hamlComponent |
35 syn region hamlAttributesHash matchgroup=hamlAttributesDelimiter start="{" end="}" contained contains=@hamlRubyTop nextgroup=@hamlComponent | |
36 syn region hamlObject matchgroup=hamlObjectDelimiter start="\[" end="\]" contained contains=@hamlRubyTop nextgroup=@hamlComponent | |
1668 | 37 syn match hamlDespacer "[<>]" contained nextgroup=hamlDespacer,hamlSelfCloser,hamlRuby,hamlPlainChar,hamlInterpolatable |
38 syn match hamlSelfCloser "/" contained | |
39 syn match hamlClassChar "\." contained nextgroup=hamlClass | |
2202 | 40 syn match hamlIdChar "#{\@!" contained nextgroup=hamlId |
1668 | 41 syn match hamlClass "\%(\w\|-\)\+" contained nextgroup=@hamlComponent |
42 syn match hamlId "\%(\w\|-\)\+" contained nextgroup=@hamlComponent | |
43 syn region hamlDocType start="^\s*!!!" end="$" | |
44 | |
2202 | 45 syn region hamlRuby matchgroup=hamlRubyOutputChar start="[!&]\==\|\~" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend |
46 syn region hamlRuby matchgroup=hamlRubyChar start="-" skip=",\s*$" end="$" contained contains=@hamlRubyTop keepend | |
1668 | 47 syn match hamlPlainChar "\\" contained |
2202 | 48 syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="!\===\|!=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape,@hamlHtmlTop |
49 syn region hamlInterpolatable matchgroup=hamlInterpolatableChar start="&==\|&=\@!" end="$" keepend contained contains=hamlInterpolation,hamlInterpolationEscape | |
2526
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
50 syn region hamlInterpolation matchgroup=hamlInterpolationDelimiter start="#{" end="}" contains=@hamlRubyTop containedin=javascriptStringS,javascriptStringD |
2202 | 51 syn match hamlInterpolationEscape "\\\@<!\%(\\\\\)*\\\%(\\\ze#{\|#\ze{\)" |
1702 | 52 syn region hamlErbInterpolation matchgroup=hamlInterpolationDelimiter start="<%[=-]\=" end="-\=%>" contained contains=@hamlRubyTop |
1668 | 53 |
2202 | 54 syn region hamlAttributeString start=+\%(=\s*\)\@<='+ skip=+\%(\\\\\)*\\'+ end=+'+ contains=hamlInterpolation,hamlInterpolationEscape |
55 syn region hamlAttributeString start=+\%(=\s*\)\@<="+ skip=+\%(\\\\\)*\\"+ end=+"+ contains=hamlInterpolation,hamlInterpolationEscape | |
56 syn match hamlAttributeVariable "\%(=\s*\)\@<=\%(@@\=\|\$\)\=\w\+" contained | |
57 | |
2526
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
58 syn match hamlHelper "\<action_view?\|\<block_is_haml?\|\<is_haml?\|\.\@<!\<flatten" contained containedin=@hamlEmbeddedRuby,@hamlRubyTop |
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
59 syn keyword hamlHelper capture_haml escape_once find_and_preserve haml_concat haml_indent haml_tag html_attrs html_esape init_haml_helpers list_of non_haml precede preserve succeed surround tab_down tab_up page_class contained containedin=@hamlEmbeddedRuby,@hamlRubyTop |
1668 | 60 |
1702 | 61 syn cluster hamlHtmlTop contains=@htmlTop,htmlBold,htmlItalic,htmlUnderline |
2526
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
62 syn region hamlPlainFilter matchgroup=hamlFilter start="^\z(\s*\):\%(plain\|preserve\|redcloth\|textile\|markdown\|maruku\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlInterpolation |
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
63 syn region hamlEscapedFilter matchgroup=hamlFilter start="^\z(\s*\):\%(escaped\|cdata\)\s*$" end="^\%(\z1 \| *$\)\@!" contains=hamlInterpolation |
2202 | 64 syn region hamlErbFilter matchgroup=hamlFilter start="^\z(\s*\):erb\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlHtmlTop,hamlErbInterpolation |
65 syn region hamlRubyFilter matchgroup=hamlFilter start="^\z(\s*\):ruby\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlRubyTop | |
2526
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
66 syn region hamlJavascriptFilter matchgroup=hamlFilter start="^\z(\s*\):javascript\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlJavaScript,hamlInterpolation keepend |
713a4965ee7f
Runtime file updates. (Tim Pope)
Bram Moolenaar <bram@vim.org>
parents:
2415
diff
changeset
|
67 syn region hamlCSSFilter matchgroup=hamlFilter start="^\z(\s*\):css\s*$" end="^\%(\z1 \| *$\)\@!" contains=@htmlCss,hamlInterpolation keepend |
2202 | 68 syn region hamlSassFilter matchgroup=hamlFilter start="^\z(\s*\):sass\s*$" end="^\%(\z1 \| *$\)\@!" contains=@hamlSassTop |
1668 | 69 |
2202 | 70 syn region hamlJavascriptBlock start="^\z(\s*\)%script" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlJavaScript keepend |
71 syn region hamlCssBlock start="^\z(\s*\)%style" nextgroup=@hamlComponent,hamlError end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,@htmlCss keepend | |
1668 | 72 syn match hamlError "\$" contained |
73 | |
2202 | 74 syn region hamlComment start="^\z(\s*\)-#" end="^\%(\z1 \| *$\)\@!" contains=rubyTodo |
75 syn region hamlHtmlComment start="^\z(\s*\)/" end="^\%(\z1 \| *$\)\@!" contains=@hamlTop,rubyTodo | |
1668 | 76 syn match hamlIEConditional "\%(^\s*/\)\@<=\[if\>[^]]*]" contained containedin=hamlHtmlComment |
77 | |
78 hi def link hamlSelfCloser Special | |
79 hi def link hamlDespacer Special | |
80 hi def link hamlClassChar Special | |
81 hi def link hamlIdChar Special | |
82 hi def link hamlTag Special | |
83 hi def link hamlClass Type | |
84 hi def link hamlId Identifier | |
85 hi def link hamlPlainChar Special | |
86 hi def link hamlInterpolatableChar hamlRubyChar | |
87 hi def link hamlRubyOutputChar hamlRubyChar | |
88 hi def link hamlRubyChar Special | |
89 hi def link hamlInterpolationDelimiter Delimiter | |
2202 | 90 hi def link hamlInterpolationEscape Special |
91 hi def link hamlAttributeString String | |
92 hi def link hamlAttributeVariable Identifier | |
1668 | 93 hi def link hamlDocType PreProc |
94 hi def link hamlFilter PreProc | |
95 hi def link hamlAttributesDelimiter Delimiter | |
96 hi def link hamlObjectDelimiter Delimiter | |
97 hi def link hamlHelper Function | |
98 hi def link hamlHtmlComment hamlComment | |
99 hi def link hamlComment Comment | |
100 hi def link hamlIEConditional SpecialComment | |
101 hi def link hamlError Error | |
102 | |
103 let b:current_syntax = "haml" | |
104 | |
2202 | 105 if main_syntax == "haml" |
106 unlet main_syntax | |
107 endif | |
108 | |
1668 | 109 " vim:set sw=2: |