diff options
Diffstat (limited to 'runtime/syntax')
-rw-r--r-- | runtime/syntax/asm.vim | 17 | ||||
-rw-r--r-- | runtime/syntax/cabal.vim | 131 | ||||
-rw-r--r-- | runtime/syntax/chaiscript.vim | 94 | ||||
-rw-r--r-- | runtime/syntax/debchangelog.vim | 6 | ||||
-rw-r--r-- | runtime/syntax/debcontrol.vim | 16 | ||||
-rw-r--r-- | runtime/syntax/debsources.vim | 8 | ||||
-rw-r--r-- | runtime/syntax/java.vim | 69 | ||||
-rw-r--r-- | runtime/syntax/javascript.vim | 14 | ||||
-rw-r--r-- | runtime/syntax/lhaskell.vim | 5 | ||||
-rw-r--r-- | runtime/syntax/maple.vim | 6 | ||||
-rw-r--r-- | runtime/syntax/mib.vim | 8 | ||||
-rw-r--r-- | runtime/syntax/mysql.vim | 6 | ||||
-rw-r--r-- | runtime/syntax/obj.vim | 95 | ||||
-rw-r--r-- | runtime/syntax/perl.vim | 718 | ||||
-rw-r--r-- | runtime/syntax/perl6.vim | 2249 | ||||
-rw-r--r-- | runtime/syntax/rhelp.vim | 61 | ||||
-rw-r--r-- | runtime/syntax/sh.vim | 8 | ||||
-rw-r--r-- | runtime/syntax/sisu.vim | 168 | ||||
-rw-r--r-- | runtime/syntax/svg.vim | 15 | ||||
-rw-r--r-- | runtime/syntax/tex.vim | 6 | ||||
-rw-r--r-- | runtime/syntax/xs.vim | 69 |
21 files changed, 3195 insertions, 574 deletions
diff --git a/runtime/syntax/asm.vim b/runtime/syntax/asm.vim index 40756de95..6b8ce1ed5 100644 --- a/runtime/syntax/asm.vim +++ b/runtime/syntax/asm.vim @@ -3,7 +3,9 @@ " Maintainer: Erik Wognsen <erik.wognsen@gmail.com> " Previous maintainer: " Kevin Dahlhausen <kdahlhaus@yahoo.com> -" Last Change: 2010 Jan 9 +" Last Change: 2010 Apr 18 + +" Thanks to Ori Avtalion for feedback on the comment markers! " For version 5.x: Clear all syntax items " For version 6.0 and later: Quit when a syntax file was already loaded @@ -45,8 +47,16 @@ syn match octNumber "0[0-7][0-7]\+" syn match hexNumber "0[xX][0-9a-fA-F]\+" syn match binNumber "0[bB][0-1]*" -syn match asmComment "#.*" -syn region asmComment start="/\*" end="\*/" +syn keyword asmTodo contained TODO + +" GAS supports various comment markers as described here: +" http://sourceware.org/binutils/docs-2.19/as/Comments.html +" I have commented out the ARM comment marker "@" by default as I think more +" people are using "@" with the .type directive. See +" http://sourceware.org/binutils/docs-2.19/as/Type.html +syn region asmComment start="/\*" end="\*/" contains=asmTodo +syn match asmComment "[#;!|].*" contains=asmTodo +" syn match asmComment "@.*" contains=asmTodo syn match asmInclude "\.include" syn match asmCond "\.if" @@ -75,6 +85,7 @@ if version >= 508 || !exists("did_asm_syntax_inits") HiLink asmSection Special HiLink asmLabel Label HiLink asmComment Comment + HiLink asmTodo Todo HiLink asmDirective Statement HiLink asmInclude Include diff --git a/runtime/syntax/cabal.vim b/runtime/syntax/cabal.vim new file mode 100644 index 000000000..2a92aa835 --- /dev/null +++ b/runtime/syntax/cabal.vim @@ -0,0 +1,131 @@ +" Vim syntax file +" Language: Haskell Cabal Build file +" Maintainer: Vincent Berthoux <twinside@gmail.com> +" File Types: .cabal +" v1.3: Updated to the last version of cabal +" Added more highlighting for cabal function, true/false +" and version number. Also added missing comment highlighting. +" Cabal known compiler are highlighted too. +" +" V1.2: Added cpp-options which was missing. Feature implemented +" by GHC, found with a GHC warning, but undocumented. +" Whatever... +" +" v1.1: Fixed operator problems and added ftdetect file +" (thanks to Sebastian Schwarz) +" +" v1.0: Cabal syntax in vimball format +" (thanks to Magnus Therning) + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn keyword cabalCategory Library library Executable executable Flag flag +syn keyword cabalCategory source-repository Source-Repository + +syn keyword cabalConditional if else +syn match cabalOperator "&&\|||\|!\|==\|>=\|<=" +syn keyword cabalFunction os arche impl flag +syn match cabalComment /--.*$/ +syn match cabalVersion "\d\+\(.\(\d\)\+\)\+" + +syn match cabalTruth "\ctrue" +syn match cabalTruth "\cfalse" + +syn match cabalCompiler "\cghc" +syn match cabalCompiler "\cnhc" +syn match cabalCompiler "\cyhc" +syn match cabalCompiler "\chugs" +syn match cabalCompiler "\chbc" +syn match cabalCompiler "\chelium" +syn match cabalCompiler "\cjhc" +syn match cabalCompiler "\clhc" + + +syn match cabalStatement "\cauthor" +syn match cabalStatement "\cbranch" +syn match cabalStatement "\cbug-reports" +syn match cabalStatement "\cbuild-depends" +syn match cabalStatement "\cbuild-tools" +syn match cabalStatement "\cbuild-type" +syn match cabalStatement "\cbuildable" +syn match cabalStatement "\cc-sources" +syn match cabalStatement "\ccabal-version" +syn match cabalStatement "\ccategory" +syn match cabalStatement "\ccc-options" +syn match cabalStatement "\ccopyright" +syn match cabalStatement "\ccpp-options" +syn match cabalStatement "\cdata-dir" +syn match cabalStatement "\cdata-files" +syn match cabalStatement "\cdefault" +syn match cabalStatement "\cdescription" +syn match cabalStatement "\cexecutable" +syn match cabalStatement "\cexposed-modules" +syn match cabalStatement "\cexposed" +syn match cabalStatement "\cextensions" +syn match cabalStatement "\cextra-lib-dirs" +syn match cabalStatement "\cextra-libraries" +syn match cabalStatement "\cextra-source-files" +syn match cabalStatement "\cextra-tmp-files" +syn match cabalStatement "\cfor example" +syn match cabalStatement "\cframeworks" +syn match cabalStatement "\cghc-options" +syn match cabalStatement "\cghc-prof-options" +syn match cabalStatement "\cghc-shared-options" +syn match cabalStatement "\chomepage" +syn match cabalStatement "\chs-source-dirs" +syn match cabalStatement "\chugs-options" +syn match cabalStatement "\cinclude-dirs" +syn match cabalStatement "\cincludes" +syn match cabalStatement "\cinstall-includes" +syn match cabalStatement "\cld-options" +syn match cabalStatement "\clicense-file" +syn match cabalStatement "\clicense" +syn match cabalStatement "\clocation" +syn match cabalStatement "\cmain-is" +syn match cabalStatement "\cmaintainer" +syn match cabalStatement "\cmodule" +syn match cabalStatement "\cname" +syn match cabalStatement "\cnhc98-options" +syn match cabalStatement "\cother-modules" +syn match cabalStatement "\cpackage-url" +syn match cabalStatement "\cpkgconfig-depends" +syn match cabalStatement "\cstability" +syn match cabalStatement "\csubdir" +syn match cabalStatement "\csynopsis" +syn match cabalStatement "\ctag" +syn match cabalStatement "\ctested-with" +syn match cabalStatement "\ctype" +syn match cabalStatement "\cversion" + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_cabal_syn_inits") + if version < 508 + let did_cabal_syn_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink cabalVersion Number + HiLink cabalTruth Boolean + HiLink cabalComment Comment + HiLink cabalStatement Statement + HiLink cabalCategory Type + HiLink cabalFunction Function + HiLink cabalConditional Conditional + HiLink cabalOperator Operator + HiLink cabalCompiler Constant + delcommand HiLink +endif + +let b:current_syntax = "cabal" + +" vim: ts=8 diff --git a/runtime/syntax/chaiscript.vim b/runtime/syntax/chaiscript.vim new file mode 100644 index 000000000..5a64bdb55 --- /dev/null +++ b/runtime/syntax/chaiscript.vim @@ -0,0 +1,94 @@ +" Vim syntax file +" Language: ChaiScript +" Maintainer: Jason Turner <lefticus 'at' gmail com> + +" Quit when a (custom) syntax file was already loaded +if exists("b:current_syntax") + finish +end + +syn case match + +" syncing method +syn sync fromstart + +" Strings +syn region chaiscriptString start=+"+ end=+"+ skip=+\\\\\|\\"+ contains=chaiscriptSpecial,chaiscriptEval,@Spell + +" Escape characters +syn match chaiscriptSpecial contained "\\[\\abfnrtv\'\"]\|\\\d\{,3}" + +" String evals +syn region chaiscriptEval contained start="${" end="}" + +" integer number +syn match chaiscriptNumber "\<\d\+\>" + +" floating point number, with dot, optional exponent +syn match chaiscriptFloat "\<\d\+\.\d*\%(e[-+]\=\d\+\)\=\>" + +" floating point number, starting with a dot, optional exponent +syn match chaiscriptFloat "\.\d\+\%(e[-+]\=\d\+\)\=\>" + +" floating point number, without dot, with exponent +syn match chaiscriptFloat "\<\d\+e[-+]\=\d\+\>" + +" Hex strings +syn match chaiscriptNumber "\<0x\x\+\>" + +" Binary strings +syn match chaiscriptNumber "\<0b[01]\+\>" + +" Various language features +syn keyword chaiscriptCond if else +syn keyword chaiscriptRepeat while for do +syn keyword chaiscriptStatement break continue return +syn keyword chaiscriptExceptions try catch throw + +"Keyword +syn keyword chaiscriptKeyword def true false attr + +"Built in types +syn keyword chaiscriptType fun var + +"Built in funcs, keep it simple +syn keyword chaiscriptFunc eval throw + +"Let's treat all backtick operator function lookups as built in too +syn region chaiscriptFunc matchgroup=chaiscriptFunc start="`" end="`" + +" Account for the "[1..10]" syntax, treating it as an operator +" Intentionally leaving out all of the normal, well known operators +syn match chaiscriptOperator "\.\." + +" Guard seperator as an operator +syn match chaiscriptOperator ":" + +" Comments +syn match chaiscriptComment "//.*$" contains=@Spell +syn region chaiscriptComment matchgroup=chaiscriptComment start="/\*" end="\*/" contains=@Spell + + + +hi def link chaiscriptExceptions Exception +hi def link chaiscriptKeyword Keyword +hi def link chaiscriptStatement Statement +hi def link chaiscriptRepeat Repeat +hi def link chaiscriptString String +hi def link chaiscriptNumber Number +hi def link chaiscriptFloat Float +hi def link chaiscriptOperator Operator +hi def link chaiscriptConstant Constant +hi def link chaiscriptCond Conditional +hi def link chaiscriptFunction Function +hi def link chaiscriptComment Comment +hi def link chaiscriptTodo Todo +hi def link chaiscriptError Error +hi def link chaiscriptSpecial SpecialChar +hi def link chaiscriptFunc Identifier +hi def link chaiscriptType Type +hi def link chaiscriptEval Special + +let b:current_syntax = "chaiscript" + +" vim: nowrap sw=2 sts=2 ts=8 noet diff --git a/runtime/syntax/debchangelog.vim b/runtime/syntax/debchangelog.vim index 040d48d0f..e808c8f63 100644 --- a/runtime/syntax/debchangelog.vim +++ b/runtime/syntax/debchangelog.vim @@ -3,8 +3,8 @@ " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainers: Gerfried Fuchs <alfie@ist.org> " Wichert Akkerman <wakkerma@debian.org> -" Last Change: 2009 Jun 05 -" URL: http://git.debian.org/?p=pkg-vim/vim.git;a=blob_plain;f=runtime/syntax/debchangelog.vim;hb=debian +" Last Change: 2010 May 06 +" URL: http://hg.debian.org/hg/pkg-vim/vim/raw-file/tip/runtime/syntax/debchangelog.vim " Standard syntax initialization if version < 600 @@ -19,7 +19,7 @@ syn case ignore " Define some common expressions we can use later on syn match debchangelogName contained "^[[:alnum:]][[:alnum:].+-]\+ " syn match debchangelogUrgency contained "; urgency=\(low\|medium\|high\|critical\|emergency\)\( \S.*\)\=" -syn match debchangelogTarget contained "\v %(frozen|unstable|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|%(etch|lenny)-%(backports|volatile)|%(dapper|hardy|intrepid|jaunty|karmic)%(-%(security|proposed|updates|backports|commercial|partner))=)+" +syn match debchangelogTarget contained "\v %(frozen|unstable|%(testing|%(old)=stable)%(-proposed-updates|-security)=|experimental|%(etch|lenny)-%(backports|volatile)|%(dapper|hardy|jaunty|karmic|lucid|maverick)%(-%(security|proposed|updates|backports|commercial|partner))=)+" syn match debchangelogVersion contained "(.\{-})" syn match debchangelogCloses contained "closes:\_s*\(bug\)\=#\=\_s\=\d\+\(,\_s*\(bug\)\=#\=\_s\=\d\+\)*" syn match debchangelogLP contained "\clp:\s\+#\d\+\(,\s*#\d\+\)*" diff --git a/runtime/syntax/debcontrol.vim b/runtime/syntax/debcontrol.vim index e886f0147..73407328f 100644 --- a/runtime/syntax/debcontrol.vim +++ b/runtime/syntax/debcontrol.vim @@ -1,14 +1,10 @@ " Vim syntax file -" Language: Debian control files +" Language: Debian control files " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainers: Gerfried Fuchs <alfie@ist.org> " Wichert Akkerman <wakkerma@debian.org> -" Last Change: 2009 July 14 -" URL: http://git.debian.org/?p=pkg-vim/vim.git;a=blob_plain;f=runtime/ftplugin/debcontrol.vim;hb=debian - -" Comments are very welcome - but please make sure that you are commenting on -" the latest version of this file. -" SPAM is _NOT_ welcome - be ready to be reported! +" Last Change: 2009 Aug 17 +" URL: http://hg.debian.org/hg/pkg-vim/vim/raw-file/tip/runtime/syntax/debcontrol.vim " Standard syntax initialization if version < 600 @@ -28,7 +24,7 @@ syn match debControlComma ", *" syn match debControlSpace " " " Define some common expressions we can use later on -syn match debcontrolArchitecture contained "\(all\|any\|alpha\|amd64\|arm\(e[bl]\)\=\|avr32\|hppa\|i386\|ia64\|m32r\|m68k\|mipsel\|mips\|powerpc\|ppc64\|s390x\=\|sh[34]\(eb\)\=\|sh\|sparc64\|sparc\|hurd-i386\|kfreebsd-\(i386\|amd64\|gnu\)\|knetbsd-i386\|netbsd-\(alpha\|i386\)\)" +syn match debcontrolArchitecture contained "\%(all\|any\|alpha\|amd64\|arm\%(e[bl]\)\=\|avr32\|hppa\|i386\|ia64\|lpia\|m32r\|m68k\|mips\%(el\)\=\|powerpc\|ppc64\|s390x\=\|sh[34]\(eb\)\=\|sh\|sparc\%(64\)\=\|hurd-i386\|kfreebsd-\%(i386\|amd64\|gnu\)\|knetbsd-i386\|kopensolaris-i386\|netbsd-\%(alpha\|i386\)\)" syn match debcontrolName contained "[a-z0-9][a-z0-9+.-]\+" syn match debcontrolPriority contained "\(extra\|important\|optional\|required\|standard\)" syn match debcontrolSection contained "\v((contrib|non-free|non-US/main|non-US/contrib|non-US/non-free|restricted|universe|multiverse)/)?(admin|cli-mono|comm|database|debian-installer|debug|devel|doc|editors|electronics|embedded|fonts|games|gnome|gnustep|gnu-r|graphics|hamradio|haskell|httpd|interpreters|java|kde|kernel|libs|libdevel|lisp|localization|mail|math|misc|net|news|ocaml|oldlibs|otherosfs|perl|php|python|ruby|science|shells|sound|text|tex|utils|vcs|video|web|x11|xfce|zope)" @@ -53,7 +49,7 @@ syn match debcontrolComment "^#.*$" syn case ignore " List of all legal keys -syn match debcontrolKey contained "^\%(Source\|Package\|Section\|Priority\|\%(XSBC-Original-\)\=Maintainer\|Uploaders\|Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|Standards-Version\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Essential\|Architecture\|Description\|Bugs\|Origin\|X[SB]-Python-Version\|Homepage\|\(XS-\)\=Vcs-\(Browser\|Arch\|Bzr\|Cvs\|Darcs\|Git\|Hg\|Mtn\|Svn\)\|XC-Package-Type\|\%(XS-\)\=DM-Upload-Allowed\): *" +syn match debcontrolKey contained "^\%(Source\|Package\|Section\|Priority\|\%(XSBC-Original-\)\=Maintainer\|Uploaders\|Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|Standards-Version\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Essential\|Architecture\|Description\|Bugs\|Origin\|X[SB]-Python-Version\|Homepage\|\(XS-\)\=Vcs-\(Browser\|Arch\|Bzr\|Cvs\|Darcs\|Git\|Hg\|Mtn\|Svn\)\|XC-Package-Type\|\%(XS-\)\=DM-Upload-Allowed\): *" " Fields for which we do strict syntax checking syn region debcontrolStrictField start="^Architecture" end="$" contains=debcontrolKey,debcontrolArchitecture,debcontrolSpace oneline @@ -70,7 +66,7 @@ syn region debcontrolStrictField start="^\%(XS-\)\=DM-Upload-Allowed" end="$" co " Catch-all for the other legal fields syn region debcontrolField start="^\%(\%(XSBC-Original-\)\=Maintainer\|Standards-Version\|Essential\|Bugs\|Origin\|X[SB]-Python-Version\|\%(XS-\)\=Vcs-Mtn\):" end="$" contains=debcontrolKey,debcontrolVariable,debcontrolEmail oneline -syn region debcontrolMultiField start="^\%(Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Uploaders\|Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment +syn region debcontrolMultiField start="^\%(Build-\%(Conflicts\|Depends\)\%(-Indep\)\=\|\%(Pre-\)\=Depends\|Recommends\|Suggests\|Provides\|Replaces\|Conflicts\|Enhances\|Breaks\|Uploaders\|Description\):" skip="^ " end="^$"me=s-1 end="^[^ #]"me=s-1 contains=debcontrolKey,debcontrolEmail,debcontrolVariable,debcontrolComment " Associate our matches and regions with pretty colours if version >= 508 || !exists("did_debcontrol_syn_inits") diff --git a/runtime/syntax/debsources.vim b/runtime/syntax/debsources.vim index 52ce6d733..bd5398197 100644 --- a/runtime/syntax/debsources.vim +++ b/runtime/syntax/debsources.vim @@ -2,8 +2,8 @@ " Language: Debian sources.list " Maintainer: Debian Vim Maintainers <pkg-vim-maintainers@lists.alioth.debian.org> " Former Maintainer: Matthijs Mohlmann <matthijs@cacholong.nl> -" Last Change: 2009 Apr 17 -" URL: http://git.debian.org/?p=pkg-vim/vim.git;a=blob_plain;f=runtime/syntax/debsources.vim;hb=debian +" Last Change: 2010 May 06 +" URL: http://hg.debian.org/hg/pkg-vim/vim/raw-file/tip/runtime/syntax/debsources.vim " Standard syntax initialization if version < 600 @@ -23,7 +23,7 @@ syn match debsourcesComment /#.*/ contains=@Spell " Match uri's syn match debsourcesUri +\(http://\|ftp://\|[rs]sh://\|debtorrent://\|\(cdrom\|copy\|file\):\)[^' <>"]\++ -syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\(etch\|lenny\|squeeze\|\(old\)\=stable\|testing\|unstable\|sid\|experimental\|dapper\|hardy\|intrepid\|jaunty\|karmic\)\([-[:alnum:]_./]*\)+ +syn match debsourcesDistrKeyword +\([[:alnum:]_./]*\)\(etch\|lenny\|squeeze\|\(old\)\=stable\|testing\|unstable\|sid\|rc-buggy\|experimental\|dapper\|hardy\|jaunty\|karmic\|lucid\|maverick\)\([-[:alnum:]_./]*\)+ " Associate our matches and regions with pretty colours hi def link debsourcesLine Error @@ -33,5 +33,3 @@ hi def link debsourcesComment Comment hi def link debsourcesUri Constant let b:current_syntax = "debsources" - -" vim: ts=8 diff --git a/runtime/syntax/java.vim b/runtime/syntax/java.vim index 18e4532d2..d11afa8b6 100644 --- a/runtime/syntax/java.vim +++ b/runtime/syntax/java.vim @@ -1,8 +1,7 @@ -" Vim syntax file -" Language: Java -" Maintainer: Claudio Fleiner <claudio@fleiner.com> +" Vim syntax file " Language: Java +" Maintainer: Claudio Fleiner <claudio@fleiner.com> " URL: http://www.fleiner.com/vim/syntax/java.vim -" Last Change: 2009 Mar 14 +" Last Change: 2010 March 23 " Please check :help java.vim for comments on some of the options available. @@ -59,8 +58,8 @@ syn match javaTypedef "\.\s*\<class\>"ms=s+1 syn keyword javaClassDecl enum syn match javaClassDecl "^class\>" syn match javaClassDecl "[^.]\s*\<class\>"ms=s+1 -syn match javaAnnotation "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>" -syn match javaClassDecl "@interface\>" +syn match javaAnnotation "@\([_$a-zA-Z][_$a-zA-Z0-9]*\.\)*[_$a-zA-Z][_$a-zA-Z0-9]*\>" +syn match javaClassDecl "@interface\>" syn keyword javaBranch break continue nextgroup=javaUserLabelRef skipwhite syn match javaUserLabelRef "\k\+" contained syn match javaVarArg "\.\.\." @@ -69,7 +68,7 @@ syn keyword javaScopeDecl public protected private abstract if exists("java_highlight_java_lang_ids") let java_highlight_all=1 endif -if exists("java_highlight_all") || exists("java_highlight_java") || exists("java_highlight_java_lang") +if exists("java_highlight_all") || exists("java_highlight_java") || exists("java_highlight_java_lang") " java.lang.* syn match javaLangClass "\<System\>" syn keyword javaR_JavaLang NegativeArraySizeException ArrayStoreException IllegalStateException RuntimeException IndexOutOfBoundsException UnsupportedOperationException ArrayIndexOutOfBoundsException ArithmeticException ClassCastException EnumConstantNotPresentException StringIndexOutOfBoundsException IllegalArgumentException IllegalMonitorStateException IllegalThreadStateException NumberFormatException NullPointerException TypeNotPresentException SecurityException @@ -110,15 +109,15 @@ endif if exists("java_space_errors") if !exists("java_no_trail_space_error") - syn match javaSpaceError "\s\+$" + syn match javaSpaceError "\s\+$" endif if !exists("java_no_tab_space_error") - syn match javaSpaceError " \+\t"me=e-1 + syn match javaSpaceError " \+\t"me=e-1 endif endif -syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":" contains=javaNumber,javaCharacter -syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel +syn region javaLabelRegion transparent matchgroup=javaLabel start="\<case\>" matchgroup=NONE end=":" contains=javaNumber,javaCharacter +syn match javaUserLabel "^\s*[_$a-zA-Z][_$a-zA-Z0-9_]*\s*:"he=e-1 contains=javaLabel syn keyword javaLabel default if !exists("java_allow_cpp_keywords") @@ -135,7 +134,7 @@ syn cluster javaTop add=javaExternal,javaError,javaError,javaBranch,javaLabelReg syn keyword javaTodo contained TODO FIXME XXX if exists("java_comment_strings") syn region javaCommentString contained start=+"+ end=+"+ end=+$+ end=+\*/+me=s-1,he=s-1 contains=javaSpecial,javaCommentStar,javaSpecialChar,@Spell - syn region javaComment2String contained start=+"+ end=+$\|"+ contains=javaSpecial,javaSpecialChar,@Spell + syn region javaComment2String contained start=+"+ end=+$\|"+ contains=javaSpecial,javaSpecialChar,@Spell syn match javaCommentCharacter contained "'\\[^']\{1,6\}'" contains=javaSpecialChar syn match javaCommentCharacter contained "'\\''" contains=javaSpecialChar syn match javaCommentCharacter contained "'[^\\]'" @@ -143,9 +142,9 @@ if exists("java_comment_strings") syn cluster javaCommentSpecial2 add=javaComment2String,javaCommentCharacter,javaNumber endif syn region javaComment start="/\*" end="\*/" contains=@javaCommentSpecial,javaTodo,@Spell -syn match javaCommentStar contained "^\s*\*[^/]"me=e-1 -syn match javaCommentStar contained "^\s*\*$" -syn match javaLineComment "//.*" contains=@javaCommentSpecial2,javaTodo,@Spell +syn match javaCommentStar contained "^\s*\*[^/]"me=e-1 +syn match javaCommentStar contained "^\s*\*$" +syn match javaLineComment "//.*" contains=@javaCommentSpecial2,javaTodo,@Spell JavaHiLink javaCommentString javaString JavaHiLink javaComment2String javaString JavaHiLink javaCommentCharacter javaCharacter @@ -162,14 +161,14 @@ if !exists("java_ignore_javadoc") && main_syntax != 'jsp' " here. syntax spell default - syn region javaDocComment start="/\*\*" end="\*/" keepend contains=javaCommentTitle,@javaHtml,javaDocTags,javaDocSeeTag,javaTodo,@Spell - syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*" matchgroup=javaCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,@Spell,javaDocTags,javaDocSeeTag + syn region javaDocComment start="/\*\*" end="\*/" keepend contains=javaCommentTitle,@javaHtml,javaDocTags,javaDocSeeTag,javaTodo,@Spell + syn region javaCommentTitle contained matchgroup=javaDocComment start="/\*\*" matchgroup=javaCommentTitle keepend end="\.$" end="\.[ \t\r<&]"me=e-1 end="[^{]@"me=s-2,he=s-1 end="\*/"me=s-1,he=s-1 contains=@javaHtml,javaCommentStar,javaTodo,@Spell,javaDocTags,javaDocSeeTag - syn region javaDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" - syn match javaDocTags contained "@\(param\|exception\|throws\|since\)\s\+\S\+" contains=javaDocParam - syn match javaDocParam contained "\s\S\+" - syn match javaDocTags contained "@\(version\|author\|return\|deprecated\|serial\|serialField\|serialData\)\>" - syn region javaDocSeeTag contained matchgroup=javaDocTags start="@see\s\+" matchgroup=NONE end="\_."re=e-1 contains=javaDocSeeTagParam + syn region javaDocTags contained start="{@\(link\|linkplain\|inherit[Dd]oc\|doc[rR]oot\|value\)" end="}" + syn match javaDocTags contained "@\(param\|exception\|throws\|since\)\s\+\S\+" contains=javaDocParam + syn match javaDocParam contained "\s\S\+" + syn match javaDocTags contained "@\(version\|author\|return\|deprecated\|serial\|serialField\|serialData\)\>" + syn region javaDocSeeTag contained matchgroup=javaDocTags start="@see\s\+" matchgroup=NONE end="\_."re=e-1 contains=javaDocSeeTagParam syn match javaDocSeeTagParam contained @"\_[^"]\+"\|<a\s\+\_.\{-}</a>\|\(\k\|\.\)*\(#\k\+\((\_[^)]\+)\)\=\)\=@ extend syntax case match endif @@ -178,9 +177,9 @@ endif syn match javaComment "/\*\*/" " Strings and constants -syn match javaSpecialError contained "\\." +syn match javaSpecialError contained "\\." syn match javaSpecialCharError contained "[^']" -syn match javaSpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\+\x\{4\}\)" +syn match javaSpecialChar contained "\\\([4-9]\d\|[0-3]\d\d\|[\"\\'ntbrf]\|u\x\{4\}\)" syn region javaString start=+"+ end=+"+ end=+$+ contains=javaSpecialChar,javaSpecialError,@Spell " next line disabled, it can cause a crash for a long line "syn match javaStringError +"\([^"\\]\|\\.\)*$+ @@ -193,7 +192,7 @@ syn match javaNumber "\<\d\+[eE][-+]\=\d\+[fFdD]\=\>" syn match javaNumber "\<\d\+\([eE][-+]\=\d\+\)\=[fFdD]\>" " unicode characters -syn match javaSpecial "\\u\+\d\{4\}" +syn match javaSpecial "\\u\d\{4\}" syn cluster javaTop add=javaString,javaCharacter,javaNumber,javaSpecial,javaStringError @@ -206,8 +205,8 @@ if exists("java_highlight_functions") else " This line catches method declarations at any indentation>0, but it assumes " two things: - " 1. class names are always capitalized (ie: Button) - " 2. method names are never capitalized (except constructors, of course) + " 1. class names are always capitalized (ie: Button) + " 2. method names are never capitalized (except constructors, of course) syn region javaFuncDef start=+^\s\+\(\(public\|protected\|private\|static\|abstract\|final\|native\|synchronized\)\s\+\)*\(\(void\|boolean\|char\|byte\|short\|int\|long\|float\|double\|\([A-Za-z_][A-Za-z0-9_$]*\.\)*[A-Z][A-Za-z0-9_$]*\)\(<[^>]*>\)\=\(\[\]\)*\s\+[a-z][A-Za-z0-9_$]*\|[A-Z][A-Za-z0-9_$]*\)\s*([^0-9]+ end=+)+ contains=javaScopeDecl,javaType,javaStorageClass,javaComment,javaLineComment,@javaClasses endif syn match javaBraces "[{}]" @@ -219,7 +218,7 @@ if exists("java_highlight_debug") " Strings and constants syn match javaDebugSpecial contained "\\\d\d\d\|\\." syn region javaDebugString contained start=+"+ end=+"+ contains=javaDebugSpecial - syn match javaDebugStringError +"\([^"\\]\|\\.\)*$+ + syn match javaDebugStringError +"\([^"\\]\|\\.\)*$+ syn match javaDebugCharacter contained "'[^\\]'" syn match javaDebugSpecialCharacter contained "'\\.'" syn match javaDebugSpecialCharacter contained "'\\''" @@ -265,17 +264,17 @@ if exists("java_mark_braces_in_parens_as_errors") endif " catch errors caused by wrong parenthesis -syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaParenT1 +syn region javaParenT transparent matchgroup=javaParen start="(" end=")" contains=@javaTop,javaParenT1 syn region javaParenT1 transparent matchgroup=javaParen1 start="(" end=")" contains=@javaTop,javaParenT2 contained syn region javaParenT2 transparent matchgroup=javaParen2 start="(" end=")" contains=@javaTop,javaParenT contained -syn match javaParenError ")" +syn match javaParenError ")" " catch errors caused by wrong square parenthesis -syn region javaParenT transparent matchgroup=javaParen start="\[" end="\]" contains=@javaTop,javaParenT1 +syn region javaParenT transparent matchgroup=javaParen start="\[" end="\]" contains=@javaTop,javaParenT1 syn region javaParenT1 transparent matchgroup=javaParen1 start="\[" end="\]" contains=@javaTop,javaParenT2 contained syn region javaParenT2 transparent matchgroup=javaParen2 start="\[" end="\]" contains=@javaTop,javaParenT contained -syn match javaParenError "\]" +syn match javaParenError "\]" -JavaHiLink javaParenError javaError +JavaHiLink javaParenError javaError if !exists("java_minlines") let java_minlines = 10 @@ -288,7 +287,7 @@ if version >= 508 || !exists("did_java_syn_inits") let did_java_syn_inits = 1 endif JavaHiLink javaFuncDef Function - JavaHiLink javaVarArg Function + JavaHiLink javaVarArg Function JavaHiLink javaBraces Function JavaHiLink javaBranch Conditional JavaHiLink javaUserLabelRef javaUserLabel @@ -320,7 +319,7 @@ if version >= 508 || !exists("did_java_syn_inits") JavaHiLink javaConstant Constant JavaHiLink javaTypedef Typedef JavaHiLink javaTodo Todo - JavaHiLink javaAnnotation PreProc + JavaHiLink javaAnnotation PreProc JavaHiLink javaCommentTitle SpecialComment JavaHiLink javaDocTags Special diff --git a/runtime/syntax/javascript.vim b/runtime/syntax/javascript.vim index ba8975bc9..b293eb806 100644 --- a/runtime/syntax/javascript.vim +++ b/runtime/syntax/javascript.vim @@ -7,7 +7,7 @@ " (ss) repaired several quoting and grouping glitches " (ss) fixed regex parsing issue with multiple qualifiers [gi] " (ss) additional factoring of keywords, globals, and members -" Last Change: 2006 Jun 19 +" Last Change: 2010 Mar 25 " For version 5.x: Clear all syntax items " For version 6.x: Quit when a syntax file was already loaded @@ -28,16 +28,14 @@ if version < 600 && exists("javaScript_fold") unlet javaScript_fold endif -syn case ignore - syn keyword javaScriptCommentTodo TODO FIXME XXX TBD contained syn match javaScriptLineComment "\/\/.*" contains=@Spell,javaScriptCommentTodo syn match javaScriptCommentSkip "^[ \t]*\*\($\|[ \t]\+\)" syn region javaScriptComment start="/\*" end="\*/" contains=@Spell,javaScriptCommentTodo syn match javaScriptSpecial "\\\d\d\d\|\\." -syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc -syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc +syn region javaScriptStringD start=+"+ skip=+\\\\\|\\"+ end=+"\|$+ contains=javaScriptSpecial,@htmlPreproc +syn region javaScriptStringS start=+'+ skip=+\\\\\|\\'+ end=+'\|$+ contains=javaScriptSpecial,@htmlPreproc syn match javaScriptSpecialCharacter "'\\.'" syn match javaScriptNumber "-\=\<\d\+L\=\>\|0[xX][0-9a-fA-F]\+\>" @@ -51,7 +49,7 @@ syn keyword javaScriptType Array Boolean Date Function Number Object String Reg syn keyword javaScriptStatement return with syn keyword javaScriptBoolean true false syn keyword javaScriptNull null undefined -syn keyword javaScriptIdentifier arguments this var +syn keyword javaScriptIdentifier arguments this var let syn keyword javaScriptLabel case default syn keyword javaScriptException try catch finally throw syn keyword javaScriptMessage alert confirm prompt status @@ -61,7 +59,7 @@ syn keyword javaScriptDeprecated escape unescape syn keyword javaScriptReserved abstract boolean byte char class const debugger double enum export extends final float goto implements import int interface long native package private protected public short static super synchronized throws transient volatile if exists("javaScript_fold") - syn match javaScriptFunction "\<function\>" + syn match javaScriptFunction "\<function\>" syn region javaScriptFunctionFold start="\<function\>.*[^};]$" end="^\z1}.*$" transparent fold keepend syn sync match javaScriptSync grouphere javaScriptFunctionFold "\<function\>" @@ -70,7 +68,7 @@ if exists("javaScript_fold") setlocal foldmethod=syntax setlocal foldtext=getline(v:foldstart) else - syn keyword javaScriptFunction function + syn keyword javaScriptFunction function syn match javaScriptBraces "[{}\[\]]" syn match javaScriptParens "[()]" endif diff --git a/runtime/syntax/lhaskell.vim b/runtime/syntax/lhaskell.vim index 8cc1ded01..077549a0c 100644 --- a/runtime/syntax/lhaskell.vim +++ b/runtime/syntax/lhaskell.vim @@ -4,7 +4,7 @@ " \begin{code} \end{code} blocks " Maintainer: Haskell Cafe mailinglist <haskell-cafe@haskell.org> " Original Author: Arthur van Leeuwen <arthurvl@cs.uu.nl> -" Last Change: 2009 May 08 +" Last Change: 2010 Apr 11 " Version: 1.04 " " Thanks to Ian Lynagh for thoughtful comments on initial versions and @@ -107,13 +107,12 @@ else endif syntax region lhsHaskellBirdTrack start="^>" end="\%(^[^>]\)\@=" contains=@haskellTop,lhsBirdTrack containedin=@lhsTeXContainer -syntax region lhsHaskellBeginEndBlock start="^\\begin{code}\s*$" matchgroup=NONE end="\%(^\\end{code}.*$\)\@=" contains=@haskellTop,@beginCode containedin=@lhsTeXContainer +syntax region lhsHaskellBeginEndBlock start="^\\begin{code}\s*$" matchgroup=NONE end="\%(^\\end{code}.*$\)\@=" contains=@haskellTop,beginCodeBegin containedin=@lhsTeXContainer syntax match lhsBirdTrack "^>" contained syntax match beginCodeBegin "^\\begin" nextgroup=beginCodeCode contained syntax region beginCodeCode matchgroup=texDelimiter start="{" end="}" -syntax cluster beginCode contains=beginCodeBegin,beginCodeCode " Define the default highlighting. " For version 5.7 and earlier: only when not done already diff --git a/runtime/syntax/maple.vim b/runtime/syntax/maple.vim index 37abf16fa..b6e4ae924 100644 --- a/runtime/syntax/maple.vim +++ b/runtime/syntax/maple.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: Maple V (based on release 4) " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> -" Last Change: Sep 11, 2006 -" Version: 9 +" Last Change: Jan 05, 2010 +" Version: 10 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " " Package Function Selection: {{{1 @@ -164,9 +164,11 @@ syn match mvError "\.\.\." " Split into booleans, conditionals, operators, repeat-logic, etc syn keyword mvBool true false FAIL syn keyword mvCond elif else fi if then +syn match mvCond "end\s\+if" syn keyword mvRepeat by for in to syn keyword mvRepeat do from od while +syn match mvRepeat "end\s\+do" syn keyword mvSpecial NULL syn match mvSpecial "\[\]\|{}" diff --git a/runtime/syntax/mib.vim b/runtime/syntax/mib.vim index 2a8a73f61..6062d50bc 100644 --- a/runtime/syntax/mib.vim +++ b/runtime/syntax/mib.vim @@ -3,13 +3,13 @@ " Maintainer: Martin Smat <msmat@post.cz> " Original Author: David Pascoe <pascoedj@spamcop.net> " Written: Wed Jan 28 14:37:23 GMT--8:00 1998 -" Last Changed: Mon Mar 15 2010 +" Last Changed: Mon Mar 23 2010 if exists("b:current_syntax") finish endif -setlocal iskeyword=@,48-57,_,128-167,224-235,-,:,= +setlocal iskeyword=@,48-57,_,128-167,224-235,- syn keyword mibImplicit ACCESS ANY AUGMENTS BEGIN BIT BITS BOOLEAN CHOICE syn keyword mibImplicit COMPONENTS CONTACT-INFO DEFINITIONS DEFVAL @@ -22,7 +22,7 @@ syn keyword mibImplicit NULL OBJECT-GROUP OBJECT-IDENTITY OBJECT-TYPE syn keyword mibImplicit OBJECTS OF OPTIONAL ORGANIZATION REFERENCE syn keyword mibImplicit REVISION SEQUENCE SET SIZE STATUS SYNTAX syn keyword mibImplicit TEXTUAL-CONVENTION TRAP-TYPE TRUE UNITS VARIABLES -syn keyword mibImplicit WRITE-SYNTAX ::= +syn keyword mibImplicit WRITE-SYNTAX syn keyword mibValue accessible-for-notify current DisplayString syn keyword mibValue deprecated mandatory not-accessible obsolete optional syn keyword mibValue read-create read-only read-write write-only INTEGER @@ -40,11 +40,13 @@ syn keyword mibEpilogue test-function-async next-function next-function-async syn keyword mibEpilogue leaf-name syn keyword mibEpilogue DEFAULT contained +syn match mibOperator "::=" syn match mibComment "\ *--.\{-}\(--\|$\)" syn match mibNumber "\<['0-9a-fA-FhH]*\>" syn region mibDescription start="\"" end="\"" contains=DEFAULT hi def link mibImplicit Statement +hi def link mibOperator Statement hi def link mibComment Comment hi def link mibConstants String hi def link mibNumber Number diff --git a/runtime/syntax/mysql.vim b/runtime/syntax/mysql.vim index 86a6c07cb..c01ecc192 100644 --- a/runtime/syntax/mysql.vim +++ b/runtime/syntax/mysql.vim @@ -1,7 +1,7 @@ " Vim syntax file " Language: mysql " Maintainer: Kenneth J. Pronovici <pronovic@ieee.org> -" Last Change: $LastChangedDate: 2009-06-29 23:08:37 -0500 (Mon, 29 Jun 2009) $ +" Last Change: $LastChangedDate: 2010-04-22 09:48:02 -0500 (Thu, 22 Apr 2010) $ " Filenames: *.mysql " URL: ftp://cedar-solutions.com/software/mysql.vim " Note: The definitions below are taken from the mysql user manual as of April 2002, for version 3.23 @@ -62,7 +62,7 @@ syn match mysqlNumber "-\=\<[0-9]*\.[0-9]*e[+-]\=[0-9]*\>" syn match mysqlNumber "\<0x[abcdefABCDEF0-9]*\>" " User variables -syn match mysqlVariable "@\a*[A-Za-z0-9]*[._]*[A-Za-z0-9]*" +syn match mysqlVariable "@\a*[A-Za-z0-9]*\([._]*[A-Za-z0-9]\)*" " Comments (c-style, mysql-style and modified sql-style) syn region mysqlComment start="/\*" end="\*/" @@ -75,7 +75,7 @@ syn sync ccomment mysqlComment " This gets a bit ugly. There are two different problems we have to " deal with. " -" The first problem is that some keywoards like 'float' can be used +" The first problem is that some keywords like 'float' can be used " both with and without specifiers, i.e. 'float', 'float(1)' and " 'float(@var)' are all valid. We have to account for this and we " also have to make sure that garbage like floatn or float_(1) is not diff --git a/runtime/syntax/obj.vim b/runtime/syntax/obj.vim new file mode 100644 index 000000000..3e2b438f1 --- /dev/null +++ b/runtime/syntax/obj.vim @@ -0,0 +1,95 @@ +" Vim syntax file +" Language: 3D wavefront's obj file +" Maintainer: Vincent Berthoux <twinside@gmail.com> +" File Types: .obj (used in 3D) +" +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +syn match objError "^\a\+" + +syn match objKeywords "^cstype\s" +syn match objKeywords "^ctech\s" +syn match objKeywords "^stech\s" +syn match objKeywords "^deg\s" +syn match objKeywords "^curv\(2\?\)\s" +syn match objKeywords "^parm\s" +syn match objKeywords "^surf\s" +syn match objKeywords "^end\s" +syn match objKeywords "^bzp\s" +syn match objKeywords "^bsp\s" +syn match objKeywords "^res\s" +syn match objKeywords "^cdc\s" +syn match objKeywords "^con\s" + +syn match objKeywords "^shadow_obj\s" +syn match objKeywords "^trace_obj\s" +syn match objKeywords "^usemap\s" +syn match objKeywords "^lod\s" +syn match objKeywords "^maplib\s" +syn match objKeywords "^d_interp\s" +syn match objKeywords "^c_interp\s" +syn match objKeywords "^bevel\s" +syn match objKeywords "^mg\s" +syn match objKeywords "^s\s" +syn match objKeywords "^con\s" +syn match objKeywords "^trim\s" +syn match objKeywords "^hole\s" +syn match objKeywords "^scrv\s" +syn match objKeywords "^sp\s" +syn match objKeywords "^step\s" +syn match objKeywords "^bmat\s" +syn match objKeywords "^csh\s" +syn match objKeywords "^call\s" + +syn match objComment "^#.*" +syn match objVertex "^v\s" +syn match objFace "^f\s" +syn match objVertice "^vt\s" +syn match objNormale "^vn\s" +syn match objGroup "^g\s.*" +syn match objMaterial "^usemtl\s.*" +syn match objInclude "^mtllib\s.*" + +syn match objFloat "-\?\d\+\.\d\+\(e\(+\|-\)\d\+\)\?" +syn match objInt "\d\+" +syn match objIndex "\d\+\/\d*\/\d*" + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_cabal_syn_inits") + if version < 508 + let did_cabal_syn_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink objError Error + HiLink objComment Comment + HiLink objInclude PreProc + HiLink objFloat Float + HiLink objInt Number + HiLink objGroup Structure + HiLink objIndex Constant + HiLink objMaterial Label + + HiLink objVertex Keyword + HiLink objNormale Keyword + HiLink objVertice Keyword + HiLink objFace Keyword + HiLink objKeywords Keyword + + + delcommand HiLink +endif + +let b:current_syntax = "obj" + +" vim: ts=8 diff --git a/runtime/syntax/perl.vim b/runtime/syntax/perl.vim index fb9195a77..4c403ba89 100644 --- a/runtime/syntax/perl.vim +++ b/runtime/syntax/perl.vim @@ -1,24 +1,24 @@ " Vim syntax file -" Language: Perl -" Maintainer: Nick Hibma <nick@van-laarhoven.org> -" Last Change: 2006 November 23 -" Location: http://www.van-laarhoven.org/vim/syntax/perl.vim +" Language: Perl 5 +" Maintainer: Andy Lester <andy@petdance.com> +" URL: http://github.com/petdance/vim-perl/tree/master +" Last Change: 2009-09-2 +" Contributors: Andy Lester <andy@petdance.com> +" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> +" Lukas Mai <l.mai.web.de> +" Nick Hibma <nick@van-laarhoven.org> +" Sonia Heimann <niania@netsurf.org> +" and many others. " " Please download most recent version first before mailing " any comments. -" See also the file perl.vim.regression.pl to check whether your -" modifications work in the most odd cases -" http://www.van-laarhoven.org/vim/syntax/perl.vim.regression.pl " -" Original version: Sonia Heimann <niania@netsurf.org> -" Thanks to many people for their contribution. - " The following parameters are available for tuning the " perl syntax highlighting, with defaults given: " " unlet perl_include_pod -" unlet perl_want_scope_in_variables -" unlet perl_extended_vars +" unlet perl_no_scope_in_variables +" unlet perl_no_extended_vars " unlet perl_string_as_statement " unlet perl_no_sync_on_sub " unlet perl_no_sync_on_global_var @@ -28,17 +28,37 @@ " let perl_nofold_packages = 1 " let perl_nofold_subs = 1 -" Remove any old syntax stuff that was loaded (5.x) or quit when a syntax file -" was already loaded (6.x). if version < 600 - syntax clear + echoerr ">=vim-6.0 is required to run perl.vim" + finish elseif exists("b:current_syntax") finish endif -" Unset perl_fold if it set but vim doesn't support it. -if version < 600 && exists("perl_fold") - unlet perl_fold +" +" Folding + +if exists("perl_fold") + " Note: this bit must come before the actual highlighting of the "package" + " keyword, otherwise this will screw up Pod lines that match /^package/ + if !exists("perl_nofold_packages") + syn region perlPackageFold start="^package \S\+;\s*\%(#.*\)\=$" end="^1;\=\s*\%(#.*\)\=$" end="\n\+package"me=s-1 transparent fold keepend + endif + if !exists("perl_nofold_subs") + syn region perlSubFold start="^\z(\s*\)\<sub\>.*[^};]$" end="^\z1}\s*\%(#.*\)\=$" transparent fold keepend + syn region perlSubFold start="^\z(\s*\)\<\%(BEGIN\|END\|CHECK\|INIT\|UNITCHECK\)\>.*[^};]$" end="^\z1}\s*$" transparent fold keepend + endif + + if exists("perl_fold_blocks") + syn region perlBlockFold start="^\z(\s*\)\%(if\|elsif\|unless\|for\|while\|until\|given\)\s*(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" start="^\z(\s*\)foreach\s*\%(\%(my\|our\)\=\s*\S\+\s*\)\=(.*)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend + syn region perlBlockFold start="^\z(\s*\)\%(do\|else\)\%(\s*{\)\=\s*\%(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\%(#.*\)\=$" transparent fold keepend + endif + + setlocal foldmethod=syntax + syn sync fromstart +else + " fromstart above seems to set minlines even if perl_fold is not set. + syn sync minlines=0 endif @@ -65,64 +85,48 @@ else endif +syn cluster perlTop contains=TOP +syn region perlGenericBlock matchgroup=perlGenericBlock start="{" end="}" contained transparent + + " All keywords " -if exists("perl_fold") && exists("perl_fold_blocks") - syn match perlConditional "\<if\>" - syn match perlConditional "\<elsif\>" - syn match perlConditional "\<unless\>" - syn match perlConditional "\<else\>" nextgroup=perlElseIfError skipwhite skipnl skipempty -else - syn keyword perlConditional if elsif unless - syn keyword perlConditional else nextgroup=perlElseIfError skipwhite skipnl skipempty -endif -syn keyword perlConditional switch eq ne gt lt ge le cmp not and or xor err -if exists("perl_fold") && exists("perl_fold_blocks") - syn match perlRepeat "\<while\>" - syn match perlRepeat "\<for\>" - syn match perlRepeat "\<foreach\>" - syn match perlRepeat "\<do\>" - syn match perlRepeat "\<until\>" - syn match perlRepeat "\<continue\>" -else - syn keyword perlRepeat while for foreach do until continue -endif -syn keyword perlOperator defined undef and or not bless ref -if exists("perl_fold") - " if BEGIN/END would be a keyword the perlBEGINENDFold does not work - syn match perlControl "\<BEGIN\|CHECK\|INIT\|END\>" contained -else - syn keyword perlControl BEGIN END CHECK INIT -endif - -syn keyword perlStatementStorage my local our -syn keyword perlStatementControl goto return last next redo -syn keyword perlStatementScalar chomp chop chr crypt index lc lcfirst length ord pack reverse rindex sprintf substr uc ucfirst -syn keyword perlStatementRegexp pos quotemeta split study -syn keyword perlStatementNumeric abs atan2 cos exp hex int log oct rand sin sqrt srand -syn keyword perlStatementList splice unshift shift push pop split join reverse grep map sort unpack -syn keyword perlStatementHash each exists keys values tie tied untie -syn keyword perlStatementIOfunc carp confess croak dbmclose dbmopen die syscall -syn keyword perlStatementFiledesc binmode close closedir eof fileno getc lstat print printf readdir readline readpipe rewinddir select stat tell telldir write nextgroup=perlFiledescStatementNocomma skipwhite -syn keyword perlStatementFiledesc fcntl flock ioctl open opendir read seek seekdir sysopen sysread sysseek syswrite truncate nextgroup=perlFiledescStatementComma skipwhite -syn keyword perlStatementVector pack vec -syn keyword perlStatementFiles chdir chmod chown chroot glob link mkdir readlink rename rmdir symlink umask unlink utime -syn match perlStatementFiles "-[rwxoRWXOezsfdlpSbctugkTBMAC]\>" -syn keyword perlStatementFlow caller die dump eval exit wantarray -syn keyword perlStatementInclude require -syn match perlStatementInclude "\<\(use\|no\)\s\+\(\(integer\|strict\|lib\|sigtrap\|subs\|vars\|warnings\|utf8\|byte\|base\|fields\)\>\)\=" -syn keyword perlStatementScope import -syn keyword perlStatementProc alarm exec fork getpgrp getppid getpriority kill pipe setpgrp setpriority sleep system times wait waitpid -syn keyword perlStatementSocket accept bind connect getpeername getsockname getsockopt listen recv send setsockopt shutdown socket socketpair -syn keyword perlStatementIPC msgctl msgget msgrcv msgsnd semctl semget semop shmctl shmget shmread shmwrite -syn keyword perlStatementNetwork endhostent endnetent endprotoent endservent gethostbyaddr gethostbyname gethostent getnetbyaddr getnetbyname getnetent getprotobyname getprotobynumber getprotoent getservbyname getservbyport getservent sethostent setnetent setprotoent setservent -syn keyword perlStatementPword getpwuid getpwnam getpwent setpwent endpwent getgrent getgrgid getlogin getgrnam setgrent endgrent -syn keyword perlStatementTime gmtime localtime time times - -syn keyword perlStatementMisc warn formline reset scalar delete prototype lock -syn keyword perlStatementNew new - -syn keyword perlTodo TODO TBD FIXME XXX contained +syn match perlConditional "\<\%(if\|elsif\|unless\|given\|when\|default\)\>" +syn match perlConditional "\<else\>" nextgroup=perlElseIfError skipwhite skipnl skipempty +syn match perlRepeat "\<\%(while\|for\%(each\)\=\|do\|until\|continue\)\>" +syn match perlOperator "\<\%(defined\|undef\|eq\|ne\|[gl][et]\|cmp\|not\|and\|or\|xor\|not\|bless\|ref\|do\)\>" +syn match perlControl "\<\%(BEGIN\|CHECK\|INIT\|END\|UNITCHECK\)\>" + +syn match perlStatementStorage "\<\%(my\|our\|local\|state\)\>" +syn match perlStatementControl "\<\%(return\|last\|next\|redo\|goto\|break\)\>" +syn match perlStatementScalar "\<\%(chom\=p\|chr\|crypt\|r\=index\|lc\%(first\)\=\|length\|ord\|pack\|sprintf\|substr\|uc\%(first\)\=\)\>" +syn match perlStatementRegexp "\<\%(pos\|quotemeta\|split\|study\)\>" +syn match perlStatementNumeric "\<\%(abs\|atan2\|cos\|exp\|hex\|int\|log\|oct\|rand\|sin\|sqrt\|srand\)\>" +syn match perlStatementList "\<\%(splice\|unshift\|shift\|push\|pop\|join\|reverse\|grep\|map\|sort\|unpack\)\>" +syn match perlStatementHash "\<\%(delete\|each\|exists\|keys\|values\)\>" +syn match perlStatementIOfunc "\<\%(syscall\|dbmopen\|dbmclose\)\>" +syn match perlStatementFiledesc "\<\%(binmode\|close\%(dir\)\=\|eof\|fileno\|getc\|lstat\|printf\=\|read\%(dir\|line\|pipe\)\|rewinddir\|say\|select\|stat\|tell\%(dir\)\=\|write\)\>" nextgroup=perlFiledescStatementNocomma skipwhite +syn match perlStatementFiledesc "\<\%(fcntl\|flock\|ioctl\|open\%(dir\)\=\|read\|seek\%(dir\)\=\|sys\%(open\|read\|seek\|write\)\|truncate\)\>" nextgroup=perlFiledescStatementComma skipwhite +syn match perlStatementVector "\<vec\>" +syn match perlStatementFiles "\<\%(ch\%(dir\|mod\|own\|root\)\|glob\|link\|mkdir\|readlink\|rename\|rmdir\|symlink\|umask\|unlink\|utime\)\>" +syn match perlStatementFiles "-[rwxoRWXOezsfdlpSbctugkTBMAC]\>" +syn match perlStatementFlow "\<\%(caller\|die\|dump\|eval\|exit\|wantarray\)\>" +syn match perlStatementInclude "\<require\>" +syn match perlStatementInclude "\<\%(use\|no\)\s\+\%(\%(attributes\|attrs\|autouse\|parent\|base\|big\%(int\|num\|rat\)\|blib\|bytes\|charnames\|constant\|diagnostics\|encoding\%(::warnings\)\=\|feature\|fields\|filetest\|if\|integer\|less\|lib\|locale\|mro\|open\|ops\|overload\|re\|sigtrap\|sort\|strict\|subs\|threads\%(::shared\)\=\|utf8\|vars\|version\|vmsish\|warnings\%(::register\)\=\)\>\)\=" +syn match perlStatementProc "\<\%(alarm\|exec\|fork\|get\%(pgrp\|ppid\|priority\)\|kill\|pipe\|set\%(pgrp\|priority\)\|sleep\|system\|times\|wait\%(pid\)\=\)\>" +syn match perlStatementSocket "\<\%(acept\|bind\|connect\|get\%(peername\|sock\%(name\|opt\)\)\|listen\|recv\|send\|setsockopt\|shutdown\|socket\%(pair\)\=\)\>" +syn match perlStatementIPC "\<\%(msg\%(ctl\|get\|rcv\|snd\)\|sem\%(ctl\|get\|op\)\|shm\%(ctl\|get\|read\|write\)\)\>" +syn match perlStatementNetwork "\<\%(\%(end\|[gs]et\)\%(host\|net\|proto\|serv\)ent\|get\%(\%(host\|net\)by\%(addr\|name\)\|protoby\%(name\|number\)\|servby\%(name\|port\)\)\)\>" +syn match perlStatementPword "\<\%(get\%(pw\%(uid\|nam\)\|gr\%(gid\|nam\)\|login\)\)\|\%(end\|[gs]et\)\%(pw\|gr\)ent\>" +syn match perlStatementTime "\<\%(gmtime\|localtime\|time\)\>" + +syn match perlStatementMisc "\<\%(warn\|formline\|reset\|scalar\|prototype\|lock\|tied\=\|untie\)\>" + +syn keyword perlTodo TODO TBD FIXME XXX NOTE contained + +syn region perlStatementIndirObjWrap matchgroup=perlStatementIndirObj start="\<\%(map\|grep\|sort\|print\|system\|exec\)\>\s*{" end="}" contains=@perlTop,perlGenericBlock + +syn match perlLabel "^\s*\h\w*\s*::\@!\%(\<v\d\+\s*:\)\@<!" " Perl Identifiers. " @@ -135,52 +139,55 @@ syn keyword perlTodo TODO TBD FIXME XXX contained " variable - there again, too complicated and too slow. " Special variables first ($^A, ...) and ($|, $', ...) -syn match perlVarPlain "$^[ADEFHILMOPSTWX]\=" +syn match perlVarPlain "$^[ACDEFHILMNOPRSTVWX]\=" syn match perlVarPlain "$[\\\"\[\]'&`+*.,;=%~!?@#$<>(-]" -syn match perlVarPlain "$\(0\|[1-9][0-9]*\)" +syn match perlVarPlain "$\%(0\|[1-9]\d*\)" " Same as above, but avoids confusion in $::foo (equivalent to $main::foo) -syn match perlVarPlain "$:[^:]" +syn match perlVarPlain "$::\@!" " These variables are not recognized within matches. syn match perlVarNotInMatches "$[|)]" " This variable is not recognized within matches delimited by m//. syn match perlVarSlash "$/" " And plain identifiers -syn match perlPackageRef "\(\h\w*\)\=\(::\|'\)\I"me=e-1 contained +syn match perlPackageRef "[$@#%*&]\%(\%(::\|'\)\=\I\i*\%(\%(::\|'\)\I\i*\)*\)\=\%(::\|'\)\I"ms=s+1,me=e-1 contained -" To highlight packages in variables as a scope reference - i.e. in $pack::var, -" pack:: is a scope, just set "perl_want_scope_in_variables" -" If you *want* complex things like @{${"foo"}} to be processed, -" just set the variable "perl_extended_vars"... +" To not highlight packages in variables as a scope reference - i.e. in +" $pack::var, pack:: is a scope, just set "perl_no_scope_in_variables" +" If you don't want complex things like @{${"foo"}} to be processed, +" just set the variable "perl_no_extended_vars"... -" FIXME value between {} should be marked as string. is treated as such by Perl. -" At the moment it is marked as something greyish instead of read. Probably todo -" with transparency. Or maybe we should handle the bare word in that case. or make it into - -if exists("perl_want_scope_in_variables") - syn match perlVarPlain "\\\=\([@$]\|\$#\)\$*\(\I\i*\)\=\(\(::\|'\)\I\i*\)*\>" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod - syn match perlVarPlain2 "\\\=%\$*\(\I\i*\)\=\(\(::\|'\)\I\i*\)*\>" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod - syn match perlFunctionName "\\\=&\$*\(\I\i*\)\=\(\(::\|'\)\I\i*\)*\>" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember +if !exists("perl_no_scope_in_variables") + syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef + syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" contains=perlPackageRef nextgroup=perlVarMember,perlVarSimpleMember,perlMethod else - syn match perlVarPlain "\\\=\([@$]\|\$#\)\$*\(\I\i*\)\=\(\(::\|'\)\I\i*\)*\>" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod - syn match perlVarPlain2 "\\\=%\$*\(\I\i*\)\=\(\(::\|'\)\I\i*\)*\>" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod - syn match perlFunctionName "\\\=&\$*\(\I\i*\)\=\(\(::\|'\)\I\i*\)*\>" nextgroup=perlVarMember,perlVarSimpleMember + syn match perlVarPlain "\%([@$]\|\$#\)\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarPlain2 "%\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" + syn match perlFunctionName "&\$*\%(\I\i*\)\=\%(\%(::\|'\)\I\i*\)*\%(::\|\i\@<=\)" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod endif -if exists("perl_extended_vars") - syn cluster perlExpr contains=perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQQ - syn region perlVarBlock matchgroup=perlVarPlain start="\($#\|[@%$]\)\$*{" skip="\\}" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember - syn region perlVarBlock matchgroup=perlVarPlain start="&\$*{" skip="\\}" end="}" contains=@perlExpr - syn match perlVarPlain "\\\=\(\$#\|[@%&$]\)\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember - syn region perlVarMember matchgroup=perlVarPlain start="\(->\)\={" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember - syn match perlVarSimpleMember "\(->\)\={\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember contains=perlVarSimpleMemberName contained +if !exists("perl_no_extended_vars") + syn cluster perlExpr contains=perlStatementIndirObjWrap,perlStatementScalar,perlStatementRegexp,perlStatementNumeric,perlStatementList,perlStatementHash,perlStatementFiles,perlStatementTime,perlStatementMisc,perlVarPlain,perlVarPlain2,perlVarNotInMatches,perlVarSlash,perlVarBlock,perlVarBlock2,perlShellCommand,perlFloat,perlNumber,perlStringUnexpanded,perlString,perlQQ,perlArrow,perlGenericBlock + syn region perlArrow matchgroup=perlArrow start="->\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn region perlArrow matchgroup=perlArrow start="->\s*\[" end="\]" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn region perlArrow matchgroup=perlArrow start="->\s*{" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn match perlArrow "->\s*{\s*\I\i*\s*}" contains=perlVarSimpleMemberName nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn region perlArrow matchgroup=perlArrow start="->\s*\$*\I\i*\s*(" end=")" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contained + syn region perlVarBlock matchgroup=perlVarPlain start="\%($#\|[$@]\)\$*{" skip="\\}" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn region perlVarBlock2 matchgroup=perlVarPlain start="[%&*]\$*{" skip="\\}" end="}" contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarPlain2 "[%&*]\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarPlain "\%(\$#\|[@$]\)\$*{\I\i*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\={" skip="\\}" end="}" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlVarSimpleMember "\%(->\)\={\s*\I\i*\s*}" nextgroup=perlVarMember,perlVarSimpleMember,perlMethod contains=perlVarSimpleMemberName contained syn match perlVarSimpleMemberName "\I\i*" contained - syn region perlVarMember matchgroup=perlVarPlain start="\(->\)\=\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember - syn match perlMethod "\(->\)\I\i*" contained + syn region perlVarMember matchgroup=perlVarPlain start="\%(->\)\=\[" skip="\\]" end="]" contained contains=@perlExpr nextgroup=perlVarMember,perlVarSimpleMember,perlMethod + syn match perlPackageConst "__PACKAGE__" nextgroup=perlMethod + syn match perlMethod "->\$*\I\i*" contained nextgroup=perlVarSimpleMember,perlVarMember,perlMethod endif " File Descriptors -syn match perlFiledescRead "[<]\h\w\+[>]" +syn match perlFiledescRead "<\h\w*>" syn match perlFiledescStatementComma "(\=\s*\u\w*\s*,"me=e-1 transparent contained contains=perlFiledescStatement syn match perlFiledescStatementNocomma "(\=\s*\u\w*\s*[^, \t]"me=e-1 transparent contained contains=perlFiledescStatement @@ -188,16 +195,20 @@ syn match perlFiledescStatementNocomma "(\=\s*\u\w*\s*[^, \t]"me=e-1 transparen syn match perlFiledescStatement "\u\w*" contained " Special characters in strings and matches -syn match perlSpecialString "\\\(\d\+\|[xX]\x\+\|c\u\|.\)" contained -syn match perlSpecialStringU "\\['\\]" contained -syn match perlSpecialMatch "{\d\+\(,\(\d\+\)\=\)\=}" contained -syn match perlSpecialMatch "\[\(\]\|-\)\=[^\[\]]*\(\[\|\-\)\=\]" contained +syn match perlSpecialString "\\\%(\o\{1,3}\|x\%({\x\+}\|\x\{1,2}\)\|c.\|[^cx]\)" contained extend +syn match perlSpecialStringU2 "\\." extend contained transparent contains=NONE +syn match perlSpecialStringU "\\\\" contained +syn match perlSpecialMatch "\\[1-9]" contained extend +syn match perlSpecialMatch "\\g\%(\d\+\|{\%(-\=\d\+\|\h\w*\)}\)" contained +syn match perlSpecialMatch "\\k\%(<\h\w*>\|'\h\w*'\)" contained +syn match perlSpecialMatch "{\d\+\%(,\%(\d\+\)\=\)\=}" contained +syn match perlSpecialMatch "\[[]-]\=[^\[\]]*[]-]\=\]" contained syn match perlSpecialMatch "[+*()?.]" contained syn match perlSpecialMatch "(?[#:=!]" contained -syn match perlSpecialMatch "(?[imsx]\+)" contained -" FIXME the line below does not work. It should mark end of line and -" begin of line as perlSpecial. -" syn match perlSpecialBEOM "^\^\|\$$" contained +syn match perlSpecialMatch "(?[impsx]*\%(-[imsx]\+\)\=)" contained +syn match perlSpecialMatch "(?\%([-+]\=\d\+\|R\))" contained +syn match perlSpecialMatch "(?\%(&\|P[>=]\)\h\w*)" contained +syn match perlSpecialMatch "(\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\=\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\=\|ACCEPT\))" contained " Possible errors " @@ -205,177 +216,195 @@ syn match perlSpecialMatch "(?[imsx]\+)" contained syn match perlNotEmptyLine "^\s\+$" contained " Highlight '} else if (...) {', it should be '} else { if (...) { ' or " '} elsif (...) {'. -"syn keyword perlElseIfError if contained +syn match perlElseIfError "[^[:space:]{]\+" contained " Variable interpolation " " These items are interpolated inside "" strings and similar constructs. syn cluster perlInterpDQ contains=perlSpecialString,perlVarPlain,perlVarNotInMatches,perlVarSlash,perlVarBlock " These items are interpolated inside '' strings and similar constructs. -syn cluster perlInterpSQ contains=perlSpecialStringU +syn cluster perlInterpSQ contains=perlSpecialStringU,perlSpecialStringU2 " These items are interpolated inside m// matches and s/// substitutions. -syn cluster perlInterpSlash contains=perlSpecialString,perlSpecialMatch,perlVarPlain,perlVarBlock,perlSpecialBEOM +syn cluster perlInterpSlash contains=perlSpecialString,perlSpecialMatch,perlVarPlain,perlVarBlock " These items are interpolated inside m## matches and s### substitutions. syn cluster perlInterpMatch contains=@perlInterpSlash,perlVarSlash " Shell commands -syn region perlShellCommand matchgroup=perlMatchStartEnd start="`" end="`" contains=@perlInterpDQ +syn region perlShellCommand matchgroup=perlMatchStartEnd start="`" end="`" contains=@perlInterpDQ keepend " Constants " " Numbers -syn match perlNumber "[-+]\=\(\<\d[[:digit:]_]*L\=\>\|0[xX]\x[[:xdigit:]_]*\>\)" -syn match perlFloat "[-+]\=\<\d[[:digit:]_]*[eE][\-+]\=\d\+" -syn match perlFloat "[-+]\=\<\d[[:digit:]_]*\.[[:digit:]_]*\([eE][\-+]\=\d\+\)\=" -syn match perlFloat "[-+]\=\<\.[[:digit:]_]\+\([eE][\-+]\=\d\+\)\=" +syn match perlNumber "\<\%(0\%(x\x[[:xdigit:]_]*\|b[01][01_]*\|\o[0-7_]*\|\)\|[1-9][[:digit:]_]*\)\>" +syn match perlFloat "\<\d[[:digit:]_]*[eE][\-+]\=\d\+" +syn match perlFloat "\<\d[[:digit:]_]*\.[[:digit:]_]*\%([eE][\-+]\=\d\+\)\=" +syn match perlFloat "\.[[:digit:]_]\+\%([eE][\-+]\=\d\+\)\=" + +syn match perlString "\<\%(v\d\+\%(\.\d\+\)*\|\d\+\%(\.\d\+\)\{2,}\)\>" contains=perlVStringV +syn match perlVStringV "\<v" contained + + +syn region perlParensSQ start=+(+ end=+)+ extend contained transparent contains=perlParensSQ,@perlInterpSQ keepend +syn region perlBracketsSQ start=+\[+ end=+\]+ extend contained transparent contains=perlBracketsSQ,@perlInterpSQ keepend +syn region perlBracesSQ start=+{+ end=+}+ extend contained transparent contains=perlBracesSQ,@perlInterpSQ keepend +syn region perlAnglesSQ start=+<+ end=+>+ extend contained transparent contains=perlAnglesSQ,@perlInterpSQ keepend + +syn region perlParensDQ start=+(+ end=+)+ extend contained transparent contains=perlParensDQ,@perlInterpDQ keepend +syn region perlBracketsDQ start=+\[+ end=+\]+ extend contained transparent contains=perlBracketsDQ,@perlInterpDQ keepend +syn region perlBracesDQ start=+{+ end=+}+ extend contained transparent contains=perlBracesDQ,@perlInterpDQ keepend +syn region perlAnglesDQ start=+<+ end=+>+ extend contained transparent contains=perlAnglesDQ,@perlInterpDQ keepend " Simple version of searches and matches -" caters for m//, m##, m{} and m[] (and the !/ variant) -syn region perlMatch matchgroup=perlMatchStartEnd start=+[m!]/+ end=+/[cgimosx]*+ contains=@perlInterpSlash -syn region perlMatch matchgroup=perlMatchStartEnd start=+[m!]#+ end=+#[cgimosx]*+ contains=@perlInterpMatch -syn region perlMatch matchgroup=perlMatchStartEnd start=+[m!]{+ end=+}[cgimosx]*+ contains=@perlInterpMatch -syn region perlMatch matchgroup=perlMatchStartEnd start=+[m!]\[+ end=+\][cgimosx]*+ contains=@perlInterpMatch +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1[cgimopsx]*+ contains=@perlInterpMatch keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m#+ end=+#[cgimopsx]*+ contains=@perlInterpMatch keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*'+ end=+'[cgimopsx]*+ contains=@perlInterpSQ keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*/+ end=+/[cgimopsx]*+ contains=@perlInterpSlash keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*(+ end=+)[cgimopsx]*+ contains=@perlInterpMatch,perlParensDQ keepend -" A special case for m!!x which allows for comments and extra whitespace in the pattern -syn region perlMatch matchgroup=perlMatchStartEnd start=+[m!]!+ end=+![cgimosx]*+ contains=@perlInterpSlash,perlComment +" A special case for m{}, m<> and m[] which allows for comments and extra whitespace in the pattern +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*{+ end=+}[cgimopsx]*+ contains=@perlInterpMatch,perlComment,perlBracesDQ keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*<+ end=+>[cgimopsx]*+ contains=@perlInterpMatch,perlAnglesDQ keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!m\s*\[+ end=+\][cgimopsx]*+ contains=@perlInterpMatch,perlComment,perlBracketsDQ keepend " Below some hacks to recognise the // variant. This is virtually impossible to catch in all " cases as the / is used in so many other ways, but these should be the most obvious ones. -syn region perlMatch matchgroup=perlMatchStartEnd start=+^split /+lc=5 start=+[^$@%]\<split /+lc=6 start=+^while /+lc=5 start=+[^$@%]\<while /+lc=6 start=+^if /+lc=2 start=+[^$@%]\<if /+lc=3 start=+[!=]\~\s*/+lc=2 start=+[(~]/+lc=1 start=+\.\./+lc=2 start=+\s/[^= \t0-9$@%]+lc=1,me=e-1,rs=e-1 start=+^/+ skip=+\\/+ end=+/[cgimosx]*+ contains=@perlInterpSlash +syn region perlMatch matchgroup=perlMatchStartEnd start="\%([$@%&*]\@<!\%(\<split\|\<while\|\<if\|\<unless\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=/\%(/=\)\@!" start=+^/\%(/=\)\@!+ start=+\s\@<=/\%(/=\)\@![^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!+ skip=+\\/+ end=+/[cgimopsx]*+ contains=@perlInterpSlash " Substitutions -" caters for s///, s### and s[][] " perlMatch is the first part, perlSubstitution* is the substitution part -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<s'+ end=+'+me=e-1 contains=@perlInterpSQ nextgroup=perlSubstitutionSQ -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<s"+ end=+"+me=e-1 contains=@perlInterpMatch nextgroup=perlSubstitutionDQ -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<s/+ end=+/+me=e-1 contains=@perlInterpSlash nextgroup=perlSubstitutionSlash -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<s#+ end=+#+me=e-1 contains=@perlInterpMatch nextgroup=perlSubstitutionHash -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<s\[+ end=+\]+ contains=@perlInterpMatch nextgroup=perlSubstitutionBracket skipwhite skipempty skipnl -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<s{+ end=+}+ contains=@perlInterpMatch nextgroup=perlSubstitutionCurly skipwhite skipempty skipnl -syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[ecgimosx]*+ contained contains=@perlInterpSQ -syn region perlSubstitutionDQ matchgroup=perlMatchStartEnd start=+"+ end=+"[ecgimosx]*+ contained contains=@perlInterpDQ -syn region perlSubstitutionSlash matchgroup=perlMatchStartEnd start=+/+ end=+/[ecgimosx]*+ contained contains=@perlInterpDQ -syn region perlSubstitutionHash matchgroup=perlMatchStartEnd start=+#+ end=+#[ecgimosx]*+ contained contains=@perlInterpDQ -syn region perlSubstitutionBracket matchgroup=perlMatchStartEnd start=+\[+ end=+\][ecgimosx]*+ contained contains=@perlInterpDQ -syn region perlSubstitutionCurly matchgroup=perlMatchStartEnd start=+{+ end=+}[ecgimosx]*+ contained contains=@perlInterpDQ - -" A special case for m!!x which allows for comments and extra whitespace in the pattern -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<s!+ end=+!+me=e-1 contains=@perlInterpSlash,perlComment nextgroup=perlSubstitutionPling -syn region perlSubstitutionPling matchgroup=perlMatchStartEnd start=+!+ end=+![ecgimosx]*+ contained contains=@perlInterpDQ - -" Substitutions -" caters for tr///, tr### and tr[][] +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\>\s*\z([^[:space:]'([{<#]\)+ end=+\z1+me=e-1 contains=@perlInterpMatch nextgroup=perlSubstitutionGQQ keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*'+ end=+'+me=e-1 contains=@perlInterpSQ nextgroup=perlSubstitutionSQ keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*/+ end=+/+me=e-1 contains=@perlInterpSlash nextgroup=perlSubstitutionGQQ keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s#+ end=+#+me=e-1 contains=@perlInterpMatch nextgroup=perlSubstitutionGQQ keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*(+ end=+)+ contains=@perlInterpMatch,perlParensDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*<+ end=+>+ contains=@perlInterpMatch,perlAnglesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*\[+ end=+\]+ contains=@perlInterpMatch,perlBracketsDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!s\s*{+ end=+}+ contains=@perlInterpMatch,perlBracesDQ nextgroup=perlSubstitutionGQQ skipwhite skipempty skipnl keepend +syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]'([{<]\)+ end=+\z1[ecgimopsx]*+ keepend contained contains=@perlInterpDQ +syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+(+ end=+)[ecgimopsx]*+ contained contains=@perlInterpDQ,perlParensDQ keepend +syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][ecgimopsx]*+ contained contains=@perlInterpDQ,perlBracketsDQ keepend +syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+{+ end=+}[ecgimopsx]*+ contained contains=@perlInterpDQ,perlBracesDQ keepend +syn region perlSubstitutionGQQ matchgroup=perlMatchStartEnd start=+<+ end=+>[ecgimopsx]*+ contained contains=@perlInterpDQ,perlAnglesDQ keepend +syn region perlSubstitutionSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[ecgimopsx]*+ contained contains=@perlInterpSQ keepend + +" Translations " perlMatch is the first part, perlTranslation* is the second, translator part. -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\(tr\|y\)'+ end=+'+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationSQ -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\(tr\|y\)"+ end=+"+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationDQ -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\(tr\|y\)/+ end=+/+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationSlash -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\(tr\|y\)#+ end=+#+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationHash -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\(tr\|y\)\[+ end=+\]+ contains=@perlInterpSQ nextgroup=perlTranslationBracket skipwhite skipempty skipnl -syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\(tr\|y\){+ end=+}+ contains=@perlInterpSQ nextgroup=perlTranslationCurly skipwhite skipempty skipnl -syn region perlTranslationSQ matchgroup=perlMatchStartEnd start=+'+ end=+'[cds]*+ contained -syn region perlTranslationDQ matchgroup=perlMatchStartEnd start=+"+ end=+"[cds]*+ contained -syn region perlTranslationSlash matchgroup=perlMatchStartEnd start=+/+ end=+/[cds]*+ contained -syn region perlTranslationHash matchgroup=perlMatchStartEnd start=+#+ end=+#[cds]*+ contained -syn region perlTranslationBracket matchgroup=perlMatchStartEnd start=+\[+ end=+\][cds]*+ contained -syn region perlTranslationCurly matchgroup=perlMatchStartEnd start=+{+ end=+}[cds]*+ contained +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\>\s*\z([^[:space:]([{<#]\)+ end=+\z1+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationGQ +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)#+ end=+#+me=e-1 contains=@perlInterpSQ nextgroup=perlTranslationGQ +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl +syn region perlMatch matchgroup=perlMatchStartEnd start=+\<\%(::\|'\|->\)\@<!\%(tr\|y\)\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ nextgroup=perlTranslationGQ skipwhite skipempty skipnl +syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+\z([^[:space:]([{<]\)+ end=+\z1[cds]*+ contained +syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+(+ end=+)[cds]*+ contains=perlParensSQ contained +syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+\[+ end=+\][cds]*+ contains=perlBracketsSQ contained +syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+{+ end=+}[cds]*+ contains=perlBracesSQ contained +syn region perlTranslationGQ matchgroup=perlMatchStartEnd start=+<+ end=+>[cds]*+ contains=perlAnglesSQ contained -" The => operator forces a bareword to the left of it to be interpreted as -" a string -syn match perlString "\<\I\i*\s*=>"me=e-2 - " Strings and q, qq, qw and qr expressions -" Brackets in qq() -syn region perlBrackets start=+(+ end=+)+ contained transparent contains=perlBrackets,@perlStringSQ - -syn region perlStringUnexpanded matchgroup=perlStringStartEnd start="'" end="'" contains=@perlInterpSQ -syn region perlString matchgroup=perlStringStartEnd start=+"+ end=+"+ contains=@perlInterpDQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q#+ end=+#+ contains=@perlInterpSQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q|+ end=+|+ contains=@perlInterpSQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q(+ end=+)+ contains=@perlInterpSQ,perlBrackets -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q{+ end=+}+ contains=@perlInterpSQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q/+ end=+/+ contains=@perlInterpSQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q[qx]#+ end=+#+ contains=@perlInterpDQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q[qx]|+ end=+|+ contains=@perlInterpDQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q[qx](+ end=+)+ contains=@perlInterpDQ,perlBrackets -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q[qx]{+ end=+}+ contains=@perlInterpDQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<q[qx]/+ end=+/+ contains=@perlInterpDQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qw#+ end=+#+ contains=@perlInterpSQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qw|+ end=+|+ contains=@perlInterpSQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qw(+ end=+)+ contains=@perlInterpSQ,perlBrackets -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qw{+ end=+}+ contains=@perlInterpSQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qw/+ end=+/+ contains=@perlInterpSQ -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qr#+ end=+#[imosx]*+ contains=@perlInterpMatch -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qr|+ end=+|[imosx]*+ contains=@perlInterpMatch -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qr(+ end=+)[imosx]*+ contains=@perlInterpMatch -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qr{+ end=+}[imosx]*+ contains=@perlInterpMatch -syn region perlQQ matchgroup=perlStringStartEnd start=+\<qr/+ end=+/[imosx]*+ contains=@perlInterpSlash +syn region perlStringUnexpanded matchgroup=perlStringStartEnd start="'" end="'" contains=@perlInterpSQ keepend +syn region perlString matchgroup=perlStringStartEnd start=+"+ end=+"+ contains=@perlInterpDQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\>\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q#+ end=+#+ contains=@perlInterpSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend + +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\>\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpDQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]#+ end=+#+ contains=@perlInterpDQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*(+ end=+)+ contains=@perlInterpDQ,perlParensDQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*\[+ end=+\]+ contains=@perlInterpDQ,perlBracketsDQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*{+ end=+}+ contains=@perlInterpDQ,perlBracesDQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!q[qx]\s*<+ end=+>+ contains=@perlInterpDQ,perlAnglesDQ keepend + +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*\z([^[:space:]#([{<]\)+ end=+\z1+ contains=@perlInterpSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw#+ end=+#+ contains=@perlInterpSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*(+ end=+)+ contains=@perlInterpSQ,perlParensSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*\[+ end=+\]+ contains=@perlInterpSQ,perlBracketsSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*{+ end=+}+ contains=@perlInterpSQ,perlBracesSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qw\s*<+ end=+>+ contains=@perlInterpSQ,perlAnglesSQ keepend + +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\>\s*\z([^[:space:]#([{<'/]\)+ end=+\z1[imosx]*+ contains=@perlInterpMatch keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*/+ end=+/[imosx]*+ contains=@perlInterpSlash keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr#+ end=+#[imosx]*+ contains=@perlInterpMatch keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*'+ end=+'[imosx]*+ contains=@perlInterpSQ keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*(+ end=+)[imosx]*+ contains=@perlInterpMatch,perlParensDQ keepend + +" A special case for qr{}, qr<> and qr[] which allows for comments and extra whitespace in the pattern +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*{+ end=+}[imosx]*+ contains=@perlInterpMatch,perlBracesDQ,perlComment keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*<+ end=+>[imosx]*+ contains=@perlInterpMatch,perlAnglesDQ,perlComment keepend +syn region perlQQ matchgroup=perlStringStartEnd start=+\<\%(::\|'\|->\)\@<!qr\s*\[+ end=+\][imosx]*+ contains=@perlInterpMatch,perlBracketsDQ,perlComment keepend " Constructs such as print <<EOF [...] EOF, 'here' documents " -if version >= 600 - " XXX Any statements after the identifier are in perlString colour (i.e. - " 'if $a' in 'print <<EOF if $a'). - if exists("perl_fold") - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\z(\I\i*\).*+ end=+^\z1$+ contains=@perlInterpDQ fold - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*"\z(.\{-}\)"+ end=+^\z1$+ contains=@perlInterpDQ fold - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*'\z(.\{-}\)'+ end=+^\z1$+ contains=@perlInterpSQ fold - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*""+ end=+^$+ contains=@perlInterpDQ,perlNotEmptyLine fold - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*''+ end=+^$+ contains=@perlInterpSQ,perlNotEmptyLine fold - syn region perlAutoload matchgroup=perlStringStartEnd start=+<<['"]\z(END_\(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)['"]+ end=+^\z1$+ contains=ALL fold - else - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\z(\I\i*\)+ end=+^\z1$+ contains=@perlInterpDQ - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*"\z(.\{-}\)"+ end=+^\z1$+ contains=@perlInterpDQ - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*'\z(.\{-}\)'+ end=+^\z1$+ contains=@perlInterpSQ - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*""+ end=+^$+ contains=@perlInterpDQ,perlNotEmptyLine - syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*''+ end=+^$+ contains=@perlInterpSQ,perlNotEmptyLine - syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\(['"]\|\)\z(END_\(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL - endif +" XXX Any statements after the identifier are in perlString colour (i.e. +" 'if $a' in 'print <<EOF if $a'). This is almost impossible to get right it +" seems due to the 'auto-extending nature' of regions. +if exists("perl_fold") + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\z(\I\i*\).*+ end=+^\z1$+ contains=@perlInterpDQ fold + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ end=+^\z1$+ contains=@perlInterpDQ fold + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ end=+^\z1$+ contains=@perlInterpSQ fold + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*""+ end=+^$+ contains=@perlInterpDQ,perlNotEmptyLine fold + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*''+ end=+^$+ contains=@perlInterpSQ,perlNotEmptyLine fold + syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL fold else - syn match perlUntilEOFStart "<<EOF.*"lc=5 nextgroup=perlUntilEOFDQ skipnl transparent - syn match perlUntilEOFStart "<<\s*\"EOF\".*" nextgroup=perlUntilEOFDQ skipnl transparent - syn match perlUntilEOFStart "<<\s*'EOF'.*" nextgroup=perlUntilEOFSQ skipnl transparent - syn match perlUntilEOFStart "<<\s*\"\".*" nextgroup=perlUntilEmptyDQ skipnl transparent - syn match perlUntilEOFStart "<<\s*''.*" nextgroup=perlUntilEmptySQ skipnl transparent - syn region perlUntilEOFDQ matchgroup=perlStringStartEnd start=++ end="^EOF$" contains=@perlInterpDQ contained - syn region perlUntilEOFSQ matchgroup=perlStringStartEnd start=++ end="^EOF$" contains=@perlInterpSQ contained - syn region perlUntilEmptySQ matchgroup=perlStringStartEnd start=++ end="^$" contains=@perlInterpDQ,perlNotEmptyLine contained - syn region perlUntilEmptyDQ matchgroup=perlStringStartEnd start=++ end="^$" contains=@perlInterpSQ,perlNotEmptyLine contained - syn match perlHereIdentifier "<<EOF" - syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\(['"]\|\)\(END_\(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\(END_\(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)$+ contains=ALL + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\z(\I\i*\)+ end=+^\z1$+ contains=@perlInterpDQ + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*"\z([^\\"]*\%(\\.[^\\"]*\)*\)"+ end=+^\z1$+ contains=@perlInterpDQ + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*'\z([^\\']*\%(\\.[^\\']*\)*\)'+ end=+^\z1$+ contains=@perlInterpSQ + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*""+ end=+^$+ contains=@perlInterpDQ,perlNotEmptyLine + syn region perlHereDoc matchgroup=perlStringStartEnd start=+<<\s*''+ end=+^$+ contains=@perlInterpSQ,perlNotEmptyLine + syn region perlAutoload matchgroup=perlStringStartEnd start=+<<\s*\(['"]\=\)\z(END_\%(SUB\|OF_FUNC\|OF_AUTOLOAD\)\)\1+ end=+^\z1$+ contains=ALL endif " Class declarations " -syn match perlPackageDecl "^\s*\<package\s\+\S\+" contains=perlStatementPackage +syn match perlPackageDecl "\<package\s\+\%(\h\|::\)\%(\w\|::\)*" contains=perlStatementPackage syn keyword perlStatementPackage package contained " Functions " sub [name] [(prototype)] { " -syn region perlFunction start="\s*\<sub\>" end="[;{]"he=e-1 contains=perlStatementSub,perlFunctionPrototype,perlFunctionPRef,perlFunctionName,perlComment -syn keyword perlStatementSub sub contained +syn match perlSubError "[^[:space:];{#]" contained +if v:version == 701 && !has('patch221') " XXX I hope that's the right one + syn match perlSubAttributes ":" contained +else + syn match perlSubAttributesCont "\h\w*\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained + syn region perlSubAttributesCont matchgroup=perlSubAttributesCont start="\h\w*(" end=")\_s*\%(:\_s*\)\=" nextgroup=@perlSubAttrMaybe contained contains=@perlInterpSQ,perlParensSQ + syn cluster perlSubAttrMaybe contains=perlSubAttributesCont,perlSubError + syn match perlSubAttributes "" contained nextgroup=perlSubError + syn match perlSubAttributes ":\_s*" contained nextgroup=@perlSubAttrMaybe +endif +syn match perlSubPrototypeError "(\%(\_s*\%(\%(\\\%([$@%&*]\|\[[$@%&*]\+\]\)\|[$&*]\|[@%]\%(\_s*)\)\@=\|;\%(\_s*[)$@%&*\\]\)\@=\|_\%(\_s*[);]\)\@=\)\_s*\)*\)\@>\zs\_[^)]\+" contained +syn match perlSubPrototype +(\_[^)]*)\_s*\|+ nextgroup=perlSubAttributes contained contains=perlSubPrototypeError +syn match perlSubName +\%(\h\|::\|'\w\)\%(\w\|::\|'\w\)*\_s*\|+ contained nextgroup=perlSubPrototype + +syn match perlFunction +\<sub\>\_s*+ nextgroup=perlSubName -syn match perlFunctionPrototype "([^)]*)" contained -if exists("perl_want_scope_in_variables") +if !exists("perl_no_scope_in_variables") syn match perlFunctionPRef "\h\w*::" contained syn match perlFunctionName "\h\w*[^:]" contained else syn match perlFunctionName "\h[[:alnum:]_:]*" contained endif +" The => operator forces a bareword to the left of it to be interpreted as +" a string +syn match perlString "\I\@<!-\?\I\i*\%(\s*=>\)\@=" + " All other # are comments, except ^#! -syn match perlComment "#.*" contains=perlTodo +syn match perlComment "#.*" contains=perlTodo,@Spell syn match perlSharpBang "^#!.*" " Formats syn region perlFormat matchgroup=perlStatementIOFunc start="^\s*\<format\s\+\k\+\s*=\s*$"rs=s+6 end="^\s*\.\s*$" contains=perlFormatName,perlFormatField,perlVarPlain,perlVarPlain2 syn match perlFormatName "format\s\+\k\+\s*="lc=7,me=e-1 contained -syn match perlFormatField "[@^][|<>~]\+\(\.\.\.\)\=" contained +syn match perlFormatField "[@^][|<>~]\+\%(\.\.\.\)\=" contained syn match perlFormatField "[@^]#[#.]*" contained syn match perlFormatField "@\*" contained syn match perlFormatField "@[^A-Za-z_|<>~#*]"me=e-1 contained @@ -383,161 +412,113 @@ syn match perlFormatField "@$" contained " __END__ and __DATA__ clauses if exists("perl_fold") - syntax region perlDATA start="^__\(DATA\|END\)__$" skip="." end="." contains=perlPOD,@perlDATA fold + syntax region perlDATA start="^__\%(DATA\|END\)__$" skip="." end="." contains=perlPOD,@perlDATA fold else - syntax region perlDATA start="^__\(DATA\|END\)__$" skip="." end="." contains=perlPOD,@perlDATA + syntax region perlDATA start="^__\%(DATA\|END\)__$" skip="." end="." contains=perlPOD,@perlDATA endif - -" -" Folding - -if exists("perl_fold") - if !exists("perl_nofold_packages") - syn region perlPackageFold start="^package \S\+;\s*\(#.*\)\=$" end="^1;\s*\(#.*\)\=$" end="\n\+package"me=s-1 transparent fold keepend - endif - if !exists("perl_nofold_subs") - syn region perlSubFold start="^\z(\s*\)\<sub\>.*[^};]$" end="^\z1}\s*\(#.*\)\=$" transparent fold keepend - syn region perlSubFold start="^\z(\s*\)\<\(BEGIN\|END\|CHECK\|INIT\)\>.*[^};]$" end="^\z1}\s*$" transparent fold keepend - endif - - if exists("perl_fold_blocks") - syn region perlBlockFold start="^\z(\s*\)\(if\|elsif\|unless\|for\|while\|until\)\s*(.*)\(\s*{\)\=\s*\(#.*\)\=$" start="^\z(\s*\)foreach\s*\(\(my\|our\)\=\s*\S\+\s*\)\=(.*)\(\s*{\)\=\s*\(#.*\)\=$" end="^\z1}\s*;\=\(#.*\)\=$" transparent fold keepend - syn region perlBlockFold start="^\z(\s*\)\(do\|else\)\(\s*{\)\=\s*\(#.*\)\=$" end="^\z1}\s*while" end="^\z1}\s*;\=\(#.*\)\=$" transparent fold keepend - endif - - setlocal foldmethod=syntax - syn sync fromstart +command -nargs=+ HiLink hi def link <args> + +" The default highlighting. +HiLink perlSharpBang PreProc +HiLink perlControl PreProc +HiLink perlInclude Include +HiLink perlSpecial Special +HiLink perlString String +HiLink perlCharacter Character +HiLink perlNumber Number +HiLink perlFloat Float +HiLink perlType Type +HiLink perlIdentifier Identifier +HiLink perlLabel Label +HiLink perlStatement Statement +HiLink perlConditional Conditional +HiLink perlRepeat Repeat +HiLink perlOperator Operator +HiLink perlFunction Keyword +HiLink perlSubName Function +HiLink perlSubPrototype Type +HiLink perlSubAttributes PreProc +HiLink perlSubAttributesCont perlSubAttributes +HiLink perlComment Comment +HiLink perlTodo Todo +if exists("perl_string_as_statement") + HiLink perlStringStartEnd perlStatement else - " fromstart above seems to set minlines even if perl_fold is not set. - syn sync minlines=0 + HiLink perlStringStartEnd perlString endif +HiLink perlVStringV perlStringStartEnd +HiLink perlList perlStatement +HiLink perlMisc perlStatement +HiLink perlVarPlain perlIdentifier +HiLink perlVarPlain2 perlIdentifier +HiLink perlArrow perlIdentifier +HiLink perlFiledescRead perlIdentifier +HiLink perlFiledescStatement perlIdentifier +HiLink perlVarSimpleMember perlIdentifier +HiLink perlVarSimpleMemberName perlString +HiLink perlVarNotInMatches perlIdentifier +HiLink perlVarSlash perlIdentifier +HiLink perlQQ perlString +HiLink perlHereDoc perlString +HiLink perlStringUnexpanded perlString +HiLink perlSubstitutionSQ perlString +HiLink perlSubstitutionGQQ perlString +HiLink perlTranslationGQ perlString +HiLink perlMatch perlString +HiLink perlMatchStartEnd perlStatement +HiLink perlFormatName perlIdentifier +HiLink perlFormatField perlString +HiLink perlPackageDecl perlType +HiLink perlStorageClass perlType +HiLink perlPackageRef perlType +HiLink perlStatementPackage perlStatement +HiLink perlStatementStorage perlStatement +HiLink perlStatementControl perlStatement +HiLink perlStatementScalar perlStatement +HiLink perlStatementRegexp perlStatement +HiLink perlStatementNumeric perlStatement +HiLink perlStatementList perlStatement +HiLink perlStatementHash perlStatement +HiLink perlStatementIOfunc perlStatement +HiLink perlStatementFiledesc perlStatement +HiLink perlStatementVector perlStatement +HiLink perlStatementFiles perlStatement +HiLink perlStatementFlow perlStatement +HiLink perlStatementInclude perlStatement +HiLink perlStatementProc perlStatement +HiLink perlStatementSocket perlStatement +HiLink perlStatementIPC perlStatement +HiLink perlStatementNetwork perlStatement +HiLink perlStatementPword perlStatement +HiLink perlStatementTime perlStatement +HiLink perlStatementMisc perlStatement +HiLink perlStatementIndirObj perlStatement +HiLink perlFunctionName perlIdentifier +HiLink perlMethod perlIdentifier +HiLink perlFunctionPRef perlType +HiLink perlPOD perlComment +HiLink perlShellCommand perlString +HiLink perlSpecialAscii perlSpecial +HiLink perlSpecialDollar perlSpecial +HiLink perlSpecialString perlSpecial +HiLink perlSpecialStringU perlSpecial +HiLink perlSpecialMatch perlSpecial +HiLink perlDATA perlComment +" Possible errors +HiLink perlNotEmptyLine Error +HiLink perlElseIfError Error +HiLink perlSubPrototypeError Error +HiLink perlSubError Error -if version >= 508 || !exists("did_perl_syn_inits") - if version < 508 - let did_perl_syn_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - " The default highlighting. - HiLink perlSharpBang PreProc - HiLink perlControl PreProc - HiLink perlInclude Include - HiLink perlSpecial Special - HiLink perlString String - HiLink perlCharacter Character - HiLink perlNumber Number - HiLink perlFloat Float - HiLink perlType Type - HiLink perlIdentifier Identifier - HiLink perlLabel Label - HiLink perlStatement Statement - HiLink perlConditional Conditional - HiLink perlRepeat Repeat - HiLink perlOperator Operator - HiLink perlFunction Function - HiLink perlFunctionPrototype perlFunction - HiLink perlComment Comment - HiLink perlTodo Todo - if exists("perl_string_as_statement") - HiLink perlStringStartEnd perlStatement - else - HiLink perlStringStartEnd perlString - endif - HiLink perlList perlStatement - HiLink perlMisc perlStatement - HiLink perlVarPlain perlIdentifier - HiLink perlVarPlain2 perlIdentifier - HiLink perlFiledescRead perlIdentifier - HiLink perlFiledescStatement perlIdentifier - HiLink perlVarSimpleMember perlIdentifier - HiLink perlVarSimpleMemberName perlString - HiLink perlVarNotInMatches perlIdentifier - HiLink perlVarSlash perlIdentifier - HiLink perlQQ perlString - if version >= 600 - HiLink perlHereDoc perlString - else - HiLink perlHereIdentifier perlStringStartEnd - HiLink perlUntilEOFDQ perlString - HiLink perlUntilEOFSQ perlString - HiLink perlUntilEmptyDQ perlString - HiLink perlUntilEmptySQ perlString - HiLink perlUntilEOF perlString - endif - HiLink perlStringUnexpanded perlString - HiLink perlSubstitutionSQ perlString - HiLink perlSubstitutionDQ perlString - HiLink perlSubstitutionSlash perlString - HiLink perlSubstitutionHash perlString - HiLink perlSubstitutionBracket perlString - HiLink perlSubstitutionCurly perlString - HiLink perlSubstitutionPling perlString - HiLink perlTranslationSlash perlString - HiLink perlTranslationHash perlString - HiLink perlTranslationBracket perlString - HiLink perlTranslationCurly perlString - HiLink perlMatch perlString - HiLink perlMatchStartEnd perlStatement - HiLink perlFormatName perlIdentifier - HiLink perlFormatField perlString - HiLink perlPackageDecl perlType - HiLink perlStorageClass perlType - HiLink perlPackageRef perlType - HiLink perlStatementPackage perlStatement - HiLink perlStatementSub perlStatement - HiLink perlStatementStorage perlStatement - HiLink perlStatementControl perlStatement - HiLink perlStatementScalar perlStatement - HiLink perlStatementRegexp perlStatement - HiLink perlStatementNumeric perlStatement - HiLink perlStatementList perlStatement - HiLink perlStatementHash perlStatement - HiLink perlStatementIOfunc perlStatement - HiLink perlStatementFiledesc perlStatement - HiLink perlStatementVector perlStatement - HiLink perlStatementFiles perlStatement - HiLink perlStatementFlow perlStatement - HiLink perlStatementScope perlStatement - HiLink perlStatementInclude perlStatement - HiLink perlStatementProc perlStatement - HiLink perlStatementSocket perlStatement - HiLink perlStatementIPC perlStatement - HiLink perlStatementNetwork perlStatement - HiLink perlStatementPword perlStatement - HiLink perlStatementTime perlStatement - HiLink perlStatementMisc perlStatement - HiLink perlStatementNew perlStatement - HiLink perlFunctionName perlIdentifier - HiLink perlMethod perlIdentifier - HiLink perlFunctionPRef perlType - HiLink perlPOD perlComment - HiLink perlShellCommand perlString - HiLink perlSpecialAscii perlSpecial - HiLink perlSpecialDollar perlSpecial - HiLink perlSpecialString perlSpecial - HiLink perlSpecialStringU perlSpecial - HiLink perlSpecialMatch perlSpecial - HiLink perlSpecialBEOM perlSpecial - HiLink perlDATA perlComment - - HiLink perlBrackets Error - - " Possible errors - HiLink perlNotEmptyLine Error - HiLink perlElseIfError Error - - delcommand HiLink -endif +delcommand HiLink " Syncing to speed up processing " if !exists("perl_no_sync_on_sub") syn sync match perlSync grouphere NONE "^\s*\<package\s" - syn sync match perlSync grouphere perlFunction "^\s*\<sub\s" + syn sync match perlSync grouphere NONE "^\s*\<sub\>" syn sync match perlSync grouphere NONE "^}" endif @@ -559,4 +540,5 @@ syn sync match perlSyncPOD grouphere NONE "^=cut" let b:current_syntax = "perl" -" vim: ts=8 +" XXX Change to sts=4:sw=4 +" vim:ts=8:sts=2:sw=2:expandtab:ft=vim diff --git a/runtime/syntax/perl6.vim b/runtime/syntax/perl6.vim new file mode 100644 index 000000000..6a3baba74 --- /dev/null +++ b/runtime/syntax/perl6.vim @@ -0,0 +1,2249 @@ +" Vim syntax file +" Language: Perl 6 +" Maintainer: Andy Lester <andy@petdance.com> +" Homepage: http://github.com/petdance/vim-perl/tree/master +" Last Change: 2009-07-04 + +" Contributors: Luke Palmer <fibonaci@babylonia.flatirons.org> +" Moritz Lenz <moritz@faui2k3.org> +" Hinrik Örn Sigurðsson <hinrik.sig@gmail.com> +" +" This is a big undertaking. Perl 6 is the sort of language that only Perl +" can parse. But I'll do my best to get vim to. +" +" You can associate the extension ".pl" with the filetype "perl6" by setting +" autocmd BufNewFile,BufRead *.pl setf perl6 +" in your ~/.vimrc. But that will infringe on Perl 5, so you might want to +" put a modeline near the beginning or end of your Perl 6 files instead: +" # vim: filetype=perl6 + +" TODO: +" * Deal with s:Perl5// +" * m:s// is a match, not a substitution +" * Make these highlight as strings, not operators: +" <==> <=:=> <===> <=~> <« »> «>» «<» +" * Allow more keywords to match as function calls(leave() is export(), etc) +" * Optimization: use nextgroup instead of lookaround (:help syn-nextgroup) +" * Fix s''' substitutions being matched as package names +" * Match s/// and m/// better, so things like "$s/" won't match +" * Add more support for folding (:help syn-fold) +" * Add more syntax syncing hooks (:help syn-sync) +" * Q//: +" :to, :heredoc +" interpolate \q:s{$scalar} (though the spec isn't very clear on it) +" +" Impossible TODO?: +" * Unspace +" * Unicode bracketing characters for quoting (there are so many) +" * Various tricks depending on context. I.e. we can't know when Perl +" expects «*» to be a string or a hyperoperator. The latter is presumably +" more common, so that's what we assume. +" * Selective highlighting of Pod formatting codes with the :allow option +" * Arbitrary number, order, and negation of adverbs to Q//, q//, qq//. +" Currently only the first adverb is considered significant. Anything +" more would require an exponential amount of regexes, making this +" already slow syntax file even slower. +" +" If you want to have Pir code inside Q:PIR// strings highlighted, do: +" let perl6_embedded_pir=1 +" +" The above requires pir.vim, which you can find in Parrot's repository: +" https://svn.parrot.org/parrot/trunk/editor/ +" +" Some less than crucial things have been made optional to speed things up. +" Look at the comments near the if/else branches in this file to see exactly +" which features are affected. "perl6_extended_all" enables everything. +" +" The defaults are: +" +" unlet perl6_extended_comments +" unlet perl6_extended_q +" unlet perl6_extended_all + +" For version 5.x: Clear all syntax items +" For version 6.x: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +" identifiers +syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*" + +" This is used in the for loops below +" Don't use the "syn keyword" construct because that always has higher +" priority than matches/regions, so the words can't be autoquoted with +" the "=>" and "p5=>" operators. All the lookaround stuff is to make sure +" we don't match them as part of some other identifier. +let s:before_keyword = " display \"\\%(\\k\\|\\K\\@<=[-']\\)\\@<!\\%(" +let s:after_keyword = "\\)\\%(\\k\\|[-']\\K\\@=\\)\\@!\"" + +" Billions of keywords +let s:keywords = { + \ "p6Attention": [ + \ "ACHTUNG ATTN ATTENTION FIXME NB TODO TBD WTF XXX NOTE", + \ ], + \ "p6DeclareRoutine": [ + \ "macro sub submethod method multi proto only rule token regex category", + \ ], + \ "p6Module": [ + \ "module class role package enum grammar slang subset", + \ ], + \ "p6Variable": [ + \ "self", + \ ], + \ "p6Include": [ + \ "use require", + \ ], + \ "p6Conditional": [ + \ "if else elsif unless", + \ ], + \ "p6VarStorage": [ + \ "let my our state temp has constant", + \ ], + \ "p6Repeat": [ + \ "for loop repeat while until gather given", + \ ], + \ "p6FlowControl": [ + \ "take do when next last redo return contend maybe defer", + \ "default exit make continue break goto leave async lift", + \ ], + \ "p6TypeConstraint": [ + \ "is as but trusts of returns handles where augment supersede", + \ ], + \ "p6ClosureTrait": [ + \ "BEGIN CHECK INIT START FIRST ENTER LEAVE KEEP", + \ "UNDO NEXT LAST PRE POST END CATCH CONTROL TEMP", + \ ], + \ "p6Exception": [ + \ "die fail try warn", + \ ], + \ "p6Property": [ + \ "prec irs ofs ors export deep binary unary reparsed rw parsed cached", + \ "readonly defequiv will ref copy inline tighter looser equiv assoc", + \ "required", + \ ], + \ "p6Number": [ + \ "NaN Inf", + \ ], + \ "p6Pragma": [ + \ "oo fatal", + \ ], + \ "p6Type": [ + \ "Object Any Junction Whatever Capture Match", + \ "Signature Proxy Matcher Package Module Class", + \ "Grammar Scalar Array Hash KeyHash KeySet KeyBag", + \ "Pair List Seq Range Set Bag Mapping Void Undef", + \ "Failure Exception Code Block Routine Sub Macro", + \ "Method Submethod Regex Str Blob Char Byte", + \ "Codepoint Grapheme StrPos StrLen Version Num", + \ "Complex num complex Bit bit bool True False", + \ "Increasing Decreasing Ordered Callable AnyChar", + \ "Positional Associative Ordering KeyExtractor", + \ "Comparator OrderingPair IO KitchenSink Role", + \ "Int int int1 int2 int4 int8 int16 int32 int64", + \ "Rat rat rat1 rat2 rat4 rat8 rat16 rat32 rat64", + \ "Buf buf buf1 buf2 buf4 buf8 buf16 buf32 buf64", + \ "UInt uint uint1 uint2 uint4 uint8 uint16 uint32", + \ "uint64 Abstraction utf8 utf16 utf32", + \ ], + \ "p6Operator": [ + \ "div x xx mod also leg cmp before after eq ne le lt", + \ "gt ge eqv ff fff and andthen Z X or xor", + \ "orelse extra m mm rx s tr", + \ ], +\ } + +for [group, words] in items(s:keywords) + let s:words_space = join(words, " ") + let s:temp = split(s:words_space) + let s:words = join(s:temp, "\\|") + exec "syn match ". group ." ". s:before_keyword . s:words . s:after_keyword +endfor +unlet s:keywords s:words_space s:temp s:words + +" More operators +" Don't put a "\+" at the end of the character class. That makes it so +" greedy that the "%" " in "+%foo" won't be allowed to match as a sigil, +" among other things +syn match p6Operator display "[-+/*~?|=^!%&,<>.;\\]" +syn match p6Operator display "\%(:\@<!::\@!\|::=\|\.::\)" +" these require whitespace on the left side +syn match p6Operator display "\%(\s\|^\)\@<=\%(xx=\|p5=>\)" +" "i" requires a digit to the left, and no keyword char to the right +syn match p6Operator display "\d\@<=i\k\@!" +" index overloading +syn match p6Operator display "\%(&\.(\@=\|@\.\[\@=\|%\.{\@=\)" + +" all infix operators except nonassocative ones +let s:infix_a = [ + \ "div % mod +& +< +> \\~& ?& \\~< \\~> +| +\\^ \\~| \\~\\^ ?| ?\\^ xx x", + \ "\\~ && & also <== ==> <<== ==>> == != < <= > >= \\~\\~ eq ne lt le gt", + \ "ge =:= === eqv before after \\^\\^ min max \\^ff ff\\^ \\^ff\\^", + \ "\\^fff fff\\^ \\^fff\\^ fff ff ::= := \\.= => , : p5=> Z minmax", + \ "\\.\\.\\. and andthen or orelse xor \\^ += -= /= \\*= \\~= //= ||=", + \ "+ - \\*\\* \\* // / \\~ || |", +\ ] +" nonassociative infix operators +let s:infix_n = "but does <=> leg cmp \\.\\. \\.\\.\\^\\^ \\^\\.\\. \\^\\.\\.\\^" + +let s:infix_a_long = join(s:infix_a, " ") +let s:infix_a_words = split(s:infix_a_long) +let s:infix_a_pattern = join(s:infix_a_words, "\\|") + +let s:infix_n_words = split(s:infix_n) +let s:infix_n_pattern = join(s:infix_n_words, "\\|") + +let s:both = [s:infix_a_pattern, s:infix_n_pattern] +let s:infix = join(s:both, "\\|") + +let s:infix_assoc = "!\\?\\%(" . s:infix_a_pattern . "\\)" +let s:infix = "!\\?\\%(" . s:infix . "\\)" + +unlet s:infix_a s:infix_a_long s:infix_a_words s:infix_a_pattern +unlet s:infix_n s:infix_n_pattern s:both + +" [+] reduce +exec "syn match p6ReduceOp display \"\\k\\@<!\\[[R\\\\]\\?!\\?". s:infix_assoc ."]\\%(«\\|<<\\)\\?\"" +unlet s:infix_assoc + +" Reverse and cross operators (Rop, Xop) +exec "syn match p6ReverseCrossOp display \"[RX]". s:infix ."\"" + +" q() or whatever() is always a function call +syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*(\@=" + +" basically all builtins that can be followed by parentheses +let s:routines = [ + \ "eager hyper substr index rindex grep map sort join lines hints chmod", + \ "split reduce min max reverse truncate zip cat roundrobin classify", + \ "first sum keys values pairs defined delete exists elems end kv any", + \ "all one wrap shape key value name pop push shift splice unshift floor", + \ "ceiling abs exp log log10 rand sign sqrt sin cos tan round strand", + \ "roots cis unpolar polar atan2 pick chop p5chop chomp p5chomp lc", + \ "lcfirst uc ucfirst capitalize normalize pack unpack quotemeta comb", + \ "samecase sameaccent chars nfd nfc nfkd nfkc printf sprintf caller", + \ "evalfile run runinstead nothing want bless chr ord gmtime time eof", + \ "localtime gethost getpw chroot getlogin getpeername kill fork wait", + \ "perl graphs codes bytes clone print open read write readline say seek", + \ "close opendir readdir slurp pos fmt vec link unlink symlink uniq pair", + \ "asin atan sec cosec cotan asec acosec acotan sinh cosh tanh asinh", + \ "acos acosh atanh sech cosech cotanh sech acosech acotanh asech ok", + \ "plan_ok dies_ok lives_ok skip todo pass flunk force_todo use_ok isa_ok", + \ "diag is_deeply isnt like skip_rest unlike cmp_ok eval_dies_ok nok_error", + \ "eval_lives_ok approx is_approx throws_ok version_lt plan eval succ pred", + \ "times nonce once signature new connect operator undef undefine sleep", + \ "from to infix postfix prefix circumfix postcircumfix minmax lazy count", + \ "unwrap getc pi e context void quasi body each contains rewinddir subst", + \ "can isa flush arity assuming rewind callwith callsame nextwith nextsame", + \ "attr eval_elsewhere none srand trim trim_start trim_end lastcall WHAT", + \ "WHERE HOW WHICH VAR WHO WHENCE ACCEPTS REJECTS does not true iterator by", + \ "re im invert flip", +\ ] + +" we want to highlight builtins like split() though, so this comes afterwards +" TODO: check if this would be faster as one big regex +let s:words_space = join(s:routines, " ") +let s:temp = split(s:words_space) +let s:words = join(s:temp, "\\|") +exec "syn match p6Routine ". s:before_keyword . s:words . s:after_keyword +unlet s:before_keyword s:after_keyword s:words_space s:temp s:words s:routines + +" packages, must come after all the keywords +syn match p6Normal display "\%(::\)\@<=\K\%(\k\|[-']\K\@=\)*" +syn match p6Normal display "\K\%(\k\|[-']\K\@=\)*\%(::\)\@=" + +" some standard packages +syn match p6Type display "\%(::\|\k\|\K\@<=[-']\)\@<!\%(Order\%(::Same\|::Increase\|::Decrease\)\?\)\%(\k\|[-']\K\@=\)\@!" +syn match p6Type display "\%(::\|\k\|\K\@<=[-']\)\@<!\%(Bool\%(::True\|::False\)\?\)\%(\k\|[-']\K\@=\)\@!" + + +syn match p6Shebang display "\%^#!.*" +syn match p6BlockLabel display "\%(^\s*\)\@<=\h\w*\s*::\@!\_s\@=" +syn match p6Number display "\k\@<!_\@!\%(\d\|__\@!\)\+_\@<!\%([eE]_\@!+\?\%(\d\|_\)\+\)\?_\@<!" +syn match p6Float display "\k\@<!_\@!\%(\d\|__\@!\)\+_\@<![eE]_\@!-\%(\d\|_\)\+" +syn match p6Float display "\k\@<!_\@<!\%(\d\|__\@!\)*_\@<!\.\@<!\._\@!\.\@!\a\@!\%(\d\|_\)\+_\@<!\%([eE]_\@!\%(\d\|_\)\+\)\?" + +syn match p6NumberBase display "[obxd]" contained +syn match p6Number display "\<0\%(o[0-7][0-7_]*\)\@=" nextgroup=p6NumberBase +syn match p6Number display "\<0\%(b[01][01_]*\)\@=" nextgroup=p6NumberBase +syn match p6Number display "\<0\%(x\x[[:xdigit:]_]*\)\@=" nextgroup=p6NumberBase +syn match p6Number display "\<0\%(d\d[[:digit:]_]*\)\@=" nextgroup=p6NumberBase +syn match p6Number display "\%(\<0o\)\@<=[0-7][0-7_]*" +syn match p6Number display "\%(\<0b\)\@<=[01][01_]*" +syn match p6Number display "\%(\<0x\)\@<=\x[[:xdigit:]_]*" +syn match p6Number display "\%(\<0d\)\@<=\d[[:digit:]_]*" + +syn match p6Version display "\<v\d\@=" nextgroup=p6VersionNum +syn match p6VersionNum display "\d\+" nextgroup=p6VersionDot contained +syn match p6VersionDot display "\.\%(\d\|\*\)\@=" nextgroup=p6VersionNum contained + +" try to distinguish the "is" function from the "is" trail auxiliary +syn match p6Routine display "\%(\%(\S\k\@<!\|^\)\s*\)\@<=is\>" + +" does is a type constraint sometimes +syn match p6TypeConstraint display "does\%(\s*\%(\k\|[-']\K\@=\)\)\@=" + +" int is a type sometimes +syn match p6Type display "\<int\>\%(\s*(\|\s\+\d\)\@!" + +" these Routine names are also Properties, if preceded by "is" +syn match p6Property display "\%(is\s\+\)\@<=\%(signature\|context\|also\|shape\)" + +" The sigil in ::*Package +syn match p6PackageTwigil display "\%(::\)\@<=\*" + +" $<match> +syn region p6MatchVarSigil + \ matchgroup=p6Variable + \ start="\$\%(<<\@!\)\@=" + \ end=">\@<=" + \ contains=p6MatchVar + +syn region p6MatchVar + \ matchgroup=p6Twigil + \ start="<" + \ end=">" + \ contained + +" Contextualizers +syn match p6Context display "\<\%(item\|list\|slice\|hash\)\>" +syn match p6Context display "\%(\$\|@\|%\|&\|@@\)(\@=" + +" the "$" placeholder in "$var1, $, var2 = @list" +syn match p6Placeholder display "\%(,\s*\)\@<=\$\%(\K\|\%([.^*?=!~]\|:\@<!::\@!\)\)\@!" +syn match p6Placeholder display "\$\%(\K\|\%([.^*?=!~]\|:\@<!::\@!\)\)\@!\%(,\s*\)\@=" + +" Quoting + +" one cluster for every quote adverb +syn cluster p6Interp_s + \ add=p6InterpScalar +syn cluster p6Interp_scalar + \ add=p6InterpScalar + +syn cluster p6Interp_a + \ add=p6InterpArray +syn cluster p6Interp_array + \ add=p6InterpArray + +syn cluster p6Interp_h + \ add=p6InterpHash +syn cluster p6Interp_hash + \ add=p6InterpHash + +syn cluster p6Interp_f + \ add=p6InterpFunction +syn cluster p6Interp_f + \ add=p6InterpFunction + +syn cluster p6Interp_c + \ add=p6InterpClosure +syn cluster p6Interp_closure + \ add=p6InterpClosure + + +if exists("perl6_extended_q") || exists("perl6_extended_all") + syn cluster p6Interp_ww + \ add=p6StringSQ + \ add=p6StringDQ + syn cluster p6Interp_quotewords + \ add=p6StringSQ + \ add=p6StringDQ +endif + +syn cluster p6Interp_q + \ add=p6EscQQ + \ add=p6EscBackSlash +syn cluster p6Interp_single + \ add=p6EscQQ + \ add=p6EscBackSlash + +syn cluster p6Interp_b + \ add=@p6Interp_q + \ add=p6Escape + \ add=p6EscOpenCurly + \ add=p6EscCodePoint + \ add=p6EscHex + \ add=p6EscOct + \ add=p6EscOctOld + \ add=p6EscNull +syn cluster p6Interp_backslash + \ add=@p6Interp_q + \ add=p6Escape + \ add=p6EscOpenCurly + \ add=p6EscCodePoint + \ add=p6EscHex + \ add=p6EscOct + \ add=p6EscOctOld + \ add=p6EscNull + +syn cluster p6Interp_qq + \ add=@p6Interp_scalar + \ add=@p6Interp_array + \ add=@p6Interp_hash + \ add=@p6Interp_function + \ add=@p6Interp_closure + \ add=@p6Interp_backslash +syn cluster p6Interp_double + \ add=@p6Interp_scalar + \ add=@p6Interp_array + \ add=@p6Interp_hash + \ add=@p6Interp_function + \ add=@p6Interp_closure + \ add=@p6Interp_backslash + +syn region p6InterpScalar + \ start="\ze\z(\$\%(\%(\%(\d\+\|!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" + \ start="\ze\z(\$\%(\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\|\%(\d\+\|!\|/\|¢\)\)\)" + \ end="\z1\zs" + \ contained + \ contains=TOP + \ keepend + +syn region p6InterpScalar + \ matchgroup=p6Context + \ start="\$\ze()\@!" + \ skip="([^)]*)" + \ end=")\zs" + \ contained + \ contains=TOP + +syn region p6InterpArray + \ start="\ze\z(@\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" + \ end="\z1\zs" + \ contained + \ contains=TOP + \ keepend + +syn region p6InterpArray + \ matchgroup=p6Context + \ start="@\ze()\@!" + \ start="@@\ze()\@!" + \ skip="([^)]*)" + \ end=")\zs" + \ contained + \ contains=TOP + +syn region p6InterpHash + \ start="\ze\z(%\$*\%(\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\)\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" + \ end="\z1\zs" + \ contained + \ contains=TOP + \ keepend + +syn region p6InterpHash + \ matchgroup=p6Context + \ start="%\ze()\@!" + \ skip="([^)]*)" + \ end=")\zs" + \ contained + \ contains=TOP + +syn region p6InterpFunction + \ start="\ze\z(&\%(\%(!\|/\|¢\)\|\%(\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\@=\)\?\K\%(\k\|[-']\K\@=\)*\%(\.\%(\K\%(\k\|[-']\K\@=\)*\)\|\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)*\)\.\?\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\)\)" + \ end="\z1\zs" + \ contained + \ contains=TOP + \ keepend + +syn region p6InterpFunction + \ matchgroup=p6Context + \ start="&\ze()\@!" + \ skip="([^)]*)" + \ end=")\zs" + \ contained + \ contains=TOP + +syn region p6InterpClosure + \ start="\\\@<!{}\@!" + \ skip="{[^}]*}" + \ end="}" + \ contained + \ contains=TOP + \ keepend + +" generic escape +syn match p6Escape display "\\\S" contained + +" escaped closing delimiters +syn match p6EscQuote display "\\'" contained +syn match p6EscDoubleQuote display "\\\"" contained +syn match p6EscCloseAngle display "\\>" contained +syn match p6EscCloseFrench display "\\»" contained +syn match p6EscBackTick display "\\`" contained +syn match p6EscForwardSlash display "\\/" contained +syn match p6EscVerticalBar display "\\|" contained +syn match p6EscExclamation display "\\!" contained +syn match p6EscComma display "\\," contained +syn match p6EscDollar display "\\\$" contained +syn match p6EscCloseCurly display "\\}" contained +syn match p6EscCloseBracket display "\\\]" contained + +" misc escapes +syn match p6EscOctOld display "\\\d\{1,3}" contained +syn match p6EscNull display "\\0\d\@!" contained +syn match p6EscCodePoint display "\%(\\c\)\@<=\%(\d\|\S\|\[\)\@=" contained nextgroup=p6CodePoint +syn match p6EscHex display "\%(\\x\)\@<=\%(\x\|\[\)\@=" contained nextgroup=p6HexSequence +syn match p6EscOct display "\%(\\o\)\@<=\%(\o\|\[\)\@=" contained nextgroup=p6OctSequence +syn match p6EscQQ display "\\qq" contained nextgroup=p6QQSequence +syn match p6EscOpenCurly display "\\{" contained +syn match p6EscHash display "\\#" contained +syn match p6EscBackSlash display "\\\\" contained + +syn region p6QQSequence + \ matchgroup=p6Escape + \ start="\[" + \ skip="\[[^\]]*]" + \ end="]" + \ contained + \ transparent + \ contains=@p6Interp_qq + +syn match p6CodePoint display "\%(\d\+\|\S\)" contained +syn region p6CodePoint + \ matchgroup=p6Escape + \ start="\[" + \ end="]" + \ contained + +syn match p6HexSequence display "\x\+" contained +syn region p6HexSequence + \ matchgroup=p6Escape + \ start="\[" + \ end="]" + \ contained + +syn match p6OctSequence display "\o\+" contained +syn region p6OctSequence + \ matchgroup=p6Escape + \ start="\[" + \ end="]" + \ contained + +" matches :key, :!key, :$var, :key<var>, etc +" Since we don't know in advance how the adverb ends, we use a trick. +" Consume nothing with the start pattern (\ze at the beginning), +" while capturing the whole adverb into \z1 and then putting it before +" the match start (\zs) of the end pattern. +syn region p6Adverb + \ start="\ze\z(:!\?\K\%(\k\|[-']\K\@=\)*\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)" + \ start="\ze\z(:!\?[@$%]\$*\%(::\|\%(\$\@<=\d\+\|!\|/\|¢\)\|\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\)\|\%(\K\%(\k\|[-']\K\@=\)*\)\)\)" + \ end="\z1\zs" + \ contained + \ contains=TOP + \ keepend + +" <words> +" FIXME: not sure how to distinguish this from the "less than" operator +" in all cases. For now, it matches if any of the following is true: +" +" * There is whitespace missing on either side of the "<", since +" people tend to put spaces around "less than" +" * It comes after "enum", "for", "any", "all", or "none" +" * It's the first or last thing on a line (ignoring whitespace) +" * It's preceded by "= " +" +" It never matches when: +" +" * Preceded by [<+~=] (e.g. <<foo>>, =<$foo>) +" * Followed by [-=] (e.g. <--, <=, <==) +syn region p6StringAngle + \ matchgroup=p6Quote + \ start="\%(\<\%(enum\|for\|any\|all\|none\)\>\s*(\?\s*\)\@<=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!" + \ start="\%(\s\|[<+~=]\)\@<!<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!" + \ start="[<+~=]\@<!<\%(\s\|<\|=>\|[-=]\{1,2}>\@!\)\@!" + \ start="\%(^\s*\)\@<=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!" + \ start="[<+~=]\@<!<\%(\s*$\)\@=" + \ start="\%(=\s\+\)\@=<\%(<\|=>\|[-=]\{1,2}>\@!\)\@!" + \ skip="\\\@<!\\>" + \ end=">" + \ contains=p6InnerAnglesOne,p6EscBackSlash,p6EscCloseAngle + +syn region p6InnerAnglesOne + \ matchgroup=p6StringAngle + \ start="<" + \ skip="\\\@<!\\>" + \ end=">" + \ transparent + \ contained + \ contains=p6InnerAnglesOne + +" <<words>> +syn region p6StringAngles + \ matchgroup=p6Quote + \ start="<<=\@!" + \ skip="\\\@<!\\>" + \ end=">>" + \ contains=p6InnerAnglesTwo,@p6Interp_qq,p6Comment,p6EscHash,p6EscCloseAngle,p6Adverb,p6StringSQ,p6StringDQ + +syn region p6InnerAnglesTwo + \ matchgroup=p6StringAngles + \ start="<<" + \ skip="\\\@<!\\>" + \ end=">>" + \ transparent + \ contained + \ contains=p6InnerAnglesTwo + +" «words» +syn region p6StringFrench + \ matchgroup=p6Quote + \ start="«" + \ skip="\\\@<!\\»" + \ end="»" + \ contains=p6InnerFrench,@p6Interp_qq,p6Comment,p6EscHash,p6EscCloseFrench,p6Adverb,p6StringSQ,p6StringDQ + +syn region p6InnerFrench + \ matchgroup=p6StringFrench + \ start="«" + \ skip="\\\@<!\\»" + \ end="»" + \ transparent + \ contained + \ contains=p6InnerFrench + +" 'string' +syn region p6StringSQ + \ matchgroup=p6Quote + \ start="'" + \ skip="\\\@<!\\'" + \ end="'" + \ contains=@p6Interp_q,p6EscQuote + +" "string" +syn region p6StringDQ + \ matchgroup=p6Quote + \ start=+"+ + \ skip=+\\\@<!\\"+ + \ end=+"+ + \ contains=@p6Interp_qq,p6EscDoubleQuote + +" Q// and friends. + +syn match p6QuoteQ display "\%([Qq]\%(ww\|to\|[qwxsahfcb]\)\?\)\>" nextgroup=p6QPairs skipwhite skipempty +syn match p6QPairs contained transparent skipwhite skipempty nextgroup=p6StringQ,p6StringQ_PIR "\%(\_s*:!\?\K\%(\k\|[-']\K\@=\)*\%(([^)]*)\|\[[^\]]*]\|<[^>]*>\|«[^»]*»\|{[^}]*}\)\?\)*" + +if exists("perl6_embedded_pir") + syn include @p6PIR syntax/pir.vim +endif + +" hardcoded set of delimiters +let s:delims = [ + \ ["\\\"", "\\\"", "p6EscDoubleQuote", "\\\\\\@<!\\\\\\\""], + \ ["'", "'", "p6EscQuote", "\\\\\\@<!\\\\'"], + \ ["/", "/", "p6EscForwardSlash", "\\\\\\@<!\\\\/"], + \ ["`", "`", "p6EscBackTick", "\\\\\\@<!\\\\`"], + \ ["|", "|", "p6EscVerticalBar", "\\\\\\@<!\\\\|"], + \ ["!", "!", "p6EscExclamation", "\\\\\\@<!\\\\!"], + \ [",", ",", "p6EscComma", "\\\\\\@<!\\\\,"], + \ ["\\$", "\\$", "p6EscDollar", "\\\\\\@<!\\\\\\$"], + \ ["{", "}", "p6EscCloseCurly", "\\%(\\\\\\@<!\\\\}\\|{[^}]*}\\)"], + \ ["<", ">", "p6EscCloseAngle", "\\%(\\\\\\@<!\\\\>\\|<[^>]*>\\)"], + \ ["«", "»", "p6EscCloseFrench", "\\%(\\\\\\@<!\\\\»\\|«[^»]*»\\)"], + \ ["\\\[", "]", "p6EscCloseBracket", "\\%(\\\\\\@<!\\\\]\\|\\[^\\]]*]\\)"], + \ ["\\s\\@<=(", ")", "p6EscCloseParen", "\\%(\\\\\\@<!\\\\)\\|([^)]*)\\)"], +\ ] + +" double and triple delimiters too +if exists("perl6_extended_q") || exists("perl6_extended_all") + call add(s:delims, ["««", "»»", "p6EscCloseFrench", "\\%(\\\\\\@<!\\\\»»\\|««\\%([^»]\\|»»\\@!\\)*»»\\)"]) + call add(s:delims, ["«««", "»»»", "p6EscCloseFrench", "\\%(\\\\\\@<!\\\\»»»\\|«««\\%([^»]\\|»\\%(»»\\)\\@!\\)*»»»\\)"]) + call add(s:delims, ["{{", "}}", "p6EscCloseCurly", "\\%(\\\\\\@<!\\\\}}\\|{{\\%([^}]\\|}}\\@!\\)*}}\\)"]) + call add(s:delims, ["{{{", "}}}", "p6EscCloseCurly", "\\%(\\\\\\@<!\\\\}}}\\|{{{\\%([^}]\\|}\\%(}}\\)\\@!\\)*}}}\\)"]) + call add(s:delims, ["\\\[\\\[", "]]", "p6EscCloseBracket", "\\%(\\\\\\@<!\\\\]]\\|\\[\\[\\%([^\\]]\\|]]\\@!\\)*]]\\)"]) + call add(s:delims, ["\\\[\\\[\\\[", "]]]", "p6EscCloseBracket", "\\%(\\\\\\@<!\\\\]]]\\|\\[\\[\\[\\%([^\\]]\\|]\\%(]]\\)\\@!\\)*]]]\\)"]) + call add(s:delims, ["\\s\\@<=((", "))", "p6EscCloseParen", "\\%(\\\\\\@<!\\\\))\\|((\\%([^)]\\|))\\@!\\)*))\\)"]) + call add(s:delims, ["\\s\\@<=(((", ")))", "p6EscCloseParen", "\\%(\\\\\\@<!\\\\)))\\|(((\\%([^)]\\|)\\%())\\)\\@!\\)*)))\\)"]) + call add(s:delims, ["\\s\\@<=<<", ">>", "p6EscCloseAngle", "\\%(\\\\\\@<!\\\\>>\\|<<\\%([^>]\\|>>\\@!\\)*>>\\)"]) + call add(s:delims, ["\\s\\@<=<<<", ">>>", "p6EscCloseAngle", "\\%(\\\\\\@<!\\\\>>>\\|<<<\\%([^>]\\|>\\%(>>\\)\\@!\\)*>>>\\)"]) +endif + +if !exists("perl6_extended_q") && !exists("perl6_extended_all") + " simple version, no special highlighting within the string + for [start_delim, end_delim, end_group, skip] in s:delims + exec "syn region p6StringQ matchgroup=p6Quote start=\"".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=".end_group." contained" + endfor + + if exists("perl6_embedded_pir") + " highlight embedded PIR code + for [start_delim, end_delim, end_group, skip] in s:delims + exec "syn region p6StringQ_PIR matchgroup=p6Quote start=\"\\%(Q\\s*:PIR\\s*\\)\\@<=".start_delim."\" skip=\"".skip."\" end=\"".end_delim."\" contains=@p6PIR,".end_group." contained" + endfor + endif +else + let s:before = "syn region p6StringQ matchgroup=p6Quote start=\"\\%(" + let s:after = "\\%(\\_s*:!\\?\\K\\%(\\k\\|[-']\\K\\@=\\)*\\%(([^)]*)\\|\\[[^\\]]*]\\|<[^>]*>\\|«[^»]*»\\|{[^}]*}\\)\\?\\)*\\_s*\\)\\@<=" + + let s:adverbs = [ + \ ["s", "scalar"], + \ ["a", "array"], + \ ["h", "hash"], + \ ["f", "function"], + \ ["c", "closure"], + \ ["b", "backslash"], + \ ["w", "words"], + \ ["ww", "quotewords"], + \ ["x", "exec"], + \ ] + + " these can't be conjoined with q and qq (e.g. as qqq and qqqq) + let s:q_adverbs = [ + \ ["q", "single"], + \ ["qq", "double"], + \ ] + + for [start_delim, end_delim, end_group, skip] in s:delims + " Q, q, and qq with any number of (ignored) adverbs + exec s:before ."Q". s:after .start_delim."\" end=\"". end_delim ."\""." contained" + exec s:before ."q". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q"." contained" + exec s:before ."qq". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq"." contained" + + for [short, long] in s:adverbs + " Qs, qs, qqs, Qa, qa, qqa, etc, with ignored adverbs + exec s:before ."Q".short. s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long." contained" + exec s:before ."q".short. s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q,@p6Interp_".long." contained" + exec s:before ."qq".short. s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq,@p6Interp_".long." contained" + + " Q, q, and qq, with one significant adverb + exec s:before ."Q\\s*:\\%(".short."\\|".long."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long." contained" + for [q_short, q_long] in s:q_adverbs + exec s:before ."Q\\s*:\\%(".q_short."\\|".q_long."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".q_long." contained" + endfor + exec s:before ."q\\s*:\\%(".short."\\|".long."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q,@p6Interp_".long." contained" + exec s:before ."qq\\s*:\\%(".short."\\|".long."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq,@p6Interp_".long." contained" + + for [short2, long2] in s:adverbs + " Qs, qs, qqs, Qa, qa, qqa, etc, with one significant adverb + exec s:before ."Q".short."\\s*:\\%(".short2."\\|".long2."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long.",@p6Interp_".long2." contained" + for [q_short2, q_long2] in s:q_adverbs + exec s:before ."Q".short."\\s*:\\%(".q_short2."\\|".q_long2."\\)". s:after .start_delim ."\" end=\"". end_delim ."\" contains=@p6Interp_".long.",@p6Interp_".q_long2." contained" + endfor + exec s:before ."q".short."\\s*:\\%(".short2."\\|".long2."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_q,@p6Interp_".long.",@p6Interp_".long2." contained" + exec s:before ."qq".short."\\s*:\\%(".short2."\\|".long2."\\)". s:after .start_delim ."\" skip=\"". skip ."\" end=\"". end_delim ."\" contains=". end_group .",@p6Interp_qq,@p6Interp_".long.",@p6Interp_".long2." contained" + endfor + endfor + endfor + unlet s:before s:after s:adverbs s:q_adverbs +endif +unlet s:delims + +" Match these so something else above can't. E.g. the "q" in "role q { }" +" should not be considered a string +syn match p6Normal display "\%(\<\%(role\|grammar\|slang\)\s\+\)\@<=\K\%(\k\|[-']\K\@=\)*" + +" :key +syn match p6Operator display ":\@<!::\@!!\?" nextgroup=p6Key +syn match p6Key display "\k\%(\k\|[-']\K\@=\)*" contained + +" => and p5=> autoquoting +syn match p6StringP5Auto display "\K\%(\k\|[-']\K\@=\)*\ze\s\+p5=>" +syn match p6StringAuto display "\K\%(\k\|[-']\K\@=\)*\ze\%(p5\)\@<!=>" +syn match p6StringAuto display "\K\%(\k\|[-']\K\@=\)*\ze\s\+=>" +syn match p6StringAuto display "\K\%(\k\|[-']\K\@=\)*p5\ze=>" + +" Hyperoperators. Needs to come after the quoting operators (<>, «», etc) +exec "syn match p6HyperOp display \"»" .s:infix."»\\?\"" +exec "syn match p6HyperOp display \"«\\?".s:infix."«\"" +exec "syn match p6HyperOp display \"»" .s:infix."«\"" +exec "syn match p6HyperOp display \"«" .s:infix. "»\"" + +exec "syn match p6HyperOp display \">>" .s:infix."\\%(>>\\)\\?\"" +exec "syn match p6HyperOp display \"\\%(<<\\)\\?".s:infix."<<\"" +exec "syn match p6HyperOp display \">>" .s:infix."<<\"" +exec "syn match p6HyperOp display \"<<" .s:infix.">>\"" +unlet s:infix + +" Regexes and grammars + +syn match p6RegexName display "\%(\<\%(regex\|rule\|token\)\s\+\)\@<=\K\%(\k\|[-']\K\@=\)*" nextgroup=p6RegexBlockCrap skipwhite skipempty +syn match p6RegexBlockCrap "[^{]*" nextgroup=p6RegexBlock skipwhite skipempty transparent contained + +syn region p6RegexBlock + \ matchgroup=p6Normal + \ start="{" + \ end="}" + \ contained + \ contains=@p6Regexen,@p6Variables + +" Perl 6 regex bits + +syn cluster p6Regexen + \ add=p6RxMeta + \ add=p6RxEscape + \ add=p6EscHex + \ add=p6EscOct + \ add=p6EscNull + \ add=p6RxAnchor + \ add=p6RxCapture + \ add=p6RxGroup + \ add=p6RxAlternation + \ add=p6RxAdverb + \ add=p6RxAdverbArg + \ add=p6RxStorage + \ add=p6RxAssertion + \ add=p6RxQuoteWords + \ add=p6RxClosure + \ add=p6RxStringSQ + \ add=p6RxStringDQ + \ add=p6Comment + +syn match p6RxMeta display contained ".\%(\k\|\s\)\@<!" +syn match p6RxAnchor display contained "[$^]" +syn match p6RxEscape display contained "\\\S" +syn match p6RxCapture display contained "[()]" +syn match p6RxAlternation display contained "|" +syn match p6RxRange display contained "\.\." + +syn region p6RxClosure + \ matchgroup=p6Normal + \ start="{" + \ end="}" + \ contained + \ containedin=p6RxClosure + \ contains=TOP +syn region p6RxGroup + \ matchgroup=p6StringSpecial2 + \ start="\[" + \ end="]" + \ contained + \ contains=@p6Regexen,@p6Variables +syn region p6RxAssertion + \ matchgroup=p6StringSpecial2 + \ start="<" + \ end=">" + \ contained + \ contains=@p6Regexen,@p6Variables,p6RxCharClass,p6RxAssertCall +syn region p6RxAssertCall + \ matchgroup=p6Normal + \ start="\%(::\|\%(\K\%(\k\|[-']\K\@=\)*\)\)\@<=(\@=" + \ end=")\@<=" + \ contained + \ contains=TOP +syn region p6RxCharClass + \ matchgroup=p6StringSpecial2 + \ start="\%(<[-!+?]\?\)\@<=\[" + \ skip="\\]" + \ end="]" + \ contained + \ contains=p6RxRange,p6RxEscape,p6EscHex,p6EscOct,p6EscNull +syn region p6RxQuoteWords + \ matchgroup=p6StringSpecial2 + \ start="< " + \ end=">" + \ contained +syn region p6RxAdverb + \ start="\ze\z(:!\?\K\%(\k\|[-']\K\@=\)*\)" + \ end="\z1\zs" + \ contained + \ contains=TOP + \ keepend +syn region p6RxAdverbArg + \ start="\%(:!\?\K\%(\k\|[-']\K\@=\)*\)\@<=(" + \ skip="([^)]*)" + \ end=")" + \ contained + \ contains=TOP +syn region p6RxStorage + \ matchgroup=p6Operator + \ start="\%(^\s*\)\@<=:\%(my\>\|temp\>\)\@=" + \ end="$" + \ contains=TOP + \ contained + +" Perl 5 regex bits + +syn cluster p6RegexP5Base + \ add=p6RxP5Escape + \ add=p6RxP5Oct + \ add=p6RxP5Hex + \ add=p6RxP5EscMeta + \ add=p6RxP5CodePoint + \ add=p6RxP5Prop + +" normal regex stuff +syn cluster p6RegexP5 + \ add=@p6RegexP5Base + \ add=p6RxP5Quantifier + \ add=p6RxP5Meta + \ add=p6RxP5QuoteMeta + \ add=p6RxP5ParenMod + \ add=p6RxP5Verb + \ add=p6RxP5Count + \ add=p6RxP5Named + \ add=p6RxP5ReadRef + \ add=p6RxP5WriteRef + \ add=p6RxP5CharClass + \ add=p6RxP5Anchor + +" inside character classes +syn cluster p6RegexP5Class + \ add=@p6RegexP5Base + \ add=p6RxP5Posix + \ add=p6RxP5Range + +syn match p6RxP5Escape display contained "\\\S" +syn match p6RxP5CodePoint display contained "\\c\S\@=" nextgroup=p6RxP5CPId +syn match p6RxP5CPId display contained "\S" +syn match p6RxP5Oct display contained "\\\%(\o\{1,3}\)\@=" nextgroup=p6RxP5OctSeq +syn match p6RxP5OctSeq display contained "\o\{1,3}" +syn match p6RxP5Anchor display contained "[\^$]" +syn match p6RxP5Hex display contained "\\x\%({\x\+}\|\x\{1,2}\)\@=" nextgroup=p6RxP5HexSeq +syn match p6RxP5HexSeq display contained "\x\{1,2}" +syn region p6RxP5HexSeq + \ matchgroup=p6RxP5Escape + \ start="{" + \ end="}" + \ contained +syn region p6RxP5Named + \ matchgroup=p6RxP5Escape + \ start="\%(\\N\)\@<={" + \ end="}" + \ contained +syn match p6RxP5Quantifier display contained "\%([+*]\|(\@<!?\)" +syn match p6RxP5ReadRef display contained "\\[1-9]\d\@!" +syn match p6RxP5ReadRef display contained "\\k<\@=" nextgroup=p6RxP5ReadRefId +syn region p6RxP5ReadRefId + \ matchgroup=p6RxP5Escape + \ start="<" + \ end=">" + \ contained +syn match p6RxP5WriteRef display contained "\\g\%(\d\|{\)\@=" nextgroup=p6RxP5WriteRefId +syn match p6RxP5WriteRefId display contained "\d\+" +syn region p6RxP5WriteRefId + \ matchgroup=p6RxP5Escape + \ start="{" + \ end="}" + \ contained +syn match p6RxP5Prop display contained "\\[pP]\%(\a\|{\)\@=" nextgroup=p6RxP5PropId +syn match p6RxP5PropId display contained "\a" +syn region p6RxP5PropId + \ matchgroup=p6RxP5Escape + \ start="{" + \ end="}" + \ contained +syn match p6RxP5Meta display contained "[(|).]" +syn match p6RxP5ParenMod display contained "(\@<=?\@=" nextgroup=p6RxP5Mod,p6RxP5ModName,p6RxP5Code +syn match p6RxP5Mod display contained "?\%(<\?=\|<\?!\|[#:|]\)" +syn match p6RxP5Mod display contained "?-\?[impsx]\+" +syn match p6RxP5Mod display contained "?\%([-+]\?\d\+\|R\)" +syn match p6RxP5Mod display contained "?(DEFINE)" +syn match p6RxP5Mod display contained "?\%(&\|P[>=]\)" nextgroup=p6RxP5ModDef +syn match p6RxP5ModDef display contained "\h\w*" +syn region p6RxP5ModName + \ matchgroup=p6StringSpecial + \ start="?'" + \ end="'" + \ contained +syn region p6RxP5ModName + \ matchgroup=p6StringSpecial + \ start="?P\?<" + \ end=">" + \ contained +syn region p6RxP5Code + \ matchgroup=p6StringSpecial + \ start="??\?{" + \ end="})\@=" + \ contained + \ contains=TOP +syn match p6RxP5EscMeta display contained "\\[?*.{}()[\]|\^$]" +syn match p6RxP5Count display contained "\%({\d\+\%(,\%(\d\+\)\?\)\?}\)\@=" nextgroup=p6RxP5CountId +syn region p6RxP5CountId + \ matchgroup=p6RxP5Escape + \ start="{" + \ end="}" + \ contained +syn match p6RxP5Verb display contained "(\@<=\*\%(\%(PRUNE\|SKIP\|THEN\)\%(:[^)]*\)\?\|\%(MARK\|\):[^)]*\|COMMIT\|F\%(AIL\)\?\|ACCEPT\)" +syn region p6RxP5QuoteMeta + \ matchgroup=p6RxP5Escape + \ start="\\Q" + \ end="\\E" + \ contained + \ contains=@p6Variables,p6EscBackSlash +syn region p6RxP5CharClass + \ matchgroup=p6StringSpecial + \ start="\[\^\?" + \ skip="\\]" + \ end="]" + \ contained + \ contains=@p6RegexP5Class +syn region p6RxP5Posix + \ matchgroup=p6RxP5Escape + \ start="\[:" + \ end=":]" + \ contained +syn match p6RxP5Range display contained "-" + +" 'string' inside a regex +syn region p6RxStringSQ + \ matchgroup=p6Quote + \ start="'" + \ skip="\\\@<!\\'" + \ end="'" + \ contained + \ contains=p6EscQuote,p6EscBackSlash + +" "string" inside a regex +syn region p6RxStringDQ + \ matchgroup=p6Quote + \ start=+"+ + \ skip=+\\\@<!\\"+ + \ end=+"+ + \ contained + \ contains=p6EscDoubleQuote,p6EscBackSlash + +" $!, $var, $!var, $::var, $package::var $*::package::var, etc +" Thus must come after the matches for the "$" regex anchor, but before +" the match for the $ regex delimiter +syn cluster p6Variables + \ add=p6VarSlash + \ add=p6VarExclam + \ add=p6VarMatch + \ add=p6VarNum + \ add=p6Variable + +syn match p6VarSlash display "\$/" +syn match p6VarExclam display "\$!" +syn match p6VarMatch display "\$¢" +syn match p6VarNum display "\$\d\+" +syn match p6Variable display "\%(@@\|[@&$%]\$*\)\%(::\|\%(\%([.^*?=!~]\|:\@<!::\@!\)\K\)\|\K\)\@=" nextgroup=p6Twigil,p6VarName,p6PackageScope +syn match p6VarName display "\K\%(\k\|[-']\K\@=\)*" contained +syn match p6Twigil display "\%([.^*?=!~]\|:\@<!::\@!\)\K\@=" nextgroup=p6PackageScope,p6VarName contained +syn match p6PackageScope display "\%(\K\%(\k\|[-']\K\@=\)*\)\?::" nextgroup=p6PackageScope,p6VarName contained + +" Perl 6 regex regions + +" /foo/ +" Below some hacks to recognise the // variant. This is virtually impossible +" to catch in all cases as the / is used in so many other ways, but these +" should be the most obvious ones. +" TODO: mostly stolen from perl.vim, might need more work +syn region p6Match + \ matchgroup=p6Quote + \ start="\%([$@%&*]\@<!\%(\<\%(split\|while\|until\|if\|unless\)\|\.\.\|[-+*!~(\[{=]\)\s*\)\@<=//\@!" + \ start="^//\@!" + \ start=+\s\@<=/[^[:space:][:digit:]$@%=]\@=\%(/\_s*\%([([{$@%&*[:digit:]"'`]\|\_s\w\|[[:upper:]_abd-fhjklnqrt-wyz]\)\)\@!/\@!+ + \ skip="\\/" + \ end="/" + \ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum + +" m/foo/, mm/foo/, rx/foo/ +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=//\@!" + \ skip="\\/" + \ end="/" + \ keepend + \ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum + +" m!foo!, mm!foo!, rx!foo! +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=!!\@!" + \ skip="\\!" + \ end="!" + \ keepend + \ contains=@p6Regexen,p6Variable,p6VarSlash,p6VarMatch,p6VarNum + +" m$foo$, mm$foo$, rx$foo$, m|foo|, mm|foo|, rx|foo|, etc +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\z([\"'`|,$]\)\$\@!" + \ skip="\\\z1" + \ end="\z1" + \ keepend + \ contains=@p6Regexen,@p6Variables + +" m (foo), mm (foo), rx (foo) +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s\+\)\@<=()\@!)\@!" + \ skip="\\)" + \ end=")" + \ contains=@p6Regexen,@p6Variables + +" m[foo], mm[foo], rx[foo] +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\[]\@!]\@!" + \ skip="\\]" + \ end="]" + \ contains=@p6Regexen,@p6Variables + +" m{foo}, mm{foo}, rx{foo} +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<={}\@!}\@!" + \ skip="\\}" + \ end="}" + \ contains=@p6Regexen,@p6Variables + +" m<foo>, mm<foo>, rx<foo> +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=<>\@!>\@!" + \ skip="\\>" + \ end=">" + \ contains=@p6Regexen,@p6Variables + +" m«foo», mm«foo», rx«foo» +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<\%(mm\?\|rx\)\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=«»\@!»\@!" + \ skip="\\»" + \ end="»" + \ contains=@p6Regexen,@p6Variables + +" Substitutions + +" s/foo/bar/ +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=/" + \ skip="\\/" + \ end="/"me=e-1 + \ keepend + \ contains=@p6Regexen,p6Variable,p6VarExclam,p6VarMatch,p6VarNum + \ nextgroup=p6Substitution + +syn region p6Substitution + \ matchgroup=p6Quote + \ start="/" + \ skip="\\/" + \ end="/" + \ contained + \ keepend + \ contains=@p6Interp_qq + +" s!foo!bar! +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=!" + \ skip="\\!" + \ end="!"me=e-1 + \ keepend + \ contains=@p6Regexen,p6Variable,p6VarSlash,p6VarMatch,p6VarNum + \ nextgroup=p6Substitution + +syn region p6Substitution + \ matchgroup=p6Quote + \ start="!" + \ skip="\\!" + \ end="!" + \ contained + \ keepend + \ contains=@p6Interp_qq + +" s$foo$bar$, s|foo|bar, etc +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\z([\"'`|,$]\)" + \ skip="\\\z1" + \ end="\z1"me=e-1 + \ keepend + \ contains=@p6Regexen,@p6Variables + \ nextgroup=p6Substitution + +syn region p6Substitution + \ matchgroup=p6Quote + \ start="\z([\"'`|,$]\)" + \ skip="\\\z1" + \ end="\z1" + \ contained + \ keepend + \ contains=@p6Interp_qq + +" s{foo} +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<={}\@!" + \ skip="\\}" + \ end="}" + \ contains=@p6Regexen,@p6Variables + +" s[foo] +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\[]\@!" + \ skip="\\]" + \ end="]" + \ contains=@p6Regexen,@p6Variables + +" s<foo> +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=<>\@!" + \ skip="\\>" + \ end=">" + \ contains=@p6Regexen,@p6Variables + +" s«foo» +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=«»\@!" + \ skip="\\»" + \ end="»" + \ contains=@p6Regexen,@p6Variables + +" s (foo) +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<s\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s\+\)\@<=()\@!" + \ skip="\\)" + \ end=")" + \ contains=@p6Regexen,@p6Variables + +" Perl 5 regex regions + +" m:P5// +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=/" + \ skip="\\/" + \ end="/" + \ contains=@p6RegexP5,p6Variable,p6VarExclam,p6VarMatch,p6VarNum + +" m:P5!! +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=!" + \ skip="\\!" + \ end="!" + \ contains=@p6RegexP5,p6Variable,p6VarSlash,p6VarMatch,p6VarNum + +" m:P5$$, m:P5||, etc +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=\z([\"'`|,$]\)" + \ skip="\\\z1" + \ end="\z1" + \ contains=@p6RegexP5,@p6Variables + +" m:P5 () +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<m\s*:P\%(erl\)\?5\s\+\)\@<=()\@!" + \ skip="\\)" + \ end=")" + \ contains=@p6RegexP5,@p6Variables + +" m:P5[] +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=[]\@!" + \ skip="\\]" + \ end="]" + \ contains=@p6RegexP5,@p6Variables + +" m:P5{} +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<={}\@!" + \ skip="\\}" + \ end="}" + \ contains=@p6RegexP5,p6Variables + +" m:P5<> +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=<>\@!" + \ skip="\\>" + \ end=">" + \ contains=@p6RegexP5,p6Variables + +" m:P5«» +syn region p6Match + \ matchgroup=p6Quote + \ start="\%(\<m\s*:P\%(erl\)\?5\s*\)\@<=«»\@!" + \ skip="\\»" + \ end="»" + \ contains=@p6RegexP5,p6Variables + +" Transliteration + +" tr/foo/bar/, tr|foo|bar, etc +syn region p6String + \ matchgroup=p6Quote + \ start="\%(\<tr\%(\s*:!\?\k\%(\k\|[-']\K\@=\)*\%(([^)]*)\)\?\)*\s*\)\@<=\z([/\"'`|!,$]\)" + \ skip="\\\z1" + \ end="\z1"me=e-1 + \ contains=p6RxRange + \ nextgroup=p6Transliteration + +syn region p6Transliteration + \ matchgroup=p6Quote + \ start="\z([/\"'`|!,$]\)" + \ skip="\\\z1" + \ end="\z1" + \ contained + \ contains=@p6Interp_qq + +" Comments + +" normal end-of-line comment +syn match p6Comment display "#.*" contains=p6Attention + +" Multiline comments. Arbitrary numbers of opening brackets are allowed, +" but we only define regions for 1 to 3 +syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#(" + \ skip="([^)]*)" + \ end=")" + \ matchgroup=p6Error + \ start="^#(" + \ contains=p6Attention,p6Comment +syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#\[" + \ skip="\[[^\]]*]" + \ end="]" + \ matchgroup=p6Error + \ start="^#\[" + \ contains=p6Attention,p6Comment +syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#{" + \ skip="{[^}]*}" + \ end="}" + \ matchgroup=p6Error + \ start="^#{" + \ contains=p6Attention,p6Comment +syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#<" + \ skip="<[^>]*>" + \ end=">" + \ matchgroup=p6Error + \ start="^#<" + \ contains=p6Attention,p6Comment +syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#«" + \ skip="«[^»]*»" + \ end="»" + \ matchgroup=p6Error + \ start="^#«" + \ contains=p6Attention,p6Comment + +" double and triple delimiters +if exists("perl6_extended_comments") || exists("perl6_extended_all") + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#((" + \ skip="((\%([^)\|))\@!]\)*))" + \ end="))" + \ matchgroup=p6Error + \ start="^#((" + \ contains=p6Attention,p6Comment + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#(((" + \ skip="(((\%([^)]\|)\%())\)\@!\)*)))" + \ end=")))" + \ matchgroup=p6Error + \ start="^#(((" + \ contains=p6Attention,p6Comment + + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#\[\[" + \ skip="\[\[\%([^\]]\|]]\@!\)*]]" + \ end="]]" + \ matchgroup=p6Error + \ start="^#\[\[" + \ contains=p6Attention,p6Comment + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#\[\[\[" + \ skip="\[\[\[\%([^\]]\|]\%(]]\)\@!\)*]]]" + \ end="]]]" + \ matchgroup=p6Error + \ start="^#\[\[\[" + \ contains=p6Attention,p6Comment + + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#{{" + \ skip="{{\%([^}]\|}}\@!\)*}}" + \ end="}}" + \ matchgroup=p6Error + \ start="^#{{" + \ contains=p6Attention,p6Comment + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#{{{" + \ skip="{{{\%([^}]\|}\%(}}\)\@!\)*}}}" + \ end="}}}" + \ matchgroup=p6Error + \ start="^#{{{" + \ contains=p6Attention,p6Comment + + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#<<" + \ skip="<<\%([^>]\|>>\@!\)*>>" + \ end=">>" + \ matchgroup=p6Error + \ start="^#<<" + \ contains=p6Attention,p6Comment + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#<<<" + \ skip="<<<\%([^>]\|>\%(>>\)\@!\)*>>>" + \ end=">>>" + \ matchgroup=p6Error + \ start="^#<<<" + \ contains=p6Attention,p6Comment + + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#««" + \ skip="««\%([^»]\|»»\@!\)*»»" + \ end="»»" + \ matchgroup=p6Error + \ start="^#««" + \ contains=p6Attention,p6Comment + syn region p6Comment + \ matchgroup=p6Comment + \ start="^\@<!#«««" + \ skip="«««\%([^»]\|»\%(»»\)\@!\)*»»»" + \ end="»»»" + \ matchgroup=p6Error + \ start="^#«««" + \ contains=p6Attention,p6Comment +endif + +" Pod + +" Abbreviated blocks (implicit code forbidden) +syn region p6PodAbbrRegion + \ matchgroup=p6PodPrefix + \ start="^=\ze\K\k*" + \ end="^\ze\%(\s*$\|=\K\)" + \ contains=p6PodAbbrNoCodeType + \ keepend + +syn region p6PodAbbrNoCodeType + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=p6PodName,p6PodAbbrNoCode + +syn match p6PodName contained ".\+" contains=@p6PodFormat +syn match p6PodComment contained ".\+" + +syn region p6PodAbbrNoCode + \ start="^" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=@p6PodFormat + +" Abbreviated blocks (everything is code) +syn region p6PodAbbrRegion + \ matchgroup=p6PodPrefix + \ start="^=\zecode\>" + \ end="^\ze\%(\s*$\|=\K\)" + \ contains=p6PodAbbrCodeType + \ keepend + +syn region p6PodAbbrCodeType + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=p6PodName,p6PodAbbrCode + +syn region p6PodAbbrCode + \ start="^" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + +" Abbreviated blocks (everything is a comment) +syn region p6PodAbbrRegion + \ matchgroup=p6PodPrefix + \ start="^=\zecomment\>" + \ end="^\ze\%(\s*$\|=\K\)" + \ contains=p6PodAbbrCommentType + \ keepend + +syn region p6PodAbbrCommentType + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=p6PodComment,p6PodAbbrNoCode + +" Abbreviated blocks (implicit code allowed) +syn region p6PodAbbrRegion + \ matchgroup=p6PodPrefix + \ start="^=\ze\%(pod\|item\|nested\|\u\+\)\>" + \ end="^\ze\%(\s*$\|=\K\)" + \ contains=p6PodAbbrType + \ keepend + +syn region p6PodAbbrType + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=p6PodName,p6PodAbbr + +syn region p6PodAbbr + \ start="^" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=@p6PodFormat,p6PodImplicitCode + +" Abbreviated block to end-of-file +syn region p6PodAbbrRegion + \ matchgroup=p6PodPrefix + \ start="^=\zeEND\>" + \ end="\%$" + \ contains=p6PodAbbrEOFType + \ keepend + +syn region p6PodAbbrEOFType + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="\%$" + \ contained + \ contains=p6PodName,p6PodAbbrEOF + +syn region p6PodAbbrEOF + \ start="^" + \ end="\%$" + \ contained + \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode + +" Directives +syn region p6PodDirectRegion + \ matchgroup=p6PodPrefix + \ start="^=\%(config\|use\)\>" + \ end="^\ze\%([^=]\|=\K\|\s*$\)" + \ contains=p6PodDirectArgRegion + \ keepend + +syn region p6PodDirectArgRegion + \ matchgroup=p6PodType + \ start="\S\+" + \ end="^\ze\%([^=]\|=\K\|\s*$\)" + \ contained + \ contains=p6PodDirectConfigRegion + +syn region p6PodDirectConfigRegion + \ start="" + \ end="^\ze\%([^=]\|=\K\|\s*$\)" + \ contained + \ contains=@p6PodConfig + +" =encoding is a special directive +syn region p6PodDirectRegion + \ matchgroup=p6PodPrefix + \ start="^=encoding\>" + \ end="^\ze\%([^=]\|=\K\|\s*$\)" + \ contains=p6PodEncodingArgRegion + \ keepend + +syn region p6PodEncodingArgRegion + \ matchgroup=p6PodName + \ start="\S\+" + \ end="^\ze\%([^=]\|=\K\|\s*$\)" + \ contained + +" Paragraph blocks (implicit code forbidden) +syn region p6PodParaRegion + \ matchgroup=p6PodPrefix + \ start="^=for\>" + \ end="^\ze\%(\s*$\|=\K\)" + \ contains=p6PodParaNoCodeTypeRegion + \ keepend + \ extend + +syn region p6PodParaNoCodeTypeRegion + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=p6PodParaNoCode,p6PodParaConfigRegion + +syn region p6PodParaConfigRegion + \ start="" + \ end="^\ze\%([^=]\|=\k\@<!\)" + \ contained + \ contains=@p6PodConfig + +syn region p6PodParaNoCode + \ start="^[^=]" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=@p6PodFormat + +" Paragraph blocks (everything is code) +syn region p6PodParaRegion + \ matchgroup=p6PodPrefix + \ start="^=for\>\ze\s*code\>" + \ end="^\ze\%(\s*$\|=\K\)" + \ contains=p6PodParaCodeTypeRegion + \ keepend + \ extend + +syn region p6PodParaCodeTypeRegion + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=p6PodParaCode,p6PodParaConfigRegion + +syn region p6PodParaCode + \ start="^[^=]" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + +" Paragraph blocks (implicit code allowed) +syn region p6PodParaRegion + \ matchgroup=p6PodPrefix + \ start="^=for\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" + \ end="^\ze\%(\s*$\|=\K\)" + \ contains=p6PodParaTypeRegion + \ keepend + \ extend + +syn region p6PodParaTypeRegion + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=p6PodPara,p6PodParaConfigRegion + +syn region p6PodPara + \ start="^[^=]" + \ end="^\ze\%(\s*$\|=\K\)" + \ contained + \ contains=@p6PodFormat,p6PodImplicitCode + +" Paragraph block to end-of-file +syn region p6PodParaRegion + \ matchgroup=p6PodPrefix + \ start="^=for\>\ze\s\+END\>" + \ end="\%$" + \ contains=p6PodParaEOFTypeRegion + \ keepend + \ extend + +syn region p6PodParaEOFTypeRegion + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="\%$" + \ contained + \ contains=p6PodParaEOF,p6PodParaConfigRegion + +syn region p6PodParaEOF + \ start="^[^=]" + \ end="\%$" + \ contained + \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode + +" Delimited blocks (implicit code forbidden) +syn region p6PodDelimRegion + \ matchgroup=p6PodPrefix + \ start="^=begin\>" + \ end="^=end\>" + \ contains=p6PodDelimNoCodeTypeRegion + \ keepend + \ extend + +syn region p6PodDelimNoCodeTypeRegion + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze=end\>" + \ contained + \ contains=p6PodDelimNoCode,p6PodDelimConfigRegion + +syn region p6PodDelimConfigRegion + \ start="" + \ end="^\ze\%([^=]\|=\K\|\s*$\)" + \ contained + \ contains=@p6PodConfig + +syn region p6PodDelimNoCode + \ start="^" + \ end="^\ze=end\>" + \ contained + \ contains=@p6PodNestedBlocks,@p6PodFormat + +" Delimited blocks (everything is code) +syn region p6PodDelimRegion + \ matchgroup=p6PodPrefix + \ start="^=begin\>\ze\s*code\>" + \ end="^=end\>" + \ contains=p6PodDelimCodeTypeRegion + \ keepend + \ extend + +syn region p6PodDelimCodeTypeRegion + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze=end\>" + \ contained + \ contains=p6PodDelimCode,p6PodDelimConfigRegion + +syn region p6PodDelimCode + \ start="^" + \ end="^\ze=end\>" + \ contained + \ contains=@p6PodNestedBlocks + +" Delimited blocks (implicit code allowed) +syn region p6PodDelimRegion + \ matchgroup=p6PodPrefix + \ start="^=begin\>\ze\s*\%(pod\|item\|nested\|\u\+\)\>" + \ end="^=end\>" + \ contains=p6PodDelimTypeRegion + \ keepend + \ extend + +syn region p6PodDelimTypeRegion + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="^\ze=end\>" + \ contained + \ contains=p6PodDelim,p6PodDelimConfigRegion + +syn region p6PodDelim + \ start="^" + \ end="^\ze=end\>" + \ contained + \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode + +" Delimited block to end-of-file +syn region p6PodDelimRegion + \ matchgroup=p6PodPrefix + \ start="^=begin\>\ze\s\+END\>" + \ end="\%$" + \ contains=p6PodDelimEOFTypeRegion + \ extend + +syn region p6PodDelimEOFTypeRegion + \ matchgroup=p6PodType + \ start="\K\k*" + \ end="\%$" + \ contained + \ contains=p6PodDelimEOF,p6PodDelimConfigRegion + +syn region p6PodDelimEOF + \ start="^" + \ end="\%$" + \ contained + \ contains=@p6PodNestedBlocks,@p6PodFormat,p6PodImplicitCode + +syn cluster p6PodConfig + \ add=p6PodConfigOperator + \ add=p6PodExtraConfig + \ add=p6StringAuto + \ add=p6PodAutoQuote + \ add=p6StringSQ + +syn region p6PodParens + \ start="(" + \ end=")" + \ contained + \ contains=p6Number,p6StringSQ + +syn match p6PodAutoQuote display contained "=>" +syn match p6PodConfigOperator display contained ":!\?" nextgroup=p6PodConfigOption +syn match p6PodConfigOption display contained "[^[:space:](<]\+" nextgroup=p6PodParens,p6StringAngle +syn match p6PodExtraConfig display contained "^=" +syn match p6PodVerticalBar display contained "|" +syn match p6PodColon display contained ":" +syn match p6PodSemicolon display contained ";" +syn match p6PodComma display contained "," +syn match p6PodImplicitCode display contained "^\s.*" + +syn region p6PodDelimEndRegion + \ matchgroup=p6PodType + \ start="\%(^=end\>\)\@<=" + \ end="\K\k*" + +" These may appear inside delimited blocks +syn cluster p6PodNestedBlocks + \ add=p6PodAbbrRegion + \ add=p6PodDirectRegion + \ add=p6PodParaRegion + \ add=p6PodDelimRegion + \ add=p6PodDelimEndRegion + +" Pod formatting codes + +syn cluster p6PodFormat + \ add=p6PodFormatOne + \ add=p6PodFormatTwo + \ add=p6PodFormatThree + \ add=p6PodFormatFrench + +" Balanced angles found inside formatting codes. Ensures proper nesting. + +syn region p6PodFormatAnglesOne + \ matchgroup=p6PodFormat + \ start="<" + \ skip="<[^>]*>" + \ end=">" + \ transparent + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne + +syn region p6PodFormatAnglesTwo + \ matchgroup=p6PodFormat + \ start="<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ transparent + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo + +syn region p6PodFormatAnglesThree + \ matchgroup=p6PodFormat + \ start="<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ transparent + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree + +syn region p6PodFormatAnglesFrench + \ matchgroup=p6PodFormat + \ start="«" + \ skip="«[^»]*»" + \ end="»" + \ transparent + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatAnglesOne,p6PodFormatAnglesTwo,p6PodFormatAnglesThree + +" All formatting codes + +syn region p6PodFormatOne + \ matchgroup=p6PodFormatCode + \ start="\u<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne + +syn region p6PodFormatTwo + \ matchgroup=p6PodFormatCode + \ start="\u<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo + +syn region p6PodFormatThree + \ matchgroup=p6PodFormatCode + \ start="\u<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree + +syn region p6PodFormatFrench + \ matchgroup=p6PodFormatCode + \ start="\u«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree + +" C<> and V<> don't allow nested formatting formatting codes + +syn region p6PodFormatOne + \ matchgroup=p6PodFormatCode + \ start="[CV]<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=p6PodFormatAnglesOne + +syn region p6PodFormatTwo + \ matchgroup=p6PodFormatCode + \ start="[CV]<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=p6PodFormatAnglesTwo + +syn region p6PodFormatThree + \ matchgroup=p6PodFormatCode + \ start="[CV]<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=p6PodFormatAnglesThree + +syn region p6PodFormatFrench + \ matchgroup=p6PodFormatCode + \ start="[CV]«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=p6PodFormatAnglesFrench + +" L<> can have a "|" separator + +syn region p6PodFormatOne + \ matchgroup=p6PodFormatCode + \ start="L<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar + +syn region p6PodFormatTwo + \ matchgroup=p6PodFormatCode + \ start="L<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar + +syn region p6PodFormatThree + \ matchgroup=p6PodFormatCode + \ start="L<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar + +syn region p6PodFormatFrench + \ matchgroup=p6PodFormatCode + \ start="L«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar + +" E<> can have a ";" separator + +syn region p6PodFormatOne + \ matchgroup=p6PodFormatCode + \ start="E<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodSemiColon + +syn region p6PodFormatTwo + \ matchgroup=p6PodFormatCode + \ start="E<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodSemiColon + +syn region p6PodFormatThree + \ matchgroup=p6PodFormatCode + \ start="E<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon + +syn region p6PodFormatFrench + \ matchgroup=p6PodFormatCode + \ start="E«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodSemiColon + +" M<> can have a ":" separator + +syn region p6PodFormatOne + \ matchgroup=p6PodFormatCode + \ start="M<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodColon + +syn region p6PodFormatTwo + \ matchgroup=p6PodFormatCode + \ start="M<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodColon + +syn region p6PodFormatThree + \ matchgroup=p6PodFormatCode + \ start="M<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon + +syn region p6PodFormatFrench + \ matchgroup=p6PodFormatCode + \ start="M«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodColon + +" D<> can have "|" and ";" separators + +syn region p6PodFormatOne + \ matchgroup=p6PodFormatCode + \ start="D<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon + +syn region p6PodFormatTwo + \ matchgroup=p6PodFormatCode + \ start="D<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=p6PodFormatAngleTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon + +syn region p6PodFormatThree + \ matchgroup=p6PodFormatCode + \ start="D<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon + +syn region p6PodFormatFrench + \ matchgroup=p6PodFormatCode + \ start="D«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon + +" X<> can have "|", "," and ";" separators + +syn region p6PodFormatOne + \ matchgroup=p6PodFormatCode + \ start="X<" + \ skip="<[^>]*>" + \ end=">" + \ contained + \ contains=p6PodFormatAnglesOne,p6PodFormatFrench,p6PodFormatOne,p6PodVerticalBar,p6PodSemiColon,p6PodComma + +syn region p6PodFormatTwo + \ matchgroup=p6PodFormatCode + \ start="X<<" + \ skip="<<[^>]*>>" + \ end=">>" + \ contained + \ contains=p6PodFormatAnglesTwo,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodVerticalBar,p6PodSemiColon,p6PodComma + +syn region p6PodFormatThree + \ matchgroup=p6PodFormatCode + \ start="X<<<" + \ skip="<<<[^>]*>>>" + \ end=">>>" + \ contained + \ contains=p6PodFormatAnglesThree,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma + +syn region p6PodFormatFrench + \ matchgroup=p6PodFormatCode + \ start="X«" + \ skip="«[^»]*»" + \ end="»" + \ contained + \ contains=p6PodFormatAnglesFrench,p6PodFormatFrench,p6PodFormatOne,p6PodFormatTwo,p6PodFormatThree,p6PodVerticalBar,p6PodSemiColon,p6PodComma + +" Define the default highlighting. +" For version 5.7 and earlier: only when not done already +" For version 5.8 and later: only when an item doesn't have highlighting yet +if version >= 508 || !exists("did_perl6_syntax_inits") + if version < 508 + let did_perl6_syntax_inits = 1 + command -nargs=+ HiLink hi link <args> + else + command -nargs=+ HiLink hi def link <args> + endif + + HiLink p6EscOctOld p6Error + HiLink p6PackageTwigil p6Twigil + HiLink p6StringAngle p6String + HiLink p6StringFrench p6String + HiLink p6StringAngles p6String + HiLink p6StringSQ p6String + HiLink p6StringDQ p6String + HiLink p6StringQ p6String + HiLink p6RxStringSQ p6String + HiLink p6RxStringDQ p6String + HiLink p6Substitution p6String + HiLink p6Transliteration p6String + HiLink p6StringAuto p6String + HiLink p6StringP5Auto p6String + HiLink p6Key p6String + HiLink p6Match p6String + HiLink p6RegexBlock p6String + HiLink p6RxP5CharClass p6String + HiLink p6RxP5QuoteMeta p6String + HiLink p6RxCharClass p6String + HiLink p6RxQuoteWords p6String + HiLink p6ReduceOp p6Operator + HiLink p6ReverseCrossOp p6Operator + HiLink p6HyperOp p6Operator + HiLink p6QuoteQ p6Operator + HiLink p6RxRange p6StringSpecial + HiLink p6RxAnchor p6StringSpecial + HiLink p6RxP5Anchor p6StringSpecial + HiLink p6CodePoint p6StringSpecial + HiLink p6RxMeta p6StringSpecial + HiLink p6RxP5Range p6StringSpecial + HiLink p6RxP5CPId p6StringSpecial + HiLink p6RxP5Posix p6StringSpecial + HiLink p6RxP5Mod p6StringSpecial + HiLink p6RxP5HexSeq p6StringSpecial + HiLink p6RxP5OctSeq p6StringSpecial + HiLink p6RxP5WriteRefId p6StringSpecial + HiLink p6HexSequence p6StringSpecial + HiLink p6OctSequence p6StringSpecial + HiLink p6RxP5Named p6StringSpecial + HiLink p6RxP5PropId p6StringSpecial + HiLink p6RxP5Quantifier p6StringSpecial + HiLink p6RxP5CountId p6StringSpecial + HiLink p6RxP5Verb p6StringSpecial + HiLink p6Escape p6StringSpecial2 + HiLink p6EscNull p6StringSpecial2 + HiLink p6EscHash p6StringSpecial2 + HiLink p6EscQQ p6StringSpecial2 + HiLink p6EscQuote p6StringSpecial2 + HiLink p6EscDoubleQuote p6StringSpecial2 + HiLink p6EscBackTick p6StringSpecial2 + HiLink p6EscForwardSlash p6StringSpecial2 + HiLink p6EscVerticalBar p6StringSpecial2 + HiLink p6EscExclamation p6StringSpecial2 + HiLink p6EscDollar p6StringSpecial2 + HiLink p6EscOpenCurly p6StringSpecial2 + HiLink p6EscCloseCurly p6StringSpecial2 + HiLink p6EscCloseBracket p6StringSpecial2 + HiLink p6EscCloseAngle p6StringSpecial2 + HiLink p6EscCloseFrench p6StringSpecial2 + HiLink p6EscBackSlash p6StringSpecial2 + HiLink p6RxEscape p6StringSpecial2 + HiLink p6RxCapture p6StringSpecial2 + HiLink p6RxAlternation p6StringSpecial2 + HiLink p6RxP5 p6StringSpecial2 + HiLink p6RxP5ReadRef p6StringSpecial2 + HiLink p6RxP5Oct p6StringSpecial2 + HiLink p6RxP5Hex p6StringSpecial2 + HiLink p6RxP5EscMeta p6StringSpecial2 + HiLink p6RxP5Meta p6StringSpecial2 + HiLink p6RxP5Escape p6StringSpecial2 + HiLink p6RxP5CodePoint p6StringSpecial2 + HiLink p6RxP5WriteRef p6StringSpecial2 + HiLink p6RxP5Prop p6StringSpecial2 + + HiLink p6Property Tag + HiLink p6Attention Todo + HiLink p6Type Type + HiLink p6Error Error + HiLink p6BlockLabel Label + HiLink p6Float Float + HiLink p6Normal Normal + HiLink p6Package Normal + HiLink p6PackageScope Normal + HiLink p6Number Number + HiLink p6VersionNum Number + HiLink p6String String + HiLink p6Repeat Repeat + HiLink p6Keyword Keyword + HiLink p6Pragma Keyword + HiLink p6Module Keyword + HiLink p6DeclareRoutine Keyword + HiLink p6VarStorage Special + HiLink p6FlowControl Special + HiLink p6NumberBase Special + HiLink p6Twigil Special + HiLink p6StringSpecial2 Special + HiLink p6VersionDot Special + HiLink p6Comment Comment + HiLink p6Include Include + HiLink p6Shebang PreProc + HiLink p6ClosureTrait PreProc + HiLink p6Routine Function + HiLink p6Operator Operator + HiLink p6Version Operator + HiLink p6Context Operator + HiLink p6Quote Delimiter + HiLink p6TypeConstraint PreCondit + HiLink p6Exception Exception + HiLink p6Placeholder Identifier + HiLink p6Variable Identifier + HiLink p6VarSlash Identifier + HiLink p6VarNum Identifier + HiLink p6VarExclam Identifier + HiLink p6VarMatch Identifier + HiLink p6VarName Identifier + HiLink p6MatchVar Identifier + HiLink p6RxP5ReadRefId Identifier + HiLink p6RxP5ModDef Identifier + HiLink p6RxP5ModName Identifier + HiLink p6Conditional Conditional + HiLink p6StringSpecial SpecialChar + + HiLink p6PodAbbr p6Pod + HiLink p6PodAbbrEOF p6Pod + HiLink p6PodAbbrNoCode p6Pod + HiLink p6PodAbbrCode p6PodCode + HiLink p6PodPara p6Pod + HiLink p6PodParaEOF p6Pod + HiLink p6PodParaNoCode p6Pod + HiLink p6PodParaCode p6PodCode + HiLink p6PodDelim p6Pod + HiLink p6PodDelimEOF p6Pod + HiLink p6PodDelimNoCode p6Pod + HiLink p6PodDelimCode p6PodCode + HiLink p6PodImplicitCode p6PodCode + HiLink p6PodExtraConfig p6PodPrefix + HiLink p6PodVerticalBar p6PodFormatCode + HiLink p6PodColon p6PodFormatCode + HiLink p6PodSemicolon p6PodFormatCode + HiLink p6PodComma p6PodFormatCode + HiLink p6PodFormatOne p6PodFormat + HiLink p6PodFormatTwo p6PodFormat + HiLink p6PodFormatThree p6PodFormat + HiLink p6PodFormatFrench p6PodFormat + + HiLink p6PodType Type + HiLink p6PodConfigOption String + HiLink p6PodCode PreProc + HiLink p6Pod Comment + HiLink p6PodComment Comment + HiLink p6PodAutoQuote Operator + HiLink p6PodConfigOperator Operator + HiLink p6PodPrefix Statement + HiLink p6PodName Identifier + HiLink p6PodFormatCode SpecialChar + HiLink p6PodFormat SpecialComment + + delcommand HiLink +endif + +" Syncing to speed up processing +"syn sync match p6SyncPod groupthere p6PodAbbrRegion "^=\K\k*\>" +"syn sync match p6SyncPod groupthere p6PodDirectRegion "^=\%(config\|use\|encoding\)\>" +"syn sync match p6SyncPod groupthere p6PodParaRegion "^=for\>" +"syn sync match p6SyncPod groupthere p6PodDelimRegion "^=begin\>" +"syn sync match p6SyncPod groupthere p6PodDelimEndRegion "^=end\>" + +" Let's just sync whole file, the other methods aren't reliable (or I don't +" know how to use them reliably) +syn sync fromstart + +setlocal foldmethod=syntax + +let b:current_syntax = "perl6" + +" vim:ts=8:sts=4:sw=4:expandtab:ft=vim diff --git a/runtime/syntax/rhelp.vim b/runtime/syntax/rhelp.vim index fa585b286..98e5bc0c6 100644 --- a/runtime/syntax/rhelp.vim +++ b/runtime/syntax/rhelp.vim @@ -1,14 +1,17 @@ " Vim syntax file " Language: R Help File " Maintainer: Johannes Ranke <jranke@uni-bremen.de> -" Last Change: 2009 Mai 12 -" Version: 0.7.2 -" SVN: $Id: rhelp.vim 86 2009-05-12 19:23:47Z ranke $ +" Last Change: 2010 Apr 22 +" Version: 0.7.3 +" SVN: $Id: rhelp.vim 88 2010-04-22 19:37:09Z ranke $ " Remarks: - Now includes R syntax highlighting in the appropriate " sections if an r.vim file is in the same directory or in the " default debian location. " - There is no Latex markup in equations " - Thanks to Will Gray for finding and fixing a bug +" - No support for \if, \ifelse and \out as I don't understand +" them and have no examples at hand (help welcome). +" - No support for \var tag within quoted string (dito) " Version Clears: {{{1 " For version 5.x: Clear all syntax items @@ -37,6 +40,7 @@ syn region rhelpRcode matchgroup=Delimiter start="\\synopsis{" matchgroup=Delimi syn region rhelpRcode matchgroup=Delimiter start="\\special{" matchgroup=Delimiter transparent end=/}/ contains=@R contained syn region rhelpRcode matchgroup=Delimiter start="\\code{" matchgroup=Delimiter transparent end=/}/ contains=@R,rhelpLink contained syn region rhelpS4method matchgroup=Delimiter start="\\S4method{.*}(" matchgroup=Delimiter transparent end=/)/ contains=@R,rhelpDots contained +syn region rhelpSexpr matchgroup=Delimiter start="\\Sexpr{" matchgroup=Delimiter transparent end=/}/ contains=@R " Strings {{{1 syn region rhelpString start=/"/ end=/"/ @@ -55,6 +59,56 @@ syn match rhelpKeyword "--" syn match rhelpKeyword "---" syn match rhelpKeyword "<" syn match rhelpKeyword ">" +syn match rhelpKeyword "\\ge" +syn match rhelpKeyword "\\le" +syn match rhelpKeyword "\\alpha" +syn match rhelpKeyword "\\beta" +syn match rhelpKeyword "\\gamma" +syn match rhelpKeyword "\\delta" +syn match rhelpKeyword "\\epsilon" +syn match rhelpKeyword "\\zeta" +syn match rhelpKeyword "\\eta" +syn match rhelpKeyword "\\theta" +syn match rhelpKeyword "\\iota" +syn match rhelpKeyword "\\kappa" +syn match rhelpKeyword "\\lambda" +syn match rhelpKeyword "\\mu" +syn match rhelpKeyword "\\nu" +syn match rhelpKeyword "\\xi" +syn match rhelpKeyword "\\omicron" +syn match rhelpKeyword "\\pi" +syn match rhelpKeyword "\\rho" +syn match rhelpKeyword "\\sigma" +syn match rhelpKeyword "\\tau" +syn match rhelpKeyword "\\upsilon" +syn match rhelpKeyword "\\phi" +syn match rhelpKeyword "\\chi" +syn match rhelpKeyword "\\psi" +syn match rhelpKeyword "\\omega" +syn match rhelpKeyword "\\Alpha" +syn match rhelpKeyword "\\Beta" +syn match rhelpKeyword "\\Gamma" +syn match rhelpKeyword "\\Delta" +syn match rhelpKeyword "\\Epsilon" +syn match rhelpKeyword "\\Zeta" +syn match rhelpKeyword "\\Eta" +syn match rhelpKeyword "\\Theta" +syn match rhelpKeyword "\\Iota" +syn match rhelpKeyword "\\Kappa" +syn match rhelpKeyword "\\Lambda" +syn match rhelpKeyword "\\Mu" +syn match rhelpKeyword "\\Nu" +syn match rhelpKeyword "\\Xi" +syn match rhelpKeyword "\\Omicron" +syn match rhelpKeyword "\\Pi" +syn match rhelpKeyword "\\Rho" +syn match rhelpKeyword "\\Sigma" +syn match rhelpKeyword "\\Tau" +syn match rhelpKeyword "\\Upsilon" +syn match rhelpKeyword "\\Phi" +syn match rhelpKeyword "\\Chi" +syn match rhelpKeyword "\\Psi" +syn match rhelpKeyword "\\Omega" " Links {{{1 syn region rhelpLink matchgroup=rhelpSection start="\\link{" end="}" contained keepend @@ -112,6 +166,7 @@ syn match rhelpSection "\\donttest\>" " Freely named Sections {{{1 syn region rhelpFreesec matchgroup=Delimiter start="\\section{" matchgroup=Delimiter transparent end=/}/ +syn region rhelpFreesubsec matchgroup=Delimiter start="\\subsection{" matchgroup=Delimiter transparent end=/}/ " R help file comments {{{1 syn match rhelpComment /%.*$/ contained diff --git a/runtime/syntax/sh.vim b/runtime/syntax/sh.vim index 6ef4fba10..2b1269fc0 100644 --- a/runtime/syntax/sh.vim +++ b/runtime/syntax/sh.vim @@ -2,8 +2,8 @@ " Language: shell (sh) Korn shell (ksh) bash (sh) " Maintainer: Dr. Charles E. Campbell, Jr. <NdrOchipS@PcampbellAfamily.Mbiz> " Previous Maintainer: Lennart Schultz <Lennart.Schultz@ecmwf.int> -" Last Change: Nov 17, 2009 -" Version: 110 +" Last Change: Apr 12, 2010 +" Version: 111 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " For options and settings, please use: :help ft-sh-syntax " This file includes many ideas from Éric Brunet (eric.brunet@ens.fr) @@ -59,7 +59,7 @@ if !exists("s:sh_fold_ifdofor") let s:sh_fold_ifdofor = 4 endif if g:sh_fold_enabled && &fdm == "manual" - set fdm=syntax + setlocal fdm=syntax endif " sh syntax is case sensitive {{{1 @@ -157,7 +157,7 @@ syn region shSubSh transparent matchgroup=shSubShRegion start="(" end=")" contai " Tests: {{{1 "======= -syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$+ end="\]" contains=@shTestList,shSpecial +syn region shExpr matchgroup=shRange start="\[" skip=+\\\\\|\\$\|\[+ end="\]" contains=@shTestList,shSpecial syn region shTest transparent matchgroup=shStatement start="\<test\s" skip=+\\\\\|\\$+ matchgroup=NONE end="[;&|]"me=e-1 end="$" contains=@shExprList1 syn match shTestOpr contained "<=\|>=\|!=\|==\|-.\>\|-\(nt\|ot\|ef\|eq\|ne\|lt\|le\|gt\|ge\)\>\|[!<>]" syn match shTestOpr contained '=' skipwhite nextgroup=shTestDoubleQuote,shTestSingleQuote,shTestPattern diff --git a/runtime/syntax/sisu.vim b/runtime/syntax/sisu.vim index c7cdf2df1..6944782f0 100644 --- a/runtime/syntax/sisu.vim +++ b/runtime/syntax/sisu.vim @@ -1,6 +1,6 @@ "SiSU Vim syntax file "SiSU Maintainer: Ralph Amissah <ralph@amissah.com> -"SiSU Markup: SiSU (sisu-0.69.0, 2008-09-16) +"SiSU Markup: SiSU (sisu-2.0.1, 2010-03-17) "(originally looked at Ruby Vim by Mirko Nasato) if version < 600 @@ -16,25 +16,26 @@ syn match sisu_error contains=sisu_link,sisu_error_wspace "<![^ei]\S\+!>" " Markers Identifiers: if !exists("sisu_no_identifiers") syn match sisu_mark_endnote "\~^" - syn match sisu_contain contains=@NoSpell "</\?sub>" syn match sisu_break contains=@NoSpell "<br>\|<br />" - syn match sisu_control contains=@NoSpell "<p>\|</p>\|<p />\|<:p[bn]>" - syn match sisu_html "<center>\|</center>" + syn match sisu_control contains=@NoSpell "<:p[bn]>" syn match sisu_marktail "[~-]#" - syn match sisu_html contains=@NoSpell "<td>\|<td \|<tr>\|</td>\|</tr>\|<table>\|<table \|</table>" syn match sisu_control "\"" syn match sisu_underline "\(^\| \)_[a-zA-Z0-9]\+_\([ .,]\|$\)" syn match sisu_number contains=@NoSpell "[0-9a-f]\{32\}\|[0-9a-f]\{64\}" syn match sisu_link contains=@NoSpell "\(_\?https\?://\|\.\.\/\)\S\+" - "metaverse specific - syn match sisu_ocn contains=@NoSpell "<\~\d\+;\w\d\+;\w\d\+>" - syn match sisu_marktail "<\~#>" - syn match sisu_markpara contains=@NoSpell "<:i[1-9]>" syn match sisu_link " \*\~\S\+" syn match sisu_action "^<:insert\d\+>" syn match sisu_require contains=@NoSpell "^<<\s*[a-zA-Z0-9^._-]\+\.ss[it]$" syn match sisu_require contains=@NoSpell "^<<{[a-zA-Z0-9^._-]\+\.ss[it]}$" - syn match sisu_contain "<:e>" + syn match sisu_structure "^:A\~$" + syn match sisu_sub_header_title "^\s\+:\(subtitle\|short\|edition\|language\|note\):\s" "group=sisu_header_content + syn match sisu_sub_header_creator "^\s\+:\(author\|translator\|illustrator\|photographer\|audio\|digitized_by\|prepared_by\):\s" + syn match sisu_sub_header_rights "^\s\+:\(copyright\|text\|translation\|illustrations\|photographs\|audio\|digitization\|license\|all\):\s" "access_rights license + syn match sisu_sub_header_classify "^\s\+:\(type\|subject\|topic_register\|keywords\|coverage\|relation\|format\|identifier\|isbn\|dewey\|loc\|pg\):\s" + syn match sisu_sub_header_dates "^\s\+:\(published\|available\|created\|issued\|valid\|modified\|added_to_site\|translated\|original_publication\):\s" + syn match sisu_sub_header_original "^\s\+:\(publisher\|date\|language\|institution\|nationality\|source\):\s" + syn match sisu_sub_header_make "^\s\+:\(headings\|num_top\|breaks\|italics\|bold\|skin\|stamp\|promo\|ad\|manpage\):\s" + syn match sisu_sub_header_notes "^\s\+:\(comment\|abstract\|description\|history\|prefix\|prefix_[ab]\):\s" syn match sisu_sem_marker ";{\|};[a-z._]*[a-z]" syn match sisu_sem_marker_block "\([a-z][a-z._]*\|\):{\|}:[a-z._]*[a-z]" syn match sisu_sem_ex_marker ";\[\|\];[a-z._]*[a-z]" @@ -57,19 +58,28 @@ syn match sisu_error contains=sisu_error "<a href\|</a>]" "url/link syn region sisu_link contains=sisu_error,sisu_error_wspace matchgroup=sisu_action start="^<<\s*|[a-zA-Z0-9^._-]\+|@|[a-zA-Z0-9^._-]\+|"rs=s+2 end="$" "header -syn region sisu_header_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break matchgroup=sisu_header start="^0\~\(\S\+\|[^-]\)" end="\n$" -syn region sisu_header_content contains=sisu_error,sisu_error_wspace,sisu_content_alt,sisu_link,sisu_linked,sisu_break matchgroup=sisu_header start="^[@%]\S\+:[+-]\?\s"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_title matchgroup=sisu_header start="^[@]title:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_creator matchgroup=sisu_header start="^[@]creator:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_rights matchgroup=sisu_header start="^[@]rights:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_classify matchgroup=sisu_header start="^[@]classify:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_dates matchgroup=sisu_header start="^[@]date:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_make matchgroup=sisu_header start="^[@]make:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_publisher matchgroup=sisu_header start="^[@]publisher:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_notes matchgroup=sisu_header start="^[@]notes:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_original matchgroup=sisu_header start="^[@]original:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_link,sisu_sub_header_source matchgroup=sisu_header start="^[@]source:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" +syn region sisu_header_content contains=sisu_error,sisu_comment,sisu_break,sisu_linked,sisu_sub_header_links matchgroup=sisu_header start="^[@]links:[+-]\?\(\s\|\n\)"rs=e-1 end="\n$" "headings syn region sisu_heading contains=sisu_mark_endnote,sisu_content_endnote,sisu_marktail,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_ocn,sisu_error,sisu_error_wspace matchgroup=sisu_structure start="^\([1-8]\|:\?[A-C]\)\~\(\S\+\|[^-]\)" end="$" "grouped text syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^table{.\+" end="}table" -syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n\n" +syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^{\(t\|table\)\(\~h\)\?\(\sc[0-9]\+;\)\?[0-9; ]*}" end="\n$" syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="^\(alt\|group\|poem\){" end="^}\(alt\|group\|poem\)" syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="^code{" end="^}code" "endnotes syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker matchgroup=sisu_mark_endnote start="\~{[*+]*" end="}\~" skip="\n" syn region sisu_content_endnote contains=sisu_link,sisu_strikeout,sisu_underline,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break,sisu_sem_block,sisu_sem_content,sisu_sem_marker matchgroup=sisu_mark_endnote start="\~\[[*+]*" end="\]\~" skip="\n" -syn region sisu_content_endnote contains=sisu_strikeout,sisu_number,sisu_control,sisu_link,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\^\~" end="\n\n" +syn region sisu_content_endnote contains=sisu_strikeout,sisu_number,sisu_control,sisu_link,sisu_identifier,sisu_error,sisu_error_wspace,sisu_mark,sisu_break matchgroup=sisu_mark_endnote start="\^\~" end="\n$" "links and images syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="}\(https\?:/\/\|\.\./\)\S\+" oneline syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_sem_block,sisu_error matchgroup=sisu_link start="{\(\~^\s\)\?" end="\[[1-5][sS]*\]}\S\+\.ss[tm]" oneline @@ -78,7 +88,6 @@ syn region sisu_linked contains=sisu_fontface,sisu_strikeout,sisu_number,sisu_co syn region sisu_control contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_error,sisu_error_wspace matchgroup=sisu_control start="\(\(^\| \)!_ \|<:b>\)" end="$" syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_sem_block,sisu_sem_content,sisu_sem_marker_block,sisu_sem_marker,sisu_sem_ex_marker_block,sisu_sem_ex_marker,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^_\([1-9*]\|[1-9]\*\) " end="$" syn region sisu_normal contains=sisu_strikeout,sisu_identifier,sisu_content_endnote,sisu_mark_endnote,sisu_link,sisu_linked,sisu_error,sisu_error_wspace matchgroup=sisu_markpara start="^\(#[ 1]\|_# \)" end="$" -syn region sisu_comment matchgroup=sisu_comment start="^%\{1,2\} " end="$" "font face curly brackets "syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_sem start="\S\+:{" end="}:[^<>,.!?:; ]\+" oneline syn region sisu_index matchgroup=sisu_index_block start="^={" end="}" @@ -96,18 +105,6 @@ syn region sisu_control contains=sisu_error matchgroup=sisu_control start="\([ ( syn region sisu_identifier contains=sisu_error matchgroup=sisu_content_alt start="\([ ]\|^\)/[^{ \|\n\\]"hs=e-1 end="/\[ \.\]" skip="[a-zA-Z0-9']" oneline "misc syn region sisu_identifier contains=sisu_error matchgroup=sisu_fontface start="\^[^ {\|\n\\]"rs=s+1 end="\^[ ,.;:'})\\\n]" skip="[a-zA-Z0-9']" oneline -"metaverse html (flagged as errors for filetype sisu) -syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<b>" end="</b>" skip="\n" oneline -syn region sisu_control contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<em>" end="</em>" skip="\n" oneline -syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<i>" end="</i>" skip="\n" oneline -syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<u>" end="</u>" skip="\n" oneline -syn region sisu_identifier contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error,sisu_mark matchgroup=sisu_html start="<ins>" end="</ins>" skip="\\\\\|\\'" oneline -syn region sisu_identifier contains=sisu_error matchgroup=sisu_html start="<del>" end="</del>" oneline -"metaverse -syn region sisu_content_alt contains=sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="<:Table.\{-}>" end="<:Table[-_]end>" -syn region sisu_content_alt contains=sisu_error matchgroup=sisu_contain start="<:code>" end="<:code[-_]end>" -syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="<:alt>" end="<:alt[-_]end>" -syn region sisu_content_alt contains=sisu_mark_endnote,sisu_content_endnote,sisu_link,sisu_mark,sisu_strikeout,sisu_number,sisu_control,sisu_identifier,sisu_error matchgroup=sisu_contain start="<:poem>" end="<:poem[-_]end>" "Expensive Mode: if !exists("sisu_no_expensive") @@ -120,18 +117,19 @@ syn match sisu_control contains=sisu_error,sisu_error_wspace "4\~! \S\+" syn region sisu_markpara contains=sisu_error,sisu_error_wspace start="^=begin" end="^=end.*$" "Errors: -syn match sisu_error_wspace contains=sisu_error_wspace "^\s\+" +syn match sisu_error_wspace contains=sisu_error_wspace "^\s\+[^:]" syn match sisu_error_wspace contains=sisu_error_wspace "\s\s\+" -syn match sisu_error_wspace contains=sisu_error_wspace " \s*$" +syn match sisu_error_wspace contains=sisu_error_wspace " \s*$" syn match sisu_error contains=sisu_error_wspace "\t\+" syn match sisu_error contains=sisu_error,sisu_error_wspace "\([^ (][_\\]\||[^ (}]\)https\?:\S\+" syn match sisu_error contains=sisu_error "_\?https\?:\S\+[}><]" -syn match sisu_error contains=sisu_error "\([!*/_\+,^]\){\([^(\}\1)]\)\{-}\n\n" -syn match sisu_error contains=sisu_error "^[\~]{[^{]\{-}\n\n" +syn match sisu_error contains=sisu_error "\([!*/_\+,^]\){\([^(\}\1)]\)\{-}\n$" +syn match sisu_error contains=sisu_error "^[\~]{[^{]\{-}\n$" syn match sisu_error contains=sisu_error "\s\+.{{" syn match sisu_error contains=sisu_error "^\~\s*$" -syn match sisu_error contains=sisu_error "^[0-9]\~\s*$" -syn match sisu_error contains=sisu_error "^[0-9]\~\S\+\s*$" +syn match sisu_error contains=sisu_error "^0\~.*" +syn match sisu_error contains=sisu_error "^[1-9]\~\s*$" +syn match sisu_error contains=sisu_error "^[1-9]\~\S\+\s*$" syn match sisu_error contains=sisu_error "[^{]\~\^[^ \)]" syn match sisu_error contains=sisu_error "\~\^\s\+\.\s*" syn match sisu_error contains=sisu_error "{\~^\S\+" @@ -140,55 +138,67 @@ syn match sisu_error contains=sisu_error "[^ (\"'(\[][_/\*!]{\|}[_/\*!][a-zA-Z0- syn match sisu_error contains=sisu_error "<dir>" "errors for filetype sisu, though not error in 'metaverse': syn match sisu_error contains=sisu_error,sisu_match,sisu_strikeout,sisu_contain,sisu_content_alt,sisu_mark,sisu_break,sisu_number "<[a-zA-Z\/]\+>" -syn match sisu_error "/\?<\([biu]\)>[^(</\1>)]\{-}\n\n" +syn match sisu_error "/\?<\([biu]\)>[^(</\1>)]\{-}\n$" "Error Exceptions: -syn match sisu_control "\n\n" "contains=ALL +syn match sisu_control "\n$" "contains=ALL syn match sisu_control " //" -syn match sisu_error "%{" -syn match sisu_error "<br>_\?https\?:\S\+\|_\?https\?:\S\+<br>" -syn match sisu_error "[><]_\?https\?:\S\+\|_\?https\?:\S\+[><]" +syn match sisu_error "%{" +syn match sisu_error "<br>_\?https\?:\S\+\|_\?https\?:\S\+<br>" +syn match sisu_error "[><]_\?https\?:\S\+\|_\?https\?:\S\+[><]" +syn match sisu_comment "^%\{1,2\}.\+" "Definitions Default Highlighting: -hi def link sisu_normal Normal -hi def link sisu_header PreProc -hi def link sisu_header_content Statement -hi def link sisu_heading Title -hi def link sisu_structure Operator -hi def link sisu_contain Include -hi def link sisu_mark_endnote Include -hi def link sisu_require NonText -hi def link sisu_link NonText -hi def link sisu_linked String -hi def link sisu_fontface Include -hi def link sisu_strikeout DiffDelete -hi def link sisu_content_alt Special -hi def link sisu_sem_content SpecialKey -hi def link sisu_sem_block Special -hi def link sisu_sem_marker Visual -"hi def link sisu_sem_marker Structure -hi def link sisu_sem_marker_block MatchParen -hi def link sisu_sem_ex_marker FoldColumn -hi def link sisu_sem_ex_marker_block Folded -hi def link sisu_sem_ex_content Comment -"hi def link sisu_sem_ex_content SpecialKey -hi def link sisu_sem_ex_block Comment -hi def link sisu_index SpecialKey -hi def link sisu_index_block Visual -hi def link sisu_content_endnote Special -hi def link sisu_control Define -hi def link sisu_ocn Include -hi def link sisu_number Number -hi def link sisu_identifier Function -hi def link sisu_underline Underlined -hi def link sisu_markpara Include -hi def link sisu_marktail Include -hi def link sisu_mark Identifier -hi def link sisu_break Structure -hi def link sisu_html Type -hi def link sisu_action Identifier -hi def link sisu_comment Comment -hi def link sisu_error_sem_marker Error -hi def link sisu_error_wspace Error -hi def link sisu_error Error +hi def link sisu_normal Normal +hi def link sisu_header PreProc +hi def link sisu_header_content Normal +hi def link sisu_sub_header_title Statement +hi def link sisu_sub_header_creator Statement +hi def link sisu_sub_header_rights Statement +hi def link sisu_sub_header_classify Statement +hi def link sisu_sub_header_dates Statement +hi def link sisu_sub_header_make Statement +hi def link sisu_sub_header_links Statement +hi def link sisu_sub_header_publisher Statement +hi def link sisu_sub_header_notes Statement +hi def link sisu_sub_header_original Statement +hi def link sisu_sub_header_source Statement +hi def link sisu_heading Title +hi def link sisu_structure Operator +hi def link sisu_contain Include +hi def link sisu_mark_endnote Include +hi def link sisu_require NonText +hi def link sisu_link NonText +hi def link sisu_linked String +hi def link sisu_fontface Include +hi def link sisu_strikeout DiffDelete +hi def link sisu_content_alt Special +hi def link sisu_sem_content SpecialKey +hi def link sisu_sem_block Special +hi def link sisu_sem_marker Visual +"hi def link sisu_sem_marker Structure +hi def link sisu_sem_marker_block MatchParen +hi def link sisu_sem_ex_marker FoldColumn +hi def link sisu_sem_ex_marker_block Folded +hi def link sisu_sem_ex_content Comment +"hi def link sisu_sem_ex_content SpecialKey +hi def link sisu_sem_ex_block Comment +hi def link sisu_index SpecialKey +hi def link sisu_index_block Visual +hi def link sisu_content_endnote Special +hi def link sisu_control Define +hi def link sisu_ocn Include +hi def link sisu_number Number +hi def link sisu_identifier Function +hi def link sisu_underline Underlined +hi def link sisu_markpara Include +hi def link sisu_marktail Include +hi def link sisu_mark Identifier +hi def link sisu_break Structure +hi def link sisu_html Type +hi def link sisu_action Identifier +hi def link sisu_comment Comment +hi def link sisu_error_sem_marker Error +hi def link sisu_error_wspace Error +hi def link sisu_error Error let b:current_syntax = "sisu" diff --git a/runtime/syntax/svg.vim b/runtime/syntax/svg.vim new file mode 100644 index 000000000..819b5ec98 --- /dev/null +++ b/runtime/syntax/svg.vim @@ -0,0 +1,15 @@ +" Vim syntax file +" Language: SVG (Scalable Vector Graphics) +" Maintainer: Vincent Berthoux <twinside@gmail.com> +" File Types: .svg (used in Web and vector programs) +" +" Directly call the xml syntax, because SVG is an XML +" dialect. But as some plugins base their effect on filetype, +" providing a distinct filetype from xml is better. + +if exists("b:current_syntax") + finish +endif + +runtime! syntax/xml.vim +let b:current_syntax = "svg" diff --git a/runtime/syntax/tex.vim b/runtime/syntax/tex.vim index ff171d374..6235df118 100644 --- a/runtime/syntax/tex.vim +++ b/runtime/syntax/tex.vim @@ -1,8 +1,8 @@ " Vim syntax file " Language: TeX " Maintainer: Dr. Charles E. Campbell, Jr. <NdrchipO@ScampbellPfamily.AbizM> -" Last Change: Dec 28, 2009 -" Version: 46 +" Last Change: Apr 14, 2010 +" Version: 47 " URL: http://mysite.verizon.net/astronaut/vim/index.html#vimlinks_syntax " " Notes: {{{1 @@ -77,7 +77,7 @@ elseif g:tex_fold_enabled && !has("folding") echomsg "Ignoring g:tex_fold_enabled=".g:tex_fold_enabled."; need to re-compile vim for +fold support" endif if g:tex_fold_enabled && &fdm == "manual" - set fdm=syntax + setl fdm=syntax endif " (La)TeX keywords: only use the letters a-zA-Z {{{1 diff --git a/runtime/syntax/xs.vim b/runtime/syntax/xs.vim index 9f1054a89..888b1402b 100644 --- a/runtime/syntax/xs.vim +++ b/runtime/syntax/xs.vim @@ -1,53 +1,38 @@ " Vim syntax file -" Language: XS (Perl extension interface language) -" Maintainer: Michael W. Dodge <sarge@pobox.com> -" Last Change: 2001 May 09 - -" For version 5.x: Clear all syntax items -" For version 6.x: Quit when a syntax file was already loaded -if version < 600 - syntax clear -elseif exists("b:current_syntax") - finish +" Language: XS (Perl extension interface language) +" Maintainer: Andy Lester <andy@petdance.com> +" URL: http://github.com/petdance/vim-perl +" Last Change: 2009-08-14 + +" Quit when a syntax file was already loaded +if exists("b:current_syntax") + finish endif " Read the C syntax to start with -if version < 600 - source <sfile>:p:h/c.vim -else - runtime! syntax/c.vim -endif +runtime! syntax/c.vim " XS extentions " TODO: Figure out how to look for trailing '='. -syn keyword xsKeyword MODULE PACKAGE PREFIX -syn keyword xsKeyword OUTPUT: CODE: INIT: PREINIT: INPUT: -syn keyword xsKeyword PPCODE: REQUIRE: CLEANUP: BOOT: -syn keyword xsKeyword VERSIONCHECK: PROTOTYPES: PROTOTYPE: -syn keyword xsKeyword ALIAS: INCLUDE: CASE: +syn keyword xsKeyword MODULE PACKAGE PREFIX +syn keyword xsKeyword OUTPUT: CODE: INIT: PREINIT: INPUT: +syn keyword xsKeyword PPCODE: REQUIRE: CLEANUP: BOOT: +syn keyword xsKeyword VERSIONCHECK: PROTOTYPES: PROTOTYPE: +syn keyword xsKeyword ALIAS: INCLUDE: CASE: " TODO: Figure out how to look for trailing '('. -syn keyword xsMacro SV EXTEND PUSHs -syn keyword xsVariable RETVAL NO_INIT -"syn match xsCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1 -"syn match xsCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" - -" Define the default highlighting. -" For version 5.7 and earlier: only when not done already -" For version 5.8 and later: only when an item doesn't have highlighting yet -if version >= 508 || !exists("did_xs_syntax_inits") - if version < 508 - let did_xs_syntax_inits = 1 - command -nargs=+ HiLink hi link <args> - else - command -nargs=+ HiLink hi def link <args> - endif - - HiLink xsKeyword Keyword - HiLink xsMacro Macro - HiLink xsVariable Identifier - - delcommand HiLink -endif +syn keyword xsMacro SV EXTEND PUSHs +syn keyword xsVariable RETVAL NO_INIT +"syn match xsCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1 +"syn match xsCast "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$" + +" Define the default highlighting, but only when an item doesn't have highlighting yet +command -nargs=+ HiLink hi def link <args> + +HiLink xsKeyword Keyword +HiLink xsMacro Macro +HiLink xsVariable Identifier + +delcommand HiLink let b:current_syntax = "xs" |