From f7e52b533c806702d830db930b41175e7bb0b236 Mon Sep 17 00:00:00 2001 From: Yaroslav Korshak Date: Wed, 11 May 2011 21:17:56 +0000 Subject: [PATCH] improved region detection --- after/syntax/perl/MojoliciousLite.vim | 2 +- syntax/epl.vim | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/after/syntax/perl/MojoliciousLite.vim b/after/syntax/perl/MojoliciousLite.vim index 7fb7a0e..0d4398a 100644 --- a/after/syntax/perl/MojoliciousLite.vim +++ b/after/syntax/perl/MojoliciousLite.vim @@ -3,7 +3,7 @@ " Language: Mojo epl templates stored in Perl __DATA__ " Maintainer: yko " Version: 0.04 -" Last Change: 2010 Dec 27 +" Last Change: 2011 Feb 11 " Location: http://github.com/yko/mojo.vim " " Thanks to Viacheslav Tykhanovskyi for simplified region syntax diff --git a/syntax/epl.vim b/syntax/epl.vim index c3316f2..4e12e62 100644 --- a/syntax/epl.vim +++ b/syntax/epl.vim @@ -27,14 +27,14 @@ endif " Begin and end of code blocks syn match MojoStart /<%=\{0,2}/ contained -syn match MojoStart /^\s*%=\{0,2}/ contained +syn match MojoSingleStart /^\s*%=\{0,2}/ contained syn match MojoEnd /=\{0,1}%>/ contained syn cluster Mojo contains=MojoStart,MojoEnd " Highlight code blocks -syn region PerlInside keepend oneline start=+<%=\{0,2}+hs=s skip=+".*%>.*"+ end=+=\{0,1}%>+ contains=@Mojo,@Perl -syn region PerlInside keepend oneline start=+^\s*%=\{0,2}+hs=s end=+$+ contains=@Mojo,@Perl +syn region PerlInside keepend oneline start=+<%=\{0,2}+hs=s end=+=\{0,1}%>+he=s-1,me=s-1 contains=MojoStart,@Perl nextgroup=MojoEnd +syn region PerlInside keepend oneline start=+^\s*%=\{0,2}+hs=s end=+$+ contains=MojoSingleStart,@Perl if !exists("mojo_no_helpers") @@ -42,7 +42,7 @@ if !exists("mojo_no_helpers") syn match perlStatementFiledesc "\<\%(app\|content\|content_for\|dumper\|extends\|flash\|include\|layout\|memorize\|param\|session\|stash\|url_for\|title\)\>" nextgroup=perlGenericBlock skipwhite contained " Tag helpers - syn match perlStatementFiledesc "\<\%(base_tag\|check_box\|file_field\|form_for\|hidden_field\|input_tag\|javascript\|link_to\|password_field\|radio_button\|select_field\|stylesheet\|submit_button\|tag\|text_area\|text_field\)\>" nextgroup=perlGenericBlock skipwhite contained + syn match perlStatementFiledesc "\<\%(base_tag\|check_box\|file_field\|form_for\|hidden_field\|input_tag\|javascript\|link_to\|password_field\|radio_button\|select_field\|stylesheet\|submit_button\|tag\|text_area\|text_field\)\>" nextgroup=perlGenericBlock skipwhite contained endif @@ -53,6 +53,7 @@ syn cluster htmlPreproc add=PerlInside command -nargs=+ HiLink hi def link HiLink MojoStart perlType +HiLink MojoSingleStart perlType HiLink MojoEnd perlType HiLink MojoFileName perlString HiLink MojoFileNameStart perlSpecial