summaryrefslogtreecommitdiffstats
path: root/syntax/blade.vim
diff options
context:
space:
mode:
authorAdam Stankiewicz <sheerun@sher.pl>2014-11-11 02:37:21 +0100
committerAdam Stankiewicz <sheerun@sher.pl>2014-11-11 02:37:21 +0100
commit617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1 (patch)
tree97fc653e0c19839490bd7aac6beeb4f5754155be /syntax/blade.vim
parentbd35da8e9ca0bddd95539bef0c8f4857dc4cc746 (diff)
downloadvim-polyglot-617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1.tar.gz
vim-polyglot-617b01a5b6aa3cadb25b2ff8639e330cfc6cf3c1.zip
Updatev1.10.3
Diffstat (limited to 'syntax/blade.vim')
-rw-r--r--syntax/blade.vim52
1 files changed, 29 insertions, 23 deletions
diff --git a/syntax/blade.vim b/syntax/blade.vim
index a02b88ae..3f512163 100644
--- a/syntax/blade.vim
+++ b/syntax/blade.vim
@@ -1,35 +1,41 @@
-" Language: Blade (Laravel)
-" Maintainer: xsbeats <jwalton512@gmail.com>
-" URL: http://github.com/xsbeats/vim-blade
-" License: WTFPL
+" Language: Blade
+" Maintainer: Jason Walton <jwalton512@gmail.com>
+" URL: https://github.com/xsbeats/vim-blade
+" License: DBAD
-if exists("b:current_syntax")
+" Check if our syntax is already loaded
+if exists('b:current_syntax') && b:current_syntax == 'blade'
finish
endif
-runtime! syntax/html.vim
-unlet b:current_syntax
-
+" Include PHP
runtime! syntax/php.vim
-unlet b:current_syntax
-
-syn match bladeConditional /@\(choice\|each\|elseif\|extends\|for\|foreach\|if\|include\|lang\|section\|unless\|while\|yield\)\>\s*/ nextgroup=bladeParenBlock containedin=ALLBUT,bladeComment
+silent! unlet b:current_syntax
-syn match bladeKeyword /@\(else\|endfor\|endforeach\|endif\|endsection\|endunless\|endwhile\|overwrite\|parent\|show\|stop\)\>/ containedin=ALL,bladeComment
+" Echos
+syn region bladeUnescapedEcho matchgroup=bladeEchoDelim start=/@\@<!\s*{!!/ end=/!!}\s*/ oneline contains=@phpClTop containedin=ALLBUT,bladeComment
+syn region bladeEscapedEcho matchgroup=bladeEchoDelim start=/@\@<!\s*{{{\@!/ end=/}}\s*/ oneline contains=@phpClTop containedin=ALLBUT,bladeComment
+syn region bladeEscapedEcho matchgroup=bladeEchoDelim start=/@\@<!\s*{{{{\@!/ end=/}}}/ oneline contains=@phpClTop containedin=ALLBUT,bladeComment
-syn region bladeCommentBlock start="{{--" end="--}}" contains=bladeComment keepend containedin=TOP
-syn match bladeComment /.*/ contained containedin=bladeCommentBlock
+" Structures
+syn match bladeStructure /\s*@\(else\|empty\|endfor\|endforeach\|endforelse\|endif\|endpush\|endsection\|endunless\|endwhile\|overwrite\|show\|stop\)\>/
+syn match bladeStructure /\s*@\(append\|choice\|each\|elseif\|extends\|for\|foreach\|forelse\|if\|include\|lang\|push\|section\|stack\|unless\|while\|yield\|\)\>\s*/ nextgroup=bladeParens
+syn region bladeParens matchgroup=bladeParen start=/(/ end=/)/ contained contains=@bladeAll,@phpClTop
-syn region bladeEchoUnescaped matchgroup=bladeEchoDelim start="\([@|{]\)\@<!{{\(--\)\@!" end="}}" contains=@phpClInside containedin=ALLBUT,bladeComment
-syn region bladeEchoEscaped matchgroup=bladeEchoDelim start="\(@\)\@<!{{{" end="}}}" contains=@phpClInside containedin=ALLBUT,bladeComment
+" Comments
+syn region bladeComments start=/\s*{{--/ end=/--}}/ contains=bladeComment keepend
+syn match bladeComment /.*/ contained containedin=bladeComments
-syn cluster bladeStatement contains=bladeConditional,bladeKeyword
+" Clusters
+syn cluster bladeAll contains=bladeStructure,bladeParens
-syn region bladeParenBlock start="(" end=")" contained oneline contains=bladeParenBlock,@phpClInside,@bladeStatement extend keepend
+" Highlighting
+hi def link bladeComment Comment
+hi def link bladeEchoDelim Delimiter
+hi def link bladeParen Delimiter
+hi def link bladeStructure Keyword
-hi def link bladeComment Comment
-hi def link bladeConditional Conditional
-hi def link bladeKeyword Keyword
-hi def link bladeEchoDelim Delimiter
-let b:current_syntax = 'blade'
+if !exists('b:current_syntax')
+ let b:current_syntax = 'blade'
+endif