On Sun, 2007-10-21 at 03:45 +0300, Ilya Bobir wrote:
> Ed Catmur wrote:
> > [...]
> > 3. Marking escaped quotes as errors after parameter dereference
> > operators:
> >   
> >> echo ${foo+\"yes\"}
> >> echo ${foo+\'yes\'}
> >>     
> >
> > 4. Escaping close parens broken in case matches:
> >   
> >> case x in \));; esac
> >>     
> >
> > 5. Escaping quotes broken in lots of places:
> > echo \"hello\"
> > echo \'hello\'
> > echo \`hello\`
> >
> > [...]
> >   
> 
> \\\@<![something]
> 
> what means "[something] not preceded by a backslash" can be replaced with
> 
> \(^\|[^\\]\)\(\\\\\)*\zs[something]
> 
> what means "[something] not preceded be a non escaped backslash".
> 
> Here is a version without escaping and with some spaces, while it is not a 
> valid Vim regex it maybe easier to read:
> 
> ( ^ | [^\\] ) ( \\ \\ )* \zs [something]

Ah, thanks.

Actually, it turns out the problem was that \' etc. wasn't being
understood inside function definitions.  The attached fixes it by adding
shSpecial to shCommandSubList.

Ed.

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

--- vim71/runtime/syntax/sh.vim	2007/10/20 19:35:31	1.1
+++ vim71/runtime/syntax/sh.vim	2007/10/20 21:46:17
@@ -71,9 +71,9 @@ syn case match
 " Clusters: [EMAIL PROTECTED] clusters {{{1
 "==================================
 syn cluster shCaseEsacList	contains=shCaseStart,shCase,shCaseBar,shCaseIn,shComment,shDeref,shDerefSimple,shCaseCommandSub,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote,shCtrlSeq
-syn cluster shCaseList	[EMAIL PROTECTED],shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shCtrlSeq
+syn cluster shCaseList	[EMAIL PROTECTED],shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shRepeat,shSetList,shSource,shStatement,shVariable,shCtrlSeq
 syn cluster shColonList	[EMAIL PROTECTED]
-syn cluster shCommandSubList	contains=shArithmetic,shDeref,shDerefSimple,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq
+syn cluster shCommandSubList	contains=shArithmetic,shDeref,shDerefSimple,shNumber,shOperator,shPosnParm,shExSingleQuote,shSingleQuote,shDoubleQuote,shStatement,shVariable,shSubSh,shAlias,shTest,shCtrlSeq,shSpecial
 syn cluster shCurlyList	contains=shNumber,shComma,shDeref,shDerefSimple,shDerefSpecial
 syn cluster shDblQuoteList	contains=shCommandSub,shDeref,shDerefSimple,shPosnParm,shExSingleQuote,shCtrlSeq,shSpecial
 syn cluster shDerefList	contains=shDeref,shDerefSimple,shDerefVar,shDerefSpecial,shDerefWordError,shDerefPPS
@@ -81,7 +81,7 @@ syn cluster shDerefVarList	contains=shDe
 syn cluster shEchoList	contains=shArithmetic,shCommandSub,shDeref,shDerefSimple,shExpr,shExSingleQuote,shSingleQuote,shDoubleQuote,shCtrlSeq
 syn cluster shExprList1	contains=shCharClass,shNumber,shOperator,shExSingleQuote,shSingleQuote,shDoubleQuote,shExpr,shDblBrace,shDeref,shDerefSimple,shCtrlSeq
 syn cluster shExprList2	[EMAIL PROTECTED],@shCaseList,shTest
-syn cluster shFunctionList	[EMAIL PROTECTED],shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shSetList,shSource,shStatement,shVariable,shOperator,shFunctionStart,shCtrlSeq
+syn cluster shFunctionList	[EMAIL PROTECTED],shCaseEsac,shColon,shCommandSub,shCommandSub,shComment,shDo,shEcho,shExpr,shFor,shHereDoc,shIf,shRedir,shRepeat,shSetList,shSource,shStatement,shVariable,shOperator,shFunctionStart,shCtrlSeq
 if exists("b:is_kornshell") || exists("b:is_bash")
  syn cluster shFunctionList	add=shDblBrace,shDblParen
 endif
@@ -182,7 +182,6 @@ else
  syn region shFor	matchgroup=shLoop start="\<for\>" end="\<in\>" end="\<do\>"me=e-2	[EMAIL PROTECTED],shDblParen skipwhite nextgroup=shCurlyIn
 endif
 if exists("b:is_kornshell") || exists("b:is_bash")
- syn cluster shCaseList add=shRepeat
  syn region shRepeat   matchgroup=shLoop   start="\<while\>" end="\<in\>" end="\<do\>"me=e-2	[EMAIL PROTECTED],shDblParen,shDblBrace
  syn region shRepeat   matchgroup=shLoop   start="\<until\>" end="\<in\>" end="\<do\>"me=e-2	[EMAIL PROTECTED],shDblParen,shDblBrace
  syn region shCaseEsac matchgroup=shConditional start="\<select\>" matchgroup=shConditional end="\<in\>" end="\<do\>" [EMAIL PROTECTED]
@@ -195,9 +194,9 @@ syn match  shComma     contained	","
 
 " Case: case...esac {{{1
 " ====
-syn match   shCaseBar	contained skipwhite "[^|"`'()]\{-}|"hs=e		nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
+syn match   shCaseBar	contained skipwhite "\([^|"`'()\\]\|\\.\)\{-}|"hs=e		nextgroup=shCase,shCaseStart,shCaseBar,shComment,shCaseExSingleQuote,shCaseSingleQuote,shCaseDoubleQuote
 syn match   shCaseStart	contained skipwhite skipnl "("			nextgroup=shCase,shCaseBar
-syn region  shCase	contained skipwhite skipnl matchgroup=shSnglCase start="\([^#$()'" \t]\|\\.\)\{-})"ms=s,hs=e  end=";;" end="esac"me=s-1 [EMAIL PROTECTED] nextgroup=shCaseStart,shCase,shComment
+syn region  shCase	contained skipwhite skipnl matchgroup=shSnglCase start="\([^#$()'" \t\\]\|\\.\)\{-})"ms=s,hs=e  end=";;" end="esac"me=s-1 [EMAIL PROTECTED] nextgroup=shCaseStart,shCase,shComment
 if g:sh_fold_enabled
  syn region  shCaseEsac	fold matchgroup=shConditional start="\<case\>" end="\<esac\>"	[EMAIL PROTECTED]
 else
@@ -541,7 +539,6 @@ hi def link shFunctionKey		Function
 hi def link shFunctionName		Function
 hi def link shNumber		Number
 hi def link shOperator		Operator
-hi def link shRepeat		Repeat
 hi def link shSet		Statement
 hi def link shSetList		Identifier
 hi def link shShellVariables		PreProc

Raspunde prin e-mail lui