jagmarz | 17 Aug 2012 10:48
Picon

Is syntax include too promiscuous on its cluster? Difficulties embedding perl syntax. (VIM version 7.3.487)

Folks,

I am trying to embed perl syntax, but it seems that somehow my new cluster contains definitions from the
perl.vim that were already contained.  I think that doesn't make sense, or at least, when I figured out to
remove them from the cluster, things started working:

  syntax include  <at> perlOnly syntax/perl.vim
  let b:current_syntax = "calibre"
  syntax cluster perlOnly remove=perlAnglesDQ,perlAnglesSQ,perlArrow,perlBracesDQ,perlBracesSQ,perlBracketsDQ,perlBracketsSQ,perlElseIfError,perlFiledescStatement,perlFiledescStatementComma,perlFiledescStatementNocomma,perlFormatField,perlFormatName,perlFunctionName,perlFunctionPRef,perlGenericBlock,perlMethod,perlNotEmptyLine,perlPackageRef,perlParensDQ,perlParensSQ,perlSpecialMatch,perlSpecialString,perlSpecialStringU,perlSpecialStringU2,perlStatementPackage,perlSubAttributes,perlSubAttributesCont,perlSubError,perlSubName,perlSubPrototype,perlSubPrototypeError,perlSubstitutionGQQ,perlSubstitutionSQ,perlTodo,perlTranslationGQ,perlVStringV,perlVarMember,perlVarSimpleMember,perlVarSimpleMemberName
  syntax region calibrePerl matchgroup=Structure start=/\[\[/ end=/\]\]/ contains= <at> perlOnly

The list of removed sections is created simply from

 grep "\<contained\>" perl.vim | while read line; do echo perl${line#*perl}}; done | cut -f 1 -d\  | sort -u |
tr "\\n" ","

The documentation states:

          All syntax items declared in the included file will have the
          "contained" flag added.  In addition, if a group list is specified,
          all top-level syntax items in the included file will be added to
          that list. >

So, if I'm reading that correctly (and I'm very new at this, I could be entirely in the wrong tree), it does
seem to imply that syntax elements that already have "contained" in the syntax included file should NOT be
placed in to the new list name.  This makes sense, I think, because they expect to be included ONLY in
regions/clusters/etc that are defined internally in the perl.vim file.  I suspect this revolves around
this in the perl.vim:

syn cluster perlTop             contains=TOP
(Continue reading)


Gmane