about summary refs log tree commit diff
path: root/Util
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2015-07-24 14:12:16 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2015-07-24 14:12:22 +0000
commit7f5ee59d8eafd71342d7caf891e0cfe31f7d3ec0 (patch)
tree193d859d1f4b3b6f5b0afe2bfd49ac8968ccca67 /Util
parenta8e18dc370eefac3919b8c1a92dbbb2c3e2cf08d (diff)
downloadzsh-7f5ee59d8eafd71342d7caf891e0cfe31f7d3ec0.tar.gz
zsh-7f5ee59d8eafd71342d7caf891e0cfe31f7d3ec0.tar.xz
zsh-7f5ee59d8eafd71342d7caf891e0cfe31f7d3ec0.zip
35809: zyodl.vim: Fix nested parentheses
Diffstat (limited to 'Util')
-rw-r--r--Util/zyodl.vim21
1 files changed, 14 insertions, 7 deletions
diff --git a/Util/zyodl.vim b/Util/zyodl.vim
index 94efb298d..b67bfa54e 100644
--- a/Util/zyodl.vim
+++ b/Util/zyodl.vim
@@ -22,8 +22,12 @@
 "   example(print *.c+LPAR()#q:s/#%+LPAR()#b+RPAR()s+LPAR()*+RPAR().c/'S${match[1]}.C'/+RPAR())
 "   ifzman(zmanref(zshmisc))ifnzman(noderef(Redirection))
 "   LPAR()foo 42 foo+RPAR()
+"   chapter(foo (foo) foo)
+"   chapter(foo (foo (foo) foo) foo) bar
+"
+"   sitem(foo)(foo (foo) foo)
+"   sitem(foo)(foo (foo) foo)
 "
-"   chapter(foo (foo) foo) # nested parentheses
 "   sitem(foo)(foo tt(foo) foo) # nested underline
 
 if exists("b:current_syntax")
@@ -33,25 +37,28 @@ endif
 "" Syntax groups:
 syn clear
 syn cluster zyodlInline contains=zyodlTt,zyodlVar,zyodlBold,zyodlEmph,zyodlCond
-syn region zyodlTt      start="\<tt("      end=")" contains=zyodlSpecial
-syn region zyodlVar     start="\<var("     end=")" contains=zyodlSpecial
-syn region zyodlBold    start="\<bf("      end=")" contains=zyodlSpecial
-syn region zyodlEmph    start="\<em("      end=")" contains=zyodlSpecial
+syn region zyodlTt      start="\<tt("      end=")" contains=zyodlSpecial,zyodlParenthetical
+syn region zyodlVar     start="\<var("     end=")" contains=zyodlSpecial,zyodlParenthetical
+syn region zyodlBold    start="\<bf("      end=")" contains=zyodlSpecial,zyodlParenthetical
+syn region zyodlEmph    start="\<em("      end=")" contains=zyodlSpecial,zyodlParenthetical
 syn region zyodlIndex   start="\<.index("  end=")" contains=zyodlSpecial
 syn match  zyodlSpecial "+\?\<\(LPAR\|RPAR\|PLUS\)()"
 syn match  zyodlNumber  "\d\+"
 syn region zyodlItem    start="\<xitem(" end=")" contains=zyodlSpecial,@zyodlInline
 syn region zyodlItem    start="\<item("  end=")" contains=zyodlSpecial,@zyodlInline
 syn region zyodlExample start="\<example(" end=")" contains=zyodlSpecial
-syn region zyodlTitle   start="\<\(chapter\|subsect\|sect\)(" end=")" contains=zyodlSpecial,@zyodlInline
+syn region zyodlTitle   start="\<\(chapter\|subsect\|sect\)(" end=")" contains=zyodlSpecial,@zyodlInline,zyodlParenthetical
 syn match  zyodlTitle   "^texinode(.*$"
+syn region zyodlParenthetical start="\w\@<!(" end=")" transparent contained contains=zyodlParenthetical
 
+" zyodlCond doesn't contain zyodlParenthetical, since section names (probably) don't have parentheticals.
 syn region zyodlCond    start="\<\(ifzman\|ifnzman\)(" end=")" contains=zyodlRef,zyodlSpecial,@zyodlInline
 syn region zyodlRef     start="\<\(zmanref\|noderef\)(" end=")"
 
+" zyodlSItemArg2 should use zyodlParenthetical instead of the 'skip='
 syn keyword zyodlKeyword sitem nextgroup=zyodlSItemArg1
 syn region zyodlSItemArg1 oneline start="(" end=")" contains=zyodlSpecial,@zyodlInline nextgroup=zyodlSItemArg2 contained
-syn region zyodlSItemArg2 start="(" end=")" contains=zyodlSpecial,@zyodlInline contained
+syn region zyodlSItemArg2 start="(" end=")" contains=zyodlSpecial,@zyodlInline contained skip="\w\@<!([^)]*)"
 
 "" Highlight groups:
 hi def link zyodlTt Constant