summaryrefslogtreecommitdiffstats
path: root/syntax/blade.vim
blob: 0a1f76072d5205aab81e10cbb692c869d0d62136 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
if !exists('g:polyglot_disabled') || index(g:polyglot_disabled, 'blade') == -1
  
" Language:     Blade
" Maintainer:   Jason Walton <jwalton512@gmail.com>
" URL:          https://github.com/xsbeats/vim-blade
" License:      DBAD

" Check if our syntax is already loaded
if exists('b:current_syntax') && b:current_syntax == 'blade'
    finish
endif

" Include PHP
runtime! syntax/php.vim
silent! unlet b:current_syntax

" 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

" 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

" Comments
syn region bladeComments start=/\s*{{--/ end=/--}}/ contains=bladeComment keepend
syn match bladeComment /.*/ contained containedin=bladeComments

" Clusters
syn cluster bladeAll contains=bladeStructure,bladeParens

" Highlighting
hi def link bladeComment        Comment
hi def link bladeEchoDelim      Delimiter
hi def link bladeParen          Delimiter
hi def link bladeStructure      Keyword


if !exists('b:current_syntax')
    let b:current_syntax = 'blade'
endif

endif